/* NMS Line Tracking — North Star Maritime interface
   Brand palette (NMS brand pack): Deep Maritime Navy #0B2345, Chardonnay Gold #D9AD55,
   Northstar Teal #008C95, Platinum Silver #BFC5CC. Button teal is deepened to #007780 so
   white button text meets WCAG AA contrast. */

:root {
  --navy: #0b2345;
  --navy-700: #12325f;
  --navy-600: #1d4a7a;
  --navy-50: #edf1f6;
  --signal: #d9ad55;
  --action: #007780;
  --action-hover: #005f66;

  --ink: #0f1b2d;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;

  --success: #15803d; --success-bg: #ecfdf3; --success-line: #b7ebc9;
  --warning: #a16207; --warning-bg: #fefbe8; --warning-line: #f3dd8a;
  --danger: #b91c1c;  --danger-bg: #fef2f2;  --danger-line: #f8c9c9;
  --info: #1d4ed8;    --info-bg: #eff5ff;    --info-line: #c7d8fb;
  --neutral: #475569; --neutral-bg: #f1f5f9; --neutral-line: #dbe3ec;

  --focus: #2563eb;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 1px rgba(15, 27, 45, .04);
  --shadow-lg: 0 12px 32px rgba(1, 23, 88, .14);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --header-h: 68px;
  --sidebar-w: 236px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--navy); text-decoration: underline; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; line-height: 1.3; margin: 0; font-weight: 650; }
h3 { font-size: .95rem; margin: 0; font-weight: 650; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
svg.lucide { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 2; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
.muted, .helper { color: var(--muted); }
.helper { font-size: .84rem; font-weight: 400; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 1.25rem; }
.stack-sm { display: grid; gap: .6rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 clamp(1rem, 3vw, 1.75rem); background: var(--navy); color: #fff; border-bottom: 3px solid var(--signal); }
.brand { display: flex; align-items: center; color: #fff; min-width: 0; flex: 0 1 190px; }
.brand:hover { color: #fff; text-decoration: none; }
/* The approved logo is shown unchanged, in its own colours, on a white plate so it reads on the navy bar. */
.brand-logo { display: block; width: min(127px, 100%); height: 50px; object-fit: contain; object-position: center; padding: 4px 10px; border-radius: 8px; background: #fff; box-sizing: content-box; }
.topnav { display: flex; align-items: center; gap: .25rem; }
.topnav a, .topnav-button { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: 0 .75rem; border-radius: var(--radius-sm); color: #d7def0; font-size: .9rem; font-weight: 500; border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.topnav a:hover, .topnav-button:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(255,255,255,.12); }
.topnav a.topnav-cta { color: #fff; background: var(--action); margin-left: .35rem; }
.topnav a.topnav-cta:hover { background: var(--action-hover); }
.topnav-user { display: inline-flex; align-items: center; gap: .5rem; margin-left: .5rem; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.18); font-size: .9rem; color: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--navy-600); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }

/* ---------- App shell ---------- */
.app { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 1rem .75rem 2rem; }
.sidebar-label { margin: 1.1rem .6rem .35rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.sidebar-label:first-child { margin-top: .25rem; }
.sidebar-org { display: flex; align-items: center; gap: .5rem; margin: 0 .25rem .75rem; padding: .6rem .7rem; background: var(--navy-50); border-radius: var(--radius-sm); font-weight: 650; font-size: .88rem; color: var(--navy); }
.sidebar-nav { display: grid; gap: 2px; }
.sidebar-nav a { position: relative; display: flex; align-items: center; gap: .65rem; min-height: 38px; padding: .4rem .7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.sidebar-nav a svg { color: var(--muted); }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.sidebar-nav a.active { background: var(--navy-50); color: var(--navy); font-weight: 650; }
.sidebar-nav a.active svg { color: var(--navy); }
.sidebar-nav a.active::before { content: ""; position: absolute; left: -.75rem; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); }
.content { min-width: 0; padding: 1.75rem clamp(1rem, 3vw, 2.25rem) 4rem; max-width: 1320px; width: 100%; }
.page { flex: 1; width: 100%; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding: 1.25rem clamp(1rem, 3vw, 1.75rem); border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .82rem; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header p { color: var(--muted); margin-top: .3rem; max-width: 70ch; }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--action); margin-bottom: .35rem; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; font-size: .88rem; font-weight: 600; margin-bottom: .6rem; }
.back-link svg { width: 16px; height: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: 2rem 0 .75rem; }
.section-title:first-child { margin-top: 0; }
.section-title p { color: var(--muted); font-size: .88rem; margin-top: .15rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: .5rem .95rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); color: #fff; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.confirm-dialog .btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--navy-600); }
.btn-ghost:hover { background: var(--navy-50); border-color: transparent; color: var(--navy); }
.btn-sm { min-height: 32px; padding: .3rem .65rem; font-size: .83rem; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { min-height: 52px; padding: .75rem 1.4rem; font-size: 1rem; }
.btn-icon { width: 40px; padding: 0; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.actions form { margin: 0; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem .18rem .5rem; border-radius: 999px; border: 1px solid; font-size: .78rem; font-weight: 650; line-height: 1.35; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-success { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.badge-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.badge-neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-line); }
.badge-lg { font-size: .88rem; padding: .3rem .8rem .3rem .65rem; }

/* Timing: how certain a date is */
.timing { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: .1rem .45rem; border-radius: 4px; }
.timing svg { width: 13px; height: 13px; }
.timing-actual { color: var(--success); background: var(--success-bg); }
.timing-estimated { color: var(--warning); background: var(--warning-bg); }
.timing-scheduled { color: var(--neutral); background: var(--neutral-bg); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.panel-header p { color: var(--muted); font-size: .85rem; margin-top: .1rem; }
.panel-body { padding: 1.1rem; }
.panel-footer { padding: .85rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.75rem; overflow: hidden; }
.stat { display: grid; gap: .15rem; padding: 1rem 1.15rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; color: inherit; }
a.stat:hover { background: var(--surface-2); text-decoration: none; color: inherit; }
.stat-label { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-label svg { width: 16px; height: 16px; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat.is-danger .stat-value { color: var(--danger); }
.stat.is-warning .stat-value { color: var(--warning); }
.stat-hint { font-size: .78rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table-wrap table { min-width: 680px; }
.table-wrap.compact table { min-width: 0; }
th { position: sticky; top: 0; text-align: left; padding: .6rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .73rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
td strong, td .ref { color: var(--ink); }
.ref { font-family: var(--mono); font-size: .86rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
a.ref { color: var(--navy-600); }
.cell-sub { display: block; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.route { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.route svg { width: 14px; height: 14px; color: var(--muted); }
td.actions-cell { text-align: right; white-space: nowrap; }
td.actions-cell .actions { justify-content: flex-end; flex-wrap: nowrap; }

/* ---------- Empty state ---------- */
.empty { display: grid; justify-items: center; gap: .35rem; padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; color: var(--line-strong); margin-bottom: .25rem; }
.empty strong { color: var(--ink-2); }
td.empty-cell { padding: 0; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem 1rem; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--surface); font-size: .92rem; margin-bottom: 1rem; }
.alert svg { margin-top: 1px; }
.alert strong { display: block; }
.alert-error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); border-left-color: var(--danger); }
.alert-warning { color: #854d0e; background: var(--warning-bg); border-color: var(--warning-line); border-left-color: #ca8a04; }
.alert-success { color: var(--success); background: var(--success-bg); border-color: var(--success-line); border-left-color: var(--success); }
.alert-info { color: var(--navy); background: var(--info-bg); border-color: var(--info-line); border-left-color: var(--navy-600); }
.alert > div > span, .alert p { color: var(--ink-2); }

/* ---------- Forms ---------- */
label, .label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.field { display: grid; gap: .35rem; align-content: start; }
input, select, textarea { width: 100%; min-height: 42px; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .93rem; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy-600) 18%, transparent); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 88px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--navy); flex: 0 0 auto; }
input[type="file"] { padding: .45rem; background: var(--surface-2); }
.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; color: var(--ink); min-height: 32px; align-items: center; }
.check small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.instruction-summary { align-items: stretch; margin-bottom: 1rem; }
.instruction-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.instruction-fields.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.instruction-fields > div { min-width: 0; }
.instruction-fields span { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.instruction-fields strong, .instruction-fields p { overflow-wrap: anywhere; }
.instruction-fields p { margin: .25rem 0 0; color: var(--ink-2); line-height: 1.5; }
.span-all { grid-column: 1 / -1; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section { padding: 1.25rem 1.1rem; display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 1.5rem; }
.form-section-head h2 { font-size: .98rem; }
.form-section-head p { color: var(--muted); font-size: .84rem; margin-top: .25rem; }
.form-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.password-field { position: relative; }
.password-field input { padding-right: 2.9rem; }
.password-field .btn-icon { position: absolute; right: 1px; top: 1px; bottom: 1px; height: auto; border: 0; background: transparent; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem 1rem; margin: 0; min-width: 0; }
.instruction-form > fieldset { border: 0; border-radius: 0; padding: 0; }
.container-timeline h3 { margin: 0 0 .75rem; }
.mini-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.mini-timeline li { border-left: 2px solid var(--line); padding-left: .75rem; display: grid; gap: .2rem; }
.mini-timeline span, .mini-timeline small { color: var(--muted); }
legend { padding: 0 .35rem; font-weight: 650; font-size: .86rem; color: var(--ink-2); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.filter-bar .field { flex: 1 1 180px; }
.filter-bar .field.grow { flex: 2 1 260px; }
details.drawer { margin-bottom: 1.25rem; }
details.drawer > summary { list-style: none; width: fit-content; margin-bottom: .75rem; }
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer[open] > summary { margin-bottom: .75rem; }

/* ---------- Public tracking ---------- */
.track-hero { position: relative; isolation: isolate; overflow: hidden; background-color: var(--navy); background-image: url('../img/tracking-ship.avif'); background-size: cover; background-position: center 48%; color: #fff; padding: clamp(2rem, 6vw, 3.75rem) clamp(1rem, 4vw, 2rem) clamp(5rem, 9vw, 6.5rem); }
.track-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(1, 23, 88, .74); }
.track-hero-inner { max-width: 880px; margin: 0 auto; position: relative; }
.track-hero .eyebrow { color: #e9c983; }
.track-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.2vw, 2.7rem); line-height: 1.1; letter-spacing: -.02em; }
.track-hero p.lede { color: #c3cde6; margin-top: .75rem; font-size: 1.04rem; max-width: 60ch; }
.track-card { width: min(880px, calc(100% - 2rem)); margin: calc(-1 * clamp(3.5rem, 7vw, 4.75rem)) auto 0; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: clamp(1.1rem, 3vw, 1.6rem); position: relative; }
.type-tabs { display: flex; flex-wrap: wrap; gap: .35rem; border: 0; padding: 0; margin: 0 0 .9rem; }
.type-tabs legend { padding: 0; margin-bottom: .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.type-tab { position: relative; }
.type-tab input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.type-tab span { display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: .4rem .85rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.type-tab span svg { width: 16px; height: 16px; }
.type-tab input:hover + span { border-color: var(--navy-600); }
.type-tab input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.type-tab input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 2px; }
.track-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; }
.track-input .input-wrap { position: relative; }
.track-input .input-wrap svg { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.track-input input { min-height: 54px; padding-left: 2.8rem; font-size: 1.1rem; font-family: var(--mono); letter-spacing: .03em; text-transform: uppercase; }
.track-input input::placeholder { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 1rem; }
.track-card .helper { margin-top: .7rem; }
.track-card .alert { margin: .9rem 0 0; }
.schedule-link { width: min(880px, calc(100% - 2rem)); margin: 1.15rem auto 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .85rem; color: var(--ink); padding: .85rem 1rem; border-bottom: 1px solid var(--line-strong); }
.schedule-link:hover { color: var(--navy); text-decoration: none; border-bottom-color: var(--navy-600); }
.schedule-link > svg:first-child { color: var(--navy-600); width: 23px; height: 23px; }
.schedule-link > svg:last-child { color: var(--muted); }
.schedule-link span { display: grid; }
.schedule-link strong { font-size: .94rem; }
.schedule-link small { color: var(--muted); font-size: .82rem; }
.track-notes { max-width: 880px; margin: 2rem auto 3rem; padding: 0 clamp(1rem, 4vw, 0rem); display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.track-notes div { display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem; align-items: start; }
.track-notes svg { grid-row: span 2; width: 22px; height: 22px; color: var(--navy-600); margin-top: 2px; }
.track-notes strong { font-size: .92rem; }
.track-notes span { color: var(--muted); font-size: .87rem; }

/* ---------- Public vessel schedule ---------- */
.schedule-page { width: min(1440px, 100%); margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 1.75rem) 3rem; }
.schedule-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .7rem 0 1.25rem; }
.schedule-header h1 { font-size: clamp(1.55rem, 3vw, 2rem); }
.schedule-header p:not(.eyebrow) { color: var(--muted); margin-top: .35rem; }
.schedule-summary { align-items: center; }
.schedule-freshness { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.live-indicator { display: inline-flex; align-items: center; gap: .4rem; color: var(--success); font-weight: 650; }
.live-indicator > span { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.schedule-filters { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(150px, 1fr) minmax(180px, 1fr); gap: .8rem; padding: .9rem 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.schedule-table-wrap { max-height: min(68vh, 760px); overflow: auto; }
.schedule-table { width: 100%; min-width: 1120px; table-layout: fixed; }
.schedule-col-eta { width: 9%; }
.schedule-col-line { width: 22%; }
.schedule-col-vessel { width: 18%; }
.schedule-col-terminal { width: 8%; }
.schedule-col-manifest { width: 13%; }
.schedule-col-agent { width: 12%; }
.schedule-col-status { width: 18%; }
.schedule-table th { top: 0; z-index: 2; }
.schedule-table th, .schedule-table td { vertical-align: top; overflow-wrap: anywhere; }
.schedule-table .ref { white-space: normal; }
.schedule-cell-list { display: grid; justify-items: start; gap: .3rem; min-height: 22px; }
.schedule-cell-list .badge { max-width: 100%; white-space: normal; line-height: 1.25; }
.schedule-source-note { display: flex; align-items: flex-start; gap: .45rem; color: var(--muted); font-size: .8rem; margin-top: .85rem; }
.schedule-source-note svg { width: 15px; height: 15px; margin-top: 2px; }
.is-hidden { display: none !important; }

/* ---------- Tracking result ---------- */
.result { max-width: 1180px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 1.5rem) 3rem; }
.content .result { padding: 0; max-width: none; margin: 0; }
.result-head { padding: 1.3rem 1.4rem; }
.result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.result-ref { font-family: var(--mono); font-size: clamp(1.35rem, 3vw, 1.7rem); font-weight: 700; letter-spacing: .01em; }
.result-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .35rem; color: var(--muted); font-size: .86rem; }
.result-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.result-meta svg { width: 15px; height: 15px; }
.route-line { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1rem; margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.route-end small { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.route-end strong { display: block; font-size: 1.08rem; }
.route-end span { color: var(--muted); font-size: .88rem; }
.route-end:last-child { text-align: right; }
.route-mid { display: flex; align-items: center; gap: .5rem; color: var(--navy-600); min-width: 120px; }
.route-mid::before, .route-mid::after { content: ""; flex: 1; border-top: 2px dashed var(--line-strong); }
.phases { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 1.1rem 1.4rem 1.3rem; list-style: none; border-top: 1px solid var(--line); background: var(--surface-2); }
.phase { position: relative; display: grid; justify-items: center; gap: .45rem; text-align: center; font-size: .82rem; font-weight: 600; color: var(--muted); }
.phase::before { content: ""; position: absolute; top: 17px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 3px; border-radius: 3px; background: var(--line); }
.phase:first-child::before { display: none; }
.phase-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); position: relative; z-index: 1; }
.phase-dot svg { width: 17px; height: 17px; }
.phase.done { color: var(--ink-2); }
.phase.done::before, .phase.current::before { background: var(--success); }
.phase.done .phase-dot { background: var(--success); border-color: var(--success); color: #fff; }
.phase.current { color: var(--ink); }
.phase.current .phase-dot { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--navy) 16%, transparent); }
.phase small { font-weight: 500; font-size: .74rem; color: var(--action); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.fact { padding: .9rem 1.4rem; border-right: 1px solid var(--line); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact dt { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .2rem; }
.fact dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.fact dd .timing { margin-top: .3rem; }
.fact dd small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.result-side { display: grid; gap: 1.25rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.container-list { list-style: none; margin: 0; padding: 0; }
.container-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.container-list li:last-child { border-bottom: 0; }
.container-list .ctr-icon { grid-row: span 2; width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--navy-50); color: var(--navy); }
.container-list .ctr-sub { grid-column: 2 / -1; font-size: .8rem; color: var(--muted); }
.note { padding: .9rem 1.1rem; font-size: .9rem; color: var(--ink-2); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: .6rem 1.1rem 1rem; }
.tl-item { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: .9rem; padding: .8rem 0; }
.tl-item::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-item:first-child::before { top: 1.2rem; }
.tl-item:last-child::before { bottom: calc(100% - 1.2rem); }
.tl-node { position: relative; z-index: 1; width: 22px; height: 22px; margin-top: .05rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-item.is-actual .tl-node { background: var(--success); border-color: var(--success); color: #fff; }
.tl-item.is-actual .tl-node svg { width: 13px; height: 13px; stroke-width: 3; }
.tl-item.is-estimated .tl-node { border-style: dashed; border-color: #ca8a04; }
.tl-item.is-scheduled .tl-node { border-style: dashed; }
.tl-item.is-latest .tl-node { background: var(--navy); border-color: var(--navy); box-shadow: 0 0 0 4px color-mix(in srgb, var(--navy) 16%, transparent); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.tl-head strong { color: var(--ink); }
.tl-item.is-scheduled .tl-head strong, .tl-item.is-estimated .tl-head strong { color: var(--ink-2); font-weight: 600; }
.tl-when { display: block; font-size: .86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: .1rem; }
.tl-where { display: flex; align-items: center; gap: .3rem; font-size: .86rem; color: var(--muted); margin-top: .1rem; }
.tl-where svg { width: 14px; height: 14px; }
.tl-note { font-size: .86rem; color: var(--ink-2); margin-top: .35rem; }
.tl-source { font-size: .76rem; color: var(--muted); margin-top: .25rem; }
.tl-latest { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-600); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .8rem; color: var(--muted); }

/* ---------- Auth ---------- */
.auth { flex: 1; display: grid; place-items: center; padding: clamp(1.5rem, 6vw, 4rem) 1rem; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card-head { padding: 1.5rem 1.6rem 1.1rem; }
.auth-card-head p { color: var(--muted); margin-top: .4rem; font-size: .93rem; }
.auth-card-body { padding: 0 1.6rem 1.6rem; display: grid; gap: 1rem; }
.auth-card-body form { display: grid; gap: 1rem; }
.auth-card-foot { padding: .9rem 1.6rem; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .85rem; color: var(--muted); }
.auth-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); margin-bottom: .9rem; }
.auth-icon svg { width: 22px; height: 22px; }
.auth-card .alert { margin: 0; }
.demo-accounts { font-size: .82rem; color: var(--muted); display: grid; gap: .2rem; }
.demo-accounts code { color: var(--ink-2); }

/* ---------- Dashboards & lists ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.activity { list-style: none; margin: 0; padding: .35rem 0; }
.activity li { display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem; padding: .6rem 1.1rem; }
.activity li + li { border-top: 1px solid var(--line); }
.activity .avatar { grid-row: span 2; width: 28px; height: 28px; font-size: .7rem; background: var(--navy-50); color: var(--navy); }
.activity strong { font-size: .88rem; font-weight: 600; color: var(--ink); }
.activity span { font-size: .8rem; color: var(--muted); }
.link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.link-card { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
.link-card:hover { border-color: var(--navy-600); text-decoration: none; color: var(--ink); }
.link-card > svg:first-child { width: 36px; height: 36px; padding: 8px; border-radius: var(--radius-sm); background: var(--navy-50); color: var(--navy); }
.link-card small { display: block; color: var(--muted); font-size: .82rem; }
.link-card > svg:last-child { color: var(--muted); }

/* Company identity settings */
.company-settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.company-logo-field { display: grid; gap: .65rem; align-content: start; }
.company-logo-field .btn { width: fit-content; }
.company-logo-preview { height: 112px; display: grid; place-items: center; padding: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.company-logo-preview img { display: block; max-width: 100%; max-height: 78px; object-fit: contain; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.field-span { grid-column: 1 / -1; }

/* Catalog rows */
.catalog-list { display: grid; gap: .5rem; }
.catalog-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.catalog-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; cursor: pointer; list-style: none; }
.catalog-row > summary::-webkit-details-marker { display: none; }
.catalog-row > summary .catalog-summary { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
.catalog-row > summary .catalog-summary span:not(:first-child) { color: var(--muted); font-size: .88rem; }
.catalog-row[open] > summary { border-bottom: 1px solid var(--line); }
.catalog-row .catalog-form { padding: 1.1rem; }

/* Permissions */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; align-items: start; }
.perm-list { display: grid; }
.perm-list .check { padding: .55rem 1.1rem; border-bottom: 1px solid var(--line); min-height: 48px; }
.perm-list .check:last-child { border-bottom: 0; }

/* Health */
.health-list { list-style: none; margin: 0; padding: 0; }
.health-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.health-list li:last-child { border-bottom: 0; }
.health-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.health-icon.ok { color: var(--success); background: var(--success-bg); }
.health-icon.problem { color: var(--danger); background: var(--danger-bg); }
.health-list small { display: block; color: var(--muted); font-size: .82rem; }

/* Invoices */
.invoice-lines { display: grid; }
.invoice-line { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(90px, .6fr) minmax(120px, .8fr) minmax(110px, .7fr) 40px; gap: .75rem; align-items: end; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.line-total { min-height: 42px; display: grid; align-content: center; justify-items: end; }
.line-total span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.line-total strong { font-variant-numeric: tabular-nums; }
.invoice-totals { display: grid; grid-template-columns: auto auto; justify-content: end; gap: .35rem 2rem; padding: 1rem 1.1rem; font-variant-numeric: tabular-nums; }
.invoice-totals dt { color: var(--muted); }
.invoice-totals dd { margin: 0; text-align: right; font-weight: 600; }
.invoice-totals .grand { font-size: 1.1rem; color: var(--ink); font-weight: 700; }

/* Secrets & code */
.secret { display: grid; gap: .5rem; }
.secret code { display: block; padding: .6rem .75rem; background: var(--surface); border: 1px solid var(--warning-line); border-radius: var(--radius-sm); overflow-wrap: anywhere; user-select: all; font-size: .85rem; }
pre.json { margin: 0; max-width: 460px; max-height: 140px; overflow: auto; font-family: var(--mono); font-size: .76rem; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .4rem .5rem; }
details.inline > summary { cursor: pointer; font-size: .82rem; color: var(--navy-600); }

/* Help centre */
.help-search { max-width: 680px; margin-bottom: 1.5rem; }
.help-search .search-input { position: relative; }
.help-search .search-input svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.help-search input { padding-left: 2.5rem; }
.help-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2rem; align-items: start; }
.help-toc { position: sticky; top: calc(var(--header-h) + 1rem); padding: .9rem 0; border-top: 2px solid var(--navy); border-bottom: 1px solid var(--line); }
.help-toc > strong { display: block; padding: 0 .5rem .5rem; font-size: .78rem; text-transform: uppercase; color: var(--muted); }
.help-toc nav { display: grid; gap: 2px; }
.help-toc a { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .88rem; font-weight: 600; }
.help-toc a:hover { color: var(--navy); background: var(--navy-50); text-decoration: none; }
.help-toc svg { width: 16px; height: 16px; color: var(--navy-600); }
.help-content { min-width: 0; }
.help-section { padding-bottom: 2rem; }
.help-section + .help-section { padding-top: 1.75rem; border-top: 1px solid var(--line-strong); }
.help-section-head { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: .8rem; align-items: start; margin-bottom: .75rem; }
.help-section-head > svg { width: 36px; height: 36px; padding: 8px; border-radius: var(--radius-sm); background: var(--navy-50); color: var(--navy); }
.help-section-head h2 { font-size: 1.2rem; }
.help-section-head p { margin-top: .2rem; color: var(--muted); font-size: .9rem; }
.help-articles { border-top: 1px solid var(--line); }
.help-articles article { padding: 1.1rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.help-articles article h3 { font-size: 1rem; }
.help-articles article > p { max-width: 78ch; margin-top: .3rem; color: var(--ink-2); }
.help-articles ol { max-width: 82ch; margin: .75rem 0 0; padding-left: 1.35rem; color: var(--ink-2); }
.terms-doc { max-width: 860px; }
.terms-doc section + section { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.terms-doc h2 { font-size: 1.05rem; }
.terms-doc p, .terms-doc ul { max-width: 78ch; margin: .5rem 0 0; color: var(--ink-2); line-height: 1.6; }
.terms-doc ul { padding-left: 1.35rem; }
.site-footer a { color: inherit; }
.site-footer .powered-by { flex-basis: 100%; padding-top: .6rem; border-top: 1px solid var(--line); text-align: center; }
.app-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: center; }
.app-footer a, .site-footer .powered-by a { color: var(--navy-600); font-weight: 600; }
.help-articles li { padding-left: .25rem; margin-top: .35rem; }
.help-articles li::marker { color: var(--navy-600); font-weight: 700; }
.help-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.help-links .btn svg { width: 15px; height: 15px; }
.help-article-hidden, .help-section-hidden { display: none !important; }

/* Anchor tabs for long edit pages */
.page-tabs { display: flex; gap: .25rem; overflow-x: auto; margin: -0.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.page-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .85rem; color: var(--ink-2); font-size: .9rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.page-tabs a:hover { color: var(--navy); border-color: var(--line-strong); text-decoration: none; }
.page-tabs .count { font-size: .74rem; font-weight: 700; background: var(--neutral-bg); color: var(--neutral); padding: 0 .4rem; border-radius: 999px; }
section[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* Confirm dialog */
.confirm-dialog { width: min(420px, calc(100% - 2rem)); border: 0; border-radius: 12px; padding: 0; box-shadow: var(--shadow-lg); color: var(--ink); }
.confirm-dialog::backdrop { background: rgba(1, 23, 88, .35); }
.confirm-dialog form { padding: 1.3rem 1.4rem 1.2rem; display: grid; gap: .8rem; }
.confirm-dialog h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.confirm-dialog h2 svg { color: var(--danger); }
.confirm-dialog p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }

/* Errors */
.error-page { flex: 1; display: grid; place-items: center; padding: 4rem 1rem; }
.error-page .empty { max-width: 440px; }
.error-page .code { font-family: var(--mono); font-size: .85rem; font-weight: 700; color: var(--action); letter-spacing: .1em; }
.error-page h1 { font-size: 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(2n) { border-right: 0; }
  .fact:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .result-grid, .two-col { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; gap: .9rem; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: var(--header-h); z-index: 20; height: auto; display: flex; align-items: center; gap: .25rem; overflow-x: auto; padding: .45rem .75rem; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-label, .sidebar-org { display: none; }
  .sidebar-nav { display: flex; gap: .25rem; }
  .sidebar-nav + .sidebar-label + .sidebar-nav, .sidebar-nav + .sidebar-nav { padding-left: .5rem; margin-left: .25rem; border-left: 1px solid var(--line); }
  .sidebar-nav a { white-space: nowrap; min-height: 36px; font-size: .86rem; }
  .sidebar-nav a.active::before { left: 8px; right: 8px; top: auto; bottom: -1px; width: auto; height: 2px; border-radius: 2px; }
  .grid-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .track-notes { grid-template-columns: 1fr; gap: 1rem; }
  .schedule-filters { grid-template-columns: 1fr 1fr; }
  .schedule-filters .grow { grid-column: 1 / -1; }
  .topnav-name { display: none; }
  .company-settings-grid { grid-template-columns: 180px minmax(0, 1fr); }
  .help-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .help-toc { position: static; padding: .7rem 0; }
  .help-toc nav { display: flex; overflow-x: auto; gap: .25rem; }
  .help-toc a { white-space: nowrap; }
}
@media (max-width: 640px) {
  .brand { flex-basis: 128px; }
  .brand-logo { width: 92px; height: 36px; padding: 3px 8px; }
  .topnav a span, .topnav-button span { display: none; }
  .topnav a, .topnav-button { padding: 0 .6rem; }
  .topnav a.topnav-cta span { display: none; }
  .topnav-user { margin-left: .25rem; padding-left: .5rem; }
  .content { padding-top: 1.25rem; }
  h1 { font-size: 1.35rem; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .grid-2, .instruction-fields, .instruction-fields.cols-3 { grid-template-columns: 1fr; }
  .track-input { grid-template-columns: 1fr; }
  .track-input .btn { width: 100%; }
  .schedule-header { align-items: flex-start; flex-direction: column; }
  .schedule-filters { grid-template-columns: 1fr; }
  .schedule-filters .grow { grid-column: auto; }
  .schedule-summary { align-items: flex-start; }
  .schedule-freshness { justify-content: flex-start; }
  .schedule-link small { line-height: 1.35; }
  .route-line { grid-template-columns: 1fr; gap: .6rem; }
  .route-end:last-child { text-align: left; }
  .route-mid { display: none; }
  .phases { grid-template-columns: 1fr; gap: 0; padding: .75rem 1.1rem; }
  .phase { grid-template-columns: auto 1fr; justify-items: start; align-items: center; text-align: left; gap: .75rem; padding: .35rem 0; }
  .phase::before { top: -50%; bottom: 50%; left: 16.5px; right: auto; width: 3px; height: auto; transform: translateY(-2px); }
  .phase small { grid-column: 2; margin-top: -.5rem; }
  .facts { grid-template-columns: 1fr; }
  .fact { border-right: 0; border-bottom: 1px solid var(--line); }
  .fact:last-child { border-bottom: 0; }
  .invoice-line { grid-template-columns: 1fr 1fr; }
  .invoice-line .field:first-child { grid-column: 1 / -1; }
  .page-header .actions { width: 100%; }
  .stat-value { font-size: 1.45rem; }
  .company-settings-grid { grid-template-columns: 1fr; }
  .company-logo-preview { max-width: 260px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .sidebar, .site-footer, .app-footer, .actions, .btn { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .panel, .table-wrap { box-shadow: none; }
}
.mt { margin-top: 1.25rem; }
.page-header h1.ref { font-size: 1.55rem; }
.invoice-totals input { width: 9rem; text-align: right; }
.upper { text-transform: uppercase; }
.text-danger { color: var(--danger) !important; }
.bar { display: block; height: 4px; width: var(--w, 0); margin-top: .4rem; border-radius: 2px; background: var(--navy-600); opacity: .55; }
.avatar-soft { background: var(--navy-50); color: var(--navy); }
.stack > *, .stack-sm > *, .two-col > *, .grid-2 > *, .result-grid > *, .result-side > * { min-width: 0; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .25rem; margin-top: .35rem; margin-left: -.65rem; }
.tl-actions form { margin: 0; }
.tl-edit { flex: 1 1 100%; order: 2; }
.tl-edit > summary { list-style: none; display: inline-flex; }
.tl-edit > summary::-webkit-details-marker { display: none; }
.tl-edit:not([open]) { flex: 0 0 auto; order: 0; }
.tl-edit-form { margin: .5rem 0 .25rem .65rem; padding: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tl-actions .helper svg { width: 14px; height: 14px; vertical-align: -2px; }
.catalog-row .catalog-danger { display: flex; justify-content: flex-end; margin: 0 1.1rem; padding: .75rem 0 1rem; border-top: 1px dashed var(--line); }
.tl-edit-form .form-grid, .catalog-row .catalog-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 1280px) { #events > .grid-2, #containers > .grid-2 { grid-template-columns: 1fr; } }
.recipient-list { list-style: none; margin: .1rem 0 0; padding: 0; display: grid; gap: .35rem; }
.recipient-list li { display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .88rem; min-width: 0; }
.recipient-list li svg { width: 16px; height: 16px; color: var(--navy-600); }
.recipient-list li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-log { list-style: none; margin: 0; padding: 0; }
.notify-log li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.notify-log li:last-child { border-bottom: 0; }
.notify-log li > svg { color: var(--navy-600); }
.notify-log small { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
@media (max-width: 1280px) { #notify > .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Shipping instructions form ---------- */
.si-form > fieldset { min-width: 0; }
.si-stepper { padding: .75rem; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; overflow-x: auto; }
.si-stepper ol { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.si-stepper a { display: grid; justify-items: center; gap: .15rem; min-width: 60px; padding: .4rem .35rem; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--ink-2); text-align: center; text-decoration: none; }
.si-stepper a:hover { background: var(--surface); text-decoration: none; }
.si-stepper a.is-active { background: var(--surface); border-color: var(--navy); color: var(--navy); }
.si-step-letter { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy-50); color: var(--navy); font-weight: 700; font-size: .82rem; }
.si-stepper a.is-active .si-step-letter { background: var(--navy); color: #fff; }
.si-step-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.si-step-state { font-size: .68rem; font-weight: 600; white-space: nowrap; }
.si-step-state.is-done { color: var(--success); }
.si-step-state.is-todo { color: var(--warning); }
.si-section { display: grid; gap: 1.1rem; padding: 1.25rem 1.1rem; }
.si-section[hidden], .si-form [data-show-field][hidden], .si-vague[hidden] { display: none; }
.si-section-head h2 { font-size: 1.05rem; }
.si-section-head p { margin-top: .2rem; color: var(--muted); font-size: .88rem; }
.si-facts { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.si-party { display: grid; gap: .6rem; }
.si-party h3, .si-subhead { font-size: .92rem; color: var(--navy); margin: 0 0 .5rem; }
.si-req { color: var(--danger); font-weight: 700; }
.si-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.si-choice legend { padding: 0; margin-bottom: .35rem; font-weight: 600; font-size: .875rem; }
.si-choice-options { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.si-row { display: grid; gap: .75rem; padding: .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.si-row + .si-row { margin-top: .75rem; }
.si-row-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.si-vague { grid-column: 1 / -1; margin: 0; }
.si-rows-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.si-totals { margin: 0; font-size: .86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.si-documents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.si-document { display: grid; gap: .45rem; align-content: start; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.si-attached { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .35rem .5rem; border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.si-section-nav { display: flex; justify-content: space-between; gap: .6rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.si-section-nav > :only-child { margin-left: auto; }
.si-section-nav > :only-child[data-si-go="J"] { margin-left: 0; }
.si-error-list { margin: .4rem 0 0; padding-left: 1.1rem; }
.si-approval { margin-bottom: 1rem; }
.si-review-section { margin-bottom: 1rem; }
.si-changes > summary { cursor: pointer; list-style: revert; }
.si-changes[open] > summary { border-bottom: 1px solid var(--line); }
@media (max-width: 900px) {
  .si-documents { grid-template-columns: minmax(0, 1fr); }
  .si-form .form-grid.cols-3, .si-form .form-grid { grid-template-columns: minmax(0, 1fr); }
}
.si-charge-row { margin-top: .4rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* Booking requests */
.book-page { max-width: 1040px; margin: 0 auto 3rem; padding: 0 16px; display: grid; gap: 1rem; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.bk-charge-row { margin-top: .25rem; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, .7fr) minmax(0, 1fr); }
.track-hero .hero-cta { margin-top: 1rem; display: inline-flex; }
@media (max-width: 640px) { .bk-charge-row { grid-template-columns: 1fr 1fr; } }

/* Origin operations */
.ops-container { margin-top: 1rem; }
#equipment, #checklist, #mbl { margin-top: 1rem; }
.ops-steps { list-style: none; margin: 0; padding: .4rem 1.1rem .9rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.ops-steps li { font-size: .72rem; padding: .18rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--neutral); background: var(--surface); }
.ops-steps li.is-done { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.ops-steps li.is-current { color: #fff; background: var(--navy, #0b2345); border-color: var(--navy, #0b2345); font-weight: 650; }
.ops-step-form [hidden] { display: none !important; }
.ctr-status { margin-left: auto; }

/* Control centre and customer portal */
.nav-count { margin-left: auto; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--action); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.4rem; text-align: center; }
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; margin-bottom: 1.75rem; }
.queue { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .8rem .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; }
.queue:hover { text-decoration: none; border-color: var(--line-strong); }
.queue-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.queue-text { display: grid; gap: .1rem; }
.queue-text small { color: var(--muted); font-size: .78rem; }
.queue-count { font-size: 1.35rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.queue.has-work { border-left: 3px solid var(--action); }
.queue.has-work .queue-count { color: var(--ink); }
.queue.has-work .queue-icon { background: var(--navy-50); color: var(--navy); }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li + li { border-top: 1px solid var(--line); }
.todo-list a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: .75rem 1.1rem; color: inherit; }
.todo-list a:hover { background: var(--surface-2); text-decoration: none; }
.todo-list small { display: block; color: var(--muted); font-size: .8rem; }
.todo-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.todo-icon.is-warning { background: var(--warning-bg); color: var(--warning); }
.todo-icon.is-info { background: var(--info-bg); color: var(--info); }
.portal-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; margin: 1.25rem 0 1.75rem; }
.portal-tiles a { display: grid; gap: .2rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; }
.portal-tiles a:hover { text-decoration: none; border-color: var(--navy); }
.portal-tiles svg { color: var(--navy); margin-bottom: .25rem; }
.portal-tiles small { color: var(--muted); font-size: .8rem; }
.source-tag { display: inline-block; margin-right: .35rem; padding: 0 .45rem; border-radius: 4px; font-size: .72rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); }
.source-tag.is-feed { background: var(--info-bg); color: var(--info); }
.source-tag.is-confirmed { background: var(--success-bg); color: var(--success); }
.release-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: .6rem 1.1rem; }
.subrow td { background: var(--surface-2); padding-top: .4rem; padding-bottom: .6rem; }
.receipt-line { margin: .2rem 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .88rem; }
.receipt-review + .receipt-review { border-top: 1px solid var(--line); }
.form-grid .span-2 { grid-column: span 2; }
.subrow .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.subrow .form-grid .span-2 { grid-column: auto; }
.subrow td { white-space: normal; }

/* Two-step sign in */
.two-step-list { margin: 0 0 1rem; padding-left: 1.2rem; display: grid; gap: .6rem; }
.two-step-qr { display: block; margin: .6rem 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.two-step-key { font-size: .95rem; letter-spacing: .05em; word-break: break-all; }
.recovery-codes { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.recovery-codes code { display: block; padding: .4rem .6rem; background: var(--surface-2); border-radius: 6px; text-align: center; font-size: .95rem; }
