/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════ */
:root {
  /* DARK MODE */
  --bg: #080d14;
  --s1: #0e1620;
  --s2: #141f2e;
  --s3: #1a2638;
  --s4: #212f42;
  --border: rgba(255, 255, 255, 0.05);
  --b2: rgba(255, 255, 255, 0.1);
  --b3: rgba(255, 255, 255, 0.15);
  --text: #c4d0de;
  --t2: #9fb3c9;
  --t3: #6d8299;
  --t4: #2e3f52;

  /* SYSTEM COLOURS — consistent across entire app */
  --col-af: #2ecc71; /* Airframe — Green */
  --col-af-d: rgba(46, 204, 113, 0.12);
  --col-e1: #4a9eff; /* Engine 1 — Blue */
  --col-e1-d: rgba(74, 158, 255, 0.12);
  --col-e2: #00c9d4; /* Engine 2 — Cyan */
  --col-e2-d: rgba(0, 201, 212, 0.12);
  --col-apu: #9b7fe8; /* APU — Purple */
  --col-apu-d: rgba(155, 127, 232, 0.12);
  --col-nlg: #8fa8c0; /* Nose Gear — Steel Grey */
  --col-nlg-d: rgba(143, 168, 192, 0.12);
  --col-lh: #5b8db8; /* LH Main — Steel Blue */
  --col-lh-d: rgba(91, 141, 184, 0.12);
  --col-rh: #8b7355; /* RH Main — Brown */
  --col-rh-d: rgba(139, 115, 85, 0.12);

  /* ALERT COLOURS — reserved exclusively for alerts */
  --warn: #ff4757; /* WARNING — Red */
  --warn-d: rgba(255, 71, 87, 0.12);
  --caution: #ff9f43; /* CAUTION — Orange */
  --caution-d: rgba(255, 159, 67, 0.12);
  --go: #00e5aa; /* GO — Green */
  --advisory: #ffd32a; /* ADVISORY — Yellow */
  --advisory-d: rgba(255, 211, 42, 0.1);

  --mono: 'DM Mono', monospace;
  --sans: 'Sora', sans-serif;
  --r: 16px;
  --r2: 12px;
  --r3: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);

  /* ── UI Polish tokens ─────────────────────────────── */
  --glow-af: 0 0 0 3px rgba(46, 204, 113, 0.18);
  --glow-e1: 0 0 0 3px rgba(74, 158, 255, 0.18);
  --glow-warn: 0 0 0 3px rgba(255, 71, 87, 0.18);
  --input-h: 38px;
  --card-pad: 20px;
  --t-snappy: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme='light'] {
  --bg: #f4f7fb;
  --s1: #e8edf3;
  --s2: #e2e9f2;
  --s3: #d4dfe9;
  --s4: #c4d3e2;
  --border: rgba(13, 29, 46, 0.15);
  --b2: rgba(13, 29, 46, 0.22);
  --b3: rgba(13, 29, 46, 0.3);
  --text: #0d1d2e;
  --t2: #2c4a62;
  --t3: #4a6a82;
  --t4: #7a9ab2;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}
/* Modo claro — reforço de contraste */
[data-theme='light'] .tab {
  color: #2c4a62;
}
[data-theme='light'] .tab.on {
  color: #1a7a45;
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.4);
}
[data-theme='light'] .tab:hover {
  color: #0d1d2e;
  background: rgba(0, 0, 0, 0.06);
}
[data-theme='light'] nav {
  background: #e8edf3;
  border-bottom: 1px solid rgba(13, 29, 46, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
[data-theme='light'] .tc {
  border-color: rgba(0, 0, 0, 0.12) !important;
}
[data-theme='light'] .tc-lbl {
  color: #4a6a82;
}
[data-theme='light'] th {
  color: #0d1d2e;
  background: #d4dfe9;
}
[data-theme='light'] td {
  color: #0d1d2e;
}
[data-theme='light'] .card {
  background: #e8edf3;
  border-color: rgba(13, 29, 46, 0.15);
}
[data-theme='light'] .card-hd {
  border-bottom-color: rgba(13, 29, 46, 0.15);
  background: #dde3eb;
}
[data-theme='light'] input,
[data-theme='light'] select,
[data-theme='light'] textarea {
  background: #e8edf3;
  color: #0d1d2e;
  border-color: rgba(13, 29, 46, 0.15);
}
[data-theme='light'] label {
  color: #2c4a62;
}
[data-theme='light'] .btn-gh {
  color: #2c4a62;
  border-color: rgba(13, 29, 46, 0.15);
}
[data-theme='light'] .btn-gh:hover {
  color: #0d1d2e;
  border-color: rgba(13, 29, 46, 0.3);
  background: #d4dfe9;
}
[data-theme='light'] .notif-panel {
  background: #e8edf3;
  border-color: rgba(13, 29, 46, 0.15);
}
[data-theme='light'] .notif-item:hover {
  background: #dde3eb;
}
[data-theme='light'] .notif-title {
  color: #0d1d2e;
}
[data-theme='light'] .notif-msg {
  color: #2c4a62;
}

/* ═══════════════════════════════════════════════════════
   GLOBAL ACCESSIBILITY & SCROLLBARS (A11y/UI Polish)
═══════════════════════════════════════════════════════ */
/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--b3);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--t3);
}
[data-theme='light'] ::-webkit-scrollbar-thumb {
  border-color: #f4f7fb;
}

/* Focus / A11y */
*:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--col-af);
  border-radius: 2px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--col-af) !important;
  box-shadow: 0 0 0 1px var(--col-af) !important;
  outline: none;
}

/* Orphan Buttons Base Reset */
button:not([class*='btn']) {
  background: transparent;
  color: inherit;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

/* Responsive Modals */
.modal-content,
.modal-panel {
  max-width: 95vw !important;
  overflow-x: auto;
}

/* Utility Classes */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-col {
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════════
   UI / UX POLISH — écran dividido, ambiente de aeroporto
   Hierarquia visual clara, densidade reduzida, foco visual
   imediato nos dados críticos.
═══════════════════════════════════════════════════════ */

/* ── Nav: mais altura, separação clara do conteúdo ── */
nav {
  min-height: 56px;
  background: var(--s1);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}
.tab {
  height: 32px;
  padding: 0 15px;
  font-size: 10.5px;
  letter-spacing: 0.55px;
  margin: 11px 3px;
  border-radius: var(--r2);
  transition: var(--t-snappy);
}
.tab.on {
  color: var(--col-af);
  background: rgba(46, 204, 113, 0.14);
  border-color: rgba(46, 204, 113, 0.4);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.12);
}
.tab:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--b2);
  color: var(--text);
}

/* ── Totals bar: cartões maiores, números muito legíveis ── */
.tbar-wrap {
  padding: 12px 18px;
  background: var(--bg);
  border-bottom: var(--border-w) solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition:
    opacity 0.15s,
    max-height 0.2s;
}
/* Hide totals bar on Dashboard — data is shown in the new dashboard cards */
body.pg-dash-active .tbar-wrap {
  display: none;
}
.tc {
  padding: 12px 14px;
  border-radius: var(--r);
  border: var(--border-w) solid var(--border);
  transition: var(--t-snappy);
  cursor: default;
}
.tc:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.tc::before {
  height: 4px;
}
.tc-lbl {
  font-size: 9px;
  letter-spacing: 1.1px;
  margin-bottom: 6px;
  opacity: 0.75;
}
.tc-h {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}
.tc-c {
  font-size: 13px;
  font-weight: 700;
  margin-top: 5px;
  opacity: 0.9;
}
.tc-sub {
  font-size: 9px;
  margin-top: 5px;
  padding-top: 5px;
  letter-spacing: 0.3px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--t2);
}

/* ── Cards: mais espaço interior, heading mais nítido ── */
.card {
  padding: var(--card-pad);
  margin-bottom: 16px;
  border-radius: var(--r);
  border: var(--border-w) solid var(--border);
  background: var(--s1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  transition: var(--t-snappy);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--b3);
}
.card-hd {
  margin-bottom: 16px;
  gap: 10px;
}
.card-hd b {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: var(--text);
}

/* ── Formulário: inputs maiores, gap entre grupos ── */
.fg {
  gap: 5px;
}
.fg label {
  font-size: 9.5px;
  letter-spacing: 0.7px;
  font-weight: 700;
  color: var(--t2);
}
.fg input,
.fg select,
.fg textarea {
  height: var(--input-h);
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: var(--r2);
  border: var(--border-w) solid var(--b2);
  background: var(--s2);
  transition: var(--t-snappy);
}
.fg textarea {
  height: auto;
  min-height: 68px;
  padding: 10px 11px;
}
.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  border-color: var(--col-af);
  box-shadow: var(--glow-af);
  background: var(--s3);
}
.fg input[readonly] {
  font-size: 13.5px;
  letter-spacing: 0.8px;
}
.inp-af input[readonly] {
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.25);
}
.mb12 {
  margin-bottom: 14px;
}
.mb8 {
  margin-bottom: 10px;
}
.sep {
  margin: 16px 0;
  border-top: var(--border-w) solid var(--border);
}

/* ── Grids: gap ligeiramente maior para respirar ── */
.g2,
.g3,
.g4,
.g5,
.g6 {
  gap: 12px;
}

/* ── Botões: mais peso visual, hover nítido ── */
.btn {
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r2);
  letter-spacing: 0.15px;
  transition: var(--t-snappy);
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}
.btn-g {
  background: var(--col-af);
  color: #080d14;
  box-shadow: 0 2px 8px rgba(46, 204, 113, 0.25);
}
.btn-g:hover {
  opacity: 1;
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.35);
  transform: translateY(-1px);
}
.btn-b:hover {
  background: rgba(74, 158, 255, 0.2);
  transform: translateY(-1px);
}
.btn-warn:hover {
  background: rgba(255, 71, 87, 0.2);
  transform: translateY(-1px);
}
.btn-gh:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--b2);
  transform: translateY(-1px);
}
.btn-apu:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 10.5px;
}
.btn-row {
  gap: 10px;
  margin-top: 14px;
}

/* ── Banners: linha de destaque mais grossa ── */
.banner {
  padding: 12px 16px;
  border-radius: var(--r2);
  font-size: 12.5px;
  margin-bottom: 14px;
}
.banner-g {
  border-width: 1px;
  box-shadow: 0 2px 10px rgba(46, 204, 113, 0.12);
}
.banner-b {
  border-width: 1px;
  box-shadow: 0 2px 10px rgba(74, 158, 255, 0.12);
}

/* ── Toasts: maior área de leitura ── */
.toast {
  min-width: 280px;
  max-width: 380px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: var(--border-w) solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  gap: 12px;
}
.toast.ok {
  border-left: 4px solid var(--col-af);
  background-color: var(--s1);
  background-image: linear-gradient(135deg, transparent 0%, rgba(46, 204, 113, 0.06) 100%);
}
.toast.err {
  border-left: 4px solid var(--warn);
  background-color: var(--s1);
  background-image: linear-gradient(135deg, transparent 0%, rgba(255, 71, 87, 0.06) 100%);
}
.toast.warn {
  border-left: 4px solid var(--caution);
  background-color: var(--s1);
  background-image: linear-gradient(135deg, transparent 0%, rgba(255, 159, 67, 0.06) 100%);
}
.toast.info {
  border-left: 4px solid var(--col-e1);
  background-color: var(--s1);
  background-image: linear-gradient(135deg, transparent 0%, rgba(74, 158, 255, 0.06) 100%);
}
.toast-title {
  font-size: 12.5px;
}
.toast-msg {
  font-size: 10.5px;
  line-height: 1.5;
}
.toast-icon {
  font-size: 16px;
}
.toast-container {
  bottom: 24px;
  right: 24px;
  gap: 10px;
}

/* ── showConfirm modal: mais peso, leitura mais fácil ── */
#confirm-modal > div {
  border-radius: 14px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55) !important;
  border: var(--border-w) solid var(--b2) !important;
}

/* ── Sequence alert: mais proeminente ── */
.seq-alert {
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 18px;
  border-width: 2px;
}
.seq-alert-title {
  font-size: 11.5px;
  letter-spacing: 0.9px;
}
.seq-chip {
  padding: 7px 12px;
  border-radius: var(--r3);
  font-size: 10px;
}

/* ── Autocomplete: sombra mais profunda ── */
.ac {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  border-radius: var(--r2);
}
.ac-i {
  padding: 8px 12px;
  font-size: 10.5px;
}

/* ── Tabelas: linhas alternadas, hover claro ── */
tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}
tbody tr:hover td {
  background: rgba(46, 204, 113, 0.06);
  transition: background 0.12s;
}
th {
  font-size: 10px;
  letter-spacing: 0.5px;
  background: var(--s2);
  border-bottom: 2px solid var(--border);
}
td {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* ── Scroll elegante ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
/* Webkit Custom Scrollbars for Premium feel */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Two-col: gap ligeiramente maior ── */
.two-col {
  gap: 16px;
}

/* ── Modo claro: ajustes correspondentes ── */
[data-theme='light'] .card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
[data-theme='light'] .tc:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
[data-theme='light'] .btn-g {
  color: #fff;
}
[data-theme='light'] nav {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(13, 29, 46, 0.15);
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  height: 100%;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  transition:
    background 0.3s,
    color 0.3s;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--r3);
}
::-webkit-scrollbar-thumb {
  background: var(--b2);
  border-radius: var(--r3);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--t3);
}

/* ═══════════════════════════════════════════════════════
   ACCESSIBILITY — Legibility & Dyslexia/ADHD friendly
═══════════════════════════════════════════════════════ */
/* Bump all small monospace labels from 9-10px → 11px min */
.tc-lbl,
.tc-h,
.tc-c,
.cfg-sec h3,
label,
.tab,
th,
.card-hd b,
.fbar *,
.btn {
  font-weight: 600;
}

/* Table data — heavier weight for readability */
td {
  font-weight: 500;
  text-align: center;
}

/* Table headers — clearly distinct */
th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
}

/* Labels on forms */
label {
  font-size: 11px;
  letter-spacing: 0.3px;
}

/* Nav tabs */
.tab {
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Top counter cards */
.tc-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.tc-h {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.tc-c {
  font-size: 11px;
  font-weight: 600;
}

/* Section headings */
.cfg-sec h3,
.card-hd b {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Input fields — easier to read */
input,
select,
textarea {
  font-size: 13px;
  font-weight: 500;
}

/* Hide time picker button from native time inputs */
input[type='time']::-webkit-calendar-picker-indicator {
  display: none;
}

/* Buttons — bold and clear */
.btn {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Increase line height in table rows for breathing room */
tbody tr td {
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.45;
}

/* Improve contrast on dim text */
.td-dim,
[class*='td-'] {
  font-weight: 500;
}

/* Focus ring — clear keyboard navigation indicator */
:focus-visible {
  outline: 2px solid var(--col-af);
  outline-offset: 2px;
  border-radius: var(--r3);
}

/* Slightly increase spacing between interactive elements */
.btn-row {
  gap: 10px;
}
.fbar {
  gap: 10px;
}

/* ── Dashboard new 3-row grid layout ── */
#dash-main-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Cap card width on fullscreen/wide monitors */
  max-width: 1500px;
  margin: 0 auto;
}
/* Each .dash-row2 = left (1.7fr) + right (1fr) */
.dash-row2 {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px;
  align-items: stretch;
}
/* Wrapper que empilha verticalmente os trens e a Atividade Operacional
         (row 3, lado esquerdo) — fecha o espaço vazio entre trens e o final
         da row em ecrãs largos. Em ecrãs < 1100px o pai .dash-row2 vira
         display:contents, e este wrapper colapsa para um bloco normal. */
.dash-row3-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
/* Row 1 left = [Status + Resumo] em cima + cards de alertas em baixo.
         Mesma técnica: fechar o gap visual contra a Previsão de Checks que
         é alta. As cards mb12 perdem o margin original pois o gap do flex
         já trata do espaçamento. */
.dash-row1-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.dash-row1-left > .card {
  margin: 0;
}
/* Grelha do dashboard: 4 linhas × 2 colunas.
         Esquerda: Status+Resumo, Motores, Trens, Atividade.
         Direita: vazio, Previsão, Este Mês, Fiabilidade.
         Cada par (motores↔previsão, trens↔este mês, atividade↔fiabilidade) partilha altura. */
.dash-2col {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  align-items: stretch;
}
.dash-2col > :nth-child(1) {
  grid-column: 1;
  grid-row: 1;
} /* Status + Resumo */
.dash-2col > :nth-child(2) {
  grid-column: 1;
  grid-row: 2;
} /* Motor 1 + 2 */
.dash-2col > :nth-child(3) {
  grid-column: 1;
  grid-row: 3;
} /* Trens */
.dash-2col > :nth-child(4) {
  grid-column: 1;
  grid-row: 4;
} /* Atividade */
.dash-2col > :nth-child(5) {
  grid-column: 2;
  grid-row: 1 / span 2;
} /* Previsão (cobre Resumo + Motores) */
.dash-2col > :nth-child(6) {
  grid-column: 2;
  grid-row: 3;
} /* Este Mês (casa com Trens) */
.dash-2col > :nth-child(7) {
  grid-column: 2;
  grid-row: 4;
} /* Fiabilidade (casa com Atividade) */
@media (max-width: 1100px) {
  .dash-2col {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .dash-2col > * {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
}
/* Dark card used everywhere in new dashboard */
.dc2 {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.dc2-check-forecast {
  min-height: 460px;
}

.dc2-hd {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
/* sub-grids inside left cell */
.sg2d {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}
.sg3d {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}
/* metric rows */
.dm-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  padding: 4px 0;
  column-gap: 8px;
}
.dm-lbl {
  font-size: 11px;
  color: var(--t2);
  white-space: nowrap;
}
.cfg-hidden {
  display: none !important;
}
.dm-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  text-align: right;
}
.dm-oil-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  padding: 4px 0 6px;
  border-top: var(--border-w) solid var(--border);
  margin-top: 6px;
  column-gap: 8px;
}
.dm-oil-row .dm-val {
  font-size: 13px;
  color: var(--text);
  text-align: right;
}
.dm-oil-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.5px;
}
.dm-oil-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.3px;
  margin: 0 0 8px;
}
.dm-stat-bnr {
  background: rgba(46, 204, 113, 0.08);
  border-left: 2px solid var(--col-af);
  border-radius: 0 var(--r3) var(--r3) 0;
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--col-af);
  letter-spacing: 0.3px;
}
/* mini cards inside Resumo da Célula */
.apu-mini {
  background: var(--s2);
  border: 2px solid var(--border-hl);
  border-radius: var(--r3);
  padding: 5px 5px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.apu-mini::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--t3);
}
.apu-mini-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.apu-mini-val {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}
/* check list with scroll */
.chk2-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  overflow-y: auto;
  max-height: 430px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--b3) transparent;
}
.chk2-list::-webkit-scrollbar {
  width: 4px;
}
.chk2-list::-webkit-scrollbar-thumb {
  background: var(--b3);
  border-radius: var(--r3);
}
.chk2-item {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--r3);
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.chk2-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  letter-spacing: 0.5px;
}
.chk2-val {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
}
/* Fiabilidade 2×2 */
.rel2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex: 1;
}
.rel2-item .rel2-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.5px;
}
.rel2-item .rel2-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  margin-top: 1px;
}
/* sparkline mini bars */
.spark2-wrap {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  flex: 1;
  min-height: 32px;
}
.spark2-bar {
  flex: 1;
  background: var(--col-af);
  border-radius: var(--r3);
}
/* Este Mês stats */
.estemés-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.estemés-val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}
.estemés-lbl {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t3);
  letter-spacing: 0.5px;
  text-align: center;
}
/* Legacy right-col hidden */
#dash-right-col {
  display: none;
}
.card-hd-home {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.card-hd-home b {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text);
  flex: 1;
}
.card-hd-home .chd-meta {
  font-family: var(--mono);
  font-size: 9px;
}
@media (max-width: 1100px) {
  #dash-main-layout > .dash-row2 {
    display: contents;
  }
  #dash-main-layout > .dash-row2 > * {
    width: 100%;
    box-sizing: border-box;
  }
  #dash-main-layout > .dash-row2:nth-of-type(1) > :first-child {
    order: 1;
  }
  #dash-main-layout > .dash-row2:nth-of-type(2) > :first-child {
    order: 2;
  }
  #dash-main-layout > .dash-row2:nth-of-type(3) > :first-child {
    order: 3;
  }
  #dash-main-layout > .dc2-activity {
    order: 4;
  }
  #dash-main-layout > .dash-row2:nth-of-type(1) > :last-child {
    order: 5;
  }
  #dash-main-layout > .dash-row2:nth-of-type(2) > :last-child {
    order: 6;
  }
  #dash-main-layout > .dash-row2:nth-of-type(3) > :last-child {
    order: 7;
  }
  #dash-main-layout > .card {
    order: 8;
  }
  .dash-row2 {
    grid-template-columns: 1fr;
  }
  .sg2d {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .dash-row2 {
    grid-template-columns: 1fr;
  }
  .sg2d {
    grid-template-columns: 1fr;
  }
  .sg3d {
    grid-template-columns: 1fr 1fr;
  }
}
/* ── Oil History sub-tabs (inside pg-hist) ── */
.oil-sub-tabs2 {
  display: flex;
  gap: 2px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--r3);
  padding: 2px;
  background: var(--s2);
}
.oil-stab {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  padding: 5px 11px;
  border-radius: var(--r3);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.oil-stab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.oil-stab.on {
  color: var(--bg);
  background: var(--col-af);
  font-weight: 600;
}
.oil-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.oil-kpi {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 10px 12px;
}
.oil-kpi-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.7px;
  margin-bottom: 4px;
}
.oil-kpi-val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
}
.oil-kpi-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.oil-chart-wrap {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
}
.oil-chart-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.oil-chart-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  letter-spacing: 0.5px;
}
.oil-legend {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
}
.oil-table-wrap {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
}
.oil-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10px;
}
.oil-table th {
  text-align: right;
  padding: 7px 4px;
  color: var(--t3);
  font-weight: 500;
  letter-spacing: 0.5px;
  font-size: 9px;
  border-bottom: var(--border-w) solid var(--border);
}
.oil-table th:first-child {
  text-align: left;
}
.oil-table td {
  text-align: right;
  padding: 6px 4px;
  color: var(--t2);
}
.oil-table td:first-child {
  text-align: left;
}
.oil-table tr.cur-month {
  background: rgba(46, 204, 113, 0.04);
}
.oil-table tr.cur-month td:first-child {
  color: var(--text);
  font-weight: 600;
}
.oil-table tr {
  border-bottom: 1px solid rgba(37, 51, 71, 0.5);
}
/* Sub-tab panels */
.oil-panel {
  display: none;
}
.oil-panel.on {
  display: block;
}

/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════ */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
#login-screen::before {
  content: '';
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 204, 113, 0.07) 0%, transparent 70%);
  top: -120px;
  left: -120px;
  pointer-events: none;
}
#login-screen::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74, 158, 255, 0.06) 0%, transparent 70%);
  bottom: -80px;
  right: -80px;
  pointer-events: none;
}
.login-box {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 40px;
  width: min(400px, 95vw);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 6px;
}
.login-logo img {
  height: 72px;
  object-fit: contain;
  filter: brightness(1.05);
}
[data-theme='light'] .nav-logo img,
[data-theme='light'] .sb-logo img {
  filter: invert(1) brightness(0.92);
}
.login-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  display: none;
}
.login-sub {
  font-size: 10px;
  color: var(--t3);
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.login-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 22px;
}
.login-fg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.login-fg label {
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: var(--mono);
}
.login-fg-icon {
  position: relative;
}
.login-fg-icon .login-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t3);
  font-size: 15px;
  pointer-events: none;
}
.login-fg-icon input {
  padding-left: 36px !important;
}
.login-fg input {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--r2);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.login-fg input:focus {
  border-color: var(--col-af);
}
.login-err {
  color: var(--warn);
  font-size: 11px;
  font-family: var(--mono);
  margin-bottom: 10px;
  display: none;
}
.pw-wrap {
  position: relative;
}
.pw-wrap input {
  padding-right: 64px;
}
/* Suprimir ícone nativo de password do browser (Chrome/Safari/Edge) */
.pw-wrap input::-ms-reveal,
.pw-wrap input::-ms-clear,
.pw-wrap input::-webkit-credentials-auto-fill-button,
.pw-wrap input::-webkit-textfield-decoration-container {
  display: none !important;
}
.pw-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  background: var(--s3);
  cursor: pointer;
  color: var(--t3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: none;
  transition: color 0.15s;
}
.pw-eye:hover {
  color: var(--col-af);
}
.pending-pill {
  background: var(--caution-d);
  border: 1px solid var(--caution);
  border-radius: var(--r3);
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--caution);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.pending-pill .pill-acts {
  display: flex;
  gap: 6px;
}
.chg-pw-box {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-top: 10px;
}
.btn-login {
  width: 100%;
  background: var(--col-af);
  color: #fff;
  border: none;
  border-radius: var(--r2);
  padding: 11px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}
.btn-login:hover {
  opacity: 0.88;
}
.login-wm {
  text-align: center;
  margin-top: 20px;
  opacity: 0.15;
  display: none;
}
.login-wm img {
  height: 40px;
}

/* ═══════════════════════════════════════════════════════
   TOP NAV
═══════════════════════════════════════════════════════ */
#app {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: visible;
}
nav {
  background: var(--s1);
  border-bottom: var(--border-w) solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 52px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0;
  position: relative;
  z-index: 50;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: var(--border-w) solid var(--border);
  margin-right: 8px;
}
.nav-logo img {
  height: 42px;
  object-fit: contain;
}
.nav-logo span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
  white-space: nowrap;
}
.tab {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  padding: 0 13px;
  height: 30px;
  margin: 11px 2px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-bottom: none;
  border-radius: var(--r);
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  gap: 6px;
  border: 1px solid transparent;
}
.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border);
}
.tab.on {
  color: var(--col-af);
  background: var(--col-af-d);
  border-color: rgba(46, 204, 113, 0.3);
}
.tab .badge {
  background: var(--warn);
  color: #fff;
  border-radius: var(--r);
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
}
.nav-r {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reg-pill {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
}
.reg-pill input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--col-af);
  font-family: var(--mono);
  font-size: 11px;
  width: 68px;
  text-transform: uppercase;
}
.user-pill {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.user-pill:hover {
  border-color: var(--b2);
}
.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.role-dot.ctrl {
  background: var(--col-af);
}
.role-dot.dir {
  background: var(--col-e2);
}
.role-dot.mech {
  background: var(--col-e1);
}
.role-dot.aux {
  background: var(--caution);
}
.role-dot.pilot {
  background: var(--col-apu);
}
.theme-btn {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  color: var(--text);
}
.theme-btn:hover {
  border-color: var(--b2);
}
.base-pill {
  background: var(--col-af-d);
  border: 1px solid var(--col-af);
  border-radius: var(--r2);
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--col-af);
  display: flex;
  align-items: center;
  gap: 5px;
}
.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--col-af);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.8);
  }
}

/* ═══════════════════════════════════════════════════════
   TOTALS BAR
═══════════════════════════════════════════════════════ */
.tbar-wrap {
  background: var(--s1);
  border-bottom: var(--border-w) solid var(--border);
  padding: 10px 16px;
  flex-shrink: 0;
  overflow-x: auto;
}
.tbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
}
.tc {
  border-radius: var(--r);
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  border: var(--border-w) solid var(--border);
  transition:
    border-color 0.2s,
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.18s;
}
.tc:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.tc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.tc.af {
  background: var(--col-af-d);
}
.tc.af::before {
  background: var(--col-af);
}
.tc.e1 {
  background: var(--col-e1-d);
}
.tc.e1::before {
  background: var(--col-e1);
}
.tc.e2 {
  background: var(--col-e2-d);
}
.tc.e2::before {
  background: var(--col-e2);
}
.tc.apu {
  background: var(--col-apu-d);
}
.tc.apu::before {
  background: var(--col-apu);
}
.tc.nlg {
  background: var(--col-nlg-d);
}
.tc.nlg::before {
  background: var(--col-nlg);
}
.tc.lh {
  background: var(--col-lh-d);
}
.tc.lh::before {
  background: var(--col-lh);
}
.tc.rh {
  background: var(--col-rh-d);
}
.tc.rh::before {
  background: var(--col-rh);
}
.tc-lbl {
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}
.tc-h {
  font-family: var(--mono);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
}
.tc-hlbl {
  font-size: 9px;
  font-weight: 400;
  opacity: 0.5;
  margin-left: 4px;
  white-space: nowrap;
}
.tc-c {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
  opacity: 0.9;
}
.tc-clbl {
  font-size: 9px;
  font-weight: 400;
  opacity: 0.5;
  margin-left: 3px;
}
.tc-v {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0;
  row-gap: 0;
}
.tc-sub {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--t3);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.af .tc-h,
.af .tc-c {
  color: var(--col-af);
}
.e1 .tc-h,
.e1 .tc-c {
  color: var(--col-e1);
}
.e2 .tc-h,
.e2 .tc-c {
  color: var(--col-e2);
}
.apu .tc-h,
.apu .tc-c {
  color: var(--col-apu);
}
.nlg .tc-h,
.nlg .tc-c {
  color: var(--col-nlg);
}
.lh .tc-h,
.lh .tc-c {
  color: var(--col-lh);
}
.rh .tc-h,
.rh .tc-c {
  color: var(--col-rh);
}

/* ═══════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════ */
.app-body {
  display: flex;
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
}
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════ */
.card {
  background: var(--s2);
  border-radius: var(--r2);
  border: var(--border-w) solid var(--border);
  margin-bottom: 24px;
  transition: var(--t-snappy);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--b3);
}
.card-hd {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-hd::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.card-hd b {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  font-family: var(--sans);
}

/* ═══════════════════════════════════════════════════════
   GRIDS
═══════════════════════════════════════════════════════ */
/* Grelhas de formulário responsivas — auto-fit para não desalinhar em ecrã dividido/estreito.
   align-items:start mantém os campos alinhados ao topo mesmo com alturas diferentes. */
.g2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: start;
}
.g3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: start;
}
.g4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: start;
}
.g5 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: start;
}
.g6 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  align-items: start;
}
.mb8 {
  margin-bottom: 8px;
}
.mb12 {
  margin-bottom: 12px;
}
.mb16 {
  margin-bottom: 16px;
}
.sep {
  border: none;
  border-top: var(--border-w) solid var(--border);
  margin: 14px 0;
}

/* ═══════════════════════════════════════════════════════
   SEQUENCE VALIDATION ALERT
═══════════════════════════════════════════════════════ */
.seq-alert {
  background: var(--caution-d);
  border: 1px solid var(--caution);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: none;
  animation: seqSlideIn 0.3s ease-out;
}
.seq-alert.show {
  display: block;
}
@keyframes seqSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.seq-alert-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.seq-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--caution);
  animation: seqPulse 2s infinite;
}
@keyframes seqPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.8);
  }
}
.seq-alert-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--caution);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.seq-alert-msg {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
}
.seq-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.seq-chip {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r3);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.seq-chip-lbl {
  color: var(--t3);
}
.seq-chip-val {
  color: var(--text);
  font-weight: 500;
}
.seq-chip-val.exp {
  color: var(--col-af);
}
.seq-chip-val.got {
  color: var(--caution);
}
.fg-with-bar {
  position: relative;
}
.fg-status-bar {
  position: absolute;
  left: 0;
  top: 24px;
  bottom: 0;
  width: 3px;
  border-radius: var(--r2) 0 0 var(--r2);
  background: transparent;
  transition: background 0.2s;
  z-index: 1;
}
.fg-status-bar.ok {
  background: var(--col-af);
}
.fg-status-bar.warn {
  background: var(--caution);
}
.fg-with-bar input {
  padding-left: 16px;
}

/* ═══════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════ */
.fg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}
.fg label {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.fg input,
.fg select,
.fg textarea {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--r2);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  border-color: var(--col-af);
}
.fg textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
  font-size: 11px;
}
.g-compact-fields {
  justify-content: start;
}
.g6.g-compact-fields {
  grid-template-columns: repeat(auto-fit, minmax(120px, 180px));
}
.g3.g-compact-fields {
  grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
}
.g2.g-compact-fields {
  grid-template-columns: repeat(auto-fit, minmax(180px, 320px));
}
.fg input[readonly] {
  font-weight: 700;
  cursor: default;
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* System-coloured inputs */
.inp-af input[readonly] {
  color: var(--col-af);
  border-color: var(--col-af);
  background: var(--col-af-d);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 10px;
}
.inp-e1 input[readonly] {
  color: var(--col-e1);
  border-color: var(--col-e1-d);
}
.inp-e2 input[readonly] {
  color: var(--col-e2);
  border-color: var(--col-e2-d);
}
.inp-apu input[readonly] {
  color: var(--col-apu);
  border-color: var(--col-apu-d);
}

/* coloured labels for system fields */
.lbl-af label {
  color: var(--col-af);
}
.lbl-e1 label {
  color: var(--col-e1);
}
.lbl-e2 label {
  color: var(--col-e2);
}
.lbl-apu label {
  color: var(--col-apu);
}
.lbl-nlg label {
  color: var(--col-nlg);
}
.lbl-lh label {
  color: var(--col-lh);
}
.lbl-rh label {
  color: var(--col-rh);
}

/* ═══════════════════════════════════════════════════════
   AUTOCOMPLETE
═══════════════════════════════════════════════════════ */
.ac {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  background: var(--s3);
  border: var(--border-w) solid var(--b2);
  border-radius: var(--r2);
  z-index: 9999;
  max-height: 170px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow);
  min-width: 200px;
}
.ac.open {
  display: block;
}
.ac-i {
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: var(--border-w) solid var(--border);
}
.ac-i:last-child {
  border-bottom: none;
}
.ac-i:hover {
  background: var(--col-af-d);
  color: var(--col-af);
}
.ac-i em {
  color: var(--t2);
  font-style: normal;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
/* Glossy buttons — gradient gloss + top highlight + soft shadow (estilo "abstract button") */
.btn {
  border: none;
  border-radius: var(--r2);
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    filter 0.12s;
  white-space: nowrap;
  position: relative;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  filter: brightness(1.05);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset;
  filter: brightness(0.97);
}
.btn-g {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.22),
      rgba(255, 255, 255, 0) 45%,
      rgba(0, 0, 0, 0.16)
    ),
    var(--col-af);
  color: #fff;
}
.btn-b {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.1)), var(--col-e1-d);
  color: var(--col-e1);
  border: 1px solid var(--col-e1);
}
.btn-warn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.1)), var(--warn-d);
  color: var(--warn);
  border: 1px solid var(--warn);
}
.btn-gh {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.05)), transparent;
  color: var(--t2);
  border: var(--border-w) solid var(--border);
}
.btn-gh:hover {
  border-color: var(--b2);
  color: var(--text);
}
.btn-apu {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.1)), var(--col-af-d);
  color: var(--col-af);
  border: 1px solid var(--col-af);
}
/* Grelha de 5 posições de pneus — não desalinha em ecrã dividido/estreito */
.tyre-grid5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-items: stretch;
}
@media (max-width: 1200px) {
  .tyre-grid5 {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important;
  }
}
/* Gráficos da Fiabilidade — 2 colunas em ecrã largo, empilham em ecrã dividido (sem scroll lateral) */
.rel-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.rel-2col > * {
  min-width: 0;
} /* permite encolher abaixo da largura do canvas */
.rel-2col canvas {
  max-width: 100%;
}
@media (max-width: 1000px) {
  .rel-2col {
    grid-template-columns: 1fr;
  }
}
.btn-full {
  width: 100%;
  padding: 11px;
}
.btn-sm {
  padding: 4px 9px;
  font-size: 10px;
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════
   BANNERS
═══════════════════════════════════════════════════════ */
.banner {
  border-radius: var(--r);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.banner-g {
  background: var(--col-af-d);
  border: 1px solid var(--col-af);
  color: var(--col-af);
}
.banner-b {
  background: var(--col-e1-d);
  border: 1px solid var(--col-e1);
  color: var(--col-e1);
}

/* ═══════════════════════════════════════════════════════
   TWO COLUMN LAYOUT
═══════════════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) 470px;
  gap: 14px;
  align-items: start;
}
.log-form-layout {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}
.log-section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.log-section-grid-systems {
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  align-items: start;
}
.log-section-grid-systems > .log-section-apu {
  grid-column: 1;
  grid-row: 1;
}
.log-section-grid-systems > .log-section-oils {
  grid-column: 1;
  grid-row: 2;
}
.log-section-grid-systems > .log-section-gear {
  grid-column: 2;
  grid-row: 1;
}
.log-section-grid-systems > .log-section-reliability {
  grid-column: 2;
  grid-row: 2;
}
.log-section {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--r2) + 2px);
  background: rgba(255, 255, 255, 0.015);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.log-section .card-hd {
  min-height: 0;
  margin: 0 0 10px;
  padding: 0 0 8px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.log-section .card-hd::after {
  display: none;
}
.log-section .card-hd b {
  font-size: 12px;
  letter-spacing: 0.04em;
}
.log-section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}
.log-section-kicker,
.log-mini-label {
  color: var(--t3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.log-section-head p {
  margin: 0;
  color: var(--t2);
  font-size: 11px;
  line-height: 1.45;
}
.log-mini-label {
  margin: 0 0 8px;
}
.log-actions-panel {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--r2) + 2px);
  background: rgba(255, 255, 255, 0.015);
}
.log-time-grid {
  align-items: start;
}
.log-section-primary .g5 {
  justify-content: start;
  grid-template-columns: 154px 118px 138px 138px 72px;
  gap: 10px;
}
.log-section-primary .g5 .fg label {
  text-align: center;
}
.log-section-primary .g5 .fg-status-bar {
  display: none;
}
.log-section-primary .g5 .fg-with-bar input {
  padding-left: 10px;
}
.log-section-primary .log-time-grid {
  justify-content: start;
  grid-template-columns: repeat(4, 96px) repeat(2, 110px) !important;
  gap: 8px !important;
}
.log-section-primary .g6.g-compact-fields {
  grid-template-columns:
    72px
    96px
    84px
    90px
    140px
    170px;
  gap: 8px;
  align-items: start;
  justify-content: start;
}
.log-section-primary .g6.g-compact-fields > .fg {
  grid-column: auto;
  min-width: 0;
}
.log-section-primary .g6.g-compact-fields > .fg label {
  text-align: center;
}
.log-section-primary .g6.g-compact-fields .log-op-inline {
  display: grid;
  align-content: start;
}
.log-section-primary .g6.g-compact-fields .log-op-inline > div {
  min-height: 38px;
  margin-top: 0 !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  white-space: nowrap;
}
.log-section-primary .g6.g-compact-fields .log-op-inline label {
  white-space: nowrap;
}
.log-section-primary .g6.g-compact-fields .log-op-inline:not(:last-child) > div {
  justify-content: center;
}
#f-clients-wrap {
  min-width: 0;
}
.client-picker-row {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  max-width: 100%;
  justify-content: center;
}
.client-picker-summary {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  align-items: center;
}
.client-picker-btn {
  flex: 0 0 auto;
  margin-left: 0;
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 9px;
  border-radius: var(--r);
  cursor: pointer;
}
.client-picker-ac {
  position: absolute;
  min-width: 180px;
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
}
.log-section-crew .g3 {
  justify-content: start;
  grid-template-columns: repeat(3, minmax(190px, 260px));
  gap: 10px;
}
.log-section-crew .fg label {
  text-align: center;
}
#sec-tl-apu-body {
  justify-content: start;
  grid-template-columns: 160px 110px;
  gap: 8px;
}
.g3.g-compact-fields.log-engine-grid {
  justify-content: start;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 8px;
}
.log-section-gear .g2 {
  justify-content: start;
  grid-template-columns: 190px 190px;
  gap: 8px;
}
.log-section-reliability .g2 {
  justify-content: start;
  grid-template-columns: 210px 190px;
  gap: 8px;
}
.log-defect-text-grid {
  justify-content: start;
  grid-template-columns: repeat(2, minmax(260px, 420px));
  gap: 10px;
}
.log-defect-text-grid textarea {
  min-height: 56px;
}
.log-mel-row {
  justify-content: start;
  grid-template-columns:
    minmax(150px, 1.35fr)
    minmax(120px, 1fr)
    minmax(115px, 0.9fr)
    minmax(125px, 1fr)
    minmax(72px, 0.45fr);
  gap: 8px;
}
.log-mel-row > .fg {
  min-width: 0;
}
#f-melext-wrap {
  margin-top: -2px;
}
.log-btn-row {
  flex-wrap: wrap;
}
.log-btn-row > .btn {
  min-width: 132px;
}
#btn-save-log,
#btn-save-maint {
  flex: 1 1 220px;
}

/* ═══════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════ */
.t-wrap {
  overflow-x: auto;
  overflow-y: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-family: var(--mono);
}
thead th {
  background: var(--s2);
  color: var(--t3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: var(--border-w) solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: var(--border-w) solid var(--border);
  transition: background 0.1s;
}
tbody tr:hover {
  background: var(--s2);
}
tbody td {
  padding: 7px 10px;
  white-space: nowrap;
}
.td-af {
  color: var(--col-af);
}
.td-e1 {
  color: var(--col-e1);
}
.td-e2 {
  color: var(--col-e2);
}
.td-apu {
  color: var(--col-apu);
}
.td-nlg {
  color: var(--col-nlg);
}
.td-lh {
  color: var(--col-lh);
}
.td-rh {
  color: var(--col-rh);
}
.td-dim {
  color: var(--t2);
}
.td-acts {
  display: flex;
  gap: 4px;
  opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════ */
.bdg {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--r3);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--mono);
}
.bdg-warn {
  background: var(--warn-d);
  color: var(--warn);
}
.bdg-ok {
  background: var(--col-af-d);
  color: var(--col-af);
}
.bdg-caut {
  background: var(--caution-d);
  color: var(--caution);
}
.bdg-adv {
  background: var(--advisory-d);
  color: var(--advisory);
}
/* MEL Category badges */
.bdg-mel-a {
  background: rgba(255, 71, 87, 0.18);
  color: var(--warn);
  border: 1px solid rgba(255, 71, 87, 0.3);
}
.bdg-mel-b {
  background: rgba(255, 71, 87, 0.12);
  color: var(--warn);
  border: 1px solid rgba(255, 71, 87, 0.2);
}
.bdg-mel-c {
  background: rgba(255, 159, 67, 0.15);
  color: var(--caution);
  border: 1px solid rgba(255, 159, 67, 0.25);
}
.bdg-mel-d {
  background: rgba(255, 211, 42, 0.12);
  color: var(--advisory);
  border: 1px solid rgba(255, 211, 42, 0.2);
}

/* ═══════════════════════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════════════════════ */
.fbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.fbar input,
.fbar select {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  padding: 6px 10px;
  border-radius: var(--r2);
  outline: none;
}
.cnt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.overlay.open {
  display: flex;
}
.modal {
  background: var(--s1);
  border: var(--border-w) solid var(--b2);
  border-radius: var(--r);
  width: min(800px, 97vw);
  max-height: 94vh;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.modal-hd {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 12px;
  border-bottom: var(--border-w) solid var(--border);
}
.modal-x {
  cursor: pointer;
  color: var(--t2);
  font-size: 20px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-x:hover {
  color: var(--warn);
}
#modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}
#modal-btn-row {
  flex-shrink: 0;
  padding: 12px 24px 20px;
  border-top: var(--border-w) solid var(--border);
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════
   ALERT MODAL
═══════════════════════════════════════════════════════ */
.alert-box {
  background: var(--s1);
  border: 2px solid var(--caution);
  border-radius: var(--r);
  padding: 28px;
  width: min(460px, 95vw);
  box-shadow: var(--shadow);
}
.alert-icon {
  font-size: 32px;
  text-align: center;
  margin-bottom: 12px;
}
.alert-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--caution);
}
.alert-body {
  font-size: 12px;
  color: var(--t2);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
}
.alert-detail {
  background: var(--s2);
  border-radius: var(--r2);
  padding: 12px;
  font-family: var(--mono);
  font-size: 11px;
  margin-bottom: 20px;
  border-left: 3px solid var(--caution);
}
.alert-row {
  display: flex;
  gap: 10px;
}
.alert-row .btn {
  flex: 1;
  padding: 10px;
}

/* ═══════════════════════════════════════════════════════
   PERIOD TOTALS
═══════════════════════════════════════════════════════ */
.ptot {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
}
.ptot-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.ptot-item .pv {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--col-af);
}
.ptot-item .pk {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════
   CONFIG SECTIONS
═══════════════════════════════════════════════════════ */
.cfg-sec {
  margin-bottom: 24px;
}
.cfg-sec h3 {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: var(--border-w) solid var(--border);
}
.sn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sn-box {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}
.sn-box h4 {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.sn-box input {
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--r3);
  outline: none;
  width: 100%;
  margin-bottom: 6px;
}
.sn-box input:focus {
  border-color: var(--col-af);
}
.sn-box label {
  font-size: 9px;
  color: var(--t3);
  font-family: var(--mono);
  display: block;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════
   ECTM
═══════════════════════════════════════════════════════ */
.ectm-engine-card {
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
}
.ectm-engine-card.e1 {
  background: var(--col-e1-d);
  border: 1px solid var(--col-e1);
}
.ectm-engine-card.e2 {
  background: var(--col-e2-d);
  border: 1px solid var(--col-e2);
}
.ectm-hd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 12px;
}
.ectm-hd.e1 {
  color: var(--col-e1);
}
.ectm-hd.e2 {
  color: var(--col-e2);
}
.ectm-val {
  font-family: var(--mono);
  font-size: 11px;
}
.ectm-over {
  color: var(--warn) !important;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   TIRES
═══════════════════════════════════════════════════════ */
.tire-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.tire-box {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 14px;
}
.tire-box h4 {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.tire-cyc {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 2px;
}
.tire-sub {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
}
.tire-hist {
  margin-top: 10px;
  border-top: var(--border-w) solid var(--border);
  padding-top: 8px;
}
.tire-entry {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  padding: 3px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: var(--border-w) solid var(--border);
}
.tire-entry:last-child {
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════════
   CREW PILLS
═══════════════════════════════════════════════════════ */
.cpills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.cpill {
  background: var(--col-e1-d);
  border: 1px solid var(--col-e1);
  border-radius: var(--r3);
  padding: 3px 8px;
  font-size: 9px;
  font-family: var(--mono);
  color: var(--col-e1);
  display: flex;
  align-items: center;
  gap: 5px;
}
.cpill.pnc {
  background: var(--col-apu-d);
  border-color: var(--col-apu);
  color: var(--col-apu);
}
.cpill.ctrl {
  background: var(--col-af-d);
  border-color: var(--col-af);
  color: var(--col-af);
}
.cpill.dir {
  background: var(--col-e2-d);
  border-color: var(--col-e2);
  color: var(--col-e2);
}
.cpill.aux {
  background: var(--caution-d);
  border-color: var(--caution);
  color: var(--caution);
}
.cpill .x {
  cursor: pointer;
  color: var(--t3);
}
.cpill .x:hover {
  color: var(--warn);
}

/* ═══════════════════════════════════════════════════════
   WATERMARK
═══════════════════════════════════════════════════════ */
.wm {
  position: fixed;
  bottom: 16px;
  right: 20px;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  display: none;
}
.wm img {
  height: 50px;
}

/* ═══════════════════════════════════════════════════════
   TOAST — Premium bottom-right
═══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  min-width: 260px;
  max-width: 340px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: all;
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s;
  position: relative;
  overflow: hidden;
}
.toast.show {
  transform: translateX(0);
  opacity: 1;
}
.toast.ok {
  border-left: 3px solid var(--col-af);
}
.toast.err {
  border-left: 3px solid var(--warn);
}
.toast.warn {
  border-left: 3px solid var(--caution);
}
.toast.info {
  border-left: 3px solid var(--col-e1);
}
.toast-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-body {
  flex: 1;
  min-width: 0;
}
.toast-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.toast-msg {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  line-height: 1.4;
}
.toast-x {
  color: var(--t3);
  cursor: pointer;
  font-size: 14px;
  transition: color 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.toast-x:hover {
  color: var(--warn);
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  animation: toastProg 4s linear forwards;
}
.toast.ok .toast-progress {
  background: var(--col-af);
}
.toast.err .toast-progress {
  background: var(--warn);
}
.toast.warn .toast-progress {
  background: var(--caution);
}
.toast.info .toast-progress {
  background: var(--col-e1);
}
@keyframes toastProg {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* ═══════════════════════════════════════════════════════
   NOTIFICATION PANEL
═══════════════════════════════════════════════════════ */
.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 399;
  display: none;
  backdrop-filter: blur(2px);
}
.notif-overlay.open {
  display: block;
}
.notif-panel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 360px;
  max-height: calc(100vh - 52px);
  background: var(--s1);
  border-left: var(--border-w) solid var(--border);
  border-bottom: var(--border-w) solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 400;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.notif-panel.open {
  transform: translateX(0);
}
.notif-panel-hd {
  padding: 14px 16px 10px;
  border-bottom: var(--border-w) solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.notif-panel-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-panel-title span {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 1px 7px;
  color: var(--t2);
  font-weight: 600;
}
.notif-panel-acts {
  display: flex;
  gap: 6px;
  align-items: center;
}
.notif-clr-btn {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  background: none;
  border: var(--border-w) solid var(--border);
  border-radius: var(--r3);
  padding: 3px 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.15s;
}
.notif-clr-btn:hover {
  color: var(--warn);
  border-color: var(--warn);
}
.notif-panel-x {
  cursor: pointer;
  color: var(--t3);
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
  padding: 2px 6px;
}
.notif-panel-x:hover {
  color: var(--warn);
}
.notif-filters {
  display: flex;
  gap: 0;
  border-bottom: var(--border-w) solid var(--border);
  padding: 0 16px;
  flex-shrink: 0;
}
.nf-tab {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--t3);
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.nf-tab:hover {
  color: var(--text);
}
.nf-tab.on {
  color: var(--col-apu);
  border-bottom-color: var(--col-apu);
}
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(37, 51, 71, 0.5);
  cursor: pointer;
  transition:
    background 0.1s,
    opacity 0.2s,
    transform 0.2s,
    max-height 0.25s;
  position: relative;
  overflow: hidden;
}
.notif-item:hover {
  background: var(--s2);
}
.notif-item.dismissing {
  opacity: 0;
  transform: translateX(40px);
  max-height: 0;
  padding: 0;
  border: none;
  pointer-events: none;
}
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 var(--r3) var(--r3) 0;
}
.notif-item.unread.ntype-warn::before {
  background: var(--warn);
}
.notif-item.unread.ntype-caution::before {
  background: var(--caution);
}
.notif-item.unread.ntype-info::before {
  background: var(--col-e1);
}
.notif-item.unread.ntype-ok::before {
  background: var(--col-af);
}
.notif-item.unread.ntype-advisory::before {
  background: var(--advisory);
}
.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-icon.ntype-warn {
  background: var(--warn-d);
  border: 1px solid rgba(255, 71, 87, 0.25);
}
.notif-icon.ntype-caution {
  background: var(--caution-d);
  border: 1px solid rgba(255, 159, 67, 0.25);
}
.notif-icon.ntype-info {
  background: var(--col-e1-d);
  border: 1px solid rgba(74, 158, 255, 0.25);
}
.notif-icon.ntype-ok {
  background: var(--col-af-d);
  border: 1px solid rgba(46, 204, 113, 0.25);
}
.notif-icon.ntype-advisory {
  background: var(--advisory-d);
  border: 1px solid rgba(255, 211, 42, 0.25);
}
.notif-body {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-msg {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  line-height: 1.5;
  margin-bottom: 5px;
}
.notif-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
}
.notif-meta-tag {
  border-radius: var(--r3);
  padding: 2px 6px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ntype-warn .notif-meta-tag {
  background: var(--warn-d);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--warn);
}
.ntype-caution .notif-meta-tag {
  background: var(--caution-d);
  border: 1px solid rgba(255, 159, 67, 0.3);
  color: var(--caution);
}
.ntype-info .notif-meta-tag {
  background: var(--col-e1-d);
  border: 1px solid rgba(74, 158, 255, 0.3);
  color: var(--col-e1);
}
.ntype-ok .notif-meta-tag {
  background: var(--col-af-d);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--col-af);
}
.ntype-advisory .notif-meta-tag {
  background: var(--advisory-d);
  border: 1px solid rgba(255, 211, 42, 0.3);
  color: var(--advisory);
}
.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--col-apu);
  flex-shrink: 0;
  align-self: center;
}
.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--t3);
}
.notif-empty-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.4;
}
.notif-empty-txt {
  font-family: var(--mono);
  font-size: 11px;
}
.notif-panel-ft {
  padding: 8px 16px;
  border-top: var(--border-w) solid var(--border);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-align: center;
  flex-shrink: 0;
}
/* Bell button */
.notif-btn {
  position: relative;
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 5px 9px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--t2);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-btn:hover {
  border-color: var(--col-apu);
  color: var(--col-apu);
}
.notif-btn.has-unread {
  border-color: var(--col-apu);
  color: var(--col-apu);
  background: var(--col-apu-d);
}
.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--warn);
  color: #fff;
  border-radius: var(--r);
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1.4;
  border: 1.5px solid var(--bg);
}

/* ═══════════════════════════════════════════════════════
   CHECK FORECAST CARDS
═══════════════════════════════════════════════════════ */
.chk-card {
  border-radius: var(--r);
  padding: 14px;
  border: var(--border-w) solid var(--border);
  background: var(--s2);
  position: relative;
  overflow: hidden;
}
.chk-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.chk-card.af::before {
  background: var(--col-af);
}
.chk-card.e1::before {
  background: var(--col-e1);
}
.chk-card.e2::before {
  background: var(--col-e2);
}
.chk-card.apu::before {
  background: var(--col-apu);
}
.chk-card.warn::before {
  background: var(--warn);
}
.chk-card.caution::before {
  background: var(--caution);
}
.chk-name {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.chk-date {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.chk-remain {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
  margin-bottom: 6px;
}
.chk-bar-wrap {
  background: var(--border);
  border-radius: var(--r3);
  height: 5px;
  margin-bottom: 6px;
}
.chk-bar {
  height: 5px;
  border-radius: var(--r3);
  transition: width 0.4s;
}
.chk-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
}

/* Interactive table rows */
tr[ondblclick]:hover td {
  background: rgba(255, 255, 255, 0.04);
}
tr[ondblclick]:active td {
  background: rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1500px) {
  .log-section-grid-systems {
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  }
  .log-section-grid-systems > .log-section-apu {
    grid-column: 1;
    grid-row: 1;
  }
  .log-section-grid-systems > .log-section-oils {
    grid-column: 1;
    grid-row: 2;
  }
  .log-section-grid-systems > .log-section-gear {
    grid-column: 2;
    grid-row: 1;
  }
  .log-section-grid-systems > .log-section-reliability {
    grid-column: 2;
    grid-row: 2;
  }
  .log-section-crew .g3 {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}
@media (max-width: 1100px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .log-section-grid,
  .log-section-grid-systems {
    grid-template-columns: 1fr;
  }
  .log-section-grid-systems > .log-section,
  .log-section-grid-systems > .log-section-apu,
  .log-section-grid-systems > .log-section-oils,
  .log-section-grid-systems > .log-section-gear,
  .log-section-grid-systems > .log-section-reliability {
    grid-column: auto;
    grid-row: auto;
  }
  .log-section-primary .g5,
  .log-section-primary .log-time-grid,
  .log-section-primary .g6.g-compact-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .log-section-crew .g3,
  .log-defect-text-grid,
  .log-mel-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sn-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.mob-log-tabs {
  display: none;
}
@media (max-width: 700px) {
  .log-section {
    padding: 12px;
  }
  .log-actions-panel {
    padding: 12px;
  }
  .log-btn-row > .btn {
    flex: 1 1 100%;
  }
  .mob-log-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-radius: var(--r2);
    overflow: hidden;
    border: var(--border-w) solid var(--border);
  }
  .mob-log-tab {
    flex: 1;
    padding: 10px;
    background: var(--s2);
    color: var(--t3);
    border: none;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition:
      background 0.15s,
      color 0.15s;
  }
  .mob-log-tab.active {
    background: var(--col-af);
    color: var(--bg);
  }
  #mob-pane-accum {
    display: none;
  }
  #mob-pane-accum.mob-visible {
    display: block;
  }
  #mob-pane-form.mob-hidden {
    display: none;
  }

  .g4,
  .g5,
  .g6 {
    grid-template-columns: 1fr 1fr;
  }
  .log-section-primary .g5,
  .log-section-primary .log-time-grid,
  .log-section-primary .g6.g-compact-fields {
    grid-template-columns: 1fr 1fr !important;
  }
  .g3 {
    grid-template-columns: 1fr 1fr;
  }
  nav {
    flex-wrap: wrap;
    height: auto;
    padding: 8px;
  }
  .tab {
    height: 26px;
    padding: 0 8px;
    font-size: 8px;
    margin: 4px 1px;
    border-radius: var(--r);
  }
  .sn-grid {
    grid-template-columns: 1fr;
  }
  .ptot-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Maintenance sub-tabs ───────────────────────────── */
.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.sub-tab {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--t2);
  padding: 8px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.sub-tab:hover {
  color: var(--text);
}
.sub-tab.on {
  color: var(--col-af);
  border-bottom-color: var(--col-af);
}
/* ═══════════════════════════════════════════════════════
   UI UTILITIES — extracted from repeated inline styles
═══════════════════════════════════════════════════════ */
/* Card header with space-between row */
.card-hd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Small filter-bar inputs/selects */
.fi {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  padding: 5px 8px;
  border-radius: var(--r2);
  outline: none;
  cursor: pointer;
}
.fi:focus {
  border-color: var(--col-af);
}

/* Helper/hint text below inputs */
.help {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  margin-top: 3px;
}

/* Inline checkbox rows */
.chk-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chk-row-pad {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: flex-start;
  padding-top: 7px;
  min-width: 0;
  max-width: 100%;
}
.chk-row-pad .help {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

/* Section uppercase mono label */
.sec-lbl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Type badge in history table */
.type-bdg {
  font-family: var(--mono);
  font-size: 9px;
  border-radius: var(--r3);
  padding: 1px 5px;
  white-space: nowrap;
  display: inline-block;
}
.type-bdg.flight {
  color: var(--col-af);
  opacity: 0.7;
  font-size: 13px;
}
.type-bdg.maint-corr {
  color: var(--col-af);
  background: var(--col-af-d);
  border: 1px solid var(--col-af);
}
.type-bdg.maint-prev {
  color: var(--t3);
  background: var(--s2);
  border: var(--border-w) solid var(--border);
}

/* ════════════════════════════════════════════════════════
   SIDEBAR LAYOUT — replaces top-nav tab layout
════════════════════════════════════════════════════════ */

/* Rewire the app root to flex-row */
#app {
  flex-direction: row !important;
  overflow: hidden !important;
  height: calc(100vh - 0px);
}

/* ── Sidebar ── */
.sidebar {
  width: 224px;
  min-width: 224px;
  background: var(--s1);
  border-right: var(--border-w) solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition:
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 60;
}
.sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}
.sidebar.collapsed .sb-label,
.sidebar.collapsed .sb-section-lbl,
.sidebar.collapsed .sb-nav-text,
.sidebar.collapsed .sb-nav-badge,
.sidebar.collapsed .sb-logo-text,
.sidebar.collapsed .sb-reg-info {
  display: none;
}

/* Logo area */
.sb-logo {
  padding: 14px 16px;
  border-bottom: var(--border-w) solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  flex-shrink: 0;
}
.sb-logo img {
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.sb-logo-text {
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* align with logo baseline (lowered) */
  align-self: stretch; /* stretch full row height so flex-end has effect */
  padding-bottom: 0; /* sits flush to the bottom of the row */
  margin-bottom: -2px; /* small nudge to align with logo baseline */
  line-height: 1.15;
}
.sb-logo-name {
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.15;
}
.sb-logo-ver {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  letter-spacing: 0.4px;
}

/* Reg pill */
.sb-reg {
  margin: 12px 10px 0;
  background: var(--col-af-d);
  border: 1px solid rgba(46, 204, 113, 0.35);
  border-radius: var(--r);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  z-index: 50;
  box-sizing: border-box;
  max-width: calc(224px - 20px);
  min-width: 0;
}
.sb-reg::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--col-af);
  border-radius: var(--r) 0 0 var(--r);
}
.sb-reg-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--col-af);
  flex-shrink: 0;
  animation: pulse 2s infinite;
  margin-left: 2px;
}
.sb-reg-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--col-af);
  letter-spacing: 2px;
  white-space: nowrap;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
}
.sb-reg-lbl {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}
.sb-reg-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: visible;
}

/* Section labels */
.sb-section-lbl {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--t4);
  text-transform: uppercase;
  padding: 14px 16px 4px;
  white-space: nowrap;
}

/* Nav items */
.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: var(--t-snappy);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--t2);
  position: relative;
  white-space: nowrap;
  text-transform: uppercase;
  border-radius: var(--r2);
  box-sizing: border-box;
}
.sb-nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}
.sb-nav-item.active {
  color: var(--col-af);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.06)), var(--col-af-d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.18);
}
/* Collapsed sidebar: remove side margin so icon stays centered in 56px column */
.sidebar.collapsed .sb-nav-item {
  margin: 1px 4px;
  padding: 8px 6px;
  justify-content: center;
}

/* Collapsed sidebar: re-center every block within the 56px column */
.sidebar.collapsed .sb-logo {
  padding: 14px 0;
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .sb-reg {
  margin: 12px 8px 0;
  padding: 10px 0;
  justify-content: center;
  gap: 0;
  max-width: none;
}
.sidebar.collapsed .sb-reg::before {
  display: none;
}
.sidebar.collapsed .sb-reg-pulse {
  margin-left: 0;
}
.sidebar.collapsed .sb-section-lbl {
  padding: 14px 0 4px;
  text-align: center;
}
.sidebar.collapsed .sb-collapse-btn {
  padding: 8px 0;
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .sb-bottom {
  padding: 10px 6px;
}
.sidebar.collapsed .sb-user-card {
  padding: 8px 0;
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .sb-user-card > div:not(.sb-user-avatar) {
  display: none;
}
.sb-nav-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sb-nav-badge {
  margin-left: auto;
  background: var(--warn);
  color: #fff;
  border-radius: var(--r);
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Collapse toggle button */
.sb-collapse-btn {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--t3);
  transition: var(--t-snappy);
  border-top: var(--border-w) solid var(--border);
  flex-shrink: 0;
}
.sb-collapse-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.sb-collapse-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 12px;
}

/* Spacer */
.sb-spacer {
  flex: 1;
}

/* Sidebar bottom user area */
.sb-bottom {
  padding: 10px;
  border-top: var(--border-w) solid var(--border);
  flex-shrink: 0;
}
.sb-user-card {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--t-snappy);
  min-height: 44px;
}
.sb-user-card:hover {
  border-color: var(--b2);
}
.sb-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--col-e1), var(--col-apu));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sb-user-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}
.sb-user-role {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t2);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD PAGE (pg-dash)
   ═══════════════════════════════════════════════════════ */
#pg-dash {
  padding: 14px;
}
.dash-row {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.dash-r3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.dash-r2e {
  grid-template-columns: 2fr 1fr;
}
.dash-card {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
}
.dash-card-lbl {
  font-size: 8px;
  font-weight: 700;
  color: var(--t3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0 0 6px;
  font-family: var(--mono);
}
.dash-card-sub {
  font-size: 9px;
  color: var(--t3);
  font-family: var(--mono);
  margin: 0 0 6px;
}
.dash-mrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.dash-mk {
  font-size: 10px;
  color: var(--t2);
  font-family: var(--mono);
}
.dash-mv {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.dash-ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dash-status-txt {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
  font-family: var(--mono);
}
.dash-eng-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.dash-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-dot-ok {
  background: var(--col-af);
}
.dash-dot-warn {
  background: var(--caution);
}
.dash-dot-err {
  background: var(--warn);
}
.dash-alert-card {
  background: var(--s1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: var(--r);
  padding: 10px 12px;
}
.dash-alert-lbl {
  font-size: 8px;
  font-weight: 700;
  color: var(--warn);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0 0 7px;
  font-family: var(--mono);
}
.dash-alert-list {
  max-height: 108px;
  overflow-y: auto;
}
.dash-alert-item {
  background: var(--s2);
  border-radius: var(--r3);
  padding: 5px 8px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.dash-alert-item:last-child {
  margin-bottom: 0;
}
.dash-alert-name {
  font-size: 10px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-alert-more {
  font-size: 9px;
  color: var(--t3);
  font-family: var(--mono);
  text-align: center;
  padding: 4px 0 0;
  cursor: pointer;
}
.dash-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r2);
  font-family: var(--mono);
  white-space: nowrap;
}
.dash-badge-warn {
  background: var(--caution-d);
  color: var(--caution);
  border: 1px solid rgba(255, 159, 67, 0.3);
}
.dash-badge-due {
  background: var(--warn-d);
  color: var(--warn);
  border: 1px solid rgba(255, 71, 87, 0.3);
}
.dash-badge-mel {
  background: var(--col-e1-d);
  color: var(--col-e1);
  border: 1px solid rgba(74, 158, 255, 0.3);
}
.dash-mini-tags {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}
.dash-mtag {
  flex: 1;
  background: var(--s2);
  border-radius: var(--r3);
  padding: 6px;
  text-align: center;
}
.dash-mtag-k {
  font-size: 8px;
  color: var(--t3);
  font-family: var(--mono);
  margin-bottom: 2px;
}
.dash-mtag-v {
  font-size: 12px;
  font-weight: 600;
}
.dash-eng-note {
  margin-top: 6px;
  border-radius: var(--r3);
  padding: 4px 7px;
  font-size: 9px;
  border-left: 2px solid;
  font-family: var(--mono);
}
.dash-note-ok {
  background: rgba(46, 204, 113, 0.07);
  border-color: var(--col-af);
  color: var(--col-af);
}
.dash-note-warn {
  background: rgba(255, 159, 67, 0.07);
  border-color: var(--caution);
  color: var(--caution);
}
.dash-note-err {
  background: rgba(255, 71, 87, 0.07);
  border-color: var(--warn);
  color: var(--warn);
}
.dash-flights {
  display: flex;
  flex-direction: column;
}
.dash-flight {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  padding: 5px 0;
  border-bottom: var(--border-w) solid var(--border);
  font-family: var(--mono);
}
.dash-flight:last-child {
  border-bottom: none;
}
.dash-chk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.dash-chk {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 9px 10px;
}
.dash-chk.chk-warn {
  border-color: rgba(255, 159, 67, 0.4);
}
.dash-chk.chk-due {
  border-color: rgba(255, 71, 87, 0.4);
}
.dash-chk-name {
  font-size: 8px;
  font-weight: 700;
  color: var(--t2);
  font-family: var(--mono);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.dash-chk-at {
  font-size: 10px;
  color: var(--text);
  margin-bottom: 2px;
}
.dash-chk-at span {
  font-weight: 700;
  color: var(--col-e1);
}
.dash-chk-rem {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}
.dash-chk-rem.ok {
  color: var(--col-af);
}
.dash-chk-rem.warn {
  color: var(--caution);
}
.dash-chk-rem.due {
  color: var(--warn);
}
.dash-chk-date {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
}
.dash-chk-date span {
  color: var(--t2);
}
.dash-tyre-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.dash-tyre {
  background: var(--s2);
  border-radius: var(--r3);
  padding: 7px 8px;
}
.dash-tyre-n {
  font-size: 8px;
  color: var(--t3);
  font-family: var(--mono);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-tyre-bg {
  background: var(--border);
  border-radius: var(--r3);
  height: 4px;
  margin-bottom: 2px;
}
.dash-tyre-bar {
  height: 4px;
  border-radius: var(--r3);
  transition: width 0.4s;
}
.dash-tyre-v {
  font-size: 9px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Oil consumption card ── */
.dash-oil-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.dash-oil-row:last-child {
  margin-bottom: 0;
}
.dash-oil-lbl {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  width: 34px;
  flex-shrink: 0;
}
.dash-oil-bar-wrap {
  flex: 1;
  background: var(--border);
  border-radius: var(--r3);
  height: 5px;
  position: relative;
  overflow: hidden;
}
.dash-oil-bar {
  height: 5px;
  border-radius: var(--r3);
  transition: width 0.4s ease;
}
.dash-oil-val {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 600;
  width: 60px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-oil-sub {
  font-size: 8px;
  color: var(--t3);
  font-family: var(--mono);
  margin-top: 7px;
  padding-top: 6px;
  border-top: var(--border-w) solid var(--border);
  text-align: center;
}

/* ── Right-col check card ── */
.dash-chk2-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
}
.dash-chk2-grid::-webkit-scrollbar {
  width: 6px;
}
.dash-chk2-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r3);
}
.dash-chk2 {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 8px 10px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.dash-chk2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--r2) 0 0 var(--r2);
}
.dash-chk2.chk2-ok::before {
  background: var(--col-af);
}
.dash-chk2.chk2-warn::before {
  background: var(--caution);
}
.dash-chk2.chk2-due::before {
  background: var(--warn);
}
.dash-chk2-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  gap: 6px;
}
.dash-chk2-name {
  font-size: 9px;
  font-weight: 700;
  color: var(--t2);
  font-family: var(--mono);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-chk2-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r2);
  font-family: var(--mono);
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-chk2-badge.ok {
  background: var(--col-af-d);
  color: var(--col-af);
  border: 1px solid rgba(46, 204, 113, 0.3);
}
.dash-chk2-badge.warn {
  background: var(--caution-d);
  color: var(--caution);
  border: 1px solid rgba(255, 159, 67, 0.3);
}
.dash-chk2-badge.due {
  background: var(--warn-d);
  color: var(--warn);
  border: 1px solid rgba(255, 71, 87, 0.3);
}
.dash-chk2-bar-wrap {
  background: var(--border);
  border-radius: var(--r3);
  height: 4px;
  margin-bottom: 5px;
  overflow: hidden;
}
.dash-chk2-bar {
  height: 4px;
  border-radius: var(--r3);
  transition: width 0.4s;
}
.dash-chk2-meta {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.dash-chk2-cur {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-chk2-prev {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.dash-chk2-compact {
  padding: 8px 10px 8px 12px;
  min-height: 48px;
  box-sizing: border-box;
}
.dash-chk2-compact .dash-chk2-hdr {
  margin-bottom: 4px;
}
.dash-chk2-compact .dash-chk2-name {
  font-size: 10px;
  line-height: 1.15;
  letter-spacing: 0;
}
.dash-chk2-compact .dash-chk2-badge {
  font-size: 8px;
  padding: 2px 6px;
}
.dash-chk2-compact .dash-chk2-meta {
  align-items: center;
  gap: 8px;
}
.dash-chk2-compact .dash-chk2-cur {
  font-size: 8px;
  line-height: 1.2;
  color: var(--t3);
}
.dash-chk2-compact .dash-chk2-prev {
  font-size: 9px;
  line-height: 1.2;
  font-weight: 800;
}

/* ── Global dash text overflow ── */
.dash-alert-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.dash-chk-name,
.dash-chk-at,
.dash-chk-rem,
.dash-chk-date {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.dash-mv {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.dash-card-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.dash-flight {
  overflow: hidden;
}
.dash-flight span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

@media (max-width: 900px) {
  .dash-r3 {
    grid-template-columns: 1fr 1fr;
  }
  .dash-r2e {
    grid-template-columns: 1fr;
  }
  .dash-chk-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .dash-r3 {
    grid-template-columns: 1fr;
  }
  .dash-r2e {
    grid-template-columns: 1fr;
  }
  .dash-chk-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Main column (right of sidebar) ── */
.main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar (inside main-column, above tbar-wrap) ── */
.main-topbar {
  background: var(--s1);
  border-bottom: var(--border-w) solid var(--border);
  padding: 0 18px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.main-topbar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.main-topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.main-topbar-r {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Rewire tbar-wrap and app-body for the new layout ── */
.main-column .tbar-wrap {
  flex-shrink: 0;
}
.main-column .app-body {
  flex: 1;
  overflow: hidden;
}
.main-column .main {
  height: 100%;
}

/* ── Light theme sidebar ── */
[data-theme='light'] .sidebar {
  background: #fff;
  border-right-color: var(--border);
}
[data-theme='light'] .sb-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme='light'] .sb-nav-item.active {
  background: rgba(46, 204, 113, 0.12);
}
[data-theme='light'] .sb-user-card {
  background: var(--s2);
}

/* ════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — sidebar layout
   Breakpoints: 768px (tablet), 480px (phone)
════════════════════════════════════════════════════════ */

/* ── Overlay backdrop for sidebar on mobile ── */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 55;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sb-overlay.open {
  display: block;
}

/* ── Hamburger button (mobile only) ── */
.sb-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--r3);
  transition: background 0.15s;
  flex-shrink: 0;
}
.sb-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ══════════════════════════════════════
   TABLET — 768px
══════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar becomes off-canvas overlay */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition:
      transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
      width 0.25s;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    width: 240px !important;
    min-width: 240px !important;
  }
  .sidebar.mob-open {
    transform: translateX(0);
  }
  /* When sidebar is open, show overlay */
  .sidebar.mob-open ~ .main-column > .main-column::before {
    display: block;
  }

  /* Main column takes full width */
  .main-column {
    width: 100%;
  }

  /* Show hamburger */
  .sb-hamburger {
    display: flex;
    align-items: center;
  }

  /* Two-col stacks */
  .two-col {
    grid-template-columns: 1fr;
  }

  /* Grids: 2 cols max */
  .g4,
  .g5,
  .g6 {
    grid-template-columns: 1fr 1fr;
  }
  .g3 {
    grid-template-columns: 1fr 1fr;
  }

  /* Modal: full-width */
  .modal {
    width: 97vw;
  }

  /* Topbar title */
  .main-topbar-title {
    font-size: 12px;
  }
  .main-topbar {
    padding: 0 12px;
    gap: 7px;
  }
}

/* ══════════════════════════════════════
   PHONE — 480px
══════════════════════════════════════ */
@media (max-width: 480px) {
  /* Tbar: 2 cols, scroll horizontally */
  .tbar-wrap {
    padding: 8px 10px;
  }
  .tbar {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: 6px;
  }
  .tc {
    padding: 8px 10px;
  }
  .tc-h {
    font-size: 18px;
  }
  .tc-c {
    font-size: 11px;
  }

  /* Main padding tighter */
  .main {
    padding: 10px;
  }

  /* Cards */
  .card {
    padding: 12px;
    margin-bottom: 10px;
  }

  /* All grids to 1 col */
  .g2,
  .g3,
  .g4,
  .g5,
  .g6 {
    grid-template-columns: 1fr;
  }

  /* Two-col sidebar layout in form cards */
  .two-col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Tables: allow horizontal scroll */
  .t-wrap {
    -webkit-overflow-scrolling: touch;
  }

  /* Buttons */
  .btn {
    padding: 8px 14px;
    font-size: 11px;
  }
  .btn-row {
    gap: 7px;
  }

  /* Modal: nearly fullscreen */
  .modal {
    width: 100vw;
    max-height: 96vh;
    max-height: 96dvh;
    border-radius: var(--r) var(--r) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    margin: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  #modal-body {
    padding: 14px 16px;
  }
  #modal-btn-row {
    padding: 10px 16px 16px;
  }

  /* Topbar compact */
  .main-topbar {
    padding: 0 10px;
    height: 46px;
    gap: 5px;
  }
  .main-topbar-sep {
    display: none;
  }
  .main-topbar-title {
    font-size: 11.5px;
  }
  .main-topbar-r {
    gap: 5px;
  }

  /* Hide less-critical topbar buttons on phone */
  #btn-print,
  #lang-btn {
    display: none;
  }

  /* Notifications badge smaller */
  .notif-count {
    font-size: 8px;
    padding: 0 4px;
  }

  /* chk-cards grid: 1 col on phone */
  #chk-cards {
    grid-template-columns: 1fr !important;
  }

  /* Toasts: full width bottom */
  .toast-container {
    bottom: 12px;
    right: 10px;
    left: 10px;
    align-items: stretch;
  }
  .toast {
    min-width: unset;
    max-width: 100%;
  }

  /* seq-alert */
  .seq-alert {
    padding: 12px 14px;
  }
  .seq-chips {
    gap: 5px;
  }
}

/* ══════════════════════════════════════
   VERY SMALL — 360px (basic Androids)
══════════════════════════════════════ */
@media (max-width: 360px) {
  .tc-h {
    font-size: 15px;
  }
  .tc-c {
    font-size: 10px;
  }
  .main-topbar-title {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════
   HOME TWO-COLUMN LAYOUT  (pg-hist)
═══════════════════════════════════════════════════════ */
.hist-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  min-height: min-content;
}
.hist-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.hist-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: visible;
  overflow-x: hidden;
  padding-right: 2px;
}
/* When a non-"Flight Logs" history tab is active, the remaining panel spans full width */
.hist-layout.single-col {
  grid-template-columns: 1fr;
}
/* History main tab bar (reuses .oil-stab styling) */
.hist-tabbar {
  margin-bottom: 14px;
}

/* ── Today summary card ── */
.today-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 14px 10px;
}
.today-stat {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 10px 12px;
  text-align: center;
}
.today-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.today-lbl {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t3);
  letter-spacing: 1px;
  margin-top: 4px;
  text-transform: uppercase;
}

/* ── Sparkline ── */
.spark-section {
  padding: 0 14px 14px;
}
.spark-section-lbl {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 48px;
}
.spark-bar {
  flex: 1;
  background: var(--col-af-d);
  border: 1px solid rgba(46, 204, 113, 0.18);
  border-radius: var(--r3) var(--r3) 0 0;
  transition: background 0.2s;
  cursor: default;
  min-height: 6px;
}
.spark-bar:hover {
  background: rgba(46, 204, 113, 0.28);
}
.spark-bar.today-bar {
  background: rgba(46, 204, 113, 0.35);
  border-color: rgba(46, 204, 113, 0.55);
}
.spark-day-labels {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}
.spark-day-lbl {
  flex: 1;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--t3);
  text-align: center;
}
.spark-day-lbl.today-lbl-spark {
  color: var(--col-af);
  font-weight: 700;
}

/* ── System status card ── */
.sys-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px 0;
}
.sys-item {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  transition: var(--t-snappy);
  cursor: default;
}
.sys-item:hover {
  transform: translateY(-1px);
  border-color: var(--b2);
}
.sys-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 0 0 var(--r2) var(--r2);
}
.sys-item.s-af::after {
  background: var(--col-af);
}
.sys-item.s-e1::after {
  background: var(--col-e1);
}
.sys-item.s-e2::after {
  background: var(--col-e2);
}
.sys-item.s-apu::after {
  background: var(--col-apu);
}
.sys-lbl {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 5px;
}
.sys-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.sys-val.c-af {
  color: var(--col-af);
}
.sys-val.c-e1 {
  color: var(--col-e1);
}
.sys-val.c-e2 {
  color: var(--col-e2);
}
.sys-val.c-apu {
  color: var(--col-apu);
}
.sys-sub {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--t2);
  margin-top: 3px;
}

/* ── Landing gear sub-row ── */
.gear-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 14px 14px;
}
.gear-item {
  background: var(--s2);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r2);
  padding: 8px 10px;
  text-align: center;
}
.gear-lbl {
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  color: var(--t3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.gear-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.gear-sub {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t3);
  margin-top: 1px;
}

/* ── Active defects card items ── */
.def-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: var(--border-w) solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}
.def-item:last-child {
  border-bottom: none;
}
.def-item:hover {
  background: rgba(255, 255, 255, 0.025);
}
.def-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.def-dot.open {
  background: var(--warn);
  box-shadow: 0 0 6px rgba(255, 71, 87, 0.4);
}
.def-dot.defer {
  background: var(--caution);
  box-shadow: 0 0 6px rgba(255, 159, 67, 0.35);
}
.def-dot.closed {
  background: var(--col-af);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.3);
}
.def-body {
  flex: 1;
  min-width: 0;
}
.def-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}
.def-meta {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--t3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.def-status {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r3);
  white-space: nowrap;
}
.def-status.open {
  background: var(--warn-d);
  color: var(--warn);
  border: 1px solid rgba(255, 71, 87, 0.25);
}
.def-status.defer {
  background: var(--caution-d);
  color: var(--caution);
  border: 1px solid rgba(255, 159, 67, 0.25);
}
.def-status.closed {
  background: var(--col-af-d);
  color: var(--col-af);
  border: 1px solid rgba(46, 204, 113, 0.2);
}
.def-empty {
  text-align: center;
  padding: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
}

/* home card header variant */
.card-hd-home {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 12px 14px;
  border-bottom: var(--border-w) solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-hd-home b {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  font-family: var(--sans);
}
.card-hd-home .chd-meta {
  margin-left: auto;
  font-size: 9px;
}

/* home card wrapper */
.home-card {
  background: var(--s1);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: var(--t-snappy);
  flex-shrink: 0;
}
.home-card:hover {
  border-color: var(--b2);
}

@media (max-width: 1100px) {
  .hist-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .hist-layout {
    grid-template-columns: 1fr;
  }
  .oil-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
