/* Lakes field portal — formal, square-cornered, Times New Roman, light/dark themes, print-ready. */
:root {
  color-scheme: light;
  --font: "Times New Roman", Times, serif; --radius: 2px;
  --ink: #1b2328; --muted: #56636a; --bg: #f3f3f1; --card: #fff; --card-alt: #f7f9f9; --hover: #f2f6f7;
  --line: #c8d0d5; --line-soft: #e6ebed; --field: #fff; --field-line: #a9b6bc;
  --head: #0b3a45; --brand: #0f5563; --brand-hover: #0b3a45; --brand-text: #0b3a45; --brand-l: #e7eff1; --brand-line: #a9bcc3;
  --accent: #8a4b16; --ok: #1d6b4f; --ok-l: #e9f3ee; --ok-line: #8fbfa8;
  --bad: #a3221a; --bad-fill: #a3221a; --bad-l: #fff3f1; --bad-line: #e6b8b3;
  --warn: #8a5300; --warn-l: #fdf5e8; --warn-line: #e2c48f;
  --violet: #5b3a85; --violet-l: #faf8fc; --violet-line: #b9a3d3;
  --com: #7a3f0c; --com-l: #fbf3ea; --com-line: #d9b48f; --eng: #155a40; --eng-l: #eef6f2; --eng-line: #9cc5b2;
  --track: #e3e8eb; --chart-grid: #e3e8eb; --chart-axis: #9aa9b0; --chart-text: #4f5d64; --chart-strong: #2b3940;
  --s1: #0f5563; --s2: #b5651d; --s3: #5b3a85; --s4: #2f5f8a;
  --lv5: #d4efe1; --lv4: #e9f4d2; --lv3: #fff0c4; --lv2: #ffd8b5; --lv1: #f6c1bb; --lvdk: #eceff1;
  --foot: rgba(243, 243, 241, .96); --shadow: rgba(27, 35, 40, .08); --toast: #1b2328;
}
/* Dark palette applies on screen only, so printed forms stay black on white. */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e1e7e9; --muted: #98a7ad; --bg: #0f1518; --card: #161f24; --card-alt: #1b262b; --hover: #1f2c32;
    --line: #34444b; --line-soft: #253238; --field: #10181c; --field-line: #4b5d65;
    --head: #0a1f26; --brand: #2f7f8d; --brand-hover: #3a90a0; --brand-text: #8fd0da; --brand-l: #1a3138; --brand-line: #2f5560;
    --accent: #e3a56d; --ok: #6fc8a0; --ok-l: #16302a; --ok-line: #2f6b55;
    --bad: #f08a7f; --bad-fill: #b23a2f; --bad-l: #361c1a; --bad-line: #7a3631;
    --warn: #e8bb6a; --warn-l: #30260f; --warn-line: #6e5522;
    --violet: #c4a8ec; --violet-l: #201b2b; --violet-line: #574677;
    --com: #ebbd8f; --com-l: #31241a; --com-line: #6c4a2c; --eng: #93d4b5; --eng-l: #152e28; --eng-line: #2e5f4f;
    --track: #29373d; --chart-grid: #26343a; --chart-axis: #5d6f77; --chart-text: #a7b5bb; --chart-strong: #e1e7e9;
    --s1: #5fb6c4; --s2: #e0a066; --s3: #b69be3; --s4: #82a9d8;
    --lv5: #1d4634; --lv4: #34461f; --lv3: #4b4118; --lv2: #53331a; --lv1: #5a2521; --lvdk: #283338;
    --foot: rgba(15, 21, 24, .96); --shadow: rgba(0, 0, 0, .45); --toast: #26353c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.5 var(--font); color: var(--ink); background: var(--bg); }
button, input, select, textarea { font-family: var(--font); }
a { color: var(--brand-text); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; } h4 { font-size: .98rem; margin-top: 1.2em; }
p { margin: 0 0 .7em; }
small, .sm { font-size: .86rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- chrome ---------- */
header.top { background: var(--head); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-right: auto; }
.brand svg { width: 34px; height: 34px; }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .2px; }
.brand small { display: block; opacity: .8; font-size: .78rem; }
.nav { display: flex; gap: 2px; overflow-x: auto; order: 3; width: 100%; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; color: #d6e6ea; text-decoration: none; white-space: nowrap; font-weight: 700; font-size: .95rem; border-bottom: 3px solid transparent; }
.nav-a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-a.on { color: #fff; border-bottom-color: #fff; }
.lakesel { display: flex; align-items: center; gap: 8px; }
.lake-lbl { font-size: .85rem; opacity: .85; }
.lake-sel { min-height: 36px; padding: 4px 8px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 0; background: var(--head); color: #fff; font: 700 .95rem var(--font); cursor: pointer; }
.lake-sel option { background: var(--card); color: var(--ink); }
.theme-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, .55); border-radius: 0; background: transparent; color: #fff; cursor: pointer; }
.theme-btn:hover { background: rgba(255, 255, 255, .1); }
.lake-tag { font-size: .8rem; font-weight: 700; color: var(--brand-text); border: 1px solid var(--brand-line); padding: 0 6px; vertical-align: middle; }
.page-head h1 .lake-tag { font-size: .9rem; }
@media (min-width: 1360px) { .nav { order: 0; width: auto; } .nav-a { padding: 10px 8px; } }
main { max-width: 1040px; margin: 0 auto; padding: 16px 14px 90px; }

/* ---------- generic ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.page-head { margin: 4px 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 2px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: 700 1rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-hover); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: var(--card); color: var(--brand-text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); background: var(--hover); }
.btn.danger { background: var(--bad-fill); border-color: var(--bad-fill); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .88rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 2px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand-text); }
.inp { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--field-line); border-radius: 2px; font: 1rem var(--font); color: var(--ink); background: var(--field); }
.inp:focus { outline: 2px solid var(--brand-line); outline-offset: 0; border-color: var(--brand); }
.inp.sm { min-height: 38px; padding: 6px 8px; font-size: .95rem; }
.inp.xs { min-height: 30px; padding: 4px 6px; font-size: .82rem; }
.inp.bad { border-color: var(--bad); background: var(--bad-l); }
textarea.inp { resize: vertical; min-height: 84px; }
select.inp { appearance: auto; }
.lbl { display: block; font-weight: 600; margin: 12px 0 4px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.check input { width: 20px; height: 20px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv b { text-align: right; }
.kv.ok b { color: var(--ok); } .kv.bad b { color: var(--bad); } .kv.warn b { color: var(--warn); }
.callout { display: flex; gap: 10px; background: var(--brand-l); border: 1px solid var(--brand-line); border-left: 4px solid var(--brand); padding: 10px 12px; margin: 8px 0 12px; }
.callout .ic { color: var(--brand-text); margin-top: 2px; }
.callout.warn { background: var(--warn-l); border-color: var(--warn-line); border-left-color: var(--warn); }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip-status { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border: 1px solid var(--warn-line); color: var(--warn); background: var(--card); }
.chip-status.complete { border-color: var(--ok-line); color: var(--ok); }
.badge { font: 700 .8rem var(--font); padding: 3px 6px; border: 1px solid var(--line); background: var(--card-alt); color: var(--ink); min-width: 44px; text-align: center; }
.badge.community { border-color: var(--com-line); background: var(--com-l); color: var(--com); }
.badge.engineering { border-color: var(--eng-line); background: var(--eng-l); color: var(--eng); }
pre.err { white-space: pre-wrap; font-size: .8rem; background: var(--bad-l); color: var(--ink); padding: 10px; border: 1px solid var(--bad-line); }

/* ---------- home ---------- */
.hero { background: var(--head); color: #fff; border-left: 6px solid #c9a227; padding: 20px; margin-bottom: 16px; }
.hero h1 { font-size: 1.85rem; margin-bottom: .2em; }
.hero p { margin: 0; opacity: .85; }
.big-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 16px; }
.big-card { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-top: 5px solid; padding: 18px; }
.big-card h2 { margin: 0; }
.big-card .ic { width: 32px; height: 32px; stroke-width: 1.8; }
.big-card.com { border-top-color: var(--accent); }
.big-card.com .ic, .big-card.com h2 { color: var(--accent); }
.big-card.eng { border-top-color: var(--ok); }
.big-card.eng .ic, .big-card.eng h2 { color: var(--ok); }
.big-card:hover { background: var(--hover); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.quick-a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 2px; text-decoration: none; color: var(--ink); font-weight: 700; background: var(--card); }
.quick-a .ic { color: var(--brand-text); }
.quick-a:hover { border-color: var(--brand); background: var(--hover); }
.status.warn { border-color: var(--warn-line); background: var(--warn-l); }
.warn-t { display: flex; gap: 8px; color: var(--warn); font-weight: 600; }

/* ---------- hubs ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; }
.form-card h3 { margin-top: 6px; }
.fc-top { display: flex; align-items: center; gap: 8px; color: var(--brand-text); }
.fc-short { font-weight: 800; color: var(--ink); }
.fc-count { margin-left: auto; font-size: .82rem; color: var(--muted); }
.form-card .btn-row { margin-top: auto; padding-top: 6px; }

/* ---------- form ---------- */
.form-head { position: sticky; top: 0; z-index: 30; background: var(--card); border: 1px solid var(--line); border-top: 0; margin: -16px -14px 12px; padding: 10px 14px 8px; box-shadow: 0 3px 8px var(--shadow); }
.fh-row { display: flex; align-items: center; gap: 10px; }
.fh-title { flex: 1; min-width: 0; }
.fh-form { font-weight: 700; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; }
.fh-actions { display: flex; gap: 6px; }
.saved-lbl { color: var(--muted); font-size: .8rem; }
.fh-prog { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.prog-bar { flex: 1; height: 8px; background: var(--track); overflow: hidden; }
.prog-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.pct { font-size: .8rem; color: var(--muted); min-width: 56px; text-align: right; }
.sec-nav { display: flex; gap: 0; overflow-x: auto; margin-top: 8px; border-left: 1px solid var(--line); scrollbar-width: thin; }
.sec-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: 2px 8px; border: 1px solid var(--line); border-left: 0; background: var(--card-alt); cursor: pointer; font: .9rem var(--font); color: var(--ink); }
.sec-chip small { color: var(--muted); font-size: .72rem; }
.sec-chip.done { background: var(--ok-l); }
.fsec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; scroll-margin-top: 150px; }
.fsec-h { display: flex; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--brand); padding-bottom: 8px; margin-bottom: 10px; }
.fsec-h h2 { flex: 1; margin: 0; font-size: 1.2rem; }
.sec-id { background: var(--brand); color: #fff; font-weight: 700; padding: 1px 8px; font-size: .95rem; }
.sec-prog { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.sec-prog.done { color: var(--ok); font-weight: 700; }
.fsec-intro { color: var(--muted); }
.q { padding: 12px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 160px; }
.q:last-child { border-bottom: 0; }
.q.invalid { background: var(--bad-l); box-shadow: -4px 0 0 var(--bad); padding-left: 8px; }
.q-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.q-num { flex: none; font: 700 .8rem var(--font); color: var(--brand-text); border: 1px solid var(--brand-line); background: var(--brand-l); padding: 1px 5px; margin-top: 3px; }
.q-label { font-weight: 700; flex: 1; }
.req { color: var(--bad); }
.q-hint { color: var(--muted); font-size: .88rem; margin: -2px 0 8px; }
.q-err { color: var(--bad); font-size: .86rem; font-weight: 600; }
.q-err:empty { display: none; }
.q-warn { color: var(--warn); font-size: .84rem; }
.q-warn:empty { display: none; }
.inp-unit { display: flex; align-items: center; gap: 8px; max-width: 320px; }
.unit { color: var(--muted); font-weight: 600; white-space: nowrap; }
.inp.other { margin-top: 8px; }
.info-box { background: var(--card-alt); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 10px 12px; }
.info-box ul { margin: 6px 0 0 18px; padding: 0; }
/* multi-choice: ruled checkbox grid */
.opts { display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-bottom: 0; background: var(--card); }
.opts.many { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; min-height: 42px; border-bottom: 1px solid var(--line); cursor: pointer; }
.opt:hover { background: var(--hover); }
.opt input { width: 19px; height: 19px; margin: 3px 0 0; flex: none; accent-color: var(--brand); cursor: pointer; }
.opt:has(input:checked) { background: var(--brand-l); }
.q select.inp, .q .rank-list, .q .evi { max-width: 560px; }
.rank-list { border: 1px solid var(--line); border-bottom: 0; background: var(--card); }
.rank-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.rank-n { font-weight: 700; color: var(--brand-text); }
.evi { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 8px; padding: 5px 10px; background: var(--violet-l); border: 1px dashed var(--violet-line); }
.evi-l { font-size: .88rem; color: var(--violet); font-weight: 700; }
details.note { margin-top: 6px; }
/* voice typing */
.dict { position: relative; }
.dict > .inp { padding-right: 88px; }
.dict-ctl { position: absolute; right: 5px; top: 5px; display: flex; gap: 3px; }
.dict-ctl button { height: 34px; min-width: 36px; padding: 0 6px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--card-alt); color: var(--ink); font: 700 .8rem var(--font); cursor: pointer; }
.dict-ctl .ic { width: 18px; height: 18px; }
.dict-mic.on { background: var(--bad-fill); border-color: var(--bad-fill); color: #fff; animation: pulse 1.1s infinite; }
.dict-other { margin-top: 8px; }
.dict-other > .inp.other { margin-top: 0; }
details.note summary { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .84rem; cursor: pointer; list-style: none; padding: 4px 0; }
details.note summary::-webkit-details-marker { display: none; }
details.note summary .ic { width: 16px; height: 16px; }
details.note[open] summary { color: var(--brand-text); }
.note-ta { min-height: 60px; margin-top: 4px; }
.cmp-val { font-weight: 700; font-size: 1.08rem; color: var(--brand-text); background: var(--brand-l); border: 1px solid var(--brand-line); padding: 7px 10px; display: inline-block; }
.cmp-val.muted { color: var(--muted); background: var(--card-alt); border-color: var(--line); font-weight: 400; font-size: .95rem; }
/* gps */
.gps { display: flex; flex-direction: column; gap: 6px; }
.gps-btn { align-self: flex-start; }
.gps-btn.busy, .cell-gps.busy { animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.gps-live { font-size: .85rem; color: var(--warn); }
.gps-live:empty { display: none; }
.gps-val { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; color: var(--muted); }
.gps-val .b { color: var(--ink); font-weight: 700; }
.gps-manual summary { font-size: .84rem; color: var(--muted); cursor: pointer; }
.gps-manual .row2 { margin-top: 6px; }
/* photos */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.thumb { margin: 0; border: 1px solid var(--line); overflow: hidden; background: var(--card-alt); }
.thumb img { display: block; width: 100%; height: 120px; object-fit: cover; cursor: zoom-in; }
.thumb figcaption { display: grid; grid-template-columns: 1fr auto; gap: 4px; padding: 6px; align-items: center; font-size: .78rem; }
.thumb figcaption b { grid-column: 1 / -1; }
.thumb.missing { padding: 10px; color: var(--muted); }
/* grid question */
.grid-q { border: 1px solid var(--line); overflow: hidden; }
.grid-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; padding: 6px 8px; align-items: center; border-top: 1px solid var(--line-soft); }
.grid-row:nth-child(even) { background: var(--card-alt); }
.grid-head { border-top: 0; background: var(--brand-l) !important; font-weight: 700; font-size: .85rem; }
.grid-rl strong { font-weight: 600; }
.grid-rl .anchor { display: block; color: var(--violet); font-size: .76rem; }
.grid-cl { display: none; font-size: .74rem; color: var(--muted); }
.grid-q.level select[data-val="5"] { background: var(--lv5); }
.grid-q.level select[data-val="4"] { background: var(--lv4); }
.grid-q.level select[data-val="3"] { background: var(--lv3); }
.grid-q.level select[data-val="2"] { background: var(--lv2); }
.grid-q.level select[data-val="1"] { background: var(--lv1); }
.grid-q.level select[data-val="dk"] { background: var(--lvdk); }
@media (max-width: 640px) {
  .grid-head { display: none; }
  .grid-row { grid-template-columns: 1fr 1fr; }
  .grid-rl { grid-column: 1 / -1; }
  .grid-cl { display: block; }
  .grid-c:only-of-type, .grid-row > .grid-c:nth-child(2):last-child { grid-column: 1 / -1; }
}
/* tables */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 4px 5px; text-align: left; vertical-align: middle; }
.tbl th { background: var(--brand-l); font-size: .8rem; white-space: nowrap; }
.tbl th small { color: var(--muted); font-weight: 400; }
.tbl th.cmp, .tbl td.cmp { background: var(--card-alt); font-weight: 700; color: var(--brand-text); white-space: nowrap; }
.tbl td.rn { color: var(--muted); text-align: center; width: 34px; }
.tbl .inp.cell { min-height: 38px; padding: 5px 7px; font-size: .92rem; min-width: 120px; }
.tbl .inp.cell.num { min-width: 78px; width: 90px; }
.tbl select.inp.cell { min-width: 120px; }
.cell-check { width: 22px; height: 22px; }
.cell-gps-wrap { display: flex; align-items: center; gap: 4px; font-size: .78rem; white-space: nowrap; }
.tbl.compact td, .tbl.compact th { padding: 5px 8px; }
.tbl tr.flag td { background: var(--bad-l); }
.tbl-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; margin-top: 6px; }
.form-foot { position: sticky; bottom: 0; z-index: 25; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; background: var(--foot); padding: 10px 0; border-top: 1px solid var(--line); }

/* ---------- small screens: keep the form chrome compact ---------- */
@media (max-width: 640px) {
  header.top { padding: 6px 10px; gap: 6px 8px; }
  .brand small, .lake-lbl { display: none; }
  .brand b { font-size: .98rem; }
  .lake-sel { padding: 4px 6px; font-size: .9rem; }
  .nav-a { padding: 7px 9px; font-size: .88rem; }
  main { padding: 12px 10px 40px; }
  .hero { padding: 16px 14px; }
  .hero h1 { font-size: 1.4rem; }
  .form-head { margin: -12px -10px 10px; padding: 6px 10px 6px; }
  .form-head .icon-btn { width: 34px; height: 34px; }
  .fh-form { font-size: .9rem; }
  .fh-prog { margin-top: 4px; }
  .sec-nav { padding-top: 6px; gap: 4px; }
  .sec-chip { min-width: 38px; padding: 1px 6px; }
  .fsec { padding: 12px 10px; scroll-margin-top: 120px; }
  .form-foot { position: static; background: transparent; border-top: 0; justify-content: stretch; }
  .form-foot .btn { flex: 1 1 auto; }
}
@media (max-width: 379px) { .brand span { display: none; } }

/* ---------- records ---------- */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; gap: 8px; }
@media (max-width: 640px) { .filters { grid-template-columns: 1fr; } }

/* ---------- photo gallery ---------- */
.filters.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-day { margin: 16px 0 0; }
.g-day h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 1.02rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.g-tile { margin: 0; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.g-img { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: var(--card-alt); cursor: zoom-in; }
.g-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-tile figcaption { display: flex; flex-wrap: wrap; gap: 0 8px; padding: 5px 7px 6px; font-size: .8rem; line-height: 1.35; }
.g-tile figcaption a { flex-basis: 100%; }
.g-tile figcaption small { flex-basis: 100%; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; } .g-tile figcaption { font-size: .74rem; padding: 4px 5px; } }
.rec-list { display: flex; flex-direction: column; gap: 0; margin-top: 8px; border-top: 1px solid var(--line); }
.rec-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-top: 0; padding: 8px 10px; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.rec-main span { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- dashboard ---------- */
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.prog-item { border: 1px solid var(--line); padding: 8px 10px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; background: var(--card); }
.prog-item:hover { border-color: var(--brand); }
.prog-top { display: flex; align-items: center; gap: 6px; color: var(--brand-text); }
.prog-top b { color: var(--ink); }
.prog-top span { margin-left: auto; font-size: .78rem; }
.prog-name { font-size: .82rem; line-height: 1.3; }
.map { height: 440px; border: 1px solid var(--line); background: var(--card-alt); }
.mk { background: transparent; border: 0; }
.mk i { display: block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .55); }
.map.leaflet-container { font-family: var(--font); }
.pop { display: flex; flex-direction: column; gap: 2px; font: .92rem var(--font); }
.map-lbl { background: none; border: 0; }
.map-lbl span { display: inline-block; transform: translate(-50%, -50%); font: 700 12px/1.1 var(--font); color: #1f2a2e; white-space: nowrap; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; }
.map-lbl-po span, .map-lbl-pk span { font-weight: 400; font-style: italic; font-size: 11px; }
/* map page */
main.wide { max-width: none; padding: 0; }
.map-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.map-bar h1 { font-size: 1.2rem; margin: 0 auto 0 0; }
.map-bar select.inp { width: auto; }
.map-wrap { position: relative; }
.map-full { position: absolute; inset: 0; background: var(--card-alt); font-family: var(--font); }
.map-full.measuring { cursor: crosshair; }
.map-tools { position: absolute; right: 10px; top: 64px; z-index: 900; display: flex; flex-direction: column; gap: 6px; }
.map-tool { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid #8a979d; border-radius: 2px; background: #fff; color: #1b2328; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.map-tool:hover { background: #eef3f4; }
.map-tool.on { background: #0f5563; border-color: #0f5563; color: #fff; }
.map-cross { position: absolute; left: 50%; top: 50%; z-index: 850; transform: translate(-50%, -50%); pointer-events: none; color: #d7301f; }
.map-cross .ic { width: 36px; height: 36px; stroke-width: 1.6; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.map-legend { position: absolute; left: 10px; top: 84px; z-index: 950; width: min(300px, calc(100% - 70px)); max-height: calc(100% - 134px); overflow: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 10px 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.leg-row { display: grid; grid-template-columns: auto 14px 1fr auto; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.leg-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.sw { display: inline-block; width: 12px; height: 12px; border: 1px solid rgba(0, 0, 0, .35); }
.leg-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .85rem; }
.leg-sub small { width: 100%; color: var(--muted); }
.leg-key { display: inline-flex; align-items: center; gap: 5px; }
.map-panel { position: absolute; left: 10px; bottom: 26px; z-index: 950; width: min(460px, calc(100% - 70px)); max-height: 55%; overflow: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 10px 12px; box-shadow: 0 2px 12px rgba(0, 0, 0, .3); }
.map-panel h4 { margin: 0 32px 6px 0; }
.map-panel .btn-row { margin: 8px 0 0; }
.panel-x { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; }
.chart.profile { margin-top: 6px; }
.map-full .leaflet-tooltip.map-id { display: none; padding: 0 4px; font: 700 11px var(--font); border-radius: 0; box-shadow: none; }
.map-full.show-ids .leaflet-tooltip.map-id { display: block; }
@media (max-width: 640px) {
  .map-panel { left: 6px; right: 58px; width: auto; bottom: 22px; max-height: 40%; font-size: .9rem; padding: 8px 10px; }
  .map-panel .kv { padding: 3px 0; }
  .map-tools { right: 6px; }
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 24px; }
.bars { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr auto; gap: 8px; align-items: center; font-size: .92rem; }
.bar-t { height: 14px; background: var(--track); overflow: hidden; }
.bar-f { height: 100%; }
.bar-v { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.legend { font-size: .82rem; color: var(--muted); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; margin: 0 4px 0 10px; vertical-align: -1px; }
.chart-wrap { margin: 6px 0 10px; }
svg.chart { width: 100%; height: auto; display: block; font-family: var(--font); }
svg.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
svg.chart .axis { stroke: var(--chart-axis); }
svg.chart .tick { font-size: 12px; fill: var(--chart-text); }
svg.chart .cnt { font-size: 11px; fill: var(--chart-strong); font-weight: 700; }
svg.chart .marker { stroke: var(--bad); stroke-dasharray: 4 3; }
svg.chart .marker-t { font-size: 12px; fill: var(--bad); }
svg.chart .bar { fill: var(--brand); } svg.chart .bar-mark { fill: var(--bad); }
svg.chart .lane { font-size: 12.5px; fill: var(--chart-strong); font-weight: 700; }
svg.chart .b-com { fill: var(--s2); } svg.chart .b-con { fill: var(--s1); }
svg.chart .b-work { fill: var(--s3); } svg.chart .b-eq { fill: var(--bad); } svg.chart .b-ev { fill: var(--chart-axis); }

/* ---------- guide ---------- */
.toc { display: flex; flex-wrap: wrap; margin-bottom: 14px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--card); }
.toc a { font-size: .95rem; padding: 6px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; }
.toc a:hover { background: var(--brand-l); }
.guide-sec { scroll-margin-top: 12px; }
.guide-sec .tbl-scroll { margin-bottom: 12px; }
.guide-tbl td { vertical-align: top; font-size: .95rem; }
.form-link { display: inline-block; font: 700 .82rem var(--font); border: 1px solid var(--brand-line); background: var(--brand-l); padding: 0 5px; margin: 1px; text-decoration: none; }
.refs li { margin-bottom: 6px; font-size: .92rem; }
.danger-zone { border-color: var(--bad-line); }

/* ---------- dialogs, toasts, update bar ---------- */
.dlg { border: 1px solid var(--line); border-radius: 2px; padding: 0; max-width: min(620px, 94vw); background: var(--card); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .3); }
.dlg::backdrop { background: rgba(10, 22, 27, .55); }
.dlg-body { padding: 18px; }
.dlg-msg { font-weight: 700; font-size: 1.08rem; }
.dlg.dlg-photo { width: min(1100px, 98vw); max-width: 98vw; max-height: 98vh; }
.photo-view { padding: 10px 12px 12px; }
.pv-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pv-count { margin-left: auto; color: var(--muted); font-size: .9rem; }
.pv-stage { position: relative; display: grid; place-items: center; min-height: 180px; background: #0d1416; touch-action: pan-y; }
.photo-view img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 64px; padding: 0; border: 0; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; }
.pv-nav:hover { background: rgba(0, 0, 0, .7); }
.pv-nav.prev { left: 0; }
.pv-nav.next { right: 0; }
.pv-nav .ic { width: 28px; height: 28px; }
.photo-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: .92rem; }
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 6px; width: min(520px, 92vw); }
.toast { background: var(--toast); color: #fff; padding: 11px 14px; border-left: 4px solid #8fbfa8; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: opacity .4s; font-size: .98rem; }
.toast.bad { background: var(--bad-fill); border-left-color: #f0b4ad; } .toast.warn { background: #6e4300; border-left-color: #e2c48f; }
.toast.out { opacity: 0; }
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 900; display: flex; gap: 12px; align-items: center; background: var(--toast); color: #fff; padding: 8px 10px 8px 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }

/* ---------- print view: always paper colours ---------- */
.print-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.print-doc { --ink: #1b2328; --muted: #56636a; --line: #c8d0d5; --brand: #0f5563; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 18px 20px; font-size: 1rem; }
.p-head { border-bottom: 2px solid var(--ink); margin-bottom: 10px; padding-bottom: 6px; }
.p-brand { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.p-head h1 { font-size: 1.3rem; margin: 2px 0; }
.p-meta { font-size: .85rem; }
.p-sec h2 { font-size: 1.08rem; background: #eef2f3; border-left: 4px solid var(--brand); padding: 3px 8px; margin: 14px 0 6px; }
.p-q { padding: 5px 0 7px; border-bottom: 1px dotted #c9d3d7; }
.p-ql b { margin-right: 2px; }
.p-when { color: #7b4fa6; font-size: .82em; }
.p-hint, .p-intro, .p-note { color: #44606a; font-size: .86em; }
.p-opts { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 3px; }
.p-opt { white-space: nowrap; }
.p-line { margin-top: 4px; }
.p-box { height: 52px; border: 1px solid #c9d3d7; margin-top: 4px; }
.p-ans { white-space: pre-wrap; margin-top: 3px; padding: 4px 6px; background: #f8fafb; border: 1px solid #e2e7e9; }
.p-evi { font-size: .84em; color: #5b3a85; margin-top: 3px; }
.p-evi .p-opt { margin-right: 14px; }
.p-tbl { border-collapse: collapse; width: 100%; font-size: .82em; margin-top: 4px; }
.p-tbl th, .p-tbl td { border: 1px solid #9fb1b8; padding: 3px 5px; height: 22px; text-align: left; }
.p-tbl th { background: #eef3f4; }
.p-anchor { display: block; color: #7b4fa6; font-size: .85em; }
.p-legend { font-size: .8em; color: #44606a; margin-top: 3px; }
.p-ranklist { columns: 2; font-size: .86em; margin: 4px 0 0; }
.p-info { background: #f6f9fa; padding: 6px 8px; border-left: 3px solid var(--brand); margin: 6px 0; font-size: .9em; }

@media print {
  @page { size: A4; margin: 12mm 11mm; }
  body { background: #fff; font-size: 9.5pt; }
  header.top, .print-bar, .update-bar, #toasts, .form-foot { display: none !important; }
  main { max-width: none; padding: 0; }
  .print-doc { border: 0; padding: 0; font-size: 9.5pt; }
  .p-q { padding: 3px 0 5px; }
  .p-box { height: 40px; }
  .p-q, .p-tbl tr, .p-info { break-inside: avoid; }
  .p-sec h2 { break-after: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
