#tl-review-root, #tl-ledger-root {
  --surface-1: #fcfcfb;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --success-text: #006300;
  --warning-text: #8a5a00;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-primary);
  max-width: 1180px;
  margin: 0 auto;
}
#tl-review-root *, #tl-ledger-root * { box-sizing: border-box; }

.tl-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 700px) { .tl-cards { grid-template-columns: 1fr; } }
.tl-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; }
.tl-card h2 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.tl-status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 999px; float: right; }
.tl-status-pill.good { background: rgba(12,163,12,0.12); color: var(--success-text); }
.tl-status-pill.warning { background: rgba(250,178,25,0.18); color: var(--warning-text); }
.tl-status-pill.critical { background: rgba(208,59,59,0.12); color: var(--critical); }
.tl-status-pill svg { width: 14px; height: 14px; vertical-align: -2px; }
.tl-hero { font-size: 34px; font-weight: 700; margin: 4px 0 2px; }
.tl-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.tl-track { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--gridline); margin-bottom: 8px; }
.tl-seg.good { background: var(--good); } .tl-seg.critical { background: var(--critical); } .tl-seg.na { background: var(--baseline); }
.tl-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tl-dot.good { background: var(--good); } .tl-dot.critical { background: var(--critical); } .tl-dot.na { background: var(--baseline); }

.tl-section { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; margin-bottom: 22px; }
.tl-section h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.tl-section .tl-desc { margin: 0 0 14px; font-size: 13px; color: var(--text-secondary); }
.tl-strip { display: flex; gap: 2px; flex-wrap: wrap; }
.tl-strip-block { width: 15px; height: 22px; border-radius: 3px; cursor: pointer; flex: none; }
.tl-strip-block.good { background: var(--good); } .tl-strip-block.critical { background: var(--critical); } .tl-strip-block.na { background: var(--gridline); }
.tl-strip-block.lb-sep { margin-right: 8px; }

#tl-tooltip { position: fixed; display: none; background: var(--text-primary); color: #fff; font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; pointer-events: none; z-index: 999; max-width: 260px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }

.tl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tl-table thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--gridline); }
.tl-table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--gridline); }
.tl-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.tl-badge.critical { background: rgba(208,59,59,0.12); color: var(--critical); }
.tl-badge.good { background: rgba(12,163,12,0.12); color: var(--success-text); }
.tl-badge svg { width: 12px; height: 12px; }
.tl-empty { color: var(--text-secondary); font-size: 13px; padding: 8px 0; }
.tl-refresh-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-secondary); }
.tl-refresh-row button { border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.tl-refresh-row button:hover { background: var(--page-plane); }

/* --- Review interface --- */
.tl-review-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 820px) { .tl-review-layout { grid-template-columns: 1fr; } }
.tl-sidebar { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 10px; max-height: 78vh; overflow-y: auto; }
.tl-sidebar-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; margin-bottom: 3px; }
.tl-sidebar-item:hover { background: var(--page-plane); }
.tl-sidebar-item.active { background: rgba(10,50,111,0.10); font-weight: 600; }
.tl-sidebar-item .tl-mini-badges { margin-top: 3px; display: flex; gap: 4px; flex-wrap: wrap; }
.tl-main { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; }
.tl-page-img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; cursor: zoom-in; margin-bottom: 16px; }
.tl-page-img.zoomed { position: fixed; inset: 0; margin: auto; max-width: 96vw; max-height: 96vh; z-index: 1000; cursor: zoom-out; box-shadow: 0 10px 40px rgba(0,0,0,.4); background: #fff; }
.tl-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 999; display: none; }
.tl-overlay.show { display: block; }
.tl-field-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--gridline); }
.tl-field-row label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.tl-field-row input { font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; width: 100%; font-variant-numeric: tabular-nums; }
.tl-leg-block { border: 1px solid var(--gridline); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.tl-leg-block h4 { margin: 0 0 8px; font-size: 13px; }
.tl-confirm-btn { background: var(--brand-navy); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 14px; }
.tl-confirm-btn:hover { background: var(--brand-navy-dark); }
.tl-saved-flash { color: var(--success-text); font-size: 13px; margin-left: 10px; display: none; }
.tl-activity { font-size: 12.5px; color: var(--text-secondary); }
.tl-activity li { margin-bottom: 4px; }

/* --- Flexflight brand palette ---
   Brand colors are applied to chrome only: topbar, nav, primary buttons,
   the login screen, and the aircraft picker. The good/warning/critical
   status colors used throughout the review/ledger dashboards (above) are
   deliberately left untouched — they're a reserved, validated palette and
   mixing brand identity into them would make "is this flagged?" harder to
   read at a glance. */
:root {
  --brand-navy: #0A326F;
  --brand-navy-dark: #072248;
  --brand-gold: #D8A013;
  --brand-black: #000000;
  --brand-gray: #3A3A40;
}

/* --- App shell (login/topbar), shared across all pages --- */
body { margin: 0; background: #f9f9f7; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.tl-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: #fcfcfb; border-bottom: 3px solid var(--brand-gold); margin-bottom: 20px; }
.tl-brand-group { display: flex; align-items: center; gap: 14px; }
.tl-topbar .tl-brand { font-weight: 700; font-size: 15px; color: var(--brand-navy); }
.tl-topbar nav a { margin-right: 16px; color: var(--brand-gray); text-decoration: none; font-size: 13.5px; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.tl-topbar nav a.active { color: var(--brand-navy); font-weight: 600; border-bottom-color: var(--brand-navy); }
.tl-topbar nav a:hover { color: var(--brand-navy); }
.tl-topbar .tl-user { font-size: 13px; color: var(--brand-gray); display: flex; align-items: center; gap: 10px; }
.tl-topbar button { border: 1px solid rgba(11,11,11,0.10); background: #fcfcfb; border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--brand-navy); }
.tl-topbar button:hover { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }

.tl-aircraft-picker {
  border: 1px solid var(--brand-navy);
  color: var(--brand-navy);
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tl-aircraft-picker:focus { outline: 2px solid var(--brand-gold); outline-offset: 1px; }

.tl-login-wrap { max-width: 360px; margin: 100px auto; background: #fcfcfb; border: 1px solid rgba(11,11,11,0.10); border-top: 4px solid var(--brand-navy); border-radius: 12px; padding: 28px 26px; }
.tl-login-wrap h1 { font-size: 18px; margin: 0 0 18px; color: var(--brand-navy); }
.tl-login-wrap input { width: 100%; padding: 9px 10px; margin-bottom: 12px; border: 1px solid rgba(11,11,11,0.10); border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.tl-login-wrap input:focus { outline: none; border-color: var(--brand-navy); box-shadow: 0 0 0 3px rgba(10,50,111,0.12); }
.tl-login-wrap button { width: 100%; padding: 10px; border: none; border-radius: 8px; background: var(--brand-navy); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.tl-login-wrap button:hover { background: var(--brand-navy-dark); }
.tl-login-error { color: #d03b3b; font-size: 13px; margin-bottom: 10px; display: none; }

/* --- Pilot scan page --- */
.tl-scan-wrap { max-width: 480px; margin: 0 auto; padding: 0 16px 60px; }
.tl-scan-step { background: #fcfcfb; border: 1px solid rgba(11,11,11,0.10); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.tl-scan-step label { display: block; font-size: 12.5px; font-weight: 600; color: #52514e; margin-bottom: 4px; }
.tl-scan-step input[type=text] { width: 100%; padding: 10px; border: 1px solid rgba(11,11,11,0.10); border-radius: 8px; font-size: 15px; margin-bottom: 14px; box-sizing: border-box; text-transform: uppercase; }
.tl-camera-btn { width: 100%; padding: 16px; border: 2px dashed var(--brand-navy); border-radius: 10px; background: #f9f9f7; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--brand-navy); }
.tl-big-btn { width: 100%; padding: 14px; border: none; border-radius: 10px; background: var(--brand-navy); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 8px; }
.tl-big-btn:hover { background: var(--brand-navy-dark); }
.tl-big-btn:disabled { background: #c3c2b7; cursor: not-allowed; }
.tl-secondary-btn { width: 100%; padding: 10px; border: 1px solid rgba(11,11,11,0.10); border-radius: 8px; background: #fff; font-size: 13.5px; cursor: pointer; margin-top: 8px; }
.tl-preview-img { width: 100%; border-radius: 8px; border: 1px solid rgba(11,11,11,0.10); margin-bottom: 12px; }
.tl-spinner-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #52514e; padding: 14px 0; }
.tl-alert { border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.tl-alert.critical { background: rgba(208,59,59,0.10); color: #8a1f1f; }
.tl-alert.good { background: rgba(12,163,12,0.10); color: #0a5c0a; }
.tl-alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.tl-scan-field-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #e1e0d9; font-size: 13.5px; }
.tl-scan-field-row input { width: 55%; padding: 5px 8px; border: 1px solid rgba(11,11,11,0.10); border-radius: 6px; font-size: 13.5px; text-align: right; }
.tl-leg-card { border: 1px solid #e1e0d9; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tl-leg-card h4 { margin: 0 0 6px; font-size: 13px; }
