:root {
  color-scheme: light dark;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  margin: 0;
  padding: 0;
  background: rgba(120, 120, 120, 0.05);
}

/* ---- App shell (V0.1) ---- */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(120, 120, 120, 0.22);
}

@media (prefers-color-scheme: dark) {
  .topbar {
    background: rgba(20, 20, 20, 0.55);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: rgba(80, 120, 255, 0.75);
  border: 1px solid rgba(80, 120, 255, 0.9);
}

.brand-title {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 18px;
  flex: 1 1 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main {
  min-width: 0;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.h1 {
  margin: 0 0 10px 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  opacity: 0.9;
}

.list {
  margin: 10px 0 0 18px;
  padding: 0;
}

.nav {
  border: 1px solid rgba(120, 120, 120, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  padding: 10px;
}

@media (prefers-color-scheme: dark) {
  .nav {
    background: rgba(20, 20, 20, 0.55);
  }
}

.nav-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
  background: transparent;
  color: inherit;
}

.nav-item:hover {
  background: rgba(120, 120, 120, 0.08);
}

.nav-item.is-active {
  background: rgba(80, 120, 255, 0.18);
  border-color: rgba(80, 120, 255, 0.35);
}

.nav-badge {
  font-size: 11px;
  opacity: 0.7;
  border: 1px solid rgba(120, 120, 120, 0.28);
  padding: 2px 6px;
  border-radius: 999px;
}

.nav-sep {
  height: 1px;
  background: rgba(120, 120, 120, 0.25);
  margin: 10px 2px;
}

.statuspill {
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(120, 120, 120, 0.08);
  white-space: nowrap;
}

.statuspill-unknown {
  border-color: rgba(120, 120, 120, 0.28);
}

.statuspill-ok {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

.statuspill-warn {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.statuspill-error {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.14);
}

.statuscard {
  border: 1px solid rgba(120, 120, 120, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  padding: 12px;
}

@media (prefers-color-scheme: dark) {
  .statuscard {
    background: rgba(20, 20, 20, 0.55);
  }
}

.statuscard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.statuscard-title {
  font-weight: 650;
  font-size: 13px;
}

.statuscard-summary {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.9;
}

.statuscard-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 10px;
  font-size: 12px;
  opacity: 0.9;
}

.statuscard-k {
  opacity: 0.75;
}

.statuscard-v {
  word-break: break-word;
}

.statuscard-error {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.85;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(220, 80, 80, 0.35);
  background: rgba(220, 80, 80, 0.08);
}

.statuscard-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(120, 120, 120, 0.25);
}

.statuscard-subtitle {
  font-weight: 650;
  font-size: 12px;
  opacity: 0.85;
}

.statuslist {
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 12px;
  opacity: 0.95;
}

.statuslist li {
  margin: 4px 0;
}

.muted {
  opacity: 0.8;
  font-size: 14px;
}

.small {
  font-size: 12px;
}

.state-note {
  min-height: 1.2em;
}

.state-note-loading {
  color: rgba(220, 160, 60, 0.95);
}

.state-note-success {
  color: rgba(70, 170, 120, 0.98);
}

.state-note-error {
  color: rgba(220, 80, 80, 0.98);
}

.state-banner {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(120, 120, 120, 0.08);
  font-size: 12px;
}

.state-banner-info {
  border-color: rgba(80, 120, 255, 0.35);
  background: rgba(80, 120, 255, 0.12);
}

.state-banner-empty {
  border-color: rgba(120, 120, 120, 0.35);
  background: rgba(120, 120, 120, 0.12);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ---- Shared cards/panels (used by devtools too) ---- */

.card {
  border: 1px solid rgba(120, 120, 120, 0.35);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
}

@media (prefers-color-scheme: dark) {
  .card {
    background: rgba(20, 20, 20, 0.35);
  }
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.row {
  margin: 12px 0;
}

.row-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.routing-override-card {
  border: 1px solid rgba(120, 120, 120, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(120, 120, 120, 0.03);
}

.routing-override-controls {
  margin-top: 8px;
  align-items: end;
}

.grow {
  flex: 1 1 auto;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.85;
}

.input,
.select,
.textarea,
.button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid rgba(120, 120, 120, 0.35);
  padding: 9px 10px;
}

.input,
.select,
.textarea {
  background: rgba(120, 120, 120, 0.08);
  width: 100%;
  box-sizing: border-box;
}

.input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.button {
  cursor: pointer;
  background: rgba(80, 120, 255, 0.22);
  border-color: rgba(80, 120, 255, 0.55);
  white-space: nowrap;
}

.button-compact {
  padding: 6px 10px;
  font-size: 12px;
}

.button-secondary {
  background: rgba(120, 120, 120, 0.12);
  border-color: rgba(120, 120, 120, 0.35);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.divider {
  border: 0;
  height: 1px;
  background: rgba(120, 120, 120, 0.35);
  margin: 14px 0;
}

.pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(20, 20, 20, 0.06);
  border: 1px solid rgba(120, 120, 120, 0.25);
  border-radius: 10px;
  padding: 10px;
  margin: 0;
  min-height: 44px;
}

.form {
  margin-top: 8px;
}

.create-outcome {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(80, 120, 255, 0.35);
  border-radius: 10px;
  background: rgba(80, 120, 255, 0.08);
}

.create-outcome.is-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.12);
}

.create-outcome.is-warning {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.12);
}

.create-outcome.is-error {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.12);
}

.create-outcome-summary {
  font-weight: 600;
  margin-bottom: 6px;
}

.create-outcome-fields {
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 12px;
}

.create-outcome-fields li {
  margin: 4px 0;
}

.callout {
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.9;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 120, 120, 0.25);
  background: rgba(120, 120, 120, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
}

.error-summary {
  font-weight: 600;
  margin-bottom: 6px;
}

.callout-error {
  border-color: rgba(220, 80, 80, 0.35);
  background: rgba(220, 80, 80, 0.08);
}

.callout-warn {
  border-color: rgba(220, 160, 60, 0.55);
  background: rgba(220, 160, 60, 0.12);
}

.callout-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.12);
}

#customerShipmentCreateOutcome {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.batch-review {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(80, 120, 255, 0.35);
  border-radius: 10px;
  background: rgba(80, 120, 255, 0.06);
}

.batch-review.is-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.1);
}

.batch-review.is-warning {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.1);
}

.batch-review-summary {
  font-weight: 600;
  margin-bottom: 6px;
}

.batch-review-columns {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.batch-review-rows {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.batch-review-row {
  border: 1px solid rgba(120, 120, 120, 0.25);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.batch-review-row.is-failed {
  border-color: rgba(220, 80, 80, 0.4);
  background: rgba(220, 80, 80, 0.08);
}

.batch-review-row-title {
  font-size: 12px;
  font-weight: 600;
}

.batch-review-row-meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.85;
}

.batch-review-row-fields {
  margin: 6px 0 0 16px;
  font-size: 11px;
  padding: 0;
}

/* ---- Shipments list/detail (V0.1) ---- */

.shipments-toolbar {
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 10px;
}

.shipments-advanced {
  margin: 6px 0 12px 0;
}

.shipments-toolbar .search-field {
  min-width: 180px;
}

.status-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.status-chip {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(120, 120, 120, 0.35);
  background: rgba(120, 120, 120, 0.08);
  cursor: pointer;
}

.status-chip.is-active {
  border-color: rgba(80, 120, 255, 0.55);
  background: rgba(80, 120, 255, 0.18);
}

.shipments-triage-head {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.queue-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shipment-row-list {
  display: grid;
  gap: 10px;
}

.shipment-group {
  border: 1px solid rgba(120, 120, 120, 0.2);
  border-radius: 10px;
  background: rgba(120, 120, 120, 0.03);
  padding: 8px;
}

.shipment-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.shipment-group-title {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.95;
}

.shipment-group-count {
  min-width: 34px;
  text-align: center;
}

.shipment-group-rows {
  display: grid;
  gap: 8px;
}

.shipments-split {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 14px;
}

.shipments-list {
  min-width: 0;
  overflow-x: auto;
}

.shipment-row {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(120, 120, 120, 0.25);
  border-radius: 10px;
  padding: 10px;
  background: rgba(120, 120, 120, 0.04);
  color: inherit;
  cursor: pointer;
}

.shipment-row:hover {
  background: rgba(120, 120, 120, 0.08);
}

.shipment-row.is-selected {
  background: rgba(80, 120, 255, 0.14);
  border-color: rgba(80, 120, 255, 0.45);
}

.shipment-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.shipment-row-identity {
  min-width: 0;
}

.shipment-row-id {
  font-size: 13px;
  font-weight: 600;
}

.shipment-row-reference {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 3px;
}

.shipment-row-meta {
  margin-top: 8px;
}

.shipment-row-actions {
  margin-top: 6px;
}

.shipments-detail {
  min-width: 0;
}

.shipment-detail-surface {
  display: grid;
  gap: 10px;
}

.detail-section {
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 10px;
  padding: 10px;
  background: rgba(120, 120, 120, 0.05);
}

.action-readiness-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-readiness-item {
  border: 1px solid rgba(120, 120, 120, 0.2);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.action-readiness-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.state-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(120, 120, 120, 0.08);
}

.state-tag-ready {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

.state-tag-blocked {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.state-tag-unavailable {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.14);
}

.barcode-workflow {
  margin-top: 10px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.action-workflow {
  margin-top: 10px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.action-workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.action-workflow-state-idle {
  border-color: rgba(120, 120, 120, 0.35);
  background: rgba(120, 120, 120, 0.12);
}

.action-workflow-state-loading {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.action-workflow-state-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

.action-workflow-state-failed {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.14);
}

.notification-execution {
  margin-top: 10px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.notification-execution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.notification-execution-grid {
  display: grid;
  grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
  gap: 4px 10px;
  margin-top: 8px;
}

.notification-execution .row-inline {
  flex-wrap: wrap;
  align-items: flex-start;
}

.barcode-workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.barcode-workflow-state-idle {
  border-color: rgba(120, 120, 120, 0.35);
  background: rgba(120, 120, 120, 0.12);
}

.barcode-workflow-state-loading {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.barcode-workflow-state-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

.barcode-workflow-state-failed {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.14);
}

.barcode-workflow .details {
  margin-top: 8px;
}

.barcode-workflow-actions {
  margin-top: 8px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(120, 120, 120, 0.25);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(120, 120, 120, 0.04);
}

.table th,
.table td {
  font-size: 12px;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(120, 120, 120, 0.18);
  vertical-align: top;
  text-align: left;
}

.table th {
  font-weight: 650;
  opacity: 0.9;
  background: rgba(120, 120, 120, 0.06);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table-row {
  cursor: pointer;
}

.table-row:hover {
  background: rgba(120, 120, 120, 0.06);
}

.table-row.is-selected {
  background: rgba(80, 120, 255, 0.14);
  outline: 1px solid rgba(80, 120, 255, 0.35);
}

/* ---- Shipment tracking (V0.1) ---- */

.shipment-tracking {
  margin-top: 10px;
}

.track-workflow {
  margin-top: 8px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(120, 120, 120, 0.04);
}

.track-workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-workflow-state-idle {
  border-color: rgba(120, 120, 120, 0.35);
  background: rgba(120, 120, 120, 0.12);
}

.track-workflow-state-loading {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.track-workflow-state-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

.track-workflow-state-unavailable {
  border-color: rgba(220, 160, 60, 0.6);
  background: rgba(220, 160, 60, 0.14);
}

.track-workflow-state-failed {
  border-color: rgba(220, 80, 80, 0.65);
  background: rgba(220, 80, 80, 0.14);
}

.kv-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 6px 10px;
  font-size: 12px;
  opacity: 0.95;
}

.kv-k {
  opacity: 0.75;
}

.kv-v {
  word-break: break-word;
}

.timeline-history {
  margin-top: 10px;
}

.timeline-history-pre {
  max-height: 180px;
  overflow: auto;
  margin-top: 6px;
}

.details {
  margin-top: 10px;
}

.details-summary {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.85;
}

.details[open] .details-summary {
  margin-bottom: 8px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(120, 120, 120, 0.08);
  opacity: 0.9;
}

.tag-success {
  border-color: rgba(70, 170, 120, 0.55);
  background: rgba(70, 170, 120, 0.14);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .grid {
    grid-template-columns: 1fr;
  }

  .shipments-split {
    grid-template-columns: 1fr;
  }

  .action-readiness-grid {
    grid-template-columns: 1fr;
  }

  .batch-review-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .shipments-toolbar {
    gap: 8px;
  }

  .shipments-toolbar .grow,
  .shipments-toolbar .search-field,
  .shipments-toolbar > div {
    width: 100%;
    min-width: 0;
  }

  .shipments-toolbar .row-inline {
    width: 100%;
    justify-content: space-between;
  }

  .kv-grid {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .notification-execution-grid {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
}

