/* TCB Marketing AI theme. Colours are tokens only, defined for light and dark mode. */

/* Self-hosted fonts (public/vendor/fonts, listed in public/vendor/README.md). Latin only; text in other
   scripts falls back to the system font. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
:root {
  color-scheme: light;
  --log-bg: #0f172a;
  --log-text: #e2e8f0;
  --log-muted: #94a3b8;
  --nav-bg: #000d44;
  --nav-text: #ffffff;
  --nav-muted: #cbd5e1;
  --nav-accent: #60a5fa;
  --page-bg: #f1f5f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-selected: #eff6ff;
  --text: #0f172a;
  --text-muted: #475569;
  --label: #526582;
  --line: #e2e8f0;
  --line-strong: #7a889c;
  --primary: #0b5ed7;
  --primary-text: #ffffff;
  --primary-hover: #0a4fb5;
  /* Filled buttons: white text on these. */
  --primary-fill: #0b5ed7;
  --primary-fill-hover: #0a4fb5;
  --link: #0b5ed7;
  --link-hover: #000d44;
  --success: #16803c;
  --danger: #b91c1c;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow-raised: 0 10px 30px rgb(15 23 42 / 0.16);
  /* Emails and their images are made for a white page, in both themes. */
  --email-paper: #ffffff;
  --tone-green-bg: #dcfce7;
  --tone-green-text: #166534;
  --tone-amber-bg: #fef3c7;
  --tone-amber-text: #92400e;
  --tone-blue-bg: #dbeafe;
  --tone-blue-text: #1d4ed8;
  --tone-grey-bg: #e2e8f0;
  --tone-grey-text: #334155;
  --tone-red-bg: #fee2e2;
  --tone-red-text: #991b1b;
  --note-warn-bg: #fffbeb;
  --note-warn-line: #d97706;
  --note-warn-text: #78350f;
  --meter-good: #16803c;
  --meter-fair: #b45309;
  --meter-poor: #b91c1c;
  --step-active-bg: #000d44;
  --step-active-text: #ffffff;
  --step-active-muted: #cbd5e1;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "IBM Plex Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark tokens: follow the system unless the person chose Light, or always when they chose Dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --log-bg: #020617;
    --log-text: #e2e8f0;
    --log-muted: #94a3b8;
    --nav-bg: #020617;
    --nav-muted: #94a3b8;
    --page-bg: #0b1220;
    --surface: #111a2e;
    --surface-muted: #0f1729;
    --surface-selected: #13264a;
    --text: #e2e8f0;
    --text-muted: #a3b1c6;
    --label: #a3b1c6;
    --line: #24324d;
    --line-strong: #5b6f93;
    --primary: #3b82f6;
    --primary-text: #ffffff;
    --primary-hover: #60a5fa;
    --primary-fill: #2563eb;
    --primary-fill-hover: #1d4ed8;
    --link: #8ab4ff;
    --link-hover: #c3d7ff;
    --success: #15803d;
    --danger: #f87171;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-raised: 0 10px 30px rgb(0 0 0 / 0.55);
    --tone-green-bg: #12351f;
    --tone-green-text: #86efac;
    --tone-amber-bg: #3a2a0c;
    --tone-amber-text: #fcd34d;
    --tone-blue-bg: #132a52;
    --tone-blue-text: #93c5fd;
    --tone-grey-bg: #24324d;
    --tone-grey-text: #cbd5e1;
    --tone-red-bg: #3b1515;
    --tone-red-text: #fca5a5;
    --note-warn-bg: #2a2110;
    --note-warn-line: #a16207;
    --note-warn-text: #fde68a;
    --meter-good: #22a052;
    --meter-fair: #f59e0b;
    --meter-poor: #f87171;
    --step-active-bg: #2563eb;
    --step-active-text: #ffffff;
    --step-active-muted: #eef4ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --log-bg: #020617;
  --log-text: #e2e8f0;
  --log-muted: #94a3b8;
  --nav-bg: #020617;
  --nav-muted: #94a3b8;
  --page-bg: #0b1220;
  --surface: #111a2e;
  --surface-muted: #0f1729;
  --surface-selected: #13264a;
  --text: #e2e8f0;
  --text-muted: #a3b1c6;
  --label: #a3b1c6;
  --line: #24324d;
  --line-strong: #5b6f93;
  --primary: #3b82f6;
  --primary-text: #ffffff;
  --primary-hover: #60a5fa;
  --primary-fill: #2563eb;
  --primary-fill-hover: #1d4ed8;
  --link: #8ab4ff;
  --link-hover: #c3d7ff;
  --success: #15803d;
  --danger: #f87171;
  --focus: #8ab4ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-raised: 0 10px 30px rgb(0 0 0 / 0.55);
  --tone-green-bg: #12351f;
  --tone-green-text: #86efac;
  --tone-amber-bg: #3a2a0c;
  --tone-amber-text: #fcd34d;
  --tone-blue-bg: #132a52;
  --tone-blue-text: #93c5fd;
  --tone-grey-bg: #24324d;
  --tone-grey-text: #cbd5e1;
  --tone-red-bg: #3b1515;
  --tone-red-text: #fca5a5;
  --note-warn-bg: #2a2110;
  --note-warn-line: #a16207;
  --note-warn-text: #fde68a;
  --meter-good: #22a052;
  --meter-fair: #f59e0b;
  --meter-poor: #f87171;
  --step-active-bg: #2563eb;
  --step-active-text: #ffffff;
  --step-active-muted: #eef4ff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page-bg); color: var(--text); font: 14px/1.5 var(--font-ui); }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3 { font-family: var(--font-heading); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; }
/* Panels set their own display, which would otherwise show a hidden one. */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fields > .field.end { justify-content: flex-end; flex: 0 0 auto; }
.skip-link:focus { left: 16px; top: 8px; z-index: 10; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; background: var(--surface); color: var(--text); }

/* Top menu */
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 20px; background: var(--nav-bg); color: var(--nav-text); }
.topnav > a, .topnav-links > a { display: inline-flex; align-items: center; min-height: 44px; color: var(--nav-text); font-weight: 600; text-decoration: none; }
.topnav > a:hover, .topnav-links > a:hover { color: var(--nav-text); text-decoration: underline; }
.topnav .brand { font-family: var(--font-heading); font-size: 18px; font-weight: 700; }
.topnav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-left: auto; font-size: 13px; }
.topnav-links > a[aria-current] { box-shadow: inset 0 -2px 0 var(--nav-accent); }

/* Account dropdown in the top bar */
.user-menu { position: relative; }
.user-menu summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; color: var(--nav-text); cursor: pointer; list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { border-color: var(--nav-muted); }
.user-menu-name { font-weight: 600; }
.user-menu-role { color: var(--nav-muted); }
.user-menu-chevron { flex: 0 0 auto; transition: transform 0.15s ease; }
.user-menu[open] .user-menu-chevron { transform: rotate(180deg); }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-raised); display: flex; flex-direction: column; }
.user-menu-panel a, .user-menu-panel button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-selected); color: var(--text); }
.user-menu-panel a[aria-current] { color: var(--link); }
.user-menu-panel form { margin: 0; padding-top: 6px; margin-top: 6px; border-top: 1px solid var(--line); }
.user-menu-panel form.theme-switch { padding: 6px 6px 10px; margin: 0 0 6px; border-top: 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.theme-switch-label { padding: 0 6px; color: var(--label); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.theme-switch-options { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.user-menu-panel .theme-switch-options button { flex: 1 1 0; justify-content: center; min-height: 44px; padding: 0 8px; color: var(--text-muted); }
.user-menu-panel .theme-switch-options button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (prefers-reduced-motion: reduce) { .user-menu-chevron { transition: none; } }

/* Page structure */
.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.wrap.narrow { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; }
.page-head p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > * { flex: 1 1 min(360px, 100%); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { margin: 0; font-size: 16px; }
.panel h3 { margin: 0; font-size: 14px; }
.panel > p, .panel-head p, .card-body p { margin: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.panel-head p { margin: 2px 0 0; }
.empty-state { padding: 28px 16px; text-align: center; color: var(--text-muted); }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--primary); border-radius: 6px; background: var(--surface); color: var(--primary); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-fill-hover); border-color: var(--primary-fill-hover); color: var(--primary-text); }
.btn.ghost { border-color: var(--line-strong); color: var(--text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
/* A small drawn mark inside a button or beside text, in the colour of the words. */
.icon { width: 16px; height: 16px; flex: 0 0 auto; }
.btn .icon { margin-right: 8px; }
.linkbtn { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }

/* Status pills */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.pill.green { background: var(--tone-green-bg); color: var(--tone-green-text); }
.pill.amber { background: var(--tone-amber-bg); color: var(--tone-amber-text); }
.pill.blue { background: var(--tone-blue-bg); color: var(--tone-blue-text); }
.pill.grey { background: var(--tone-grey-bg); color: var(--tone-grey-text); }
.pill.red { background: var(--tone-red-bg); color: var(--tone-red-text); }

/* Tables */
.table-box { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.table-wide { min-width: 720px; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--label); font-size: 12px; font-weight: 700; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-inactive td { color: var(--text-muted); }

/* Key and value lists */
.kv-list { margin: 0; display: flex; flex-direction: column; }
.kv { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; text-align: right; }

/* Forms */
.fields { display: flex; flex-wrap: wrap; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Inside a .fields row, fields share the width; elsewhere they stack at their natural height. */
.fields > .field { flex: 1 1 min(240px, 100%); }
.fields > .field.full { flex-basis: 100%; }
.field label, .field .label { font-size: 13px; font-weight: 600; }
.field .hint { color: var(--text-muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit;
}
textarea { padding: 10px 12px; resize: vertical; }
input[type=file] { width: 100%; min-height: 44px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
input[type=file]::file-selector-button { min-height: 34px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--primary); border-radius: 4px; background: var(--surface); color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; flex: 0 0 auto; }
fieldset.plain { margin: 0; padding: 0; border: 0; }

/* Messages */
.note { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.note.warn { border-color: var(--note-warn-line); background: var(--note-warn-bg); color: var(--note-warn-text); }
.flash-stack { display: flex; flex-direction: column; gap: 8px; }
.flash { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 600; }
.flash.success { border-color: var(--success); background: var(--tone-green-bg); color: var(--tone-green-text); }
.flash.info { border-color: var(--primary); background: var(--tone-blue-bg); color: var(--tone-blue-text); }
.flash.warning { border-color: var(--note-warn-line); background: var(--note-warn-bg); color: var(--note-warn-text); }
.flash.error { border-color: var(--danger); background: var(--tone-red-bg); color: var(--tone-red-text); }
.form-error { margin: 0; padding: 12px 14px; border: 1px solid var(--danger); border-radius: 8px; background: var(--tone-red-bg); color: var(--tone-red-text); font-weight: 600; }

/* Setup status list */
.status-list { display: flex; flex-direction: column; }
.status-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-item:last-child { border-bottom: 0; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }

/* Sign-in page */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; }
.login-card { width: min(100%, 30rem); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-raised); }
.login-card header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 6.5rem; padding: 1.5rem 2rem; background: var(--nav-bg); color: var(--nav-text); }
.login-card header strong { font-family: var(--font-heading); font-size: 19px; }
.login-card header span { color: var(--nav-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.login-body { padding: 2.25rem; display: flex; flex-direction: column; gap: 16px; }
.login-body h1 { margin: 0; font-size: 26px; }
.login-body p { margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* Buttons: extra variants */
.btn.success { background: var(--success); border-color: var(--success); color: var(--primary-text); }
.btn.success:hover { color: var(--primary-text); filter: brightness(0.95); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* A part of the page that can't be used for the moment, such as the editor while the AI revises.
   The veil shows it and catches the mouse; the inert attribute in the markup stops the keyboard. */
.paused { position: relative; }
.paused::after { content: ""; position: absolute; inset: -4px; z-index: 2; border-radius: 10px; background: var(--page-bg); opacity: 0.65; cursor: not-allowed; }

/* Small uppercase labels */
.label-caps { color: var(--label); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }

/* Stat tiles */
/* Equal columns, so a row never ends with one tile stretched across it. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 16px; }
.stat { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.stat strong { font-family: var(--font-heading); font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }

/* Workflow step bar */
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps li { flex: 1 1 min(140px, 100%); display: flex; }
.steps a, .steps .step { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; }
.steps a:hover { border-color: var(--primary); color: var(--text); }
.step-number { color: var(--label); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.steps .done a { border-color: var(--success); }
.steps .done .step-number { color: var(--tone-green-text); }
/* The step the campaign is at is filled; the page being viewed, when it is another step, is outlined. */
.steps .current a { background: var(--step-active-bg); border-color: var(--step-active-bg); color: var(--step-active-text); }
.steps .current .step-number { color: var(--step-active-muted); }
.steps a[aria-current] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.steps .current a[aria-current] { border-color: var(--step-active-bg); box-shadow: none; }
/* Where the campaign is, apart from the page being viewed (the filled step). */
.step-now { align-self: flex-start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--tone-blue-bg); color: var(--tone-blue-text); font-size: 12px; font-weight: 700; }

/* Selectable option cards. The checked state comes from the input itself. */
.option { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.option input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; }
.option:has(input:checked) { border-color: var(--primary); background: var(--surface-selected); }
.option-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.option.compact { align-items: center; padding: 0 12px; }
.option.static { cursor: default; border-style: dashed; background: var(--surface-muted); color: var(--text-muted); }
.option-list { display: flex; flex-direction: column; gap: 8px; }
/* Short choices side by side, such as the days of the week, wrapping on a phone. */
.option-list.inline { flex-direction: row; flex-wrap: wrap; gap: 0 20px; }

/* Scores */
.score { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
meter { flex: 1 1 auto; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--line); }
meter::-webkit-meter-bar { height: 8px; border: 0; border-radius: 999px; background: var(--line); }
meter::-webkit-meter-optimum-value { border-radius: 999px; background: var(--meter-good); }
meter::-webkit-meter-suboptimum-value { border-radius: 999px; background: var(--meter-fair); }
meter::-webkit-meter-even-less-good-value { border-radius: 999px; background: var(--meter-poor); }
meter::-moz-meter-bar { border-radius: 999px; background: var(--meter-good); }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--meter-fair); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--meter-poor); }
meter.neutral::-webkit-meter-optimum-value { background: var(--primary); }
meter.neutral::-moz-meter-bar { background: var(--primary); }

/* Cards with header, body and footer */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; align-items: stretch; }
.card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.card > header, .card-body, .card > footer { padding: 16px 20px; }
.card > header { display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.card > header h2 { margin: 0; font-size: 18px; }
.card-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 14px; }
.card > footer { border-top: 1px solid var(--line); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.quote-box { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); color: var(--text); }

/* Approval checks */
.check-list { padding: 0; gap: 0; overflow: hidden; }
.check-row { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row.attention { background: var(--note-warn-bg); }
.check-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.check-head .grow { flex: 1 1 min(320px, 100%); min-width: 0; }
.check-head h3 { margin: 0; font-size: 14px; }
.check-row table { background: var(--surface); border: 1px solid var(--line); }
/* What a check found, one line each: repeated text, spam signals. */
.check-items { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; }
.summary-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.summary-bar meter { flex: 1 1 200px; }
/* Progress of long work inside a panel: a meter with its numbers, then what is happening. */
.progress-block { display: flex; flex-direction: column; gap: 10px; }
.progress-block > p { margin: 0; }
.progress-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.progress-row meter { flex: 1 1 240px; }
/* Numbers that change in place keep their width, so the text beside them does not jump. */
.count { font-variant-numeric: tabular-nums; }

/* Email preview */
.preview-stage { padding: 20px; background: var(--page-bg); border-radius: 8px; }
.email-frame { display: block; width: 100%; max-width: 640px; height: 720px; margin: 0 auto; border: 1px solid var(--line); border-radius: 4px; background: var(--email-paper); }
/* Beside the approval checks the email is shorter, so the decision stays in reach; it scrolls inside. */
.email-frame.short { height: 480px; }
.plain-text { margin: 0; padding: 16px; overflow-x: auto; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); font: 13px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; }
details.disclosure > summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
/* A small action that asks once more before it happens, such as removing someone from a list. */
details.inline-confirm > summary { list-style: none; }
details.inline-confirm > summary::-webkit-details-marker { display: none; }
details.inline-confirm[open] > form { margin-top: 4px; }
.confirm-box { display: flex; flex-direction: column; gap: 10px; max-width: 36rem; padding: 12px; border: 1px solid var(--danger); border-radius: 8px; background: var(--surface); }
.confirm-box p { margin: 0; }
/* The panel where a person commits: approving a version, or sending it to subscribers. */
.panel.decisive { border: 2px solid var(--success); }
/* The panel with the Approve button stays in view at the bottom of the screen while the checks scroll past. */
.panel.sticky-decision { position: sticky; bottom: 12px; z-index: 5; padding-top: 14px; padding-bottom: 14px; box-shadow: var(--shadow-raised); }
.panel.sticky-decision .record-detail { display: none; }

/* Model comparison */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.draft-out { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); white-space: pre-line; }
.rating { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* Tabs: links to the sections of one area, the current one marked with aria-current */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--label); font-weight: 700; text-decoration: none; }
.tabs a:hover { border-bottom-color: var(--primary); color: var(--text); }
.tabs a[aria-current] { border-bottom-color: var(--primary); color: var(--text); }

/* Settings forms */
.settings-form { display: flex; flex-direction: column; gap: 16px; }

/* Grouped tables */
.group-row td { background: var(--surface-muted); color: var(--label); font-size: 12px; font-weight: 700; text-transform: uppercase; }

/* A form that wraps a whole page keeps the page's spacing between its sections. */
.stack { display: flex; flex-direction: column; gap: 20px; }
/* Reader: a list of articles beside the chosen article, one to two. */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.reader-side, .reader-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.reader-filter { display: flex; flex-direction: column; gap: 12px; }
/* A plain block, not a flex column: inside a fixed height, flex would squeeze the rows into each other. */
.reader-list { max-height: 70vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.reader-list a { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 44px; padding: 12px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.reader-list a:last-child { border-bottom: 0; }
.reader-list a:hover { background: var(--surface-muted); }
.reader-list a[aria-current] { background: var(--surface-selected); font-weight: 600; }
@media (max-width: 900px) {
  .reader { grid-template-columns: minmax(0, 1fr); }
  .reader-list { max-height: 50vh; }
}
@media (max-width: 600px) {
  /* The name and account menu share a row; the links follow below. */
  .topnav { padding: 6px 16px; gap: 0 12px; }
  .topnav .user-menu { margin-left: auto; }
  .user-menu-role { display: none; }
  /* The links wrap onto a second row rather than hiding the last ones off the side. */
  .topnav-links { order: 3; flex: 1 1 100%; gap: 0 16px; margin: 0; }
  /* Six steps in two rows of three. */
  .steps { gap: 6px; }
  .steps li { flex: 1 1 calc(33.333% - 6px); }
  .steps a, .steps .step { min-height: 44px; padding: 6px 8px; font-size: 13px; }
  /* A wide table becomes one block per row, each cell under its column name (set in the markup or by app.js). */
  .stack-on-phone[data-labelled].table-wide { min-width: 0; }
  .stack-on-phone[data-labelled] thead { display: none; }
  .stack-on-phone[data-labelled] tr, .stack-on-phone[data-labelled] td { display: block; }
  .stack-on-phone[data-labelled] tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .stack-on-phone[data-labelled] tr:last-child { border-bottom: 0; }
  .stack-on-phone[data-labelled] td { padding: 6px 12px; border: 0; text-align: left; }
  .stack-on-phone[data-labelled] td.num { text-align: left; }
  .stack-on-phone[data-labelled] td::before { content: attr(data-label); display: block; color: var(--label); font-size: 12px; font-weight: 700; text-transform: uppercase; }
  .wrap { padding: 16px; }
  .login-body { padding: 1.5rem; }
  .kv dd { text-align: left; }
  .preview-stage { padding: 8px; }
  .email-frame, .email-frame.short { height: min(70vh, 560px); }
  .panel.sticky-decision { bottom: 8px; padding: 12px 16px; }
}
/* A small picture of an uploaded email image on Admin, Email design. */
.email-image-thumb { display: block; max-width: 96px; max-height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--email-paper); }
/* The worker log under a progress bar: a terminal-style box, dark in both themes, folded by default. */
details.worker-log { margin-top: 4px; }
details.worker-log > summary { min-height: 44px; padding: 12px 0; font-weight: 600; cursor: pointer; }
.log-lines { margin: 0; max-height: 280px; overflow: auto; padding: 12px 14px; border-radius: 8px; background: var(--log-bg); color: var(--log-text); font: 12px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-lines .log-time { color: var(--log-muted); font-variant-numeric: tabular-nums; }
/* An autopilot run folded into a progress bar on Campaigns, Autopilot runs; clicking it opens the stages and the log. */
details.run-progress > summary { display: flex; flex-direction: column; gap: 10px; cursor: pointer; list-style: none; border-radius: 6px; }
details.run-progress > summary::-webkit-details-marker { display: none; }
.run-progress-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.run-progress-head h2 { margin: 0; }
.run-progress-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.run-progress-more { color: var(--primary); font-weight: 600; }
.run-progress-more::after { content: " ▾"; }
details.run-progress[open] .run-progress-more::after { content: " ▴"; }
details.run-progress > summary:hover .run-progress-more { text-decoration: underline; }
.run-progress-body { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
