/* ===== P18.2 Design system =====
   Dark (default) and light themes: <html data-theme="dark|light">. Every color on every page comes from these tokens. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations"), url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root, :root[data-theme="dark"] {
  --bg: #0A1020;            /* the page: deep navy */
  --surface: #101A2E;       /* cards */
  --raised: #16223B;        /* hover, inputs, highlighted rows */
  --border: #22304D;
  --text: #E7EDF8;
  --muted: #8C99B5;
  --accent: #2468EE;        /* electric blue (white text on it passes contrast, P18.15) */
  --accent-strong: #5B97FF;
  --accent-soft: rgba(47, 123, 255, 0.14);
  --accent-text: #6FA2FF;
  --on-accent: #FFFFFF;
  --good: #2BC48A; --good-bg: rgba(43, 196, 138, 0.14);
  --warn: #F2A93B; --warn-bg: rgba(242, 169, 59, 0.14);
  --bad: #F46E80;  --bad-bg: rgba(244, 110, 128, 0.14);
  --violet: #A08BFF; --violet-bg: rgba(124, 92, 255, 0.16);
  --ai-bg: rgba(124, 92, 255, 0.08); --ai-line: rgba(124, 92, 255, 0.28);
  --mark: rgba(242, 169, 59, 0.35);
  --hover: rgba(255, 255, 255, 0.03);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.45);
  --focus: 0 0 0 3px rgba(47, 123, 255, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F5FA; --surface: #FFFFFF; --raised: #EEF2F9; --border: #DCE2EE;
  --text: #0E1930; --muted: #5A6782;
  --accent: #1A57DB; --accent-strong: #1648B8; --accent-soft: rgba(26, 87, 219, 0.10); --accent-text: #1A57DB; --on-accent: #FFFFFF;
  --good: #0D6E4A; --good-bg: rgba(13, 110, 74, 0.10);
  --warn: #854B03; --warn-bg: rgba(133, 75, 3, 0.10);
  --bad: #B4203A;  --bad-bg: rgba(180, 32, 58, 0.09);
  --violet: #6D4AE8; --violet-bg: rgba(109, 74, 232, 0.10);
  --ai-bg: rgba(109, 74, 232, 0.05); --ai-line: rgba(109, 74, 232, 0.22);
  --mark: rgba(255, 214, 0, 0.45);
  --hover: rgba(14, 25, 48, 0.03);
  --shadow: 0 1px 2px rgba(14, 25, 48, 0.06);
  --shadow-pop: 0 12px 32px rgba(14, 25, 48, 0.16);
  --focus: 0 0 0 3px rgba(31, 99, 240, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: var(--accent-soft); }

h1 { font-size: 24px; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-weight: 600; }
.muted { color: var(--muted); }

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }

.topbar-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--muted);
}
.topbar-status[data-state="ok"] { background: var(--good-bg); color: var(--good); }
.topbar-status[data-state="warn"] { background: var(--warn-bg); color: var(--warn); }
.topbar-status[data-state="bad"] { background: var(--bad-bg); color: var(--bad); }

.layout { display: flex; min-height: calc(100vh - 60px); }

.sidebar {
  width: 210px;
  flex-shrink: 0;
  padding: 14px 10px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.disabled { color: var(--muted); cursor: default; }
.nav-item small { font-size: 11px; opacity: 0.8; }

.content { flex: 1; min-width: 0; padding: 28px 28px 60px; max-width: 1100px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background-color .12s, border-color .12s;
}
.button:hover { background: var(--raised); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.button:disabled { opacity: 0.5; cursor: default; background: var(--surface); border-color: var(--border); color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.ok::before, .badge.bad::before, .badge.warn::before, .badge.info::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.info { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: var(--raised); color: var(--muted); }

.health-summary { margin: 0 0 12px; font-weight: 600; }
.health-summary.ok { color: var(--good); }
.health-summary.bad { color: var(--bad); }

.check-list { width: 100%; border-collapse: collapse; }
.check-list td { padding: 7px 0; border-top: 1px solid var(--border); vertical-align: top; }
.check-list td:last-child { text-align: right; }
.health-footer { margin-top: 12px; font-size: 12px; }

.content .card + .card { margin-top: 16px; }
.small { font-size: 12px; }

.mailbox + .mailbox { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.mailbox-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mailbox-address { font-weight: 600; }
.mailbox-actions { display: flex; align-items: center; gap: 8px; }

.issues { margin: 10px 0 0; padding: 8px 12px 8px 28px; border-radius: 6px; }
.issues.warn { background: var(--warn-bg); color: var(--warn); }
.issues.bad { background: var(--bad-bg); color: var(--bad); }
.issues.neutral { background: var(--bg); color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { background: var(--raised); border-radius: 10px; padding: 10px 12px; }
.stat-value { font-size: 18px; font-weight: 600; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat.warn .stat-value { color: var(--warn); }

.sync-result { margin-top: 8px; font-size: 13px; min-height: 1em; }
.sync-result.ok { color: var(--good); }
.sync-result.bad { color: var(--bad); }

/* ---------- shared ---------- */
.page-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.page-header h1 { margin: 0; }
.badge.muted-badge { background: var(--raised); color: var(--muted); font-weight: 500; }
.badge.suggestion { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.nav-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; text-align: center; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--accent-text); text-decoration: none; }

.help-button {
  width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: italic 600 12px/1 Georgia, serif; cursor: pointer;
}
.help-button:hover, .help-button[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); }
.page-header, .card-header { position: relative; }
.help-panel {
  position: absolute; top: 100%; left: 0; z-index: 10; margin-top: 6px; width: min(420px, 90vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 12px 14px; font-size: 13px;
}
.help-title { font-weight: 600; margin-bottom: 6px; }
.help-section p { margin: 2px 0 8px; color: var(--muted); }

/* ---------- inbox ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tab {
  font: inherit; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--raised); }
.tab.active { border-color: transparent; color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.tab-count { color: var(--muted); font-weight: 500; }
.tab-unread { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; text-align: center; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.search { font: inherit; flex: 1; min-width: 200px; max-width: 360px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.search:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.filter { font-size: 13px; color: var(--muted); cursor: pointer; }

.list-card { padding: 0; overflow: hidden; }
.conversation {
  display: flex; gap: 10px; padding: 10px 16px; color: var(--text); text-decoration: none;
  border-top: 1px solid var(--border);
}
.conversation:first-child { border-top: none; }
.conversation:hover { background: var(--raised); }
.unread-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; flex-shrink: 0; }
.conversation.unread .unread-dot { background: var(--accent); }
.conversation.unread .sender, .conversation.unread .conversation-subject { font-weight: 600; }
.conversation-main { flex: 1; min-width: 0; }
.conversation-top { display: flex; align-items: baseline; gap: 8px; }
.sender { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sender-address { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-time { margin-left: auto; font-size: 12px; white-space: nowrap; }
.conversation-subject { margin-top: 1px; }
.conversation-snippet { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-count { font-size: 12px; font-weight: 400; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.empty { padding: 24px 16px; text-align: center; }
.load-more { display: block; margin: 10px auto; }

/* ---------- conversation reader ---------- */
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.conversation-title { font-size: 19px; }
.conversation-meta { margin: -6px 0 12px; }
.action-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.segment { font: inherit; font-size: 13px; font-weight: 500; min-height: 34px; padding: 6px 14px; border: none; border-left: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.segment:first-child { border-left: none; }
.segment:hover:not(.active) { color: var(--accent-text); }
.segment.active { background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: default; }
.action-status { font-size: 13px; }
.action-status.bad { color: var(--bad); }

.banner { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius); margin-bottom: 10px; font-size: 13px; border: 1px solid transparent; }
.banner-text { flex: 1; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.banner.info { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.banner.muted { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }

.emails { display: flex; flex-direction: column; gap: 10px; }
.email { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.email.outgoing { background: var(--raised); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.email-header { display: flex; justify-content: space-between; gap: 12px; }
.email-sender { font-weight: 600; word-break: break-word; }
.email-time { white-space: nowrap; }
.email .chips { margin-top: 6px; }
.email-body { font: inherit; white-space: pre-wrap; word-break: break-word; margin: 10px 0 0; }
/* P18.24: emails folded to one line; the newest is open */
.email-fold { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.email-fold.outgoing { background: var(--raised); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.email-fold > summary { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) max-content; gap: 12px; align-items: baseline;
  padding: 11px 18px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.email-fold > summary::-webkit-details-marker { display: none; }
.email-fold > summary:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.email-fold > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.email-fold-sender { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.email-fold-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-fold-time { white-space: nowrap; }
.email-fold[open] > summary { padding-bottom: 0; }
.email-fold[open] .email-fold-preview { visibility: hidden; }
.email-fold > .email { border: none; box-shadow: none; background: transparent; padding-top: 6px; }
.email-fold > .email .email-sender { font-weight: 500; color: var(--muted); font-size: 13px; }
.email-fold > .email .email-time { display: none; }
.emails-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 8px; }
.insight-fold { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.insight-fold > summary { cursor: pointer; padding: 7px 10px; list-style: none; display: flex; gap: 8px; align-items: center; min-width: 0; }
.insight-fold > summary::-webkit-details-marker { display: none; }
.insight-fold > summary::after { content: "▾"; color: var(--muted); margin-left: auto; }
.insight-fold[open] > summary::after { content: "▴"; }
.insight-fold[open] .insight-fold-preview { display: none; }
.insight-fold-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.insight-fold > .insight { margin: 0; border: none; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; }
.activity-fold > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 6px; }
.activity-fold > summary::-webkit-details-marker { display: none; }
.activity-fold > summary h2 { margin: 0; display: inline; }
.activity-fold > summary::after { content: "▾"; color: var(--muted); margin-left: auto; }
.activity-fold[open] > summary::after { content: "▴"; }
.activity-fold[open] > summary { margin-bottom: 8px; }
@media (max-width: 720px) {
  .email-fold > summary { grid-template-columns: minmax(0, 1fr) max-content; padding: 10px 12px; }
  .email-fold-preview { grid-column: 1 / -1; grid-row: 2; }
}
.quoted { margin-top: 8px; font-size: 13px; }
.quoted summary { color: var(--accent-text); cursor: pointer; }
.quoted .email-body { color: var(--muted); border-left: 3px solid var(--border); padding-left: 10px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment { padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--raised); text-decoration: none; font-size: 13px; }
.attachment:hover { border-color: var(--accent); color: var(--accent-text); }
button.attachment { background: none; cursor: pointer; }
.data-table tr.voided td { opacity: 0.6; }
.search-form { gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }
.search-input { min-width: 320px; flex: 1; }
.search-list { list-style: none; padding: 0; margin: 0; }
.search-row { padding: 10px 0; border-top: 1px solid var(--border); }
.search-snippet { color: var(--muted); margin-top: 4px; }
.search-snippet mark { background: var(--mark); color: var(--text); padding: 0 1px; }
.ask-form .inline { gap: 8px; }
.ask-input { flex: 1; min-width: 260px; }
.ask-form .chips { margin: 8px 0 4px; justify-content: flex-start; }
.ask-form .ask-chip { margin: 0; }
.ask-hide { display: block; margin: 6px 0 2px; }
.ask-item { border-top: 1px solid var(--border); padding: 10px 0; }
.ask-answer { margin: 6px 0; line-height: 1.5; white-space: pre-wrap; }
.ask-citations, .ask-warnings { list-style: none; padding: 0; margin: 6px 0; }
.ask-citation { margin: 6px 0; }
.ask-quote { margin: 4px 0 0; padding: 4px 10px; border-left: 3px solid var(--border); color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-older summary { cursor: pointer; color: var(--accent-text); margin-top: 8px; font-size: 13px; }
.keyinfo-table td { vertical-align: top; }
.keyinfo-value { font-size: 13px; overflow-wrap: anywhere; }
.keyinfo-context { margin-top: 3px; max-width: 520px; overflow-wrap: anywhere; }
.keyinfo-actions { white-space: nowrap; text-align: right; }
.keyinfo-actions .small-button { margin-left: 6px; }
.keyinfo-suggested { margin-bottom: 12px; }
.keyinfo-kept-title { font-size: 14px; margin: 4px 0; }
.keyinfo-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.keyinfo-add-box summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
.keyinfo-add { gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { font-weight: 600; margin-bottom: 12px; }
.auth-card h1 { margin: 0 0 6px; }
.settings-subtitle { font-size: 15px; margin: 16px 0 6px; }
.team-person { border-top: 1px solid var(--border); padding: 10px 0; }
.team-person summary, .team-add summary { cursor: pointer; color: var(--accent-text); font-size: 13px; margin-top: 4px; }
.team-person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.team-permissions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 8px 0; }
.team-group { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 0; }
.team-group legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.team-permission { display: block; margin: 3px 0; }
.team-add { margin-top: 12px; }
.team-password { margin-top: 8px; gap: 8px; }
.auth-activity { margin-top: 12px; }
.auth-activity summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.file-text { max-height: 260px; overflow: auto; font-size: 12px; margin-top: 6px; }
.contract-diff { border: 1px solid var(--bad); border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: var(--bad-bg); }
.contract-diff.check { border-color: var(--border); background: transparent; }
.ai-suggestion-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: var(--raised); }
.upload-row { flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.upload-row .input[type=file] { max-width: 280px; }
.risky-file { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.activity { margin-top: 16px; }
.activity h2 { margin-bottom: 8px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }

@media (max-width: 760px) {
  .content { padding: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sender-address { display: none; }
  .email-header { flex-direction: column; gap: 2px; }
  .banner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Deals (P3.6) ---------- */
.select, .input { font: inherit; min-height: 36px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: inherit; }
.select:hover, .input:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
.input::placeholder { color: var(--muted); opacity: .8; }
textarea.input { line-height: 1.5; }
.select:focus, .input:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.action-status.ok { color: var(--good); }
.deal-table { display: flex; flex-direction: column; }
.deal-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(0, 1fr) 110px 150px 128px 116px 124px;
  gap: 10px; align-items: center; padding: 10px 14px;
  border-top: 1px solid var(--border); color: inherit; text-decoration: none;
}
a.deal-row:hover { background: var(--raised); }
.deal-table.no-money .deal-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(0, 1fr) 110px 128px 116px 124px; }
.deal-head { border-top: none; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.deal-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.deal-cell .badge { margin-right: 4px; }
.deal-brand { font-weight: 600; }
.deal-amount, .num, .money { font-variant-numeric: tabular-nums; }
.deadline.warn { color: var(--warn); font-weight: 600; }
.deadline.bad { color: var(--bad); font-weight: 600; }
.badge.deal-chip { background: var(--violet-bg); color: var(--violet); font-weight: 500; }
.deal-link { color: var(--accent-text); }
.deal-overview .card { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.form-actions { margin-top: 12px; }
.notes { width: 100%; resize: vertical; box-sizing: border-box; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline .select { max-width: 100%; }
.linked-list { list-style: none; padding: 0; margin: 0 0 12px; }
.linked-conversation { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.linked-conversation a { color: var(--accent-text); }
.find-input { width: min(520px, 100%); }
/* P16.1: scam check */
.scam-reasons { margin: 6px 0; padding-left: 18px; }
.scam-banner { align-items: flex-start; }
/* P19.7: sending setup */
.sending-panel .test-email { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
/* P19.6: Waiting for your answer */
.review-list { list-style: none; padding: 0; margin: 0; }
.review-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.review-row:first-child { border-top: 0; }
.review-row > input { margin-top: 4px; }
.review-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.review-subject { font-weight: 600; color: var(--accent-text); }
.review-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-row .row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) { .review-row { flex-wrap: wrap; } .review-row .row-actions { width: 100%; justify-content: flex-start; } }
/* P19.5c: a conversation shared by several Deals */
.deals-box { margin: 8px 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--raised); }
.deals-box-list { margin: 6px 0; padding-left: 20px; }
.deal-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.deal-divider::before, .deal-divider::after { content: ""; flex: 1; border-top: 1px dashed var(--border); }
.linked-conversation .row-actions { margin-left: auto; display: inline-flex; gap: 6px; }
/* P19.5b: divide one conversation between Deals */
.divide-panel { list-style: none; padding: 12px; margin: 4px 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); display: flex; flex-direction: column; gap: 10px; }
.divide-list { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.divide-list > li { border-top: 1px solid var(--border); }
.divide-list > li:first-child { border-top: 0; }
.divide-list > li.gets { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.divide-email { display: grid; grid-template-columns: auto 200px 150px auto 1fr; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.divide-who, .divide-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .divide-email { grid-template-columns: auto 1fr; } .divide-snippet { grid-column: 2; } }
.find-results:empty { display: none; }
/* P19.5: old emails suggested for a Deal */
.suggestion-list { list-style: none; padding: 0; margin: 0 0 12px; }
.suggestion-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.suggestion-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; flex: 1 1 320px; }
.suggestion-main > a { color: var(--accent-text); font-weight: 600; }
.suggestion-main > .muted { flex-basis: 100%; }
.small-button { padding: 2px 8px; font-size: 12px; margin-left: auto; }

/* ---------- Deals views, sorting and board (P18.8) ---------- */
.views-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.view-chip { font: inherit; font-size: 13px; min-height: 30px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.view-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
.view-chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 600; }
.view-chip-group { display: inline-flex; align-items: center; }
.view-chip-group .view-chip { border-radius: 999px 0 0 999px; border-right: none; }
.view-remove { font: inherit; min-height: 30px; padding: 0 9px 0 6px; border: 1px solid var(--border); border-left: none; border-radius: 0 999px 999px 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.view-chip-group.active .view-remove { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.view-remove:hover { color: var(--bad); }
.views-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.views-bar .view-save { margin-left: 4px; display: inline-flex; align-items: center; gap: 4px; }
.views-bar .view-save .icon { width: 14px; height: 14px; }
.deals-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.deals-bar .tabs { margin-bottom: 0; }
.deals-count { margin-left: auto; }
.mode-switch .segment { display: inline-flex; align-items: center; gap: 6px; }
.mode-switch .icon { width: 15px; height: 15px; }
.deals-toolbar .search { flex: 1 1 220px; min-width: 200px; }
.deals-toolbar .select { max-width: 190px; }
.multi-filter { position: relative; display: inline-block; vertical-align: middle; }
.deal-filters::details-content { display: contents; }
.multi-filter > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.multi-filter > summary::-webkit-details-marker { display: none; }
.multi-filter > summary::after { content: "▾"; color: var(--muted); margin-left: auto; padding-left: 4px; }
.multi-filter.set > summary { border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.multi-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 320px; overflow-y: auto; display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px rgb(0 0 0 / 0.25); }
.multi-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.multi-option:hover { background: var(--accent-soft); }
.multi-menu .link-like { justify-self: start; margin: 4px 8px 2px; }
.filter-chips { margin: 8px 0 0; }
.filter-chip { cursor: default; }
.advance-badge { margin: 2px 0; }
.content:has(#page-deals:not([hidden]) .deal-table) { max-width: 1440px; } /* only while Deals is shown (P18.16 fix) */
.sort-button { font: inherit; font-size: 12.5px; font-weight: 500; color: var(--muted); background: none; border: none; padding: 2px 0; cursor: pointer; display: inline-flex; gap: 4px; text-align: left; }
.sort-button:hover, .sort-button.on { color: var(--text); }
.sort-button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.sort-arrow { color: var(--accent-text); }
.board { display: grid; grid-template-columns: repeat(var(--board-columns, 7), minmax(0, 1fr)); gap: 10px; padding-bottom: 10px; align-items: start; }
.board-column { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 290px); }
.board-column-head { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 10px; border-bottom: 1px solid var(--border); }
.board-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.board-cards { display: flex; flex-direction: column; gap: 8px; padding: 8px; overflow-y: auto; }
.board-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); color: inherit; text-decoration: none; }
.board-card:hover { border-color: var(--accent); }
.board-card:focus-visible { outline: none; box-shadow: var(--focus); }
.board-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; align-items: baseline; }
.board-card-head .deal-brand { min-width: 0; overflow-wrap: anywhere; }
.board-column-head .badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: 12px; padding-left: 7px; padding-right: 7px; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.board-card-title { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.board-card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: 12px; }
.board-empty { text-align: center; margin: 8px 0; }
.content:has(.board) { max-width: none; }

/* ---------- Deal page header and timeline (P18.9) ---------- */
.rail-wrap { margin: 4px 0 14px; }
.rail { list-style: none; display: flex; margin: 0; padding: 0; }
.rail-step { flex: 1; display: flex; align-items: center; gap: 8px; position: relative; padding-right: 10px; color: var(--muted); font-size: 13px; }
.rail-step:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; min-width: 12px; }
.rail-step.done:not(:last-child)::after { background: var(--accent); }
.rail-mark { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 600; }
.rail-mark .icon { width: 14px; height: 14px; }
.rail-step.done .rail-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rail-step.done { color: var(--text); }
.rail-step.now .rail-mark { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.rail-step.now { color: var(--text); font-weight: 600; }
.rail-label { white-space: nowrap; }
.rail.closed { opacity: .55; }
.rail-closed { margin: 8px 0 0; }
.deal-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 18px; padding: 14px 16px; margin-bottom: 12px; }
.deal-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.deal-fact-label { font-size: 12px; color: var(--muted); }
.deal-fact-value { font-weight: 500; overflow-wrap: anywhere; }
.deal-fact .badge { align-self: flex-start; }
.next-step { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.next-step.quiet { border-color: var(--border); background: var(--surface); }
.next-icon { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.next-step.quiet .next-icon { background: var(--good-bg); color: var(--good); }
.next-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.next-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); }
.next-title { font-size: 15px; }
.next-detail, .next-also, .next-step p { margin: 0; }
.next-also a { color: var(--accent-text); }
.next-step > .button { flex: none; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline-entry { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.timeline-entry:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--raised); border: 1px solid var(--border); color: var(--muted); }
.timeline-dot .icon { width: 14px; height: 14px; }
.timeline-entry.tl-email .timeline-dot { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.timeline-entry.tl-email.tl-out .timeline-dot { color: var(--good); background: var(--good-bg); }
.timeline-entry.tl-payment .timeline-dot { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.timeline-body { flex: 1; min-width: 0; padding-top: 4px; }
.timeline-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.timeline-title { font-weight: 500; color: inherit; }
a.timeline-title:hover { color: var(--accent-text); }
.timeline-time { margin-left: auto; white-space: nowrap; }
.timeline-subject { margin-top: 2px; }
.timeline-snippet { margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .rail-label { display: none; }
  .rail-step.now .rail-label { display: inline; }
  .next-step { flex-wrap: wrap; }
}

/* ---------- Start fresh (P19.1) ---------- */
.danger-card { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.fresh-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; margin-bottom: 10px; }
.fresh-columns h3 { font-size: 13px; margin: 6px 0; color: var(--muted); }
.fresh-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.danger-card .input { max-width: 260px; }

/* ---------- Import your records (P19.2) ---------- */
.records-card input[type=file] { max-width: 340px; }
.records-result { margin-top: 14px; }
.records-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.records-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); }
.records-tile strong { font-size: 18px; }
.records-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.records-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.records-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.records-table tr.muted td { color: var(--muted); }
.records-table .badge { margin-left: 6px; }
.records-details summary { cursor: pointer; color: var(--accent-text); font-size: 13px; margin: 8px 0; }
.records-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.records-scroll .records-table { margin: 0; }
.records-scroll th { position: sticky; top: 0; background: var(--surface); }

/* ---------- Email accounts and mailbox check (P19.3) ---------- */
.account-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 10px 0; background: var(--raised); }
.account-box h3 { margin: 0 0 10px; font-size: 14px; }
.account-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.account-box code { font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.mailbox-check { margin-top: 12px; }
.mailbox-check .records-scroll { max-height: 360px; }
.import-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.import-panel h3 { margin: 0 0 6px; font-size: 14px; }
.import-bar { height: 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin: 8px 0; }
.import-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.ok-text .icon { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Clients (P3.7) ---------- */
.client-table { display: flex; flex-direction: column; }
.client-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr) 110px;
  gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); color: inherit; text-decoration: none;
}
a.client-row:hover { background: var(--raised); }
.client-deal {
  display: grid; grid-template-columns: minmax(0, 2fr) 140px 100px 130px 150px;
  gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); color: inherit; text-decoration: none;
}
a.client-deal:hover { background: var(--raised); }
.client-row .small { overflow-wrap: anywhere; }
.subheading { font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.page-header .badge { margin-left: 4px; }

@media (max-width: 900px) {
  .client-row, .client-deal { grid-template-columns: 1fr 1fr; }
  .deal-head { display: none; }
  .deal-row, .deal-table.no-money .deal-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Reply status (P4.2) ---------- */
.reply-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.reply-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Reply composer (P4.3) ---------- */
.composer { margin-top: 14px; }
.composer-fields { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.composer-body { width: 100%; box-sizing: border-box; resize: vertical; min-height: 180px; font: inherit; line-height: 1.5; }
.composer .banner { margin: 0 0 10px; }
.send-confirm { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.send-preview { max-height: 160px; overflow: auto; background: var(--surface); padding: 8px; border-radius: 6px; margin: 4px 0; }
.reply-link { color: inherit; text-decoration: none; }
.reply-count { font-size: 28px; font-weight: 700; }
a.button { text-decoration: none; display: inline-block; }
.job-failed { margin-top: 4px; color: var(--warn); }
.ok-text { color: var(--good); }
.warn-text { color: var(--warn); }
.good-text { color: var(--good); }
.plan-video { padding: 10px 0; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.plan-editor { display: grid; gap: 8px; }
.plan-row { gap: 8px; }
.identity-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 6px; }
.identity-list { list-style: none; padding: 0; margin: 0; }
.identity-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.bad-text { color: var(--bad); }

/* ---------- Settings (P5.3) ---------- */
.service-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) 190px 110px 150px; gap: 8px; align-items: center; padding: 6px 0; }
.service-row.archived { opacity: 0.55; }
.method-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 90px 70px; gap: 8px; align-items: center; padding: 6px 0; }
.price-input { width: 90px; }
.ai-preview { max-height: 420px; overflow: auto; background: var(--bg); padding: 10px; border-radius: 6px; }
#page-settings .card { margin-bottom: 14px; }
@media (max-width: 900px) { .service-row, .method-row { grid-template-columns: minmax(0, 1fr); } }

td .inline .small-button { margin-left: 0; }

/* ---------- AI insights (P5.4) ---------- */
.insight { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--ai-bg); border: 1px solid var(--ai-line); font-size: 13px; }
.insight.pending, .insight.failed { color: var(--muted); }
.insight-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.insight-summary { margin: 4px 0 8px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 3px; margin-bottom: 6px; }
.fact { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.insight-suggestion { margin: 6px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.insight-action { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.insight .small-button { margin-left: 0; }

.deal-insight { margin-top: 12px; }
.ai-draft { margin-bottom: 10px; }
.ai-ask { margin-top: 8px; }
.ai-ask .input { flex: 1; min-width: 240px; }
.ai-suggestion { background: var(--surface); padding: 8px; border-radius: 6px; margin: 6px 0; }
.usage-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.usage-table th, .usage-table td { padding: 5px 8px; border-top: 1px solid var(--border); text-align: right; font-size: 13px; }
.usage-table th:first-child, .usage-table td:first-child { text-align: left; white-space: pre; }
.usage-table th { color: var(--muted); font-weight: 500; }
.check-line { gap: 8px; margin: 6px 0 12px; }
.price-events { list-style: none; margin: 4px 0 8px; padding: 0; }
.price-event { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.price-event .price-who { font-weight: 600; }
.price-event.you .price-who { color: var(--accent-text); }
.negotiation .card-header .badge { white-space: normal; text-align: right; }
.recommendation { border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; display: grid; gap: 4px; }
.recommendation.ok { border-left-color: var(--good); }
.recommendation.warn { border-left-color: var(--warn); }
.recommendation.bad { border-left-color: var(--bad); }
.recommendation-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.recommendation-label { font-size: 16px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) 64px 90px 150px 190px; gap: 8px; align-items: center; padding: 6px 0; }
.item-notes { display: flex; gap: 12px; padding: 0 0 6px; }
.items-total { padding: 8px 0; font-weight: 600; border-top: 1px solid var(--border); }
.date-input { min-width: 0; }
.agreement-box { display: grid; gap: 6px; margin-top: 8px; }
.agreement-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; align-items: center; }
.qty-input { width: 64px; }
.items-suggestion { margin: 6px 0 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 900px) { .item-row { grid-template-columns: 1fr; } }
.followup-banner { display: grid; gap: 8px; }
.item-link { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 0 0 8px; }
.item-progress { display: grid; gap: 4px; padding: 0 0 8px; }
.item-progress-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-select { max-width: 170px; }
.payment-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; }
.payment-form-hint { flex-basis: 100%; }
.payment-row { padding-left: 48px; display: flex; gap: 8px; align-items: center; }
.payment-row.voided { text-decoration: line-through; color: var(--muted); }
.link-like { background: none; border: none; color: var(--accent-text); cursor: pointer; padding: 0; text-decoration: underline; }
.activity-list li.voided span:first-child { text-decoration: line-through; color: var(--muted); }

/* P6.7 Ready to review */
.ready-list { margin-top: 12px; }
.ready-title { font-size: 14px; margin: 8px 0 6px; }
.ready-item { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; color: inherit; text-decoration: none; }
.ready-item:hover { background: var(--hover); }
.ready-preview { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terms-picker .terms-note { min-width: min(260px, 100%); flex: 1; }
.terms-picker .select { max-width: 100%; min-width: 0; }
.terms-picker { min-width: 0; max-width: 100%; }

/* P7.1 Analytics */
#page-analytics > * + * { margin-top: 16px; }
.filter-row { gap: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 600px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-tile.warn { border-color: var(--warn); }
.stat-tile.bad { border-color: var(--bad); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.chart-wrap { position: relative; margin-top: 8px; }
.month-chart { width: 100%; height: auto; display: block; }
.month-chart .bar { fill: var(--accent); }
.month-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.month-chart .axis-line { stroke: var(--border); stroke-width: 1; }
.month-chart .axis-text { fill: var(--muted); font-size: 11px; }
.month-chart .hit { fill: transparent; cursor: default; outline: none; }
.month-chart .hit:hover, .month-chart .hit:focus { fill: var(--hover); }
.chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 8px)); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-pop); pointer-events: none; white-space: nowrap; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.data-table tbody tr:hover td { background: var(--hover); }
.two-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.content .two-columns > .card { margin: 0; }  /* beats ".content .card + .card" */
@media (max-width: 480px) { .stat-value { font-size: 18px; } }
/* P7.2 breakdown tables */
.table-scroll { overflow-x: auto; }
.data-table.breakdown th, .data-table.breakdown td { white-space: nowrap; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.export-link { margin-left: auto; text-decoration: none; }
/* P18.11: received by brand (horizontal bars) and money still to receive (one split bar) */
.hbar-chart { display: grid; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; outline: none; }
.hbar-row:hover, .hbar-row:focus-visible { background: var(--hover); }
.hbar-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: block; height: 14px; }
.hbar { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar-value { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 84px; }
.open-money { margin: 4px 0 12px; }
.open-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.open-part { display: block; min-width: 3px; }
.open-part.overdue, .open-key.overdue { background: var(--bad); }
.open-part.due, .open-key.due { background: var(--warn); }
.open-part.later, .open-key.later { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.open-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 8px 0 0; font-size: 12.5px; }
.open-legend li { display: inline-flex; align-items: center; gap: 6px; }
.open-legend strong { font-variant-numeric: tabular-nums; }
.open-key { width: 10px; height: 10px; border-radius: 3px; }
@media (max-width: 480px) { .hbar-row { grid-template-columns: 1fr auto; } .hbar-track { grid-column: 1 / -1; order: 3; } }
/* P8.1 Approvals */
#page-approvals > * + * { margin-top: 12px; }
.tab-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 600; }
.tab-count.zero { background: var(--raised); color: var(--muted); }
.approval-list { list-style: none; margin: 0; padding: 0; }
.approval-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.approval-item:last-child { border-bottom: none; }
.approval-item.urgent { border-left: 3px solid var(--warn); padding-left: 10px; }
.approval-main { min-width: 0; }
.approval-detail { margin-top: 2px; overflow-wrap: anywhere; }
.approval-item .button { white-space: nowrap; text-decoration: none; }
@media (max-width: 600px) { .approval-item { flex-direction: column; align-items: flex-start; } }
/* P8.2 quick decisions and Not now */
.approval-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; flex-shrink: 0; }
.approval-main { flex: 1; }
@media (max-width: 600px) { .approval-actions { flex-wrap: wrap; justify-content: flex-start; } }
.hidden-section { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.hidden-item { opacity: 0.75; }
/* P8.3 Today */
#today-card #today-body > * + * { margin-top: 12px; }

/* P9.1 Production: review rounds */
.activity-list li.review-round { display: block; }
.review-round > div { margin: 2px 0; }
.review-round .inline { margin-top: 6px; }
.review-round .inline .small-button { margin-left: 0; }
.review-round textarea { flex: 1 1 100%; }
.review-feedback { padding: 4px 8px; border-left: 3px solid var(--warn); background: var(--warn-bg); white-space: pre-wrap; }
.review-round a { word-break: break-all; }
.review-ai { margin: 6px 0; }

[hidden] { display: none !important; } /* P17.1: hidden menu items stay hidden whatever their display rule */

/* P17.3 Confidential information */
.confidential-control { display: inline-flex; gap: 6px; align-items: center; }
.email.confidential { opacity: 0.85; border-style: dashed; }
.confidential-preview { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 6px; max-height: 240px; overflow: auto; }
.confidential-control .small-button { margin-left: 0; }

/* P17.4 */
.team-signature .input { flex: 1; min-width: 220px; }
.team-signature .small-button { margin-left: 0; }

/* P17.5 Two-step sign-in */
.two-step-qr svg { width: 200px; height: 200px; background: #FFFFFF; border-radius: 6px; padding: 6px; }
.two-step-code { max-width: 160px; letter-spacing: 2px; }
.recovery-codes { background: var(--bg); padding: 10px 14px; border-radius: 6px; columns: 2; font-size: 15px; }
.two-step-steps { padding-left: 20px; margin: 6px 0; }
.two-step-card { max-width: 520px; }

/* ===== P18.2 shared components ===== */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.icon-button { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.icon-button:hover { color: var(--text); background: var(--raised); }
time[title] { cursor: help; text-decoration: none; }

/* loading: a shimmer in the shape of the content that is coming */
.skeleton { display: grid; gap: 10px; padding: 4px 0; }
.skeleton-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--raised) 25%, color-mix(in srgb, var(--raised) 50%, var(--surface)) 50%, var(--raised) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skeleton-line:nth-child(2) { width: 82%; } .skeleton-line:nth-child(3) { width: 64%; } .skeleton-line:nth-child(4) { width: 76%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* nothing to show / something went wrong: always say what to do next */
.empty-state, .error-state { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 16px; color: var(--muted); }
.empty-state .icon, .error-state .icon { width: 26px; height: 26px; opacity: .8; }
.empty-state strong { color: var(--text); font-weight: 600; }
.error-state { color: var(--bad); }
.error-state p, .empty-state p { margin: 0; max-width: 460px; }
.error-state .button, .empty-state .button { margin-top: 6px; }

.small { font-size: 12.5px; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); }
mark { background: var(--mark); color: inherit; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } * { transition: none !important; } }
.small-button { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; vertical-align: -2px; }
.auth-card { padding: 26px 26px 22px; }


/* ===== P18.3 dialogs and pop-ups ===== */
.button.danger { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.button.danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); border-color: transparent; color: #FFFFFF; }
.dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface);
  color: var(--text); box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: rgba(5, 9, 20, 0.6); backdrop-filter: blur(2px); }
.dialog[open] { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.dialog-body { padding: 20px 22px 18px; display: grid; gap: 12px; }
.dialog-head { display: flex; align-items: center; gap: 12px; }
.dialog-head h2 { font-size: 17px; letter-spacing: -0.01em; }
.dialog-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.dialog-icon.danger { background: var(--bad-bg); color: var(--bad); }
.dialog-message { margin: 0; color: var(--muted); line-height: 1.55; white-space: pre-line; }
.dialog-error { margin: 0; color: var(--bad); min-height: 0; }
.dialog-error:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.dialog .form-field .input { width: 100%; }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 13px; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.ok .icon { color: var(--good); }
.toast.bad { background: var(--bad); color: #FFFFFF; }
@media (prefers-reduced-motion: reduce) { .dialog[open] { animation: none; } }

/* ===== P18.4 app frame: grouped icon menu, top bar, profile menu ===== */
.topbar { justify-content: flex-start; gap: 14px; }
.topbar .brand { width: 196px; flex: none; }
.menu-open { display: none; }
.top-search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); }
.top-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.top-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-size: 13.5px; }
.top-search input::placeholder { color: var(--muted); }
.top-search kbd { font: 500 11px var(--font); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.topbar-right { margin-left: auto; gap: 10px; }
.bell { position: relative; }
/* P18.10 the bell: your notifications */
.approvals-tab-tools { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 6px; }
.bell-wrap { position: relative; }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad);
  color: #FFFFFF; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bg, var(--surface)); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 24px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); z-index: 45; overflow: hidden; }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-list { overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.bell-item:hover, .bell-item:focus-visible { background: var(--raised); }
.bell-unread-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.bell-item.unread .bell-unread-dot { background: var(--accent); }
.bell-item.unread.urgent .bell-unread-dot { background: var(--bad); }
.bell-item:not(.unread) .bell-item-title { font-weight: 500; }
.bell-item-main { min-width: 0; display: grid; gap: 2px; }
.bell-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bell-item-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-item-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-empty { padding: 16px 14px; }
.bell-foot { display: block; padding: 10px 14px; font-size: 13px; color: var(--accent-text); text-decoration: none; border-top: 1px solid var(--border); }
.profile { position: relative; }
.profile-button { display: flex; align-items: center; gap: 8px; height: 38px; padding: 3px 10px 3px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.profile-button:hover { background: var(--raised); }
.profile-button .icon { width: 15px; height: 15px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #FFFFFF;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #FFFFFF)); }
.profile-name { font-size: 13px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 40; display: grid; gap: 2px; }
.profile-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.profile-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); text-decoration: none; font-size: 13.5px; cursor: pointer; text-align: left; }
.profile-item:hover, .profile-item:focus-visible { background: var(--raised); }
.profile-item .icon { color: var(--muted); }

.layout { min-height: calc(100vh - 60px); }
.sidebar { width: 224px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; gap: 2px; transition: width .18s ease; }
.nav-group { display: grid; gap: 2px; margin-bottom: 10px; }
.nav-group-label { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 4px 12px 4px; }
.nav-item { justify-content: flex-start; gap: 12px; white-space: nowrap; overflow: hidden; }
.nav-item .nav-badge { margin-left: auto; }
.nav-item .icon { flex: none; }
.nav-spacer { flex: 1; min-height: 12px; }
.nav-collapse { border: 0; background: none; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.layout.narrow .sidebar { width: 68px; }
.layout.narrow .nav-label, .layout.narrow .nav-group-label { display: none; }
.layout.narrow .nav-item { justify-content: center; padding: 10px; position: relative; }
.layout.narrow .nav-item .nav-badge { position: absolute; top: 3px; right: 5px; min-width: 16px; font-size: 10px; padding: 0 4px; }
.menu-backdrop { position: fixed; inset: 0; background: rgba(5, 9, 20, 0.55); z-index: 29; }

/* one page header everywhere: title, a short explanation, the main buttons on the right */
.page-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { display: grid; gap: 2px; }
.page-title h1 { margin: 0; }
.page-title-row { display: flex; align-items: center; gap: 10px; position: relative; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 13.5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-header > .help-button { align-self: center; }

@media (max-width: 900px) {
  .top-search kbd, .profile-name { display: none; }
  .topbar .brand { width: auto; }
}
@media (max-width: 760px) {
  .menu-open { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-name, .topbar-status { display: none; }
  .top-search { max-width: none; }
  .sidebar, .layout.narrow .sidebar { position: fixed; top: 0; left: 0; z-index: 30; height: 100vh; width: 260px; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .layout.menu-shown .sidebar { transform: none; }
  .layout.narrow .nav-label, .layout.narrow .nav-group-label { display: inline; }
  .layout.narrow .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .nav-collapse { display: none; }
}
@media (max-width: 420px) { .top-search { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ===== P18.5 Settings sections and Appearance per person ===== */
:root[data-accent="violet"] { --accent: #6D4AE8; --accent-strong: #9A80FF; --accent-soft: rgba(124, 92, 255, 0.16); --accent-text: #A893FF; --focus: 0 0 0 3px rgba(124, 92, 255, 0.35); }
:root[data-theme="light"][data-accent="violet"] { --accent: #6D4AE8; --accent-strong: #5A38D4; --accent-soft: rgba(109, 74, 232, 0.10); --accent-text: #6D4AE8; --focus: 0 0 0 3px rgba(109, 74, 232, 0.25); }
:root[data-accent="teal"] { --accent: #14B8A6; --accent-strong: #2DD4BF; --accent-soft: rgba(20, 184, 166, 0.16); --accent-text: #3FD3C2; --on-accent: #04201D; --focus: 0 0 0 3px rgba(20, 184, 166, 0.35); }
:root[data-theme="light"][data-accent="teal"] { --accent: #0B7468; --accent-strong: #095F55; --accent-soft: rgba(11, 116, 104, 0.10); --accent-text: #0B7468; --on-accent: #FFFFFF; --focus: 0 0 0 3px rgba(15, 140, 126, 0.25); }

/* compact: less space around rows and cards, so more fits on a small screen */
:root[data-density="compact"] body { font-size: 13.5px; }
:root[data-density="compact"] .card { padding: 13px 15px; }
:root[data-density="compact"] .content .card + .card { margin-top: 10px; }
:root[data-density="compact"] .conversation, :root[data-density="compact"] .deal-row, :root[data-density="compact"] .client-row { padding-top: 7px; padding-bottom: 7px; }
:root[data-density="compact"] .nav-item { padding-top: 7px; padding-bottom: 7px; }
:root[data-density="compact"] .button { min-height: 30px; padding: 4px 12px; }
:root[data-density="compact"] .data-table th, :root[data-density="compact"] .data-table td { padding: 5px 8px; }
:root[data-density="compact"] .content { padding-top: 20px; }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 80px; }
.settings-nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
.settings-nav-item:hover { background: var(--raised); color: var(--text); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.setting-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.setting-row > div:first-child { display: grid; gap: 2px; }
.setting-row .select { max-width: 260px; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav-item { white-space: nowrap; }
  .setting-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ===== P18.6 Home command center ===== */
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.home-tile { display: grid; gap: 4px; padding: 16px 18px; color: var(--text); text-decoration: none; transition: border-color .15s; }
a.home-tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tile-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.tile-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.tile-note { font-size: 12.5px; color: var(--muted); }
.home-tile.bad .tile-value { color: var(--bad); }
.home-tile.warn .tile-value { color: var(--warn); }
.content .home-tiles .card + .card, .content .home-grid > .card + .card { margin-top: 0; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 16px; }
.home-grid.single { grid-template-columns: minmax(0, 1fr); }
.card-link { font-size: 13px; color: var(--accent-text); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.waiting-list { list-style: none; margin: 0 -20px; padding: 0; }
.waiting-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); }
.waiting-row:hover { background: var(--hover); }
.waiting-row.urgent { box-shadow: inset 3px 0 0 var(--bad); }
.waiting-main { flex: 1; min-width: 0; display: grid; }
.waiting-title { color: var(--text); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting-title:hover { color: var(--accent-text); }
.waiting-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting-row .small-button { margin-left: 0; flex: none; }
.waiting-more { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--accent-text); }

.earn-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.earn-head > div { display: grid; }
.earn-total { font-size: 22px; letter-spacing: -0.02em; }
.earn-bars { display: flex; align-items: stretch; gap: 8px; height: 150px; margin: 14px 0 6px; }
.earn-bar { flex: 1; display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 6px; position: relative; outline: none; }
.earn-track { width: 100%; max-width: 24px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.earn-track i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.earn-bar.now .earn-track i { background: var(--accent); }
.earn-month { font-size: 11.5px; color: var(--muted); }
.earn-bar:hover::after, .earn-bar:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px;
  color: var(--text); box-shadow: var(--shadow-pop); z-index: 5; }
.earn-bar:hover .earn-track i { filter: brightness(1.15); }

.week-list { list-style: none; margin: 0; padding: 0; }
.week-row { display: grid; grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.week-row:first-child { border-top: 0; }
.next-row { grid-template-columns: 200px minmax(0, 1.2fr) minmax(0, 1fr) auto; }
.next-row .week-day { font-weight: 500; }
.next-row .week-day .deadline { white-space: normal; }
.next-more { padding: 8px 0 0; border-top: 1px solid var(--border); }
#next-card { margin-bottom: 16px; }
.week-day { font-weight: 600; font-size: 13px; }
.week-day.warn { color: var(--warn); }
.week-day.bad { color: var(--bad); }
.week-deal { color: var(--text); font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-deal:hover { color: var(--accent-text); }

.health-strip .card-header { margin-bottom: 0; flex-wrap: wrap; gap: 10px; }
.health-lights { display: flex; gap: 6px; flex-wrap: wrap; }
.health-details { margin-top: 12px; }
.health-details > summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
.health-details > .card { margin-top: 12px; box-shadow: none; background: var(--bg); }
@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .week-row { grid-template-columns: 90px minmax(0, 1fr); }
  .next-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .week-row .muted, .week-row .badge { grid-column: 2; }
  .next-row .muted, .next-row .badge { grid-column: 1; justify-self: start; }
}
@media (max-width: 600px) {
  .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-value { font-size: 21px; }
  .waiting-row { flex-wrap: wrap; }
  .waiting-main { flex-basis: 100%; order: 2; }
  .waiting-row .small-button { margin-left: auto; }
}
.earn-bar:nth-last-child(-n+2):hover::after, .earn-bar:nth-last-child(-n+2):focus-visible::after { left: auto; right: 0; transform: none; }
.earn-bar:nth-child(-n+2):hover::after, .earn-bar:nth-child(-n+2):focus-visible::after { left: 0; transform: none; }
a.button { display: inline-flex; }

/* ===== P18.7 Inbox in two panes ===== */
.content:has(.inbox-split) { max-width: none; }
.inbox-split { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox-list .list-card { max-height: calc(100vh - 250px); overflow-y: auto; }
.reader-pane { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); min-height: 320px; }
.reader-pane .page-header { margin-bottom: 8px; }
.reader-pane .conversation-title { font-size: 18px; }
.reader-pane .open-full { margin-left: auto; }
.reader-pane > .empty-state { padding: 80px 16px; }
.reader-pane .email { box-shadow: none; }
.inbox-split .conversation-snippet { white-space: nowrap; }
.inbox-split .sender-address { display: none; }
.conversation.open { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.conversation-row { display: flex; align-items: stretch; border-top: 1px solid var(--border); }
.conversation-row:first-child { border-top: none; }
.conversation-row .conversation { flex: 1; min-width: 0; border-top: none; padding-left: 6px; }
/* Starred conversations (2026-11-27) */
.star-button { flex: none; align-self: flex-start; background: none; border: none; cursor: pointer; font-size: 20px; line-height: 1;
  padding: 12px 10px; color: var(--muted); border-radius: 8px; }
.star-button:hover { color: var(--warn); background: var(--raised); }
.star-button.on { color: var(--warn); }
.star-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.page-header .star-button { padding: 4px 6px; align-self: center; font-size: 24px; }
.star-filter { display: inline-flex; align-items: center; gap: 6px; }
.star-filter .star-icon { color: var(--warn); font-size: 16px; line-height: 1; }
.star-filter.on { border-color: var(--warn); color: var(--text); background: var(--warn-bg); font-weight: 600; }
.conversation-tick { margin: 14px 0 0 14px; flex: none; }
.select-all { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.select-all + .conversation-row { border-top: none; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; margin-bottom: 10px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-text); }
.bulk-bar .small-button { margin-left: 0; }

/* P18.12 Calendar: a month / week grid; entries colored by kind, late ones say so in words */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-arrow { padding: 6px 9px; }
.cal-prev .icon { transform: rotate(180deg); }
.cal-title { font-size: 18px; margin: 0 0 0 8px; }
.cal-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-filter { font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 11px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.cal-filter.on { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cal-filter:not(.on) .cal-mark { opacity: .3; }
.cal-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-setting { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.cal-setting select { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.cal-mark { width: 4px; align-self: stretch; min-height: 12px; border-radius: 2px; flex: none; background: var(--accent); }
.cal-filter .cal-mark { width: 10px; height: 10px; min-height: 0; align-self: center; border-radius: 3px; }
.deadline > .cal-mark { background: var(--accent); }
.published > .cal-mark { background: var(--good); }
.payment > .cal-mark { background: var(--violet); }
.cal-grid { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 14px; }
.cal-row.head, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekday { font-size: 12px; font-weight: 600; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 104px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-grid.week .cal-cell { min-height: 260px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.outside { background: var(--hover); }
.cal-cell.outside .cal-day-number { color: var(--muted); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell-head { display: flex; }
.cal-day-number { font: inherit; font-size: 12.5px; font-weight: 600; min-width: 26px; height: 26px; border-radius: 999px; border: none;
  background: transparent; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.cal-day-number:hover { background: var(--raised); }
.cal-cell.today .cal-day-number { background: var(--accent); color: var(--on-accent); }
.cal-entry { display: flex; gap: 6px; padding: 2px 5px 2px 3px; border-radius: 6px; color: var(--text); text-decoration: none;
  font-size: 12px; line-height: 1.35; min-width: 0; }
.cal-entry:hover { background: var(--raised); }
.cal-entry-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-lead { font-weight: 600; }
.cal-entry.late .cal-lead, .cal-entry.overdue .cal-lead { color: var(--bad); }
.cal-entry.late, .cal-entry.overdue { background: var(--bad-bg); }
.cal-entry.done { color: var(--muted); }
.cal-deal { color: inherit; }
.cal-more { font-size: 12px; text-align: left; padding: 1px 6px; }
.cal-day-list { display: grid; gap: 4px; }
.cal-day-list .cal-entry { font-size: 13px; padding: 7px 9px 7px 5px; }
.cal-day-list .cal-entry-text { white-space: normal; }
.block { display: block; }
@media (max-width: 720px) {
  .cal-cell { min-height: 58px; padding: 2px; }
  .cal-grid.month .cal-entry, .cal-grid.month .cal-more { display: none; }  /* phone: dots only; the day list below shows the entries */
  .cal-grid.month .cal-cell-head { flex-direction: column; align-items: center; }
  .cal-grid.month .cal-cell.has-entries .cal-cell-head::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 2px; }
  .cal-grid.month .cal-cell.has-late .cal-cell-head::after { background: var(--bad); }
  .cal-grid.week .cal-days { grid-template-columns: 1fr; }
  .cal-grid.week .cal-row.head { display: none; }
  .cal-grid.week .cal-cell { min-height: 0; border-right: none; }
  .cal-setting { margin-left: 0; }
}
.cal-cell-weekday { align-self: center; margin-left: 4px; display: none; }
@media (max-width: 720px) { .cal-grid.week .cal-cell-weekday { display: inline; } }
.received > .cal-mark { background: var(--muted); }
/* Calendar list view (2026-11-26; table layout 2026-11-28) */
.cal-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; }
.cal-kpi { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); border-top: 3px solid var(--border); }
.cal-kpi:hover { background: var(--hover); }
.cal-kpi.bad { border-top-color: var(--bad); }
.cal-kpi.warn { border-top-color: var(--warn); }
.cal-kpi.info { border-top-color: var(--accent); }
.cal-kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.cal-kpi-number { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.cal-kpi.bad .cal-kpi-number { color: var(--bad); }
.cal-kpi-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-group { margin-bottom: 16px; padding: 0; overflow: hidden; }
.cal-group-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cal-group-head h2 { margin: 0; font-size: 16px; }
.cal-group-value { margin-left: auto; font-weight: 600; font-size: 14px; }
.cal-empty { margin: 0; padding: 14px 16px; }
.cal-table { display: grid; }
.cal-table-head, .cal-table-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 130px 180px 110px; gap: 14px; align-items: center; padding: 10px 16px; }
.cal-table-head.priced, .cal-table-row.priced { grid-template-columns: 130px minmax(0, 1fr) 130px 180px 110px 100px; }
.cal-cell-email .badge { white-space: normal; text-align: left; }
.cal-table-head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  background: var(--raised); padding-top: 8px; padding-bottom: 8px; }
.cal-table-row { color: var(--text); text-decoration: none; border-top: 1px solid var(--border); border-left: 3px solid transparent; padding-left: 13px; }
.cal-table-head { border-left: 3px solid transparent; padding-left: 13px; }
.cal-table-head + .cal-table-row { border-top: none; }
.cal-table-row:hover { background: var(--hover); }
.cal-table-row.late { border-left-color: var(--bad); }
.cal-table-row.late .cal-cell-when strong { color: var(--bad); }
.cal-table-row.late.long .cal-cell-when strong { font-weight: 800; }
.cal-table-row.due { border-left-color: var(--warn); }
.cal-table-row.due .cal-cell-when strong { color: var(--warn); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cal-cell-main { min-width: 0; display: grid; gap: 2px; }
.cal-deal-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-video { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); }
.cal-video-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-kind { color: var(--violet); font-weight: 600; }
.cal-tag { flex: none; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.cal-tag.ok { color: var(--good); border-color: var(--good); background: var(--good-bg); }
.cal-cell-stage .badge { white-space: nowrap; }
.cal-cell-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-cell-price { white-space: nowrap; }
@media (max-width: 900px) {
  .cal-kpis { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .cal-kpi { padding: 10px 12px; }
  .cal-kpi-number { font-size: 22px; }
  .cal-kpi-value { display: none; }
  .cal-table-head { display: none; }
  .cal-table-row, .cal-table-row.priced { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .cal-cell-main { grid-column: 1 / -1; grid-row: 2; }
  .cal-cell-when { grid-row: 1; }
  .cal-cell-price { grid-row: 1; grid-column: 2; }
  .cal-cell-stage { grid-row: 3; }
  .cal-cell-email { grid-row: 4; }
  .cal-cell-who { grid-row: 3; text-align: right; }
  .cal-video { flex-wrap: wrap; }
  .cal-video-text, .cal-deal-name { white-space: normal; }
}

/* P18.13 Client pages: the client at a glance */
.client-overview { margin-bottom: 16px; }
.client-overview .stat-value { font-size: 20px; }
.client-deal.head { font-size: 12px; font-weight: 600; color: var(--muted); border-top: none; padding-top: 0; }
@media (max-width: 900px) { .client-deal.head { display: none; } }

/* P18.14 Quick find */
.quick-open { flex: none; border: 1px solid var(--border); background: var(--bg); color: var(--muted); border-radius: 6px; padding: 2px 8px;
  font: 500 11.5px var(--font); cursor: pointer; white-space: nowrap; }
.quick-open:hover { color: var(--text); border-color: var(--accent); }
.quick-open:focus-visible { outline: none; box-shadow: var(--focus); }
.quick-phone { display: none; }
@media (max-width: 420px) { .quick-phone { display: inline-grid; } }
.quick-dialog { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; padding: 0; display: none; }
.quick-dialog[open] { display: flex; flex-direction: column; max-height: 72vh; }
.quick-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--muted); }
.quick-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font: 15px var(--font); }
.quick-input::placeholder { color: var(--muted); }
.quick-dialog kbd { font: 500 11px var(--font); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
  color: var(--muted); background: var(--raised); margin-right: 3px; }
.quick-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.quick-group { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px 4px; }
.quick-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.quick-item .icon { color: var(--muted); flex: none; }
.quick-item.active { background: var(--accent-soft); }
.quick-item.active .icon { color: var(--accent-text); }
.quick-text { display: flex; flex-direction: column; min-width: 0; }
.quick-label, .quick-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-empty { padding: 18px 12px; }
.quick-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); }
@media (max-width: 600px) { .quick-foot { display: none; } .quick-dialog { margin-top: 8px; max-height: 85vh; } }
.quick-input:focus-visible { box-shadow: none; }

/* ===== P18.15 Phone and accessibility pass ===== */
/* keyboard: a "Skip to the page content" link appears with Tab, first on every page */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; padding: 10px 14px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; }
main.content:focus { outline: none; }
/* reduced motion: no animations or smooth movement for people who switched it off in Windows / their phone */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}
/* phones and touch screens: everything you tap is at least about 36 px (help buttons and ticks get a bigger tap area) */
@media (max-width: 720px), (pointer: coarse) {
  .button.small-button, a.button.small-button, .view-chip, .select, .input { min-height: 36px; }
  .segment { min-height: 38px; }
  .help-button { position: relative; }
  .help-button::after { content: ""; position: absolute; inset: -10px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .cal-day-number { min-width: 34px; height: 34px; }
  .swatch { width: 36px; height: 36px; }
  .link-like.small { padding: 8px 0; }
  .icon-button { width: 40px; height: 40px; }
}
@media (max-width: 720px) { table.records-table { display: block; overflow-x: auto; max-width: 100%; } }
.cal-setting select { min-height: 32px; }
/* phones: each Deal is a card; every value has its column name above it, the title row spans the card */
@media (max-width: 900px) {
  .deal-row:not(.deal-head) .deal-cell[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600;
    color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
  .deal-row:not(.deal-head) .deal-title { grid-column: 1 / -1; }
}

/* ===== P18.16 Help & guide, tour, What's new ===== */
.help-guide-link { display: inline-block; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.help-guide-link:hover { text-decoration: underline; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.guide-toc a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-size: 13px; background: var(--surface); }
.guide-toc a:hover { border-color: var(--accent); color: var(--accent-text); }
.guide-part { scroll-margin-top: 80px; }
.guide-part:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.guide-part p { margin: 6px 0; line-height: 1.6; max-width: 80ch; }
.content .guide-part + .guide-part, .content .guide-part + .card { margin-top: 12px; }
.release { padding: 10px 0; border-top: 1px solid var(--border); }
.release:first-of-type { border-top: none; }
.release-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.release ul { margin: 6px 0 0; padding-left: 20px; }
.release li { margin: 3px 0; line-height: 1.5; }
.whats-new { width: min(560px, calc(100vw - 24px)); }
.whats-new-list { max-height: 55vh; overflow-y: auto; }
.tour-box { position: fixed; inset: auto 20px 20px auto; margin: 0; width: min(380px, calc(100vw - 32px)); padding: 18px 20px 14px;
  border: 1px solid var(--accent); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); z-index: 900; }
.tour-box h2 { font-size: 17px; margin: 4px 0 6px; }
.tour-box p { margin: 0 0 12px; color: var(--muted); line-height: 1.55; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-gap { flex: 1; }
.tour-spot { position: relative; z-index: 850; box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px var(--accent-soft) !important; border-radius: 10px; }
@media (max-width: 600px) { .tour-box { inset: auto 12px 12px 12px; width: auto; } }
.stack { display: grid; gap: 6px; }
/* P18.17 Deals filters: one row on a computer; folded under "Filters" on a phone */
.deal-filters { display: contents; }
.deal-filters > summary { display: none; }
.deal-filters-body { display: contents; }
@media (max-width: 720px) {
  .deal-filters { display: block; width: 100%; }
  .deal-filters > summary { display: inline-flex; list-style: none; cursor: pointer; }
  .deal-filters > summary::-webkit-details-marker { display: none; }
  .deal-filters[open] > summary { margin-bottom: 8px; }
  .deal-filters-body { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
  .deals-toolbar .select { max-width: none; flex: 1 1 140px; }
  .multi-filter { flex: 1 1 140px; }
  .multi-filter > summary { max-width: none; width: 100%; }
  .multi-menu { left: 0; right: 0; min-width: 0; }
}
.insight-fold .insight-head > .badge:first-child { display: none; }
/* P18.25: links in the email text and the original formatting */
.email-link { color: var(--accent-text); text-decoration: underline; word-break: break-all; }
.email-link.risky { color: var(--bad); }
.link-warning { margin-left: 6px; font-size: 11px; vertical-align: middle; }
.original { margin-top: 10px; }
.original-view:not(:empty) { margin-top: 8px; }
.original-frame { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: 10px; background: #fff; display: block; }
.original-bar { padding: 6px 10px; margin-bottom: 6px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }
/* P18.26: foldable sections (Deal page) */
.foldable > h2, .foldable > .card-header > h2 { cursor: pointer; user-select: none; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.foldable > h2::before, .foldable > .card-header > h2::before { content: "▾"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.foldable.folded > h2::before, .foldable.folded > .card-header > h2::before { transform: rotate(-90deg); }
.foldable.folded > h2::after, .foldable.folded > .card-header > h2::after { content: attr(data-summary); font-size: 13px; font-weight: 400; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.foldable > h2:focus-visible, .foldable > .card-header > h2:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.foldable.folded > :not(h2):not(.card-header) { display: none !important; }
.foldable.folded > .card-header { margin-bottom: 0; }
.foldable.folded > h2 { margin-bottom: 0; }
.fold-buttons { display: inline-flex; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .foldable > h2::before, .foldable > .card-header > h2::before { transition: none; } }
.deal-items.foldable { margin-bottom: 16px; }
/* P17.6: assigned work and team notes */
.assign-select { max-width: 200px; padding-top: 3px; padding-bottom: 3px; }
.assign-field { display: inline-flex; align-items: center; gap: 6px; }
.assignee-line { margin-top: 2px; }
.team-note-new { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.team-note-new textarea { flex: 1; min-height: 40px; resize: vertical; }
.team-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.team-note { border-left: 3px solid var(--border); padding: 2px 0 2px 10px; }
.team-note-head { color: var(--muted); }
.team-note-head strong { color: var(--text); font-weight: 600; }
.team-note-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.work-list { display: flex; flex-direction: column; }
.work-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--border);
  color: inherit; text-decoration: none; }
.work-row:first-child { border-top: none; }
.work-row:hover { background: var(--hover, rgba(127,127,127,.06)); }
.work-row:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.work-main { min-width: 0; }
.work-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) { .work-row { flex-direction: column; align-items: flex-start; } .work-meta { justify-content: flex-start; } .team-note-new { flex-direction: column; } .team-note-new textarea { width: 100%; } }
/* the bell list on a phone: across the screen under the top bar (it was cut off on the left) */
@media (max-width: 720px) { .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
/* P17.7: Team summary */
.work-tabs { margin-bottom: 14px; }
.day-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.day-bar > * { flex: none; margin: 0; }
.day-bar .day-input { width: auto; padding-top: 4px; padding-bottom: 4px; }
.team-numbers { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.team-changes > summary { cursor: pointer; color: var(--accent-text); font-size: 13px; margin-top: 4px; }
.team-change-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.team-change { display: grid; grid-template-columns: 44px 84px 1fr; gap: 8px; align-items: baseline; font-size: 13.5px; }
.team-change-group { justify-self: start; }
.team-change-text { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) { .team-change { grid-template-columns: 44px 1fr; } .team-change-group { display: none; } }
/* P18.27 Inbox filters */
.filter-menus { gap: 8px; }
.filter-menus .multi-menu input[type=radio] { accent-color: var(--accent); }

/* Video scripts (2026-11-28) */
.script-card h3 { margin: 0; }
.script-text { width: 100%; min-height: 220px; resize: vertical; font-size: 15px; line-height: 1.6; font-family: inherit; }
.script-text[readonly] { background: var(--raised); }
.script-versions { margin-top: 10px; }
.script-version-list li { display: grid; gap: 4px; }
.script-old { white-space: pre-wrap; background: var(--raised); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; font-family: inherit; font-size: 14px; }
.script-actions { margin-top: 8px; gap: 8px; }
.cal-deal-stage { margin-top: 3px; font-size: 11px; }
.cal-last-email { margin-top: 3px; font-size: 11px; white-space: nowrap; }
.cal-deal-id { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 2px; }
.cal-tag.vnum { order: -1; border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
