/* ws-ui.css — the components every WorldSensor page is built from.
 * ═══════════════════════════════════════════════════════════════════
 * Linked AFTER ws-tokens.css. Only things that are genuinely the same in
 * more than one page live here: the header and the phone tab bar, buttons,
 * fields, cards and grouped rows, tables, pills, the switch and the stepper,
 * the modal, the flash hint, floating map furniture, and the rule that hides
 * retired features. Page layout stays in each page's own <style>.
 *
 * The vocabulary is the Garver360 Tracker app's (docs/DESIGN.md): grouped
 * rows with an icon tile, 14px fields and primary buttons, 16px groups, a
 * bottom tab bar on phones, pills floating over the map.
 */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
/* The browser's own surfaces carry the palette too. */
::selection { background: var(--accent-tint-2); color: var(--text); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-tint-3); outline-offset: 1px; border-color: var(--accent);
}
.tabular, .ws-num { font-variant-numeric: tabular-nums; }
.sub { color: var(--text-muted); font-size: var(--size-caption); }
svg { flex: none; }

/* ── The header (row 1, desks and tablets) ───────────────────────────
 * 52px, the wordmark, the sections, a spacer, the page's tools, the account
 * pill. Collapses by measurement (WS.fitHeader): first the button labels go,
 * then the sections fold behind a menu button. On a phone the sections move
 * to the tab bar instead (below) and the bar keeps only the wordmark, the
 * page's tools and the menu. */
.ws-hdr {
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 18px; flex-shrink: 0;
  position: relative; z-index: 200;
}
.ws-hdr .hdr-logo {
  font-weight: var(--weight-semibold); font-size: var(--size-row); color: var(--text); letter-spacing: -.01em;
  white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer;
}
.ws-hdr .hdr-logo:hover { text-decoration: none; color: var(--accent-ink); }
.ws-hdr .hdr-logo .mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent-tint); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ws-hdr .hdr-logo .mark svg { width: 15px; height: 15px; }
.ws-hdr .hdr-grow { flex: 1; min-width: 6px; }
.ws-nav { display: flex; gap: 2px; align-items: center; flex-shrink: 0; }
.ws-nav-item {
  font-size: var(--size-small); font-weight: var(--weight-medium); color: var(--text-muted); text-decoration: none;
  padding: 7px 11px; border-radius: var(--radius); white-space: nowrap; transition: background var(--dur), color var(--dur);
  background: none; border: 0; font-family: inherit; cursor: pointer; line-height: 1.3; display: inline-flex; align-items: center; gap: 7px;
}
.ws-nav-item svg { width: 16px; height: 16px; }
.ws-nav-item:hover { background: var(--secondary); color: var(--text); text-decoration: none; }
.ws-nav-item.active { color: var(--accent); background: var(--accent-tint); font-weight: var(--weight-semibold); }
.hdr-tools { display: flex; gap: 8px; align-items: center; min-width: 0; }
.hdr-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--text); font-size: var(--size-small);
  font-weight: var(--weight-medium); padding: 6px 11px; border-radius: var(--radius); cursor: pointer; transition: background var(--dur);
  white-space: nowrap; flex-shrink: 0; font-family: inherit; text-decoration: none; line-height: 1.3; min-height: 34px;
}
.hdr-btn:hover { background: var(--secondary); text-decoration: none; }
.hdr-btn svg { flex-shrink: 0; width: 16px; height: 16px; }
.hdr-account { position: relative; display: inline-flex; flex-shrink: 0; }
.hdr-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 6px; z-index: 5000;
}
.hdr-menu.open { display: block; }
.hdr-menu .who { padding: 8px 12px 8px; font-size: var(--size-caption); color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.hdr-menu .who b { display: block; color: var(--text); font-weight: var(--weight-semibold); font-size: var(--size-body); }
.hdr-menu button, .hdr-menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px;
  border-radius: var(--radius-sm); font-size: var(--size-small); font-weight: var(--weight-medium); color: var(--text);
  cursor: pointer; white-space: nowrap; font-family: inherit; text-decoration: none; justify-content: flex-start; line-height: 1.3;
}
.hdr-menu button svg, .hdr-menu a svg, .hdr-drop button svg, .hdr-drop a svg { width: 16px; height: 16px; color: var(--accent); }
.hdr-menu button:hover, .hdr-menu a:hover { background: var(--secondary); text-decoration: none; }
.hdr-menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.hdr-menu .danger, .hdr-drop .danger { color: var(--red-ink); }
.hdr-menu .danger svg, .hdr-drop .danger svg { color: var(--red); }
/* A menu item that carries a state: a dot that lights when on (the account
 * menu's "Show hidden features"). */
.check::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-right: 2px; flex: none; }
.check.on::before { background: var(--green); }
#wsMenuBtn { display: none; }
.hdr-crumbs { display: flex; gap: 6px; align-items: center; min-width: 0; font-size: var(--size-caption); color: var(--text-muted); white-space: nowrap; overflow: hidden; margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--border); }
.hdr-crumbs:empty { display: none; }
.hdr-crumbs a { color: var(--text-muted); font-weight: var(--weight-medium); }
.hdr-crumbs a:hover { color: var(--accent-ink); }
.hdr-crumbs .cur { color: var(--text); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; }
.hdr-crumbs .sepc { color: var(--grey-40); }
/* Which server this is — the app prints its server under the sign-in form for
 * the same reason: staging and production are otherwise indistinguishable. */
.ws-env {
  font-weight: var(--weight-semibold); font-size: var(--size-micro); letter-spacing: .06em; text-transform: uppercase;
  color: var(--amber-ink); background: var(--amber-tint); padding: 3px 8px; border-radius: var(--radius-xs);
}
/* tight: labels off the tool buttons, crumbs shortened */
.ws-hdr.hdr-tight .hdr-btn .lbl { display: none; }
.ws-hdr.hdr-tight .hdr-btn { padding: 6px 8px; }
.ws-hdr.hdr-tight .hdr-crumbs { display: none; }
/* collapsed (a narrow desk or a tablet): the sections fold behind the menu */
.ws-hdr.hdr-collapsed { padding: 0 12px; }
.ws-hdr.hdr-collapsed .ws-nav .ws-nav-item:not([data-navkey="map"]):not([data-navkey="photos"]) { display: none; }
.ws-hdr.hdr-collapsed .hdr-crumbs { display: none; }
.ws-hdr.hdr-collapsed #wsMenuBtn { display: inline-flex; margin-left: auto; }
.ws-hdr.hdr-collapsed .hdr-grow { display: none; }
/* Only the BAR's copies hide: the tools node is moved into the drop-down
   while collapsed (WS.fitHeader), where it lays out as a column. */
.ws-hdr.hdr-collapsed > .hdr-tools, .ws-hdr.hdr-collapsed > .hdr-account { display: none; }
.hdr-drop .hdr-tools { display: flex; flex-direction: column; gap: 2px; }
.hdr-drop .hdr-tools:empty { display: none; }
.hdr-drop {
  display: none; position: absolute; top: calc(100% + 8px); right: 12px; width: min(84vw, 320px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(16, 24, 40, .18); padding: 6px; z-index: 5000; flex-direction: column; gap: 2px;
}
.ws-hdr.menu-open .hdr-drop { display: flex; }
.hdr-drop .ws-nav-item, .hdr-drop .hdr-btn, .hdr-drop button, .hdr-drop a { display: flex; width: 100%; text-align: left; justify-content: flex-start; align-items: center; gap: 10px; }
.hdr-drop .hdr-btn { border: 0; font-size: var(--size-small); padding: 9px 11px; min-height: 40px; }
.hdr-drop .hdr-btn .lbl { display: inline !important; }
.hdr-drop .sep { height: 1px; background: var(--border); margin: 6px 0; }
.hdr-drop .who { padding: 8px 12px 6px; font-size: var(--size-caption); color: var(--text-muted); }
.hdr-drop .who b { display: block; color: var(--text); font-size: var(--size-body); font-weight: var(--weight-semibold); }
/* phone: the sections live in the tab bar; the bar keeps the wordmark, the
 * page's tools (in the menu) and nothing else. */
.ws-hdr.hdr-phone { padding: 0 12px; }
.ws-hdr.hdr-phone .ws-nav, .ws-hdr.hdr-phone .hdr-crumbs, .ws-hdr.hdr-phone .hdr-grow { display: none; }
.ws-hdr.hdr-phone > .hdr-tools, .ws-hdr.hdr-phone > .hdr-account { display: none; }
.ws-hdr.hdr-phone #wsMenuBtn { display: inline-flex; margin-left: auto; }
.ws-hdr.hdr-phone .hdr-drop .ws-nav-item { display: none; }
/* No tab bar on this page (WS.header({tabs:false})): the drop-down is the whole navigation. */
.ws-hdr.hdr-phone[data-tabs="0"] .hdr-drop .ws-nav-item { display: flex; }
.ws-hdr.hdr-phone.hdr-hidden { display: none; }
.ws-hdr .hdr-badge { margin-left: auto; }

/* ── The tab bar (phones) ────────────────────────────────────────────
 * The app's: a translucent white bar with a scrim so the labels never sit on
 * bright imagery, 22px icons over 11px medium labels, the active one in the
 * accent. Fixed to the bottom, above the home indicator. */
.ws-tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 240;
  background: var(--tab-scrim); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0);
}
.ws-tabbar .tabs { display: flex; align-items: stretch; height: 56px; }
.ws-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: var(--size-micro); font-weight: var(--weight-medium); color: var(--tab-inactive); text-decoration: none;
  transition: color var(--dur); min-width: 0; padding: 6px 4px 5px; border-radius: 0;
}
.ws-tabbar a svg { width: 24px; height: 24px; }
.ws-tabbar a.active { color: var(--tab-active); }
.ws-tabbar a:hover { text-decoration: none; }
.ws-tabbar a:focus-visible { outline-offset: -3px; border-radius: var(--radius); }
body.ws-tabs .ws-tabbar { display: block; }
/* Pages that scroll: leave room under the last row. */
body.ws-tabs { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0)); }

/* ── Screen and page titles ────────────────────────────────────────── */
.ws-title { font-size: var(--size-screen); font-weight: var(--weight-display); letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.ws-titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.ws-titlerow .act { font-size: var(--size-small); font-weight: var(--weight-medium); color: var(--accent); }
.title-row { display: flex; align-items: center; gap: 12px; min-height: 34px; margin-bottom: 1rem; flex-wrap: wrap; }
.title-row .page-title, .page-title { margin: 0; font-size: var(--size-title); letter-spacing: -.015em; }
.title-row .sub-inline, .sub-inline { font-size: var(--size-body); color: var(--text-muted); }
.title-row .grow { flex: 1; }
.help {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .6875rem; font-weight: var(--weight-semibold);
  color: var(--text-muted); position: relative; flex-shrink: 0; line-height: 1; cursor: help;
}
.help::after {
  content: attr(data-tip); position: absolute; top: 28px; left: -8px; width: 380px; max-width: 80vw;
  background: var(--overlay-surface-strong); border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow);
  border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--size-caption); font-weight: 400; color: var(--text);
  line-height: 1.5; text-align: left; white-space: normal; z-index: 50; display: none;
}
.help:hover::after, .help:focus-visible::after { display: block; }
.stats-inline { display: flex; gap: 16px; margin-left: auto; font-size: var(--size-caption); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-inline b { color: var(--text); font-weight: var(--weight-semibold); }

/* ── Content shells ────────────────────────────────────────────────── */
.ws-content { flex: 1; padding: 1.4rem 1.9rem 2.5rem; overflow-y: auto; min-height: 0; }
.ws-content .inner { max-width: 960px; margin: 0 auto; }
@media (max-width: 640px) {
  .ws-content { padding: 1rem 1rem 2rem; }
  /* A row's subtitle wraps to two lines on a phone, as the app's does. */
  .ws-row .sub:not(.nowrap) { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  /* A title's actions drop under it, left-aligned, rather than crowding the name. */
  .title-row .grow { flex-basis: 100%; }
}

/* ── Buttons ───────────────────────────────────────────────────────── */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--size-small); font-weight: var(--weight-medium);
  font-family: inherit; line-height: 1.3; cursor: pointer; min-height: 34px;
  transition: background var(--dur), border-color var(--dur), opacity var(--dur), transform var(--dur);
  white-space: nowrap; text-decoration: none;
}
button:hover:not(:disabled), .btn:hover { background: var(--secondary); text-decoration: none; }
button:active:not(:disabled), .btn:active { opacity: .8; transform: scale(.985); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: var(--weight-semibold); }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent); filter: brightness(.93); }
button.primary:disabled { background: var(--secondary); border-color: var(--secondary); color: var(--text-faint); opacity: 1; }
button.danger, .btn.danger { color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 35%, white); }
button.danger:hover:not(:disabled), .btn.danger:hover { background: var(--red-tint); }
button.quiet, .btn.quiet { border-color: transparent; background: transparent; }
button.quiet:hover:not(:disabled) { background: var(--secondary); }
button.sm, .btn.sm { padding: 5px 9px; font-size: var(--size-caption); border-radius: var(--radius-sm); min-height: 28px; }
button.on { background: var(--accent-tint-2); border-color: var(--accent); color: var(--accent); }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
/* The app's primary: full width, 50px tall, 14px corners, 16px semibold. */
button.block, .btn.block { width: 100%; min-height: 50px; border-radius: var(--radius-lg); font-size: var(--size-input); font-weight: var(--weight-semibold); }
button svg, .btn svg { width: 16px; height: 16px; flex: none; }
button.icon, .btn.icon { width: 42px; height: 42px; padding: 0; border-radius: 13px; }
button.icon svg, .btn.icon svg { width: 20px; height: 20px; }

/* ── Fields ────────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-family: inherit;
  font-size: var(--size-body); color: var(--text); background: var(--surface); line-height: 1.3; max-width: 100%; min-height: 36px;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
input.sm, select.sm { padding: 4px 9px; font-size: var(--size-caption); border-radius: var(--radius-sm); min-height: 28px; }
/* The app's field: 11px uppercase label, then a 14px-radius 16px field. */
label.field, .field label {
  display: block; font-size: var(--size-micro); font-weight: var(--weight-medium); letter-spacing: .073em; text-transform: uppercase;
  color: var(--text-muted); margin: 0 0 6px 4px;
}
.field { margin-bottom: 14px; }
.field input, .field select, .field textarea { width: 100%; }
.ws-form .field input, .ws-form .field select, .ws-form input.big {
  padding: 13px 16px; font-size: var(--size-input); border-radius: var(--radius-lg); border-color: var(--border); min-height: 50px;
}
.hint { color: var(--text-muted); font-size: var(--size-caption); line-height: 1.5; }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
/* A search field with its glyph inside. */
.ws-search { position: relative; }
.ws-search input { width: 100%; padding-left: 40px; }
.ws-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }

/* ── The switch (the app's Switch) ─────────────────────────────────── */
.ws-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.ws-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.ws-switch .k {
  position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background var(--dur);
}
.ws-switch .k::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(16, 24, 40, .25); transition: transform var(--dur) var(--ease);
}
.ws-switch input:checked + .k { background: var(--accent); }
.ws-switch input:checked + .k::after { transform: translateX(20px); }
.ws-switch input:focus-visible + .k { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── The stepper (the app's DayStepper) ────────────────────────────── */
.ws-seg { display: inline-flex; gap: 4px; }
.ws-seg button, .ws-seg .opt {
  padding: 5px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent;
  font-size: var(--size-caption); font-weight: var(--weight-medium); color: var(--text-muted); min-height: 30px;
}
.ws-seg button.on, .ws-seg .opt.on { background: var(--accent-tint-2); border-color: var(--accent); color: var(--accent); }

/* ── Cards and grouped rows ────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2xl);
  padding: 16px; margin-bottom: 12px;
}
.card-hdr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.card-hdr-title { font-size: var(--size-input); font-weight: var(--weight-semibold); margin: 0; letter-spacing: -.01em; }
.card-hdr-meta { font-size: var(--size-caption); color: var(--text-muted); }
.card.archived { border-style: dashed; background: var(--surface-2); }
/* A card's heading is the app's section header. */
h2.section, .section-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-body); font-weight: var(--weight-medium); font-size: var(--size-micro);
  letter-spacing: .073em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px;
}
/* Controls that sit on a section line keep their own type. */
h2.section .btn, h2.section button, h2.section .badge, h2.section .pill, h2.section input, h2.section select, .section-title .pill {
  font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: var(--weight-medium);
}
/* The app's settings group: rows in a 16px container, hairlines between. */
.ws-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; margin: 0 0 6px; }
.ws-section + .ws-group, .ws-kicker + .ws-group { margin-top: 6px; }
.ws-group > .ws-section, .ws-group > h2.section { padding: 0; }
.ws-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px;
  border-top: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
  width: 100%; text-align: left; font-family: inherit; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; cursor: default;
  font-size: var(--size-row); font-weight: var(--weight-medium); line-height: 1.3; transition: background var(--dur), opacity var(--dur);
}
.ws-group > .ws-row:first-child, .ws-group > .ws-section + .ws-row { border-top: 0; }
a.ws-row, button.ws-row, .ws-row[role=button] { cursor: pointer; }
a.ws-row:hover, button.ws-row:hover:not(:disabled), .ws-row[role=button]:hover { background: var(--surface-2); text-decoration: none; }
a.ws-row:active, button.ws-row:active, .ws-row[role=button]:active { opacity: .7; transform: none; }
.ws-row .ico {
  width: 36px; height: 36px; border-radius: var(--radius); background: var(--secondary); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ws-row .ico svg { width: 18px; height: 18px; }
.ws-row .ico.img { background: var(--surface-3); overflow: hidden; }
.ws-row .ico.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws-row .t { flex: 1; min-width: 0; }
.ws-row .lbl { display: block; font-size: var(--size-row); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row .sub { display: block; margin-top: 2px; font-size: var(--size-caption); color: var(--text-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row .sub.wrap, .ws-row .lbl.wrap { white-space: normal; }
.ws-row .right { margin-left: 8px; display: inline-flex; align-items: center; gap: 8px; flex: none; }
.ws-row .chev { width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.ws-row.danger .lbl, .ws-row.danger .ico { color: var(--red); }
.ws-row.quiet .lbl { font-weight: 400; color: var(--text-muted); }
.ws-row .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ws-row .pills .pill { padding: 0 8px; font-size: var(--size-micro); }
.ws-note { font-size: var(--size-caption); color: var(--text-muted); padding: 6px 4px 0; line-height: 1.5; }

/* ── Rows and lists (the older list vocabulary, retuned) ───────────── */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.item { display: flex; gap: 10px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item > b { cursor: pointer; font-size: var(--size-row); font-weight: var(--weight-medium); }
.item > b:hover { color: var(--accent-ink); }
.item.archived > b { color: var(--text-muted); font-weight: 400; }
.kv { display: flex; gap: 6px; font-size: var(--size-caption); color: var(--text-muted); margin: 3px 0; }
.kv b { color: var(--text); font-weight: var(--weight-semibold); }
/* The app's empty card: a glyph and a sentence, centred. */
.ws-empty {
  padding: 20px 16px; color: var(--text-muted); font-size: var(--size-small); text-align: center; line-height: 1.5;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.ws-empty svg { width: 22px; height: 22px; color: var(--text-muted); }
.ws-empty.card { border-radius: var(--radius-xl); }
/* Loading rows: a skeleton, not a spinner in the middle of the content. */
.ws-skel { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-3) 25%, var(--secondary) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: wsskel 1.4s ease infinite; min-height: 14px; }
@keyframes wsskel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* The app's metric row: a 16px value over a 10px uppercase label. */
.ws-metrics { display: flex; gap: 8px; }
.ws-metrics .m { flex: 1; min-width: 0; }
.ws-metrics .v { font-size: var(--size-input); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.ws-metrics .l { font-size: var(--size-kicker); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-top: 2px; }

/* ── Tables ────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--size-body); }
.tbl th {
  background: var(--surface-2); padding: 8px 12px; text-align: left; font-size: var(--size-micro);
  font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: .073em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }

/* ── Badges, pills, toggles ────────────────────────────────────────── */
.badge, .pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: var(--size-caption); font-weight: var(--weight-medium); background: var(--secondary); color: var(--text-muted);
  white-space: nowrap; line-height: 1.5; border: 1px solid transparent;
}
.pill svg, .badge svg { width: 14px; height: 14px; flex: none; }
.pill.on, .badge.green { background: var(--green-tint); color: var(--green-ink); }
.pill.off, .badge.amber { background: var(--amber-tint); color: var(--amber-ink); }
.badge.red, .pill.bad { background: var(--red-tint); color: var(--red-ink); }
.badge.blue { background: var(--blue-tint); color: var(--blue-ink); }
.badge.accent, .pill.sel { background: var(--accent-tint); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, white); }
.pill.dis { opacity: .45; cursor: not-allowed; }
.acts .pill, .pill.act, button.pill { cursor: pointer; background: var(--surface); border-color: var(--border-strong); color: var(--text); min-height: 30px; padding: 3px 11px; }
.acts .pill:hover, .pill.act:hover, button.pill:hover { background: var(--secondary); }
.acts .pill.sel { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 30%, white); color: var(--accent); }
.acts .pill.dis:hover { background: var(--surface); }
.toggle {
  font-size: var(--size-caption); font-weight: var(--weight-medium); border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  padding: 3px 11px; cursor: pointer; color: var(--text); background: var(--surface); white-space: nowrap; line-height: 1.5; min-height: 30px; display: inline-flex; align-items: center;
}
.toggle:hover { background: var(--secondary); }
.toggle.on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grey-40); flex: none; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.red { background: var(--red); } .dot.blue { background: var(--blue); }
/* The chips a floor's walks are filtered by. */
.ws-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ws-chips::-webkit-scrollbar { display: none; }
.ws-chips .chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: var(--size-caption); font-weight: var(--weight-medium); color: var(--text); cursor: pointer; min-height: 34px; font-family: inherit; white-space: nowrap;
}
.ws-chips .chip.on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.ws-chips .chip .dot { width: 9px; height: 9px; }

/* ── Notices (the app's error box: a tint, an icon, one line) ─────── */
.ws-error, #err, .ws-ok, #ok, .ws-notice {
  display: none; border-radius: var(--radius-md); padding: 11px 14px; font-size: var(--size-small); line-height: 1.45;
  margin: 0 0 14px; white-space: pre-wrap; border: 0; align-items: flex-start; gap: 8px;
}
.ws-error, #err { background: color-mix(in srgb, var(--red) 10%, white); color: var(--red-ink); }
.ws-ok, #ok { background: var(--green-tint); color: var(--green-ink); }
.ws-notice { background: var(--amber-tint); color: var(--amber-ink); display: flex; }
.ws-error[style*="block"], #err[style*="block"], .ws-ok[style*="block"], #ok[style*="block"] { display: flex !important; }
.ws-error svg, #err svg, .ws-ok svg, #ok svg, .ws-notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.ws-progress { background: var(--secondary); border-radius: var(--radius-pill); height: 6px; overflow: hidden; }
/* Fill by transform, not width: set --p (0–1) on the bar. */
.ws-progress > i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .2s ease; }

/* ── The modal (the app's Alert) ───────────────────────────────────── */
.ws-modal-bg { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 9000; }
.ws-modal {
  background: var(--surface); border-radius: var(--radius-xl); width: 420px; max-width: 96vw; max-height: 88vh;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35); display: flex; flex-direction: column; animation: wspop .16s var(--ease); overflow: hidden;
}
@keyframes wspop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.ws-modal .mh { padding: 18px 18px 6px; font-size: var(--size-subhead); font-weight: var(--weight-semibold); letter-spacing: -.01em; }
.ws-modal .mb { padding: 6px 18px 12px; font-size: var(--size-small); line-height: 1.55; color: var(--text); overflow: auto; }
.ws-modal .mb input[type=text], .ws-modal .mb input[type=password] { width: 100%; margin-top: 8px; }
.ws-modal .mb ul { margin: 6px 0 10px; padding-left: 20px; }
.ws-modal .mb .warn { color: var(--amber-ink); font-size: var(--size-caption); margin: 10px 0 4px; }
.ws-modal .mf { padding: 4px 18px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ws-modal .mf button { min-height: 40px; padding: 8px 16px; border-radius: var(--radius-md); }
@media (max-width: 480px) {
  .ws-modal .mf { flex-direction: column-reverse; }
  .ws-modal .mf button { width: 100%; min-height: 46px; }
}
/* the shell's own delete modal, same look */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 9000; }
.modal .sheet { background: var(--surface); border-radius: var(--radius-xl); padding: 18px; max-width: 460px; width: 100%; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); animation: wspop .16s var(--ease); }
.modal h3 { margin: 0 0 8px; font-size: var(--size-subhead); font-weight: var(--weight-semibold); letter-spacing: -.01em; }
.modal .takes { margin: 6px 0 10px; padding-left: 20px; font-size: var(--size-small); line-height: 1.6; }
.modal .warn { color: var(--amber-ink); font-size: var(--size-caption); line-height: 1.5; margin: 10px 0 12px; }
.modal input { width: 100%; margin-top: 6px; }
.modal .row button { min-height: 40px; padding: 8px 16px; border-radius: var(--radius-md); }

/* ── The flash hint ────────────────────────────────────────────────── */
.ws-hint {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 8000;
  background: var(--overlay-surface-strong); border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow);
  border-radius: var(--radius-pill); padding: 8px 16px; font-size: var(--size-caption); font-weight: var(--weight-medium); color: var(--text);
  max-width: 92vw; text-align: center; opacity: 0; transition: opacity .25s; pointer-events: none;
}
.ws-hint.show { opacity: 1; }
body.ws-tabs .ws-hint { bottom: calc(72px + env(safe-area-inset-bottom, 0)); }

/* ── Floating map furniture (the app's HUD) ────────────────────────── */
.fbar { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 24px); z-index: 10; }
/* A pill floating over imagery: the app's routePill. */
.fsel, .fbtn, .ws-fpill {
  display: inline-flex; align-items: center; gap: 8px; background: var(--overlay-surface);
  border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow); border-radius: var(--radius-pill); padding: 7px 14px;
  font-size: var(--size-small); font-weight: var(--weight-medium); color: var(--text); white-space: nowrap; font-family: inherit; cursor: default; position: relative; line-height: 1.3; min-height: 36px;
}
button.fsel, .fbtn { cursor: pointer; }
button.fsel:hover, .fbtn:hover:not(:disabled) { background: var(--surface); }
.fbtn.on { background: var(--accent-tint-2); border-color: var(--accent); color: var(--accent); }
.fsel .lbl { color: var(--text-muted); }
.fsel select { border: 0; background: transparent; font: inherit; color: var(--text); padding: 0; cursor: pointer; outline: none; min-height: 0; }
.fsel svg, .fbtn svg { width: 15px; height: 15px; color: var(--accent); }
.fpill {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--overlay-surface);
  border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow); border-radius: var(--radius-pill); padding: 6px 14px;
  font-size: var(--size-caption); font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; z-index: 10; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
}
/* Square map buttons: the app's 42px, 13px-radius crosshair button. */
.fzoom { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 10; }
.fzoom button, .ws-mapbtn { width: 42px; height: 42px; padding: 0; font-size: 18px; border-radius: 13px; background: var(--overlay-surface); border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow); color: var(--text-muted); }
.ws-mapbtn svg { width: 20px; height: 20px; }
.ws-mapbtn.on { border-color: var(--accent); color: var(--accent); }
.fseg { display: inline-flex; background: var(--overlay-surface); border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow); border-radius: var(--radius); overflow: hidden; }
.fseg button { border: 0; border-radius: 0; background: transparent; padding: 7px 11px; font-size: var(--size-caption); box-shadow: none; min-height: 34px; }
.fseg button + button { border-left: 1px solid var(--border); }
.fseg button.on { background: var(--accent-tint-2); color: var(--accent); font-weight: var(--weight-semibold); }
.fseg button:disabled { opacity: 1; color: var(--grey-40); }
/* The app's bottom panel: 20px corners, a hairline, floating over the map. */
.ws-panel { background: var(--overlay-surface); border: 1px solid var(--overlay-border); box-shadow: var(--overlay-shadow); border-radius: var(--radius-panel); padding: 16px; }

/* ── The sign-in screens (the app's login) ─────────────────────────
 * One column, the mark in a 60px tinted badge, a 28px title, the form, and
 * which server this is at the foot. Shared by login, change-password and
 * invite. */
.ws-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.ws-auth main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: max(60px, 12vh) 24px 40px; padding-top: max(60px, env(safe-area-inset-top, 0) + 60px); }
.ws-auth .col { width: 100%; max-width: 400px; }
.ws-auth .badge-mark {
  width: 60px; height: 60px; border-radius: var(--radius-2xl); background: var(--accent-tint); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.ws-auth .badge-mark svg { width: 28px; height: 28px; }
.ws-auth h1 { font-size: var(--size-screen); font-weight: var(--weight-display); text-align: center; margin: 18px 0 0; letter-spacing: -.02em; line-height: 1.15; }
.ws-auth .lede { font-size: var(--size-body); color: var(--text-muted); text-align: center; margin: 6px 0 0; line-height: 1.5; }
.ws-auth form { margin-top: 36px; }
.ws-auth .field { margin-bottom: 8px; }
.ws-auth .field label { margin-top: 8px; }
.ws-auth .field input { width: 100%; padding: 13px 16px; font-size: var(--size-input); border-radius: var(--radius-lg); border-color: var(--border); min-height: 50px; }
.ws-auth .field .hint { margin: 6px 4px 0; }
.ws-auth #err { margin: 10px 0 0; }
.ws-auth button.block { margin-top: 20px; }
.ws-auth .foot { text-align: center; margin-top: 28px; font-size: var(--size-caption); color: var(--text-muted); line-height: 1.7; }
.ws-auth .foot a { color: var(--accent); }
.ws-auth .server { font-variant-numeric: tabular-nums; }

/* A drawn disclosure chevron for folding rows (no text glyphs as icons). */
.ws-chev { display: inline-block; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur); margin-bottom: 2px; }
.ws-chev.open { transform: rotate(45deg); margin-bottom: 4px; }

/* Inside the iOS app the page is one tab of the app: no header, no tab bar. */
html.ws-inapp .ws-tabbar, html.ws-inapp #wsHeader { display: none !important; }
html.ws-inapp body.ws-tabs { padding-bottom: 0; }

/* ── Retired features ──────────────────────────────────────────────
 * Hidden, not removed: anything carrying data-legacy stays in the page and
 * only shows while "Show hidden features" is on (WS.legacy). The attribute
 * value says why it is hidden. */
html:not(.ws-legacy) [data-legacy] { display: none !important; }
.legacy-note { display: none; align-items: center; gap: 6px; font-size: var(--size-caption); color: var(--amber-ink); background: var(--amber-tint); border-radius: var(--radius-xs); padding: 2px 8px; }
html.ws-legacy .legacy-note { display: inline-flex; }

/* ── Touch ─────────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  button, .btn { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  button.sm, .btn.sm { min-height: 40px; }
  button.icon, .btn.icon, .fzoom button, .ws-mapbtn { width: 44px; height: 44px; }
  .toggle, .pill.act, .acts .pill, label.pill, .ws-seg button { min-height: 40px; }
  .hdr-menu button, .hdr-menu a, .hdr-drop a, .hdr-drop button { padding: 12px 12px; min-height: 48px; }
  /* 16px: the size at which iOS stops zooming the page into a focused field. */
  select, input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=url], textarea { min-height: 44px; font-size: var(--size-input); }
  input.sm, select.sm { min-height: 40px; }
  .ws-row { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-modal, .modal .sheet { animation: none; }
  .ws-skel { animation: none; }
  * { transition-duration: 0s !important; }
}
