:root { font: 16px/1.45 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--texture), var(--aurora);
  background-attachment: fixed;
}
main {
  width: min(100%, 680px);
  margin: auto;
  padding: max(22px, env(safe-area-inset-top)) 16px calc(30px + env(safe-area-inset-bottom));
}
header, .actions, .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand, .eyebrow, .meta { color: var(--muted); font-size: .85rem; }
.brand { margin: 0 0 2px; font-weight: 650; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 7vw, 2.5rem); line-height: 1.13; letter-spacing: -.045em; }
h2 { font-size: 1.13rem; letter-spacing: -.015em; }
nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  position: sticky;
  z-index: 2;
  top: max(8px, env(safe-area-inset-top));
  width: 100%;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--sheen), var(--glass);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
  backdrop-filter: blur(24px) saturate(135%);
}
button {
  min-height: 44px;
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--button);
  color: var(--text);
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
nav button { border-radius: 999px; }
nav button[aria-pressed="false"] { border-color: transparent; background: transparent; }
nav button[aria-pressed="true"], a { color: var(--accent); }
.primary { background: #1555b5; color: #fff; border-color: #1555b5; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
.panel, .notice, dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--sheen), var(--panel);
  box-shadow: var(--shadow);
}
.panel, .notice { padding: 13px 15px; }
.panel + .panel, .notice { margin-top: 10px; }
.grid > .panel { margin: 0; background: var(--sheen), #24375bbd; }
section { margin-top: 18px; }
.metric { display: block; font-size: 1.75rem; line-height: 1.2; font-weight: 750; }
.panel h2 + *, .panel details + *, dialog p, dialog label { margin-top: 9px; }
.panel details { margin-top: 10px; overflow-wrap: anywhere; }
summary { cursor: pointer; }
.track { height: 6px; border-radius: 10px; background: var(--track); overflow: hidden; margin-bottom: 10px; }
progress { width: 100%; height: 7px; appearance: none; display: block; border: 0; border-radius: inherit; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: linear-gradient(90deg,#55a5ff,#bda0ff); border-radius: inherit; }
progress::-moz-progress-bar { background: linear-gradient(90deg,#55a5ff,#bda0ff); border-radius: inherit; }
.queue-card p, .queue-card .actions { margin-top: 8px; }
.queue-card .actions { flex-wrap: wrap; justify-content: flex-start; }
.draft { white-space: pre-wrap; }
.inline-draft fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.inline-draft label { display: block; margin-top: 10px; }
.inline-draft input, .inline-draft [data-html-body] {
  width: 100%;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--button);
  color: var(--text);
  font: inherit;
  font-size: max(16px, 1em);
}
.inline-draft [data-html-body] { min-height: 16rem; overflow-wrap: anywhere; }
.draft-link-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.draft-link-toolbar label { margin-top: 0; }
.draft-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.meta { margin-top: 9px; }
dialog { color: var(--text); width: min(440px, calc(100% - 28px)); padding: 17px; }
dialog::backdrop { background: #07162884; }
dialog label { display: block; }
textarea {
  display: block;
  width: 100%;
  margin: 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  color: var(--text);
  background: var(--button);
  font: inherit;
  resize: vertical;
}

@media (prefers-reduced-transparency: reduce) { nav { -webkit-backdrop-filter: none; backdrop-filter: none; } }

.audience-client { border-inline-start: 4px solid #78b9ff; }
.audience-partner { border-inline-start: 4px solid #c9a6ff; }
.doubt { color: #ffd397; }

:root {
  --base: #0b0c11;
  --glass: #161922ed;
  --button: #222631;
  --aurora: radial-gradient(ellipse at 78% 0%, #24202e, transparent 48%),
            radial-gradient(ellipse at 0% 36%, #151e29, transparent 58%), var(--base);
  --texture: repeating-linear-gradient(118deg, #ffffff07 0 1px, transparent 1px 4px);
  --hero: #1d2330;
  --selected: #435579;
  --danger: #ffadbb;
  --caution: #ffd397;
  --primary: #2164c6;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #192643;
  --muted: #4c5e79;
  --accent: #174eab;
  --line: #627ca333;
  --edge: #ffffffdb;
  --glass: #f8fbffbd;
  --button: #edf3ff;
  --track: #52688d26;
  --base: #f2f0eb;
  --sheen: linear-gradient(145deg,#ffffffbf,transparent 60%);
  --shadow: inset 0 1px 0 #fff, 0 10px 26px #283e651f;
  --aurora: radial-gradient(ellipse at 84% 0%, #e6dcd0, transparent 54%),
            radial-gradient(ellipse at 0% 36%, #dde5ed, transparent 58%), var(--base);
  --hero: #e5edfc;
  --selected: #fff;
  --danger: #a21e40;
  --caution: #805114;
  --primary: #1555b5;
}
.grid > .panel { background: var(--sheen), var(--hero); }
.doubt { color: var(--caution); }
.toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-bottom: 10px; }
.toolbar > button { min-height: 36px; padding: 4px 10px; font-size: .8rem; }
.appearance {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sheen), var(--button);
}
.appearance select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.appearance:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
nav button[aria-pressed="true"] {
  background: var(--selected);
  box-shadow: inset 0 1px 0 var(--edge), 0 2px 6px #0002;
}
button { border-radius: 999px; background: var(--sheen), var(--button); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.destructive { color: var(--danger); }
:is([data-mail-select], [data-client-batch-select]) ~ strong { color: var(--danger); }
:is([data-mail-select], [data-client-batch-select]):checked ~ strong { color: #81e4aa; }
:root[data-theme="light"] :is([data-mail-select], [data-client-batch-select]):checked ~ strong { color: #17613a; }
.queue-card .client-batch-choice { flex-basis: 100%; }
.client-batch-choice { cursor: pointer; }
#mail-history { margin-top: 1rem; }
.mail-queue-progress { margin: 12px 0; padding: 10px 0; border-block: 1px solid var(--edge); }
.mail-queue-progress .track { margin: 6px 0; }
.mail-report-success { color: #81e4aa; }
.mail-report-warning { color: #ffd16f; }
.mail-report-error { color: var(--danger); }
:root[data-theme="light"] .mail-report-success { color: #17613a; }
:root[data-theme="light"] .mail-report-warning { color: #825500; }
.queue-card .actions > .primary { flex-basis: 100%; }
@media (prefers-reduced-transparency: reduce) {
  :root[data-theme="light"] { --glass: #f8fbff; --aurora: #f2f5fb; }
}

#analytics-audience {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
  max-width: 360px;
}
#analytics-audience button[aria-pressed="true"] {
  background: var(--selected);
  color: var(--accent);
  box-shadow: inset 0 1px 0 var(--edge);
}

.period-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; }
.period-controls label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.period-controls input { font: inherit; color: var(--text); background: var(--button); border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.period-table { overflow-x: auto; }
.period-table table { width: 100%; border-collapse: collapse; }
.period-table th, .period-table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
.period-table thead th { font-size: .8rem; color: var(--muted); }

/* Operational board shared with the local control centre. */
nav { grid-template-columns: minmax(0, 1fr) minmax(0, .65fr) minmax(0, 1.42fr) minmax(0, 1fr); }
body.board-view main { width: min(100%, 1480px); }
body.board-view nav { max-width: 680px; margin-inline: auto; }
.board-head, .board-switch, .board-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.board-head { justify-content: space-between; }
.board-switch { border: 1px solid var(--line); border-radius: 99px; padding: 4px; }
.board-switch button { border-color: transparent; background: transparent; }
.board-switch button[aria-pressed="true"] { background: var(--selected); color: var(--accent); }
.board-filters { margin: 18px 0 8px; }
.board-filters input, .board-filters select, #crm-detail select, #crm-detail input {
  color: var(--text); background: var(--button); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; padding: 10px; min-height: 44px; max-width: 100%;
}
.board-filters input[type="search"] { flex: 1 1 220px; }
.board-filters select { max-width: 250px; }
.board-attention { display: flex; align-items: center; font-size: .85rem; gap: 6px; }
.board-attention input { min-height: auto; }
#segment-offer .offer-field { display: grid; gap: 6px; margin: 0 0 16px; }
#segment-offer .offer-field input,
#segment-offer .offer-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--button);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
#segment-offer .offer-field input { min-height: 48px; }
#segment-offer .offer-field textarea { min-height: 240px; resize: vertical; }
.board-lanes { display: flex; overflow-x: auto; gap: 14px; padding: 8px 2px 22px; align-items: flex-start; scroll-snap-type: x proximity; }
.board-lane { flex: 0 0 290px; border: 1px solid var(--line); background: var(--glass); border-radius: 20px; padding: 12px; scroll-snap-align: start; }
.board-lane h2 { display: flex; justify-content: space-between; align-items: center; font-size: .92rem; margin: 0 0 14px; min-height: 32px; }
.board-lane h2 span { border-radius: 99px; padding: 3px 9px; background: var(--button); color: var(--muted); }
.board-stack { display: grid; gap: 10px; max-height: 65vh; overflow-y: auto; padding: 1px; }
.lead-card { width: 100%; border-radius: 15px; text-align: left; padding: 13px; display: grid; gap: 8px; font-weight: 400; background: var(--sheen), var(--panel); overflow-wrap: anywhere; }
.lead-card strong { font-size: 1rem; font-weight: 650; }
.lead-card .meta { margin: 0; font-size: .78rem; }
.lead-card:hover { outline: 1px solid var(--accent); }
.board-tags { font-size: .73rem; color: var(--accent); }
.board-empty { padding: 18px 4px; font-size: .85rem; color: var(--muted); }
.board-overdue { color: var(--danger); font-size: .78rem; }
#crm-detail { width: min(650px, calc(100% - 24px)); max-height: 90dvh; overflow-y: auto; }
#crm-detail h2, #crm-detail details, #crm-detail form { margin-top: 16px; }
#crm-detail select, #crm-detail input { width: 100%; display: block; margin: 4px 0 12px; }
#crm-detail p, #crm-detail a { overflow-wrap: anywhere; }
#crm-detail form button { margin-top: 12px; }
#crm-plan-status { color: var(--caution); }
@media (max-width: 520px) {
  .board-lane { flex-basis: 85vw; }
  .board-filters select { width: calc(50% - 4px); max-width: none; font-size: .82rem; }
  nav button { padding-inline: 2px; font-size: clamp(.68rem, 3.3vw, .82rem); }
}

/* Segment is a separate badge; the card edge continues to identify its audience. */
.segment-badge {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--segment-border);
  border-radius: 10px;
  background: var(--segment-bg);
  color: var(--segment-ink);
  font-size: .76rem;
  line-height: 1.4;
  font-weight: 650;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.card-segment { margin-top: 9px; }
.segment-tone-0 { --segment-ink: #b9d9ff; --segment-bg: #173964; --segment-border: #41638c; }
:root[data-theme="light"] .segment-tone-0 { --segment-ink: #16477c; --segment-bg: #e1edff; --segment-border: #a7c5eb; }
.segment-tone-1 { --segment-ink: #a4e6f5; --segment-bg: #123b48; --segment-border: #356570; }
:root[data-theme="light"] .segment-tone-1 { --segment-ink: #155266; --segment-bg: #ddf4fa; --segment-border: #a1d5e2; }
.segment-tone-2 { --segment-ink: #a9e8d5; --segment-bg: #143d34; --segment-border: #3c695a; }
:root[data-theme="light"] .segment-tone-2 { --segment-ink: #185b47; --segment-bg: #dff5e9; --segment-border: #a4d8c0; }
.segment-tone-3 { --segment-ink: #d3e9a1; --segment-bg: #303d18; --segment-border: #596b34; }
:root[data-theme="light"] .segment-tone-3 { --segment-ink: #435718; --segment-bg: #edf4d9; --segment-border: #c4d695; }
.segment-tone-4 { --segment-ink: #f4df9a; --segment-bg: #493919; --segment-border: #786235; }
:root[data-theme="light"] .segment-tone-4 { --segment-ink: #6f5013; --segment-bg: #fff2cb; --segment-border: #ddc57f; }
.segment-tone-5 { --segment-ink: #ffcba1; --segment-bg: #4a2f1e; --segment-border: #80563a; }
:root[data-theme="light"] .segment-tone-5 { --segment-ink: #83421b; --segment-bg: #ffebdc; --segment-border: #e8be9d; }
.segment-tone-6 { --segment-ink: #ffc3ba; --segment-bg: #4b2828; --segment-border: #805151; }
:root[data-theme="light"] .segment-tone-6 { --segment-ink: #8b3432; --segment-bg: #ffebe8; --segment-border: #e4b4ac; }
.segment-tone-7 { --segment-ink: #f5bfdc; --segment-bg: #46263c; --segment-border: #7c4a69; }
:root[data-theme="light"] .segment-tone-7 { --segment-ink: #812e60; --segment-bg: #fbe6f2; --segment-border: #dca8c6; }
.segment-tone-8 { --segment-ink: #dbc7ff; --segment-bg: #35294e; --segment-border: #665080; }
:root[data-theme="light"] .segment-tone-8 { --segment-ink: #5e3589; --segment-bg: #efe7ff; --segment-border: #c6b0e4; }
.segment-tone-9 { --segment-ink: #c4cfff; --segment-bg: #293353; --segment-border: #515f88; }
:root[data-theme="light"] .segment-tone-9 { --segment-ink: #364780; --segment-bg: #e8edff; --segment-border: #b5c2ea; }
.segment-tone-10 { --segment-ink: #bfe7bd; --segment-bg: #253e28; --segment-border: #506d50; }
:root[data-theme="light"] .segment-tone-10 { --segment-ink: #305e30; --segment-bg: #e7f4e3; --segment-border: #b2d4ab; }
.segment-tone-11 { --segment-ink: #e8d2b7; --segment-bg: #3e342b; --segment-border: #71604f; }
:root[data-theme="light"] .segment-tone-11 { --segment-ink: #64482e; --segment-bg: #f5ece1; --segment-border: #d7c3a9; }
.segment-tone-neutral { --segment-ink: var(--muted); --segment-bg: var(--button); --segment-border: var(--line); }

.outreach-attention + .outreach-attention { border-top:1px solid var(--line); margin-top:16px; padding-top:16px; }
