/* Avion Admin — Avion Brand Guidelines v1.1 (Oct 2026). Use these values only; do not pick colours by eye.
   Primary: Midnight #0B1440, Blue #26397F, Olive #AED05F (highlights and buttons only).
   Secondary: Dark olive #6F8A22, Light blue #A9B9E6, Cream #F4F2EC, White #FFFFFF.
   Text and UI: Ink #0F1840, Muted #5B6482, Line #E3E5EE.
   Fonts: Poppins (headlines, wordmark) + Inter (body, labels, UI). Self-hosted from /fonts.
   Status colours (good/warn/bad) are functional UI states not covered by the guide. */
@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
:root {
  --brand-midnight: #0B1440; --brand-blue: #26397F; --brand-olive: #AED05F;
  --brand-dark-olive: #6F8A22; --brand-light-blue: #A9B9E6; --brand-cream: #F4F2EC; --white: #FFFFFF;
  --ink: #0F1840; --ink-2: #0F1840; --ink-3: #5B6482; --line: #E3E5EE; --line-strong: #A9B9E6;
  --brand-bg: radial-gradient(900px 500px at 85% 30%, rgba(60,100,230,.35), transparent 70%), linear-gradient(135deg, #0a1233 0%, #16255f 55%, #26397f 100%);
  --midnight: var(--brand-midnight); --midnight-2: #16255f; --midnight-3: var(--brand-blue);
  --olive: var(--brand-olive); --olive-dark: var(--brand-dark-olive); --olive-tint: var(--brand-cream);
  --sky: var(--brand-light-blue); --sky-tint: #EEF1FA; --sky-ink: var(--brand-blue);
  --page: var(--white);
  --good: #2E6B2A; --good-bg: #E6F2E3; --warn: #8A5A00; --warn-bg: #FDF1D9; --bad: #A12A1C; --bad-bg: #FBE6E2; --info-bg: var(--sky-tint);
  --radius: 14px; --shadow: 0 1px 2px rgba(15,24,64,.05), 0 6px 20px rgba(15,24,64,.06);
  --font: 'Inter', system-ui, sans-serif; --display: 'Poppins', system-ui, sans-serif; --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--page); }
a { color: var(--sky-ink); }
a:hover { color: var(--midnight); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; align-self: flex-start; background: var(--brand-bg); background-color: var(--brand-midnight); color: #E3E5EE; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 26px 20px 18px; color: var(--white); text-decoration: none; }
.brand img.logo { height: 26px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.brand img.mark { height: 34px; width: auto; display: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--olive); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--white); }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: .01em; }
.brand-sub { font-family: var(--font); font-weight: 600; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--brand-olive); }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #E3E5EE; text-decoration: none; font-weight: 500; min-height: 40px; }
.nav a:hover { background: var(--midnight-2); color: var(--white); }
.nav a[aria-current="page"] { background: rgba(169,185,230,.16); color: var(--white); box-shadow: inset 3px 0 0 var(--brand-olive); }
.nav a[aria-current="page"] svg { color: var(--brand-olive); }
.nav .badge { margin-left: auto; background: var(--brand-olive); color: var(--brand-midnight); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.who { padding: 14px 16px; border-top: 1px solid rgba(169,185,230,.25); font-size: 12.5px; }
.who strong { color: var(--white); display: block; font-size: 13.5px; }
.who button { margin-top: 10px; width: 100%; background: transparent; border: 1px solid rgba(169,185,230,.5); color: var(--white); border-radius: 999px; padding: 8px; cursor: pointer; }
.who button:hover { background: rgba(169,185,230,.16); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 12px 0 36px; background: var(--page); }
.search svg { position: absolute; left: 11px; top: 11px; color: var(--ink-3); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 420px; overflow: auto; z-index: 20; }
.search-results a { display: flex; gap: 10px; padding: 9px 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a:focus { background: var(--sky-tint); }
.env { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #B9C3CC; display: inline-block; }
.live.on i { background: #3E9B3A; }
.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--display); font-size: 28px; font-weight: 500; margin: 0; line-height: 1.1; letter-spacing: -.015em; color: var(--ink); }
.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.crumb a { color: var(--ink-3); }

/* Cards, KPIs */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h2 { font-family: var(--display); font-size: 16px; font-weight: 500; line-height: 1.1; margin: 0; }
.card-b { padding: 16px 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi .value { font-family: var(--display); font-size: 26px; font-weight: 500; letter-spacing: -.015em; line-height: 1.15; }
.kpi .sub { font-size: 12.5px; color: var(--ink-3); }
.kpi .money-line { font-family: var(--display); font-size: 17px; font-weight: 600; }
.kpi.accent { border-top: 3px solid var(--brand-blue); }
.tip { position: relative; display: inline-flex; }
.tip > button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--white); color: var(--ink-3); font-size: 11px; line-height: 1; cursor: help; padding: 0; }
.tip [role="tooltip"] { display: none; position: absolute; left: -8px; top: 24px; width: 260px; background: var(--midnight); color: var(--white); padding: 9px 11px; border-radius: 8px; font-size: 12px; font-weight: 400; z-index: 30; box-shadow: var(--shadow); }
.tip:hover [role="tooltip"], .tip:focus-within [role="tooltip"] { display: block; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); background: var(--brand-cream); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--sky-tint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--ink-3); }

/* Filters, forms, buttons */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field input, .field select, .field textarea { height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; background: var(--white); min-width: 140px; color: var(--ink); font-weight: 400; }
.field textarea { height: auto; min-height: 84px; padding: 9px 10px; resize: vertical; }
.field .hint { font-weight: 400; color: var(--ink-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand-olive); border-color: var(--brand-olive); color: var(--brand-midnight); }
.btn.primary:hover { background: #9fc04f; border-color: #9fc04f; }
.btn.dark { background: var(--midnight); border-color: var(--midnight); color: var(--white); }
.btn.danger { color: var(--bad); border-color: #E7B8B0; }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--white); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-weight: 600; color: var(--ink-3); cursor: pointer; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand-blue); }

/* Pills, status */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #EEF1F4; color: var(--ink-2); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--sky-tint); color: var(--sky-ink); }
.notice { padding: 11px 14px; border-radius: 10px; background: var(--sky-tint); color: var(--brand-blue); font-size: 13px; border: 1px solid var(--brand-light-blue); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: #F3DDAA; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: #F0C3BB; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--ink-3); font-size: 12.5px; }
.dl dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.msg { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 10px; }
.msg.inbound { background: #F7F9FB; }
.msg.note { background: #FFF8E6; border-color: #F1DFAE; }
.msg.reply { background: var(--olive-tint); border-color: #D3DDCB; }
.msg header { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }

/* States */
.state { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.state h3 { color: var(--ink); margin: 0 0 6px; font-size: 16px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #EDF1F4, #F6F8FA, #EDF1F4); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Modal, toast, AI panel */
.backdrop { position: fixed; inset: 0; background: rgba(11,29,44,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--white); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(11,29,44,.35); }
.modal h2 { font-family: var(--display); font-size: 19px; margin: 0; padding: 20px 22px 0; }
.modal .body { padding: 14px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--midnight); color: var(--white); padding: 11px 14px; border-radius: 10px; max-width: 420px; box-shadow: var(--shadow); font-size: 13px; }
.toast.bad { background: var(--bad); }
.ai-fab { background: var(--brand-midnight); color: var(--white); border-color: var(--brand-midnight); }
.ai-fab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-olive); }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--white); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(11,29,44,.15); z-index: 40; display: flex; flex-direction: column; }
.ai-panel header { padding: 16px 18px; background: var(--brand-bg); background-color: var(--brand-midnight); color: var(--white); display: flex; align-items: center; gap: 10px; }
.ai-panel .log { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-bubble { padding: 10px 12px; border-radius: 10px; background: #F2F5F8; white-space: pre-wrap; font-size: 13px; }
.ai-bubble.me { background: var(--sky-tint); align-self: flex-end; }
.ai-panel form { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.ai-panel form input { flex: 1; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.matrix th, .matrix td { text-align: center; padding: 6px 8px; font-size: 12px; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); text-transform: none; letter-spacing: 0; height: 150px; vertical-align: bottom; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--brand-bg); background-color: var(--brand-midnight); color: var(--white); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-family: var(--display); font-weight: 500; font-size: 56px; margin: 0; max-width: 460px; line-height: 1.1; letter-spacing: -.02em; }
.login-art h1 em { font-style: normal; color: var(--brand-olive); }
.login-art .label { font-weight: 600; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--brand-olive); margin-bottom: 16px; }
.login-art img.logo { height: 30px; width: auto; align-self: flex-start; }
.login-form img.logo { height: 22px; width: auto; align-self: flex-start; display: none; }
.login-art p { color: var(--brand-light-blue); max-width: 440px; font-size: 16px; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--white); }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { font-family: var(--display); font-weight: 500; margin: 0; font-size: 26px; line-height: 1.1; letter-spacing: -.015em; }
.login-form input { height: 44px; }

/* Tablet */
@media (max-width: 1024px) {
  .sidebar { width: 76px; }
  .brand-name, .brand-sub, .nav a span, .who strong, .who span, .nav .badge, .brand img.logo { display: none; }
  .brand { align-items: center; padding: 18px 8px; }
  .brand img.mark { display: block; }
  .login-form img.logo { display: block; }
  .nav a { justify-content: center; padding: 10px; }
  .who button { font-size: 11px; padding: 6px; }
  .content { padding: 18px; }
  .topbar { padding: 10px 18px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}

/* Brand label style (guide: Inter SemiBold 12px, uppercase, +0.22em, dark olive on light) */
.label-text, .section-label { font-family: var(--font); font-weight: 600; font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--brand-dark-olive); }
.crumb { letter-spacing: .02em; }
.card { border-radius: var(--radius); }
.kpi { border-radius: var(--radius); }
.field input, .field select, .field textarea { border-radius: 10px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-blue); outline: none; box-shadow: 0 0 0 3px rgba(169,185,230,.5); }
.btn.dark { background: var(--brand-midnight); border-color: var(--brand-midnight); }
.topbar { border-bottom-color: var(--line); }
.search input { background: var(--white); border-color: var(--line); border-radius: 999px; }
.env { border-radius: 999px; }
