/*
 * Moserwood - After Hours (CH-395 W1, TST_PROPERTY_DASHBOARD_SPEC.md section 7).
 * Dark-first; light mode by prefers-color-scheme or data-theme="light";
 * data-night="1" dims the dark theme. W8 (TST_GUEST_PORTAL_SPEC.md 17.1):
 * the theme switch's positions on every mw layout - Day = data-theme light,
 * Dark = data-theme dark, Night = dark plus data-night (a 60 percent
 * overlay, the tablet's dim, which a touch lifts for 60 s: data-dim-lift);
 * unset = no data-theme, the device decides. 2 px corners, hairline
 * borders, a double brass hairline on featured tiles only, no shadows, no
 * texture. Status is shape + text label, never colour alone.
 */

@font-face {
  font-family: "Bodoni Moda";
  src: url("fonts/bodoni-moda-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0C1320;
  --surface: #131D30;
  --surface2: #1B283F;
  --ink: #F2EBDD;
  --muted: #9BA5B6;
  --line: #27354E;
  --brand: #C9A55A;
  --brand-ink: #0C1320;
  --accent: #C9A55A;
  --ok: #6FCB91;
  --warn: #FF8A3D;
  --bad: #FF7B6C;
  --stale: #7D879A;
  --yellow: #F5C542;   /* IOTS-GUI-02 3d: AQI Unhealthy for Sensitive Groups, 10.4:1 on the surface */
  --logo-dark: inline;
  --logo-light: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F5F1E8;
    --surface: #FFFFFF;
    --surface2: #ECE6D9;
    --ink: #111A2B;
    --muted: #566073;
    --line: #D8D0BF;
    --brand: #14213D;
    --brand-ink: #F5F1E8;
    --accent: #86651F;
    --ok: #1F7047;
    --warn: #A34E00;
    --bad: #B3261E;
    --stale: #6F7585;
    --yellow: #806B00;   /* 5.2:1 on the light surface */
    --logo-dark: none;
    --logo-light: inline;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F5F1E8;
  --surface: #FFFFFF;
  --surface2: #ECE6D9;
  --ink: #111A2B;
  --muted: #566073;
  --line: #D8D0BF;
  --brand: #14213D;
  --brand-ink: #F5F1E8;
  --accent: #86651F;
  --ok: #1F7047;
  --warn: #A34E00;
  --bad: #B3261E;
  --stale: #6F7585;
  --yellow: #806B00;
  --logo-dark: none;
  --logo-light: inline;
  color-scheme: light;
}
/* W8 Night: the dark tokens under the 60 percent dim (dashboard spec 23.5), never in the way of a touch. */
:root[data-night="1"]:not([data-dim-lift="1"]) body::after { content: ""; position: fixed; inset: 0; background: #000; opacity: 0.6; pointer-events: none; z-index: 1000; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Jost", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: "Bodoni Moda", Georgia, serif; font-weight: 500; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin: 28px 0 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }

/* Header */
.hdr { border-bottom: 1px solid var(--line); background: var(--surface2); }
.hdr .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.hdr img.mark { width: 31px; height: 40px; }
.mark-dark { display: var(--logo-dark); }
.mark-light { display: var(--logo-light); }
.wordmark { font-family: "Bodoni Moda", Georgia, serif; font-weight: 600; text-transform: uppercase; letter-spacing: 0.32em; font-size: 1rem; }
.hdr .spacer { flex: 1; }
.hdr form { margin: 0; }
.hdr .btn { padding: 0 12px; }
@media (max-width: 480px) { .hdr .wordmark { letter-spacing: 0.2em; font-size: 0.9rem; } .hdr .btn { padding: 0 10px; letter-spacing: 0.08em; } }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; color: var(--muted); text-decoration: none; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.8rem; font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .sep { width: 1px; background: var(--line); margin: 10px 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 48px; padding: 0 20px; border-radius: 2px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.8rem; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* Status strip */
.strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); font-size: 0.9rem; }
.chip .k { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; }

/* Tiles */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 14px 16px; min-height: 96px; }
.tile.featured { border: 3px double var(--accent); }
.tile .lbl { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; font-weight: 500; }
.tile .val { font-size: 1.6rem; font-weight: 500; margin: 6px 0 4px; overflow-wrap: anywhere; }
.tile .note { color: var(--muted); font-size: 0.85rem; }
.tile[data-state="stale"] .val, .tile[data-state="nodata"] .val { color: var(--muted); }
.tile[data-state="nodata"] .val { font-size: 1.05rem; font-style: italic; }
.zone h3 { font-size: 1.1rem; margin-bottom: 8px; }
.list .tile { min-height: 0; }

/* Status marker: dot = ok, triangle = warn, square = alert, hollow ring = stale, dash = no data */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.st::before { content: ""; display: inline-block; width: 10px; height: 10px; flex: none; }
.st[data-state="ok"]::before     { background: var(--ok); border-radius: 50%; }
.st[data-state="warn"]::before   { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--warn); }
.st[data-state="alert"]::before  { background: var(--bad); }
.st[data-state="stale"]::before  { border: 2px solid var(--stale); border-radius: 50%; }
.st[data-state="nodata"]::before { height: 2px; background: var(--stale); }
.st[data-state="ok"] { color: var(--ok); }
.st[data-state="warn"] { color: var(--warn); }
.st[data-state="alert"] { color: var(--bad); }
.st[data-state="stale"], .st[data-state="nodata"] { color: var(--stale); }

/* Controls (W2): a .ctl block of rows, its outcome line beneath */
.ctl { margin: 12px 0 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; }
.ctl .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.ctl .row[hidden], .ctl p[hidden] { display: none; }
.ctl .k { min-width: 64px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; }
.ctl label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.ctl input[type="number"] { width: 92px; min-height: 48px; padding: 8px 10px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; font-size: 1.05rem; }
.ctl select { min-height: 48px; max-width: 100%; padding: 8px 10px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; text-transform: none; letter-spacing: 0; }
.btn[disabled], .ctl input[disabled], .ctl select[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[aria-pressed="true"] { outline: 1px solid var(--accent); outline-offset: 2px; }
.cmdst { min-height: 1.2em; }
.cmdst:empty::before, .cmdst[data-state=""]::before { display: none; }
.ctl.is-stale::after { content: "Stale - controls off until fresh data"; display: block; color: var(--stale); font-size: 0.8rem; }
.stack { display: flex; flex-direction: column; }
.stack .ctl { margin-top: 0; border-top: 0; }
.small { font-size: 0.85rem; }

/* Forms (sign-in) */
.card { max-width: 420px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 28px 24px; }
.card .emblem-wrap { text-align: center; margin-bottom: 8px; }
.card .emblem { width: 160px; height: auto; vertical-align: top; }
.card .wordmark { display: block; text-align: center; margin-bottom: 20px; }
label { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; margin: 14px 0 6px; }
input[type="text"], input[type="password"] { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; font-size: 1.05rem; }
input[type="checkbox"] { width: 22px; height: 22px; vertical-align: middle; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--ink); }
.msg { border: 1px solid var(--bad); color: var(--bad); padding: 10px 12px; border-radius: 2px; margin-bottom: 14px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; background: var(--surface2); padding: 8px 10px; border-radius: 2px; }
.codes { columns: 2; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; }
.muted { color: var(--muted); }

/* W5 weather (spec 17): advisory line, card, icons. Status stays shape + label. */
.advisory { margin: 16px 0 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; }
.advisory .adv { display: flex; align-items: baseline; gap: 10px; margin: 4px 0; }
.advisory .adv[data-state="alert"] .t { color: var(--bad); }
.advisory .adv[data-state="warn"] .t { color: var(--warn); }
.advisory .adv[data-state="ok"] .t { color: var(--ok); }
.advisory .psps { margin: 6px 0 0; font-size: 0.85rem; }
.wx-card { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.wx-col h3 { font-size: 1.1rem; margin-bottom: 8px; }
.wx-col h3 .wx-src { font-family: "Jost", system-ui, sans-serif; font-size: 0.75rem; font-weight: 400; letter-spacing: 0.04em; margin-left: 6px; }
.wx-days { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.wx-days .tile { min-height: 0; padding: 10px; }
.wx-days .tile .val { font-size: 1.05rem; }
.wx-days .tile .note { font-size: 0.75rem; }
.tile.wx { position: relative; }
.wx-icon { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.wx-days .wx-icon { width: 20px; height: 20px; top: 8px; right: 8px; }
.tile[data-unverified="1"] .val { color: var(--stale); }
.updated { color: var(--muted); font-size: 0.8rem; margin-top: 24px; }

/* W7a (TST_GUEST_PORTAL_SPEC.md sections 2, 5, 6): View as, the preview
   banner, the guest pages and the content editor. Phone first. */
.preview-banner { background: var(--surface); border-bottom: 3px double var(--warn); }
.preview-banner .wrap { padding-top: 8px; padding-bottom: 8px; }
.pv-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pv-text { color: var(--warn); font-weight: 500; }
.pv-text::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: 8px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--warn); }
.pv-cabin { color: var(--muted); font-size: 0.9rem; }
.pv-exit { margin: 0; }
.pv-switch { flex-basis: 100%; }
.pv-switch > summary, .hdr .viewas > summary { list-style: none; display: inline-flex; }
.pv-switch > summary::-webkit-details-marker { display: none; }
.pv-switch:not([open]) { flex-basis: auto; }
.viewas-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; }
.viewas-form label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.viewas-form select, .gc-preview select { min-height: 48px; padding: 8px 10px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; }
.hdr .viewas { position: relative; }
.hdr .viewas > summary { list-style: none; }
.hdr .viewas > summary::-webkit-details-marker { display: none; }
.hdr .viewas[open] .viewas-form { position: absolute; right: 0; z-index: 10; min-width: 280px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; }
.hello { color: var(--muted); font-size: 0.95rem; }
body[data-preview] [data-cmd][aria-disabled="true"], body[data-inert] [data-cmd][aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

.g-title { margin: 24px 0 4px; }
.g-dates, .g-next { margin: 8px 0 0; font-size: 1.05rem; }
.gc { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 14px 16px; margin: 12px 0 0; }
.gc h3 { font-size: 1.05rem; margin-bottom: 6px; }
.gc-body { overflow-wrap: anywhere; }
.gc-map { margin: 8px 0 0; }
.gc-empty { margin: 8px 0 0; }

.gc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 28px 0 0; }
.gc-head h2 { margin: 0; }
.gc-preview { display: flex; gap: 8px; align-items: center; margin: 0; }
.gc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.gc-actions form { margin: 0; }
.gc-form { margin: 10px 0 0; }
.gc-form > summary { list-style: none; display: inline-flex; }
.gc-form > summary::-webkit-details-marker { display: none; }
.gc-form form { margin-top: 8px; }
.gc-form textarea, .gc-form select { width: 100%; padding: 10px 12px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; font-size: 1rem; }
.gc-form select { min-height: 48px; }
.gc-form .btn[type="submit"] { margin-top: 12px; }
.hint { text-transform: none; letter-spacing: 0; color: var(--muted); }
.badge { color: var(--warn); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; }
.flash { border: 1px solid var(--line); padding: 10px 12px; border-radius: 2px; }
.flash[data-kind="success"] { border-color: var(--ok); color: var(--ok); }
.flash[data-kind="error"] { border-color: var(--bad); color: var(--bad); }

/* W7b (TST_GUEST_PORTAL_SPEC.md section 4): the Guests pages. */
.gform input[type="email"], .gform input[type="tel"], .gform input[type="date"], .gform input[type="time"],
.gform input[type="number"], .gform input[type="text"], .gform textarea, .gform select,
.gl-filter input[type="text"] { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; font-size: 1rem; }
.gform .row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gform .btn[type="submit"] { margin-top: 14px; }
.gl-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0 12px; }
.gl-filter label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; flex: 1 1 220px; }
.chip-f[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.gl-row { display: block; text-decoration: none; color: inherit; }
.g-checkout { margin: 8px 0 0; padding: 10px 12px; border: 3px double var(--accent); border-radius: 2px; font-weight: 500; }
.strip-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.cabin-strip { display: grid; grid-template-columns: 112px repeat(var(--cols), 14px); grid-auto-rows: 36px; align-items: center; min-width: max-content; padding: 6px 0; }
.cs-label { grid-column: 1; padding: 0 10px; color: var(--muted); font-size: 0.8rem; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cs-day { grid-row: 1; font-size: 0.7rem; color: var(--muted); text-align: left; border-left: 1px solid var(--line); padding-left: 2px; }
.cs-day[data-month] { color: var(--accent); }
.cs-bar { display: block; min-height: 26px; margin: 0 1px; padding: 4px 6px; border-radius: 2px; background: var(--brand); color: var(--brand-ink); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cs-bar.turnover { outline: 1px dashed var(--accent); outline-offset: -1px; }

/* W8 (TST_GUEST_PORTAL_SPEC.md 17.1): the theme switch - three positions, one 48 px control. */
.theme-switch { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; padding: 0 4px; background: transparent; border: 0; cursor: pointer; color: var(--ink); }
.ts-track { position: relative; display: inline-grid; grid-template-columns: repeat(3, 32px); grid-auto-flow: column; grid-template-rows: 36px; align-items: center; width: 98px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.ts-thumb { position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--accent); transition: transform 0.15s; }
.ts-g { position: relative; width: 18px; height: 18px; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
:root[data-theme-pos="dark"] .ts-thumb, :root[data-theme-pos="auto"] .ts-thumb, .theme-switch[data-pos="dark"] .ts-thumb { transform: translateX(32px); }
:root[data-theme-pos="night"] .ts-thumb, .theme-switch[data-pos="night"] .ts-thumb { transform: translateX(64px); }
:root[data-theme-pos="day"] .ts-thumb, .theme-switch[data-pos="day"] .ts-thumb { transform: translateX(0); }
@media (prefers-color-scheme: light) { :root[data-theme-pos="auto"] .ts-thumb { transform: translateX(0); } }
.theme-switch[data-pos="day"] .ts-day, .theme-switch[data-pos="dark"] .ts-dark, .theme-switch[data-pos="night"] .ts-night { color: var(--accent); }

/* IOTS-GUI-02 step 3: the instrument strip (revises GUI-01 B1) - guest Welcome,
   guest outside-stay Weather, tablet Home. ONE continuous strip, ONE row at
   every width: the surface, a brass hairline above and below, line-token
   dividers, six equal cells of one height (92 px; 64 px under 600 px, where
   the short titles and notes take over). Title, value, note - in that order. */
.instrument { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 92px; margin: 16px 0 8px; background: var(--surface); border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }
.instrument .cell { position: relative; min-width: 0; height: 92px; overflow: hidden; padding: 8px 10px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.instrument .cell:first-child { border-left: 0; }
.instrument .ct { color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.68rem; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; }
.instrument .cv { font-size: 1.5rem; font-weight: 500; line-height: 1.15; margin-top: 4px; white-space: nowrap; overflow: hidden; }
.instrument .cn { margin-top: auto; color: var(--muted); font-size: 0.75rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.instrument .sm { display: none; }
.instrument .sg.lo { color: var(--muted); }
.instrument .sg.ampm { font-size: 0.6em; }
.instrument .sg.cat { font-size: 0.75rem; font-weight: 400; }
.instrument .sg.ln { display: block; font-size: 0.95rem; line-height: 1.2; white-space: normal; }
.instrument .sg.ln::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; }
.instrument .sg.ln[data-k="ok"] { color: var(--ok); }
.instrument .sg.ln[data-k="ok"]::before { background: var(--ok); border-radius: 50%; }
.instrument .sg.ln[data-k="warn"] { color: var(--warn); }
.instrument .sg.ln[data-k="warn"]::before { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--warn); }
.instrument .sg.ln[data-k="alert"] { color: var(--bad); }
.instrument .sg.ln[data-k="alert"]::before { background: var(--bad); }
.instrument .cell[data-tone="ok"] .cv { color: var(--ok); }
.instrument .cell[data-tone="ink"] .cv { color: var(--ink); }
.instrument .cell[data-tone="yellow"] .cv { color: var(--yellow); }
.instrument .cell[data-tone="bad"] .cv { color: var(--bad); }
.instrument .cell[data-state="stale"] .cv, .instrument .cell[data-state="nodata"] .cv, .instrument .cell[data-state="stale"] .sg.ln { color: var(--muted); }
.instrument .cell[data-state="stale"] .ct::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border: 1.5px solid var(--stale); border-radius: 50%; }
/* NOW: the picture beside the temperature, the full cell height; the badges on it. */
.instrument .cell[data-cell="now"] { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; column-gap: 6px; }
.instrument .cell[data-cell="now"] .ct, .instrument .cell[data-cell="now"] .cv { grid-column: 1; }
.instrument .cell[data-cell="now"] .cn { grid-column: 1; align-self: end; }
.instrument .cp { grid-column: 2; grid-row: 1 / -1; display: flex; align-items: flex-start; justify-content: center; min-width: 0; }
.instrument .cp .wx-icon { position: static; width: 40px; height: 40px; color: var(--ink); }
.instrument .bn-badges { position: absolute; right: 6px; bottom: 6px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; max-width: calc(100% - 12px); overflow: hidden; }
.instrument .bn-badges .badge { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 0 4px; letter-spacing: 0.04em; font-size: 0.6rem; line-height: 1.4; white-space: nowrap; color: var(--ink); }
.instrument .bn-badges .badge[data-kind="raining"], .instrument .bn-badges .badge[data-kind="rain"] { color: var(--accent); }
.instrument .bn-badges .badge[data-kind="wind"] { color: var(--warn); }
.instrument .cn a { color: var(--accent); }
@media (max-width: 899px) {
  .instrument .cell { padding: 7px 6px; }
  .instrument .ct { font-size: 0.6rem; letter-spacing: 0.08em; }
  .instrument .cv { font-size: 1.15rem; }
  .instrument .cn { font-size: 0.66rem; line-height: 1.15; -webkit-line-clamp: 3; }
  .instrument .sg.ln { font-size: 0.8rem; }
  .instrument .cp .wx-icon { width: 30px; height: 30px; }
  .instrument .bn-badges .badge { font-size: 0.5rem; padding: 0 3px; letter-spacing: 0.02em; }
}
@media (max-width: 599px) {
  .instrument { grid-template-rows: 64px; }
  .instrument .cell { height: 64px; padding: 5px 4px; }
  .instrument .lg { display: none; }
  .instrument .sm { display: inline; }
  .instrument .ct { font-size: 0.56rem; letter-spacing: 0.06em; }
  .instrument .cv { font-size: 0.9rem; margin-top: 2px; letter-spacing: -0.01em; }
  .instrument .cn { font-size: 0.6rem; line-height: 1.15; }
  .instrument .sg.cat { display: none; }
  .instrument .sg.ln { font-size: 0.68rem; line-height: 1.1; }
  .instrument .sg.ln::before { width: 6px; height: 6px; margin-right: 3px; }
  .instrument .sg.ln[data-k="warn"]::before { width: 0; height: 0; border-left-width: 4px; border-right-width: 4px; border-bottom-width: 7px; }
  .instrument .cell[data-cell="now"] { column-gap: 2px; }
  .instrument .cn { -webkit-line-clamp: 2; }
  .instrument .cp .wx-icon { width: 20px; height: 20px; }
  .instrument .bn-badges { right: 2px; bottom: 2px; max-width: calc(100% - 4px); flex-direction: row; flex-wrap: nowrap; }
  .instrument .bn-badges .badge { font-size: 0.48rem; padding: 0 2px; letter-spacing: 0; }
}

/* IOTS-GUI-06 step 1: the strip packed. Replaces GUI-05 5c's grow-to-fill rule: every cell reads
   title, value, note stacked with small even gaps (3 px) and a tight line height, so the line box
   hugs the digits; the strip is as tall as its tallest cell needs plus the padding, the cells
   stretch to it, and any leftover sits BELOW a shorter cell's last line, never between title, value
   and note. GUI-05's larger value for a cell with no note stays (a cell whose note is empty hides
   it). NOW: the picture runs the cell's full inner height beside the temperature. */
.instrument { grid-template-rows: auto; align-items: stretch; }
.instrument .cell { height: auto; padding: 6px 10px; }
.instrument .ct { line-height: 1.2; }
.instrument .cv { line-height: 0.8; margin-top: 1px; overflow-x: clip; overflow-y: visible; }
.instrument .cn { margin-top: 1px; line-height: 1.05; }
.instrument .cell:not([data-cell="tmrw"]):has(> .cn:empty) > .cn { display: none; }
.instrument .cell:not([data-cell="tmrw"]):has(> .cn:empty) > .cv { font-size: 2.25rem; line-height: 0.8; }
.instrument .sg.ln { line-height: 0.8; }
/* GUI-06 step 2: WARNINGS' value ("None", or a warning's text) at TOMORROW's value size. */
.instrument .cell[data-cell="alerts"] .sg.ln { font-size: 1em; }
.instrument .cell[data-cell="alerts"] .sg.ln[data-k="warn"], .instrument .cell[data-cell="alerts"] .sg.ln[data-k="alert"] { font-size: 0.8em; line-height: 1.1; }
.instrument .sg.ln::before { vertical-align: 2px; }
.instrument .cell[data-cell="now"] { --pw: 52px; grid-template-columns: minmax(0, 1fr) var(--pw); grid-template-rows: auto auto 1fr; column-gap: 4px; }
.instrument .cell[data-cell="now"] > .cn { align-self: start; }
.instrument .cp { grid-column: 2; grid-row: 1 / -1; position: relative; display: block; width: var(--pw); }
.instrument .cp .wx-icon { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Under 900 px a cell is a sixth of the page: the larger value follows the cell's width (about 4 em of
   "65 / 53" fits), capped, so it never clips. */
@media (max-width: 899px) {
  .instrument .cell { padding: 5px 6px; }
  .instrument .cell:not([data-cell="tmrw"]):has(> .cn:empty) > .cv { font-size: clamp(1.15rem, calc((100vw - 32px) / 27), 1.6rem); line-height: 0.8; }
  .instrument .cell[data-cell="now"] { --pw: 40px; }
}
@media (max-width: 599px) {
  .instrument .cell { padding: 4px 4px; }
  .instrument .cv { margin-top: 1px; }
  .instrument .cn { margin-top: 1px; display: block; white-space: nowrap; overflow: hidden; font-size: 0.56rem; letter-spacing: -0.01em; }
  .instrument .cell:not([data-cell="tmrw"]):has(> .cn:empty) > .cv { font-size: clamp(0.8rem, calc((100vw - 32px) / 24), 1.1rem); line-height: 0.8; }
  .instrument .cell[data-cell="now"] { --pw: 22px; column-gap: 2px; }
  /* HIGH/LOW and TOMORROW ("65 / 53") clipped 2 px at 375 as shipped: tighter spacing, same size. */
  .instrument .cell[data-cell="hilo"] .cv, .instrument .cell[data-cell="tmrw"] .cv { letter-spacing: -0.03em; word-spacing: -0.18em; }
}

/* IOTS-GUI-07: the NOW badges are drawn whole. They were boxed to the picture's width (52 / 40 / 22 px) with
   overflow hidden, and a right-aligned flex item overflows to the LEFT, so "Raining" read "AINING". Now each badge
   is its own width, stacked at the picture's bottom right, and may run left over the (short) note area; the cell
   still clips, so the cell must hold the widest badge. Under 600 px only the first badge (wind, GUI-02 D7's top
   rank) shows rather than two that do not fit. */
.instrument .bn-badges { right: 0; bottom: 0; left: auto; width: max-content; max-width: none; overflow: visible; flex-direction: column; flex-wrap: nowrap; align-items: flex-end; }
.instrument .bn-badges .badge { flex: 0 0 auto; overflow: visible; }
@media (max-width: 899px) { .instrument .bn-badges .badge { font-size: 0.5rem; } }
@media (max-width: 599px) {
  .instrument .bn-badges { right: 0; max-width: none; flex-direction: column; }
  .instrument .bn-badges .badge { font-size: 0.46rem; padding: 0 2px; }
  .instrument .bn-badges .badge:nth-child(n+2) { display: none; }
}

/* IOTS-GUI-06 step 3 (phone fit, guest and tablet - body[data-quiet]): a time never breaks inside
   (the server and household.js set a no-break space before am / pm); the header is ONE line; the
   tab menu is ONE row. */
body[data-quiet] .hdr-date, body[data-quiet] .ampm { white-space: nowrap; }
@media (max-width: 599px) {
  body[data-quiet] .hello { display: none; }
  body[data-quiet] .hdr .wrap { flex-wrap: nowrap; gap: 8px; padding-left: 12px; padding-right: 12px; }
  body[data-quiet] .hdr .wordmark { font-size: 0.8rem; letter-spacing: 0.14em; }
  body[data-quiet] .home-link { gap: 8px; min-width: 0; }
  body[data-quiet] .tabs { flex-wrap: nowrap; gap: 0; }
  body[data-quiet] .tabs li { flex: 1 1 0; min-width: 0; display: flex; }
  body[data-quiet] .tabs a { flex: 1 1 auto; justify-content: center; text-align: center; padding: 4px 2px; min-height: 48px; font-size: 0.6rem; letter-spacing: 0.04em; line-height: 1.2; overflow-wrap: break-word; }
}

/* IOTS-GUI-02 3a: the date in the header, immediately left of the theme switch. Step 4: the
   header's right-hand group (View as, date, switch, Sign out) is ONE unbroken line down to
   375 px - it moves under the shield as a whole; View as is an icon-sized button under 600 px. */
.hdr-right { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: nowrap; white-space: nowrap; }
.hdr-date { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.04em; white-space: nowrap; }
.hdr .viewas .va-icon { display: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 599px) {
  .hdr-right { gap: 4px; }
  .hdr-date { font-size: 0.78rem; letter-spacing: 0; }
  .hdr .viewas > summary { padding: 0; width: 44px; min-width: 44px; }
  .hdr .viewas .va-text { display: none; }
  .hdr .viewas .va-icon { display: inline; }
  .hdr .theme-switch { padding: 0; }
  .hdr .hdr-right .btn { padding: 0 8px; letter-spacing: 0.06em; }
}

/* IOTS-GUI-01 A2: the shield and wordmark are one link home. */
.home-link { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-height: 48px; }

/* IOTS-GUI-01 C8: guest and tablet pages draw only a problem state - no OK chip. */
body[data-quiet] .st[data-state="ok"], body[data-quiet] .st[data-state=""] { display: none; }
.tile[data-muted="1"] .val { color: var(--muted); font-size: 1rem; font-weight: 400; }

/* W8 (17.3, 17.4): Property info - jump links, sections; the composite pair; guide links. */
/* IOTS-GUI-05 step 2c: the section links are a row of tiles on every layout (guest and tablet),
   wrapping to more rows on a narrow screen; each tile at least 48 px tall. */
.jump ul { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.jump a { display: flex; align-items: center; min-height: 56px; height: 100%; box-sizing: border-box; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; text-decoration: none; color: var(--ink); font-family: "Bodoni Moda", Georgia, serif; font-size: 1rem; line-height: 1.25; }
.jump a:hover, .jump a:focus-visible { border-color: var(--accent); color: var(--accent); }
@media (max-width: 599px) { .jump ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } .jump a { min-height: 48px; font-size: 0.95rem; } }
.info-section { scroll-margin-top: 12px; }
.info-cabin { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; margin: 16px 0 4px; }
.composite .row { display: flex; flex-wrap: wrap; gap: 12px; }
.composite .btn { flex: 1 1 220px; }
.guide-link { margin: 16px 0 0; }
.gc-towrite { margin-left: auto; margin-right: 12px; }
.gc-paste-preview { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.9rem; }
.gc-paste-preview th, .gc-paste-preview td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

/* IOTS-GUI-08: the strip's cell layout. Every cell: title where it was, the note on the bottom edge (last line at
   the bottom padding), the value centred in the gap between them (or between the title and the bottom padding
   when the cell has no note: its empty note is display none). NOW is the same stack - the weather in words is its
   note - with the picture lifted out of the flow and centred vertically beside it. TOMORROW's note steps down in
   size so the whole forecast shows, two lines at most; under 900 px (cells too narrow for that sentence) the short
   form shows, as do NOW's words without the wind suffix. */
.instrument .cell { display: flex; flex-direction: column; }
.instrument .cv { margin-top: auto; margin-bottom: auto; }
.instrument .cn { margin-top: 0; margin-bottom: 0; flex: 0 0 auto; display: block; white-space: nowrap; overflow: hidden; -webkit-line-clamp: unset; text-overflow: clip; }
.instrument .cell[data-cell="now"] { display: flex; flex-direction: column; }
.instrument .cell[data-cell="now"] > .ct, .instrument .cell[data-cell="now"] > .cv, .instrument .cell[data-cell="now"] > .cn { grid-column: auto; grid-row: auto; align-self: auto; }
.instrument .cell[data-cell="now"] > .cn { padding-right: calc(var(--pw) + 4px); font-size: 0.68rem; }
.instrument .cell[data-cell="now"] > .cv { padding-right: calc(var(--pw) + 4px); }
.instrument .cell[data-cell="now"] > .cp { position: absolute; grid-column: auto; grid-row: auto; right: 10px; top: 50%; transform: translateY(-50%); width: var(--pw); height: calc(100% - 12px); display: block; }
.instrument .cell[data-cell="tmrw"] > .cn { white-space: normal; font-size: 0.62rem; line-height: 1.05; }
@media (max-width: 899px) {
  .instrument .cell[data-cell="now"] > .cp { right: 6px; height: calc(100% - 10px); }
  .instrument .cell[data-cell="now"] > .cn { white-space: normal; font-size: 0.56rem; }
  .instrument .cell[data-cell="now"] > .cn .lg, .instrument .cell[data-cell="tmrw"] > .cn .lg { display: none; }
  .instrument .cell[data-cell="now"] > .cn .sm, .instrument .cell[data-cell="tmrw"] > .cn .sm { display: inline; }
  .instrument .cell[data-cell="tmrw"] > .cn { font-size: 0.56rem; }
}
@media (max-width: 599px) {
  .instrument .cell[data-cell="now"] > .cp { right: 4px; height: calc(100% - 8px); }
  .instrument .cell[data-cell="now"] > .cn { font-size: 0.5rem; letter-spacing: 0; padding-right: 0; white-space: nowrap; }
}
/* GUI-08 fit: TOMORROW's two-line note is never clipped by its own box; the larger no-note value sits 1 px
   high (its glyphs' ink centre runs low in the line box); HIGH / LOW and TOMORROW step down under 900 px so
   "66° / 47°" never clips. */
.instrument .cell[data-cell="tmrw"] > .cn { overflow: visible; }
@media (min-width: 900px) { .instrument .cell[data-cell="tmrw"] > .cv { position: relative; top: -4px; } .instrument .cell[data-cell="sun"] > .cv { position: relative; top: -1px; } .instrument .cell { min-height: 71px; } .instrument .cell:has(> .cn:empty) > .cv { position: relative; top: -1px; } }   /* room for TOMORROW's two-line note; the strip is 73 px, as measured live */
@media (max-width: 899px) {
  .instrument .cell[data-cell="hilo"] .cv, .instrument .cell[data-cell="tmrw"] .cv { font-size: clamp(0.6rem, calc(100vw / 44), 1.5rem) !important; }   /* !important: beats the empty-note larger-value rule's specificity */
}
