:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #eef2f7;
  --line: #e2e8f0;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --side: #0b1220;
  --side-2: #111827;
  --teal: #0ea5a4;
  --teal-2: #0f766e;
  --yellow: #fbbf24;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --shadow: 0 6px 20px rgba(15, 23, 42, .07);
  --r: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.45; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app { background: linear-gradient(90deg, var(--side) 0 236px, var(--bg) 236px); display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.app.sidebar-collapsed { background: linear-gradient(90deg, var(--side) 0 68px, var(--bg) 68px); grid-template-columns: 68px minmax(0, 1fr); }
.side { background: var(--side); border-right: 1px solid #1f2937; color: #cbd5e1; display: flex; flex-direction: column; height: 100dvh; min-height: 100vh; position: sticky; top: 0; }
.sidebar-collapsed .side { width: 68px; }
.brand { align-items: center; border-bottom: 1px solid #1f2937; display: flex; gap: 10px; padding: 16px; }
.brand-mark { align-items: center; background: var(--yellow); border-radius: 7px; color: #422006; display: flex; font-weight: 900; height: 30px; justify-content: center; width: 30px; }
.brand-name { color: #fff; font-weight: 800; }
.brand-sub { color: #67e8f9; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-collapsed .brand { justify-content: center; padding: 16px 8px; }
.sidebar-collapsed .brand > div:last-child, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav button span:nth-child(2), .sidebar-collapsed .nav .count, .sidebar-collapsed .side-box, .sidebar-collapsed .side-foot { display: none; }
.nav-label { color: #94a3b8; font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 14px 12px 6px; text-transform: uppercase; }
.nav { display: grid; gap: 2px; padding: 0 8px; }
.nav button { align-items: center; background: transparent; border: 0; border-radius: 6px; color: #cbd5e1; display: grid; gap: 9px; grid-template-columns: 18px 1fr auto; padding: 8px 10px; text-align: left; width: 100%; }
.sidebar-collapsed .nav { padding: 12px 8px 0; }
.sidebar-collapsed .nav button { grid-template-columns: 1fr; justify-items: center; padding: 10px 0; }
.nav button:hover, .nav button.active { background: #1e293b; color: #fff; }
.nav .count { color: #94a3b8; font-size: 11px; }
.side-box { background: rgba(14, 165, 164, .1); border: 1px solid rgba(103, 232, 249, .22); border-radius: var(--r); color: #a5f3fc; margin: auto 12px 12px; padding: 11px; }
.side-foot { border-top: 1px solid #1f2937; color: #94a3b8; padding: 12px; }
.main { min-width: 0; }
.top { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; gap: 10px; padding: 12px 22px; position: sticky; top: 0; z-index: 5; }
.mobile-menu { display: inline-flex; }
.crumbs { color: var(--ink-3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs strong { color: var(--ink); }
.status-pill { align-items: center; background: var(--surface-3); border: 1px solid var(--line); border-radius: 999px; display: inline-flex; gap: 6px; padding: 5px 10px; white-space: nowrap; }
.dot { background: var(--green); border-radius: 50%; height: 7px; width: 7px; }
.page { padding: 22px 24px 42px; }
.view-head { align-items: flex-start; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 18px; }
.eyebrow { color: var(--teal-2); font-size: 11px; font-weight: 900; letter-spacing: .08em; margin-bottom: 5px; text-transform: uppercase; }
h1, h2, h3 { letter-spacing: 0; margin: 0; }
h1 { font-size: 25px; line-height: 1.18; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--ink-3); }
.grid { display: grid; gap: 14px; min-width: 0; }
.grid-2 { grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.band, .metric, .trip-card, .step, .detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 2px rgba(15, 23, 42, .03); min-width: 0; }
.band { padding: 14px; }
.band-head { align-items: center; border-bottom: 1px solid #edf2f7; display: flex; gap: 10px; justify-content: space-between; margin: -2px -2px 12px; padding: 0 2px 10px; }
.metric { min-height: 94px; padding: 12px; }
.metric-label { color: var(--ink-3); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.metric-value { font-size: 24px; font-weight: 900; margin-top: 8px; }
.btn { align-items: center; border: 1px solid var(--line); border-radius: 6px; display: inline-flex; gap: 7px; justify-content: center; min-height: 32px; padding: 6px 10px; text-decoration: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.btn-danger:hover { background: #ffe4e6; }
.btn-sm { min-height: 28px; padding: 4px 8px; }
.btn-icon { min-width: 32px; padding: 6px; }
.badge { align-items: center; border-radius: 999px; display: inline-flex; font-size: 11.5px; font-weight: 800; gap: 4px; line-height: 1; padding: 5px 7px; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.lab { background: #ecfeff; color: #0e7490; }
.badge.gray { background: var(--surface-3); color: var(--ink-2); }
.trip-list { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trip-card { overflow: hidden; text-align: left; width: 100%; }
.trip-card:hover { border-color: rgba(14, 165, 164, .55); box-shadow: var(--shadow); }
.trip-visual { background: linear-gradient(135deg, rgba(14, 165, 164, .8), rgba(15, 23, 42, .93)), linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px); background-size: auto, 22px 22px; height: 90px; position: relative; }
.route-line { border-top: 2px solid rgba(255,255,255,.82); left: 22px; position: absolute; right: 26px; top: 48px; }
.route-line:before, .route-line:after { background: #fff; border: 3px solid rgba(15,23,42,.35); border-radius: 50%; content: ""; height: 10px; position: absolute; top: -7px; width: 10px; }
.route-line:before { left: 0; }
.route-line:after { right: 0; }
.plane { color: #fff; font-size: 19px; left: 50%; position: absolute; top: 32px; transform: translateX(-50%); }
.trip-body { padding: 12px; }
.trip-title { font-size: 15px; font-weight: 900; line-height: 1.25; margin-bottom: 8px; }
.trip-meta { color: var(--ink-2); display: grid; gap: 4px; font-size: 12.5px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; }
.table-wrap table { min-width: 760px; }
th, td { border-bottom: 1px solid #edf2f7; overflow-wrap: anywhere; padding: 9px 8px; text-align: left; vertical-align: top; }
th { color: var(--ink-3); font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.row-selected td { background: #ecfeff; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { color: var(--ink-2); display: grid; font-size: 12px; font-weight: 800; gap: 5px; }
input, textarea, select { background: white; border: 1px solid var(--line); border-radius: 6px; min-height: 34px; min-width: 0; padding: 7px 9px; width: 100%; }
textarea { min-height: 92px; resize: vertical; }
.dropzone { align-items: center; background: repeating-linear-gradient(135deg, #f8fafc, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px); border: 1px dashed #cbd5e1; border-radius: var(--r); display: grid; gap: 12px; min-height: 170px; padding: 18px; text-align: center; }
.dropzone.drag-over { background: #ecfeff; border-color: var(--teal); box-shadow: inset 0 0 0 1px rgba(14,165,164,.28); }
.dropzone input { background: white; }
.steps { display: grid; gap: 8px; }
.step { align-items: flex-start; display: grid; gap: 10px; grid-template-columns: 26px minmax(0,1fr) auto; padding: 10px; }
.step-index { align-items: center; background: var(--surface-3); border-radius: 50%; color: var(--ink-2); display: flex; font-size: 11px; font-weight: 900; height: 24px; justify-content: center; width: 24px; }
.step.active { border-color: rgba(14, 165, 164, .45); }
.step.active .step-index { background: var(--teal); color: white; }
.step-title { font-weight: 900; }
.step-text { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.timeline { display: grid; gap: 8px; }
.timeline-item { align-items: flex-start; background: transparent; border: 0; border-radius: var(--r); color: inherit; display: grid; gap: 12px; grid-template-columns: 118px minmax(0,1fr) auto; padding: 8px; text-align: left; width: 100%; }
.timeline-item:hover, .timeline-item.selected { background: #ecfeff; }
.time { color: var(--ink-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.timeline-main { border-left: 2px solid var(--line); padding-left: 12px; }
.timeline-item.selected .timeline-main { border-color: var(--teal); }
.api-strip { background: #0f172a; border-radius: var(--r); color: #cbd5e1; display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; }
.api-cell { border-left: 1px solid #334155; min-width: 0; padding-left: 10px; }
.api-cell:first-child { border-left: 0; padding-left: 0; }
.api-label { color: #94a3b8; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.api-value { color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; margin-top: 3px; overflow-wrap: anywhere; }
.segmented { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r); display: inline-flex; padding: 3px; }
.segmented button { background: transparent; border: 0; border-radius: 6px; color: var(--ink-2); padding: 5px 9px; }
.segmented button.active { background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.08); color: var(--ink); }
.chat { display: grid; gap: 10px; }
.message { border-radius: var(--r); max-width: 84%; overflow-wrap: anywhere; padding: 10px 12px; }
.message.ai { background: var(--surface-3); color: var(--ink-2); }
.message.user { background: var(--teal); color: #fff; justify-self: end; }
.chat-input { align-items: center; border-top: 1px solid #edf2f7; display: flex; gap: 8px; margin-top: 4px; padding-top: 12px; }
.chat-input input { flex: 1; }
.assistant-fab { align-items: center; background: var(--teal); border: 1px solid rgba(255,255,255,.5); border-radius: 999px; bottom: 22px; box-shadow: 0 14px 36px rgba(15,23,42,.18); color: #fff; display: flex; font-size: 18px; height: 44px; justify-content: center; position: fixed; right: 22px; width: 44px; z-index: 18; }
.assistant-backdrop { background: rgba(15,23,42,.18); border: 0; display: none; inset: 0; padding: 0; position: fixed; z-index: 29; }
.assistant-backdrop.active { display: block; }
.assistant-drawer { background: var(--surface); border-left: 1px solid var(--line); box-shadow: -18px 0 42px rgba(15,23,42,.16); display: flex; flex-direction: column; height: 100vh; max-width: min(440px, calc(100vw - 24px)); position: fixed; right: 0; top: 0; transform: translateX(104%); transition: transform 180ms ease; width: 420px; z-index: 30; }
.assistant-drawer.open { transform: translateX(0); }
.assistant-head { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 16px; }
.assistant-body { display: grid; gap: 14px; min-height: 0; overflow: auto; padding: 14px 16px 92px; }
.assistant-input { align-items: center; background: var(--surface); border-top: 1px solid var(--line); bottom: 0; display: flex; gap: 8px; left: 0; padding: 12px; position: absolute; right: 0; }
.assistant-input input { flex: 1; }
.screen-dim { background: rgba(15,23,42,.42); border: 0; display: none; inset: 0; padding: 0; position: fixed; z-index: 19; }
.screen-dim.active { display: block; }
.modal-backdrop { align-items: center; background: rgba(15,23,42,.48); display: flex; inset: 0; justify-content: center; padding: 24px; position: fixed; z-index: 35; }
.document-modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 70px rgba(15,23,42,.28); display: flex; flex-direction: column; height: min(86vh, 880px); overflow: hidden; width: min(920px, 96vw); }
.modal-head { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 14px 16px; }
.document-frame { border: 0; flex: 1; width: 100%; }
.modal-state { align-content: center; color: var(--ink-3); display: grid; flex: 1; gap: 10px; justify-items: center; padding: 32px; text-align: center; }
.hidden { display: none !important; }
.admin-app { --side: #111111; --side-2: #171717; --teal: #2563eb; --teal-2: #1d4ed8; }
.admin-side { background: #111111; border-right-color: #262626; }
.admin-side .brand { border-bottom-color: #262626; }
.admin-side .brand-mark { background: #f97316; color: #fff7ed; }
.admin-side .brand-sub { color: #bfdbfe; }
.admin-side .nav button:hover, .admin-side .nav button.active { background: #27272a; }
.admin-side .side-box { background: rgba(37, 99, 235, .12); border-color: rgba(147, 197, 253, .26); color: #bfdbfe; }
.admin-top { border-bottom-color: #d4d4d8; }
.admin-login { align-items: center; background: radial-gradient(circle at 20% 20%, rgba(249,115,22,.12), transparent 32%), #f4f4f5; display: flex; min-height: 100vh; justify-content: center; padding: 20px; }
.admin-login-card { max-width: 440px; width: 100%; }
.admin-brand-inline { background: #111111; border-radius: var(--r); margin: -2px -2px 0; padding: 12px; }
.admin-tenant .api-strip { grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); }
@media (max-width: 1120px) {
  .grid-2, .grid-3, .grid-4, .trip-list, .api-strip { grid-template-columns: 1fr 1fr; }
  .admin-tenant .api-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app { background: var(--bg); }
  .app.sidebar-collapsed { background: var(--bg); grid-template-columns: 1fr; }
  .side { bottom: 0; height: 100vh; left: 0; max-width: 86vw; position: fixed; top: 0; transform: translateX(-104%); transition: transform 180ms ease; width: 286px; z-index: 20; }
  .sidebar-collapsed .side { width: 286px; }
  .sidebar-collapsed .brand { justify-content: flex-start; padding: 16px; }
  .sidebar-collapsed .brand > div:last-child, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav button span:nth-child(2), .sidebar-collapsed .nav .count, .sidebar-collapsed .side-box, .sidebar-collapsed .side-foot { display: revert; }
  .sidebar-collapsed .nav { padding: 0 8px; }
  .sidebar-collapsed .nav button { grid-template-columns: 18px 1fr auto; justify-items: stretch; padding: 8px 10px; }
  .sidebar-open .side { transform: translateX(0); }
  .top { display: grid; grid-template-columns: 34px minmax(0,1fr) minmax(0,1fr); padding: 10px 12px; }
  .crumbs { grid-column: 2 / 4; }
  .status-pill, .top .upload-top { display: none; }
  .top .assistant-top { grid-column: 1 / 4; width: 100%; }
  .page { padding: 16px; }
  .view-head, .band-head { display: grid; grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .trip-list, .form-grid, .api-strip { grid-template-columns: 1fr; }
  .admin-tenant .api-strip { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; }
  .step { grid-template-columns: 26px minmax(0,1fr); }
  .step > .btn, .step > .badge { grid-column: 2; justify-self: start; }
  .message { max-width: 100%; width: 100%; }
  .assistant-drawer { border-left: 0; left: 0; max-width: 100vw; width: auto; }
  .assistant-backdrop.active { display: none; }
  .assistant-input { align-items: stretch; flex-wrap: wrap; }
  .assistant-input input { flex: 1 1 100%; order: -1; }
  .modal-backdrop { padding: 10px; }
  .document-modal { height: 92vh; width: 100%; }
}
