/* Emdad Global platform. Tokens from DESIGN.md (direction set with the Lovable design review, 13 Oct 2026). */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/PlusJakartaSans-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/fonts/PlexArabic-400-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("/fonts/PlexArabic-500-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("/fonts/PlexArabic-600-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/fonts/PlexArabic-700-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/fonts/PlexArabic-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/fonts/PlexArabic-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("/fonts/DMSans-latin.woff2") format("woff2"); }

:root {
  /* tonal scales */
  --green-50: #f0f8f4; --green-100: #e0efe7; --green-200: #c3dfd2; --green-300: #9ac8b5; --green-400: #73b29b; --green-500: #4f9a82; --green-600: #397c67; --green-700: #2e6354; --green-800: #284f44; --green-900: #223f37;
  --peach-50: #fff8f0; --peach-100: #ffecd9; --peach-200: #f9dbba; --peach-300: #f5c99b; --peach-400: #efad71; --peach-500: #e88c4c; --peach-600: #d56c2c; --peach-700: #af5022; --peach-800: #8c4123; --peach-900: #713720;
  --neutral-50: #f7f9f8; --neutral-100: #eef2ef; --neutral-200: #dee5e0; --neutral-300: #c3cec7; --neutral-400: #99aaa0; --neutral-500: #75887c; --neutral-600: #586e62; --neutral-700: #40574b; --neutral-800: #293f34; --neutral-900: #192d24;
  /* roles — light. Text and status colours reach 4.5:1 (WCAG AA) on every surface and soft background they sit on. */
  --surface-1: #ffffff; --surface-2: #f7f9f8; --surface-3: #eef2ef;
  --page: var(--surface-2); --surface: var(--surface-1);
  --sidebar: #ffffff; --hero: #e0efe7;
  --text: #223b30; --text-2: #53685c; --text-3: #627167;
  --line: var(--neutral-200); --border: var(--neutral-200);
  --primary: #397c67; --primary-fg: #ffffff; --primary-hover: #2e6354;
  --brand: #4f9a82; --brand-ink: #2e6354; --brand-soft: #e0efe7;
  --accent: #f5c99b; --accent-ink: #8c4123; --accent-soft: #ffecd9;
  --good: #24795a; --good-soft: #e7f4ed; --warn: #96621d; --warn-soft: #fff1d9; --bad: #ae4d4d; --bad-soft: #fcecec; --info: #3f7194; --info-soft: #eaf2f8;
  --scrim: rgba(25, 45, 36, .5);
  /* shape */
  --r-input: 6px; --r-compact: 10px; --r-card: 16px; --r-wide: 18px; --r-hero: 24px; --r-pill: 999px;
  --radius-sm: var(--r-input); --radius: var(--r-card); --radius-lg: var(--r-hero);
  --shadow-sm: 0 2px 5px rgba(25, 45, 36, .03); --shadow-md: 0 4px 16px rgba(25, 45, 36, .05); --shadow-lg: 0 14px 50px rgba(25, 45, 36, .14);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif; --display: "Plus Jakarta Sans", "DM Sans", "Segoe UI", system-ui, sans-serif; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --rail-w: 238px;
}
.theme-dark, :root[data-theme="dark"] {
  --surface-1: #1b3026; --surface-2: #11231b; --surface-3: #253c30; --page: var(--surface-2); --surface: var(--surface-1);
  --sidebar: #162920; --hero: #284c3b;
  --text: #e8f1eb; --text-2: #b3c7ba; --text-3: #a4b9ad;
  --line: #2d453a; --border: #2d453a;
  --primary: #73b29b; --primary-fg: #223f37; --primary-hover: #9ac8b5;
  --brand: #73b29b; --brand-ink: #c3dfd2; --brand-soft: #284c3b;
  --accent: #efad71; --accent-ink: #f9dbba; --accent-soft: #443724;
  --good: #76c7a2; --good-soft: #203f30; --warn: #edc183; --warn-soft: #443724; --bad: #ee9292; --bad-soft: #422b2a; --info: #91bfdf; --info-soft: #243947;
  --scrim: rgba(0, 0, 0, .55);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .25); --shadow-lg: 0 14px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-1: #1b3026; --surface-2: #11231b; --surface-3: #253c30; --page: var(--surface-2); --surface: var(--surface-1);
    --sidebar: #162920; --hero: #284c3b;
    --text: #e8f1eb; --text-2: #b3c7ba; --text-3: #a4b9ad;
    --line: #2d453a; --border: #2d453a;
    --primary: #73b29b; --primary-fg: #223f37; --primary-hover: #9ac8b5;
    --brand: #73b29b; --brand-ink: #c3dfd2; --brand-soft: #284c3b;
    --accent: #efad71; --accent-ink: #f9dbba; --accent-soft: #443724;
    --good: #76c7a2; --good-soft: #203f30; --warn: #edc183; --warn-soft: #443724; --bad: #ee9292; --bad-soft: #422b2a; --info: #91bfdf; --info-soft: #243947;
    --scrim: rgba(0, 0, 0, .55);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .25); --shadow-lg: 0 14px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.55; }
[dir="rtl"] body, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .display, [dir="rtl"] .metric-value, [dir="rtl"] .rail-brand b { font-family: "IBM Plex Sans Arabic", var(--font); letter-spacing: 0; }
/* Arabic: slightly larger and darker, since Arabic glyphs read lighter at the same size. Latin
   names keep their own direction (so "Co." does not jump to the far side) while every cell stays
   aligned to the right edge. */
[dir="rtl"] { --text-2: #44584c; --text-3: #5f746a; }
[dir="rtl"].theme-dark, [dir="rtl"][data-theme="dark"] { --text-2: #c0d2c6; --text-3: #9db5a6; }
[dir="rtl"] body { font-size: 15px; }
[dir="rtl"] table.data { font-size: 14.5px; }
[dir="rtl"] table.data th { font-size: 12.5px; }
[dir="rtl"] .micro { font-size: 12.5px; }
[dir="rtl"] .small, [dir="rtl"] .item .sub, [dir="rtl"] .follow-person, [dir="rtl"] .follow-meta, [dir="rtl"] .subtitle { font-size: 13.5px; }
[dir="rtl"] .dcard .co, [dir="rtl"] .dcard .t, [dir="rtl"] .follow-title > span, [dir="rtl"] .company-top h1, [dir="rtl"] table.data td, [dir="rtl"] table.data td > *, [dir="rtl"] .item .title, [dir="rtl"] .item .sub, [dir="rtl"] .tl .head, [dir="rtl"] .tl .text, [dir="rtl"] .fact-value, [dir="rtl"] .page-heading h1, [dir="rtl"] .contact-item h3, [dir="rtl"] .contact-item p, [dir="rtl"] .company-deal h3, [dir="rtl"] .product-cell, [dir="rtl"] .follow-subject { unicode-bidi: plaintext; text-align: right; }
[dir="rtl"] table.data td.r, [dir="rtl"] table.data th.r { text-align: left; }
[dir="rtl"] .eyebrow, [dir="rtl"] .nav-label, [dir="rtl"] table.data th, [dir="rtl"] .fact-label, [dir="rtl"] .kv div b { letter-spacing: 0; text-transform: none; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, .display { font-family: var(--display); margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.micro { font-size: 11px; color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: end; }
.text-primary { color: var(--primary); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% 0%, var(--green-100), transparent 60%), radial-gradient(900px 500px at 100% 100%, var(--peach-100), transparent 60%), var(--page); }
.login-card { width: min(400px, 100%); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-hero); box-shadow: var(--shadow-lg); padding: 32px; display: grid; gap: 16px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand b { display: block; font-family: var(--display); font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.login-brand b i { font-style: normal; color: var(--primary); }
.login-brand small { color: var(--text-3); font-size: 10px; letter-spacing: .08em; font-weight: 600; text-transform: uppercase; }
.login-error { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: var(--r-compact); font-size: 13px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100%; }
.rail { background: var(--sidebar); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px 12px; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 26px; color: var(--text); }
.rail-brand svg { width: 40px; height: 40px; color: var(--brand); flex: none; }
.rail-brand b { display: block; font-family: var(--display); font-size: 16px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.rail-brand img { width: 40px; height: 40px; }
.rail-brand b i { font-style: normal; color: var(--primary); }
.rail-brand small { display: block; font-size: 9px; letter-spacing: .08em; color: var(--text-3); font-weight: 600; margin-top: 4px; }
.rail-nav { display: flex; flex-direction: column; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-3); padding: 12px 16px 5px; }
.rail-nav a { height: 44px; display: flex; align-items: center; gap: 13px; padding: 0 17px; border-radius: var(--r-pill); color: var(--text-2); font-size: 14.5px; font-weight: 500; margin: 1px 0; }
.rail-brand { padding-bottom: 14px; }
.connection { padding: 10px 12px 8px; }
[dir="rtl"] .eyebrow, [dir="rtl"] .topbar-date, [dir="rtl"] .micro { unicode-bidi: plaintext; }
.rail-nav a:hover { background: var(--surface-2); text-decoration: none; }
.rail-nav a.active { background: var(--green-100); color: var(--green-800); font-weight: 700; }
.theme-dark .rail-nav a.active, :root[data-theme="dark"] .rail-nav a.active { background: var(--surface-3); color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail-nav a.active { background: var(--surface-3); color: var(--text); } }
.rail-nav i { width: 19px; height: 19px; display: inline-block; flex: none; }
.nav-count { margin-inline-start: auto; background: var(--peach-200); color: var(--green-900); border-radius: var(--r-pill); min-width: 23px; height: 23px; padding: 0 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.rail-bottom { margin-top: auto; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 11px; padding: 18px 12px 12px; }
.connection i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); display: inline-block; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 14px 8px 2px; border-top: 1px solid var(--line); }
.user-card b { display: block; font-size: 12.5px; font-weight: 600; }
.user-card .micro { margin-top: 2px; }
.user-card a { margin-inline-start: auto; color: var(--text-3); font-size: 12px; }
.avatar { width: 35px; height: 35px; border-radius: 50%; background: var(--green-100); color: var(--green-800); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; font-family: var(--display); }
.avatar.peach { background: var(--peach-100); color: var(--peach-800); }
.avatar.sm { width: 24px; height: 24px; font-size: 9px; }
.theme-dark .avatar, :root[data-theme="dark"] .avatar { background: var(--surface-3); color: var(--text); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 72px; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--surface-1); position: sticky; top: 0; z-index: 5; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12.5px; min-width: 0; }
.breadcrumb strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb a { color: inherit; text-decoration: none; white-space: nowrap; min-width: 0; border-radius: 6px; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#crumb-here { display: flex; min-width: 0; }
.crumb-mid { display: flex; align-items: center; gap: 10px; }
.crumb-mid[hidden] { display: none; }
.hub-tabs { display: flex; gap: 6px; padding: 22px 32px 0; max-width: 1500px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.hub-tabs[hidden] { display: none; }
.hub-tabs a { flex: none; padding: 8px 16px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13.5px; border: 1px solid var(--line); background: var(--surface-1); }
.hub-tabs a:hover { color: var(--text); border-color: var(--brand); }
.hub-tabs a.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.hub-tabs + .page { padding-top: 18px; }
@media (max-width: 640px) { .hub-tabs { padding: 14px 16px 0; } }
.cols-box .cols-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 22px; }
.cols-group { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; align-content: start; }
.cols-group legend { font-weight: 700; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
[dir="rtl"] .cols-group legend { text-transform: none; letter-spacing: 0; }
.cols-add { display: grid; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.companies-table td { vertical-align: top; }
table.data th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.sortable::after { content: "↕"; display: inline-block; margin-inline-start: 5px; font-size: 10px; opacity: .35; }
table.data th.sortable:hover::after { opacity: .7; }
table.data th.sortable[aria-sort="ascending"]::after { content: "▲"; opacity: .9; color: var(--brand); }
table.data th.sortable[aria-sort="descending"]::after { content: "▼"; opacity: .9; color: var(--brand); }
table.data th.sortable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.list a.item { color: inherit; text-decoration: none; }
.list a.item:hover { background: var(--surface-2); }
.item.trial { align-items: flex-start; gap: 14px; }
.item.trial details { margin-top: 6px; }
.item.trial summary { cursor: pointer; }
pre.mail-body { white-space: pre-wrap; font-family: var(--font-body, inherit); font-size: 13px; line-height: 1.65; margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); max-height: 420px; overflow: auto; }
.autopilot-state .card-head { flex-wrap: wrap; gap: 10px; }
.ai-write { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.ai-write .micro { min-width: 0; }
.ai-write .btn { flex: none; }
a.co-link { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a.co-link:hover { color: var(--brand); text-decoration-color: currentColor; }
.page-title { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.topbar-date { font-size: 12px; color: var(--text-3); margin-inline-end: 6px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* One column no wider than the screen: a wide table or a long address scrolls inside its card, the page does not. */
.page { padding: 30px 32px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; max-width: 1500px; width: 100%; }
.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 1150px) { :root { --rail-w: 210px; } .page, .topbar { padding-left: 22px; padding-right: 22px; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 238px; z-index: 20; transform: translateX(-100%); transition: transform 200ms; }
  [dir="rtl"] .rail { transform: translateX(100%); }
  .rail.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim.open { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 15; }
  .menu-btn { display: inline-flex; }
  .topbar { height: 64px; padding: 0 14px; }
  .page { padding: 20px 16px 48px; }
  .topbar-date { display: none; }
}

/* ---------- page heading ---------- */
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.eyebrow { font-size: 10.5px; letter-spacing: .08em; font-weight: 700; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.subtitle { color: var(--text-2); font-size: 13.5px; margin: 8px 0 0; max-width: 80ch; line-height: 1.6; }
.heading-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.explain { color: var(--text-2); font-size: 13.5px; max-width: 80ch; margin: -8px 0 0; line-height: 1.6; }
/* A note that follows a card or a row of tiles sits below it, not against it. */
.card + .explain, .tiles + .explain, .grid-2 + .explain, form.card + .explain { margin-top: 16px; }
.alert-card .item { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.stock-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- metrics (Today) ---------- */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric { border: 1px solid transparent; border-radius: var(--r-wide); min-height: 138px; background: var(--surface-1); text-align: start; padding: 16px 17px; cursor: pointer; transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; min-width: 0; }
.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.metric.bad { background: var(--bad-soft); color: var(--bad); }
.metric.good { background: var(--good-soft); color: var(--good); }
.metric.warn { background: var(--warn-soft); color: var(--warn); }
.metric.info { background: var(--info-soft); color: var(--info); }
.metric.neutral { background: var(--surface-3); color: var(--text-2); }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-top i { width: 18px; height: 18px; display: inline-block; }
.metric-value { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-label { color: var(--text); font-weight: 600; font-size: 12.5px; margin-top: auto; padding-top: 12px; }
.metric-detail { font-size: 10.5px; margin-top: 3px; line-height: 1.5; }
@media (max-width: 1150px) { .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .metric { min-height: 120px; } .metric-value { font-size: 32px; } }

/* ---------- layout helpers ---------- */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }
/* The emails page: the list beside the open email, one under the other on a phone. */
.grid-2.mail-grid { grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.4fr); }
@media (max-width: 760px) { .grid-2.mail-grid { grid-template-columns: minmax(0, 1fr); } }
/* The company page: contacts and deals beside the timeline, one under the other below a tablet. */
.grid-2.company-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
/* Lists of very different lengths, packed in columns: a long list leaves no hole beside it (owner, 14 Nov 2026). */
.lists-masonry { columns: 2 340px; column-gap: 22px; }
.lists-masonry > .card { break-inside: avoid; margin-bottom: 22px; display: block; width: 100%; }
.lists-masonry.packed { columns: auto; display: flex; gap: 22px; align-items: flex-start; }
.lists-masonry .mason-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.lists-masonry.packed .card { margin-bottom: 0; }
@media (max-width: 900px) { .grid-2.company-grid { grid-template-columns: minmax(0, 1fr); } }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.stack { display: grid; gap: 22px; align-content: start; }
@media (max-width: 900px) { .today-grid { grid-template-columns: 1fr; } }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { display: flex; align-items: center; gap: 9px; }
.section-heading .spacer { margin-inline-start: auto; }
.small-count { font-family: var(--font); background: var(--surface-3); color: var(--text-2); font-size: 10px; font-weight: 600; padding: 3px 7px; border-radius: var(--r-pill); }
.minor-section { margin-top: 10px; }
.empty-line { display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); padding: 16px 0; }
.empty-line:last-child { border-bottom: 0; }
.empty-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-3); flex: none; }
.empty-icon i { width: 17px; height: 17px; display: inline-block; }
.empty-line strong { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.empty-line .end { margin-inline-start: auto; }

/* ---------- cards ---------- */
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head .spacer { margin-inline-start: auto; }
.card-body { padding: 16px 18px; }
.hero-panel { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-hero); padding: 26px 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
/* A figure keeps to one line; one too long for its tile is made smaller (fitFigures in app.js). */
.tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-wide); padding: 14px 16px; min-width: 0; }
.tile b { display: block; font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.tile span { color: var(--text-3); font-size: 12px; }

/* ---------- follow-up cards ---------- */
.follow-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 12px; }
.follow-card.overdue { border-inline-start: 3px solid var(--bad); }
.follow-main { padding: 18px 20px; display: flex; gap: 13px; }
.monogram { background: var(--info-soft); color: var(--info); width: 42px; height: 42px; border-radius: var(--r-compact); display: grid; place-items: center; flex: none; font-family: var(--display); font-weight: 700; font-size: 14px; }
.monogram.green { background: var(--green-100); color: var(--green-800); }
.monogram.peach { background: var(--peach-100); color: var(--peach-800); }
.theme-dark .monogram.green, :root[data-theme="dark"] .monogram.green { background: var(--surface-3); color: var(--text); }
.follow-content { min-width: 0; flex: 1; }
.follow-title { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.follow-person { color: var(--text-2); font-size: 12px; margin: 4px 0 8px; }
.follow-subject { font-size: 12.5px; font-weight: 500; margin-bottom: 8px; }
.follow-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); margin-top: 10px; }
.follow-meta .late { color: var(--bad); font-weight: 600; }
.follow-actions { padding: 10px 20px; display: flex; align-items: center; gap: 5px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.follow-actions .pick { margin-inline-start: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 600; padding: 4px 9px; line-height: 1.3; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.peach { background: var(--peach-100); color: var(--peach-800); }
.theme-dark .chip.peach, :root[data-theme="dark"] .chip.peach { background: var(--accent-soft); color: var(--accent-ink); }
.queue-footer { display: flex; align-items: center; gap: 7px; padding: 10px 2px; color: var(--text-3); font-size: 11.5px; }
.queue-footer i { width: 14px; height: 14px; color: var(--good); display: inline-block; }

/* ---------- season panel & coming up ---------- */
.season-panel { border-radius: var(--r-hero); background: var(--hero); overflow: hidden; }
.season-art { height: 150px; background: linear-gradient(135deg, var(--green-200), var(--peach-200)); position: relative; overflow: hidden; }
.season-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.season-body { padding: 22px; }
.season-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-weight: 700; }
.season-body h3 { margin: 10px 0 6px; font-size: 22px; font-weight: 700; }
.season-body p { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin: 0 0 16px; }
.season-company { padding-top: 14px; border-top: 1px solid rgba(0, 0, 0, .08); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.season-company + .season-company { margin-top: 10px; }
.season-company strong { font-size: 12.5px; display: block; }
.season-company .micro { color: var(--text-2); }
.coming-row { padding: 16px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); display: flex; gap: 12px; margin-bottom: 10px; }
.date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 44px; height: 48px; background: var(--info-soft); color: var(--info); border-radius: var(--r-compact); flex: none; }
.date-badge span { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.date-badge strong { font-family: var(--display); font-size: 20px; line-height: 1; }
.coming-row h3 { font-family: var(--font); font-size: 12.5px; margin-bottom: 4px; }
.coming-row p { margin: 0 0 6px; font-size: 11.5px; color: var(--text-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: start; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-1); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr.clickable { cursor: pointer; }
table.data td.r, table.data th.r { text-align: end; font-variant-numeric: tabular-nums; }
.empty { padding: 30px 18px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 13.5px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.stage-lead { background: var(--surface-3); color: var(--text-2); }
.stage-contacted, .stage-qualified { background: var(--info-soft); color: var(--info); }
.stage-quoted, .stage-sample, .stage-negotiation { background: var(--accent-soft); color: var(--accent-ink); }
.stage-order, .stage-shipment { background: var(--brand-soft); color: var(--brand-ink); }
.stage-delivered { background: var(--good-soft); color: var(--good); }
.stage-lost, .stage-disqualified { background: var(--bad-soft); color: var(--bad); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 15px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-1); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px; transition: background 140ms, border-color 140ms; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.accent { background: var(--peach-300); border-color: var(--peach-300); color: var(--green-900); }
.btn.soft { background: var(--green-100); border-color: var(--green-100); color: var(--green-800); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.sm { height: 29px; padding: 0 11px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn i { width: 15px; height: 15px; display: inline-block; }
.btn > svg, .step > svg, .chip > svg, .tab > svg { width: 15px; height: 15px; flex: none; }
.form > .btn, .card-body > .btn { justify-self: start; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--r-compact); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn i { width: 18px; height: 18px; display: inline-block; }
.notification-dot { position: absolute; width: 6px; height: 6px; top: 8px; inset-inline-end: 9px; background: var(--bad); border-radius: 50%; }
label.f { display: grid; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; min-width: 0; }
label.f > span .req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--r-input); background: var(--surface-1); color: var(--text); min-width: 0; font-size: 13px;
}
textarea { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.form { display: grid; gap: 14px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.form .row.c2 { grid-template-columns: 1fr 1fr; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--r-compact); padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; }
.form legend { font-size: 12px; color: var(--text-3); padding: 0 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 240px; }
.topbar-actions input, .topbar-actions select { width: auto; min-width: 150px; height: 36px; }
/* The product lines (lines.js): one press from one product's companies to another's. A ledger
   strip, not pills: the name, its customs code, and the count the list below will show. */
.line-tabs { display: flex; gap: 0; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-1); overflow-x: auto; scrollbar-width: thin; }
.line-tabs[hidden] { display: none; }
.line-tab { flex: 1 0 auto; min-width: 132px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 11px 16px 10px; border: 0; border-inline-end: 1px solid var(--line); background: none; color: var(--text-2); cursor: pointer; text-align: start; font: inherit; position: relative; }
.line-tab:last-child { border-inline-end: 0; }
.line-tab span { grid-column: 1 / -1; font-weight: 600; font-size: 13px; white-space: nowrap; }
.line-tab b { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.15; }
.line-tab small { font-size: 10.5px; color: var(--text-3); justify-self: end; align-self: center; }
.line-tab::after { content: ""; position: absolute; inset-inline: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.line-tab:hover { background: var(--surface-2); color: var(--text); }
.line-tab.on { background: var(--brand-soft); color: var(--brand-ink); }
.line-tab.on::after { background: var(--brand); }
.line-tab.on b { color: var(--brand-ink); }
.line-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.line-other { cursor: default; }
.line-other select { grid-column: 1 / -1; height: 26px; padding: 0 6px; font-size: 12px; min-width: 96px; max-width: 220px; border-radius: 6px; }
.more-filters { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-compact); background: var(--surface-2); }
.more-filters[hidden] { display: none; }
#more-n { background: var(--brand); color: #fff; border-radius: var(--r-pill); min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; font-size: 10.5px; }
#more-n[hidden] { display: none; }
/* The same lines as cards on Start here: each product with where its companies stand. */
.line-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.line-card { display: grid; gap: 8px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: var(--r-wide); background: var(--surface-1); color: var(--text); text-decoration: none; border-top: 3px solid var(--peach-300); }
.line-card:hover { border-color: var(--brand); border-top-color: var(--brand); }
.line-card h3 { margin: 0; font-size: 14px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.line-card h3 small { font-weight: 500; font-size: 10.5px; color: var(--text-3); }
.line-card .big { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.line-card .big + span { color: var(--text-3); font-size: 12px; }
.line-card dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin: 0; font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 8px; }
.line-card dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); text-align: end; }
.line-card .meter { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.line-card .meter i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.spent-line { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
/* Money in its own currency: the code beside the figure, and the rate under its value in pounds. */
.cur { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); margin-inline-end: 6px; vertical-align: 1px; }
.cur.fx { background: var(--info-soft); color: var(--info); }
td .rate { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 400; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--surface-2); }
@media (max-width: 640px) { .line-tab { min-width: 118px; padding: 9px 12px 8px; }  .line-cards { grid-template-columns: 1fr 1fr; gap: 8px; } .line-card { padding: 11px 12px 10px; } .line-card .big { font-size: 22px; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface-1); }
.chips .chip.on, .chips .chip:has(input:checked) { background: var(--green-100); color: var(--green-800); border-color: var(--green-200); }
.pick-chips .chip { position: relative; padding: 6px 12px; }
.pick-chips input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.pick-chips .chip:has(input:focus-visible) { outline: 2px solid var(--green-600, currentColor); outline-offset: 2px; }
.pick-chips input[type=date] { width: auto; min-width: 150px; }
.segmented { display: flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-pill); gap: 2px; }
.segmented .tab { height: 28px; font-size: 11.5px; padding: 0 12px; border-radius: var(--r-pill); color: var(--text-2); border: 0; background: transparent; cursor: pointer; font-weight: 600; }
.segmented .tab.on { background: var(--surface-1); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(640px, 100%); max-height: 92vh; overflow: auto; background: var(--surface-1); border-radius: var(--r-hero); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-head .icon-btn { margin-inline-start: auto; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }
.modal-error { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: var(--r-compact); font-size: 13px; margin-bottom: 10px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--page); padding: 12px 20px; border-radius: var(--r-pill); box-shadow: var(--shadow-lg); font-size: 13px; max-width: 420px; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }

/* ---------- lists ---------- */
.list { display: grid; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.item:last-child { border-bottom: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--text-3); font-size: 12.5px; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- timeline ---------- */
.timeline { display: grid; }
.tl { position: relative; padding-inline-start: 48px; padding-bottom: 22px; min-height: 60px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 16px; top: 36px; bottom: 0; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { position: absolute; inset-inline-start: 0; top: 0; width: 34px; height: 34px; border-radius: var(--r-compact); background: var(--green-100); color: var(--green-800); display: grid; place-items: center; }
.tl .dot i { width: 16px; height: 16px; display: inline-block; }
.tl .dot.in { background: var(--peach-100); color: var(--peach-800); border-radius: 50%; }
.tl .dot.event { background: var(--info-soft); color: var(--info); border-radius: 50%; }
.tl .dot.plain { background: var(--surface-3); color: var(--text-2); }
.theme-dark .tl .dot, :root[data-theme="dark"] .tl .dot { background: var(--good-soft); color: var(--good); }
.theme-dark .tl .dot.in, :root[data-theme="dark"] .tl .dot.in { background: var(--warn-soft); color: var(--warn); }
.tl .head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.tl .head b { font-weight: 700; font-size: 13px; }
.tl .when { color: var(--text-3); font-size: 11px; display: block; margin-top: 5px; }
.tl .text { color: var(--text-2); white-space: pre-wrap; margin-top: 3px; font-size: 12.5px; line-height: 1.6; }
.tl .text.clamp { max-height: 4.8em; overflow: hidden; }
.timeline-date { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); margin-bottom: 16px; }

/* ---------- pipeline ---------- */
.pipeline-summary { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pipeline-summary strong { font-family: var(--display); font-size: 24px; font-weight: 700; }
.pipeline-summary .summary-label { font-size: 11.5px; color: var(--text-3); margin-right: 8px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.col { border-radius: var(--r-wide); background: var(--surface-3); padding: 14px 12px; border-top: 3px solid var(--neutral-400); display: flex; flex-direction: column; min-height: 200px; min-width: 0; }
.col.info { background: var(--info-soft); border-top-color: var(--info); }
.col.peach { background: var(--warn-soft); border-top-color: var(--peach-400); }
.col.good { background: var(--good-soft); border-top-color: var(--good); }
.col.over { outline: 2px dashed var(--brand); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 0 3px; }
.col-head b { font-family: var(--display); font-size: 13.5px; font-weight: 700; }
.col-head .v { font-size: 11.5px; color: var(--text-2); margin: 8px 3px 14px; display: block; }
.col-body { display: grid; gap: 10px; align-content: start; flex: 1; }
.dcard { background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); padding: 14px; cursor: grab; display: grid; gap: 4px; }
.dcard:hover { border-color: var(--green-400); }
.dcard:active { cursor: grabbing; }
.dcard .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dcard .co { font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.dcard .t { color: var(--text-2); font-size: 12px; line-height: 1.5; }
.dcard .val { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 8px 0 6px; }
.dcard .val small { font-family: var(--font); font-size: 10px; color: var(--text-3); font-weight: 400; }
.dcard .owner { display: flex; align-items: center; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-2); }
.dcard .next { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.dcard .next.late { color: var(--bad); font-weight: 600; }
.dcard .next.due { color: var(--peach-700); }
.empty-stage { border: 1px dashed var(--neutral-300); border-radius: 14px; padding: 26px 10px; text-align: center; color: var(--text-3); font-size: 11.5px; }

/* ---------- stage stepper (deal page) ---------- */
.stepper { display: flex; flex-wrap: wrap; gap: 6px; }
.step { height: 32px; padding: 0 14px; border-radius: var(--r-pill); font-size: 12.5px; border: 1px solid var(--line); background: var(--surface-1); cursor: pointer; color: var(--text-2); font-weight: 600; }
.step.done { background: var(--green-100); border-color: var(--green-100); color: var(--green-800); }
.step.now { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.step.closed { border-style: dashed; }
.step:disabled { cursor: default; }

/* ---------- company hero & facts ---------- */
.company-top { display: flex; align-items: center; gap: 17px; flex-wrap: wrap; }
.company-logo { width: 66px; height: 66px; background: var(--hero); color: var(--primary); border-radius: var(--r-wide); display: grid; place-items: center; flex: none; font-family: var(--display); font-weight: 800; font-size: 22px; }
.company-top h1 { font-size: 26px; margin-bottom: 8px; }
.company-top .heading-actions { margin-inline-start: auto; }
.company-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.fact-label { color: var(--text-3); font-size: 10.5px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.fact-value { font-size: 13px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 18px; }
.kv div b { display: block; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 3px; }
.kv div span { font-size: 13.5px; }
.contact-item { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-1); padding: 16px; display: flex; gap: 12px; margin-bottom: 10px; }
.contact-item h3 { font-family: var(--font); font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.contact-item p { font-size: 12px; color: var(--text-2); margin: 3px 0; overflow-wrap: anywhere; }
.contact-item .actions { margin-inline-start: auto; display: flex; gap: 4px; align-self: flex-start; }
.company-deal { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; margin-bottom: 10px; }
.company-deal h3 { font-size: 13.5px; }
.company-deal .val { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 12px 0 8px; }
.company-deal .val small { font-family: var(--font); font-size: 10px; color: var(--text-3); font-weight: 400; }

/* ---------- bars (reports) ---------- */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 16px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--green-500), var(--green-300)); border-radius: var(--r-pill); }
.bar .r { text-align: end; font-variant-numeric: tabular-nums; color: var(--text-2); font-family: var(--display); font-weight: 700; }

/* ---------- quote editor ---------- */
.lines td input, .lines td select { height: 34px; padding: 0 8px; }
.lines td { vertical-align: middle; }
.total-row td { font-weight: 700; border-top: 2px solid var(--primary); font-family: var(--display); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border-radius: var(--r-pill); width: fit-content; max-width: 100%; }
.tab { height: 34px; padding: 0 16px; border: 0; background: none; cursor: pointer; color: var(--text-2); border-radius: var(--r-pill); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; }
.tab.on { background: var(--surface-1); color: var(--text); box-shadow: var(--shadow-sm); }
.tab:hover { text-decoration: none; }

.page-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--text-3); }

/* ---------- phone: tables become labelled cards, no sideways scroll ---------- */
.filters input[type=checkbox] { min-width: 0; width: auto; height: auto; }
/* Read by screen readers, not shown: a heading for a column of buttons, the sign-in page's title. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* A link inside a sentence is underlined, so it is not told apart by colour alone. */
p a:not(.btn), .eyebrow a, .muted a:not(.btn), .micro a, .small a:not(.btn), .check a, .buyer-pick a { text-decoration: underline; text-underline-offset: 2px; }
.section-heading h2 { text-wrap: nowrap; }
@media (max-width: 640px) {
  .breadcrumb > #crumb-section, .breadcrumb > i, .breadcrumb > .crumb-mid { display: none; }
  .table-wrap { overflow: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tbody tr { border: 1px solid var(--line); border-radius: var(--r-card); padding: 6px 0; margin: 0 0 10px; background: var(--surface-1); }
  table.data tbody tr:nth-child(even) { background: var(--surface-1); }
  table.data td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px; border-bottom: 0; text-align: end; overflow-wrap: anywhere; }
  table.data td .micro { white-space: normal; }
  table.data td::before { content: attr(data-label); color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; text-align: start; flex: none; min-width: 90px; padding-top: 2px; }
  table.data td.no-label::before { content: ""; min-width: 0; }
  table.data td.r { text-align: end; }
  table.data td:empty { display: none; }
  .lines td { display: table-cell; text-align: start; }
  .lines, .lines tbody, .lines tr { display: table; width: 100%; }
  .lines thead { display: table-header-group; }
  .lines td::before { content: none; }
  .lines .table-wrap, .table-wrap:has(.lines) { overflow-x: auto; }
  .btn.sm { height: 36px; }
  .icon-btn { width: 40px; height: 40px; }
  .section-heading h2 { text-wrap: balance; }
  .segmented .tab { height: 32px; }
}
/*
 * Start here and Approvals at a phone's 375 px (review panel R3, 14 Nov 2026: 437 and 450 px wide,
 * the tasks and the buttons off the screen in both languages). A one-column grid of plain `1fr`
 * grows to its widest line that cannot break (a nowrap chip, a row of tabs); minmax(0, 1fr) holds
 * it to the screen, and the rows inside wrap instead.
 */
@media (max-width: 900px) { .today-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .topbar-right { gap: 4px; min-width: 0; }
  .topbar .breadcrumb { min-width: 0; overflow: hidden; }
  .assign-btn span { display: none; }
  .line-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-card, .line-card h3 > span { min-width: 0; overflow-wrap: anywhere; }
  .section-heading { flex-wrap: wrap; }
  .section-heading .segmented { max-width: 100%; overflow-x: auto; }
  .follow-title { flex-wrap: wrap; }
  .follow-title > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  .follow-person, .follow-meta .mono { overflow-wrap: anywhere; }
  .reply-actions { flex-wrap: wrap; }
  .approval-list { grid-template-columns: minmax(0, 1fr); }
  .approval .card-head { flex-wrap: wrap; }
  .approval .card-head .chip { white-space: normal; }
  .approval-body { grid-template-columns: minmax(0, 1fr); }
}

.page-enter { animation: enter 280ms ease-out; }
/* Opacity only: a transform here would hold the pinned bars (position: fixed) to the page instead of the screen. */
@keyframes enter { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .page-enter { animation: none; } .rail, .metric { transition: none; } }
@media print { .rail, .topbar, .toasts { display: none !important; } .app { grid-template-columns: 1fr; } }

/* ---------- brand & product icons ---------- */
.rail-brand img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.login-logo { display: block; width: min(260px, 80%); height: auto; margin: 0 auto 6px; }
.picon { display: inline-block; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--picon) center / contain no-repeat; mask: var(--picon) center / contain no-repeat; vertical-align: middle; flex: none; }
.picon.lg { width: 120px; height: 120px; }
.season-art { height: 150px; display: grid; place-items: center; background: linear-gradient(135deg, var(--green-200), var(--peach-200)); color: var(--green-700); position: relative; overflow: hidden; }
.season-art .picon { opacity: .9; }
.season-art .ghost { position: absolute; inset-inline-end: -20px; bottom: -30px; width: 170px; height: 170px; opacity: .18; }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-cell .picon { color: var(--good); width: 22px; height: 22px; }
.picon-box { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--good-soft); flex: none; }
/* The documents card: issue buttons on their own wrapping row under the title. */
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
/* Seven metrics on Today (late payments present) stay on one row at desktop width. */
.metrics:has(> :nth-child(7)) { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1150px) { .metrics:has(> :nth-child(7)) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .metrics:has(> :nth-child(7)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Settings: a unified page heading and number fields that are as short as their numbers. */
.page-heading.compact { margin-bottom: 14px; }
.page-heading.compact .subtitle { margin-top: 2px; }
.settings-tabs { margin-bottom: 18px; }
.settings-body .form input[type=number] { max-width: 140px; }
.settings-body .form .f:has(> input[type=number]) { max-width: 560px; }
.popover { position: absolute; top: 64px; inset-inline-end: 24px; width: min(380px, calc(100vw - 32px)); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; }
.popover-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-weight: 700; }
.popover-head svg { width: 16px; height: 16px; flex: none; color: var(--primary); }
.rail-brand span { min-width: 0; }
.rail-brand small { white-space: normal; line-height: 1.3; }
.popover-head .micro { margin-inline-start: auto; }
.popover .item { padding: 10px 16px; }
/* The bell holds the mail that arrived above the work that is due: it scrolls, and an email not seen yet stands out. */
.popover { max-height: calc(100vh - 84px); overflow-y: auto; }
.popover .bell-mail .item .title { font-weight: 500; }
.popover .bell-mail .item.unread { background: var(--primary-soft, rgba(0, 0, 0, .04)); }
.popover .bell-mail .item.unread .title { font-weight: 700; }
.popover .bell-mail .sub span { overflow-wrap: anywhere; }
.popover-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.popover-foot { padding: 10px 16px; border-top: 1px solid var(--line); }
.lang-btn { font-family: var(--display); font-weight: 700; font-size: 12px; width: auto; padding: 0 10px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.file-row:last-child { border-bottom: 0; }
.file-row .meta { color: var(--text-3); font-size: 11.5px; }
.file-row .end { margin-inline-start: auto; display: flex; gap: 4px; }
.doc-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row .state { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); }
.doc-row .state.issued { background: var(--good-soft); color: var(--good); }
.doc-row .state.draft { background: var(--warn-soft); color: var(--warn); }
.doc-row .state.not_required { background: var(--surface-3); color: var(--text-3); }
.doc-row .state i { width: 14px; height: 14px; display: inline-block; }
.doc-row b { display: block; font-size: 13px; }
.doc-row .micro { display: block; }
.ship-steps { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- v2: lead lists, campaigns, approvals, queue, research, accounting ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-compact); background: var(--info-soft); color: var(--text); border: 1px solid transparent; margin: 0 0 16px; font-size: 13.5px; }
.notice.warn { background: var(--warn-soft); }
.notice > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--warn); }
.notice p { margin: 0; line-height: 1.55; }
.notice p + p { margin-top: 4px; }
.card-head h2 svg { width: 16px; height: 16px; vertical-align: -2px; margin-inline-end: 4px; color: var(--primary); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* A secret saved in Settings → Integrations: dots that read as filled, and its Show button. */
.secret-row { display: flex; gap: 6px; align-items: center; }
.secret-row input { flex: 1; min-width: 0; }
input.saved-secret::placeholder { color: var(--text); opacity: 0.85; letter-spacing: 0.04em; }

/* upload */
.dropzone { position: relative; display: grid; gap: 4px; place-items: center; text-align: center; padding: 28px 16px; border: 2px dashed var(--brand); border-radius: var(--r-wide); background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.over { background: var(--brand-soft); border-color: var(--primary); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone b { color: var(--text); font-size: 15px; }
.dropzone span { font-size: 12.5px; }
.dropzone .picked { color: var(--primary); font-weight: 600; word-break: break-word; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 14px; }
.map-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.map-row .req { color: var(--bad); }

/* campaigns */
.campaign-form { display: grid; gap: 18px; }
.step-card { border: 1px solid var(--line); border-radius: var(--r-compact); padding: 12px 14px 14px; display: grid; gap: 10px; margin: 0 0 12px; background: var(--surface-2); }
.step-card legend { font-weight: 700; color: var(--text); font-size: 13px; padding: 0 6px; }
.step-card textarea { font-family: var(--font); line-height: 1.55; }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pre { white-space: pre-wrap; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* approvals */
.approval-list { display: grid; gap: 16px; }
.approval .card-head { align-items: flex-start; }
.approval .card-head h2 { font-size: 16px; margin: 0; }
.approval-body { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 20px; }
.approval-facts { display: grid; gap: 10px; align-content: start; font-size: 13px; }
.approval-facts b { display: block; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.approval-facts span { word-break: break-word; }
.approval textarea { font-family: var(--font); line-height: 1.6; min-height: 220px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.decided { opacity: .62; }
.decided .card-body { padding: 12px 18px; }

/* queue */
.progress-line { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.progress-line .track { flex: 1; height: 10px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress-line .fill { height: 100%; background: linear-gradient(90deg, var(--green-500), var(--peach-300)); border-radius: var(--r-pill); transition: width .3s; }
.queue-list { display: grid; gap: 14px; }
.queue-item .card-head h2 { font-size: 16px; margin: 0; }
.queue-item textarea { margin-top: 12px; width: 100%; }
.outcome-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* company page additions */
.kind-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.kind-row .micro { margin-inline-end: 4px; }
/* buyer data waiting for approval (company page and Approvals) */
.buyer-review { margin: 12px 0 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.buyer-pick { align-items: flex-start; margin: 6px 0; line-height: 1.5; }
.buyer-pick input { margin-top: 3px; flex: none; }
.buyer-pick .mono { overflow-wrap: anywhere; }
.buyer-review .approval-actions { margin-top: 8px; }
.growth-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin: 18px 0 22px; align-items: start; }
.growth-grid .notice { margin: 0; grid-column: 1 / -1; }

/* pickers inside modals */
.list .pick { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 9px 12px; cursor: pointer; color: var(--text); font: inherit; }
.list .pick:hover { background: var(--surface-2); }
.list .pick.on { background: var(--brand-soft); }
.list .pick .sub { color: var(--text-3); font-size: 12px; }

/* research */
.price-card { margin-top: 14px; }
.price-card .kv span.num { font-family: var(--display); font-weight: 700; font-size: 16px; display: block; }

/* accounting */
.gain { color: var(--good); font-weight: 600; }
.loss { color: var(--bad); font-weight: 600; }
table.data tr.voided td { opacity: .5; text-decoration: line-through; }
table.data tr.voided td:last-child { text-decoration: none; }
table.data td.late { color: var(--bad); font-weight: 600; }
.modal table.lines { width: 100%; border-collapse: collapse; }
.modal table.lines th { font-size: 11px; color: var(--text-3); text-align: start; padding: 4px; font-weight: 600; }
.modal table.lines td { padding: 3px; }

/* settings → integrations */
.integration .card-body > p.muted { margin: 0; }

@media (max-width: 760px) {
  .approval-body { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; gap: 4px; }
  .growth-grid { grid-template-columns: 1fr; }
  .modal table.lines thead { display: none; }
  .modal table.lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .modal table.lines td:first-child { grid-column: 1 / -1; }
}
.kv div span.strong { font-weight: 700; }

/* Names and data from the lists keep their own direction inside the Arabic interface. */
.approval .card-head h2, .queue-item .card-head h2, .company-top h2, .page-heading h1, table.data td, .item .title, .item .sub, .approval-facts span, .kv div span { unicode-bidi: plaintext; }
.stack-v { display: grid; gap: 16px; }
.kv div span + span { display: block; margin-top: 2px; }
input[type=file] { font: inherit; font-size: 13px; color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: 12.5px; margin-inline-end: 10px; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-1); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }

/* ---------- work order: pickers, record buttons, bulk bar, archived rows, health ---------- */
.picker { position: relative; }
.picker-list { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 45; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-compact); box-shadow: var(--shadow-lg); max-height: 300px; overflow: auto; }
.picker-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; cursor: pointer; color: var(--text); font: inherit; }
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button:focus-visible { background: var(--surface-2); outline: none; }
.btn.ghost.danger { color: var(--bad); }
.rec-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
tr.archived td { color: var(--text-3); }
tr.archived td b, tr.archived td a { color: var(--text-2); }
/* Above the list, sticking under the top bar while the page scrolls (owner, 10 Nov 2026: "on top, not at the bottom"). */
.bulk-slot { position: sticky; top: 82px; z-index: 4; }
.bulk-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0; padding: 10px 14px; border-radius: var(--r-card); background: var(--surface-1); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.bulk-bar.idle { box-shadow: none; background: var(--surface-2); font-size: 13px; }
.bulk-bar b { font-variant-numeric: tabular-nums; }
td.pick, th.pick { width: 34px; text-align: center; }
td.pick input, th.pick input { width: 16px; height: 16px; }
.view-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); }
.view-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: var(--r-pill); font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.view-tabs button[aria-pressed="true"] { background: var(--surface-1); color: var(--text); box-shadow: var(--shadow-sm); }
.tl .tl-tools { display: inline-flex; gap: 4px; margin-inline-start: 8px; opacity: .75; }
.tl:hover .tl-tools, .tl:focus-within .tl-tools { opacity: 1; }
.tl.archived { opacity: .6; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.health-grid .tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-compact); background: var(--surface-1); display: grid; gap: 4px; }
.health-grid .tile b { font-size: 18px; white-space: normal; }
.health-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-inline-end: 6px; vertical-align: middle; }
.health-dot.warn { background: var(--warn); }
.health-dot.bad { background: var(--bad); }
.page-help { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 18px; padding: 10px 14px; border-radius: var(--r-compact); background: var(--brand-soft); color: var(--text); font-size: 13.5px; line-height: 1.6; max-width: 110ch; }
.page-help svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--brand); }
.archived-block { margin-top: 10px; }
.archived-block summary { cursor: pointer; padding: 6px 0; }
.contact-item.archived, .company-deal.archived { opacity: .75; }

/* ---------- "Start here" (owner, 9 Nov 2026): what ran by itself, then today's work in order ---------- */
.start { margin-bottom: 26px; }
.start-done { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--r-card); background: var(--brand-soft); color: var(--text); }
.start-done-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--brand-ink, var(--primary)); margin-inline-end: 4px; }
.start-done-label i { width: 15px; height: 15px; display: inline-block; }
.start-done .end { margin-inline-start: auto; }
.start-fig { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.start-fig b { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.start-fig.minor b { color: var(--text-2); font-size: 14px; }
.work-list { display: grid; gap: 8px; }
.work-later { margin-top: 14px; opacity: .92; }
.work-card { display: block; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-1); padding: 12px 14px; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; border-inline-start: 4px solid var(--border, var(--line)); }
a.work-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
a.work-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.work-card.tone-good { border-inline-start-color: var(--good); }
.work-card.tone-warn { border-inline-start-color: var(--warn); }
.work-card.tone-bad { border-inline-start-color: var(--bad); }
.work-card.tone-info { border-inline-start-color: var(--info); }
.work-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.work-row .end { margin-inline-start: auto; flex: none; }
.work-step { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-2); flex: none; }
.work-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.work-ico i { width: 16px; height: 16px; display: inline-block; }
.tone-good .work-ico { background: var(--good-soft); color: var(--good); }
.tone-warn .work-ico { background: var(--warn-soft); color: var(--warn); }
.tone-bad .work-ico { background: var(--bad-soft); color: var(--bad); }
.tone-info .work-ico { background: var(--info-soft); color: var(--info); }
.work-n { font-size: 22px; font-weight: 700; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; flex: none; }
.work-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.work-text strong { font-size: 13.5px; font-weight: 600; }
.reply-list { margin-top: 10px; border-top: 1px solid var(--line); }
.reply-row { display: flex; align-items: center; gap: 12px; padding: 9px 0 9px 34px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .reply-row { padding: 9px 34px 9px 0; }
.reply-row:last-child { border-bottom: 0; }
.reply-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; flex: 1; }
.reply-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.reply-actions { display: flex; gap: 6px; flex: none; }
.start-clear { display: flex; align-items: center; gap: 13px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--r-card); }
.start-clear .empty-icon { background: var(--good-soft); color: var(--good); }
.start-clear strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
@media (max-width: 640px) {
  .work-row { flex-wrap: wrap; }
  .work-row .end { margin-inline-start: 34px; }
  [dir="rtl"] .work-row .end { margin-inline-start: 34px; }
  .reply-row { flex-wrap: wrap; padding-inline-start: 0 !important; padding-inline-end: 0 !important; }
  .reply-subject { max-width: 100%; white-space: normal; }
  .work-n { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .work-card { transition: none; } }

/* ---------- Tables read the same way everywhere (owner, 9 Nov 2026) ---------- */
/* A long list keeps its headings in view: the table scrolls inside its frame, under the top bar. */
@media (min-width: 641px) {
  .table-wrap { max-height: calc(100vh - 190px); overflow: auto; }
  .modal .table-wrap, .lines .table-wrap { max-height: none; }
  table.data thead th { z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
}
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data td.r { white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td .chip { white-space: nowrap; }
/* Unmatched mail: the company Claude read in the signature, for a person to confirm. */
.suggest-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; padding: 7px 10px; border-radius: var(--r-compact, 8px); background: var(--brand-soft); font-size: 12.5px; }
.suggest-line > i { width: 14px; height: 14px; display: inline-block; color: var(--brand-ink, var(--primary)); }
.suggest-line .micro { flex-basis: 100%; }

/* ---------- Writing rules (owner, 9 Nov 2026): what the AI learned from rejected and corrected emails ---------- */
.writing-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.metric.static { cursor: default; }
.metric.static:hover { transform: none; box-shadow: none; }
@media (max-width: 900px) { .writing-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rule-list { display: grid; gap: 8px; }
.rule-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-1); }
.rule-row.archived { opacity: .75; }
.rule-main { flex: 1; min-width: 0; }
.rule-text { margin: 0 0 4px; font-size: 14px; font-weight: 500; line-height: 1.55; unicode-bidi: plaintext; }
.rule-actions { display: flex; gap: 4px; flex: none; }
.rule-add { display: flex; gap: 8px; margin: 12px 0 16px; }
.rule-add input { flex: 1; min-width: 0; }
.lesson-note { margin-top: 4px; font-size: 12.5px; white-space: pre-wrap; unicode-bidi: plaintext; }
.earlier-rules summary { cursor: pointer; list-style: none; }
.earlier-rules summary h2 { display: inline-flex; align-items: center; gap: 9px; }
.earlier-rules[open] summary { margin-bottom: 12px; }
/* The reason window: one click per reason. */
.lesson-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.lesson-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-pill, 999px); cursor: pointer; font-size: 13px; background: var(--surface-1); }
.lesson-chip input { margin: 0; accent-color: var(--primary); }
.lesson-chip:has(input:checked) { border-color: var(--primary); background: var(--brand-soft); }
.lesson-chip:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) { .rule-row { flex-wrap: wrap; } .rule-actions { width: 100%; justify-content: flex-end; } }

/* ---------- The AI budget on Start here (owner, 9 Nov 2026) ---------- */
.budget-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: -8px 0 18px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-card); }
.budget-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 12.5px; color: var(--text-2); }
.work-card .budget-line { margin: 10px 0 0 34px; }
[dir="rtl"] .work-card .budget-line { margin: 10px 34px 0 0; }
.budget-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.budget-line .sep { margin: 0 6px; color: var(--text-3); }
.budget-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .work-card .budget-line, [dir="rtl"] .work-card .budget-line { margin-inline: 0; } }

/* My queue: the three steps and what each outcome does (owner, 9 Nov 2026). */
.queue-steps { margin: 0 0 12px; padding-inline-start: 22px; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-2); }
.queue-steps b { color: var(--text); }
.queue-legend { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-1); }
.queue-legend summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.queue-legend dl { margin: 10px 0 0; display: grid; gap: 8px; }
.queue-legend dl > div { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 10px; font-size: 13px; }
.queue-legend dt { font-weight: 600; }
.queue-legend dd { margin: 0; color: var(--text-2); }
@media (max-width: 640px) { .queue-legend dl > div { grid-template-columns: 1fr; gap: 2px; } }

/* A buyer's reply: its kind, the next step the AI read, and where its answer stands (owner, 9 Nov 2026). */
.reply-next, .reply-state { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.reply-next > span:first-child { font-weight: 600; color: var(--text-2); }
.ai-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }

/* Buyer data: the lookup's result in one line, then what to do (owner, 10 Nov 2026). */
.lookup-verdict { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-compact); margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.lookup-verdict > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.lookup-verdict.good { background: var(--good-soft); color: var(--good); }
.lookup-verdict.bad { background: var(--bad-soft); color: var(--bad); }
.lookup-verdict.warn { background: var(--warn-soft); color: var(--warn); }
.lookup-verdict.info { background: var(--info-soft); color: var(--info); }
.lookup-next { margin: 10px 0; padding: 10px 12px; border-inline-start: 3px solid var(--line); }
.lookup-next p { margin: 0 0 6px; }
.lookup-next .btn { margin-top: 4px; }
/* A contact's address at another company's domain (a shipping agent's in the customs lists). */
.other-addr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; padding: 6px 8px; border-radius: var(--r-compact); background: var(--warn-soft); color: var(--warn); font-size: 12.5px; line-height: 1.45; }

/* A batch picked on the companies list: each company's products, its best way, and where its email stands. */
.batch-card { margin-top: 18px; }
.batch-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.batch-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto; gap: 8px 14px; align-items: start; padding: 12px 18px; border-top: 1px solid var(--line); }
.batch-row .muted { display: block; }
.batch-row .way { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .batch-row { grid-template-columns: minmax(0, 1fr); } }
.batch-sub { padding: 10px 18px 4px; font-weight: 600; color: var(--text-2); border-top: 1px solid var(--line); }
.pick-summary { margin: 0; padding-inline-start: 18px; }
.pick-summary li { margin: 2px 0; }
.section-title { font-size: 18px; font-weight: 700; margin: 22px 0 6px; }
.kv .prod-line span, .batch-row .prod-line span { display: inline; margin-top: 0; }
.kv .way span { display: inline-flex; margin-top: 0; }

/* A campaign step is when, not what: Claude writes each email for its company (owner, 11 Nov 2026). */
.step-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.step-row label.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.step-row input { width: 80px; }
/* The competitive advantage an email was built on, beside it for the reviewer. */
.approval-facts .advantage span, .advantage-line span { color: var(--good); font-weight: 600; }
.advantage-line { margin: 4px 0 0; }
/* Accounting → Analysis and Books (finance.js): a period read as figures, a chart and a statement. */
.fin-period { margin-bottom: 14px; gap: 8px 12px; }
.fin-period .segmented { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r-pill); }
.fin-period .segmented a.tab { display: inline-flex; align-items: center; text-decoration: none; }
.fin-tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.fin-tile { display: grid; gap: 4px; }
.fin-tile > span { font-size: 12px; color: var(--text-3); order: -1; }
.fin-tile b { font-size: 24px; }
.delta { font-size: 11px; font-weight: 700; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--text-3); font-weight: 500; }
b.good, .num.good { color: var(--good); }
b.warn, .num.warn { color: var(--warn); }
b.bad, .num.bad { color: var(--bad); }
.fin-chart-wrap { overflow-x: auto; }
.fin-chart { width: 100%; height: auto; max-height: 260px; display: block; }
.fin-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.fin-chart .zero { stroke: var(--text-3); stroke-width: 1; }
.fin-chart .tick { font-size: 10.5px; fill: var(--text-3); font-family: var(--font); }
.fin-chart .sales { fill: var(--brand); }
.fin-chart .costs { fill: var(--peach-400); }
.fin-chart .net { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.fin-chart .net-dot { fill: var(--surface-1); stroke: var(--text); stroke-width: 2; }
.fin-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.fin-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.fin-legend i.sales { background: var(--brand); }
.fin-legend i.costs { background: var(--peach-400); }
.fin-legend i.net { background: var(--text); height: 3px; vertical-align: 3px; }
table.fin-statement td:first-child { min-width: 210px; }
table.fin-statement tr.strong td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
table.fin-statement td.total { font-weight: 700; border-inline-start: 1px solid var(--line); }
table.data td.indent { padding-inline-start: 30px; }
table.data tr.strong td { font-weight: 700; background: var(--surface-2); }
.fin-bars .bar { grid-template-columns: minmax(110px, 1.1fr) 1.4fr auto; }
.fin-bars .bar .r { font-size: 13px; text-align: end; white-space: nowrap; }
.fin-bars .bar .r small { display: block; font-family: var(--font); font-weight: 400; font-size: 10.5px; color: var(--text-3); }
.fin-bars .bar a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-bars .bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-list { display: grid; gap: 6px; }
details.due { border: 1px solid var(--line); border-radius: var(--r-compact); padding: 0; }
details.due summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; }
details.due summary::-webkit-details-marker { display: none; }
details.due summary b { margin-inline-start: auto; }
details.due ul { list-style: none; margin: 0; padding: 0 12px 8px; display: grid; gap: 5px; font-size: 12.5px; }
details.due li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 5px; }
details.due li .num { margin-inline-start: auto; }
.doc-meters { display: grid; gap: 14px; }
.doc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.meter.good i { background: var(--good); }
.meter.warn i { background: var(--warn); }
.meter.bad i { background: var(--bad); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.plain-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 6px; }
.plain-list li .num { margin-inline-start: auto; }
.budget-list { display: grid; gap: 14px; }
.budget-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
table.journal tr.first td { border-top: 2px solid var(--line); }
table.journal td small, table.data td small { color: var(--text-3); font-weight: 500; font-size: 10px; }
.due-monthly { margin: 14px 0; border-inline-start: 4px solid var(--peach-400); }
.due-monthly .item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.due-monthly .item .num { margin-inline-start: auto; }
.file-btn b { font-family: var(--display); }
@media print {
  .hub-tabs, .tabs, .fin-period, .heading-actions, .explain, #budgets, .file-btn { display: none !important; }
  .card { break-inside: avoid; box-shadow: none; }
  details.due ul { display: grid !important; }
  body { background: #fff; }
}
/* Accounting → Invoices: where an invoice comes from, what waits to be invoiced, and the new-invoice form. */
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 22px; }
.how-grid > div { display: grid; gap: 6px; align-content: start; justify-items: start; padding-inline-start: 12px; border-inline-start: 3px solid var(--peach-300); }
.how-grid b { font-family: var(--display); font-size: 14px; }
.how-grid span { color: var(--text-2); font-size: 13px; }
.wait-doc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.wait-doc .num { margin-inline-start: auto; }
.due-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: -4px; }
.inv-lines-wrap { overflow-x: auto; }
table.inv-lines { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
table.inv-lines input { width: 100%; min-width: 0; height: 34px; padding: 0 8px; }
table.inv-lines th { text-align: start; font-size: 11px; color: var(--text-3); font-weight: 700; padding: 0 4px 4px; }
table.inv-lines th.r, table.inv-lines td.r { text-align: end; }
table.inv-lines td { padding: 3px 4px; }
table.inv-lines td.line-amount { font-weight: 600; white-space: nowrap; }
table.inv-lines tfoot td { border-top: 1px solid var(--line); padding-top: 8px; background: none; }
.inv-form .row[hidden] { display: none; }

/* Generate documents (pages/generate.js): one card per document, then what was issued. */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gen-card { display: grid; gap: 10px; align-content: start; justify-items: start; padding: 18px; border-top: 3px solid var(--green-500, var(--accent)); }
.gen-card.gen-accounting { border-top-color: var(--peach-300); background: var(--surface-2, transparent); }
.gen-head { display: flex; align-items: center; gap: 10px; }
.gen-head svg { width: 20px; height: 20px; flex: none; color: var(--text-2); }
.gen-head h2 { font-family: var(--display); font-size: 16px; margin: 0; }
.gen-text { color: var(--text-2); font-size: 13px; margin: 0; min-height: 3.2em; }
.gen-from { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.gen-card .btn { margin-top: 2px; }
.gen-filters { padding: 12px 16px 0; }
.gen-given p { margin: 0; }
.gen-given p + p { margin-top: 2px; color: var(--text-2); }
/* Ready files on the Generate documents page: kept as they are, to print or download. */
.ready-card { margin-top: 18px; border-top: 3px solid var(--peach-300); }
.ready-lead { margin: 0; padding: 12px 18px 4px; color: var(--text-2); font-size: 13px; max-width: 78ch; }
.ready-table td { vertical-align: top; }
.ready-table td:first-child { min-width: 260px; white-space: normal; }
.ready-title { font-weight: 600; }
.ready-note { color: var(--text-2); font-size: 12.5px; margin-top: 2px; max-width: 62ch; white-space: normal; }
.ready-name { color: var(--text-3, var(--text-2)); font-size: 11.5px; margin-top: 3px; overflow-wrap: anywhere; white-space: normal; }
.ready-table .icon-btn { vertical-align: middle; }

/* ---------- outreach waves (19 Nov 2026) ---------- */
.wave-h2 { font-family: var(--display); font-size: 16px; margin: 24px 0 10px; }
.wave-bodies { display: grid; gap: 14px; }
.wave-body { border: 1px solid var(--line); border-radius: var(--r-card, 16px); padding: 14px 16px; background: var(--surface-1); }
.wave-body.ok { border-color: var(--green-200); }
.wave-body-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wave-body-head .end { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.wave-body-subject { font-weight: 600; margin: 12px 0 8px; overflow-wrap: anywhere; }
.wave-body-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); font-size: 13px; line-height: 1.6; background: var(--surface-3); border-radius: 10px; padding: 12px 14px; margin: 0; max-height: 340px; overflow-y: auto; }
.wave-batches { display: grid; gap: 10px; }
.wave-batch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-1); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.wave-batch.ready { border-inline-start: 3px solid var(--peach-500); }
.wave-batch.approved, .wave-batch.sending { border-inline-start: 3px solid var(--green-500); }
.wave-batch-main { display: flex; align-items: center; gap: 14px; flex: 1 1 320px; min-width: 0; color: inherit; text-decoration: none; }
.wave-batch-no { font-family: var(--display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; color: var(--text-2); }
.wave-batch.set_aside { opacity: .72; }
.wave-batch.set_aside .wave-batch-no { text-decoration: line-through; }
.wave-batch-what { display: grid; gap: 2px; min-width: 0; }
.wave-batch-what b { overflow-wrap: anywhere; }
.wave-batch-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.wave-left summary { cursor: pointer; }
.wave-left-group { margin-top: 10px; }
.wave-co { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.wave-co-head { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.wave-co-name { min-width: 0; overflow-wrap: anywhere; }
.wave-co-to { min-width: 0; overflow-wrap: anywhere; }
.wave-co-actions { margin-inline-start: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.wave-co-opening { margin: 8px 0 0; line-height: 1.6; max-width: 90ch; color: var(--text-2); overflow-wrap: anywhere; }
.wave-approve { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.wave-sample-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wave-sample-head .end { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.wave-body-more summary { cursor: pointer; }
.wave-body-more[open] summary { margin-bottom: 8px; }

/* ---------- money, the short way, and "Add" on every page (19 Nov 2026) ---------- */
.money-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.money-action { display: grid; gap: 4px; justify-items: start; text-align: start; padding: 18px 20px; border-radius: var(--r-wide); border: 1px solid var(--line); background: var(--surface-1); color: inherit; font: inherit; cursor: pointer; text-decoration: none; transition: transform .15s ease; }
.money-action:hover { transform: translateY(-2px); }
.money-action svg { width: 22px; height: 22px; margin-bottom: 6px; }
.money-action b { font-family: var(--display); font-size: 16px; }
.money-action span { color: var(--text-3); font-size: 12.5px; }
.money-action.out { background: var(--hero); }
.money-action.in { background: var(--accent-soft); }
.money-action.out span, .money-action.in span { color: var(--text-2); }
.money-action.bills.due { border-inline-start: 3px solid var(--bad); }
.money-form .money-amount { font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-form fieldset { display: grid; gap: 8px; }
.money-list { display: grid; }
.money-row { display: flex; align-items: baseline; gap: 12px 16px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.money-row:last-child { border-bottom: 0; }
.money-day { min-width: 92px; color: var(--text-3); font-size: 12.5px; }
.money-what { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.money-sum { margin-inline-start: auto; text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; display: grid; }
.money-sum.in { color: var(--good); }
.money-bill > div { display: grid; gap: 2px; }
.quick-add { display: grid; gap: 8px; }
.quick-add-item { display: flex; align-items: center; gap: 14px; text-align: start; padding: 14px 16px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface-1); color: inherit; font: inherit; cursor: pointer; }
.quick-add-item:hover { background: var(--surface-3); }
.quick-add-item svg { width: 20px; height: 20px; flex: none; }
.quick-add-item span { display: grid; gap: 2px; }
.quick-add-item small { color: var(--text-3); font-size: 12.5px; }
@media (max-width: 700px) { .quick-add-btn span { display: none; } }
@media (prefers-reduced-motion: reduce) { .money-action { transition: none; } .money-action:hover { transform: none; } }
.use-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.use-row:last-of-type { border-bottom: 0; }
.use-row input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.use-row span { display: grid; gap: 3px; }
.today-more { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.today-products { margin: 18px 0; }
.today-products > summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 15px; padding: 10px 0; }
.rule-add .rule-owner { white-space: nowrap; }
/* A group's entry carries one counter, its first page's: two side by side read as one number. */
#nav a[data-hub] .nav-count ~ .nav-count { display: none; }

/* ---------- possible duplicates (19 Nov 2026) ---------- */
.dup-list { display: grid; gap: 14px; margin-top: 16px; }
.dup-group .card-head { flex-wrap: wrap; }
.dup-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dup-row:last-child { border-bottom: 0; }
.dup-row input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.dup-row:has(input:checked) { background: var(--surface-3); }
.dup-main { display: grid; gap: 3px; flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.dup-side { display: grid; gap: 4px; justify-items: end; text-align: end; flex: none; }
.dup-pager { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
@media (max-width: 700px) { .dup-row { flex-wrap: wrap; } .dup-side { justify-items: start; text-align: start; padding-inline-start: 30px; } }

/* ---------- "Ask": the chat in the corner (pages/ask.js) ---------- */
.ask { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.ask[hidden] { display: none; }
.ask-fab { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border: 0; border-radius: var(--r-pill); background: var(--primary); color: var(--primary-fg); font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-lg); }
.ask-fab:hover { background: var(--primary-hover); }
.ask-fab svg { width: 18px; height: 18px; }
.ask.open .ask-fab span { display: none; }
.ask.open .ask-fab { padding: 0 14px; }
.ask-panel { width: min(400px, calc(100vw - 24px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-lg); overflow: hidden; }
.ask-panel[hidden] { display: none; }
.ask-panel header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ask-panel header .icon-btn { margin-inline-start: auto; }
.ask-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.ask-hello { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.ask-examples { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.ask-examples .btn { text-align: start; white-space: normal; height: auto; padding: 6px 12px; }
.ask-msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; background: var(--surface-2); align-self: flex-start; line-height: 1.5; overflow-wrap: anywhere; }
.ask-msg.mine { align-self: flex-end; background: var(--accent-soft); font-weight: 600; }
.ask-msg.bad { background: var(--bad-soft); color: var(--bad); }
.ask-rows { margin-top: 8px; font-size: 12px; }
.ask-rows summary { cursor: pointer; color: var(--text-2); }
.ask-table { max-height: 200px; overflow: auto; margin-top: 6px; }
.ask-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.ask-form input { flex: 1; min-width: 0; }
@media (max-width: 700px) {
  .ask { bottom: 12px; inset-inline-end: 12px; }
  .ask-fab span { display: none; }
  .ask-fab { padding: 0 14px; }
  .ask-panel { height: min(70vh, calc(100vh - 110px)); }
}
@media print { .ask { display: none; } }

/* ---------- on a phone, and as an app on its home screen ---------- */
@media (max-width: 700px) {
  /* A finger, not a pointer: the small buttons and the ticks get room. */
  .btn.sm { min-height: 36px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  /* iOS zooms the page when a field's text is under 16px: keep fields at 16. */
  input, select, textarea { font-size: 16px; }
  .modal { max-height: 88vh; }
  .modal.wide { width: 100%; }
}
/* Clear of the phone's own bars when opened from the home screen. */
.ask { bottom: max(20px, env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); height: calc(72px + env(safe-area-inset-top)); } }

/* Quality records (20 Nov 2026): files and small pictures on a record. */
.qc-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.qc-file { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.qc-file .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-thumb { width: 56px; height: 56px; flex: none; border: 1px solid var(--border, rgba(0,0,0,.12)); border-radius: 8px; background: var(--surface-3) center / cover no-repeat; cursor: zoom-in; padding: 0; }
.qc-rec { align-items: flex-start; }
.qc-flags > svg { color: var(--bad); }
@media (max-width: 720px) { .qc-rec { flex-direction: column; } .qc-rec .actions { justify-content: flex-start !important; } }

/* Faster money entry (20 Nov 2026): a Recent line is a button; the pasted lines to check. */
button.money-row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: start; cursor: pointer; }
button.money-row:hover, button.money-row:focus-visible { background: var(--surface-2, rgba(127,127,127,.08)); }
.paste-rows { display: grid; gap: 8px; }
.paste-row { display: grid; grid-template-columns: auto 140px minmax(90px, 1fr) minmax(120px, 1.2fr) minmax(140px, 2fr) 100px 84px; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r, 8px); }
.paste-row.bad { border-color: var(--bad); }
.paste-row input, .paste-row select { min-width: 0; width: 100%; }
.paste-note { grid-column: 1 / -1; color: var(--bad); }
@media (max-width: 760px) { .paste-row { grid-template-columns: auto 1fr 1fr; } .paste-row [name^=what] { grid-column: 2 / -1; } }
/* Browser check, 20 Nov 2026: on a phone a page's own button in the top bar (New cost sheet, Add a
   requirement, Plan this month) pushed the bell and the account off the screen. On a phone it now
   sits on its own row under the bar, full width, and the icons keep their place. */
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; row-gap: 0; }
  .topbar-right { display: contents; }
  .topbar .breadcrumb { flex: 1 1 0; min-width: 0; overflow: hidden; }
  .topbar-actions { order: 10; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 10px; }
  .topbar-actions:empty { display: none; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; }
}
