[hidden] { display: none !important; }
:root {
  --bg: #f4f6f8; --card: #fff; --text: #14212e; --muted: #5b6b7a; --line: #d9e0e6;
  --brand: #123a5c; --brand-2: #1e5a8a; --ok: #1d8a4e; --ok-bg: #e3f4ea; --bad: #c0392b; --bad-bg: #fbe5e2;
  --na: #6b7785; --na-bg: #eceff2; --warn: #9a6400; --warn-bg: #fff3d6; --focus: #f2b632;
  /* badges: soft tint close to the page with vivid text – the light-mode counterpart of the dark-mode look */
  --badge-ok: #137a3b; --badge-ok-bg: #dcf2e4; --badge-bad: #c0271f; --badge-bad-bg: #fde3e1; --badge-warn: #9a5b00; --badge-warn-bg: #fdf0d2;
  --badge-h-warn: #8c5200; --badge-h-warn-bg: #fbe6b4; --badge-h-bad: #ad2019; --badge-h-bad-bg: #fad2ce; /* count badges in headings */
  --info-bg: #fff8dc; --info-line: #f1d67a; --alt: #d98a00;
}
:root { color-scheme: light; }
/* Dark: when chosen, or on 'automatic' when the device is dark (data-theme set from the user's preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151c; --card: #17212b; --text: #e6edf3; --muted: #93a3b3; --line: #2a3744;
    --brand: #0b2a44; --brand-2: #4d9be0; --ok: #43c47d; --ok-bg: #143324; --bad: #ff7a6b; --bad-bg: #3a1a17;
    --na: #a3b0bd; --na-bg: #24303b; --warn: #ffc857; --warn-bg: #3a2e10;
    --badge-ok: #43c47d; --badge-ok-bg: #143324; --badge-bad: #ff7a6b; --badge-bad-bg: #3a1a17; --badge-warn: #ffc857; --badge-warn-bg: #3a2e10; --badge-h-warn: #ffc857; --badge-h-warn-bg: #3a2e10; --badge-h-bad: #ff7a6b; --badge-h-bad-bg: #3a1a17;
    --info-bg: #2e2810; --info-line: #6b5a1c; --alt: #e39a17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0e151c; --card: #17212b; --text: #e6edf3; --muted: #93a3b3; --line: #2a3744;
    --brand: #0b2a44; --brand-2: #4d9be0; --ok: #43c47d; --ok-bg: #143324; --bad: #ff7a6b; --bad-bg: #3a1a17;
    --na: #a3b0bd; --na-bg: #24303b; --warn: #ffc857; --warn-bg: #3a2e10;
    --badge-ok: #43c47d; --badge-ok-bg: #143324; --badge-bad: #ff7a6b; --badge-bad-bg: #3a1a17; --badge-warn: #ffc857; --badge-warn-bg: #3a2e10; --badge-h-warn: #ffc857; --badge-h-warn-bg: #3a2e10; --badge-h-bad: #ff7a6b; --badge-h-bad-bg: #3a1a17;
    --info-bg: #2e2810; --info-line: #6b5a1c; --alt: #e39a17;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--brand-2); }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  background: var(--brand); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.net { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.15); }
.net.off { background: var(--warn); color: #000; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10;
}
.tabs a { flex: 1; text-align: center; padding: 8px 0 10px; text-decoration: none; color: var(--muted); font-size: 12px; }
.tabs a span { display: block; font-size: 20px; line-height: 24px; }
.tabs a.on { color: var(--brand-2); font-weight: 600; }
.tabs b { font-weight: inherit; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h2 { font-size: 19px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 11px 12px; min-height: 48px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.code-input { text-transform: uppercase; font-size: 22px; letter-spacing: 2px; font-weight: 700; }
button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; min-height: 48px;
  background: var(--brand-2); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
}
button.secondary, .btn.secondary { background: var(--na-bg); color: var(--text); }
button.block, .btn.block { width: 100%; }
button.big { min-height: 60px; font-size: 19px; }
button:disabled { opacity: .5; }
.list-link {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.list-link .chev { margin-left: auto; color: var(--muted); font-size: 22px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--na-bg); color: var(--na); white-space: nowrap; }
.badge.ok { background: var(--badge-ok-bg); color: var(--badge-ok); }
.badge.bad { background: var(--badge-bad-bg); color: var(--badge-bad); }
.badge.warn { background: var(--badge-warn-bg); color: var(--badge-warn); }
h2 .badge.warn { background: var(--badge-h-warn-bg); color: var(--badge-h-warn); }
h2 .badge.bad { background: var(--badge-h-bad-bg); color: var(--badge-h-bad); }
.issue { border-left: 4px solid var(--bad); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px; margin-bottom: 12px; font-size: 15px; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* checklist */
.section { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.section > summary { list-style: none; padding: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 18px; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary .prog { margin-left: auto; }
.section[open] > summary { border-bottom: 1px solid var(--line); }
.section.done > summary { background: var(--ok-bg); }
.item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-of-type { border-bottom: 0; }
.item .txt { font-weight: 500; }
.item .req { color: var(--bad); font-weight: 700; }
.item .help { font-size: 14px; color: var(--muted); margin-top: 3px; white-space: pre-line; }
.infobox {
  display: flex; gap: 12px; align-items: center; min-height: 56px; padding: 10px 12px;
  background: var(--info-bg); border: 1.5px solid var(--info-line); border-radius: 12px;
}
.infobox .txt { font-weight: 600; }
.i-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: #f6c945; color: #000;
  font: 800 21px/34px Georgia, "Times New Roman", serif; text-align: center; box-shadow: 0 0 0 3px rgba(246,201,69,.3);
}
.item.invalid { background: var(--bad-bg); }
.item .known { font-size: 13px; color: var(--bad); margin-top: 4px; }
.item img.thumb { max-width: 120px; max-height: 90px; border-radius: 8px; margin-top: 6px; display: block; }
.choices { display: flex; gap: 8px; margin-top: 10px; }
.choices button { flex: 1; background: var(--na-bg); color: var(--text); border: 2px solid transparent; }
.choices button.sel-ok { background: var(--ok); color: #fff; }
.choices button.sel-notok { background: var(--bad); color: #fff; }
.choices button.sel-alt { background: var(--alt); color: #000; }
.choices button.sel-na { background: var(--na); color: #fff; }
.reading { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.reading input { max-width: 160px; font-size: 20px; font-weight: 700; }
.item .comment { margin-top: 8px; }
.sec-foot { padding: 12px 14px; background: var(--bg); }
.locked .choices button, .locked input, .locked textarea { pointer-events: none; }
.answer { margin-top: 6px; font-size: 15px; }

.badge.running-ind { background: var(--bad); color: #fff; animation: pulse-ind 2s ease-in-out infinite; }
@keyframes pulse-ind { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .badge.running-ind { animation: none; } }
details.others > summary { cursor: pointer; }
details.others .list-link { margin: 10px 0 0; }
.mcard.running { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
button.mstart { background: var(--ok); }
button.mstop { background: var(--bad); }
.ivline { font-size: 14px; margin-top: 4px; }
.ivline.warn { color: var(--warn); }
.ivline.bad { color: var(--bad); }
.mread input { max-width: none; }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom));
  background: #14212e; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: 90%;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 15px;
}
.scanner { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner .frame { position: absolute; top: 50%; left: 50%; width: 64vmin; height: 64vmin; transform: translate(-50%, -50%); border: 3px solid var(--focus); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.scanner .bar { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 10px; background: #000; color: #fff; align-items: center; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.hist-item { font-size: 15px; padding: 4px 0; display: flex; gap: 8px; }
.hist-item .r { min-width: 22px; text-align: center; font-weight: 700; }

.local-banner {
  position: relative; z-index: 1000; padding: 6px 12px; text-align: center; font: 700 13px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .02em; color: #111; background: repeating-linear-gradient(-45deg, #ffd24d 0 14px, #ffbf00 14px 28px);
  border-bottom: 2px solid #111;
}

dialog.ask { border: 0; border-radius: 14px; padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.ask::backdrop { background: rgba(0,0,0,.45); }
dialog.ask h2 { margin: 0 0 8px; font-size: 18px; }
dialog.ask p { margin: 0 0 14px; line-height: 1.45; white-space: pre-line; }
dialog.ask textarea, dialog.ask input { width: 100%; margin-bottom: 14px; }
.ask-btns { display: flex; flex-direction: row-reverse; gap: 8px; }

/* maps (Leaflet) */
.map { height: 320px; border-radius: 12px; margin-top: 12px; border: 1px solid var(--line); z-index: 0; }
.leaflet-container { font: inherit; font-size: 13px; }
.mk-dot { background: #1e5a8a; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.mk-dot.latest { background: #d6452f; }
.mk-pos { background: #fff; border: 2px solid #123a5c; border-radius: 50%; text-align: center; line-height: 26px; font-size: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.mk-pin span, .pin-center::before { display: block; width: 26px; height: 26px; background: #d6452f; border: 3px solid #fff;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 1px 5px rgba(0,0,0,.45); }
.linkbtn { background: none; color: var(--brand-2); min-height: 0; padding: 2px 6px; font-weight: 600; font-size: inherit; }
.mappick { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--bg); }
.mappick .mwrap { flex: 1; position: relative; }
.mappick #pmap { position: absolute; inset: 0; }
.pin-center { position: absolute; left: 50%; top: 50%; z-index: 1000; pointer-events: none; transform: translate(-50%, -100%); }
.pin-center::before { content: ''; margin-bottom: 4px; }
.mappick .hint { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: rgba(20,33,46,.85); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 14px; white-space: nowrap; pointer-events: none; }
.mappick .bar { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.mappick .bar .grow { flex: 1; }
.row > .grow.btn, .row > button.grow { flex: 1; }
.leaflet-control-layers input { width: auto; min-height: 0; padding: 0; margin: 0 4px 0 0; accent-color: #1e5a8a; }
.leaflet-control-layers label { display: block; font-weight: 400; font-size: 12px; margin: 0; color: #333; }
.leaflet-control-layers-expanded { padding: 4px 8px; }

/* messages */
.tabs a span { position: relative; }
.tab-badge { position: absolute; top: -4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--bad); color: #fff; font: 700 11px/18px -apple-system, sans-serif; font-style: normal; }
.msg-notice { display: block; text-decoration: none; font-weight: 600; background: var(--badge-h-warn-bg, var(--warn-bg)); color: var(--badge-h-warn, var(--warn)); }
.msg.unread { border-left: 4px solid var(--warn); }
.msg-text { white-space: pre-line; margin-top: 6px; }

/* extra measurements on a machine */
.mmetrics { margin-top: 6px; }
.mmetrics .ivline { margin-top: 2px; }
.mmet label { font-weight: 500; }
