[hidden] { display: none !important; }
:root {
  --ink: #15202E;
  --ink-2: #4A5667;
  --paper: #FFFFFF;
  --panel: #F1F3F6;
  --line: #CBD2DC;
  --navy: #16324F;
  --blue: #1F5A96;
  --warn-ink: #7A4A00;
  --warn-bg: #FFF1D6;
  --ok-ink: #17593A;
  --ok-bg: #E2F2E8;
  --danger: #A12B2B;
  --r: 6px;
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px 64px; }
h1 { font-size: 1.6rem; margin: 8px 0 4px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; font-weight: 700; }
h3 { font-size: 1rem; margin: 22px 0 8px; }
a { color: var(--blue); }
.dim { color: var(--ink-2); font-weight: 400; }
.hint { color: var(--ink-2); font-size: 0.92rem; margin: 4px 0 12px; }
:focus-visible { outline: 3px solid #F2B84B; outline-offset: 2px; }

/* top bar */
.bar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; flex-wrap: wrap; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.bar a, .bar .linkish { color: #fff; text-decoration: none; font-weight: 500; }
.brand { font-weight: 700 !important; font-size: 1.05rem; }
.bar nav { display: flex; gap: 18px; align-items: center; }
.bar nav form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* buttons & inputs */
button, .button { font: inherit; font-weight: 600; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: var(--r); padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.danger { border-color: var(--danger); color: var(--danger); background: var(--paper); margin-top: 24px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--r); padding: 9px 10px; min-height: 44px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }
label > input, label > select, label > textarea { font-weight: 400; color: var(--ink); }
label.inline { flex-direction: row; align-items: center; gap: 6px; width: auto; }
label.inline input { width: auto; min-height: 0; }
fieldset { border: 0; border-top: 2px solid var(--ink); margin: 22px 0 0; padding: 12px 0 0; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0 8px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn button { padding: 8px 10px; flex: none; }

/* flash / warnings */
.flash { background: var(--ok-bg); color: var(--ok-ink); padding: 10px 14px; border-radius: var(--r); font-weight: 600; }
.warnings { background: var(--warn-bg); color: var(--warn-ink); border-left: 5px solid #D08A12; margin: 12px 0;
  padding: 10px 14px 10px 32px; border-radius: 0 var(--r) var(--r) 0; }
.warnings li { margin: 2px 0; }
.note { background: var(--panel); padding: 10px 14px; border-radius: var(--r); }
.aptmsg { color: var(--warn-ink); font-weight: 600; min-height: 1em; }

/* layout rows */
.titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.count { background: #D08A12; color: #fff; border-radius: 999px; padding: 0 8px; font-size: 0.8rem; font-weight: 700; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg a { padding: 8px 14px; text-decoration: none; color: var(--ink); font-weight: 600; }
.seg a.on { background: var(--navy); color: #fff; }

/* fleet cards with Hobbs drum */
.fleet { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-top: 8px; }
.ac { border: 1.5px solid var(--line); border-radius: 10px; padding: 16px; }
.ac-head { display: flex; align-items: baseline; gap: 10px; }
.tail { font-size: 1.5rem; font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: 0.02em; }
.drum { display: flex; gap: 3px; margin: 14px 0 10px; }
.drum span { background: var(--navy); color: #fff; font-size: 1.7rem; font-weight: 600; width: 1.35em; text-align: center;
  border-radius: 3px; padding: 4px 0; box-shadow: inset 0 -10px 12px -8px rgba(0,0,0,.45), inset 0 10px 12px -8px rgba(0,0,0,.45); }
.drum span.pt { background: none; color: var(--ink); width: 0.4em; box-shadow: none; }
.drum span:last-child, .drum span:nth-last-child(2) { background: #F7F1E3; color: var(--ink); }
.drum .unset { background: none !important; color: var(--ink-2) !important; box-shadow: none !important; width: auto !important;
  font-size: 1rem !important; }
.mini { display: flex; gap: 22px; margin: 0 0 14px; }
.mini div { display: flex; flex-direction: column; }
.mini dt { font-size: 0.82rem; color: var(--ink-2); }
.mini dd { margin: 0; font-size: 1.15rem; font-weight: 600; }
.ac-actions { display: flex; gap: 10px; }
.ac-actions .button { flex: 1; justify-content: center; }

/* tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 700; color: var(--ink-2); font-size: 0.85rem; }
td.n, th.n { text-align: right; }
td.big { font-size: 1.1rem; font-weight: 600; }
table.legs tbody tr { cursor: pointer; }
table.legs tbody tr:hover { background: var(--panel); }
tr.is-incomplete td:first-child { box-shadow: inset 4px 0 0 #D08A12; }
.tag { font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.empty { color: var(--ink-2); text-align: center; padding: 20px; }

/* leg form */
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.calc { font-weight: 600; margin: 10px 0 0; min-height: 1.2em; }
.counters { display: grid; gap: 8px; }
.chead, .crow { display: grid; grid-template-columns: minmax(110px, 1.2fr) 1fr 1.2fr 70px; gap: 8px; align-items: center; }
.chead span { font-size: 0.82rem; color: var(--ink-2); font-weight: 700; }
.clabel { font-weight: 600; }
.cdelta { font-weight: 700; text-align: right; }
.cdelta.bad { color: var(--danger); }
details { margin-top: 18px; }
details > summary { font-weight: 700; font-size: 1.05rem; cursor: pointer; padding: 10px 0; border-top: 2px solid var(--ink);
  list-style-position: inside; }
details.engines > summary { border-top: 1px dashed var(--line); font-size: 0.98rem; }
details.panel > summary, details.history > summary { border-top: 1px solid var(--line); }
.notes { margin-top: 18px; }
.footer-actions { margin-top: 18px; }
.footer-actions .primary { width: 100%; justify-content: center; }

/* CESCOM */
ol.cescom { list-style: none; padding: 0; margin: 12px 0 20px; counter-reset: c; border-top: 2px solid var(--ink); }
ol.cescom li { counter-increment: c; display: grid; grid-template-columns: 2em 1fr auto; grid-template-rows: auto auto;
  column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
ol.cescom li::before { content: counter(c); grid-row: 1 / 3; color: var(--ink-2); font-weight: 700; }
ol.cescom .cval { font-size: 1.45rem; font-weight: 700; text-align: right; }
ol.cescom .cchg { grid-column: 3; text-align: right; font-weight: 600; color: var(--ok-ink); }
ol.cescom .casof { grid-column: 2; grid-row: 2; font-size: 0.85rem; }

/* reports */
.reportlist { list-style: none; padding: 0; border-top: 2px solid var(--ink); }
.reportlist li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rname { font-weight: 600; font-size: 1.05rem; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0; align-items: center; }
.checks label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); }
.checks input { width: auto; min-height: 0; }
.ctitle { font-weight: 700; font-size: 0.9rem; color: var(--ink-2); width: 5.5em; }
table.colpick input { width: 22px; height: 22px; min-height: 0; }
table.report tr.grp th { background: var(--panel); color: var(--ink); font-size: 0.95rem; }
table.report tr.sub td { font-weight: 700; border-bottom: 2px solid var(--line); }
table.report tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
.builder > label { margin-top: 12px; }

/* admin */
.rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rowform input:not([type=checkbox]), .rowform select { width: auto; flex: 1 1 160px; }
.rowform input.short { flex: 0 0 90px; }
.rowform.add { border-bottom: 0; }
.rowform.inactive { opacity: 0.55; }
.rowform.tight { border: 0; padding: 0; }
table.counteradmin td { white-space: normal; }
ul.plain { padding-left: 18px; }

/* login */
.login { max-width: 420px; margin: 12vh auto 0; }
.login form { display: grid; gap: 14px; margin-top: 16px; }
.devlink { background: var(--warn-bg); padding: 10px; border-radius: var(--r); }

@media (max-width: 560px) {
  .chead { display: none; }
  .crow { grid-template-columns: 1fr 1fr; grid-template-areas: "l d" "s e"; row-gap: 4px; padding: 8px 0;
    border-bottom: 1px solid var(--line); }
  .crow .clabel { grid-area: l; }
  .crow .cdelta { grid-area: d; }
  .crow .cstart { grid-area: s; }
  .crow .with-btn { grid-area: e; }
  .crow .cstart::placeholder { color: var(--ink-2); }
  .bar nav { gap: 14px; font-size: 0.95rem; }
}
@media print {
  .bar, .noprint, .flash { display: none !important; }
  main { max-width: none; padding: 0; }
  body { font-size: 11pt; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
