/* Intellilog cold-chain app: one style sheet for every page.
   Colours are tokens on :root. Dark mode re-declares them (the OS setting, or the theme button in the top bar).
   Status is never shown by colour alone: every chip has a shape and a word. */

:root {
  color-scheme: light;
  --page: #f4f6f8;
  --surface: #ffffff;
  --ink: #12202b;
  --ink-2: #3f4f5c;
  --muted: #5b6b79;
  --border: #dde3e9;
  --border-strong: #c5cfd8;
  --field-border: #8896a3;
  --row-line: #e6ebef;
  --nav: #12202b;
  --nav-ink: #c9d5df;
  --nav-accent: #5cc8e3;
  --accent: #0b6e8a;
  --accent-hover: #08536a;
  --accent-ink: #ffffff;
  --link: #0b6e8a;
  --ok-bg: #e4f4ea;   --ok-ink: #17613d;
  --bad-bg: #fde7e5;  --bad-ink: #9c211a;
  --warn-bg: #fff1d6; --warn-ink: #7a4e00;
  --idle-bg: #eaeff3; --idle-ink: #3f4f5c;
  --info-bg: #e3f1f5; --info-ink: #08536a;
  --series: #0b6e8a;
  --band: #e4f4ea;
  --band-line: #17613d;
  --crit: #c62f25;
  --grid: #dde3e9;
  --axis: #8896a3;
  --map-bg: #e9eef1;
  --shadow: rgba(18, 32, 43, 0.16);
  --focus: #0b6e8a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e151b;
    --surface: #17222b;
    --ink: #e9eef2;
    --ink-2: #c3ced8;
    --muted: #93a3b1;
    --border: #2a3946;
    --border-strong: #3a4b59;
    --field-border: #5b6d7c;
    --row-line: #223039;
    --nav: #0a1217;
    --nav-ink: #b7c5d1;
    --accent: #5cc8e3;
    --accent-hover: #86d9ee;
    --accent-ink: #08202a;
    --link: #6fd0e8;
    --ok-bg: #14382a;   --ok-ink: #7fdca9;
    --bad-bg: #4a1e1b;  --bad-ink: #ffb4ac;
    --warn-bg: #4a3811; --warn-ink: #ffd27a;
    --idle-bg: #26333d; --idle-ink: #c3ced8;
    --info-bg: #12384a; --info-ink: #8adbf0;
    --series: #5cc8e3;
    --band: rgba(46, 160, 100, 0.2);
    --band-line: #7fdca9;
    --crit: #ff7a6e;
    --grid: #2a3946;
    --axis: #5b6d7c;
    --map-bg: #232f38;
    --shadow: rgba(0, 0, 0, 0.5);
    --focus: #5cc8e3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e151b;
  --surface: #17222b;
  --ink: #e9eef2;
  --ink-2: #c3ced8;
  --muted: #93a3b1;
  --border: #2a3946;
  --border-strong: #3a4b59;
  --field-border: #5b6d7c;
  --row-line: #223039;
  --nav: #0a1217;
  --nav-ink: #b7c5d1;
  --accent: #5cc8e3;
  --accent-hover: #86d9ee;
  --accent-ink: #08202a;
  --link: #6fd0e8;
  --ok-bg: #14382a;   --ok-ink: #7fdca9;
  --bad-bg: #4a1e1b;  --bad-ink: #ffb4ac;
  --warn-bg: #4a3811; --warn-ink: #ffd27a;
  --idle-bg: #26333d; --idle-ink: #c3ced8;
  --info-bg: #12384a; --info-ink: #8adbf0;
  --series: #5cc8e3;
  --band: rgba(46, 160, 100, 0.2);
  --band-line: #7fdca9;
  --crit: #ff7a6e;
  --grid: #2a3946;
  --axis: #5b6d7c;
  --map-bg: #232f38;
  --shadow: rgba(0, 0, 0, 0.5);
  --focus: #5cc8e3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 16px; margin-bottom: 12px; }
code, pre, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------- top navigation ---------- */
.nav {
  background: var(--nav); display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 0 24px;
}
.nav .brand {
  font-weight: 700; color: #fff; text-decoration: none; margin-right: 20px; padding: 14px 0; font-size: 17px;
  display: inline-flex; align-items: center; gap: 8px;
}
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--nav-accent); box-shadow: 0 0 0 3px rgba(92, 200, 227, 0.25); }
.nav a.l {
  color: var(--nav-ink); text-decoration: none; padding: 16px 12px 13px; font-size: 14px; border-bottom: 3px solid transparent;
}
.nav a.l:hover { color: #fff; }
.nav a.l.on { color: #fff; border-bottom-color: var(--nav-accent); font-weight: 600; }
.nav :focus-visible { outline-color: #fff; }
.nav .sp { flex: 1 1 16px; }
.nav .me { font-size: 13px; color: var(--nav-ink); padding: 8px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.nav .me .who { display: inline-flex; align-items: center; }
.nav .link-btn { color: var(--nav-ink); }
.nav .link-btn:hover { color: #fff; }
.tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 4px; margin-left: 6px; white-space: nowrap;
}
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--link); text-decoration: underline; font-size: 13px; }
.theme-btn {
  background: none; border: 1px solid rgba(201, 213, 223, 0.35); border-radius: 8px; width: 32px; height: 32px;
  color: var(--nav-ink); display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.theme-btn:hover { color: #fff; border-color: #fff; }
.live { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: var(--nav-ink); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #93a3b1; }
.live.on::before { background: #4cd48a; box-shadow: 0 0 0 3px rgba(76, 212, 138, 0.25); }
.live.off::before { background: #f5b83d; }

/* ---------- page layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head .muted { margin-top: 4px; font-size: 14px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.stack { display: grid; gap: 16px; }
.mb { margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card.flush { padding: 0; }
.card.accent { border-color: var(--accent); }
.card.danger { border-color: var(--bad-ink); }
.card.attention { border-color: var(--warn-ink); }
.card > h2:first-child, .card-title { margin: 0 0 12px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 14px 16px; }
.empty { max-width: 640px; margin: 40px auto; padding: 24px; }
.empty h1 { font-size: 22px; margin-bottom: 10px; }
.empty p { margin-bottom: 12px; color: var(--ink-2); }
.page-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; max-width: 1240px; margin: 0 auto; padding: 8px 24px 24px; color: var(--muted); font-size: 12.5px; }
.foot-note { margin: 20px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- buttons, chips, segmented switch, tabs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600; text-decoration: none; min-height: 38px;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.sec { background: var(--surface); color: var(--link); border-color: var(--accent); }
.btn.sec:hover:not(:disabled) { background: var(--info-bg); color: var(--link); border-color: var(--accent); }
.btn.end, .btn.danger { background: var(--surface); color: var(--bad-ink); border-color: var(--bad-ink); }
.btn.end:hover:not(:disabled), .btn.danger:hover:not(:disabled) { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }
.btn.sm { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px 3px 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--idle-bg); color: var(--idle-ink);
}
.chip::before { content: ""; width: 8px; height: 8px; background: currentColor; border-radius: 50%; flex: none; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.bad::before { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.warn::before { border-radius: 0; transform: rotate(45deg) scale(0.85); }
.chip.idle::before { background: transparent; border: 2px solid currentColor; }
.chip.info { background: var(--info-bg); color: var(--info-ink); }
.chip.info::before { border-radius: 1px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: var(--surface); padding: 9px 14px; font-size: 14px; color: var(--ink); }
.seg button:hover { background: var(--page); }
.seg button.on { background: var(--nav); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .seg button.on { background: var(--accent); color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: var(--accent); color: var(--accent-ink); } }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border-strong); margin-bottom: 16px; }
.tabs button { border: 0; background: transparent; padding: 11px 16px 9px; font-size: 14px; color: var(--ink-2); border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 10px; font-weight: 600; border: 1px solid; }
.banner.crit { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }
.banner.crit::before { content: "▲"; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.banner.warn::before { content: "◆"; }

/* ---------- forms ---------- */
.fgrid, .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.f, .field { display: block; font-size: 13px; font-weight: 600; min-width: 0; }
.f.wide, .field.wide { grid-column: 1 / -1; }
.f em, .field em { font-weight: 400; font-style: normal; color: var(--muted); }
.f input, .f select, .f textarea, .field input, .field select, .field textarea,
.inline-select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--field-border); border-radius: 8px;
  font-weight: 400; background: var(--surface); color: var(--ink); min-height: 38px;
}
.f textarea, .field textarea { min-height: 60px; resize: vertical; }
.f input[readonly] { background: var(--page); }
.inline-select { width: auto; min-width: 220px; margin-top: 4px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.form-error { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-ink); font-weight: 600; }
.form-error::before { content: "▲ "; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.note-line { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-ink); }
.note-line.bad { background: var(--bad-bg); color: var(--bad-ink); font-weight: 600; }
.note-line.bad::before { content: "▲ "; }
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.field-label-row { display: flex; align-items: center; gap: 8px; }

/* ---------- tables ---------- */
.scroll { overflow-x: auto; }
.scroll > table.grid { min-width: 760px; }   /* on a phone the table scrolls sideways instead of squeezing its columns */
table.grid.first-nowrap td:first-child { white-space: nowrap; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 12px; white-space: nowrap; vertical-align: bottom;
}
table.grid td { padding: 10px 12px; border-top: 1px solid var(--row-line); vertical-align: middle; }
table.grid tr.current td { background: var(--info-bg); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .sub { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.big-num { font-size: 17px; font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat .muted { display: block; }
.stat b { display: block; font-size: 30px; line-height: 1.1; }
.attention-list { display: grid; gap: 10px; font-size: 14px; }
.attention-list > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.attention-list .chip { flex: 0 0 auto; min-width: 108px; justify-content: center; }
.attention-list > div > div { flex: 1 1 260px; min-width: 0; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.tile .v { font-size: 28px; font-weight: 700; line-height: 1.2; margin: 4px 0; overflow-wrap: anywhere; }
.tile .v.small { font-size: 22px; }
.tile .unit { font-size: 0.5em; font-weight: 500; color: var(--muted); margin-left: 4px; }
.tile .note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.meter { height: 6px; border-radius: 3px; background: var(--border); margin-top: 8px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--series); width: 0; transition: width 0.4s; }
.meter-fill.low { background: #e0a100; }
.meter-fill.crit { background: var(--crit); }
.head-line { min-width: 0; }
.head-line .muted { font-size: 14px; margin-top: 6px; }
.status-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.ev { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; font-size: 14px; border-top: 1px solid var(--row-line); }
.ev:first-of-type { border-top: 0; }
.ev .when { margin-left: auto; color: var(--muted); white-space: nowrap; }
.ev .what { flex: 1 1 200px; min-width: 0; }
.btn-col { display: grid; gap: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key-line { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--series); border-radius: 2px; }
.key-line.bad { border-top-color: var(--crit); }
.key-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--series); }
.key-dot.bad { background: var(--crit); }
.sim-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 16px; }
.sim-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- chart ---------- */
.chart { position: relative; width: 100%; height: 300px; }
.chart svg { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.chart svg:focus-visible { outline-offset: -2px; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band { fill: var(--band); }
.chart .band-edge { stroke: var(--band-line); stroke-width: 1; stroke-dasharray: 4 3; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .band-label { fill: var(--ok-ink); font-size: 11.5px; font-weight: 600; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-bad { fill: none; stroke: var(--crit); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .dot.bad { fill: var(--crit); }
.chart .end-label { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; }
.chart .empty-msg { fill: var(--muted); font-size: 13px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; box-shadow: 0 6px 20px var(--shadow); font-size: 12.5px;
}
.tooltip .tt-time { color: var(--muted); }
.tooltip .tt-value { display: flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 700; margin: 2px 0; }
.tooltip .tt-key { display: inline-block; width: 12px; border-top: 3px solid var(--series); }
.tooltip .tt-row { color: var(--muted); }
.tooltip .tt-status { font-weight: 600; margin-top: 2px; }
.table-wrap { max-height: 300px; overflow: auto; }
.table-wrap table.grid th { position: sticky; top: 0; background: var(--surface); }

/* ---------- map ---------- */
.map { position: relative; height: 300px; overflow: hidden; background: var(--map-bg); border-radius: 8px; touch-action: none; cursor: grab; }
.map:active { cursor: grabbing; }
.smap-tiles { position: absolute; inset: 0; }
.smap-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; }
.smap-tile.failed { visibility: hidden; }
:root[data-theme="dark"] .smap-tile { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .smap-tile { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9); }
}
.smap-overlay { position: absolute; inset: 0; pointer-events: none; }
.smap-overlay .trail { fill: none; stroke: var(--series); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; opacity: 0.95; }
.smap-overlay .trail-bad { fill: none; stroke: var(--crit); stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round; }
.smap-overlay .start { fill: var(--surface); stroke: var(--series); stroke-width: 3; }
.smap-overlay .acc { fill: var(--band); stroke: var(--series); stroke-width: 1; }
.smap-overlay .acc.bad { fill: var(--bad-bg); stroke: var(--crit); }
.smap-overlay .me { fill: var(--series); stroke: var(--surface); stroke-width: 3; }
.smap-overlay .me.bad { fill: var(--crit); }
.smap-overlay .pulse { fill: var(--series); opacity: 0.35; transform-box: fill-box; transform-origin: center; animation: pulse 2s ease-out infinite; }
.smap-overlay .pulse.bad { fill: var(--crit); }
@keyframes pulse { from { transform: scale(0.6); opacity: 0.45; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .smap-overlay .pulse { animation: none; } }
.smap-ctl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.smap-ctl button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1;
}
.smap-ctl button.fit { font-size: 12px; }
.smap-attrib { position: absolute; left: 0; bottom: 0; padding: 2px 6px; font-size: 10.5px; background: rgba(255, 255, 255, 0.78); color: #333; border-top-right-radius: 6px; }
.smap-attrib a { color: inherit; }

/* ---------- dialog, invite box ---------- */
.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink); box-shadow: 0 16px 48px var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.dialog h2 { margin-bottom: 6px; }
.dialog .hint { margin-bottom: 12px; }
.dialog-fields { display: flex; flex-direction: column; gap: 12px; }
.result-box { margin: 12px 0; padding: 12px; border-radius: 10px; background: var(--page); border: 1px solid var(--border); }
#pwResult { margin: 8px 0 0; padding: 0; border: 0; background: none; }
.result-box > p { margin-bottom: 8px; }
.result-box > p:last-child { margin-bottom: 0; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
textarea.invite { width: 100%; font-size: 12.5px; line-height: 1.5; resize: none; background: var(--surface); border: 1px solid var(--field-border); border-radius: 8px; padding: 8px; }
.code { background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow: auto; font-size: 12.5px; max-height: 300px; }

/* ---------- sign-in page ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); padding: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 32px var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.login-brand .brand-mark { background: var(--accent); box-shadow: 0 0 0 3px var(--info-bg); }
.login-card h1 { font-size: 22px; margin-bottom: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-submit { margin-top: 6px; width: 100%; }
.login-help { margin-top: 16px; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .nav { padding: 0 12px; }
  .nav .sp { flex-basis: 100%; height: 0; }
  .wrap { padding: 16px; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .wrap { padding: 12px 16px; }
  .nav a.l { padding: 12px 8px 10px; font-size: 13px; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { margin-top: 8px; font-size: 12px; }
  .chart, .map { height: 260px; }
  .seg button { padding: 8px 10px; }
  .tabs button { padding: 10px 10px 8px; }
  .page-foot { padding: 8px 16px 20px; }
}
