/* Smartio Shipments — brand tokens taken from the live theme (PLAN 4.12). */
:root {
  --primary: #0d4877;
  --primary-dark: #092f50;
  --primary-light: #1a6099;
  --teal-1: #7bd0ca;
  --teal-4: #61afcc;
  --gradient-brand: linear-gradient(135deg, #7bd0ca, #61afcc);
  --gradient-nav: linear-gradient(90deg, #0d4877, #1a6099);
  --green: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --wa: #25d366;
  --bg: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-sunken: #eef2f7;
  --text: #111827;
  --text-mid: #556b85;
  --text-soft: #6b7f95;
  --border: #e8edf3;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --shadow: 0 2px 10px rgba(13, 72, 119, 0.08);
  --shadow-lg: 0 8px 28px rgba(13, 72, 119, 0.14);
  --on-brand: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1722;
    --bg-surface: #18222f;
    --bg-sunken: #131c27;
    --text: #e9eef5;
    --text-mid: #9fb0c4;
    --text-soft: #8ea0b6;
    --border: #26333f;
    --primary-light: #2e7ab2;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1722;
  --bg-surface: #18222f;
  --bg-sunken: #131c27;
  --text: #e9eef5;
  --text-mid: #9fb0c4;
  --text-soft: #8ea0b6;
  --border: #26333f;
  --primary-light: #2e7ab2;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ── header ─────────────────────────────────────────────────────────── */
.topbar {
  background: var(--gradient-nav);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .logo { height: 30px; width: auto; display: block; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: #cfe2f2; text-align: right; line-height: 1.25; }
.topbar .who strong { display: block; color: #fff; font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
}
.tabs::after { content: ""; flex: 0 0 8px; }
.tabs a {
  padding: 12px 10px;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.tabs a.on { color: var(--primary-light); border-bottom-color: var(--teal-4); }

main { padding: 16px; max-width: 720px; margin: 0 auto 72px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.sub { color: var(--text-mid); font-size: 14px; margin: 0 0 16px; }

/* ── surfaces ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mid);
}
.empty .mark {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--gradient-brand);
  opacity: 0.9;
}
.empty p { margin: 4px 0; }

/* ── forms ──────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  font-size: 16px; /* iOS refuses to stay zoomed-out below 16px */
  font-family: inherit;
  padding: 12px 14px;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
input::placeholder { color: var(--text-soft); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal-4);
  outline-offset: 2px;
}
/* Re-assert the authored shape: a global focus rule must never square off a
   round control (see the focus-visible border-radius trap). */
.btn:focus-visible, .pill:focus-visible { border-radius: var(--radius-s); }
.code-input { letter-spacing: 8px; font-size: 24px; text-align: center; font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--gradient-brand);
  color: #06323a;
  cursor: pointer;
  margin-top: 18px;
}
.btn.secondary {
  background: transparent;
  color: var(--primary-light);
  border: 1px solid var(--border);
}
.btn.small { width: auto; min-height: 38px; padding: 8px 14px; font-size: 14px; margin: 0; }
.btn.danger { background: transparent; color: var(--error); border: 1px solid var(--error); }

.msg {
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
  background: var(--bg-sunken);
  color: var(--text-mid);
  border: 1px solid var(--border);
}
.msg.bad { color: var(--error); border-color: var(--error); background: transparent; }

/* ── tables / lists ─────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
/* On a phone the text column takes the full width and the buttons sit under
   it — squeezing both onto one line wrapped the phone number mid-digits. */
.row .grow { flex: 1 1 100%; min-width: 0; }
.row .name { font-weight: 600; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row .meta { color: var(--text-mid); font-size: 13px; overflow-wrap: anywhere; margin-top: 4px; }
.row details { margin-top: 8px; }
.row summary { cursor: pointer; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 100%; }
.actions form { flex: 1 1 auto; }
.actions .btn { width: 100%; }
@media (min-width: 560px) {
  .row .grow { flex: 1 1 auto; }
  .actions { flex: 0 0 auto; }
  .actions .btn { width: auto; }
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-sunken);
  color: var(--text-mid);
  border: 1px solid var(--border);
}
.pill.on { background: rgba(34, 197, 94, 0.14); color: #15803d; border-color: rgba(34,197,94,.35); }
.pill.off { background: rgba(239, 68, 68, 0.12); color: #b91c1c; border-color: rgba(239,68,68,.35); }
.pill.brand { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill.on { color: #6ee7a4; }
  :root:not([data-theme="light"]) .pill.off { color: #fca5a5; }
}
:root[data-theme="dark"] .pill.on { color: #6ee7a4; }
:root[data-theme="dark"] .pill.off { color: #fca5a5; }

.audit { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit th { text-align: left; color: var(--text-mid); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.audit td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.scroll-x { overflow-x: auto; }

.login-wrap { max-width: 420px; margin: 0 auto; padding: 32px 16px; }
.login-logo { display: block; margin: 0 auto 20px; height: 48px; width: auto; }
/* The navy wordmark disappears on the dark ground — swap in the white one. */
.login-logo.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-logo.on-light { display: none; }
  :root:not([data-theme="light"]) .login-logo.on-dark { display: block; }
}
:root[data-theme="dark"] .login-logo.on-light { display: none; }
:root[data-theme="dark"] .login-logo.on-dark { display: block; }
.foot { text-align: center; color: var(--text-soft); font-size: 12px; margin-top: 28px; }
code { font-size: 13px; word-break: break-all; }
