/* SanaLogs Inventory — liquid glass over MEDEVAC backdrop
   Theme: Nomad Health blue→violet (#3B82F6 → #8B5CF6) + X-Sim glass */
:root {
  --brand-a: #3B82F6;
  --brand-b: #8B5CF6;
  --grad-primary: linear-gradient(135deg, #3B82F6, #8B5CF6);
  --bg-ink: #070A18;

  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-hover: rgba(255, 255, 255, 0.12);
  --glass-bg-solid: rgba(16, 20, 40, 0.92);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-hover: rgba(255, 255, 255, 0.30);
  --glass-blur: saturate(150%) blur(14px);
  --glass-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);

  --text: #E6EAF5;
  --text-2: rgba(230, 234, 245, 0.75);
  --muted: #93A0BC;
  --primary: #3B82F6;
  --primary-hover: #5c96f7;
  --success: #34D399;
  --alert: #F87171;
  --warn: #F59E0B;
  --radius: 16px;
  --radius-sm: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-ink);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
/* MEDEVAC backdrop — fixed layer + brand halos + dark veil so glass reads */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, rgba(59, 130, 246, 0.10) 0%, rgba(139, 92, 246, 0.10) 100%),
    linear-gradient(180deg, rgba(7, 10, 24, 0.46) 0%, rgba(7, 10, 24, 0.20) 42%,
      rgba(7, 10, 24, 0.26) 68%, rgba(7, 10, 24, 0.90) 78%, rgba(7, 10, 24, 0.98) 100%),
    url('/bg-medevac.jpg') center / cover no-repeat,
    var(--bg-ink);
}
a { color: var(--brand-a); text-decoration: none; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

/* layout */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: rgba(5, 8, 20, 0.55);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad-primary); font-weight: 700; font-size: 16px; color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand .sub { font-size: 11px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; font-weight: 500; font-size: 14px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--glass-bg-hover); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(139, 92, 246, 0.28));
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.25);
}
.nav-item .ico { width: 20px; text-align: center; }
.nav-sep { margin: 10px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: rgba(147, 160, 188, 0.6); }
.nav-bottom { margin-top: auto; }

.main { flex: 1; padding: 26px 30px; max-width: 1600px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* glass cards */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 20px;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 45%, transparent 100%);
  pointer-events: none; z-index: 0;
}
.card > * { position: relative; z-index: 1; }
.card:hover { border-color: var(--glass-border-hover); }

.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.card.clickable { cursor: pointer; transition: transform 0.12s, border-color 0.2s; }
.card.clickable:hover { border-color: rgba(139, 92, 246, 0.55); transform: translateY(-2px); }
.card.clickable:active { transform: none; }
.stat .num {
  font-size: 32px; font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat.alert .num { background: none; -webkit-text-fill-color: currentcolor; color: var(--alert); }
.stat.warn .num { background: none; -webkit-text-fill-color: currentcolor; color: var(--warn); }
.stat.ok .num { background: none; -webkit-text-fill-color: currentcolor; color: var(--success); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 0; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.40);
  transition: filter 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.12); box-shadow: 0 6px 22px rgba(99, 102, 241, 0.55); }
.btn.ghost {
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-hover); filter: none; }
.btn.success { background: linear-gradient(135deg, #10B981, #34D399); box-shadow: 0 4px 16px rgba(52, 211, 153, 0.35); }
.btn.danger { background: linear-gradient(135deg, #DC2626, #F87171); box-shadow: 0 4px 16px rgba(248, 113, 113, 0.35); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* forms */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  background: rgba(6, 8, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18); color: var(--text);
}
input::placeholder, textarea::placeholder { color: rgba(147, 160, 188, 0.55); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-b);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.22);
}
select option { background: #10142a; color: var(--text); }
input[type="checkbox"] { width: auto; accent-color: var(--brand-b); }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 9px 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; color: var(--text-2); }
td strong { color: var(--text); }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* badges */
.badge { display: inline-block; padding: 2.5px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge.green { background: rgba(52, 211, 153, 0.14); color: #4ade80; border-color: rgba(52, 211, 153, 0.30); }
.badge.red { background: rgba(248, 113, 113, 0.14); color: #f87171; border-color: rgba(248, 113, 113, 0.30); }
.badge.blue { background: rgba(59, 130, 246, 0.15); color: #7cb1f9; border-color: rgba(59, 130, 246, 0.32); }
.badge.amber { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245, 158, 11, 0.30); }
.badge.gray { background: rgba(147, 160, 188, 0.12); color: var(--muted); border-color: rgba(147, 160, 188, 0.25); }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(4, 6, 16, 0.60);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--glass-bg-solid);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.modal h2 { margin-bottom: 16px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs .tab {
  flex: 1; text-align: center; padding: 9px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--muted); border: 1px solid var(--glass-border); font-size: 14px; font-weight: 500;
  background: var(--glass-bg);
  transition: background 0.15s, color 0.15s;
}
.auth-tabs .tab:hover { background: var(--glass-bg-hover); color: var(--text); }
.auth-tabs .tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.30), rgba(139, 92, 246, 0.30));
  border-color: rgba(139, 92, 246, 0.5);
}

/* misc */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mb { margin-bottom: 14px; }
.mt { margin-top: 14px; }
.error-msg { color: var(--alert); font-size: 13.5px; margin-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--glass-bg-solid);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 13px 18px; font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.2s ease;
}
.toast.err { border-left-color: var(--alert); }
@keyframes slideIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.sig-canvas { background: rgba(255, 255, 255, 0.93); border-radius: var(--radius-sm); width: 100%; height: 120px; touch-action: none; cursor: crosshair; }
.scan-box { font-size: 22px; padding: 16px; text-align: center; letter-spacing: 1px; }
.scan-result { text-align: center; padding: 18px 0; }
.scan-result .big { font-size: 26px; font-weight: 700; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.filters label.field { margin-bottom: 0; min-width: 150px; }

/* mobile top bar + hamburger drawer */
.topbar { display: none; }
.hamburger {
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text);
  font-size: 20px; line-height: 1; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.side-backdrop {
  display: none; position: fixed; inset: 0; z-index: 140;
  background: rgba(4, 6, 16, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.side-backdrop.show { display: block; }

/* mobile modals: stack form rows, tighten padding, keep tables scrollable */
@media (max-width: 640px) {
  .modal-back { padding: 10px; align-items: flex-end; }
  .modal { padding: 18px 14px; max-height: 94vh; border-radius: 14px; }
  .modal .form-row { flex-direction: column; gap: 0; }
  .modal .form-row > * { width: 100%; }
  .modal .modal-actions { flex-wrap: wrap; }
  .modal h2 { font-size: 17px; }
  .modal table input { min-width: 70px; }
  /* Header controls get their own lines instead of being crushed between the
     filter chip and the action button. The inline width="auto"/"180px" set on the
     selects and the search box has to be overridden, hence !important. */
  .page-head .actions { width: 100%; }
  .page-head .actions > * { flex: 1 1 100%; min-width: 0; }
  .page-head .actions select,
  .page-head .actions input {
    width: auto !important;
    min-width: 0;
    box-sizing: border-box;
  }
  .page-head .actions select { flex: 1 1 calc(50% - 4px); }   /* two filters share a line */
  .page-head .actions input { flex: 1 1 100%; }
  .page-head .actions .btn { justify-content: center; }
}

@media (max-width: 860px) {
  #app { flex-direction: column; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 130;
    padding: 10px 14px;
    background: rgba(5, 8, 20, 0.75);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
  }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 262px;
    transform: translateX(-105%); transition: transform 0.25s ease;
    z-index: 150; background: rgba(5, 8, 20, 0.92);
  }
  .sidebar.open { transform: none; box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5); }
  .main { padding: 18px 14px; }
}
@media print {
  .sidebar, .page-head .actions, .filters, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .card { background: #fff; border-color: #ccc; box-shadow: none; }
  .card::after { display: none; }
  th, td { color: #000; }
}

/* lots modal rows — stacked layout, phone-safe */
.lot-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lot-info { flex: 1; min-width: 0; }
.lot-qty { width: 72px; flex-shrink: 0; text-align: center; }

/* mobile inventory cards — collapsed rows, tap to expand */
.inv-cards { display: none; }
.inv-card { padding: 14px 16px; }
.inv-card-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.inv-card-name { flex: 1; min-width: 0; }
.inv-card-stock { font-size: 22px; font-weight: 700; flex-shrink: 0; }
.inv-card-stock.low { color: var(--alert); }
.inv-card-min { font-size: 13px; font-weight: 500; color: var(--muted); }
.inv-card-body { display: none; padding-top: 12px; margin-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.inv-card.open .inv-card-body { display: block; }
@media (max-width: 860px) {
  .inv-cards { display: flex; flex-direction: column; gap: 10px; }
  .inv-table-card { display: none; }
}

/* kit checklists + seal display */
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04); transition: border-color 0.15s, background 0.15s;
}
.check-item input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; }
.check-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.check-item.checked { border-color: rgba(52, 211, 153, 0.55); background: rgba(52, 211, 153, 0.08); }
.seal-check {
  text-align: center; padding: 14px; border: 1px dashed rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-sm); background: rgba(245, 158, 11, 0.06);
}
.seal-no { font-size: 24px; font-weight: 700; letter-spacing: 2px; }
.kit-mine { border-color: rgba(59, 130, 246, 0.55); box-shadow: 0 0 22px rgba(59, 130, 246, 0.18); }

.sig-view { cursor: pointer; }
.sig-view:hover { filter: brightness(1.3); }

/* svg icon sizing */
.ico svg { width: 17px; height: 17px; display: block; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.badge svg { width: 11px; height: 11px; vertical-align: -1.5px; }
.badge.sig-view { display: inline-flex; align-items: center; gap: 4px; }

/* mobile: date filters stack in a 2-col grid instead of mashing */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
  .filters label.field { min-width: 0; width: 100%; }
  .filters select, .filters input { width: 100%; min-width: 0; }
  .filters .btn { grid-column: 1 / -1; justify-content: center; }
}
input[type="date"] { min-width: 0; -webkit-appearance: none; appearance: none; }

/* swipe hint above horizontally scrollable tables (mobile) */
.scroll-hint {
  text-align: center; font-size: 11.5px; color: var(--muted);
  letter-spacing: 0.5px; padding: 2px 0 8px;
  transition: opacity 0.35s;
}
.scroll-hint.fade { opacity: 0; }
.scroll-hint .sh-l, .scroll-hint .sh-r {
  display: inline-block; color: var(--brand-b); font-weight: 700;
  animation: shNudge 1.3s ease-in-out infinite;
}
.scroll-hint .sh-l { animation-name: shNudgeL; }
@keyframes shNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes shNudgeL { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }

/* portrait runway backdrop on phones — heavy bottom fade doubles as the
   content ground and hides the pavement threshold area */
@media (max-width: 640px) {
  body::before {
    background:
      linear-gradient(115deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%),
      linear-gradient(180deg, rgba(7, 10, 24, 0.44) 0%, rgba(7, 10, 24, 0.20) 40%,
        rgba(7, 10, 24, 0.42) 64%, rgba(7, 10, 24, 0.94) 80%, rgba(7, 10, 24, 0.98) 100%),
      url('/bg-medevac-mobile.jpg') center top / cover no-repeat,
      var(--bg-ink);
  }
}

/* shopping list quantity stepper */
.qty-step { display: inline-flex; align-items: center; gap: 8px; }
.qty-step .btn { min-width: 32px; justify-content: center; padding: 4px 8px; }
.qty-val { min-width: 26px; text-align: center; font-weight: 600; }


/* crisp icon rendering */
.ico svg, .btn svg, .badge svg { shape-rendering: geometricPrecision; }


/* brand tile now renders the app icon */
.brand img.logo { object-fit: contain; background: none; box-shadow: none; padding: 0; }

/* lot row quantity stepper */
.lot-row .qty-step { flex-shrink: 0; gap: 6px; }
.lot-row .lot-qty { width: 64px; }

/* Save reserves its slot so +/- never shift under a repeat tap */
.lot-row .lot-save {
  visibility: hidden;
  flex-shrink: 0;
  min-width: 58px;
  justify-content: center;
}
.lot-row .lot-save.on { visibility: visible; }

/* Quick Scan: search-by-name results */
.pick-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.pick-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 10px 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px; color: var(--text); font: inherit; cursor: pointer;
}
.pick-row:hover { background: rgba(255,255,255,.08); border-color: rgba(139,92,246,.5); }
.pick-row:active { transform: translateY(1px); }

/* Lots modal: inline edit pane for a saved lot */
.lot-edit {
  margin: -4px 0 12px; padding: 12px 14px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
}
.lot-edit .field { margin-bottom: 8px; }
@media (max-width: 640px) {
  .lot-edit .form-row { display: block; }
}

/* destructive ghost button (kit delete) — reads as dangerous without shouting */
.btn.ghost.danger {
  background: transparent;
  box-shadow: none;
  color: #F87171;
  border-color: rgba(248, 113, 113, .45);
}
.btn.ghost.danger:hover {
  background: rgba(248, 113, 113, .12);
  border-color: rgba(248, 113, 113, .75);
}

/* shopping list: supplier group heading rows */
.grp-row td {
  padding-top: 16px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.grp-row:first-child td { padding-top: 4px; }

/* ---------- Flights tab ---------- */
.fl-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.fl-mapcard { padding: 0; overflow: hidden; position: relative; }
#flMap { height: calc(100vh - 190px); min-height: 420px; background: #0b0f1e; }
.fl-status { position: absolute; left: 0; right: 0; bottom: 0; z-index: 500; padding: 8px 12px;
  background: rgba(5, 8, 20, .72); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.fl-status .fl-attr { margin-left: auto; opacity: .8; font-size: 10px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fl-attr-btn { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.fl-attr-full { display: none; white-space: normal; }
.fl-status.credits .fl-attr-full { display: inline; }
.fl-status.credits .fl-attr-short { display: none; }
.fl-stale { color: var(--warn); }
.fl-list { max-height: calc(100vh - 190px); overflow-y: auto; padding: 10px; }
.fl-handle { display: none; }
.fl-sheet-close, .fl-sheet-title { display: none; }
.fl-sec { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 6px 6px; }
.fl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 6px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px; color: var(--text); font: inherit; cursor: pointer; }
.fl-row:hover { background: rgba(255,255,255,.08); border-color: rgba(139,92,246,.5); }
.fl-row.aei { border-color: rgba(59,130,246,.45); background: linear-gradient(135deg, rgba(59,130,246,.14), rgba(139,92,246,.14)); }
.fl-only-mobile { display: none; }
#flFollow.on { border-color: rgba(139,92,246,.7); background: rgba(139,92,246,.18); }

/* markers */
.fm { display: flex; flex-direction: column; align-items: center; color: #C4B5FD; }
.fm-aei { color: #fff; filter: drop-shadow(0 0 8px rgba(139,92,246,.9)) drop-shadow(0 0 2px rgba(0,0,0,.9)); }
.fm-ground { opacity: .6; }
.fm-ghost { opacity: .45; }
.fm-ghost svg { filter: grayscale(.4); }
.fl-tails { display: inline-flex; gap: 6px; }
.fl-tail { position: relative; padding-left: 20px !important; }
.fl-tail::before { content: ''; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #64748B; }
.fl-tail.fl-tail-air::before { background: #22C55E; box-shadow: 0 0 6px #22C55E; }
.fm-sel { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(245,158,11,.95)); z-index: 2000 !important; opacity: 1 !important; }
.fm-sel svg { position: relative; z-index: 1; }
.fm-ring { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 2px solid #F59E0B; pointer-events: none;
  animation: fm-pulse 1.6s ease-out infinite; }
@keyframes fm-pulse { 0% { transform: scale(.45); opacity: .95; } 100% { transform: scale(1.35); opacity: 0; } }
.fl-detail { display: none; padding: 12px 14px; margin: 0 0 6px; border-bottom: 1px solid var(--glass-border); position: relative; }
.fl-detail.open { display: block; }
.fl-detail-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.fl-detail-close:hover { color: var(--text); }
.fl-wxtime { color: var(--muted); }
.fl-sec-sm { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
.fl-faa { margin: 8px 0; }
.fl-faa > summary { cursor: pointer; list-style: none; }
.fl-faa > summary::-webkit-details-marker { display: none; }
.fl-faa > summary::after { content: ' ▾'; }
.fl-faa[open] > summary::after { content: ' ▴'; }
.fl-faa-owner { padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; background: rgba(147,197,253,.08); border: 1px solid rgba(147,197,253,.2); font-size: 13px; }
.fl-faa .fcard-grid { margin-bottom: 8px; }
.fl-legs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.fl-leg-row { display: flex; flex-direction: column; font-size: 13px; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.04); position: relative; }
.fl-leg-row.clickable { cursor: pointer; }
.fl-leg-row.clickable:hover, .fl-leg-row.clickable:focus { background: rgba(255,255,255,.08); outline: none; }
.fl-leg-row.picked { box-shadow: inset 3px 0 0 #F59E0B; background: rgba(245,158,11,.1); }
.fl-leg-row.loading::after { content: ''; position: absolute; right: 8px; top: 8px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(147,197,253,.35); border-top-color: #93C5FD; animation: fl-rot .9s linear infinite; }
.fl-aptname { display: inline-block; margin-left: 4px; font-size: 11px; font-weight: 500; color: var(--muted); vertical-align: baseline; }
.fl-arrow { color: var(--muted); font-weight: 400; margin: 0 2px; }
.fl-spin { animation: fl-rot .9s linear infinite; color: #93C5FD; flex: 0 0 auto; }
@keyframes fl-rot { to { transform: rotate(360deg); } }
.fl-spinline { display: flex; align-items: center; gap: 8px; }
.fl-search input.busy { background-image: none; box-shadow: 0 0 0 1px rgba(147,197,253,.5) inset; }
.fl-delay { color: #FCD34D; font-weight: 600; }
.fl-statusline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.fl-warn { padding: 8px 10px; border-radius: 10px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.35); color: #FCD34D; }
.fl-cruise { margin: 6px 0 8px; padding: 8px 10px; border-radius: 10px; background: rgba(147,197,253,.08); border: 1px solid rgba(147,197,253,.2); }
.fl-itin { list-style: none; margin: 0 0 10px; padding: 0; position: relative; }
.fl-itin li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; position: relative; cursor: pointer; }
.fl-itin li:hover, .fl-itin li:focus { background: rgba(147,197,253,.08); outline: none; }
.fl-itin li.picked .fl-itin-n { box-shadow: 0 0 0 2px #F59E0B; }
.fl-itin li + li::before { content: ''; position: absolute; left: 10px; top: -8px; height: 12px; border-left: 2px solid rgba(147,197,253,.3); }
.fl-itin-n { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 700 11px/1 Inter, system-ui, sans-serif; color: #93C5FD; border: 2px solid #93C5FD; background: rgba(9,12,28,.9); }
.fl-itin li.done .fl-itin-n { opacity: .45; }
.fl-itin li.done .fl-itin-txt { opacity: .6; }
.fl-itin li.now .fl-itin-n { background: #93C5FD; color: #0b1020; box-shadow: 0 0 8px rgba(147,197,253,.8); }
.fl-itin-txt { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
/* numbered cruise stops: Leaflet forces display:block on the marker box, so the
   circle and centring live on the inner span */
.fl-stop { background: none; border: 0; }
.fl-stop span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  color: #0b1020; background: #93C5FD; border: 2px solid #fff; font: 800 12px/1 Inter, system-ui, sans-serif; box-shadow: 0 0 0 2px rgba(9,12,28,.9), 0 2px 6px rgba(0,0,0,.7); }
.fl-stop.now span { background: #3B82F6; color: #fff; box-shadow: 0 0 0 2px rgba(9,12,28,.9), 0 0 12px rgba(59,130,246,1); }
.fl-stop.done span { background: rgba(147,197,253,.55); color: rgba(11,16,32,.85); }
.fm-ship { color: #93C5FD; }
.fm-moored { opacity: .55; }
.fm-label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: max-content; padding: 2px 8px; border-radius: 999px;
  font: 600 11px/1.2 Inter, system-ui, sans-serif; white-space: nowrap; color: #fff; background: linear-gradient(90deg, #3B82F6, #8B5CF6); box-shadow: 0 2px 8px rgba(0,0,0,.5); }

/* leaflet on dark glass */
.leaflet-container { font: inherit; }
.leaflet-control-zoom a { background: rgba(5,8,20,.85) !important; color: var(--text) !important; border-color: var(--glass-border) !important; }
.fpop .leaflet-popup-content-wrapper { background: rgba(9, 12, 28, .92); color: var(--text); border: 1px solid var(--glass-border);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.fpop .leaflet-popup-tip { background: rgba(9, 12, 28, .92); }
.fpop .leaflet-popup-content { margin: 12px 14px; overflow-wrap: anywhere; }
.fpop .leaflet-popup-close-button { color: var(--muted) !important; }
.fcard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.fcard-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13px; }
.fcard-grid b { min-width: 0; overflow-wrap: anywhere; }
.fcard-grid span { color: var(--muted); }
.badge.purple { background: rgba(139,92,246,.18); color: #C4B5FD; border-color: rgba(139,92,246,.4); }
.badge.sky { background: rgba(147,197,253,.16); color: #93C5FD; border-color: rgba(147,197,253,.4); }

@media (max-width: 860px) {
  .fl-wrap { grid-template-columns: 1fr; }
  #flMap { height: calc(100vh - 210px); min-height: 360px; }
  .fl-only-mobile { display: inline-flex; }
  .fl-list { position: fixed; left: 0; right: 0; bottom: 0; z-index: 140; max-height: 70vh; border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 44px)); transition: transform .25s ease; background: rgba(5,8,20,.96); }
  .fl-list.open { transform: none; }
  .fl-list.half { transform: translateY(max(0px, calc(100% - 42vh))); }
  .fl-list.half #flList { display: none; }
  .fl-sheet-bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 6px 4px 6px 10px; margin: -10px -10px 6px; cursor: pointer;
    border-bottom: 1px solid var(--glass-border); position: relative; }
  .fl-handle { display: block; position: absolute; left: 50%; top: 5px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255,255,255,.35); }
  .fl-sheet-title { display: inline; padding-top: 8px; }
  .fl-sheet-close { display: inline-flex; margin-top: 6px; }
  /* toolbar: compact buttons in a wrapping row, search on its own line */
  .page-head .fl-actions > * { flex: 0 0 auto; }
  .page-head .fl-actions .fl-search { flex: 1 1 100%; width: 100%; min-width: 100%; }
  .page-head .fl-actions .fl-search input { width: 100%; }
  .page-head .fl-actions .fl-tails { display: inline-flex; }
  .page-head .fl-actions .btn { padding: 6px 12px; }
}
.fl-sheet-bar { display: none; }
@media (max-width: 860px) { .fl-sheet-bar { display: flex; } }
.fl-leg { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; }
/* flights: legend + radar toggle */
.fl-legend { background: rgba(5,8,20,.82); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 10px; color: var(--text);
  font: 11px/1.7 Inter, system-ui, sans-serif; backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); margin: 10px 10px 0 0 !important; }
.fl-legend .lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -3px; margin-right: 7px; }
.fl-legend .lg-aei { background: linear-gradient(135deg,#3B82F6,#8B5CF6); box-shadow: 0 0 6px rgba(139,92,246,.9); }
.fl-legend .lg-jet { background: #C4B5FD; }
.fl-legend .lg-heli { background: #C4B5FD; border-radius: 50%; position: relative; }
.fl-legend .lg-heli::before, .fl-legend .lg-heli::after { content: ''; position: absolute; left: -2px; right: -2px; top: 6px; height: 2px; background: #0b1020; }
.fl-legend .lg-heli::after { transform: rotate(90deg); }
.fl-legend .lg-ground { background: rgba(196,181,253,.35); }
.fl-legend .lg-ship { background: rgba(147,197,253,.28); border: 2px solid #93C5FD; border-radius: 4px 4px 7px 7px; }
.fl-legend .lg-route { width: 18px; height: 3px; border-radius: 2px; background: #C4B5FD; vertical-align: 2px; }
.fl-legend .lg-plan { width: 18px; height: 0; border-top: 2px dashed #C4B5FD; vertical-align: 2px; }
/* lit state for every Flights toolbar toggle (Radar, Planes, Ships, tail follow) */
.fl-actions .btn.on, #flWx.on { border-color: rgba(96,165,250,.8); background: rgba(59,130,246,.2); color: #fff; }
.fl-actions .btn { transition: background .15s, border-color .15s; }
.fl-legend { position: relative; padding-right: 26px; }
.fl-legend-btn { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06);
  color: var(--text); font: 700 13px/1 Inter, system-ui, sans-serif; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.fl-legend-btn:hover { background: rgba(255,255,255,.14); }
.fl-legend.collapsed { padding: 0; width: 26px; height: 26px; }
.fl-legend.collapsed .fl-legend-btn { top: 3px; right: 3px; }
@media (max-width: 860px) { .fl-legend { display: none; } }
.fl-search { position: relative; }
.fl-listen { position: relative; }
.fl-listen-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 1200; width: 340px; max-width: calc(100vw - 32px); padding: 6px;
  background: rgba(9,12,28,.96); border: 1px solid var(--glass-border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.fl-listen-menu.open { display: block; }
.fl-listen-note { padding: 6px 10px 8px; }
.fl-listen-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.fl-listen-row:hover { background: rgba(255,255,255,.06); }
.fl-listen-txt { display: flex; flex-direction: column; min-width: 0; }
.fl-listen-go { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #fff; padding: 6px 10px; border-radius: 999px; background: linear-gradient(90deg, #3B82F6, #8B5CF6); white-space: nowrap; }
.fl-listen-row:active .fl-listen-go { filter: brightness(1.15); }
.fl-atc-link { color: #93C5FD; text-decoration: none; }
.fl-atc-link:hover { text-decoration: underline; }
@media (max-width: 860px) { .fl-listen-menu { right: auto; left: 0; } }
.fl-search input { width: 220px; padding: 7px 10px; font-size: 13px; }
.fl-search-res { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 1200; min-width: 300px; max-width: 360px; max-height: 340px; overflow: auto;
  background: rgba(9,12,28,.96); border: 1px solid var(--glass-border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); padding: 6px; }
.fl-search-res.open { display: block; }
.fl-search-hit { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; border-radius: 8px; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.fl-search-hit:hover, .fl-search-hit:focus { background: rgba(255,255,255,.06); outline: none; }
.fl-search-txt { display: flex; flex-direction: column; min-width: 0; }
.fl-search-txt strong, .fl-search-txt .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .fl-search, .fl-search input { width: 100%; } .fl-search-res { max-width: none; right: 0; } }
