/* Aerosentry Logbook
   Soft, rounded surfaces on warm neutrals. Brand orange is the only accent;
   status colors are semantic (In Build = blue, Operational = green, Crashed = red). */

:root {
  color-scheme: light;
  accent-color: var(--primary);

  --bg: #f2f1ee;
  --panel: #ffffff;
  --panel-2: #f6f5f2;
  --panel-3: #eeede9;
  --border: rgba(28, 25, 23, .07);
  --border-strong: rgba(28, 25, 23, .14);
  --text: #1c1917;
  --text-2: #5f5a55;
  --text-3: #a29d97;

  --primary: #f59e0b;
  --primary-hover: #ea9306;
  --on-primary: #1c1917;
  --primary-soft: rgba(245, 158, 11, .14);
  --accent-text: #b45309;
  --focus: rgba(245, 158, 11, .28);
  --danger: #dc2626;

  --sidebar: #1a1918;
  --sidebar-2: rgba(255, 255, 255, .07);
  --sidebar-text: #bdb8b2;

  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 4px 18px rgba(28, 25, 23, .05);
  --shadow-lg: 0 24px 60px rgba(28, 25, 23, .18);

  --r-xl: 24px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: "Manrope", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --slate-bg: #f1f0ed; --slate-fg: #57534e; --slate-dot: #a8a29e;
  --blue-bg: #eaf1ff; --blue-fg: #1d4ed8; --blue-dot: #4f86f7;
  --violet-bg: #f3f0ff; --violet-fg: #6d28d9; --violet-dot: #8b5cf6;
  --amber-bg: #fff6e5; --amber-fg: #b45309; --amber-dot: #f59e0b;
  --green-bg: #e9f8ef; --green-fg: #15803d; --green-dot: #2fbf68;
  --teal-bg: #e7f8f5; --teal-fg: #0f766e; --teal-dot: #14b8a6;
  --orange-bg: #fff1e6; --orange-fg: #c2410c; --orange-dot: #f97316;
  --red-bg: #fdecec; --red-fg: #b91c1c; --red-dot: #ef5050;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0f; --panel: #1a1a1b; --panel-2: #222224; --panel-3: #2a2a2c;
    --border: rgba(255, 255, 255, .06); --border-strong: rgba(255, 255, 255, .12);
    --text: #f0efed; --text-2: #a8a5a1; --text-3: #6f6c69;
    --accent-text: #fbbf24; --primary-soft: rgba(245, 158, 11, .15);
    --sidebar: #161617; --sidebar-2: rgba(255, 255, 255, .06);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
    --slate-bg: rgba(255, 255, 255, .07); --slate-fg: #d4d2cf;
    --blue-bg: rgba(79, 134, 247, .16); --blue-fg: #9dbcff;
    --violet-bg: rgba(139, 92, 246, .16); --violet-fg: #c4b5fd;
    --amber-bg: rgba(245, 158, 11, .15); --amber-fg: #fcd34d;
    --green-bg: rgba(47, 191, 104, .15); --green-fg: #86e3a9;
    --teal-bg: rgba(20, 184, 166, .15); --teal-fg: #5eead4;
    --orange-bg: rgba(249, 115, 22, .15); --orange-fg: #fdba74;
    --red-bg: rgba(239, 80, 80, .16); --red-fg: #ffa3a3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f; --panel: #1a1a1b; --panel-2: #222224; --panel-3: #2a2a2c;
  --border: rgba(255, 255, 255, .06); --border-strong: rgba(255, 255, 255, .12);
  --text: #f0efed; --text-2: #a8a5a1; --text-3: #6f6c69;
  --accent-text: #fbbf24; --primary-soft: rgba(245, 158, 11, .15);
  --sidebar: #161617; --sidebar-2: rgba(255, 255, 255, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  --slate-bg: rgba(255, 255, 255, .07); --slate-fg: #d4d2cf;
  --blue-bg: rgba(79, 134, 247, .16); --blue-fg: #9dbcff;
  --violet-bg: rgba(139, 92, 246, .16); --violet-fg: #c4b5fd;
  --amber-bg: rgba(245, 158, 11, .15); --amber-fg: #fcd34d;
  --green-bg: rgba(47, 191, 104, .15); --green-fg: #86e3a9;
  --teal-bg: rgba(20, 184, 166, .15); --teal-fg: #5eead4;
  --orange-bg: rgba(249, 115, 22, .15); --orange-fg: #fdba74;
  --red-bg: rgba(239, 80, 80, .16); --red-fg: #ffa3a3;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 500 14px/1.55 var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
::selection { background: rgba(245, 158, 11, .3); }
a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 750; letter-spacing: -.015em; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
svg { flex-shrink: 0; }

/* Soft rounded scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; padding: 14px; gap: 14px; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 22px 14px 14px;
  position: sticky; top: 14px; height: calc(100vh - 28px); border-radius: var(--r-xl);
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 2px 10px 26px; }
.brand svg { color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { font-size: 12.5px; font-weight: 600; color: #8f8a84; letter-spacing: 0; margin-top: 1px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 999px;
  color: var(--sidebar-text); font-weight: 600; transition: background .15s, color .15s;
}
.sidebar nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .7; }
.sidebar nav a:hover { background: var(--sidebar-2); color: #fff; }
.sidebar nav a.active { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar nav a.active svg { color: var(--primary); opacity: 1; }
.new-btn { margin-top: 20px; justify-content: center; }
.sidebar-foot { margin-top: auto; }
.user-chip {
  width: 100%; display: flex; align-items: center; gap: 10px; background: var(--sidebar-2); border: 0;
  color: #eceae7; padding: 8px 14px 8px 8px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; text-align: left;
}
.user-chip:hover { background: rgba(255, 255, 255, .11); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
main { flex: 1; min-width: 0; padding: 10px 22px 60px; }
.loading { color: var(--text-3); padding: 40px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head .sub { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.crumbs { color: var(--text-3); font-size: 13px; margin-bottom: 8px; font-weight: 600; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 0; background: var(--panel); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px rgba(245, 158, 11, .28); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-ghost { box-shadow: none; background: transparent; }
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

input, select, textarea {
  font: inherit; font-weight: 500; color: var(--text); background: var(--panel-2);
  border: 1.5px solid transparent; border-radius: var(--r-md);
  padding: 9px 14px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { background: var(--panel-3); }
input:focus, select:focus, textarea:focus { background: var(--panel); border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a29d97' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
.actions select { height: 40px; border-radius: 999px; background-color: var(--panel); box-shadow: var(--shadow); font-weight: 700; }
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.req { color: var(--danger); }

/* Rounded custom checkboxes */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; padding: 0; flex-shrink: 0;
  border-radius: 7px; border: 2px solid var(--border-strong); background: var(--panel); cursor: pointer;
  display: inline-grid; place-items: center; transition: background .15s, border-color .15s;
}
input[type="checkbox"]:hover { border-color: var(--primary); background: var(--panel); }
input[type="checkbox"]:checked {
  background: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%231c1917' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  background-size: 15px; background-position: center; background-repeat: no-repeat;
}
input[type="checkbox"]:focus { box-shadow: 0 0 0 4px var(--focus); }

/* ---------- Cards ---------- */
.card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 6px; gap: 10px; }
.card-head h3 { font-size: 16px; font-weight: 750; }
.card-body { padding: 16px 24px 22px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.c-slate { background: var(--slate-bg); color: var(--slate-fg); }
.c-blue { background: var(--blue-bg); color: var(--blue-fg); }
.c-violet { background: var(--violet-bg); color: var(--violet-fg); }
.c-amber { background: var(--amber-bg); color: var(--amber-fg); }
.c-green { background: var(--green-bg); color: var(--green-fg); }
.c-teal { background: var(--teal-bg); color: var(--teal-fg); }
.c-orange { background: var(--orange-bg); color: var(--orange-fg); }
.c-red { background: var(--red-bg); color: var(--red-fg); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text-2); }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 22px 24px; display: flex; flex-direction: column; position: relative; }
.kpi .kpi-icon { position: absolute; top: 20px; right: 20px; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.kpi .kpi-icon svg { width: 21px; height: 21px; fill: currentColor; }
.kpi .label { color: var(--text-2); font-size: 14px; font-weight: 700; }
.kpi .value { font-size: 40px; font-weight: 800; margin-top: 14px; letter-spacing: -.03em; line-height: 1; }
.kpi .hint { font-size: 13px; color: var(--text-3); margin-top: 8px; font-weight: 600; }
.k-total .kpi-icon { background: var(--primary-soft); color: var(--accent-text); }
.k-blue .kpi-icon { background: var(--blue-bg); color: var(--blue-fg); }
.k-green .kpi-icon { background: var(--green-bg); color: var(--green-fg); }
.k-red .kpi-icon { background: var(--red-bg); color: var(--red-fg); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.stack { display: flex; height: 14px; gap: 6px; margin-top: 4px; }
.stack > div { height: 100%; border-radius: 999px; min-width: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.legend a { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 13.5px; font-weight: 600; padding: 8px 16px 8px 12px; border-radius: 999px; background: var(--panel-2); }
.legend a:hover { background: var(--panel-3); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend .n { margin-left: 6px; font-weight: 800; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; margin: 0 8px; border-radius: var(--r-md); color: var(--text); }
.list-row:last-child { margin-bottom: 10px; }
a.list-row:hover { background: var(--panel-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row b { font-weight: 750; }
.empty { padding: 32px 20px; text-align: center; color: var(--text-3); font-weight: 600; }

/* ---------- Fleet table ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 400px; }
.search input { padding-left: 42px; height: 42px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: var(--text-3); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; background: var(--panel); padding: 4px; border-radius: 999px; box-shadow: var(--shadow); }
.chip { border: 0; background: transparent; color: var(--text-2); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s; }
.chip:hover { background: var(--panel-2); }
.chip.on { background: var(--text); color: var(--panel); }
.chip .n { opacity: .55; margin-left: 5px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: var(--r-lg); padding: 6px; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.grid th, table.grid td { padding: 13px 16px; text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.grid th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-size: 12.5px; font-weight: 700; color: var(--text-3); cursor: pointer; user-select: none; padding-top: 12px; padding-bottom: 12px; }
table.grid th:hover { color: var(--text); }
table.grid th .arrow { margin-left: 4px; font-size: 10px; }
table.grid td { background: var(--panel); border-top: 1px solid var(--border); }
table.grid tbody tr:hover td { background: var(--panel-2); }
table.grid tbody tr:hover td:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
table.grid tbody tr:hover td:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
table.grid .sticky { position: sticky; left: 0; z-index: 1; }
table.grid td.sticky { box-shadow: 8px 0 12px -10px rgba(0, 0, 0, .18); }
table.grid th.sticky { z-index: 3; }
table.grid td.sticky { font-weight: 800; color: var(--text); cursor: pointer; }
table.grid td.sticky:hover { color: var(--accent-text); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 10px; z-index: 50; width: 290px; max-height: 440px; overflow: auto;
}
.dropdown-menu label { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); padding: 8px 10px; border-radius: var(--r-sm); margin: 0; cursor: pointer; font-size: 13.5px; }
.dropdown-menu label:hover { background: var(--panel-2); }
.dropdown-menu input[type="checkbox"] { width: 18px; height: 18px; border-radius: 6px; background-size: 13px; }
.dropdown-menu .grp { font-size: 12px; color: var(--text-3); padding: 12px 10px 4px; font-weight: 700; }

/* ---------- Detail ---------- */
.detail-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-title h1 { font-size: 32px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: var(--r-lg); margin-bottom: 20px; font-weight: 700; }
.banner svg { width: 20px; height: 20px; fill: currentColor; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .detail-grid { grid-template-columns: 1fr; } }
.spec-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
dl.specs { margin: 0; display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); row-gap: 2px; }
dl.specs dt, dl.specs dd { padding: 9px 0; margin: 0; }
dl.specs dt { color: var(--text-3); font-size: 13px; font-weight: 600; padding-right: 14px; }
dl.specs dd { font-weight: 700; overflow-wrap: break-word; min-width: 0; display: flex; align-items: center; gap: 6px; }
dl.specs dd > span:first-child { min-width: 0; }
.copy { opacity: 0; border: 0; background: var(--panel-2); cursor: pointer; color: var(--text-3); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; padding: 0; transition: opacity .15s; }
.copy svg { width: 14px; height: 14px; fill: currentColor; }
dd:hover .copy { opacity: 1; }
.copy:hover { color: var(--accent-text); background: var(--primary-soft); }
.notes-box { white-space: pre-wrap; }

/* ---------- Logbook ---------- */
.log-form { display: grid; gap: 10px; }
.log-form .row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.log-divider { height: 1px; background: var(--border); margin: 0 24px; }
.timeline { padding: 10px 0 14px; }
.entry { display: grid; grid-template-columns: 14px 1fr; gap: 14px; padding: 10px 24px; position: relative; }
.entry::before { content: ""; position: absolute; left: 30px; top: 30px; bottom: -12px; width: 2px; border-radius: 2px; background: var(--border); }
.entry:last-child::before { display: none; }
.entry .icon { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; box-shadow: 0 0 0 4px var(--panel); }
.entry .icon.c-slate { background: var(--slate-dot); } .entry .icon.c-blue { background: var(--blue-dot); }
.entry .icon.c-violet { background: var(--violet-dot); } .entry .icon.c-amber { background: var(--amber-dot); }
.entry .icon.c-green { background: var(--green-dot); } .entry .icon.c-teal { background: var(--teal-dot); }
.entry .icon.c-orange { background: var(--orange-dot); } .entry .icon.c-red { background: var(--red-dot); }
.entry .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.entry .meta b { color: var(--text-2); font-weight: 700; }
.entry .title { font-weight: 700; margin-top: 3px; }
.entry .body { white-space: pre-wrap; color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.entry.system .title { font-weight: 600; color: var(--text-2); font-size: 13.5px; }
.entry.system .body { font-size: 13px; color: var(--text-3); }
.entry .del { margin-left: auto; opacity: 0; height: 26px; width: 26px; padding: 0; }
.entry:hover .del { opacity: 1; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; margin: 0; cursor: pointer; }
.switch input { width: 18px; height: 18px; border-radius: 6px; background-size: 13px; }

/* ---------- Form ---------- */
.form-groups { display: grid; gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 20px; }
.fields .wide { grid-column: 1 / -1; }
.form-foot { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 16px 0; background: linear-gradient(transparent, var(--bg) 35%); }

/* ---------- Toast & modal ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; background: #1f1e1d; color: #fff; padding: 12px 20px 12px 14px;
  border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 700; animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); max-width: 460px;
}
.toast::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green-dot); flex-shrink: 0; }
.toast.err::before { background: var(--red-dot); }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 14, 13, .45); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 150; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; padding: 28px; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal p { color: var(--text-2); margin: 0 0 18px; }
.modal .actions { justify-content: flex-end; margin-top: 22px; }

/* ---------- Inline cell editing ---------- */
table.grid td.editable { cursor: text; }
table.grid td.editable:hover { box-shadow: inset 0 0 0 1.5px var(--border-strong); border-radius: var(--r-sm); }
table.grid td.editing { padding: 5px 8px; overflow: visible; box-shadow: none; }
table.grid td.editing input, table.grid td.editing select { height: 36px; padding: 4px 12px; min-width: 160px; font-size: 13.5px; border-radius: var(--r-sm); background-color: var(--panel); border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
table.grid td.editing select { padding-right: 34px; }
table.grid td.saved { animation: saved 1.4s ease-out; }
@keyframes saved { from { background: var(--green-bg); } }

/* ---------- Top bar & theme toggle ---------- */
.topbar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
.theme-toggle { display: inline-flex; background: var(--panel); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.theme-toggle button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .15s; }
.theme-toggle button svg { width: 15px; height: 15px; fill: currentColor; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.on { background: var(--text); color: var(--panel); }

/* ---------- Tabs (segmented) ---------- */
.tabs { display: inline-flex; gap: 4px; background: var(--panel); padding: 5px; border-radius: 999px; box-shadow: var(--shadow); margin: -6px 0 20px; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 9px 18px; color: var(--text-2); font-weight: 700; border-radius: 999px; transition: background .15s; }
.tabs a:hover { color: var(--text); background: var(--panel-2); }
.tabs a.on { color: var(--panel); background: var(--text); }
.tab-badge { font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--panel-3); color: var(--text-2); }
.tabs a.on .tab-badge { background: rgba(255, 255, 255, .18); color: inherit; }
:root[data-theme="dark"] .tabs a.on .tab-badge { background: rgba(0, 0, 0, .12); }
.tab-badge.full, .tabs a.on .tab-badge.full { background: var(--green-dot); color: #fff; }

/* ---------- Pre-flight checklist ---------- */
.cl-summary { padding: 24px; margin-bottom: 16px; }
.cl-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cl-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.cl-top .muted { margin-top: 2px; }
.progress { height: 12px; border-radius: 999px; overflow: hidden; background: var(--panel-2); }
.progress > div { height: 100%; border-radius: 999px; background: var(--primary); transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.progress.full > div { background: var(--green-dot); }
.cl-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 700px) { .cl-sections { grid-template-columns: 1fr; } }
.cl-sections .card { padding-bottom: 10px; }
.cl-sections .card-head { padding-bottom: 10px; }
.cl-num { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 10px; border-radius: 10px; background: var(--primary-soft); color: var(--accent-text); font-size: 13px; font-weight: 800; }
.cl-count { font-size: 12.5px; font-weight: 800; color: var(--text-3); background: var(--panel-2); padding: 3px 10px; border-radius: 999px; }
.cl-count.full { color: var(--green-fg); background: var(--green-bg); }
.cl-item { padding: 11px 14px; margin: 0 10px; border-radius: var(--r-md); transition: background .15s; }
.cl-item:hover { background: var(--panel-2); }
.cl-row { display: flex; align-items: flex-start; gap: 10px; }
.cl-check { flex: 1; display: flex; gap: 12px; align-items: flex-start; margin: 0; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.cl-check input { margin-top: 0; }
.cl-item.done .cl-check span { color: var(--text-3); }
.cl-meta { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 32px; font-size: 12.5px; font-weight: 600; }
.cl-by { color: var(--green-fg); background: var(--green-bg); padding: 2px 10px; border-radius: 999px; }
.cl-note { color: var(--text-2); background: var(--panel-3); padding: 2px 10px; border-radius: 999px; }
.cl-note-btn { flex-shrink: 0; margin-top: 1px; border: 0; background: var(--panel); padding: 3px 10px; border-radius: 999px; font: inherit; font-size: 12px; font-weight: 700; color: var(--text-2); cursor: pointer; opacity: 0; box-shadow: var(--shadow); transition: opacity .15s; }
.cl-item:hover .cl-note-btn, .cl-note-btn:focus { opacity: 1; }
.cl-note-btn:hover { color: var(--accent-text); }

/* Checklist progress in tables / lists */
.mini-progress { display: inline-block; width: 60px; height: 8px; margin-right: 10px; vertical-align: middle; border-radius: 999px; overflow: hidden; background: var(--panel-3); }
.mini-progress > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.mini-progress.full > span { background: var(--green-dot); }
table.grid td.checklist { cursor: pointer; font-weight: 700; }
.dash-cl { font-size: 12.5px; margin-right: 14px; white-space: nowrap; font-weight: 700; }

/* ---------- Touch devices: show controls that otherwise appear on hover ---------- */
.fleet-cards { display: none; }
@media (hover: none) {
  .copy, .cl-note-btn, .entry .del { opacity: 1; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; } /* stops iPhone from zooming into fields */

  .layout { display: block; padding: 0; }
  main { padding: calc(10px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom)); }

  /* Sidebar becomes a floating bottom tab bar */
  .sidebar {
    position: fixed; top: auto; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; height: 66px; padding: 8px 10px; z-index: 100;
    flex-direction: row; align-items: center; gap: 6px; border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  }
  .brand { display: none; }
  .sidebar nav { flex-direction: row; flex: 1; gap: 4px; }
  .sidebar nav a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 4px; font-size: 11.5px; height: 50px; }
  .sidebar nav a svg { width: 21px; height: 21px; }
  .new-btn { margin: 0; width: 50px; height: 50px; padding: 0; font-size: 0; border-radius: 50%; flex-shrink: 0; }
  .new-btn::before { content: "+"; font-size: 28px; font-weight: 600; line-height: 1; }
  .sidebar-foot { margin: 0; flex-shrink: 0; }
  .user-chip { width: 50px; height: 50px; padding: 0; justify-content: center; border-radius: 50%; }
  .user-chip span:last-child { display: none; }
  .avatar { width: 38px; height: 38px; font-size: 13px; }
  .account-menu { left: auto; right: -2px; width: 240px; bottom: calc(100% + 14px); }

  .head-shortcuts, .desktop-only { display: none !important; }

  /* Top bar: compact theme switch */
  .topbar { margin-bottom: 4px; }
  .theme-toggle button { font-size: 0; gap: 0; padding: 8px 11px; }
  .theme-toggle button svg { width: 17px; height: 17px; }

  /* Headers */
  .page-head { margin-bottom: 18px; gap: 12px; align-items: stretch; }
  .page-head h1 { font-size: 25px; }
  .detail-title h1 { font-size: 26px; }
  .page-head .sub { font-size: 14px; }
  .page-head > .actions { width: 100%; }
  .page-head > .actions .btn, .page-head > .actions select { flex: 1; }

  /* Dashboard */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px; }
  .kpi .kpi-icon { top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 11px; }
  .kpi .kpi-icon svg { width: 17px; height: 17px; }
  .kpi .label { font-size: 13px; padding-right: 36px; }
  .kpi .value { font-size: 32px; margin-top: 10px; }
  .kpi .hint { font-size: 12px; }
  .card-head { padding: 18px 18px 4px; }
  .card-body { padding: 14px 18px 18px; }
  .list-row { flex-wrap: wrap; row-gap: 6px; padding: 12px 12px; margin: 0 6px; }
  .list-row .grow { flex-basis: 100%; order: 3; }
  .dash-cl { margin-right: auto; }

  /* Fleet: cards instead of the table */
  .toolbar { gap: 8px; }
  .search { max-width: none; flex-basis: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-width: calc(100% - 120px); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .dropdown { margin-left: auto; }
  .table-wrap { display: none; }
  .fleet-cards { display: grid; gap: 10px; }
  .fleet-card { display: grid; gap: 4px; background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 18px; color: var(--text); }
  .fleet-card:active { transform: scale(.99); }
  .fc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .fc-top b { font-size: 16.5px; font-weight: 800; }
  .fc-sub { color: var(--text-2); font-size: 13.5px; font-weight: 600; }
  .fc-bottom { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin-top: 6px; }

  /* Aircraft page */
  .tabs { display: flex; width: 100%; }
  .tabs a { flex: 1; justify-content: center; padding: 9px 8px; font-size: 13.5px; }
  .detail-grid { grid-template-columns: 1fr; }
  .spec-groups { grid-template-columns: 1fr; }
  .log-form .row { grid-template-columns: 1fr; }
  .banner { padding: 12px 16px; font-size: 14px; }

  /* Checklist */
  .cl-sections { grid-template-columns: 1fr; }
  .cl-summary { padding: 18px; }
  .cl-item { padding: 12px 10px; margin: 0 6px; }
  .cl-check { font-size: 14.5px; }
  .cl-meta { padding-left: 32px; }

  /* Forms & overlays */
  .fields { grid-template-columns: 1fr; }
  .form-foot { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .form-foot .btn { flex: 1; }
  #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .modal { padding: 22px; }
  .modal .actions .btn { flex: 1; }
  .login-card { padding: 26px; }
}

/* ---------- Login ---------- */
.login-screen { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(245, 158, 11, .14), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 34px; display: grid; gap: 4px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo svg { color: var(--text); }
.login-logo b { display: block; font-size: 17px; font-weight: 800; }
.login-logo span { color: var(--text-3); font-size: 13px; font-weight: 600; }
.login-card h2 { font-size: 24px; }
.login-card p { margin: 4px 0 16px; }
.login-card label { margin-top: 10px; }
.login-card .btn { margin-top: 20px; height: 46px; font-size: 15px; }
.login-error { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--red-bg); color: var(--red-fg); font-weight: 700; font-size: 13px; }

/* ---------- Account menu ---------- */
.sidebar-foot { position: relative; }
.account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--panel); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 8px; display: grid; gap: 2px; z-index: 60; }
.account-menu .am-head { padding: 10px 12px 12px; display: grid; }
.account-menu .am-head span { color: var(--text-3); font-size: 12.5px; font-weight: 600; word-break: break-all; }
.account-menu button { border: 0; background: none; text-align: left; font: inherit; font-weight: 700; color: var(--text); padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; }
.account-menu button:hover { background: var(--panel-2); }
.account-menu button.danger { color: var(--danger); }

/* ---------- Install-as-app tip (iPhone) ---------- */
.install-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px; }
.install-card img { width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; }
.install-card .grow { flex: 1; min-width: 0; }
.install-card .muted { font-size: 13.5px; font-weight: 600; }
.install-card svg { width: 15px; height: 15px; fill: currentColor; vertical-align: -2px; }
.install-x { border: 0; background: var(--panel-2); color: var(--text-3); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; flex-shrink: 0; font: inherit; }

/* Installed app (iPhone): solid strip behind the status bar so content doesn't scroll under the clock */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--bg); z-index: 90; }

/* ---------- Field days ---------- */
.fd-h2 { font-size: 15px; font-weight: 800; color: var(--text-2); margin: 22px 4px 10px; }
.fd-h2:first-of-type { margin-top: 0; }
.fd-list { display: grid; gap: 12px; }
.fd-card, .fd-next { display: flex; align-items: center; gap: 18px; padding: 16px 20px; color: var(--text); transition: transform .1s; }
.fd-card:hover, .fd-next:hover { background: var(--panel-2); }
.fd-next { margin-bottom: 16px; background: linear-gradient(120deg, var(--primary-soft), transparent 65%), var(--panel); }
.fd-date { width: 62px; flex-shrink: 0; display: grid; justify-items: center; padding: 8px 0; border-radius: 16px; background: var(--panel-2); line-height: 1.1; }
.fd-date span { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.fd-date b { font-size: 24px; font-weight: 800; }
.fd-date.today { background: var(--primary); } .fd-date.today span, .fd-date.today b { color: var(--on-primary); }
.fd-date.upcoming { background: var(--blue-bg); } .fd-date.upcoming b { color: var(--blue-fg); }
.fd-card .grow, .fd-next .grow { flex: 1; min-width: 0; }
.fd-kicker { font-size: 12.5px; font-weight: 800; color: var(--accent-text); }
.fd-title { font-size: 16.5px; font-weight: 800; }
.fd-card .muted, .fd-next .muted { font-size: 13.5px; font-weight: 600; }
.fd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fd-side { display: grid; justify-items: end; gap: 1px; text-align: right; flex-shrink: 0; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.fd-side b { font-size: 22px; color: var(--text); line-height: 1.1; }
.fd-empty { text-align: center; padding: 44px 24px; display: grid; justify-items: center; gap: 6px; }
.fd-empty-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--accent-text); margin-bottom: 8px; }
.fd-empty-icon svg { width: 28px; height: 28px; fill: currentColor; }
.fd-empty p { max-width: 520px; margin: 4px 0 14px; }

.loc-row { display: flex; gap: 8px; }
.loc-row input { flex: 1; }
.loc-row .btn svg { width: 16px; height: 16px; fill: currentColor; }
.loc-results { display: grid; gap: 4px; margin-top: 8px; }
.loc-results:empty { display: none; }
.loc-opt { text-align: left; border: 0; background: var(--panel-2); border-radius: var(--r-sm); padding: 10px 14px; font: inherit; cursor: pointer; color: var(--text); }
.loc-opt:hover { background: var(--primary-soft); }
.loc-state { margin-top: 8px; font-size: 13px; font-weight: 600; }
.loc-ok { color: var(--green-fg); }
.ac-pick { padding: 8px 10px 14px; display: grid; gap: 2px; }
.ac-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); margin: 0; cursor: pointer; color: var(--text); font-size: 14px; }
.ac-opt:hover { background: var(--panel-2); }
.ac-opt .grow { flex: 1; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ac-opt .muted { font-size: 13px; font-weight: 600; }
.ac-cl { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.crew-row { display: grid; grid-template-columns: 1fr 180px 36px; gap: 8px; margin-bottom: 8px; }

.fd-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.fd-col { display: grid; gap: 16px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.fd-col > .card { min-width: 0; }
@media (max-width: 1100px) { .fd-grid { grid-template-columns: 1fr; } }

.wx-best { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.wx-best b { font-size: 15px; font-weight: 800; }
.wx-best.good { background: var(--green-bg); color: var(--green-fg); }
.wx-best.bad { background: var(--red-bg); color: var(--red-fg); }
.wx-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(46px, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.wx-h { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 12px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.wx-h b { font-size: 16px; color: var(--text); }
.wx-h .wx-g { color: var(--text-3); }
.wx-h .wx-t { font-size: 11.5px; }
.wx-h .wx-p, .wx-h .wx-temp { font-size: 11.5px; font-weight: 600; }
.wx-dir { display: grid; width: 18px; height: 18px; } .wx-dir svg { width: 18px; height: 18px; fill: currentColor; }
.wx-h.good { background: var(--green-bg); } .wx-h.marginal { background: var(--amber-bg); }
.wx-h.bad { background: var(--red-bg); } .wx-h.night { background: var(--panel-2); opacity: .6; }
.wx-h.now { box-shadow: inset 0 0 0 2px var(--text); }
.wx-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.wx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.wx-legend i.good { background: var(--green-dot); } .wx-legend i.marginal { background: var(--amber-dot); }
.wx-legend i.bad { background: var(--red-dot); } .wx-legend i.night { background: var(--border-strong); }

.fl-start { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fl-start input[name=objective] { grid-column: 1 / -1; }
.fl-start-btns { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.fl-start-btns .btn-primary { flex: 1; height: 48px; font-size: 15px; }
.fl-start-btns svg { width: 18px; height: 18px; fill: currentColor; transform: rotate(45deg); }
.fl-list { padding: 0 8px 10px; }
.fl-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--r-md); }
.fl-row:hover { background: var(--panel-2); }
.fl-row.airborne { background: var(--amber-bg); }
.fl-no { width: 34px; height: 34px; border-radius: 11px; background: var(--panel-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.fl-row.airborne .fl-no { background: var(--primary); color: var(--on-primary); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, .2); } }
.fl-row .grow { flex: 1; min-width: 0; }
.fl-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.fl-top .muted { font-size: 13px; font-weight: 600; }
.fl-obj { font-size: 13.5px; font-weight: 600; margin-top: 1px; }
.fl-meta { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-top: 2px; }
.fl-meta [data-live] { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 800; }
.fl-notes { color: var(--text-2); }
.fl-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.fl-edit { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; }
.fl-del { width: 30px; padding: 0; opacity: .6; }
.fl-modal { display: grid; gap: 12px; max-width: 480px; }
.fl-modal h3 { margin-bottom: 0; }
.fl-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.result-opt { margin: 0; cursor: pointer; border-radius: 999px; }
.result-opt input { position: absolute; opacity: 0; pointer-events: none; }
.result-opt span { display: inline-block; padding: 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; border: 2px solid transparent; }
.result-opt input:checked + span { border-color: currentColor; }
.result-opt input:focus-visible + span { box-shadow: 0 0 0 4px var(--focus); }

.ready-list { padding: 4px 8px 10px; }
.ready-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); color: var(--text); }
.ready-row:hover { background: var(--panel-2); }
.ready-row .grow { flex: 1; min-width: 0; }
.ready-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ready-why { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-top: 3px; }
.sum-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sum-kpis div { background: var(--panel-2); border-radius: var(--r-md); padding: 10px 12px; display: grid; }
.sum-kpis b { font-size: 19px; font-weight: 800; }
.sum-kpis span { font-size: 12px; font-weight: 600; color: var(--text-3); }
.sum-results { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sum-table div { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 7px 2px; font-size: 13.5px; border-top: 1px solid var(--border); }
.sum-table span { color: var(--text-2); font-weight: 600; text-align: right; }
.obj-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-weight: 600; }
.crew-grid { display: grid; gap: 12px; }
.crew-item { display: flex; align-items: center; gap: 12px; }
.crew-item .avatar { width: 36px; height: 36px; }
.crew-item .muted { font-size: 12.5px; font-weight: 600; }

@media (max-width: 760px) {
  .fd-card, .fd-next { gap: 14px; padding: 14px 16px; align-items: flex-start; }
  .fd-date { width: 54px; }
  .fd-side b { font-size: 18px; }
  .crew-row { grid-template-columns: 1fr 130px 36px; }
  .loc-row { flex-wrap: wrap; } .loc-row input { flex-basis: 100%; } .loc-row .btn { flex: 1; }
  .fl-start { grid-template-columns: 1fr; }
  .fl-row { padding: 12px 8px; gap: 10px; align-items: flex-start; }
  .ac-cl { display: none; }
}

/* ---------- Print (field day report) ---------- */
@media print {
  :root { --bg: #fff; --panel: #fff; --panel-2: #f5f5f4; --shadow: none; }
  body { background: #fff; }
  .sidebar, .topbar, .page-head .actions, .fl-start, .fl-actions, #toasts, .crumbs, .install-card { display: none !important; }
  .layout { display: block; padding: 0; }
  main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #e7e5e4; break-inside: avoid; }
  .fd-grid { grid-template-columns: 1fr 1fr; }
  textarea { border: 0; resize: none; background: none; padding: 0; }
  a { color: inherit; }
}

/* ---------- Software under test ---------- */
.chg-list { padding: 4px 8px 12px; display: grid; gap: 8px; }
.chg { background: var(--panel-2); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 8px; }
.chg-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chg-top b { font-size: 15.5px; font-weight: 800; }
.chg-tools { margin-left: auto; display: flex; gap: 2px; }
.chg-desc { font-weight: 600; }
.chg-exp { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.chg-exp span { display: block; font-size: 12px; color: var(--text-3); font-weight: 700; }
.chg-evidence { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.chg-evidence .muted { font-weight: 600; }
.chg-verdict { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chg-verdict > span { font-size: 12.5px; font-weight: 700; color: var(--text-3); margin-right: 4px; }
.verdict-btn { border: 0; background: var(--panel); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.verdict-btn:hover { color: var(--text); }
.verdict-btn.on { box-shadow: inset 0 0 0 2px currentColor; }
.chg-note { font-size: 13px; color: var(--text-2); font-style: italic; }
.chg-tag { background: var(--primary-soft); color: var(--accent-text); }
.chip-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { margin: 0; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle span { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--panel-2); color: var(--text-3); border: 2px solid transparent; }
.chip-toggle input:checked + span { background: var(--primary-soft); color: var(--accent-text); border-color: var(--primary); }
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 4px var(--focus); }
.fl-testing { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fl-testing > span { font-size: 13px; font-weight: 700; color: var(--text-3); }
.fl-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 600; }
.fl-tags .tag { font-size: 11.5px; }
.sw-list { padding: 4px 8px 12px; display: grid; gap: 8px; }
.sw-ac { padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); display: grid; gap: 8px; }
.sw-ac-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sw-rows { display: grid; gap: 2px; }
.sw-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; font-size: 13px; padding: 3px 0; }
.sw-row > span:first-child { color: var(--text-3); font-weight: 600; }
.sw-row > span:last-child { font-weight: 700; overflow-wrap: anywhere; }
.sw-row.diff > span:last-child { color: var(--text-2); }
.sw-row i { font-style: normal; color: var(--text-3); }
.sw-row b { color: var(--accent-text); }
.sw-by { font-size: 12px; font-weight: 600; color: var(--green-fg); }
.sw-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.nav-short { display: none; }
@media (max-width: 760px) { .nav-long { display: none; } .nav-short { display: inline; } }

/* ---------- Test plan (manager defines, team checks off) ---------- */
.tp-progress { padding: 0 24px; }
.tp-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel-2); gap: 3px; margin: 6px 0 4px; }
.tp-bar > div { height: 100%; border-radius: 999px; }
.tp-bar .w { background: var(--green-dot); } .tp-bar .f { background: var(--red-dot); } .tp-bar .r { background: var(--panel-3); }
.tp-list { padding: 8px 8px 4px; }
.tp-group { font-size: 12.5px; font-weight: 800; color: var(--accent-text); padding: 10px 12px 4px; }
.tp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); }
.tp-item:hover { background: var(--panel-2); }
.tp-item .grow { flex: 1; min-width: 0; }
.tp-text { font-weight: 600; }
.tp-item.worked .tp-text { color: var(--text-2); }
.tp-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-top: 3px; }
.tp-item.worked .tp-meta { color: var(--green-fg); } .tp-item.failed .tp-meta { color: var(--red-fg); }
.tp-note { color: var(--text-2); font-style: italic; }
.tp-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tp-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--panel); color: var(--text-3); display: grid; place-items: center; cursor: pointer; padding: 0; transition: background .15s, border-color .15s, color .15s; }
.tp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.tp-btn.ok:hover { border-color: var(--green-dot); color: var(--green-fg); }
.tp-btn.no:hover { border-color: var(--red-dot); color: var(--red-fg); }
.tp-btn.ok.on { background: var(--green-dot); border-color: var(--green-dot); color: #fff; }
.tp-btn.no.on { background: var(--red-dot); border-color: var(--red-dot); color: #fff; }
.tp-more { border: 0; background: none; color: var(--text-3); font-size: 18px; width: 28px; height: 40px; cursor: pointer; border-radius: 10px; }
.tp-more:hover { background: var(--panel-3); color: var(--text); }
.tp-add { display: flex; gap: 8px; align-items: flex-start; padding: 6px 20px 20px; flex-wrap: wrap; }
.tp-add textarea { flex: 1 1 260px; min-height: 0; resize: none; }
.tp-add select { flex: 0 1 200px; width: auto; }
.tp-add .btn { height: 42px; }
.tp-tag { background: var(--green-bg); color: var(--green-fg); }
@media (max-width: 760px) {
  .tp-progress { padding: 0 18px; }
  .tp-item { padding: 10px 8px; align-items: flex-start; }
  .tp-add { padding: 6px 14px 16px; }
  .tp-add select, .tp-add .btn { flex: 1; }
}
.tp-del { font-size: 14px; opacity: 0; }
.tp-item:hover .tp-del { opacity: 1; }
@media (hover: none) { .tp-del { opacity: .6; } }

/* ---------- Field use: connection state, photos, phone ergonomics ---------- */
#busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 400; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, transparent, var(--primary), transparent) no-repeat; background-size: 40% 100%; animation: busy 1s linear infinite; }
body.busy #busy { opacity: 1; }
@keyframes busy { from { background-position: -40% 0; } to { background-position: 140% 0; } }
#netBanner { display: none; position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 350;
  align-items: center; gap: 8px; background: var(--red-dot); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-lg); white-space: nowrap; }
#netBanner::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
body.offline #netBanner { display: inline-flex; }
@keyframes pulse { 50% { opacity: .3; } }

.log-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.log-foot .grow { flex: 1; }
.photo-btn { margin: 0; cursor: pointer; }
.photo-btn svg { width: 17px; height: 17px; fill: currentColor; }
.log-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.log-photos:empty { display: none; }
.log-photos .ph { position: relative; width: 76px; height: 76px; }
.log-photos .ph img, .entry-photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }
.log-photos .ph button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text); color: var(--panel); font-size: 12px; cursor: pointer; padding: 0; }
.entry-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.entry-photos .ph { width: 92px; height: 92px; padding: 0; border: 0; background: none; cursor: zoom-in; }
.lightbox { place-items: center; background: rgba(0, 0, 0, .88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.lb-x { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 18px; cursor: pointer; }

.modal-bg { overflow-y: auto; }
.fd-grid.today #flightsCard { order: -1; }

@media (max-width: 760px) {
  .detail-grid > .log-card { order: -1; }   /* writing a log entry is the main job on a phone */
  .modal-bg:not(.lightbox) { place-items: start center; padding: calc(14px + env(safe-area-inset-top)) 12px 24px; }
  .cl-check input[type=checkbox] { width: 24px; height: 24px; flex-shrink: 0; }
  .cl-check { min-height: 30px; align-items: center; }
  .log-foot .grow { display: none; }
  .log-foot .btn-primary { margin-left: auto; height: 42px; padding: 0 22px; }
  .photo-btn { height: 42px; }
  .btn-sm { min-height: 38px; }
}
.login-card .btn-ghost { margin-top: 2px; }
.login-help { margin: 6px 0 0; text-align: center; font-size: 12.5px; }
