:root {
  /* Brand colors (colors.txt) */
  --navy: #062849;
  --blue: #164B70;
  --accent: #FF7A0A;
  --accent-hover: #E96800;
  --white: #FFFFFF;
  --bg: #F5F7F9;
  --text: #142D42;
  --muted: #718293;
  /* Darker muted for small text so it stays readable (4.5:1 on white) */
  --muted-strong: #526779;

  --border: #DCE4EA;
  --danger: #B42318;
  --danger-bg: #FEF3F2;
  --success: #067647;
  --success-bg: #ECFDF3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 45, 66, 0.05), 0 1px 3px rgba(20, 45, 66, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

main { flex: 1; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding-inline: 16px; }
.narrow { max-width: 640px; }
.muted { color: var(--muted-strong); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Top bar ---------- */
.topbar { background: var(--navy); color: var(--white); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 16px; min-height: 64px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--white); text-decoration: none; font-weight: 700; font-size: 18px;
}
.brand-logo { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 6px; flex-shrink: 0; }
.brand svg { width: 24px; height: 24px; color: var(--accent); flex-shrink: 0; }
.brand .accent { color: var(--accent); }
.brand-tag {
  font-size: 12px; font-weight: 600; color: var(--navy); background: var(--accent);
  padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.route { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #CCDCE7; }
.route svg { width: 16px; height: 16px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 15px; font-weight: 500; color: #CCDCE7;
  background: transparent; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 12px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--white); border-bottom-color: var(--accent); }

/* ---------- Cards, forms, buttons ---------- */
.page { padding-block: 28px 48px; display: grid; gap: 20px; align-content: start; }
.page > section { display: grid; gap: 20px; }
/* Let wide tables scroll inside their card instead of stretching the page */
.page > *, .page > section > * { min-width: 0; }

.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.card > h2 { margin-bottom: 18px; }

label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted-strong); }

input, select {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--muted); }
input:disabled { background: var(--bg); color: var(--muted-strong); }
input[readonly] { background: var(--bg); cursor: default; }
input[readonly]:focus { border-color: var(--border); box-shadow: none; }
input:focus, select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 75, 112, 0.18);
}
select { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.form-grid > .alert { grid-column: 1 / -1; }
.field-hint { font-size: 13px; color: var(--muted-strong); margin-top: 6px; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 9px 18px; font: inherit; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: var(--text); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue); }
.btn-ghost { background: var(--white); color: var(--blue); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--blue); }
.btn-danger { background: var(--white); color: var(--danger); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.btn-block { width: 100%; }

.link {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--blue);
  background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline;
}

:is(.btn, .tab, .link, a):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 15px;
  background: var(--danger-bg); color: var(--danger); border: 1px solid #FECDCA;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.badge-waiting { background: #FFF0E3; color: #914000; }
.badge-in_flight { background: #EAF1F6; color: var(--blue); }
.badge-arrived { background: var(--success-bg); color: var(--success); }
.badge-role-admin { background: #EAF1F6; color: var(--navy); }
.badge-role-clerk { background: #FFF0E3; color: #914000; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 20px; font-weight: 700;
  background: var(--navy); color: var(--white);
}
.profile-name { font-size: 18px; font-weight: 600; }

/* ---------- Tables ---------- */
/* position: relative keeps the absolutely-positioned .sr-only labels inside the scroll box */
.table-wrap { position: relative; overflow-x: auto; margin-inline: -24px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted-strong); background: #F8FAFB;
  padding: 10px 12px; border-block: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
:is(th, td):first-child { padding-left: 24px; }
:is(th, td):last-child { padding-right: 24px; }
tbody tr { transition: background-color 0.15s; }
tbody tr:hover { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn + .btn { margin-left: 6px; }
td select { min-height: 36px; padding: 5px 8px; font-size: 14px; width: auto; }
.empty { padding: 28px 0 8px; text-align: center; color: var(--muted-strong); }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.toolbar h2 { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.filters input { max-width: 300px; }
.filters select { width: auto; }
.summary { font-size: 14px; color: var(--muted-strong); margin-top: 14px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.rate-form label { margin-bottom: 4px; }
.rate-form input { width: 120px; }

/* ---------- Staff dashboard shell ---------- */
.shell { flex: 1; display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 20px 14px 0; background: var(--navy); color: var(--white);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px 24px; }
.icon-btn.sidebar-close { display: none; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px;
  padding: 10px 12px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 15px; font-weight: 500; color: #CCDCE7; text-align: left; text-decoration: none;
  cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-link .ext { width: 14px; height: 14px; margin-left: auto; opacity: 0.7; }
.side-link:hover { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.side-link.active { background: var(--blue); color: var(--white); font-weight: 600; }
.side-link.active svg { color: var(--accent); }
.side-link.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent);
}
.side-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.side-divider { height: 1px; margin: 10px 12px; background: rgba(255, 255, 255, 0.12); }

.side-user {
  display: flex; align-items: center; gap: 10px;
  margin: 16px -14px 0; padding: 14px 12px 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.avatar-sm { width: 36px; height: 36px; font-size: 14px; background: var(--accent); color: var(--text); }
.side-user-info { flex: 1; min-width: 0; }
.side-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-role { font-size: 12px; color: #CCDCE7; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
  transition: background-color 0.15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.shell-main { min-width: 0; display: flex; flex-direction: column; }
.shell .page { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 32px; }
.mobile-bar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 272px; max-width: 85vw; height: auto;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .shell.nav-open .sidebar { transform: none; visibility: visible; }
  .icon-btn.sidebar-close { display: inline-grid; margin-right: -6px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(6, 40, 73, 0.45); }
  .mobile-bar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px;
    min-height: 56px; padding-inline: 6px 16px; background: var(--navy); color: var(--white);
  }
  .shell .page { padding-inline: 16px; padding-top: 20px; }
}

.side-badge {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.14); color: var(--white);
}
.side-badge:empty { display: none; }
.side-link.active .side-badge { background: var(--accent); color: var(--text); }

/* ---------- Home ---------- */
.card-sub { font-size: 14px; color: var(--muted-strong); margin-top: 3px; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.eyebrow {
  margin-bottom: 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted-strong);
}
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Route board */
.card.route-board { padding: 0; overflow: hidden; }
.route-line {
  display: flex; align-items: center; gap: 16px; padding: 18px 24px;
  background: var(--navy); color: var(--white);
}
.port { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.port-code {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  font-size: 14px; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.4);
}
.port-end .port-code { background: var(--accent); border-color: var(--accent); color: var(--text); }
.port-name { font-size: 16px; font-weight: 600; }
.route-track {
  position: relative; flex: 1; min-width: 40px; height: 2px;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0 8px, transparent 8px 16px);
}
.route-plane {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--navy); color: var(--accent);
}
.route-plane svg { width: 22px; height: 22px; transform: rotate(45deg); }

.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage { min-width: 0; padding: 20px 24px 24px; }
.stage + .stage { border-left: 1px solid var(--border); }
.stage-head { display: flex; align-items: center; gap: 8px; }
.stage-head h3 { font-size: 15px; font-weight: 600; }
.stage-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.stage-meta { margin: 2px 0 14px 18px; font-size: 14px; color: var(--muted-strong); }
.tickets { display: grid; gap: 10px; }
.ticket {
  display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left;
  font: inherit; color: var(--text); cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--stage-color);
  border-radius: 8px; transition: background-color 0.15s, border-color 0.15s;
}
.ticket:hover { background: var(--white); border-color: var(--blue); border-left-color: var(--stage-color); }
.ticket:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ticket-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 15px; }
.ticket-nick { font-size: 14px; color: var(--muted-strong); }
.ticket-tag {
  margin-left: auto; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #FFF0E3; color: #914000;
}
.ticket-when { font-size: 14px; }
.ticket-load { font-size: 13px; color: var(--muted-strong); }
.stage-empty {
  padding: 12px 14px; border: 1px dashed var(--border); border-radius: 8px;
  font-size: 14px; color: var(--muted-strong);
}
.stage-more { padding-left: 4px; font-size: 13px; color: var(--muted-strong); }
.route-totals {
  padding: 14px 24px; border-top: 1px solid var(--border); background: #F8FAFB;
  font-size: 14px; color: var(--muted-strong);
}
.route-totals strong { color: var(--text); font-weight: 600; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.home-grid > * { min-width: 0; }

/* Today in Dubai */
.today-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.today-figures > div { min-width: 0; padding: 14px 16px; border-radius: 8px; background: var(--bg); }
.fig { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fig-label { font-size: 13px; color: var(--muted-strong); }
.mini-title {
  margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted-strong);
}
.staff-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.staff-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
.staff-list .avatar-xs { grid-row: span 2; }
.staff-name { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.staff-count { font-size: 13px; color: var(--muted-strong); white-space: nowrap; }
.staff-bar { grid-column: 2 / 4; height: 6px; overflow: hidden; border-radius: 999px; background: #EAF0F4; }
.staff-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.today-empty { display: grid; justify-items: center; gap: 14px; padding: 20px 8px; text-align: center; color: var(--muted-strong); }

.avatar-xs { width: 32px; height: 32px; font-size: 12px; }
.avatar-me { background: var(--accent); color: var(--text); }

/* Latest activity */
.activity { margin: 0; padding: 0; list-style: none; }
.activity-item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { padding-bottom: 0; border-bottom: 0; }
.activity-text p { font-size: 15px; }
.activity-text .activity-meta { margin-top: 2px; font-size: 13px; color: var(--muted-strong); }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 2px; border: 0; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--blue); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.link-btn svg { width: 16px; height: 16px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tracking-link { font-weight: 600; color: var(--blue); text-decoration: none; }
.tracking-link:hover { text-decoration: underline; }

/* ---------- Flight detail ---------- */
.back-link { margin: 0 0 6px -4px; padding-block: 2px; }
.fd-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.fd-nick { font-weight: 500; color: var(--muted-strong); }
.route-plane { transition: left 0.3s ease; }
.fd-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 20px 24px; }
.fd-figures > .kpi { background: var(--white); }
.fd-figures .fig { overflow: hidden; text-overflow: ellipsis; }

tfoot td {
  font-weight: 700; color: var(--navy); background: #F8FAFB;
  border-top: 2px solid var(--border); border-bottom: 0;
}
.row-link { cursor: pointer; }
.cell-link {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 600;
  color: var(--blue); text-align: left; cursor: pointer; white-space: nowrap;
}
.cell-link:hover { text-decoration: underline; }
.cell-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.menu { position: relative; display: inline-flex; }
.btn .chev { width: 16px; height: 16px; margin-left: 2px; transition: transform 0.15s; }
.btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.menu-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 25; min-width: 260px; padding: 6px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(20, 45, 66, 0.16);
}
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 8px;
  background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.menu-item strong { display: block; font-size: 15px; font-weight: 600; }
.menu-item small { display: block; font-size: 13px; color: var(--muted-strong); }
.file-ico {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.file-pdf { background: var(--danger-bg); color: var(--danger); }
.file-xlsx { background: var(--success-bg); color: var(--success); }

@media (max-width: 640px) {
  .fd-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; }
  .head-actions .menu { flex: 1 1 auto; }
  .menu .btn { width: 100%; }
  .menu-list { left: 0; right: auto; width: 100%; min-width: 0; }
}

/* ---------- Finance ---------- */
.fin-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
}
.segmented button {
  min-height: 36px; padding: 6px 14px; border: 0; border-radius: 7px; background: none;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted-strong); white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.segmented button:hover { background: var(--bg); color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--navy); color: var(--white); font-weight: 600; }
.segmented button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.fin-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fin-custom input { width: auto; min-height: 40px; padding: 6px 10px; }
.fin-custom span { font-size: 14px; color: var(--muted-strong); }

/* While new numbers load, keep the old ones visible but faded */
[data-fin-data] { transition: opacity 0.15s; }
.is-loading [data-fin-data] { opacity: 0.55; }

.fin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  display: grid; align-content: start; gap: 2px; min-width: 0; padding: 18px 20px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi-label { font-size: 14px; font-weight: 500; color: var(--muted-strong); }
.kpi-value {
  overflow: hidden; font-size: 28px; font-weight: 700; line-height: 1.25;
  white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.kpi-delta { font-size: 13px; font-weight: 600; }
.kpi-vs { font-weight: 400; color: var(--muted-strong); }
.tone-good { color: var(--success); }
.tone-bad { color: var(--danger); }
.tone-flat { color: var(--muted-strong); }
.neg { color: var(--danger); }
.fin-ops { margin-top: -6px; font-size: 14px; color: var(--muted-strong); }
.fin-ops strong { font-weight: 600; color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted-strong); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend-key { width: 12px; height: 12px; border-radius: 3px; }
.key-revenue { background: #164B70; }
.key-expenses { background: #E96800; }

.fin-chart-wrap { position: relative; }
.fin-chart { min-height: 260px; }
.fin-chart svg { display: block; overflow: visible; }
.fin-chart .grid { stroke: #EAF0F4; stroke-width: 1; }
.fin-chart .axis { stroke: var(--border); stroke-width: 1; }
.fin-chart .tick { font-size: 12px; fill: var(--muted-strong); font-variant-numeric: tabular-nums; }
.fin-chart .hit { fill: transparent; }
.fin-chart .bucket { outline: none; }
.fin-chart .bucket.active .hit { fill: rgba(22, 75, 112, 0.06); }
.fin-chart .bucket:focus-visible .hit { stroke: var(--accent); stroke-width: 2; }
.chart-tip {
  position: absolute; top: 8px; z-index: 5; min-width: 160px; padding: 10px 12px; pointer-events: none;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 45, 66, 0.14);
}
.tip-title { margin-bottom: 4px; font-size: 13px; color: var(--muted-strong); white-space: nowrap; }
.tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.tip-row strong { font-variant-numeric: tabular-nums; }
.tip-row span:last-child { color: var(--muted-strong); }
.tip-key { width: 14px; height: 2px; border-radius: 1px; }
.fin-details { margin-top: 14px; }
.fin-details summary { width: fit-content; font-size: 14px; font-weight: 600; color: var(--blue); cursor: pointer; }
.fin-details .table-wrap { margin-top: 12px; }

.fin-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1280px) {
  .fin-grid { grid-template-columns: minmax(0, 1fr); }
}
.fin-grid > * { min-width: 0; }
.cat-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.cat-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.cat-name { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.cat-amount { font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-bar { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 999px; background: #EAF0F4; }
.cat-bar > span { display: block; height: 100%; border-radius: 999px; background: #E96800; }

.file-csv { background: #EAF1F6; color: var(--blue); }
.file-ico svg { width: 20px; height: 20px; }
.file-report { background: var(--bg); color: var(--blue); }
.report-list { margin: 0; padding: 0; list-style: none; }
.report-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.report-row:first-child { padding-top: 0; }
.report-text { display: grid; flex: 1; min-width: 160px; }
.report-text span { font-size: 13px; color: var(--muted-strong); }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.fin-next { margin-top: 14px; font-size: 14px; color: var(--muted-strong); }

@media (max-width: 1100px) {
  .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .segmented { width: 100%; }
  .segmented button { flex: 1 1 auto; padding-inline: 10px; }
  .fin-kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
}

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .stages { grid-template-columns: minmax(0, 1fr); }
  .stage + .stage { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 640px) {
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
  .route-line { gap: 10px; padding: 14px 16px; }
  .port-code { width: 42px; height: 42px; font-size: 12px; }
  .port-name { font-size: 14px; }
  .route-plane { width: 32px; height: 32px; }
  .route-plane svg { width: 18px; height: 18px; }
  .stage { padding: 16px; }
  .route-totals { padding: 12px 16px; }
  .fig { font-size: 22px; }
  .today-figures > div { padding: 12px; }
  .activity-item { grid-template-columns: 32px minmax(0, 1fr); }
  .activity-item .badge { grid-column: 2; justify-self: start; }
}

@media (max-width: 380px) {
  .port-name { display: none; }
}

/* ---------- Login ---------- */
.login-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 32px 16px;
}
.brand-dark { color: var(--navy); font-size: 22px; }
.login { max-width: 400px; width: 100%; }
.login h1 { font-size: 22px; margin-bottom: 6px; }
.login form { display: grid; gap: 14px; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 8px; font-size: 15px; font-weight: 500;
  background: var(--text); color: var(--white); box-shadow: 0 8px 24px rgba(20, 45, 66, 0.2);
}
.toast-error { background: var(--danger); }

/* ---------- Tracking page ---------- */
.hero { padding-block: 48px 24px; text-align: center; }
.hero p { margin-top: 8px; }
.track-form { display: flex; gap: 8px; margin-top: 24px; }
.track-form input { flex: 1; min-width: 0; min-height: 52px; font-size: 17px; text-transform: uppercase; }
.track-form input::placeholder { text-transform: none; }
.track-form .btn { min-height: 52px; padding-inline: 24px; }

.result { margin-bottom: 48px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.label { font-size: 13px; color: var(--muted-strong); }
.tracking-id { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.status-text { margin-top: 12px; }

.steps {
  list-style: none; margin: 28px 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.step {
  position: relative; padding-top: 40px; text-align: center;
  font-size: 14px; color: var(--muted-strong);
}
.step::after {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px;
  background: var(--border);
}
.step:first-child::after { display: none; }
.dot {
  position: absolute; top: 0; left: 50%; z-index: 1; transform: translateX(-50%);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--white); border: 2px solid var(--border); color: var(--white);
}
.dot svg { width: 16px; height: 16px; visibility: hidden; }
.step.done { color: var(--text); }
.step.done .dot { background: var(--navy); border-color: var(--navy); }
.step.done .dot svg { visibility: visible; }
.step.done::after { background: var(--navy); }
.step.current { color: var(--text); font-weight: 600; }
.step.current .dot { background: var(--accent); border-color: var(--accent); color: var(--text); }
.step.current .dot svg { visibility: visible; }

.details {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px;
  margin: 0; padding-top: 20px; border-top: 1px solid var(--border);
}
.details dt { font-size: 13px; color: var(--muted-strong); }
.details dd { margin: 2px 0 0; font-weight: 600; }

.site-footer { padding-block: 24px; text-align: center; font-size: 14px; color: var(--muted-strong); }
.site-footer a { color: var(--blue); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .card { padding: 18px; }
  .table-wrap { margin-inline: -18px; }
  :is(th, td):first-child { padding-left: 18px; }
  :is(th, td):last-child { padding-right: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-spacer { display: none; }
  .filters { justify-content: stretch; flex: 1 1 100%; }
  .filters input { max-width: none; }
  .filters > * { flex: 1 1 100%; }
  .track-form { flex-direction: column; }
  .hero { padding-top: 32px; }
  .steps .step { font-size: 13px; }
}

@media (max-width: 440px) {
  .details { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Admin business overview */
.overview-metric { font: inherit; text-align: left; color: var(--text); cursor: pointer; }
.overview-metric:hover { border-color: var(--blue); }
.overview-metric:focus-visible, .overview-flight:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.overview-metric-label { display: flex; justify-content: space-between; gap: 8px; }
.overview-metric .kpi-vs { font-size: 13px; }
.overview-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.overview-stage { display: grid; gap: 8px; padding: 4px 20px; border-left: 1px solid var(--border); }
.overview-stage:first-child { border-left: 0; padding-left: 0; }
.overview-stage-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.overview-stage i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.overview-stage-in_flight i { background: var(--blue); }
.overview-stage-arrived i { background: var(--success); }
.overview-stage strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.overview-stage small { font-size: 13px; font-weight: 400; color: var(--muted-strong); }
.overview-stage > span:last-child { font-size: 13px; color: var(--muted-strong); }
.overview-columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.overview-columns > * { min-width: 0; }
.overview-attention { background: #FFF0E3; color: #914000; border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.overview-flight { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; font: inherit; text-align: left; color: var(--text); cursor: pointer; }
.overview-flight:last-child { border-bottom: 0; }
.overview-flight:hover strong { color: var(--blue); text-decoration: underline; }
.overview-flight > span { min-width: 0; display: grid; gap: 7px; }
.overview-flight strong { font-size: 14px; overflow-wrap: anywhere; }
.overview-flight-date, .overview-flight-right > span:last-child { font-size: 12px; color: var(--muted-strong); }
.overview-flight-right { justify-items: end; flex-shrink: 0; }
.overview-flight-date.overdue { color: var(--danger); }
.overview-totals > h2 { margin-bottom: 4px; }
.overview-totals dl { margin: 16px 0 22px; }
.overview-totals dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.overview-totals dt { color: var(--muted-strong); }
.overview-totals dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-secondary { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .overview-columns { grid-template-columns: minmax(0, 1fr); }

  .overview-metrics { gap: 10px; }
  .overview-status-grid { gap: 12px; }
  .overview-stage { padding: 0 0 0 12px; }
  .overview-stage-label { font-size: 12px; }
  .overview-stage strong { font-size: 26px; }
  .overview-stage small { display: block; font-size: 11px; }
  #home-view .toolbar { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 380px) { .overview-metrics { grid-template-columns: minmax(0, 1fr); } .overview-flight { flex-wrap: wrap; } }

/* Shared finance-style surfaces for route details and customer tracking. */
.route-line { background: var(--bg); color: var(--navy); border-bottom: 1px solid var(--border); }
.port-code { background: var(--white); border-color: var(--border); }
.route-track { background-image: repeating-linear-gradient(90deg, var(--border) 0 8px, transparent 8px 16px); }
.route-plane { background: var(--bg); color: var(--navy); }
.tracking-page { padding-block: 28px 48px; display: grid; gap: 20px; align-content: start; }
.tracking-page .hero { padding: 24px; text-align: left; }
.tracking-page .track-form { margin-top: 20px; }
.tracking-page .track-form input, .tracking-page .track-form .btn { min-height: 44px; font-size: 16px; }
.tracking-page .result { margin-bottom: 0; }

.enquiry-item { padding: 20px 0; border-bottom: 1px solid #e4e9ef; }
.enquiry-message { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; }
#enquiries-panel { margin-bottom: 24px; }

tfoot .flight-account-row td { border-top: 0; font-weight: 500; }
tfoot .flight-net-row td { border-top: 1px solid var(--navy); font-weight: 750; }
tfoot .flight-net-row td.num { border-bottom: 3px double var(--navy); }

.payment-toggle { border: 1px solid #d6dfe6; border-radius: 7px; padding: 8px 12px; background: #fff5e9; color: #874400; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.payment-toggle.is-paid { background: #eaf6ef; color: #18623d; border-color: #bedecb; }
.payment-toggle:disabled { opacity: .5; cursor: wait; }
