/* Inter (SIL OFL, fonts/OFL.txt): clear figures, tabular numbers; bundled so it works offline and prints the same */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/Inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/Inter-greek.woff2) format('woff2'); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
:root {
  --ink: #111;
  --muted: #666;
  --line: #1a1a1a;
  --bg: #eef0f3;
  --panel: #fff;
  --accent: #1f5fbf;
  --auto: #17418f;
  --user: #b4231a;
  --warn-bg: #fff4d6;
  --warn-line: #e0b14a;
  --err-bg: #fde4e1;
  --err-line: #d9534f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-feature-settings: 'calt' 1; }

/* ================================================================== app chrome */
html, body { height: 100%; }
body { overflow: hidden; }
[hidden] { display: none !important; }
body.loading > section { visibility: hidden; }
button, .button { font: inherit; font-size: 14px; padding: 7px 14px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .button:hover { background: #eef0f3; }
button.primary { background: var(--accent); color: #fff; font-weight: 500; }
button.primary:hover { background: #194f9f; }
button.ghost { color: var(--accent); }
input, select { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid #d3d7dd; border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid #c6dafc; border-color: var(--accent); }
input.invalid { border-color: var(--err-line); background: var(--err-bg); }
input.empty-req { background: var(--warn-bg); }
kbd { font: 12px/1 inherit; color: #888; }
.spacer { flex: 1; }

/* ---------------- flight header (Docs-like) */
.doc-top { display: flex; align-items: center; gap: 10px; padding: 6px 14px 4px 10px; background: #f9fbfd; border-bottom: 1px solid #e2e5e9; }
.back { display: flex; padding: 4px; border-radius: 50%; }
.back:hover { background: #e8ebef; }
.back img { width: 34px; height: 34px; display: block; }
.doc-head { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; }
.doc-title-row { display: flex; align-items: center; gap: 10px; }
.doc-title { font-size: 18px; border: 1px solid transparent; padding: 1px 6px; margin-left: -2px; min-width: 120px; max-width: 46vw; background: transparent; border-radius: 4px; }
.doc-title:hover { border-color: #c9ced6; }
.doc-title:focus { background: #fff; outline: 2px solid #c6dafc; }
.save-state { font-size: 12.5px; color: #6b717a; white-space: nowrap; }
.save-state.offline { color: #a3261d; }
.menubar { display: flex; gap: 0; margin-left: -4px; }
.menu-wrap { position: relative; }
.menu-btn { font-size: 14px; padding: 2px 8px; border-radius: 4px; }
.menu-btn.open { background: #e3e8ef; }
.menu { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 230px; padding: 6px 0; background: #fff; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(60,64,67,.15), 0 1px 2px rgba(60,64,67,.3); display: flex; flex-direction: column; }
.menu > button, .menu > a, .menu > label { display: flex; justify-content: space-between; gap: 20px; width: 100%; border-radius: 0; padding: 7px 18px; font-size: 14px; color: var(--ink); text-decoration: none; cursor: pointer; border: 0; }
.menu > button:hover, .menu > a:hover, .menu > label:hover { background: #f1f3f4; }
.menu > button:disabled { color: #aaa; cursor: default; background: none; }
.menu hr { border: 0; border-top: 1px solid #e3e5e8; margin: 6px 0; }
.doc-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.doc-tools input, .doc-tools select { height: 32px; font-size: 13.5px; }
#date { width: 104px; }
#block-start { width: 74px; }
#aircraft-other { width: 82px; text-transform: uppercase; }
.chips { display: inline-flex; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: #eef0f3; color: #3c4043; white-space: nowrap; cursor: default; }
.chip.ok { background: #e6f4ea; color: #137333; }
.chip.warn { background: #fef7e0; color: #8a5a00; }
.chip.err { background: #fce8e6; color: #a50e0e; }
.pager { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: #555; }
.pager button { padding: 2px 8px; font-size: 16px; }

#stage { --hair: 1px; --thick: 2px; display: flex; justify-content: center; align-items: flex-start; overflow: hidden; background: #eef0f3; }
#sheet > .sheet:not(.active) { display: none; }

/* ---------------- home */
#home { height: 100%; overflow: auto; background: #fff; }
.home-top { display: flex; align-items: center; gap: 24px; padding: 10px 22px; border-bottom: 1px solid #eceef1; position: sticky; top: 0; background: #fff; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; color: #4a4f57; min-width: 180px; }
.brand img { width: 38px; height: 38px; }
#search { flex: 0 1 640px; height: 44px; border-radius: 22px; border: 0; background: #f1f3f4; padding: 0 22px; font-size: 15.5px; }
#search:focus { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); outline: none; }
.starts { background: #f1f3f4; padding: 18px 0 26px; }
.starts-inner, .flights { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.starts h2 { font-size: 15.5px; font-weight: 500; color: #202124; margin: 0 0 14px; }
.tiles { display: flex; gap: 22px; flex-wrap: wrap; }
.tile { flex-direction: column; align-items: flex-start; padding: 0; gap: 10px; background: none; }
.tile:hover { background: none; }
.tile-art { width: 148px; height: 112px; border: 1px solid #dadce0; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--accent); transition: border-color .12s, box-shadow .12s; }
.tile:hover .tile-art { border-color: var(--accent); box-shadow: 0 1px 4px rgba(31,95,191,.25); }
.tile-art svg { width: 56px; height: 56px; }
.tile-label { font-size: 14px; font-weight: 500; color: #202124; }
.flights { padding-top: 18px; padding-bottom: 60px; }
.group-label { font-size: 13px; font-weight: 500; color: #5f6368; margin: 18px 4px 6px; }
.frow { display: grid; grid-template-columns: 64px 1fr 120px 110px 120px 36px; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 22px; cursor: pointer; text-decoration: none; color: inherit; }
.frow:hover { background: #e8f0fe; }
.frow .thumb { width: 64px; height: 44px; border: 1px solid #e0e3e7; border-radius: 4px; background: #fff; display: block; }
.frow > span { min-width: 0; }
.frow .ft { font-size: 14.5px; font-weight: 500; color: #202124; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .sub { font-size: 12.5px; color: #5f6368; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .col { font-size: 13px; color: #5f6368; white-space: nowrap; }
.frow .more { width: 36px; height: 36px; border-radius: 50%; justify-content: center; padding: 0; font-size: 20px; color: #5f6368; }
.frow .more:hover { background: #d2e3fc; }
.row-menu { position: fixed; min-width: 200px; }
.empty { color: #5f6368; text-align: center; margin-top: 40px; }

/* ---------------- account */
.account { position: relative; flex: none; }
.avatar { width: 34px; height: 34px; padding: 0; border-radius: 50%; overflow: hidden; justify-content: center; background: #1f5fbf; color: #fff; font-weight: 600; font-size: 15px; }
.avatar:hover { background: #1f5fbf; box-shadow: 0 0 0 4px #e3e8ef; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-menu { left: auto; right: 0; top: calc(100% + 8px); min-width: 240px; }
.account-menu .who { display: flex; flex-direction: column; padding: 8px 18px 6px; font-size: 14px; }
.account-menu .who span { color: #5f6368; font-size: 13px; }

/* ---------------- calendar (date fields) */
.cal { position: fixed; z-index: 40; width: 264px; padding: 10px; background: #fff; border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.12); user-select: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.cal-nav { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 11px; color: #70757a; padding: 4px 0; }
.cal-grid button { height: 32px; padding: 0; justify-content: center; border-radius: 50%; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-grid button.out { color: #b0b4b9; }
.cal-grid button.today { color: var(--accent); font-weight: 600; }
.cal-grid button.sel { background: var(--accent); color: #fff; }
.cal-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.cal-foot button { font-size: 13px; color: var(--accent); padding: 4px 10px; }

/* ---------------- dialogs, toast, sign-in */
dialog { border: 0; border-radius: 12px; padding: 22px 24px 16px; width: min(560px, 94vw); box-shadow: 0 8px 40px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(32,33,36,.45); }
dialog h2 { font-size: 20px; font-weight: 400; margin: 0 0 16px; }
#route-dialog input, #rename-dialog input { width: 100%; height: 42px; font-size: 15px; }
.dialog-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.route-hint { min-height: 18px; margin: 8px 2px 0; font-size: 13px; color: #5f6368; }
.route-hint.err { color: #a50e0e; }
.dialog-foot .primary { order: 3; }
.dialog-foot .ghost { order: 2; }
.dialog-foot .link { color: var(--accent); text-decoration: none; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid2 label { display: flex; flex-direction: column; font-size: 12.5px; color: #3c4043; gap: 4px; }
.grid2 .pair { display: flex; gap: 6px; }
.grid2 .pair input { flex: 1; min-width: 0; }
.grid2 small { color: var(--muted); font-size: 11.5px; }
.about { margin-top: 14px; font-size: 12.5px; color: #5f6368; }
.about summary { cursor: pointer; }
.toast { position: fixed; left: 24px; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 18px; background: #323232; color: #fff; padding: 12px 10px 12px 18px; border-radius: 6px; box-shadow: 0 3px 10px rgba(0,0,0,.3); font-size: 14px; }
.toast-action { color: #8ab4f8; font-weight: 500; }
.toast-action:hover { background: rgba(255,255,255,.08); }
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #f1f3f4; z-index: 60; }
.login-card { background: #fff; border-radius: 12px; padding: 34px 36px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 14px; align-items: stretch; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.login-card img { width: 48px; align-self: center; }
.login-card h1 { font-size: 22px; font-weight: 400; text-align: center; margin: 0 0 6px; }
.google-button { display: flex; justify-content: center; min-height: 44px; }
.login-error { color: #a50e0e; margin: 0; font-size: 13px; }

/* ------------------------------------------------------------------ sheet
   Geometry in "u" taken from the scanned MD4.2 form (1145 u wide, ~850 u tall). */
.sheet {
  --u: var(--fit, 0.95px);
  position: relative;
  width: calc(1145 * var(--u));
  background: #fff;
  color: #000;
  padding-top: calc(30 * var(--u));
  font-family: Inter, Helvetica, Arial, sans-serif;
  font-feature-settings: 'tnum' 1, 'calt' 1;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);

}
/* fold line: one dashed overlay (Chrome print drops borders next to dashed cell borders) */
.sheet .fold-line { position: absolute; top: calc(30 * var(--u)); bottom: 0; left: calc(570.6 * var(--u)); width: 0; border-left: var(--hair) dashed var(--line); pointer-events: none; z-index: 2; }
.sheet .date-top { position: absolute; right: 0; top: calc(3 * var(--u)); font-size: calc(15 * var(--u)); font-weight: 600; display: flex; align-items: center; gap: calc(6 * var(--u)); }
.sheet .pgno { display: inline-flex; align-items: center; justify-content: center; width: calc(21 * var(--u)); height: calc(21 * var(--u)); border: calc(1.4 * var(--u)) solid #000; border-radius: 50%; font-size: calc(12 * var(--u)); font-weight: 700; line-height: 1; flex: none; }
.sheet .date-top input { font-size: calc(15 * var(--u)); text-align: right; width: calc(200 * var(--u)); font-weight: 600; }

.g { display: grid; border: var(--thick) solid var(--line); border-bottom: none; }
.g > div { border-right: var(--hair) solid var(--line); border-bottom: var(--hair) solid var(--line); position: relative; min-width: 0; overflow: hidden; }

/* header block */
.hdr { grid-template-columns: calc(570 * var(--u)) calc(70 * var(--u)) calc(56 * var(--u)) calc(74 * var(--u)) calc(73 * var(--u)) calc(77 * var(--u)) calc(70 * var(--u)) calc(80 * var(--u)) 1fr;
       grid-template-rows: calc(24 * var(--u)) calc(26 * var(--u)) calc(25 * var(--u)); }
.hdr .title { grid-row: 1 / 4; display: flex; align-items: flex-start; justify-content: center; font-weight: 800; font-size: calc(40 * var(--u)); padding-top: calc(2 * var(--u)); border-right-color: transparent !important; }
.hdr .lbl { font-size: calc(8.8 * var(--u)); font-weight: 600; letter-spacing: .02em; padding: calc(5.5 * var(--u)) calc(3 * var(--u)) 0; white-space: nowrap; }
.hdr .lbl.big { font-size: calc(19 * var(--u)); font-weight: 800; padding-top: calc(2 * var(--u)); line-height: 1; }
.hdr .est { font-size: calc(10.5 * var(--u)); text-align: right; padding: calc(6 * var(--u)) calc(8 * var(--u)) 0; grid-column: span 2; }
.hdr .val input { font-size: calc(13 * var(--u)); font-weight: 700; }

/* main table */
.tbl { grid-template-columns:
  calc(62*var(--u)) calc(61*var(--u)) calc(67*var(--u)) calc(66*var(--u)) calc(65*var(--u)) calc(61*var(--u)) calc(61*var(--u)) calc(63*var(--u)) calc(64*var(--u))
  calc(126*var(--u)) calc(49*var(--u)) calc(49*var(--u)) calc(49*var(--u)) calc(49*var(--u)) calc(48*var(--u)) calc(50*var(--u)) calc(48*var(--u)) calc(49*var(--u)) 1fr;
  border-top: none; }
.tbl .h { font-size: calc(7.9 * var(--u)); font-weight: 600; letter-spacing: .02em; line-height: 1.12; padding: calc(2.5 * var(--u)) calc(2.5 * var(--u)); text-transform: uppercase; }
.tbl .h.c { text-align: center; }
.tbl .h.big { font-size: calc(13.5 * var(--u)); line-height: 1; text-transform: none; font-weight: 500; letter-spacing: 0; padding: 0 calc(3 * var(--u)); display: flex; align-items: center; white-space: nowrap; }
.tbl .fold { border-right-color: transparent !important; }
.tbl .noline { border-bottom-color: transparent; }
.tbl .dep { font-size: calc(10.5 * var(--u)); }
.tbl .dep input { font-size: calc(12 * var(--u)); font-weight: 700; text-align: left; padding-left: calc(4*var(--u)); }
.tbl .tot-label { font-size: calc(9.5 * var(--u)); font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; padding: 0 calc(4 * var(--u)); }
.tbl .ti-title { font-size: calc(19 * var(--u)); line-height: 1; font-weight: 800; padding: calc(5 * var(--u)) calc(4 * var(--u)) 0; border-bottom-width: var(--thick); }
.tbl .sunset { font-size: calc(11 * var(--u)); font-weight: 700; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.tbl .sunset input { font-size: calc(12 * var(--u)); font-weight: 700; }
.tbl .total-row { border-bottom-width: var(--thick); }

/* checkpoint hexagon */
.tbl .cp, .tbl .cp-end { border-bottom-color: transparent; }        /* the checkpoint column has no rules between legs */
.tbl .cp-end.total-row { border-bottom-color: var(--line); }
.cp { overflow: visible !important; z-index: 3; pointer-events: none; }
.cp svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tbl .cpn { z-index: 2; overflow: visible; border: 0 !important; background: transparent; }
.sheet .cpn textarea { display: block; font-weight: 700; font-size: calc(12.5 * var(--u)); padding: 0 calc(8 * var(--u)); resize: none; overflow: hidden; text-align: center; white-space: pre-wrap; word-break: normal; overflow-wrap: normal; }

/* inputs on the sheet */
.sheet input, .sheet textarea { width: 100%; height: 100%; border: 0; border-radius: 0; padding: 0 calc(2 * var(--u)); background: transparent; text-align: center;
  font-family: inherit; font-size: calc(13 * var(--u)); font-weight: 500; color: var(--auto); outline: none; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1, 'calt' 1; letter-spacing: -0.005em; }
.sheet input.user, .sheet textarea.user { color: var(--user); }
/* editable cells: hover shows a light tint, a thin outline and a text cursor (screen only) */
.sheet input, .sheet textarea { cursor: text; transition: background-color .08s; }
.sheet input:hover, .sheet textarea:hover { background: #eef4ff; box-shadow: inset 0 0 0 calc(1.2 * var(--u)) #8fb0e6; }
.sheet input:focus, .sheet textarea:focus { background: #fffbe0; }
.sheet input.blank { color: #000; }
.sheet input.need { background: #fff3c4; }
.sheet input.calm { background: #fde4e1; }
.sheet .add-row { position: absolute; right: calc(6 * var(--u)); top: calc(5 * var(--u)); font-size: calc(12 * var(--u)); line-height: 1; padding: calc(2*var(--u)) calc(7*var(--u)); border-radius: calc(4*var(--u)); }
.ti-title { position: relative; }
.sub2 { display: grid; grid-template-rows: 1fr 1fr; height: 100%; }
.sub2 > div:first-child { border-bottom: var(--hair) solid var(--line); }
.sub2 > div { overflow: hidden; min-height: 0; }
.sub2 input { display: block; }
.sub2.soft > div:first-child { border-bottom-color: var(--line); }

/* terminal information + notes */
.foot { grid-template-columns: calc(570 * var(--u)) 1fr; border-top: none; border-bottom: var(--thick) solid var(--line); }
.foot > div { border-bottom: none; }
.foot .ti { display: grid; grid-template-columns: calc(123*var(--u)) calc(89*var(--u)) calc(147*var(--u)) 1fr; border-right-color: transparent !important; }
.foot .ti > div { border-right: var(--hair) solid var(--line); border-bottom: var(--hair) solid var(--line); min-width: 0; overflow: hidden; position: relative; }
.foot .ti > div:nth-child(4n) { border-right: none; }
.foot .ti .th { font-size: calc(11 * var(--u)); font-weight: 600; display: flex; align-items: center; padding: 0 calc(5*var(--u)); height: calc(28*var(--u)); }
.foot .ti textarea { resize: none; text-align: left; font-size: calc(10.5 * var(--u)); line-height: 1.12; padding: calc(2*var(--u)) calc(4*var(--u)); display: block; overflow: hidden; }
.foot .ti .rowctl { position: absolute; right: 2px; top: 2px; z-index: 2; display: none; }
.foot .ti .cellrow:hover .rowctl { display: block; }
.foot .notes { position: relative; }
.foot .notes .th { font-size: calc(19 * var(--u)); line-height: 1; font-weight: 800; padding: calc(4*var(--u)) calc(5*var(--u)) 0; height: calc(28*var(--u)); border-bottom: var(--hair) solid var(--line); }
.foot .notes textarea { position: absolute; left: 0; right: 0; bottom: 0; top: calc(28*var(--u)); height: auto; text-align: left; resize: none;
  font-size: calc(11.5 * var(--u)); line-height: calc(33 * var(--u)); padding: 0 calc(6*var(--u)); background: transparent; z-index: 1; }
/* ruled lines for writing in flight: real borders, so they print without "background graphics" */
.foot .notes .note-lines { position: absolute; left: 0; right: 0; bottom: 0; top: calc(28*var(--u)); overflow: hidden; pointer-events: none; }
.foot .notes .note-lines div { height: calc(33 * var(--u)); border-bottom: var(--hair) solid var(--line); }
.rowctl button { font-size: 10px; padding: 0 4px; line-height: 14px; }

/* print: A4 landscape, sheet only */
@page { size: A4 landscape; margin: 5mm; }
@media print {
  html, body { background: #fff; }
  .no-print, .rowctl, .add-row { display: none !important; }
  #flight { display: block !important; }
  html, body { height: auto; overflow: visible; }
  #stage { display: block; overflow: visible; height: auto !important; padding: 0 !important; }
  #sheet > .sheet:not(.active) { display: block; }
  .sheet input.need, .sheet input.calm { background: transparent !important; }
  .sheet { --u: 0.226mm; --hair: 0.2mm; --thick: 0.4mm; box-shadow: none; margin: 0 auto; }
  .sheet input, .sheet textarea, .sheet input.user, .sheet textarea.user { color: #000 !important; background: transparent !important; }
}
