/* The CRM's base styling. The colours are variables: theme.css sets them (a dark theme and a light theme, and the company's own colour from Settings, Branding), so no
   colour and no company name is written into the pages. The names in the block below are the CRM's own, kept so every rule here and every page script keeps working:
   each one points at a theme.css name. A fill uses --primary and text and links use --link, because the main colour is never used as text (on a dark page it is too dim). */

:root {
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --paper: var(--bg);
  --line: var(--border);
  --accent: var(--primary);
  --accent-ink: var(--on-primary);
  --danger: var(--red-text);
  --danger-paper: var(--red-tint);
  --ok: var(--green-text);
  --viz-1: var(--channel-phone);
  --viz-2: var(--orange);
  --viz-3: var(--green);
  --viz-axis: var(--slate-2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.center .card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.lead {
  color: var(--ink-soft);
  margin: 0 0 22px;
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}

input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

input:focus { outline: 3px solid rgba(var(--primary-rgb), 0.45); border-color: var(--primary); }

input.code { font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; }

.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-weight: 500; }
.check input { width: 22px; height: 22px; }

button {
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: var(--accent-ink);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }
button.quiet { background: transparent; color: var(--link); margin-top: 8px; }

.message {
  display: none;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--danger-paper);
  color: var(--danger);
  font-weight: 500;
}
.message.show { display: block; }

.step { display: none; }
.step.show { display: block; }

.key {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  word-break: break-all;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 8px;
  user-select: all;
}

.small { font-size: 0.95rem; }
.small:not(button) { color: var(--ink-soft); }

/* The update bar: a small branded strip that announces a new version and never covers the work. */
#crm-update-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  width: 520px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  z-index: 1000;
  font-size: 1rem;
}
#crm-update-bar .text { flex: 1; }
#crm-update-bar .text strong { display: block; }
#crm-update-bar .text .note { display: block; margin-top: 4px; }
#crm-update-bar .text .note:empty { display: none; }
#crm-update-bar.held .text .note { font-weight: 600; }
#crm-update-bar button {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  font-size: 0.95rem;
  background: var(--primary);
}
#crm-update-bar button.quiet { color: var(--link); }

/* ---- The app shell (phase 1 part E) ---------------------------------------------------------- */

body.app { font-size: 16px; }
body.app .topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-size: 1.25rem; margin: 0; flex: 1; }
.topbar .who { color: var(--ink-soft); font-size: 0.95rem; }
.topbar button, .menu button { width: auto; margin: 0; }
.topbar .menu-toggle { display: none; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.menu {
  width: 220px; flex: none; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--card);
}
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a {
  display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600;
}
.menu a:hover { background: var(--paper); }
.menu a.current { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--link); }
.menu .signout { margin-top: 20px; }
.content { flex: 1; min-width: 0; padding: 20px 16px 120px; max-width: 1100px; }

h1.page-title { font-size: 1.6rem; margin: 0 0 16px; }
h1.page-title .sub { font-size: 1rem; font-weight: 500; color: var(--ink-soft); margin-left: 8px; }

a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--link); outline-offset: 2px;
}

.app button { width: auto; margin: 0; padding: 10px 16px; font-size: 1rem; }
.app button.quiet { background: transparent; color: var(--link); }
.app button.danger { background: var(--danger); color: var(--on-red); }
.app button.small { padding: 6px 10px; font-size: 0.9rem; }
.app button.icon-button {
  background: transparent; color: var(--ink-soft); padding: 6px; border-radius: 8px; line-height: 0;
}
.app button.icon-button:hover { background: var(--paper); color: var(--link); }
.app input[type="text"], .app input[type="search"], .app input[type="email"], .app input[type="tel"], .app input[type="url"],
.app input[type="number"], .app input[type="date"], .app input[type="month"], .app input[type="datetime-local"], .app input[type="password"],
.app select, .app textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
.app textarea { resize: vertical; }
.app label { margin: 12px 0 4px; }
.app .check { margin: 8px 0; }
.app .check input { width: 20px; height: 20px; }

/* Sections with the pencil and gear. */
.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
.sec-head { display: flex; align-items: center; gap: 8px; cursor: default; min-height: 36px; }
.sec-title { font-size: 1.15rem; margin: 0; }
h3.sec-title { font-size: 1.05rem; }
.sec-tools { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.sec-tools.empty { display: none; }
.sec-head:hover .sec-tools, .sec-head:focus-within .sec-tools, .sec.tools-open .sec-tools { opacity: 1; }
@media (hover: none) { .sec-tools { opacity: 0.55; } }
.sec-body { margin-top: 8px; }

.kv { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--ink-soft); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.edit-form .field { margin-bottom: 6px; }
.edit-form .hint { font-size: 0.9rem; color: var(--ink-soft); margin-top: 2px; }
.edit-form .draft-conflict { color: var(--danger); }
.edit-form .buttons, .buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.edit-form .buttons .danger { margin-left: auto; }
.edit-form .message { margin-top: 10px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar label { margin: 0 0 4px; font-size: 0.9rem; }
.toolbar > div { min-width: 140px; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; background: var(--paper); }
table.list tr:last-child td { border-bottom: 0; }
table.list td.num { text-align: right; }
table.list a { font-weight: 600; text-decoration: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pager { display: flex; align-items: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.pager .count { color: var(--ink-soft); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 0.9rem; margin: 2px 4px 2px 0; }
.pill.status-customer { background: var(--green-tint); border-color: transparent; }
.pill.status-prospect { background: var(--primary-tint); border-color: transparent; }
.pill.status-former { background: var(--danger-paper); border-color: transparent; }
.pill button { padding: 0 4px; margin-left: 4px; background: transparent; color: var(--ink-soft); font-size: 1rem; line-height: 1; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-soft); font-size: 0.9rem; }
.timeline .kind { font-weight: 600; margin-right: 8px; }
.timeline .body { white-space: pre-wrap; margin-top: 2px; }

.history { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .diff { color: var(--ink-soft); }

.empty { color: var(--ink-soft); font-style: italic; }
.message.ok { background: var(--green-tint); color: var(--ok); }
.inline-add { margin-top: 10px; }
.rows { display: grid; gap: 10px; }
.row-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.row-card .main { flex: 1 1 200px; }
.row-card .meta { color: var(--ink-soft); font-size: 0.92rem; }
.row-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-card.overdue { border-color: var(--danger); }
.row-card.done { opacity: 0.6; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .side { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.pair .side h4 { margin: 0 0 6px; font-size: 1rem; }
.pair .side.chosen { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }

#crm-saved {
  position: fixed; left: 16px; bottom: 16px; z-index: 900; display: none; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--card-raised); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-pop);
  max-width: calc(100% - 32px);
}
#crm-saved.show { display: flex; }
#crm-saved button { color: var(--text); padding: 4px 10px; }
#crm-saved button.icon-button { color: var(--text); }

dialog.confirm, dialog.panel {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--card); color: var(--ink);
  width: min(560px, calc(100% - 32px)); font: inherit;
}
dialog.panel { width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: var(--scrim); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 1.25rem; }
.panel-body { margin-top: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { background: transparent; color: var(--ink-soft); border-radius: 8px 8px 0 0; padding: 8px 12px; }
.tabs button[aria-selected="true"] { color: var(--link); box-shadow: inset 0 -3px 0 var(--primary); }

.field-list { list-style: none; margin: 0; padding: 0; }
.field-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.field-list li .name { flex: 1 1 160px; font-weight: 600; }
.field-list li .type { color: var(--ink-soft); font-size: 0.9rem; }

.notes-list article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.notes-list h2 { margin: 0 0 4px; font-size: 1.15rem; }
.notes-list .meta { color: var(--ink-soft); font-size: 0.9rem; }
.notes-list p { white-space: pre-wrap; margin: 8px 0 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { color: var(--ink-soft); padding: 20px 0; }

@media (max-width: 760px) {
  .topbar .menu-toggle { display: inline-block; }
  .topbar .who { display: none; }
  .layout { display: block; }
  .menu { display: none; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu.open { display: block; }
  .content { padding: 16px 16px 120px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .pair { grid-template-columns: 1fr; }
  .app button { padding: 11px 16px; }
}

/* Money pages (phase 2): tap any dollar, the Friday problems list, the brief, the schedule, and print. */
.app button.dollar {
  background: transparent; color: var(--ink); padding: 2px 4px; font: inherit; font-variant-numeric: tabular-nums;
  text-decoration: underline dotted; text-underline-offset: 3px; border-radius: 6px;
}
.app button.dollar:hover, .app button.dollar:focus-visible { color: var(--link); background: var(--paper); }
table.list td.num .zero { color: var(--ink-soft); }
table.math td:first-child { width: 70%; }
table.math tr.step-result td { font-weight: 700; border-top: 2px solid var(--ink-soft); }
table.math tr.step-base td { font-weight: 600; }
table.math tr.step-rate td, table.math tr.step-note td { color: var(--ink-soft); }
.sec.problems { border-color: rgba(var(--red-rgb), 0.45); }
.problems-list { margin: 0; padding-left: 20px; }
.problems-list li { padding: 4px 0; }
.ok-note { color: var(--ok); font-weight: 600; }
.brief .kv { margin-top: 6px; }
.payday .meta { color: var(--ink-soft); font-size: 0.9rem; }
.locked-note { font-weight: 600; }
tr.status-overdue td:nth-child(4) { color: var(--danger); font-weight: 600; }
tr.status-paid td:nth-child(4) { color: var(--ok); font-weight: 600; }

@media print {
  .topbar, .menu, .no-print, .sec-tools, #crm-saved, #crm-update-bar, .problems { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .sec { border: 0; padding: 0 0 12px; break-inside: avoid; }
  .app button.dollar { text-decoration: none; color: #000; }
  table.list { border: 1px solid #999; }
  table.list th, table.list td { border-bottom: 1px solid #ccc; }
}

/* Phase 3: the pipeline lanes, the advertiser board and the goal bars. */
.lanes { display: grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap: 10px; overflow-x: auto; }
.lane { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 120px; }
.lane.over { outline: 2px solid var(--primary); }
.lane.derived { background: transparent; border-style: dashed; }
.lane-title { font-size: 1rem; margin: 0 0 8px; }
.lane-body { display: grid; gap: 8px; }
.deal-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: grab; }
.deal-card[draggable="false"] { cursor: default; }
.deal-card.dragging { opacity: 0.5; }
.deal-card.locked { border-left: 4px solid var(--ok); }
.deal-card-name { font-weight: 600; }
.deal-card-tools { margin-top: 6px; }
.board td.board-cell { text-align: center; }
.board td.board-cell.done { background: var(--green-tint); font-weight: 600; }
.board th.board-stage { font-size: 0.85rem; }
.goal-row { margin: 10px 0 14px; }
.goal-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.bar { height: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.2s; }
.bar-fill.full { background: var(--ok); }
tr.you td { font-weight: 600; }
@media (max-width: 760px) {
  .lanes { grid-template-columns: repeat(5, 200px); }
}

/* Phase 4: screens, the map, the install checklist, the ads board, the robots' steps. */
.app a.button-link {
  display: inline-block; padding: 10px 16px; border-radius: 8px; background: var(--primary); color: var(--accent-ink);
  font-weight: 600; text-decoration: none;
}
.pill.screen-live { background: var(--green-tint); border-color: transparent; }
.pill.screen-planned { background: var(--primary-tint); border-color: transparent; }
.pill.screen-closed, .pill.screen-down, .pill.screen-removed { background: var(--danger-paper); border-color: transparent; }
tr.closed td { color: var(--ink-soft); }
.meta.warn, strong.warn { color: var(--danger); }
.map-wrap { width: 100%; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
svg.screen-map { display: block; width: 100%; height: auto; }
.map-ground { fill: var(--paper); }
.map-dot { stroke: var(--card); stroke-width: 3; }
.dot-live { fill: var(--ok); }
.dot-planned { fill: var(--primary); }
.dot-down, .dot-removed { fill: var(--ink-soft); }
.dot-closed { fill: var(--danger); }
.map-label { font-size: 22px; fill: var(--ink); font-family: var(--font); }
.map-point:hover .map-label, .map-point:focus .map-label { text-decoration: underline; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 0.92rem; color: var(--ink-soft); }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; background: var(--ink-soft); }
.legend-dot.dot-live { background: var(--ok); }
.legend-dot.dot-planned { background: var(--primary); }
.legend-dot.dot-closed { background: var(--danger); }
.sheet-group { margin-top: 10px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.photo-grid img { display: block; max-width: 160px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.row-card .edit-form { flex: 1 1 100%; }
.match-box { flex: 1 1 100%; border-top: 1px solid var(--line); padding-top: 8px; }
.match-results { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.memo-ai-button { min-height: 44px; }
.memo-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.memo-ai { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--line); overflow-wrap: anywhere; }
.smartlead-event .actions button, .smartlead-event .match-box button { min-height: 44px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.ad-lanes { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; }
a.ad-card { display: block; color: var(--ink); text-decoration: none; cursor: pointer; }
a.ad-card:hover { border-color: var(--primary); }
.install { max-width: 560px; }
.install-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 10px 14px 14px; margin: 0 0 14px; min-width: 0; }
.install-group legend { font-weight: 700; padding: 0 6px; }
.install .app input, .install input[type="text"], .install input[type="number"], .install input[type="tel"], .install select { font-size: 1.1rem; min-height: 48px; }
.install .big-check .check { font-size: 1.1rem; min-height: 48px; }
.install .big-check .check input { width: 28px; height: 28px; }
.install .photo-button {
  display: inline-block; padding: 14px 18px; border: 2px dashed var(--primary); border-radius: 10px; color: var(--link); cursor: pointer; margin: 4px 0 8px;
}
.install input[type="file"] { display: block; max-width: 100%; font-size: 1rem; }
.app .install button.big { width: 100%; min-height: 56px; font-size: 1.2rem; }
.install img.thumb { max-width: 120px; max-height: 120px; border-radius: 8px; }
.install .pair { gap: 0 12px; }
@media (max-width: 760px) {
  .ad-lanes { grid-template-columns: repeat(6, 200px); }
  .install .pair { grid-template-columns: 1fr; }
}

/* paging (ui.js pager) */
.pager { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
.pager button[disabled] { opacity: 0.5; }

/* Phase 5: the customer portal, the public status and unsubscribe pages, and the support and message pages. */
.portal-wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 100px; min-width: 0; }
.portal-head { margin-bottom: 8px; }
/* Part 6, step P6-3: the logo beside the company name (the .brand-logo rule keeps it at most 2rem tall; on a narrow phone the name wraps under it), the owner's top line under the
   name, and the How it works video button, the whole width of its card and at least 44 pixels tall on every screen. */
.portal-brand { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-width: 0; margin: 0 0 10px; }
.portal-brand .page-title { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.portal-top-line { margin: 0 0 10px; color: var(--ink-soft); overflow-wrap: anywhere; }
.portal-video-words { margin: 0 0 12px; overflow-wrap: anywhere; }
.app a.button-link.portal-video-button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; box-sizing: border-box; text-align: center; }
.portal-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.portal-foot { margin-top: 24px; text-align: center; }
.portal-card { margin-top: 24px; }
.portal .tabs { position: sticky; top: 0; z-index: 20; background: var(--paper); padding-top: 6px; }
.portal .tabs button { flex: 1 1 auto; }
.app button.approve { background: var(--green); color: var(--on-green); }
.decision { flex: 1 1 100%; margin-top: 6px; }
.mini-title { font-size: 1rem; margin: 14px 0 6px; }
.pill.waiting { background: var(--danger-paper); border-color: transparent; }
.wait-words { font-weight: 600; margin: 6px 0; }
.ticket-messages .from-customer .when { color: var(--link); }
.article-body { white-space: pre-wrap; }
details.article { display: block; }
details.article summary { font-weight: 600; cursor: pointer; }
.answer { border-left: 4px solid var(--primary); padding: 4px 12px; margin: 12px 0; white-space: pre-wrap; }
.status-banner { padding: 16px; border-radius: var(--radius); font-weight: 700; font-size: 1.15rem; margin: 0 0 16px; background: var(--green-tint); color: var(--ok); }
.status-banner.state-degraded, .status-banner.state-maintenance { background: var(--orange-tint); color: var(--orange-text); }
.status-banner.state-down { background: var(--danger-paper); color: var(--danger); }
.pill.state-operational { background: var(--green-tint); border-color: transparent; }
.pill.state-degraded, .pill.state-maintenance { background: var(--orange-tint); border-color: transparent; }
.pill.state-down { background: var(--danger-paper); border-color: transparent; }
.readonly-box { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; }
.row-card pre, .pre-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; font: inherit; }
.row-card .main { min-width: 0; overflow-wrap: anywhere; }
.inline-form { flex: 1 1 100%; margin-top: 6px; }

/* Analytics (phase 6): charts are plain SVG; colours are tokens, a mark is never the only carrier of its meaning (every chart
   has a table or its numbers beside it, a legend with two series, and a hover title on each mark). */
.chart-wrap { margin: 8px 0 14px; }
svg.chart { width: 100%; height: auto; max-width: 720px; display: block; }
svg.chart .chart-label, svg.chart .chart-value, svg.chart .chart-tick { fill: var(--ink); font-size: 21px; font-family: var(--font); }
svg.chart .chart-tick { fill: var(--ink-soft); font-size: 17px; }
svg.chart .chart-axis { stroke: var(--viz-axis); stroke-width: 1; }
svg.chart .bar-1, .swatch.bar-1 { fill: var(--viz-1); background: var(--viz-1); }
svg.chart .bar-2, .swatch.bar-2 { fill: var(--viz-2); background: var(--viz-2); }
svg.chart .bar-3, .swatch.bar-3 { fill: var(--viz-3); background: var(--viz-3); }
svg.chart g.clickable { cursor: pointer; }
svg.chart g.clickable:hover rect, svg.chart g.clickable:focus rect { stroke: var(--ink); stroke-width: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.9rem; color: var(--ink-soft); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
button.numlink { background: transparent; color: var(--link); padding: 0 2px; min-height: 0; font-weight: 600; text-decoration: underline; border: 0; font: inherit; cursor: pointer; }
.analytics-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
#analytics-tabs { overflow-x: auto; flex-wrap: nowrap; }
#analytics-tabs button { white-space: nowrap; }

/* Phase 6 slice B: Ask anything, My charts and views, Sales tools */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chips .meta { flex-basis: 100%; }
.chips button.example { text-align: left; white-space: normal; max-width: 100%; }
.picker-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.picker-results button { white-space: normal; text-align: left; max-width: 100%; }
pre.proposal-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font: inherit; }
.field.check label { display: flex; align-items: center; gap: 8px; }
.ask-form input[type="text"] { width: 100%; }
#sales-body input[type="text"], #sales-body input[type="url"], #sales-body input[type="search"], #sales-body textarea, #mine-body input[type="text"] { max-width: 100%; box-sizing: border-box; }

/* Deal entry: the "Is this a renewal?" question and the advertiser picker. Big tap targets for a phone. */
.renewal-question { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 12px 0; }
.renewal-question[hidden] { display: none; }
.renewal-question legend { font-weight: 700; padding: 0 6px; }
.renewal-question .choice-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 4px; }
.renewal-question .choice-row input { width: 22px; height: 22px; flex: none; }
.entry-results { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.entry-results .pick-business { text-align: left; min-height: 44px; }

/* Portal onboarding and ad materials (one form for the portal home and the staff business page) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.onboard-banner { background: color-mix(in srgb, var(--primary) 12%, var(--card)); border: 1px solid var(--primary); border-radius: var(--radius); padding: 12px 14px; font-weight: 600; margin: 0 0 12px; }
.onboard-group { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 8px 12px 12px; min-width: 0; }
.onboard-group legend { font-weight: 700; padding: 0 6px; }
.onboard .field input, .onboard .field textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
.needed-mark.on { display: inline-block; background: var(--danger-paper); color: var(--danger); border-radius: 999px; padding: 0 8px; font-size: 0.85rem; font-weight: 700; }
.onboard input.needed, .onboard textarea.needed { border-color: var(--danger); background: var(--red-tint); }
.field-note { display: block; min-height: 1.1em; }
.field-note.warn { color: var(--danger); }
.onboard-adline { margin: 4px 0 10px; }
.onboard-drop { border: 2px dashed var(--primary); border-radius: var(--radius); padding: 22px 14px; text-align: center; display: flex; flex-direction: column; gap: 6px; cursor: pointer; background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.onboard-drop.over { background: color-mix(in srgb, var(--primary) 20%, var(--card)); }
.onboard-uploading, .onboard-filelist { list-style: none; padding: 0; margin: 8px 0; }
.onboard-uploading li.bad { color: var(--danger); }
.onboard-uploading li.good { color: var(--ok); }
.onboard-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 8px; border: 1px solid var(--line); }
.onboard-found-label { margin-left: 6px; }
.onboard-filelist li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.onboard-source { margin: 2px 0; }
.onboard-source p { margin: 2px 0; overflow-wrap: anywhere; }
.source-found { font-weight: 600; }
.source-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.source-buttons button { min-height: 44px; min-width: 96px; }
.onboard-send { margin: 6px 0 10px; }
.bp-card, .bp-pack { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; min-width: 0; overflow-wrap: anywhere; }
.bp-card h3 { margin: 0 0 6px; }
.bp-actions, .bp-found { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.bp-actions button, .bp-found button { min-height: 44px; text-align: left; }
.bp-card input[type=search], .bp-card input[type=text] { width: 100%; max-width: 100%; box-sizing: border-box; }
.bp-colors { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.bp-swatch { display: inline-flex; align-items: flex-end; min-width: 76px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.bp-hex { background: var(--card); color: var(--ink); padding: 0 4px; border-radius: 4px; }
.field-source { opacity: 0.85; }
.onboard-fold > summary { cursor: pointer; padding: 10px 0; }

.call-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--paper); color: var(--ink); border-top: 2px solid var(--line); }
.call-bar select, .call-bar button { min-height: 44px; }

/* My ad work (owner and admin): one card per sale, big tap targets, no side scroll at 390px. */
.adw-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; }
.adw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.adw-name { font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }
.adw-amount-shown { font-weight: 700; }
.adw-facts { margin: 6px 0 8px; }
.adw-entry { border-top: 1px solid var(--line); padding: 8px 0; }
.adw-entry-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.adw-notes-shown { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.adw-choices { display: grid; gap: 8px; margin: 6px 0 10px; }
.adw-choice { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: normal; cursor: pointer; }
.adw-choice input[type="radio"] { width: 24px; height: 24px; flex: 0 0 24px; margin: 0; }
.adw-choice-text { display: flex; flex-direction: column; min-width: 0; }
.adw-guess-tag { margin: 0 0 0 auto; flex: 0 0 auto; }
.adw-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; }
.adw-card .buttons button { min-height: 44px; }
@media (max-width: 760px) { .adw-card .buttons { display: flex; flex-wrap: wrap; gap: 8px; } .adw-card .buttons button { flex: 1 1 140px; } }

/* Phase 7 pages: Issues, Ideas, Weekly yes, Health (cards on a phone, words for green and red, never colour alone). */
.p7-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.p7-filters select, .p7-filters input { flex: 1 1 150px; min-width: 0; box-sizing: border-box; }
.p7-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; }
.p7-title { font-size: 1.1rem; margin: 0 0 6px; overflow-wrap: anywhere; }
.p7-card .buttons button { min-height: 44px; }
.pill.sev-critical, .pill.sev-high, .pill.p7-bad { background: var(--danger-paper); border-color: transparent; color: var(--danger); }
.pill.p7-good { background: var(--green-tint); border-color: transparent; color: var(--ok); }
.p7-reasons { margin: 6px 0; padding-left: 18px; }
.p7-textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; }
@media (max-width: 760px) { .p7-card .buttons { display: flex; flex-wrap: wrap; gap: 8px; } .p7-card .buttons button { flex: 1 1 140px; } }

/* The company logo beside the name (phase 8.1): small, never wider than the bar. */
.brand-logo { max-height: 2rem; max-width: 8rem; width: auto; height: auto; object-fit: contain; }
.card .brand-logo { display: block; max-height: 3rem; margin: 0 0 .5rem; }

/* Demo copy (phase 8.2): a strip on every page so nobody mistakes it for the real thing. */
.demo-banner { background: var(--orange-tint); color: var(--orange-text); border-bottom: 1px solid rgba(var(--orange-rgb), 0.5); text-align: center; font-size: .9rem; padding: .35rem .75rem; position: sticky; top: 0; z-index: 50; }
.demo-logins { margin-top: 1rem; padding: .5rem .75rem; border: 1px dashed currentColor; border-radius: 6px; }

/* Phase 8: a value shown once (a token, a signing secret), and the setup checklist. */
.once-box { margin: .5rem 0 1rem; }
.once-value { width: 100%; font-family: ui-monospace, monospace; }
.setup-list { list-style: none; padding: 0; margin: 0; }
.setup-item { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.setup-item.done strong { text-decoration: none; }
.setup-item.done .small::before { content: "\2713  "; }
.ready { font-weight: 700; }

/* The eye button (Sign In Fixes, C1): sits at the end of a sign in box and shows or hides what was typed. The page's general button rule
   makes a button wide with a top margin, so this one resets both (and the app shell's own button rule, which is why the selectors carry the wrapper's class). 44 pixels is a comfortable tap size on a phone. */
.eye-field { position: relative; display: block; }
.eye-field input[type="password"], .eye-field input[type="text"] { padding-right: 56px; }
.eye-field .eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: auto;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink-soft);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.eye-field .eye:hover { color: var(--ink); }
.eye-field .eye:focus-visible { outline: 3px solid var(--link); }

/* The first time note (Sign In Fixes, C4): a small text link under the Sign in button and the owner's plain text note it opens. The page's general button rule makes a button wide,
   so the link resets it. The note has no display rule of its own, so the hidden attribute keeps it shut. */
button.link {
  width: auto;
  margin: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--link);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: underline;
}
.first-time { margin: 14px 0 0; text-align: center; }
.note {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* A good answer on a form (Sign In Fixes, C2): the page's message box is red, so a good answer says ok. */
.message.ok { background: var(--green-tint); color: var(--ok); }
.my-login { max-width: 440px; }

/* Forgot my login (Sign In Fixes, C3): the page title of the reset step. A good answer on this page uses the same green message box as Change my login. */
h2.step-title { font-size: 1.15rem; margin: 0 0 4px; }

/* The first sign in reminder (Sign In Follow Ups, SIF-2a): app.js puts the class reminder on the EXISTING My login button for a person who skipped the welcome page and is still on the starting login.
   A small dot in the corner of the button, in the warm colour of the theme on screen (dark and light); it is drawn over the button and takes no room, so the top bar does not move at any width. */
#my-login.reminder { position: relative; }
#my-login.reminder::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange-text); pointer-events: none; }

/* The Demo stage panel on Settings, Branding (WCP-99 step DEMO-D3). Theme variables only; outside every 760 pixel block. */
.stage-panel { margin-top: 28px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-alt); }
.stage-panel h3 { margin: 0 0 6px; }
.stage-current { font-weight: 600; margin: 8px 0 4px; }

/* Send us files (WCP-163): four boxes, a list with a bar per file. Boxes stack on a small screen; every control is a full size tap target. */
.upload-zones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.upload-zone { border: 2px dashed var(--primary); border-radius: var(--radius); padding: 18px 12px; text-align: center; display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-height: 88px; background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.upload-zone.over { background: color-mix(in srgb, var(--primary) 20%, var(--card)); }
.upload-list, .upload-sentlist { list-style: none; padding: 0; margin: 8px 0; }
.upload-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.upload-row.error .upload-status { color: var(--danger); }
.upload-row.done .upload-status { color: var(--ok); }
.upload-bar { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--primary) 15%, var(--card)); overflow: hidden; margin: 6px 0; }
.upload-fill { height: 100%; background: var(--primary); transition: width 0.2s; }
.upload-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.upload-buttons button { min-height: 44px; min-width: 88px; }
@media (max-width: 760px) { .upload-zones { grid-template-columns: 1fr; } .upload-zone { min-height: 104px; padding: 22px 12px; } }

.qr { text-align: center; margin: 0 0 12px; }
.qr img { background: white; padding: 4px; border-radius: 6px; max-width: 100%; height: auto; }
/* The Ad pipeline board (WCP-2 step W2-D2): a card past its stage's stuck limit gets a warm edge, and the skipped steps read quietly. Theme variables only; outside every 760 pixel block. */
.deal-card.stuck { border-left: 4px solid var(--danger); }
.pipe-skipped { font-size: 0.85rem; color: var(--text-muted); }
