/* Colors and fonts follow the VoltTerritory brand overview:
   Electric Blue #2563EB, Midnight Navy #0F172A, Energy Green #22C55E,
   Cloud White #F8FAFC; Montserrat for headings, Inter for text. */
:root {
  --blue: #2563EB;
  --energy: #22C55E;
  --navy: #0F172A;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #0F172A;
  --muted: #475569;
  --border: #E2E8F0;
  --accent: #2563EB;       /* primary buttons: white text on Electric Blue */
  --accent-text: #FFFFFF;
  --brand-ink: #2563EB;    /* blue used as text */
  --danger: #b42318;
  --focus: #2563EB;
  --row-hover: #F1F5F9;
  --font-head: "Montserrat", Arial, sans-serif;
  --font-body: "Inter", Arial, sans-serif;
  --warn: #9a5b00;
  --cold: #1d5fa8;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  /* stage badge colors: background / text */
  --s0: #eceff1; --s0t: #37474f;
  --s1: #e3f0fb; --s1t: #0b4f8a;
  --s2: #e8e6fb; --s2t: #3d2f9b;
  --s3: #fdf1dc; --s3t: #7a4b00;
  --s4: #fbe7f1; --s4t: #8a1f55;
  --s5: #dff3e4; --s5t: #155d2f;
  --s6: #f3e3e1; --s6t: #8a2a1f;
}

/* Dark theme. A script at the top of index.html sets data-theme from your
   choice in the header (Auto follows your device setting). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F172A;
    --surface: #1E293B;
    --text: #F8FAFC;
    --muted: #94A3B8;
    --border: #334155;
    --accent: #2563EB;
    --accent-text: #FFFFFF;
    --brand-ink: #60A5FA;
    --danger: #ff7b6e;
    --focus: #60A5FA;
    --row-hover: #273449;
    --warn: #f0b354;
    --cold: #7fb6f2;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    --s0: #2a3033; --s0t: #cfd8dc;
    --s1: #16324a; --s1t: #9ccbf5;
    --s2: #2a2650; --s2t: #c4bdf7;
    --s3: #3d2e12; --s3t: #f3c87a;
    --s4: #45192f; --s4t: #f4a9cd;
    --s5: #173d24; --s5t: #8fdca9;
    --s6: #45201b; --s6t: #f2a69c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

h1, h2 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0; }
h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.5rem; margin-bottom: 16px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 560px; margin-bottom: 16px; }
.view-head h2 { margin: 0; }
.view-head .icon-btn { margin-right: -10px; color: var(--muted); }
@media (hover: hover) { .view-head .icon-btn:hover { background: var(--row-hover); color: var(--text); } }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- header and tabs ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 0;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 0 auto; }
.brand-mark { display: flex; flex: none; }
.brand-mark img { display: block; width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.top h1 { font-size: 1.15rem; color: var(--text); }
.brand-sub {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; max-width: 1100px; margin: 6px auto 0; }
.tabs a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabs a.active { color: var(--text); border-bottom-color: var(--blue); }
/* "+ Add" is a secondary button: navy text on Energy Green. */
.tabs a.tab-add,
.tabs a.tab-add.active {
  margin-left: auto;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--energy);
  color: var(--navy);
}
.tabs a.tab-add.active { box-shadow: inset 0 0 0 2px var(--navy); }

/* Two-tone wordmark: "Volt" in the text color, "Territory" in blue. */
.brand-accent { color: var(--brand-ink); }

/* Theme toggle: one quiet icon showing the current mode; tap to cycle
   Auto -> Light -> Dark. Full 40px tap target, but visually just a faint icon. */
.theme-toggle {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -4px -8px -4px 4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s, background-color 0.15s;
}
.theme-toggle:focus-visible { opacity: 1; background: var(--row-hover); }
@media (hover: hover) {
  .theme-toggle:hover { opacity: 1; background: var(--row-hover); }
}
.theme-toggle svg { display: none; width: 18px; height: 18px; }
:root:not([data-theme-pref]) .theme-toggle .icon-auto,
:root[data-theme-pref="auto"] .theme-toggle .icon-auto,
:root[data-theme-pref="light"] .theme-toggle .icon-light,
:root[data-theme-pref="dark"] .theme-toggle .icon-dark { display: block; }
@media (max-width: 599px) {
  .brand-sub { display: none; }
  .brand { gap: 8px; }
  .top h1 { font-size: 1rem; white-space: nowrap; }
  .theme-toggle { margin-left: auto; }
}
@media (max-width: 359px) {
  .top h1 { font-size: 0.9rem; }
  .brand-mark img { width: 26px; height: 26px; border-radius: 6px; }
}

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---------- form controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
/* iOS Safari gives date inputs a wide built-in minimum width that ignores
   width: 100%, pushing forms past the screen edge. Reset it and keep the
   date text left-aligned like the other fields. */
input, select, textarea { min-width: 0; max-width: 100%; }
input[type="date"], input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
label { display: block; font-weight: 600; font-size: 0.92rem; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
.req { color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.stack { display: grid; gap: 14px; max-width: 560px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid2 > * { min-width: 0; }
@media (min-width: 600px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

details.more summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-ink);
}
details.more[open] summary { margin-bottom: 10px; }

/* ---------- add business ---------- */
/* One centered column: a header, the form card, then the CSV import card. */
.add-wrap { max-width: 760px; margin: 8px auto 40px; display: grid; gap: 20px; }
.add-wrap .view-head { max-width: none; margin: 0; align-items: flex-start; }
.add-sub { margin: 6px 0 0; }
.add-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 28px 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.add-card.import { padding-top: 24px; }
.add-section { padding: 22px 0; border-top: 1px solid var(--border); }
.add-section:first-child { border-top: 0; }
.add-section > legend { float: left; width: 100%; margin-bottom: 14px; }
.add-section > legend + * { clear: both; }
.add-section .stage-extra { margin-top: 0; }
details.more.add-section { padding: 10px 0; }
details.more.add-section summary .muted { font-weight: 400; margin-left: 4px; }
.add-more { display: grid; gap: 14px; padding-bottom: 12px; }
.add-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -28px -24px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 16px 16px;
}
.add-foot .btn-primary { min-width: 160px; }
@media (max-width: 599px) {
  .add-wrap { margin-top: 0; gap: 16px; }
  .add-card { padding: 4px 16px 16px; border-radius: 14px; }
  .add-card.import { padding-top: 16px; }
  .add-foot { margin: 0 -16px -16px; padding: 12px 16px; border-radius: 0 0 14px 14px; flex-direction: column-reverse; }
  .add-foot .btn { width: 100%; }
}

/* ---------- businesses list ---------- */
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr 1fr; }
.filters input { grid-column: 1 / -1; }
@media (min-width: 800px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .filters input { grid-column: auto; }
}
#list-count { margin: 10px 0; font-size: 0.9rem; }

.biz-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.biz-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.biz-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.biz-table tr:last-child td { border-bottom: 0; }
.biz-table tbody tr { cursor: pointer; }
.biz-table tbody tr:hover { background: var(--row-hover); }
.biz-table .sub { display: block; color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.biz-table .name { font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 699px) {
  .hide-sm { display: none; }
  .biz-table td { padding: 12px 10px; }
  .biz-table th { padding: 8px 10px; }
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.s0 { background: var(--s0); color: var(--s0t); }
.s1 { background: var(--s1); color: var(--s1t); }
.s2 { background: var(--s2); color: var(--s2t); }
.s3 { background: var(--s3); color: var(--s3t); }
.s4 { background: var(--s4); color: var(--s4t); }
.s5 { background: var(--s5); color: var(--s5t); }
.s6 { background: var(--s6); color: var(--s6t); }

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.error { color: var(--danger); }

/* ---------- detail panel ---------- */
dialog#detail, dialog#asset-dialog {
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
}
@media (min-width: 700px) {
  dialog#detail, dialog#asset-dialog {
    width: 520px;
    margin: 0 0 0 auto;
    box-shadow: var(--shadow);
  }
}
dialog#detail::backdrop, dialog#asset-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
#detail-form, #asset-form { display: flex; flex-direction: column; height: 100%; }
.detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}
.detail-head h2 { flex: 1; margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.icon-btn {
  min-width: 46px;
  min-height: 46px;
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
}
.detail-body { flex: 1; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick .btn { flex: 1 1 auto; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 14px; min-width: 0; min-inline-size: 0; }
legend { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px; padding: 0; }
.detail-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.detail-foot .btn-primary { flex: 1; }
.meta { font-size: 0.85rem; }

.detail-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.detail-foot .btn:not(.btn-primary) { padding: 0 14px; }

/* ---------- flags ---------- */
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.detail-status .flags { margin-top: 0; }
.flag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid currentColor;
}
.flag-needs { color: var(--warn); }
.flag-cold { color: var(--cold); }

/* ---------- today ---------- */
.group { margin-bottom: 24px; }
.group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.group-overdue h3 { color: var(--danger); }
.group h3 .count {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  text-align: center;
  font-size: 0.8rem;
}
.group-empty { margin: 0; padding: 12px 0; color: var(--muted); font-size: 0.92rem; }
.task {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.group-overdue .task { border-left: 4px solid var(--danger); }
.group-today .task { border-left: 4px solid var(--accent); }
.task-main {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 6px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.task-main:hover { background: var(--row-hover); }
.task-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.task-top .name { font-weight: 700; overflow-wrap: anywhere; }
.task-step { display: block; margin-top: 4px; }
.task .sub { display: block; color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.due { font-weight: 600; }
.group-overdue .due { color: var(--danger); }
.task-done { align-self: center; min-width: 76px; }

/* ---------- Done sheet ---------- */
dialog#modal {
  padding: 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  margin: auto 0 0;
}
@media (min-width: 700px) {
  dialog#modal { width: 560px; border-radius: 16px; margin: auto; box-shadow: var(--shadow); }
}
dialog#modal::backdrop { background: rgba(0, 0, 0, 0.4); }
.sheet { display: flex; flex-direction: column; max-height: 92vh; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; max-width: none; }
.sheet-body > p { margin: 0; }
.sheet-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.sheet-foot .btn-primary { flex: 1; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

fieldset.needed {
  padding: 12px;
  border: 2px solid var(--warn);
  border-radius: 12px;
}
fieldset.needed legend { color: var(--warn); padding: 0 4px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- summary row ---------- */
#summary { margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
.stat:hover { background: var(--row-hover); }
.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); line-height: 1.25; }
.stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-detail { font-size: 0.8rem; color: var(--muted); line-height: 1.3; }
.stat-alert { border-left: 4px solid var(--danger); }
.stat-alert .stat-detail { color: var(--danger); font-weight: 600; }
@media (max-width: 599px) {
  .stat { padding: 10px; }
  .stat-value { font-size: 1.5rem; }
  .stat-detail { display: none; }
}

.stage-counts {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.stage-count {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
}
.stage-count:hover { background: var(--row-hover); }
.stage-count strong { font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.s0 { background: var(--s0t); } .dot.s1 { background: var(--s1t); } .dot.s2 { background: var(--s2t); }
.dot.s3 { background: var(--s3t); } .dot.s4 { background: var(--s4t); } .dot.s5 { background: var(--s5t); }
.dot.s6 { background: var(--s6t); }

/* ---------- pipeline board ---------- */
.board {
  position: relative; /* keeps hidden labels inside its scroll area */
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px 12px;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  align-items: flex-start;
}
.col {
  flex: 0 0 272px;
  scroll-snap-align: start;
  background: var(--row-hover);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 8px;
}
@media (max-width: 599px) { .col { flex-basis: 84vw; } }
.col h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 10px; }
.col h3 .count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col.drop-target { border-color: var(--accent); }
.col-cards { display: grid; gap: 8px; }
.col-empty { margin: 0; padding: 16px 8px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
}
.card.dragging { opacity: 0.5; }
@media (hover: hover) and (pointer: fine) { .card { cursor: grab; } }
.card-open {
  display: block;
  width: 100%;
  padding: 6px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.card-open:hover { background: var(--row-hover); }
.card .name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.card .sub { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.card-step { display: block; font-size: 0.9rem; margin-top: 4px; }
.card-stage { display: block; padding: 4px 6px 2px; }
.card-stage select { min-height: 40px; padding: 6px 10px; font-size: 0.9rem; }

@media (max-width: 420px) {
  .tabs { gap: 0; }
  .tabs a { padding: 0 7px; }
  .tabs a.tab-add, .tabs a.tab-add.active { padding: 0 12px; }
}
/* Six tabs on a small phone: "+ Add" becomes just "+". */
@media (max-width: 399px) {
  .tabs .label-add { display: none; }
  .tabs a.tab-add, .tabs a.tab-add.active { padding: 0 14px; font-size: 1.25rem; }
}

/* ---------- tabs: short labels on phones ---------- */
.label-short { display: none; }
@media (max-width: 480px) {
  .label-long { display: none; }
  .label-short { display: inline; }
}

/* ---------- activity log ---------- */
.activity { display: grid; gap: 10px; }
.activity h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.activity-add { display: grid; grid-template-columns: minmax(0, 1fr) 11rem auto; gap: 8px; }
@media (max-width: 479px) {
  .activity-add { grid-template-columns: minmax(0, 1fr) auto; }
  .activity-add input[name="outcome"] { grid-column: 1 / -1; }
}
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.activity-list li { padding: 10px 0; border-top: 1px solid var(--border); }
.activity-list li[data-activity-id] { display: flex; align-items: flex-start; gap: 8px; }
.activity-body { flex: 1; min-width: 0; }
.activity-delete {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin: -6px -6px 0 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted, #6b7280); cursor: pointer;
}
.activity-delete:hover, .activity-delete:focus-visible { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.activity-delete:disabled { opacity: 0.5; cursor: wait; }
.activity-list li:first-child { border-top: 0; }
.activity-meta { display: block; font-size: 0.9rem; }
.activity-outcome { display: block; margin-top: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- landed ---------- */
.show-sm { display: none !important; }
@media (max-width: 699px) { .show-sm { display: block !important; } }
.btn-small { min-height: 40px; padding: 0 14px; }
.cell-action { text-align: right; width: 1%; white-space: nowrap; }
.due-overdue { color: var(--danger); font-weight: 600; }

/* ---------- CSV import ---------- */
.import { display: grid; gap: 16px; }
.import p { margin: 0; }
.import-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.import-head h3 { font-family: var(--font-head); font-size: 1.1rem; margin-bottom: 4px; }
.import-head .btn { flex: none; }
#csv-preview { display: grid; gap: 14px; }
#csv-preview:empty { display: none; }
@media (max-width: 599px) {
  .import-head { flex-direction: column; }
  .import-head .btn { width: 100%; }
}
.import input[type="file"] { padding: 10px; }
.flag-ok { color: var(--brand-ink); }
.flag-bad { color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 0; }
.table-wrap { overflow-x: auto; }
.error-box {
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: 10px;
  color: var(--text);
}
.error-box p { margin: 0 0 6px; color: var(--danger); }
.error-box ul { margin: 0; padding-left: 20px; }
.import-actions { display: flex; gap: 8px; }
.import-actions .btn-primary { flex: 1; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 150%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transition: transform 0.2s, visibility 0.2s;
  visibility: hidden;
  z-index: 20;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.bad { background: var(--danger); color: #fff; }

/* ---------- address fields and suggestions ---------- */
.addr-fields { display: grid; gap: 14px; }
.addr-row { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.addr-row .addr-city { grid-column: 1 / -1; }
@media (min-width: 600px) {
  .addr-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr); }
  .addr-row .addr-city { grid-column: auto; }
}
.addr-set { gap: 0; }
.addr-combo { position: relative; display: block; margin-top: 4px; }
.addr-combo > input { margin-top: 0; font-weight: 400; }
.addr-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-weight: 400;
}
.addr-menu[hidden] { display: none; }
.addr-option {
  display: block;
  padding: 10px 12px;
  cursor: pointer;
  border-top: 1px solid var(--border);
}
.addr-option:first-child { border-top: 0; }
.addr-option[aria-selected="true"] { background: var(--row-hover); }
@media (hover: hover) { .addr-option:hover { background: var(--row-hover); } }
.addr-main { display: block; font-weight: 600; }
.addr-detail { display: block; color: var(--muted); font-size: 0.86rem; margin-top: 1px; }
.addr-msg { display: block; padding: 12px; color: var(--muted); font-size: 0.9rem; }
.addr-credit { display: block; padding: 6px 12px; font-size: 0.75rem; color: var(--muted); border-top: 1px solid var(--border); text-align: right; }

/* ---------- map ---------- */
.map-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.map-bar #map-status { margin: 0; font-size: 0.875rem; }
.map-layers { display: flex; flex-wrap: wrap; gap: 8px; }
.map-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; user-select: none;
}
.map-chip input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; border: 0; accent-color: var(--blue); }
.map-chip { white-space: nowrap; }
.map-chip strong { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.map-chip:has(input:not(:checked)) { color: var(--muted); }
.map-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.map-key { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.key-placed { background: var(--energy); border-radius: 4px; }
.key-potential { background: var(--blue); }
.key-lost { background: #94A3B8; }

.map {
  height: calc(100dvh - 230px);
  min-height: 380px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  z-index: 0; /* keep Leaflet's panes under the dialogs */
}
@media (max-width: 599px) {
  .map-layers { gap: 6px; }
  .map-chip { min-height: 36px; padding: 0 10px; gap: 6px; font-size: 0.8125rem; }
}
@media (max-width: 599px) { .map { height: calc(100dvh - 210px); margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; } }
/* Darken the street tiles to match the dark theme (satellite photos stay as they are). */
:root[data-theme="dark"] .map .tiles-street { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
.map .leaflet-control-layers { border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); background-color: var(--surface); color: var(--text); }
.map .leaflet-control-layers-expanded { padding: 8px 12px 8px 8px; font: 400 0.875rem/1.4 var(--font-body); }
.map .leaflet-control-layers label { display: flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.map .leaflet-control-layers-base input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; border: 0; flex: none; accent-color: var(--blue); }
.map .leaflet-control-layers label > span, .map .leaflet-control-layers label > div { display: flex; align-items: center; gap: 6px; }
:root[data-theme="dark"] .map .leaflet-control-layers-toggle { filter: invert(1); }
:root[data-theme="dark"] .map .leaflet-control-attribution { background: rgba(30,41,59,.85); color: var(--muted); }
:root[data-theme="dark"] .map .leaflet-control-attribution a { color: var(--brand-ink); }

.map-pin span {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.pin-placed span { background: var(--energy); color: var(--navy); border-radius: 8px; }
.pin-placed svg { width: 18px; height: 18px; }
.pin-potential span { background: var(--blue); }
.pin-lost span { background: #94A3B8; }

.map .leaflet-popup-content-wrapper, .map .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.map .leaflet-popup-content { margin: 14px 16px; font: 400 0.875rem/1.4 var(--font-body); }
.map a.leaflet-popup-close-button { color: var(--muted); }
.pop { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 180px; }
.pop-kiosk { font: 700 1.125rem/1.2 var(--font-head); color: var(--brand-ink); }
.pop-name { font-size: 1rem; }
.pop-addr { color: var(--muted); }
.pop .btn { margin-top: 6px; }
.map.leaflet-container { font-family: var(--font-body); }

/* ---------- settings link in the phone/tablet header ---------- */
.settings-link {
  display: flex; flex: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: -4px -8px -4px 0;
  border-radius: 50%; color: var(--muted); opacity: 0.55;
  transition: opacity 0.15s, background-color 0.15s;
}
.settings-link svg { width: 18px; height: 18px; }
.settings-link.active { opacity: 1; color: var(--text); }
.settings-link:focus-visible { opacity: 1; background: var(--row-hover); }
@media (hover: hover) { .settings-link:hover { opacity: 1; background: var(--row-hover); } }
.theme-toggle { margin-right: 0; }

/* ---------- settings ---------- */
.settings { max-width: 860px; display: grid; gap: 20px; margin-bottom: 40px; }
.settings h2 { margin-bottom: 0; }
.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.set-head h3 { font-family: var(--font-head); font-size: 1.1rem; }
.set-head p { margin: 4px 0 0; font-size: 0.92rem; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 0 0; margin-top: 18px; border-top: 1px solid var(--border);
}
.set-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-label .muted { font-size: 0.875rem; }
.set-row select { width: 220px; flex: none; }
.segmented.seg-3 { grid-template-columns: repeat(3, 1fr); width: 300px; flex: none; }
.segmented.seg-2 { grid-template-columns: repeat(2, 1fr); width: 200px; flex: none; }
.set-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.set-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.set-soon { border-style: dashed; box-shadow: none; background: transparent; }
@media (max-width: 599px) {
  .set-card { padding: 18px 16px; border-radius: 14px; }
  .set-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .set-row select, .segmented.seg-3, .segmented.seg-2 { width: 100%; }
  .set-actions { flex-direction: column-reverse; }
  .set-actions .btn { width: 100%; }
}

/* ---------- website layout (computers only) ----------
   index.html adds .desktop to <html> on a wide screen with a mouse or
   trackpad. Phones and tablets never get it, so they keep the app layout. */
.sidebar, .page-head { display: none; }

.desktop { --side-w: 252px; }
.desktop .top { display: none; }
.desktop .mobile-title { display: none; }
.desktop .sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 5;
  width: var(--side-w);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 0; color: var(--text); text-decoration: none;
}
.side-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.side-brand-text strong { font: 700 1.05rem/1.2 var(--font-head); overflow-wrap: anywhere; }
.side-brand-text > span {
  margin-top: 3px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.btn-add, .btn-add.active {
  background: var(--energy); border-color: var(--energy); color: var(--navy);
}
.btn-add:hover { filter: brightness(1.05); }
.btn-add.active { box-shadow: inset 0 0 0 2px var(--navy); }
.side-add { margin: 22px 0 14px; min-height: 42px; }
.side-add span { font-size: 1.2rem; line-height: 1; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 10px;
  border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem;
}
.side-nav a:hover { background: var(--row-hover); color: var(--text); }
.side-nav a.active {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--brand-ink); font-weight: 600;
}
.nav-icon { width: 18px; height: 18px; flex: none; }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px;
  border-radius: 999px; text-align: center;
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--muted); background: var(--row-hover);
}
.nav-count:empty { display: none; }
.side-nav a.active .nav-count { background: var(--surface); }
.side-nav a .nav-count.alert { background: var(--danger); color: #fff; }
.side-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.link-logout {
  align-self: center; padding: 8px 4px;
  color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.link-logout:hover { color: var(--text); }

.desktop main { max-width: none; margin: 0 0 0 var(--side-w); padding: 28px 40px 40px; }
.desktop .page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 1.75rem; }
.page-head p { margin: 4px 0 0; }
.page-head p:empty { display: none; }
.page-actions { display: flex; gap: 10px; }
.page-actions:empty { display: none; }

/* Use the extra room. */
.desktop #summary { margin-bottom: 28px; }
.desktop .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.desktop .stat { padding: 18px 20px; }
.desktop .stage-counts { flex-wrap: wrap; margin-top: 14px; }
.desktop #today-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; align-items: start;
}
.desktop #today-list > .empty { grid-column: 1 / -1; }
.desktop .board { margin: 0 -40px; padding: 0 40px 16px; scroll-padding: 0 40px; scroll-snap-type: none; }
.desktop .col { flex: 1 0 250px; }
.desktop .map { height: calc(100dvh - 200px); min-height: 480px; }
.desktop .add-wrap { margin: 0 0 40px; max-width: 860px; }
.desktop #toast { left: calc(50% + var(--side-w) / 2); }

/* ---------- assets ---------- */
.asset-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.asset-bar #asset-export-all { margin-left: auto; }
.asset-selbar {
  position: sticky; top: 8px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px; padding: 8px 8px 8px 14px;
  border: 1px solid var(--blue); border-radius: 10px; background: var(--surface);
}
.asset-selbar span { font-weight: 600; margin-right: auto; }
.export-menu {
  position: fixed; inset: auto; margin: 0; min-width: 220px; padding: 6px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.export-menu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 6px; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.export-menu button span { color: var(--muted); font-size: 0.85rem; }
.export-menu button:hover, .export-menu button:focus-visible { background: var(--row-hover); outline: none; }
.biz-table .sel { width: 1%; padding-right: 0; cursor: default; }
.biz-table .sel input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; cursor: pointer; }
.biz-table tr.selected { background: var(--row-hover); }
.desktop .asset-bar { margin-top: -6px; }
.asset-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.asset-stat {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; cursor: pointer;
}
.asset-stat strong { font-variant-numeric: tabular-nums; }
.asset-stat[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.serial { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; overflow-wrap: anywhere; }
.extra-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.extra-chip { font-size: 0.78rem; padding: 2px 8px; border-radius: 6px; background: var(--row-hover); color: var(--muted); overflow-wrap: anywhere; }
.extra-chip b { color: var(--text); font-weight: 600; }
.extra-list { display: grid; gap: 8px; }
.extra-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 8px; align-items: center; }
.extra-row .icon-btn { min-width: 40px; min-height: 40px; color: var(--muted); }
@media (hover: hover) { .extra-row .icon-btn:hover { background: var(--row-hover); color: var(--danger); } }
.extra-add { justify-self: start; }
.extra-empty { margin: 0; font-size: 0.9rem; }
.asset-cell { display: flex; gap: 12px; align-items: flex-start; }
.asset-cell > div { min-width: 0; }
.asset-thumb {
  flex: none; width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: var(--row-hover); border: 1px solid var(--border);
}
.asset-thumb-empty { display: grid; place-items: center; color: var(--muted); opacity: 0.6; }
.asset-thumb-empty svg { width: 20px; height: 20px; }
.asset-photo { display: grid; gap: 10px; }
.asset-photo img {
  display: block; width: 100%; max-height: 300px; object-fit: contain;
  border-radius: 10px; background: var(--row-hover); border: 1px solid var(--border);
}
.asset-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.asset-photo-actions .muted { font-size: 0.85rem; }
.asset-photo p { margin: 0; font-size: 0.9rem; }
.asset-photo-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 120px; padding: 16px; cursor: pointer;
  border: 1px dashed var(--border); border-radius: 10px;
  background: none; color: var(--muted); font: inherit; font-weight: 600;
}
.asset-photo-add svg { width: 28px; height: 28px; }
@media (hover: hover) { .asset-photo-add:hover { background: var(--row-hover); color: var(--text); } }
.link-btn { border: 0; padding: 0; background: none; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; }
.biz-assets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.biz-assets button {
  width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
@media (hover: hover) { .biz-assets button:hover { background: var(--row-hover); } }
.biz-assets .serial { color: var(--muted); }
.biz-assets .badge { margin-left: auto; }
.biz-table .show-sm-only { display: none; }
@media (max-width: 699px) { .biz-table .show-sm-only { display: block; } }
@media (max-width: 599px) {
  .asset-stats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
  .asset-stat { flex: none; }
  .asset-bar #asset-export-all { padding: 0 12px; }
}

/* ---------- asset maintenance ---------- */
/* Due-state text: overdue and due today in red, soon in amber. */
.maint-due { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.maint-overdue, .maint-today { color: var(--danger); }
.maint-soon { color: var(--warn); }
.maint-done { color: var(--muted); font-weight: 500; }

.maint-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.maint-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 10px;
}
.maint-item.is-done { opacity: 0.7; }
.maint-text { flex: 1; min-width: 0; }
.maint-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.maint-top .name { font-weight: 600; overflow-wrap: anywhere; }
.maint-item .sub { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.maint-item .btn-small { flex: none; padding: 0 12px; }
.maint-empty { margin: 0; font-size: 0.92rem; }
.maint-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.maint-custom[hidden] { display: none; }
.maint-next { margin: 0; }

/* Today: maintenance tasks get their own colored edge. */
.maint-task { border-left: 4px solid var(--warn); }
.maint-task-overdue, .maint-task-today { border-left-color: var(--danger); }

/* Asset list: wrench flag under the name, and the filter chip. */
.maint-flag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.maint-flag svg, .asset-stat-maint svg { width: 14px; height: 14px; flex: none; }
.maint-flag.maint-scheduled { color: var(--muted); }
.asset-stat-maint { color: var(--warn); }
.asset-stat-maint span, .asset-stat-maint strong { color: var(--text); }

/* Badges: red count on the Assets link / tab. Amber while nothing is overdue. */
.maint-badge {
  min-width: 20px; padding: 1px 6px; border-radius: 999px; text-align: center;
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.4;
  background: var(--warn); color: #fff;
}
.maint-badge.overdue { background: var(--danger); }
.maint-badge[hidden] { display: none; }
.side-nav .maint-badge { margin-left: auto; }
.side-nav .maint-badge:not([hidden]) + .nav-count { margin-left: 6px; }
.tab-badge { margin-left: 6px; }
:root[data-theme="dark"] .maint-badge { color: #0F172A; }
:root[data-theme="dark"] .maint-badge.overdue { color: #fff; background: #d92d20; }

/* Banner shown on other pages while maintenance is due. */
.maint-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 8px 6px 8px 14px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}
.maint-banner.overdue {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}
.maint-banner[hidden] { display: none; }
/* Site-wide announcement from the admin area. */
.maint-banner.announce {
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}
.maint-banner.announce > svg { color: var(--brand-ink); }
.maint-banner.announce span { font-weight: 500; overflow-wrap: anywhere; }
.maint-banner.announce.level-warning {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}
.maint-banner.announce.level-warning > svg { color: var(--warn); }
.maint-banner.announce.level-critical {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
.maint-banner.announce.level-critical > svg { color: var(--danger); }
.maint-banner.announce.level-critical span { font-weight: 600; }
.maint-banner.announce .announce-tag {
  flex: none; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface);
}
.maint-banner.announce .btn-small { flex: none; text-decoration: none; }
@media (max-width: 599px) {
  .maint-banner.announce { flex-wrap: wrap; }
  .maint-banner.announce #announce-text, .maint-banner.announce .announce-text { flex: 1 1 calc(100% - 80px); }
}
.blocked-actions { display: grid; gap: 8px; margin-top: 20px; }
.maint-banner > svg { width: 20px; height: 20px; flex: none; color: var(--warn); }
.maint-banner.overdue > svg { color: var(--danger); }
.maint-banner span { flex: 1; font-weight: 600; }
.maint-banner .icon-btn { color: var(--muted); }

/* ---------- sign-in screen ---------- */
.auth-wait body > :not(#auth-root) { visibility: hidden; }
.auth-screen {
  position: fixed; inset: 0; z-index: 2000; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font: 800 1.35rem var(--font-head); }
.auth-brand a { display: flex; border-radius: 9px; }
.auth-title { font-size: 1.3rem; margin-bottom: 12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.auth-tabs button {
  min-height: 44px; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.auth-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.auth-form .btn { width: 100%; }
.auth-help { margin: 0; color: var(--muted); font-size: 0.9rem; }
.auth-msg { margin: 0; min-height: 1.3em; font-size: 0.92rem; }
.auth-msg.error { color: var(--danger); }
.auth-msg.ok { color: var(--s5t); }
.auth-link {
  justify-self: center; border: 0; background: none; padding: 8px;
  color: var(--brand-ink); font-size: 0.92rem; cursor: pointer; text-decoration: underline;
}

/* ---------- account setup (profile.js) ---------- */
.pf-card { max-width: 480px; }
.pf-progress { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.pf-dots { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.pf-dots li { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.pf-dots li.done, .pf-dots li.on { background: var(--accent); }
.pf-help { margin-bottom: 18px; }
.pf-step { display: grid; gap: 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pf-step[hidden] { display: none; }
.pf-legend { float: left; width: 100%; padding: 0; margin: 6px 0 0; font: 700 1rem var(--font-head); }
.pf-legend + * { clear: both; }
.pf-card > .auth-link { display: block; margin: 10px auto 0; }
[data-profile-summary] { margin-top: 14px; }
.pf-editor .pf-step + .pf-step { padding-top: 16px; border-top: 1px solid var(--border); }
.pf-field > span:first-child { display: block; }
.pf-optional { color: var(--muted); font-weight: 400; }
.pf-err { min-height: 0; color: var(--danger); font-size: 0.85rem; font-weight: 500; }
.pf-err:empty { display: none; }
.pf-form [aria-invalid="true"] { border-color: var(--danger); }
.pf-row { display: grid; gap: 14px; }
@media (min-width: 480px) {
  .pf-row { grid-template-columns: 1.4fr 0.8fr 1fr; gap: 10px; }
  .pf-row.pf-row-2 { grid-template-columns: 1fr 1fr; }
}
.pf-check { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; cursor: pointer; }
.pf-check input { width: 20px; height: 20px; margin: 0; flex: none; }
.pf-email {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--row-hover); font-size: 0.92rem;
}
.pf-email span { color: var(--muted); }
.pf-email strong { overflow-wrap: anywhere; }
.pf-nav { display: flex; gap: 8px; }
.pf-nav .btn { flex: 1; width: auto; }
.pf-nav [hidden] { display: none; }
.pf-editor { align-items: flex-start; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.pf-summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 0.92rem; }
.pf-summary dt { color: var(--muted); }
.pf-summary dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- sign-out warning (public/app/auth.js) ---------- */
.timeout-screen {
  position: fixed; inset: 0; z-index: 2100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: rgba(0, 0, 0, 0.45);
}
.timeout-screen[hidden] { display: none; }
.timeout-card { max-width: 400px; }
.timeout-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
