:root {
  --navy: #0f172a; --ink: #1e293b; --sub: #475569; --line: #e2e8f0;
  --blue: #1d4ed8; --amber: #f59e0b; --amberbg: #fffbeb; --bg: #f8fafc;
  --normal: #1d4ed8; --abnormal: #b45309; --emergency: #b91c1c; --reference: #2f7d3a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
header { max-width: 720px; margin: 0 auto; padding: 28px 18px 8px; }
h1 { font-size: 26px; font-weight: 800; color: var(--navy); margin: 0 0 6px; }
h2 { font-size: 20px; font-weight: 800; color: var(--navy); margin: 0 0 6px; }
.sub { color: var(--sub); margin: 0 0 14px; }
.fine { color: #94a3b8; font-size: 13px; margin-top: 12px; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }
main { max-width: 720px; margin: 0 auto; padding: 8px 18px 60px; }
/* The editing screen uses more width on desktop; landing/download stay narrow. */
body.wide header, body.wide main { max-width: 1040px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.hidden { display: none !important; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); margin-bottom: 5px; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field.two { grid-template-columns: 1fr; } }
input[type=text], input[type=email] { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit; color: var(--ink); background: #fff; }
input[type=file] { width: 100%; }

/* Custom file picker (native "Choose Files" text can't be relabeled) */
.filepick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filechip { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; color: var(--ink); margin: 2px 0; }
.filechip-x { background: none; border: 0; color: #94a3b8; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
.filechip-x:hover { color: var(--emergency); }
.filehidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filebtn { display: inline-block; background: #eef2ff; color: #3730a3; font-weight: 700; font-size: 14px;
  padding: 9px 14px; border-radius: 9px; cursor: pointer; border: 1px solid #e0e7ff; }
.filebtn:hover { background: #e0e7ff; }
.filehidden:focus-visible + .filebtn { outline: 2px solid var(--blue); outline-offset: 2px; }
.filelist { color: var(--sub); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.opt { display: flex; gap: 9px; align-items: flex-start; margin: 12px 0 2px; color: var(--sub); font-size: 13.5px; }
.opt input { margin-top: 2px; width: 17px; height: 17px; flex: 0 0 auto; }
.opt strong { color: var(--ink); }

button { font: inherit; cursor: pointer; border-radius: 11px; padding: 12px 18px; border: 0; font-weight: 700; }
button.primary { background: var(--blue); color: #fff; width: 100%; }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #eef2ff; color: #3730a3; }
button.link { background: none; color: var(--sub); padding: 10px 0; font-weight: 600; }
.downloads { display: flex; gap: 10px; flex-wrap: wrap; }
.downloads button { flex: 1 1 auto; }

.msg { margin-top: 10px; min-height: 1em; }
.msg.err { color: var(--emergency); }
.msg.busy { color: var(--sub); }
.msg.busy .prog-text { display: inline; }
#progTime { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.spinner { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 8px;
  border: 2px solid #c7d2fe; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.problems { background: var(--amberbg); border: 1px solid #fde68a; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.problems h3 { margin: 0 0 6px; font-size: 14px; color: #92400e; }
.problems ul { margin: 0; padding-left: 18px; }
.problems li { font-size: 13px; color: #78350f; margin-bottom: 3px; }
.sev { font-weight: 800; text-transform: uppercase; font-size: 11px; }

.cat { margin: 18px 0 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.cat.normal { color: var(--normal); } .cat.abnormal { color: var(--abnormal); } .cat.emergency { color: var(--emergency); } .cat.reference { color: var(--reference); }
.cl { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.cl.flagged { border: 2px solid var(--amber); }
.cl-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.cl .title { flex: 1 1 auto; font-weight: 700; }
.cl-src { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--sub); margin: -2px 0 8px; }
.cl-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.cl-merge, .cl-del { background: #fff; border: 1px solid var(--line); font-size: 12px; font-weight: 700;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.cl-merge { color: var(--sub); }
.cl-merge:hover { background: #f1f5f9; border-color: #cbd5e1; }
.cl-del { color: var(--emergency); }
.cl-del:hover { background: #fef2f2; border-color: #fecaca; }
.cl-crit, .cl-same { background: #fff; border: 1px solid var(--line); color: var(--sub); font-size: 12px; font-weight: 700;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.cl-crit.on { background: #fffbeb; border-color: var(--amber); color: #92400e; }
.cl-same:hover { background: #f1f5f9; border-color: #cbd5e1; }
.cl-same.on { background: #eef2ff; border-color: #c7d2fe; color: var(--normal); }
.row { display: grid; grid-template-columns: 16px 1fr 18px 1fr auto; gap: 6px; align-items: center; margin-bottom: 5px; }
.row .arrow { text-align: center; color: #94a3b8; }
.row input { padding: 7px 9px; font-size: 14px; }
.row.memrow { position: relative; }
.row.memrow::before { content: ''; position: absolute; left: -8px; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--normal); }
.row-acts { display: flex; gap: 1px; align-items: center; }
.row-mem, .row-ins, .row-del { background: none; border: 0; color: #b0b8c4; line-height: 1; padding: 0;
  width: 22px; height: 26px; border-radius: 6px; }
.row-mem { font-size: 12px; font-weight: 700; border: 1px solid var(--line); color: #b0b8c4; }
.row-mem.on { background: #eef2ff; border-color: #c7d2fe; color: var(--normal); }
.row-mem:hover { border-color: #c7d2fe; color: var(--normal); }
.row-ins { font-size: 17px; font-weight: 700; }
.row-ins:hover { color: var(--normal); background: #eef2ff; }
.row-del { font-size: 20px; font-weight: 400; }
.row-del:hover { color: var(--emergency); background: #fef2f2; }
.row-undo { background: #eef2ff; border: 1px solid #c7d2fe; color: var(--normal); font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; margin-left: 4px; white-space: nowrap; }
.row-undo:hover { background: #e0e7ff; }

/* Sub-header row: full-width band, left-justified label */
.row.subrow { display: flex; align-items: center; gap: 8px; background: #f1f5f9; border-radius: 8px;
  padding: 4px 8px; margin: 4px 0; }
.sub-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; flex: 0 0 auto; }
.sub-label { flex: 1 1 auto; font-weight: 700; background: transparent; border: none; font-size: 14px; color: var(--ink); padding: 5px 2px; }
.sub-label:focus { outline: none; }
.row-add-wrap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* Start from scratch (upload card) + add-section buttons (review) */
.scratch-line { margin: 10px 0 2px; font-size: 14px; color: var(--sub); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.add-section { display: block; width: 100%; background: #f8fafc; border: 1px dashed var(--line); color: var(--sub);
  font-size: 13px; font-weight: 700; padding: 10px; border-radius: 10px; margin: 2px 0 18px; cursor: pointer; }
.add-section:hover { background: #eef2ff; border-color: #c7d2fe; color: var(--normal); }
.add-section.empty { padding: 18px; font-size: 15px; margin-top: 8px; }

/* Editing guide modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 16px; max-width: 640px; width: 100%; box-shadow: 0 20px 60px rgba(15,23,42,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; color: var(--navy); }
.modal-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--sub); cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 16px 20px 22px; }
.gk { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); margin: 18px 0 8px; }
.gk:first-child { margin-top: 0; }
.gk span { text-transform: none; letter-spacing: 0; font-weight: 400; color: #94a3b8; }
.glist { list-style: none; margin: 0; padding: 0; }
.glist li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--ink); margin-bottom: 8px; line-height: 1.5; }
.gi { flex: 0 0 auto; min-width: 20px; text-align: center; color: var(--sub); font-weight: 700; }
.gi.gsq { border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 13px; }
.gb { flex: 0 0 auto; background: #f1f5f9; border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px;
  font-size: 12.5px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.gb.gon { background: #eef2ff; border-color: #c7d2fe; color: var(--normal); }
.gb.gdel { color: var(--emergency); }
.glist kbd { background: #f1f5f9; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; font: 600 12px var(--mono, ui-monospace, monospace); color: var(--ink); }
.gmuted { color: #94a3b8; font-size: 13px; }

/* Summary strip */
.rsum { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.rchip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: var(--sub); }
.rchip.normal { background: #eff6ff; color: #1d4ed8; }
.rchip.abnormal { background: #fffbeb; color: #b45309; }
.rchip.emergency { background: #fef2f2; color: #b91c1c; }
.rchip.reference { background: #f0fdf4; color: #2f7d3a; }
.rchip.flag { background: #fff7ed; color: #c2410c; }

/* Review body: sticky outline rail + checklists */
.review-body { display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: start; }
.outline { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.ol-item { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 8px; color: var(--sub); cursor: pointer; }
.ol-item:hover { background: #f1f5f9; color: var(--ink); }
.ol-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: #94a3b8; }
.ol-item.normal .ol-dot { background: var(--normal); }
.ol-item.abnormal .ol-dot { background: var(--abnormal); }
.ol-item.emergency .ol-dot { background: var(--emergency); }
.ol-item.reference .ol-dot { background: var(--reference); }
.ol-t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-n { font-size: 11px; color: #94a3b8; flex: 0 0 auto; }
.ol-item.flagged { color: #c2410c; font-weight: 600; }
.ol-item.flagged::after { content: '!'; color: #c2410c; font-weight: 700; }
.ol-item.grouped { padding-left: 22px; }
.ol-item.grouped .ol-dot { visibility: hidden; }
.ol-item.grouped::before { content: '\21B3'; color: #94a3b8; margin-left: -14px; margin-right: 1px; }
@media (max-width: 640px) { .review-body { grid-template-columns: 1fr; } .outline { position: static; flex-direction: row; flex-wrap: wrap; } }

/* Drag-to-reorder */
.drag { cursor: grab; color: #c2c8d0; font-size: 15px; line-height: 1; user-select: none; flex: 0 0 auto; text-align: center; }
.drag:hover { color: var(--sub); }
.drag:active { cursor: grabbing; }
.cl-drag { font-size: 16px; padding: 0 2px; }
.dragging { opacity: .45; }
.drop-before { box-shadow: 0 -3px 0 -1px var(--normal); }
.drop-after { box-shadow: 0 3px 0 -1px var(--normal); }

/* Recategorize dropdown */
.cl-cat { font-size: 12px; font-weight: 700; color: var(--sub); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; background: #fff; }

/* Collapse + inline flags */
.cl-collapse { background: none; border: 0; color: var(--sub); font-size: 22px; cursor: pointer; padding: 0 6px; flex: 0 0 auto; transition: transform .1s; line-height: 1; }
.cl.collapsed .cl-collapse { transform: rotate(-90deg); }
.cl.collapsed .cl-body { display: none; }
.cl-count { font-size: 12px; color: #94a3b8; flex: 0 0 auto; white-space: nowrap; }
.cl-flag { background: var(--amberbg); border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; font-size: 13px; color: #78350f; margin-bottom: 10px; }
.rowflag input { border-color: #fcd34d; }
.rowflag-note { font-size: 12px; color: #b45309; margin: -2px 0 6px 2px; }
.pulse { animation: pulse 1.2s ease; }
@keyframes pulse { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px #fde68a; } }

/* Undo / revert toolbar */
.edit-tools { display: flex; gap: 8px; margin: 0 0 12px; }
.tool { background: #fff; border: 1px solid var(--line); color: var(--sub); font-size: 13px; font-weight: 700;
  padding: 7px 12px; border-radius: 8px; }
.tool:hover:not(:disabled) { background: #f1f5f9; border-color: #cbd5e1; color: var(--ink); }
.tool:disabled { opacity: .45; cursor: not-allowed; }

/* Split point: a short dash on the right edge between two rows. */
.split-gap { position: relative; height: 9px; }
.split-dash { position: absolute; right: 2px; top: 0; height: 9px; width: 34px; padding: 0; border: 0;
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; }
.split-dash::after { content: ''; width: 22px; height: 2px; border-radius: 2px; background: #cbd5e1; transition: all .1s; }
.split-dash:hover::after { background: var(--normal); width: 30px; height: 3px; }
.split-hint { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--normal); background: #eef2ff; border: 1px solid #c7d2fe;
  padding: 2px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .1s; }
.split-dash:hover .split-hint { opacity: 1; }
.row-add { background: #eef2ff; color: #3730a3; border: 0; font-size: 13px; font-weight: 700;
  padding: 7px 12px; border-radius: 8px; margin-top: 4px; }
.row-add:hover { background: #e0e7ff; }

.ack { display: flex; gap: 9px; align-items: flex-start; margin: 20px 0 8px; font-weight: 600; color: var(--ink); }
.ack input { margin-top: 3px; width: 18px; height: 18px; }
.disclaimer { color: #b45309; font-size: 13px; font-weight: 600; margin: 8px 0 14px; }

/* ── Landing orientation (how it works / guidance / what you get) ── */
.samplelink { margin: 2px 0 0; }
.samplelink a { color: var(--blue); font-weight: 600; text-decoration: none; }
.samplelink a:hover { text-decoration: underline; }
header .samplelink { max-width: 720px; margin: 10px auto 0; padding: 0 18px; }

ol.steps { margin: 6px 0 0; padding-left: 22px; }
ol.steps li { margin-bottom: 8px; color: var(--ink); }
ol.steps strong { color: var(--navy); }

.guidance { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ghead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); margin: 0 0 6px; }
.guidance ul { margin: 0; padding-left: 20px; color: var(--sub); }
.guidance li { margin-bottom: 4px; }

ul.get { margin: 6px 0 12px; padding-left: 20px; }
ul.get li { margin-bottom: 8px; color: var(--ink); }
ul.get strong { color: var(--navy); }

footer.trust { margin: 4px 0 10px; }
footer.trust .disclaimer { margin-bottom: 6px; }
footer.trust .fine { margin-top: 0; }

/* ── Sample gallery (landing): PDF in ForeFlight + native .fmd checklist ── */
header .sample-gallery { max-width: 720px; margin: 14px auto 0; padding: 0 18px; }
.sample-gallery { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin: 8px 0; }
.sample-item { flex: 1 1 280px; max-width: 360px; margin: 0; text-decoration: none; color: inherit; }
.sample-item img { width: 100%; height: auto; border: 1px solid #e2e7ee; border-radius: 10px; box-shadow: 0 6px 20px rgba(16,22,31,.12); transition: transform .12s, box-shadow .12s; display: block; }
a.sample-item:hover img { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,22,31,.18); }
.sample-item .cap { display: block; margin-top: 8px; font-size: 13.5px; line-height: 1.4; color: #3a4554; }
.sample-item .cap em { color: #1f6fb2; font-style: normal; font-weight: 600; }

/* ── Feedback prompt (download screen) ── */
.feedback-prompt { margin: 16px 0 4px; padding: 12px 14px; background: var(--amberbg);
  border: 1px solid #fde68a; border-radius: 12px; font-size: 15px; font-weight: 600; color: #78350f; }
.feedback-prompt a { color: var(--blue); text-decoration: none; white-space: nowrap; }
.feedback-prompt a:hover { text-decoration: underline; }

/* ── Contact form ── */
.contact-form .field { margin-bottom: 14px; }
.contact-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit; color: var(--ink); background: #fff; resize: vertical; min-height: 7rem; }
.contact-form button.primary { margin-top: 4px; }
.contact-form .fine { margin-top: 10px; }

/* ── Review: editable checklist-pages header ── */
.cl-pages { font-size: 18px; font-weight: 800; color: var(--navy); margin: 22px 0 2px; }
.cl-pages-note { margin: 0 0 6px; }
