/* ============================================================
   DESIGN TOKENS
   ------------------------------------------------------------
   Every colour, size, radius and shadow in this file should come
   from here. Before these existed the file carried 167 distinct
   hex values, 36 font sizes, 13 radii and 20 shadows -- six ways
   to write "the border colour", eight ways to write "the blue".
   That inconsistency, not any individual page, is what made the
   app look unfinished.

   Rules:
   - Never write a raw hex in a component rule. Add a token, or
     use the nearest one.
   - Type and space come off the scales below. If a value is not
     on the scale, it is wrong, not special.
   - The legacy aliases at the bottom (--bg, --text, --accent...)
     exist because ~200 existing rules reference them. They are
     defined in terms of the ramps, so there is exactly one
     source of truth. Prefer the ramp names in new code.
   ============================================================ */
.access-tabs { display:flex; gap:var(--space-2); border-bottom:1px solid var(--line); }
.access-tabs button { background:var(--surface-2); color:var(--ink-600); border:1px solid var(--line); padding:var(--space-3) var(--space-4); border-radius:var(--radius-sm) var(--radius-sm) 0 0; }
.access-tabs button.active { background:var(--brand-100); color:var(--brand-700); border-bottom-color:var(--brand-100); }
.access-toolbar { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-3); background:var(--surface-3); border:1px solid var(--line); }
/* The user/group access editor. Two columns that stop growing: stretched
   across a wide screen, the Read..Delete boxes sat half a metre from their
   labels (Graeme, 2026-09-30). Permissions on the left; Privileges and
   User's roles stacked on the right, as checklists rather than tables. */
.access-columns { display:grid; grid-template-columns:minmax(0,40rem) minmax(0,26rem); gap:var(--space-6); align-items:start; margin-top:var(--space-4); }
.access-side { display:grid; gap:var(--space-6); align-content:start; }
.access-panel { border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-1); overflow:hidden; }
.access-panel > p { margin:0; padding:var(--space-3) var(--space-4); border-top:1px solid var(--line-soft); }
.access-columns input[type=checkbox] { width:auto; margin:0; accent-color:var(--brand-600); }
.access-grid { width:100%; border-collapse:collapse; }
.access-grid th, .access-grid td { padding:var(--space-2) var(--space-3); border-bottom:1px solid var(--line-soft); }
.access-grid thead th { font-size:var(--text-xs); font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-500); background:var(--surface-2); }
.access-grid thead th:not(:first-child), .access-grid td { width:5rem; text-align:center; }
.access-grid tbody th { text-align:left; font-weight:500; color:var(--ink-800); }
.access-grid tbody tr:last-child > * { border-bottom:0; }
.access-grid tbody tr:hover > * { background:var(--surface-2); }
.access-checklist { list-style:none; margin:0; padding:0; }
.access-checklist li { border-bottom:1px solid var(--line-soft); }
.access-checklist li:last-child { border-bottom:0; }
.access-checklist label { display:flex; align-items:flex-start; gap:var(--space-3); margin:0; padding:var(--space-2) var(--space-4); font-weight:400; color:var(--ink-800); cursor:pointer; }
.access-checklist input[type=checkbox] { margin-top:.2em; flex:0 0 auto; }
.access-checklist small { display:block; font-size:var(--text-xs); color:var(--ink-500); }
.access-checklist li:hover { background:var(--surface-2); }
.access-grid thead th:first-child { text-align:left; }
/* Maximizer's three-state box ("User and Group Security - advanced"): this
   principal's OWN setting -- Granted, Denied, Not set -- with the combined
   result as a hint: via-group = not set here but a group grants it;
   overridden = granted here but a denial (or missing Read) wins. */
.access-box { display:inline-flex; align-items:center; justify-content:center; width:1.35rem; height:1.35rem; padding:0; margin:0;
  border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface-1); color:var(--ink-400);
  font-size:var(--text-xs); font-weight:700; line-height:1; vertical-align:middle; box-shadow:none; }
button.access-box { cursor:pointer; }
button.access-box:hover:not(:disabled) { border-color:var(--brand-500); }
button.access-box:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.access-box.allow { background:var(--brand-600); border-color:var(--brand-600); color:var(--on-accent); }
.access-box.deny { background:var(--danger-bg); border-color:var(--danger); color:var(--danger); }
.access-box.via-group { color:var(--brand-400); border-style:dashed; }
.access-box.overridden { background:var(--surface-3); border-color:var(--line-strong); color:var(--ink-500); text-decoration:line-through; }
.access-legend { display:flex; flex-wrap:wrap; gap:var(--space-2) var(--space-4); margin:0; padding:var(--space-3) var(--space-4); border-top:1px solid var(--line-soft); }
.access-legend > span { display:inline-flex; align-items:center; gap:var(--space-2); }
.access-readonly { display:flex; align-items:flex-start; gap:var(--space-3); padding:var(--space-2) var(--space-4); color:var(--ink-800); }
/* The read-only tick: a greyed disabled checkbox looks the same ticked or not. */
.access-mark { display:inline-flex; align-items:center; justify-content:center; width:1.25rem; height:1.25rem; flex:0 0 auto; border-radius:var(--radius-sm); font-size:var(--text-xs); font-weight:700; color:var(--ink-400); }
.access-mark.on { background:var(--brand-100); color:var(--brand-700); }
/* Sales team member: the person, then the right they hold on the team's
   deals. Wraps rather than squeezing the select on a phone. */
.team-member-row { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--space-2); padding:var(--space-1) 0; border-bottom:1px solid var(--line-soft); }
.team-member-row select { width:auto; min-width:8rem; }
/* minmax(0,…), not 1fr: a 1fr track grows to its table's minimum width, so
   the table widened the page instead of scrolling. */
@media (max-width: 1100px) { .access-columns { grid-template-columns:minmax(0,1fr); } }
@media (max-width: 600px) { .access-grid thead th:not(:first-child), .access-grid td { width:auto; padding-inline:var(--space-1); } }
/* "Copy access and settings from" -- Maximizer's copy user, above the tabs' content. */
/* A wrapping row, not a grid: a max-content track sized itself off the
   checkbox label and pushed the page 1,800px wide. */
.access-copy { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-2) var(--space-4); padding:var(--space-3); border:1px solid var(--line); border-top:0; background:var(--surface-2); }
.access-copy > label { margin:0; flex:0 0 auto; }
.access-copy > select { flex:0 1 22rem; width:auto; min-width:0; max-width:100%; }
.access-copy .checkbox-row { display:inline-flex; align-items:center; gap:var(--space-2); width:auto; }
.access-copy .checkbox-row input { width:auto; flex:0 0 auto; margin:0; }
.access-copy p { flex:1 1 100%; min-width:0; margin:0; }
:root {
    color-scheme: light;

    /* --- brand ------------------------------------------------ */
    --brand-700: #4643a5;
    --brand-600: #5752c7;   /* primary actions, links */
    --brand-500: #6964dd;
    --brand-400: #8d89ea;
    --brand-300: #b1aef3;   /* borders on selected/hovered brand fills */
    --brand-200: #d3d1f9;
    --brand-100: #ecebfd;   /* selected row / active nav fill */
    --brand-50:  #f7f6ff;   /* hover fill */

    /* --- print: paper is white whatever the screen theme, so these are
       never redefined for dark mode (QuotePrint). ---------------- */
    --print-ink:   #172033;
    --print-paper: #ffffff;

    /* --- ink (text) ------------------------------------------- */
    --ink-900: #172033;     /* page headings */
    --ink-800: #202b3f;     /* strong text, figures */
    --ink-700: #344055;     /* panel titles */
    --ink-600: #4b5870;
    --ink-500: #637087;     /* body */
    --ink-400: #7e899b;     /* muted / captions */
    --ink-300: #a0a9b8;     /* faint / meta */

    /* --- surfaces & lines ------------------------------------- */
    --canvas:    #f7f8fb;   /* page ground */
    --surface-1: #ffffff;   /* cards, panels */
    --surface-2: #fafbfc;   /* table heads, subtle fills */
    --surface-3: #f1f3f7;   /* filter bands, callouts */
    --line:      #e5e8ef;   /* default border */
    --line-strong: #ccd3df; /* form controls */
    --line-soft: #f0f2f6;   /* dividers inside a card */

    /* --- semantic --------------------------------------------- */
    --success:    #1a7a3f;
    --success-bg: #e6f7ec;
    --danger:     #c43d45;
    --danger-fg:  #8c2626;
    --danger-bg:  #fdeaea;
    --danger-line:#e5a3a3;
    --warning:    #b45309;
    --warning-bg: #fff8e6;
    --warning-line:#e6d08a;

    /* Data colours: what a figure MEANS. Only ever on the datum
       itself (a number, a bar, a slice) -- never on chrome. */
    --data-won:      #2f9e63;
    --data-progress: #33bcd0;
    --data-lost:     #e0393f;
    /* Pipeline stage colours. One set, read by both the tiles above the
       Opportunities list and the "Pipeline by stage" bars on Home --
       which disagreed until 2026-09-14, the tiles using these hues and
       the bars a separate indigo ramp, so the same stage was two colours
       depending on the page. Crm.Core's PipelineStageTone decides which
       tone a stage gets; these say what each tone looks like.
       The -soft variants are the tile backgrounds. */
    --stage-qualify:  #4c8bf5;
    --stage-analysis: #8a68d8;
    --stage-proposal: #d98a35;
    --stage-review:   #1a9f91;
    --stage-open:     #4c8bf5;
    --stage-won:      #168a58;
    --stage-lost:     #d85d6d;

    --stage-qualify-soft:  #f5f8ff;
    --stage-analysis-soft: #f9f7ff;
    --stage-proposal-soft: #fff9f1;
    --stage-review-soft:   #f2fbfa;
    --stage-open-soft:     #f5f8ff;
    --stage-won-soft:      #f2fcf7;
    --stage-lost-soft:     #fff6f7;


    /* Text/icons sitting ON a saturated fill. Stays white in both
       themes, because the fills it sits on stay dark in both. */
    --on-accent: #ffffff;

    /* Tinted outlines for won / lost / at-risk chips and stage steps.
       Alpha rather than a flat tint so they hold on any surface. */
    --success-line: #1a7a3f44;
    --danger-line-soft: #8c262644;
    --warning-line-soft: #d03b3b44;

    /* The one non-blue accent in the app (individual-contact badge,
       field-change timeline markers). Named so it stays the only one. */
    --accent-purple: #7655a7;
    --accent-purple-strong: #5b3f8c;
    --accent-purple-bg: #f6f1fb;

    /* Module colours identify where you are. Each is paired with one
       very pale wash; saturated colour is reserved for icons and rails. */
    --module-company: #0f9888;
    --module-company-soft: #e8f8f4;
    --module-person: #7959d6;
    --module-person-soft: #f1edff;
    --module-lead: #df6b45;
    --module-lead-soft: #fff0e9;
    --module-work: #c68b18;
    --module-work-soft: #fff7df;
    --module-activity: #198e5a;
    --module-activity-soft: #eaf8f0;
    --module-opportunity: #1689b3;
    --module-opportunity-soft: #e9f7fc;
    --module-case: #cd5573;
    --module-case-soft: #fff0f4;
    --module-quote: #4f8a1f;
    --module-quote-soft: #f1f9e8;
    --module-campaign: #dc7a28;
    --module-campaign-soft: #fff3e8;
    --module-report: #426fbd;
    --module-report-soft: #edf3fc;

    /* Form accents make editable CRM data easy to pick out without
       colouring the whole application chrome. */
    --field-accent: #5752c7;
    --field-accent-soft: #efefff;
    --field-accent-hover: #dedcff;
    --field-label: #514f7c;
    --section-accent: var(--module-company);
    --section-accent-soft: var(--module-company-soft);

    /* Navigation rail: a cool indigo shell with brighter, purpose-built
       icon colours. These are intentionally separate from the module colours
       used on white content surfaces, where the same values would be loud. */
    --nav-top: #191a37;
    --nav-mid: #302e69;
    --nav-bottom: #504b9c;
    --nav-icon-home: #b8c4ff;
    --nav-icon-company: #55e0cb;
    --nav-icon-person: #d3b1ff;
    --nav-icon-lead: #ff9b72;
    --nav-icon-work: #ffd166;
    --nav-icon-calendar: #6ed6ff;
    --nav-icon-activity: #69e6a6;
    --nav-icon-opportunity: #55ddef;
    --nav-icon-case: #ff86a8;
    --nav-icon-quote: #a3e36a;
    --nav-icon-campaign: #ffae61;
    --nav-icon-library: #f2ba5c;
    --nav-icon-report: #83b6ff;
    --nav-icon-inbox: #c9a8ff;
    --nav-icon-import: #5ce0a1;
    --nav-icon-setup: #d1c9dc;

    /* --- type scale (16px root: 11 12 13 14 15 16 18 22 28) ---- */
    --text-2xs: .6875rem;
    --text-xs:  .75rem;
    --text-sm:  .8125rem;
    --text-md:  .875rem;    /* body default */
    --text-lg:  .9375rem;
    --text-xl:  1rem;
    --text-2xl: 1.125rem;
    --text-3xl: 1.375rem;
    --text-4xl: 1.75rem;

    /* The one monospace stack. Two rules (.merge-field code and
       .policy-grid textarea) already asked for --font-mono with a bare
       'monospace' fallback and never got it, because nothing defined
       the token -- so they silently rendered in whatever the browser
       picked. Everything that shows a key, a code or a CIDR block reads
       from here. */
    --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

    /* --- space scale (4px base) -------------------------------- */
    --space-0: .125rem;
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    /* --- radius ------------------------------------------------ */
    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --font-sans: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;

    /* --- elevation --------------------------------------------
       Layered, not single. A tight "contact" shadow says the edge is
       touching the surface; a wider, softer one says it is above it.
       One blurry shadow gives neither and just looks smudged.
       --highlight-top is the other half: a 1px inset light line on the
       top edge, which is what actually reads as a raised object rather
       than a rectangle with a shadow under it. */
    --shadow-sm:
        0 1px 1px rgba(20, 35, 80, .04),
        0 1px 2px rgba(20, 35, 80, .06);
    --shadow-md:
        0 1px 2px rgba(20, 35, 80, .06),
        0 2px 6px rgba(20, 35, 80, .06),
        0 8px 16px -6px rgba(20, 35, 80, .08);
    --shadow-lg:
        0 1px 3px rgba(20, 35, 80, .08),
        0 8px 20px -4px rgba(20, 35, 80, .10),
        0 24px 44px -12px rgba(20, 35, 80, .14);
    /* Hover/active lift, paired with a 1px translate. */
    --shadow-raise:
        0 1px 2px rgba(20, 35, 80, .07),
        0 6px 12px -2px rgba(20, 35, 80, .10),
        0 16px 28px -10px rgba(20, 35, 80, .12);
    --highlight-top: inset 0 1px 0 rgba(255, 255, 255, .75);
    --shadow-press: inset 0 2px 4px rgba(20, 35, 80, .16);

    /* --- legacy aliases (see header) --------------------------- */
    --bg: var(--canvas);
    --surface: var(--surface-1);
    --border: var(--line);
    --text: var(--ink-800);
    --muted: var(--ink-400);
    --accent: var(--brand-600);
    --crm-primary: var(--brand-600);
    --error-bg: var(--danger-bg);
    --error-border: var(--danger-line);
    --error-text: var(--danger-fg);
    --warn-bg: var(--warning-bg);
    --warn-border: var(--warning-line);
    --warn-text: #6b5410;
}

.skip-to-content { position: fixed; left: .75rem; top: .5rem; z-index: 3000; transform: translateY(-180%); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--brand-600); color: var(--on-accent) !important; font-weight: 600; transition: transform .15s ease; }
.skip-to-content:focus { transform: translateY(0); }

/* Persisted appearance mode. The indigo-violet brand remains recognisable
   while neutral charcoal surfaces keep the dark workspace calm. */
html.theme-dark {
  color-scheme: dark;

  /* Redefine the RAMPS, not each component. Anything styled through
     a token is dark-mode correct for free; the per-component
     html.theme-dark rules further down are legacy and can go as
     their components move onto tokens. */
  /* The brand ramp is NOT inverted. These steps are fills as often as
     they are text, and --on-accent (white) sits on them -- lightening
     them would put white text on pale blue. Only the two tint steps,
     which are backgrounds, move. Link text in dark is handled by the
     html.theme-dark a rule further down. */
  /* --brand-700 is only ever TEXT (43 uses, no fills), usually on a
     --brand-50/100 tint, so unlike the fill steps it must lighten here:
     at #514db9 the active tab and selected-menu text vanished. */
  --brand-700: #c3c0fa;
  --brand-600: #5d5bd4;
  --brand-500: #706de1;
  --brand-400: #9895ef;
  --brand-300: #5856a8;
  --brand-200: #413f7c;
  --brand-100: #302f59;
  --brand-50:  #26263f;

  --ink-900: #f2f6ff;
  --ink-800: #e7eefb;
  --ink-700: #dbe4f4;
  --ink-600: #c4d1e6;
  --ink-500: #b3c0d6;
  --ink-400: #a8b6cc;
  --ink-300: #8f9cb3;

  --canvas:    #11131e;
  --surface-1: #1a1d2b;
  --surface-2: #222638;
  --surface-3: #292d43;
  --field-accent: #9895ef;
  --field-accent-soft: #302f55;
  --field-accent-hover: #3c396b;
  --field-label: #b7b4ef;
  --section-accent: #54d6c4;
  --section-accent-soft: #173d45;
  --line:      #383e58;
  --line-strong: #4a5270;
  --line-soft: #30354b;

  --success:    #57c98d;
  --success-bg: #15271e;
  --danger:     #f08a8f;
  --danger-fg:  #f3a3a7;
  --danger-bg:  #331d1e;
  --danger-line:#6d3538;
  --warning:    #e0a85c;
  --warning-bg: #2c2416;
  --warning-line:#5c4a24;

  /* Keep module identity vivid without pale panels glaring in dark mode. */
  --module-company: #54d6c4;
  --module-company-soft: #173d3b;
  --module-person: #b7a0ff;
  --module-person-soft: #352b50;
  --module-lead: #ffac87;
  --module-lead-soft: #472f2c;
  --module-work: #edc565;
  --module-work-soft: #40371e;
  --module-activity: #71d8a0;
  --module-activity-soft: #203d31;
  --module-opportunity: #72cee9;
  --module-opportunity-soft: #203b4b;
  --module-case: #f39ab4;
  --module-case-soft: #452a3b;
  --module-quote: #a9dc7a;
  --module-quote-soft: #2e3a24;
  --module-campaign: #ffbd79;
  --module-campaign-soft: #443423;
  --module-report: #9dbfff;
  --module-report-soft: #293850;

  /* Data colours lift slightly so they hold on a dark ground. */
  --data-won:      #4dc07f;
  --data-progress: #4fd3e6;
  --data-lost:     #f0605f;

  /* The stage tints are backgrounds; left at their light values they
     were near-white panels on the dark canvas. */
  --stage-qualify-soft:  color-mix(in srgb, var(--stage-qualify) 16%, var(--surface-1));
  --stage-analysis-soft: color-mix(in srgb, var(--stage-analysis) 16%, var(--surface-1));
  --stage-proposal-soft: color-mix(in srgb, var(--stage-proposal) 16%, var(--surface-1));
  --stage-review-soft:   color-mix(in srgb, var(--stage-review) 16%, var(--surface-1));
  --stage-open-soft:     color-mix(in srgb, var(--stage-open) 16%, var(--surface-1));
  --stage-won-soft:      color-mix(in srgb, var(--stage-won) 16%, var(--surface-1));
  --stage-lost-soft:     color-mix(in srgb, var(--stage-lost) 16%, var(--surface-1));
  --accent-purple-bg:    color-mix(in srgb, var(--accent-purple) 18%, var(--surface-1));
  --accent-purple-strong: #c7b0ee;

  /* Depth on a dark ground comes mostly from the highlight, not the
     shadow -- a black shadow on near-black reads as nothing. */
  --shadow-sm:
      0 1px 1px rgba(0, 0, 0, .3),
      0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md:
      0 1px 2px rgba(0, 0, 0, .35),
      0 3px 8px rgba(0, 0, 0, .38),
      0 10px 20px -8px rgba(0, 0, 0, .45);
  --shadow-lg:
      0 2px 4px rgba(0, 0, 0, .4),
      0 10px 24px -4px rgba(0, 0, 0, .45),
      0 28px 48px -14px rgba(0, 0, 0, .55);
  --shadow-raise:
      0 2px 4px rgba(0, 0, 0, .4),
      0 8px 16px -2px rgba(0, 0, 0, .45),
      0 20px 32px -12px rgba(0, 0, 0, .5);
  --highlight-top: inset 0 1px 0 rgba(255, 255, 255, .07);
  --shadow-press: inset 0 2px 5px rgba(0, 0, 0, .5);

  --warn-text: #e2c98c;

  /* Legacy names still referenced by ~40 rules below. */
  --crm-bg: var(--canvas);
  --crm-surface: var(--surface-1);
  --crm-surface-raised: var(--surface-2);
  --crm-text: var(--ink-800);
  --crm-muted: var(--ink-400);
  --crm-line: var(--line);

}
html.theme-dark body { background: var(--crm-bg); color: var(--crm-text); }
html.theme-dark .app-shell,
html.theme-dark .main-content { background: var(--crm-bg); color: var(--crm-text); }

/* Keep keyboard focus visible across every control.
   Several compact toolbar buttons intentionally remove their default
   browser outline; this restores one consistent, high-contrast indicator. */
:where(a, button, input, select, textarea):focus-visible {
    outline:2px solid var(--crm-primary);
    outline-offset: 2px;
}
html.theme-dark .modal,
html.theme-dark .report-builder,
html.theme-dark .workqueue-card,
html.theme-dark .dashboard-panel { background: var(--crm-surface); color: var(--crm-text); }
.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; }
html.theme-dark input,
html.theme-dark textarea,
html.theme-dark select { background: var(--crm-surface-raised); color: var(--crm-text); }
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder { color: var(--crm-muted); }
html.theme-dark .detail-section,
html.theme-dark .record-summary { border-color: var(--crm-line); }

/* A legacy classless anchor still needs an intentional CRM treatment.
   New navigation/actions should use the existing button, record-link, or
   panel-link pattern; prose links keep this compact, tinted fallback.
   Menus and the related-record rail have their own whole-row styling. */
a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }
a:visited { color: var(--brand-600); }
html.theme-dark a { color:var(--brand-400); }
a:not([class]):not([role="menuitem"]):not(.record-rail a):not(.action-menu-panel a):not(.avatar-menu-popover a) {
    padding: .07em .25em;
    border-radius: var(--radius-sm);
    background: var(--brand-50);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--brand-300);
    text-underline-offset: .18em;
    box-decoration-break: clone;
}
a:not([class]):not([role="menuitem"]):not(.record-rail a):not(.action-menu-panel a):not(.avatar-menu-popover a):hover {
    background: var(--brand-100);
    text-decoration-color: currentColor;
}
html.theme-dark a:not([class]):not([role="menuitem"]):not(.record-rail a):not(.action-menu-panel a):not(.avatar-menu-popover a) { background: var(--crm-surface-raised); text-decoration-color: var(--brand-400); }
html.theme-dark .theme-toggle { color: var(--crm-text); }
.theme-toggle { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: var(--text-2xl); line-height: 1; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.theme-toggle:hover, .theme-toggle:focus-visible { background: rgba(255,255,255,.14); outline: 2px solid currentColor; outline-offset: 2px; }
html.theme-dark .muted { color: var(--crm-muted) !important; }

/* A #anchor jump (SectionJumpNav.razor) should glide, not snap --
   respects the user's own OS/browser reduced-motion setting, which
   auto-disables smooth scrolling regardless of this rule. */
html { scroll-behavior: smooth; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1 { font-size: var(--text-3xl); margin: 0 0 var(--space-4); }
code { font-family: Consolas, "Courier New", monospace; font-size: .9em; }
.muted { color: var(--muted); }

/* Typography scale, added when MudText was removed. MudBlazor's Typo
   values were a visual scale rather than document structure -- Typo.h5
   was used for currency figures and Typo.subtitle2 for uppercase section
   labels -- so these are classes, not headings. Promoting the ones that
   really are page titles to <h1>/<h2> is worth doing, but separately:
   real heading elements would immediately pick up rules like
   ".detail-form h2" and change layout, which is not this change's job.
   Sizes come off the type scale rather than copying MudBlazor's px. */
.text-h4        { font-size: var(--text-4xl); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.text-h5        { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.text-h6        { font-size: var(--text-2xl); font-weight: 600; line-height: 1.3; }
.text-subtitle1 { font-size: var(--text-xl); font-weight: 500; }
.text-subtitle2 { font-size: var(--text-md); font-weight: 600; }
.text-body2     { font-size: var(--text-md); }
.text-caption   { font-size: var(--text-xs); }
.small { font-size: var(--text-md); }

/* --- login ------------------------------------------------------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-sm);
}

.login-card .workspace {
    margin: calc(-1 * var(--space-2)) 0 var(--space-5);
    color: var(--muted);
}

/* --- single sign-on ------------------------------------------------ */
.sso-button {
    display: block;
    width: 100%;
    margin-top: var(--space-5);
    text-align: center;
}

/* A rule with the word "or" sitting on it, so the two ways in read as
   alternatives rather than as steps. */
.sso-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-5) 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.sso-divider::before,
.sso-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* --- two-step verification --------------------------------------
   Both of these hold strings that get read off a screen and typed
   somewhere else, so they are set in a monospace face with generous
   letter-spacing: the whole job here is telling 5 from S and 8 from B
   at a glance. */
.setup-key {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    letter-spacing: .08em;
    word-break: break-all;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin: var(--space-3) 0;
    text-align: center;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    list-style: none;
    padding: var(--space-3);
    margin: var(--space-4) 0;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    letter-spacing: .04em;
    text-align: center;
}

/* One column on a narrow screen: a ten-character code wrapping
   mid-string is worse than a longer list. */
@media (max-width: 30rem) {
    .recovery-codes { grid-template-columns: 1fr; }
}

label {
    display: block;
    margin: var(--space-4) 0 var(--space-1);
    font-weight: 600;
    font-size: var(--text-md);
}

input[type=text], input[type=email], input[type=password] {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-family: inherit;
    background: var(--surface-1);
    /* The inverse of a button: a field is a hole, not a lump. A faint
       inset shadow at the top edge is what makes it read as recessed
       next to a raised control. */
    box-shadow: inset 0 1px 2px rgba(20, 35, 80, .07);
}

/* Every other form control, app-wide. Until 2026-10-01 only text, email
   and password boxes had a house style; dropdowns, text areas and number,
   date and search inputs were browser defaults anywhere a page had not
   styled its own (list filters, admin screens), which is most of what made
   screens look unfinished next to each other. Same box as the text input
   above. The dropdown keeps the browser's own arrow on purpose: several
   page rules set the background shorthand, which would silently erase a
   drawn chevron and leave a select with no arrow at all. */
input:not([type]), input[type=search], input[type=number], input[type=date], input[type=datetime-local],
input[type=time], input[type=month], input[type=tel], input[type=url], select, textarea {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-family: inherit;
    color: var(--ink-800);
    background-color: var(--surface-1);
    box-shadow: inset 0 1px 2px rgba(20, 35, 80, .07);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:not([type]), input[type=search], input[type=tel], input[type=url], textarea { width: 100%; }
textarea { resize: vertical; line-height: 1.45; }
select { cursor: pointer; max-width: 100%; }

input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):hover:not(:disabled),
select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--field-accent); }

/* A search box that draws its own frame (the app bar, list searches) holds
   a bare input: no second box inside it. */
.appbar-search input, .search-field input, .record-search-box input, .report-search input,
.record-access-search input, .sales-mailbox-search input,
html.theme-dark :is(.appbar-search, .search-field, .record-search-box, .report-search,
    .record-access-search, .sales-mailbox-search) input {
    box-shadow: none; background-color: transparent;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled, select:disabled, textarea:disabled { background-color:var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-600); }

/* A bare <button> otherwise takes the browser's 13.33px system font, which
   is on no scale and is why a row of icon buttons read smaller than the text
   beside them. :where() keeps this at zero specificity so any class wins. */
:where(button) { font-family: inherit; font-size: inherit; }

/* A small square icon-only control (sync, close, discard). It was used on
   the inbox, composer and interactions pages without ever being defined, so
   it rendered as a grey browser-default button. */
.icon-button {
    display: inline-grid; place-items: center;
    min-width: var(--space-6); height: var(--space-6); padding: 0 var(--space-1);
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink-500);
    font-size: var(--text-xl); line-height: 1; cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-button:hover:not(:disabled) { background: var(--brand-50); border-color: var(--line); color: var(--brand-600); }
.icon-button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.icon-button:disabled { opacity: .45; cursor: default; }

/* :not(.appbar-logout) matters. This is an element selector, so without
   the exclusion the generic margin-top:var(--space-5) lands on the app bar's 36px
   sign-out icon button and pushes it 3px below the 54px bar's bottom edge,
   into the gradient line under it -- found live, not from reading the
   rule. (There used to be a :not(.mud-button-root) here for the same
   reason, back when every MudButton rendered as type=submit was repainted
   a saturated blue regardless of its Variant.) */
button[type=submit]:not(.appbar-logout), .button {
    display: inline-block;
    margin-top: var(--space-5);
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    color:var(--on-accent);
    border: 0;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    /* A control should feel pressable: sitting slightly proud at rest,
       lifting on hover, and sinking under the pointer. The inset
       highlight on the top edge is what sells it -- without it this is
       a coloured rectangle with a shadow. */
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.18);
    transition: box-shadow .14s ease, transform .14s ease, background .14s ease;
}

button[type=submit]:not(.appbar-logout):hover:not(:disabled), .button:hover:not(:disabled) {
    box-shadow: var(--shadow-raise), inset 0 1px 0 rgba(255,255,255,.18);
    transform: translateY(-1px);
}

button[type=submit]:not(.appbar-logout):active:not(:disabled), .button:active:not(:disabled) {
    box-shadow: var(--shadow-press);
    transform: translateY(1px);
}

button[type=submit]:not(.appbar-logout):disabled, .button:disabled {
    background: var(--ink-300); cursor: not-allowed; box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    button[type=submit]:not(.appbar-logout), .button, .sid-kpi { transition: none; }
    button[type=submit]:not(.appbar-logout):hover, .button:hover,
    .sid-kpi:hover { transform: none; }
}

button.link {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.alert {
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: var(--text-md);
}

.alert.error { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-text); }
.alert.warning { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.alert.success { background:var(--success-bg); border:1px solid var(--success-line); color:var(--success); }
.alert.success a { color: inherit; font-weight: 600; }

/* Added when MudAlert was removed: the app had its own alert in three of
   the four severities MudBlazor offered, so these are the two that had no
   equivalent yet. .dense reduces padding the way MudBlazor's Dense did,
   and deliberately keeps the base margin -- unlike .alert.inline below,
   which also drops it and is for alerts sitting inside another control. */
.alert.info { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); }
.alert.dense { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }

/* One alert in the app is dismissible (Team). MudAlert drew the close
   icon itself; this lays out the message, its action and that close
   control now the markup is ours. */
.alert-dismissible { display: flex; align-items: center; gap: var(--space-3); }
.alert-dismissible > span { flex: 1; }
.alert.error .alert-close { color: var(--error-text); font-size: var(--text-2xl); line-height: 1; padding: 0 var(--space-1); }

.validation-message { color: var(--error-text); font-size: var(--text-sm); display: block; margin-top: var(--space-1); }

/* --- app --------------------------------------------------------- */
.page { max-width: 900px; margin: 0 auto; padding: 0 var(--space-4) 3rem; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

/* --- global search (top nav) -------------------------------------- */
.global-search { flex: 0 1 12rem; display: flex; }
.global-search input[type=search] {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
}
.global-search button {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
}
.global-search button:hover { color: var(--accent); border-color: var(--accent); }

/* --- app bar search ------------------------------------------------
   Plain HTML -- see MainLayout.razor's own comment on why this is a GET
   form and not a bound field. A light grey pill on a white bar
   (Salesforce Lightning's own search-bar treatment), not the
   translucent-on-colour style this had when the bar itself was solid
   blue. */
.appbar-search {
    display: flex; align-items: center; gap: var(--space-2);
    background:var(--surface-2); border-radius: var(--radius-pill);
    padding: var(--space-2) var(--space-4); width: 22rem; max-width: 34vw;
}
.appbar-search-icon { color:var(--ink-400) !important; flex-shrink: 0; }
.appbar-search input[type=search] {
    background: none; border: 0; outline: 0; color:var(--ink-800);
    font: inherit; font-size: var(--text-md); width: 100%;
}
.appbar-search input[type=search]::placeholder { color:var(--ink-400); }
.appbar-search-kbd {
    font-family: "IBM Plex Mono", monospace; font-size: var(--text-2xs);
    color:var(--ink-400); background:var(--surface-2);
    border-radius: var(--radius-sm); padding: .0625rem var(--space-1); flex-shrink: 0;
}

/* --- page content area ----------------------------------------------
   Both offsets are this file's own now. Under MudMainContent the top one
   was MudBlazor's, and a same-specificity rule here -- loaded after its
   stylesheet -- silently won the cascade and cancelled it, which is what
   put "Welcome, Graeme" invisibly behind the app bar the first time this
   was written (found live in the browser, not by re-reading the CSS: the
   accessibility tree had the heading, the screenshot didn't). */
.main-content {
    margin-left: var(--rail-w);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    padding-bottom: 3rem;
    padding-top: calc(var(--appbar-h) + var(--nav-top-h, 0px) + 1.5rem);
    min-width: 0;
}
.main-content .page { max-width: none; margin: 0; padding: 0; }
.clickable-row { cursor: pointer; }
.clickable-row:focus-visible { outline:2px solid var(--crm-primary); outline-offset: -2px; }
.calendar-more { border:0; background:transparent; cursor:pointer; padding:var(--space-0) var(--space-1); text-align:left; }
.calendar-more:hover, .calendar-more:focus-visible { color:var(--crm-primary,var(--brand-500)); text-decoration:underline; }
.route-error { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:50vh; gap:var(--space-3); text-align:center; padding:var(--space-6); }
.route-error p { color:var(--muted,var(--ink-500)); margin:0; }
/* A record's name inside a data table. Dark and unadorned at rest so a
   column of them reads as data rather than a wall of blue, and the link
   affordance arrives on hover and on keyboard focus.

   .activity-subject-link is the original name, kept because several pages
   still use it; .record-link is the same treatment under a name that says
   what it is. Both, because renaming every call site to prove a point is
   not worth a diff. */
.activity-subject-link,
.record-link { color: inherit; text-decoration: none; font-weight: 600; }
.activity-subject-link:hover, .activity-subject-link:focus-visible,
.record-link:hover, .record-link:focus-visible { color: var(--brand-600); text-decoration: underline; }

/* --- the app shell (MainLayout.razor + NavMenu.razor) -----------------
   Two variables run the whole thing. --appbar-h is how far the fixed bar
   pushes the page down; --rail-w is the sidebar's width AND the content's
   left offset, so the collapse toggle is a single :has() that re-points
   one number. Under MudLayout this took six !important rules in three
   parts of this file, because the drawer width lived in MudBlazor's own
   --mud-drawer-width-left and three different MudBlazor releases had
   put the content in three different DOM positions relative to it. */
/* Four rail states, driven by a class on <html> that wwwroot/js/nav.js
   sets: labelled (208px), icons (56px), top (no rail; the same markup
   reflowed into a horizontal strip, see html.nav-top below) and hidden.
   The class is on the root rather than the rail because the "bring it
   back" control lives in the app bar -- when the rail is hidden there is
   nowhere else for it -- and because App.razor's inline script can then
   set it before first paint, so the rail does not flash in and out on
   every load. */
.app-shell { --appbar-h: 54px; --rail-w: 208px; --nav-top-h: 0px; }
html.nav-icons .app-shell { --rail-w: 3.5rem; }
html.nav-hidden .app-shell { --rail-w: 0px; }
html.nav-hidden .drawer { display: none; }

.appbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1100;
    display: flex;
    align-items: center;
    height: var(--appbar-h);
    padding: 0 var(--space-4);
    background: var(--surface-1);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--brand-600) 6%, transparent), var(--shadow-sm);
}
.appbar::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: linear-gradient(90deg, var(--module-company), var(--brand-500), var(--module-person), var(--module-campaign));
    opacity: .8;
}

/* Cool indigo workspace rail, inspired by the supplied reference while
   leaving the working canvas intentionally light. The gradient belongs
   only to navigation; forms, record cards, tables and text inputs keep
   --surface (#fff) so data entry remains crisp and high contrast. */
.drawer {
    position: fixed;
    top: var(--appbar-h);
    bottom: 0;
    left: 0;
    z-index: 1000;
    width: var(--rail-w);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 var(--space-2) var(--space-3);
    background:
        radial-gradient(circle at 0 0, rgba(154, 151, 255, .16), transparent 25rem),
        linear-gradient(180deg, var(--nav-top) 0%, var(--nav-mid) 48%, var(--nav-bottom) 100%);
    box-shadow: var(--shadow-sm);
    transition: width .15s ease;
}
.nav-menu { display: flex; flex-direction: column; gap: var(--space-0); }
.nav-link {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-md);
    color: var(--on-accent);
    font-size: var(--text-md);
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
}
/* :visited (specificity 0,1,1) otherwise beats this class (0,1,0) once a
   route has been visited, because of the global `a:visited` rule below --
   every rail link you've actually clicked would fall back to --brand-600
   instead of staying white. Only .active/.hover happened to be specific
   enough to not need this. */
.nav-link:visited { color: var(--on-accent); }
.nav-link:hover {
    background: rgba(255,255,255,.12);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--module-color, var(--brand-400)) 55%, transparent);
}
.nav-link-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.65rem;
    height: 1.65rem;
    margin-right: var(--space-2);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--module-color, var(--brand-400)) 18%, transparent);
}
/* Small module colour cues make scanning the purple rail easier without
   changing the calm data-entry surfaces in the rest of the CRM. The
   --module-color each .nav-* sets is further down this file, shared with
   the module page headers so a module has one colour everywhere. */
.nav-link-icon .material-icons { font-size: 20px; color: var(--module-color, rgba(247,249,255,.72)); }
.nav-link-text { overflow: hidden; text-overflow: ellipsis; }

.nav-link.active {
    background: linear-gradient(90deg, rgba(255,255,255,.15), rgba(255,255,255,.06));
    color: var(--on-accent);
    box-shadow: inset 3px 0 0 var(--module-color, var(--brand-400));
}
.nav-link.active .nav-link-text { font-weight: 600; }
.nav-link.active .nav-link-icon {
    background: color-mix(in srgb, var(--module-color, var(--brand-400)) 28%, rgba(255,255,255,.08));
    box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}

/* Icons only: the label is hidden but the icon keeps its tile, so the
   rail still reads as navigation and not as a column of loose glyphs. */
html.nav-icons .nav-link-text { display: none; }
html.nav-icons .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
html.nav-icons .nav-link-icon { margin-right: 0; }
/* Retain the saved desktop layout while giving phone content room to breathe. */
@media (max-width: 700px) {
    html.nav-labelled .app-shell { --rail-w: 3.5rem; }
    html.nav-labelled .nav-link-text { display: none; }
    html.nav-labelled .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
    html.nav-labelled .nav-link-icon { margin-right: 0; }
}

/* The "top" state: the same rail markup reflowed into a horizontal strip
   under the app bar. Deliberately CSS-only rather than a second component
   -- the module list stays single-sourced in ModuleSwitcher.Build, and
   there is no duplicate DOM to keep in step.

   --nav-top-h feeds .main-content's padding-top the way --rail-w feeds its
   margin-left, so the content clears the strip without any rule knowing
   which mode is active. */
html.nav-top .app-shell { --rail-w: 0px; --nav-top-h: 2.6rem; }
html.nav-top .drawer {
    top: var(--appbar-h);
    bottom: auto;
    width: 100%;
    height: var(--nav-top-h);
    padding: 0 var(--space-2);
    overflow-x: auto;
    overflow-y: hidden;
}
html.nav-top .nav-shell { display: flex; align-items: center; height: 100%; gap: var(--space-2); }
html.nav-top .nav-menu { flex-direction: row; gap: var(--space-0); }
html.nav-top .nav-link { height: 1.95rem; padding: 0 var(--space-2); }
html.nav-top .nav-link-icon { width: 1.3rem; height: 1.3rem; margin-right: var(--space-1); border-radius: var(--radius-sm); }
html.nav-top .nav-link-icon .material-icons { font-size: 16px; }
html.nav-top .nav-link-text { font-size: var(--text-sm); }
/* The active item marks itself with an underline here rather than the
   rail's left stripe -- an inset left edge reads as nothing on a
   horizontal strip. */
html.nav-top .nav-link.active { box-shadow: inset 0 -2px 0 var(--module-color, var(--brand-400)); }
/* The strip scrolls when the modules do not fit -- at 820px only 8 of
   the 15 show. A thin scrollbar rather than none: the strip genuinely does scroll, so
   hiding the affordance entirely would leave the overflow undiscoverable,
   but the default band is most of a row of chrome. */
html.nav-top .drawer { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
html.nav-top .drawer::-webkit-scrollbar { height: 4px; }
html.nav-top .drawer::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 2px; }
html.nav-top .drawer::-webkit-scrollbar-track { background: transparent; }

/* --- app-bar navigation, shown only when the rail is hidden -----------
   With the rail showing this would be a second copy of the same
   navigation. Hidden is the one state where the bar has to carry it. */
.appbar .module-switcher { display: none; }
html.nav-hidden .appbar .module-switcher { display: block; }

/* The breadcrumb switcher. A <details> disclosure, so it needs no circuit
   -- see ModuleSwitcher.razor for why that matters in a statically
   rendered layout. */
.module-switcher { position: relative; margin-right: var(--space-3); }
.module-switcher > summary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-800);
    font-size: var(--text-md);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.module-switcher > summary::-webkit-details-marker { display: none; }
.module-switcher > summary:hover { background: var(--surface-2); border-color: var(--line-strong); }
.module-switcher > summary:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.module-switcher > summary .material-icons { font-size: 18px; color: var(--ink-400); }
.module-switcher[open] > summary .material-icons { transform: rotate(180deg); }

.module-menu {
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(2, minmax(9rem, 1fr));
    gap: var(--space-0);
    padding: var(--space-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    box-shadow: var(--shadow-lg), var(--highlight-top);
}
.module-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--ink-700);
    font-size: var(--text-md);
    text-decoration: none;
    white-space: nowrap;
}
.module-menu-item:hover { background: var(--surface-2); color: var(--ink-900); }
.module-menu-item.current { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.module-menu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--module-color, var(--brand-400)) 16%, transparent);
}
.module-menu-icon .material-icons { font-size: 18px; color: var(--module-color, var(--ink-500)); }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* Keep the working canvas usable beside the compact rail on laptops and
   split-screen browser windows. The wide desktop gutters are helpful at
   full width, but become wasted horizontal space once the viewport is
   narrow; the page itself already provides card-level spacing. */
@media (max-width: 1100px) {
    .main-content {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
}
@media (max-width: 700px) {
    .main-content {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }
}

/* Respect the operating system's accessibility preference. The CRM has
   drag/drop cards, drawer transitions and button hover effects, but none
   of those should override a user's reduced-motion setting. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* --- command palette (CommandPalette.razor) -------------------------
   Plain markup, not a MudBlazor popover component -- see that
   component's own top comment for why. Fixed positioning so it sits
   above the app shell (drawer, app bar) regardless of which page
   mounted it. */
.cmdk-overlay {
    position: fixed; inset: 0; background: rgba(15,15,25,.45);
    z-index: 2000; display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12vh;
}
.cmdk {
    width: 34rem; max-width: 92vw; background:var(--surface-1);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.cmdk-input {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-4);
    border-bottom:1px solid var(--line);
}
.cmdk-input input {
    border: 0; outline: 0; font: inherit; font-size: var(--text-xl); flex: 1; background: none;
    color:var(--ink-800);
}
.cmdk-input kbd {
    font-family: "IBM Plex Mono", monospace; font-size: var(--text-xs);
    color: var(--ink-400); background:var(--canvas);
    border-radius: var(--radius-sm); padding: .0625rem var(--space-2);
}
.cmdk-list { padding: var(--space-2); max-height: 22rem; overflow-y: auto; }
.cmdk-section {
    font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-400); padding: var(--space-3) var(--space-3) var(--space-2);
}
.cmdk-item {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3); border-radius: var(--radius-md);
    font-size: var(--text-md); cursor: pointer;
}
.cmdk-item.sel, .cmdk-item:hover { background: var(--surface-2); }
.cmdk-ic {
    width: 1.75rem; height: 1.75rem; border-radius: var(--radius-sm); flex-shrink: 0;
    background:var(--canvas); color: var(--brand-600);
    display: flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 700;
}
.cmdk-meta { margin-left: auto; color: var(--ink-400); font-size: var(--text-xs); }
.cmdk-empty { padding: var(--space-4) var(--space-3); color: var(--ink-400); font-size: var(--text-md); }

/* --- Opportunities: Table/Board view toggle + kanban board ---------- */
.view-toggle {
    display: flex; border-radius: var(--radius-pill); overflow: hidden;
    border:1px solid var(--line);
}
.view-toggle button {
    font: inherit; font-size: var(--text-sm); font-weight: 600; padding: var(--space-2) var(--space-4); border: 0; cursor: pointer;
    display: flex; align-items: center; gap: var(--space-1);
    background:var(--surface-1); color: var(--ink-400);
}
.view-toggle button.active { background: var(--brand-600); color:var(--on-accent); }

.board-columns { display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-3); align-items: flex-start; }
.board-column { width: 16rem; flex-shrink: 0; border-radius: var(--radius-md); transition: background-color .1s; }
.board-column-dragover { background: var(--brand-50); outline: 2px dashed var(--brand-600); outline-offset: -2px; }
.board-col-head {
    display: flex; flex-direction: column; gap: var(--space-1);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); margin-bottom: var(--space-3); color:var(--on-accent);
}
.board-col-head .line1 { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.board-col-head .name { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.board-col-head .meta { font-size: var(--text-2xs); font-weight: 600; opacity: .85; white-space: nowrap; }
.board-col-head .amt { font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-col-empty, .board-col-more {
    font-size: var(--text-sm); color: var(--ink-400); padding: var(--space-2) var(--space-2);
}
.board-card {
    background:var(--surface-1); border-radius: var(--radius-md); border-top: 3px solid;
    box-shadow: var(--shadow-sm), var(--highlight-top);
    padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); cursor: pointer;
    transition: box-shadow .15s, transform .15s;
}
.board-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.board-card-dragging { opacity: .4; }
.board-card .title { font-size: var(--text-md); font-weight: 600; margin-bottom: var(--space-1); }
.board-card .company { font-size: var(--text-xs); color: var(--ink-400); margin-bottom: var(--space-2); }
.board-card .company:has(+ .contact) { margin-bottom: var(--space-0); }
.board-card .contact { font-size: var(--text-xs); color: var(--brand-600); margin-bottom: var(--space-2); }
.board-card .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }
.board-card .money { display: flex; flex-direction: column; gap: var(--space-0); min-width: 0; }
.board-card .amt { font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-card .closedate { font-size: var(--text-2xs); color: var(--ink-400); white-space: nowrap; }
.board-card .closedate-overdue { color: var(--danger); font-weight: 600; }
.board-card .stage-age { margin-left: auto; font-size: var(--text-2xs); color: var(--ink-400); font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-card .owner {
    width: 1.375rem; height: 1.375rem; border-radius: 50%; background:var(--canvas);
    color: var(--brand-600); font-size: var(--text-2xs); font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
/* The tile wears its stage's tone. Tones come from Crm.Core's
   PipelineStageTone, shared with the Home bars, and the colours from the
   --stage-* tokens, so neither is written twice. */
.pipeline-tile { border-top: 3px solid var(--brand-600); }
.pipeline-tile.stage-qualify { border-top-color: var(--stage-qualify); background: var(--stage-qualify-soft); }
.pipeline-tile.stage-analysis { border-top-color: var(--stage-analysis); background: var(--stage-analysis-soft); }
.pipeline-tile.stage-proposal { border-top-color: var(--stage-proposal); background: var(--stage-proposal-soft); }
.pipeline-tile.stage-review { border-top-color: var(--stage-review); background: var(--stage-review-soft); }
.pipeline-tile.stage-open { border-top-color: var(--stage-open); background: var(--stage-open-soft); }
.pipeline-tile.stage-won { border-top-color: var(--stage-won); background: var(--stage-won-soft); }
.pipeline-tile.stage-lost { border-top-color: var(--stage-lost); background: var(--stage-lost-soft); }
.pipeline-tile-active { border-color: var(--brand-600) !important; box-shadow: inset 0 0 0 1px var(--brand-600); }

.record-cell { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.record-cell > div:last-child { min-width: 0; }
.record-heading { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.record-avatar {
    width: 2rem; height: 2rem; flex: 0 0 2rem; display: grid; place-items: center;
    border-radius: var(--radius-md); font-size: var(--text-2xs); font-weight: 750; letter-spacing: .025em;
}

/* Campaign email workspace */
.campaign-email-panel { margin-top: var(--space-6); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.campaign-audience-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-4); margin: var(--space-3) 0 var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-left: 4px solid var(--module-campaign); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-audience-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.campaign-audience-field > label { color: var(--ink-700); font-size: var(--text-xs); font-weight: 700; }
.campaign-audience-row { display: flex; gap: var(--space-2); min-width: 0; }
.campaign-audience-row input, .campaign-audience-row select { flex: 1 1 14rem; min-width: 0; min-height: 2.6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); background: var(--surface-1); color: var(--ink-900); }
.campaign-audience-row .button { white-space: nowrap; }
.campaign-email-panel h2, .campaign-email-panel h3 { margin: 0; }
.campaign-email-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-4); max-width: 72rem; margin-bottom: var(--space-5); }
.campaign-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.campaign-field > label, .campaign-sender-heading label { color: var(--ink-700); font-size: var(--text-xs); font-weight: 700; }
.campaign-field-full { grid-column: 1 / -1; }
.campaign-input-action { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--space-3); align-items: stretch; }
.campaign-input-action .button { min-width: 7rem; }
.campaign-email-fields input, .campaign-email-fields select, .campaign-test-address { width: 100%; min-height: 2.6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); background: var(--surface-1); color: var(--ink-900); }
.campaign-sender-card { padding: var(--space-4) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.campaign-sender-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.campaign-sender-heading > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.campaign-toggle { display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; cursor: pointer; }
.campaign-toggle input { width: 1.1rem; min-height: 1.1rem; accent-color: var(--brand-600); }
.campaign-sender-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.campaign-editor { min-height: 24rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--print-paper); color: var(--print-ink); }
.campaign-plaintext-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-0) var(--space-2); margin: var(--space-1) 0 var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); cursor: pointer; }
.campaign-plaintext-toggle input { width: 1.1rem; min-height: 1.1rem; accent-color: var(--brand-600); }
.campaign-plaintext-toggle span { flex-basis: 100%; color: var(--ink-400); font-size: var(--text-sm); }
.campaign-plaintext-editor { width: 100%; min-height: 24rem; padding: var(--space-4) var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); font-family: inherit; font-size: var(--text-xl); line-height: 1.6; color: var(--ink-800); resize: vertical; }
.campaign-plaintext-editor:disabled { background: var(--surface-3); color: var(--ink-500); cursor: not-allowed; }
.campaign-preview-plaintext { margin-top: var(--space-2); padding: var(--space-5) var(--space-5); border-radius: var(--radius-sm); background: var(--surface-3); white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: var(--text-lg); line-height: 1.6; color: var(--ink-800); }
.campaign-email-panel .composer-format-toolbar { border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.campaign-email-panel .composer-format-toolbar button { white-space: nowrap; }
.campaign-options { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-5); align-items: center; margin-top: var(--space-4); }
.campaign-options label { display: flex; align-items: center; gap: var(--space-2); }
.campaign-options input[type=number] { width: 5rem; }
.campaign-link-tags { display: grid; grid-template-columns: minmax(14rem,1.4fr) repeat(3,minmax(9rem,1fr)); gap: var(--space-3); align-items: end; margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.campaign-link-tags > div { display: flex; flex-direction: column; gap: var(--space-1); }
.campaign-link-tags label { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 700; }
.campaign-link-tags input { min-height: 2.45rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-900); }
.campaign-send-state { padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--module-campaign-soft); color: var(--module-campaign); font-weight: 700; }
.campaign-test-address { max-width: 18rem; }
.campaign-audience-review { margin-top: var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.campaign-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(7rem,1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.campaign-stat-grid span { padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-1); color: var(--ink-600); }
.campaign-stat-grid strong { display: block; font-size: var(--text-2xl); color: var(--ink-900); }
.campaign-schedule-row { display: grid; grid-template-columns: minmax(12rem,16rem) minmax(10rem,13rem) auto; gap: var(--space-3); align-items: center; margin-top: var(--space-4); }
.campaign-schedule-row .button { min-height: 3.5rem; justify-self: start; }
.campaign-schedule-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); margin-top: var(--space-5); padding: var(--space-4) var(--space-4); border: 1px solid color-mix(in srgb,var(--module-campaign) 28%,var(--line)); border-left: 4px solid var(--module-campaign); border-radius: var(--radius-md); background: var(--module-campaign-soft); }
.campaign-schedule-card > div:first-child { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.campaign-schedule-card strong { color: var(--ink-900); font-size: var(--text-xl); }
.campaign-version-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; min-width: min(100%, 34rem); }
.campaign-version-actions select { min-width: min(100%, 28rem); max-width: 100%; }
.campaign-test-status { display: inline-flex; align-items: center; border-radius: var(--radius-pill); padding: var(--space-1) var(--space-2); font-size: var(--text-xs); font-weight: 800; white-space: nowrap; }
.campaign-test-status.sent { color: var(--success); background: var(--success-bg); }
.campaign-test-status.failed { color: var(--danger-fg); background: var(--danger-bg); }
.campaign-checklist-card { margin-top: var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-checklist-card h3 { margin: 0; }
.campaign-checklist-progress { border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); color: var(--brand-700); background: var(--brand-100); font-size: var(--text-sm); font-weight: 800; }
.campaign-checklist-add { display: grid; grid-template-columns: minmax(16rem,1fr) minmax(12rem,.5fr) auto auto; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.campaign-checklist-items { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.campaign-checklist-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.campaign-checklist-item > div { display: flex; flex-direction: column; gap: var(--space-0); }
.campaign-checklist-item.complete strong { color: var(--ink-400); text-decoration: line-through; }
.campaign-schedule-kicker { color: var(--module-campaign); font-size: var(--text-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.campaign-schedule-history { margin-top: var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-schedule-history h3 { margin: 0; }
.campaign-schedule-history .table-scroll { max-height: 22rem; margin-top: var(--space-3); overflow: auto; }
.campaign-schedule-history table { min-width: 48rem; }
.campaign-history-event { font-weight: 700; color: var(--module-campaign); }
.campaign-worker-error { color: var(--danger); overflow-wrap: anywhere; }
.campaign-preview-recipient { margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-preview-recipient > label { display: block; margin-bottom: var(--space-2); font-weight: 700; }
.campaign-preview-recipient > select { width: min(100%, 680px); }
.campaign-preview-modes { display: flex; gap: var(--space-1); margin-top: var(--space-3); }
.campaign-preview-modes button { padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--ink-700); cursor: pointer; }
.campaign-preview-modes button.active { border-color: var(--module-campaign); background: var(--module-campaign-soft); color: var(--module-campaign); font-weight: 700; }
.campaign-preview-envelope { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.campaign-preview-envelope span { color: var(--ink-400); font-size: var(--text-sm); }
.campaign-preview-stage { display: flex; justify-content: center; padding: var(--space-4); margin-top: var(--space-2); overflow: auto; border-radius: var(--radius-sm); background: var(--surface-3); }
.campaign-message-preview { display: block; width: 100%; min-height: 520px; border: 0; background: var(--print-paper); box-shadow: var(--shadow-md); transition: max-width .2s ease; }
.campaign-message-preview-desktop { max-width: 100%; }
.campaign-message-preview-mobile { max-width: 390px; }
.campaign-preflight { margin-top: var(--space-4); }
.campaign-preflight h3 { margin: 0 0 var(--space-2); }
.campaign-preflight-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: var(--space-2); }
.campaign-preflight-grid > span { display: grid; grid-template-columns: 1.1rem 1fr; gap: 0 var(--space-1); align-items: start; padding: var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-1); }
.campaign-preflight-grid > span small { grid-column: 2; color: var(--ink-400); }
.campaign-check-ready > strong { color: var(--success); }
.campaign-check-warning > strong { color: var(--warning); }
.campaign-link-url { max-width: 48rem; overflow-wrap: anywhere; }
.campaign-delivery-progress { height: .6rem; margin: var(--space-4) 0 var(--space-4); overflow: hidden; border-radius: var(--radius-pill); background: color-mix(in srgb,var(--line) 70%,transparent); }
.campaign-delivery-progress span { display: block; height: 100%; border-radius: inherit; background: var(--module-campaign); transition: width .3s ease; }
.campaign-deliverability-health { display: grid; grid-template-columns: minmax(12rem,1fr) minmax(24rem,2fr) auto; align-items: center; gap: var(--space-4); margin-top: var(--space-4); padding: var(--space-4); border: 1px solid color-mix(in srgb,var(--success) 35%,var(--line)); border-radius: var(--radius-md); background: color-mix(in srgb,var(--success-bg) 70%,var(--surface-1)); }
.campaign-deliverability-health.warning { border-color: color-mix(in srgb,var(--warning) 45%,var(--line)); background: color-mix(in srgb,var(--warning-bg) 75%,var(--surface-1)); }
.campaign-deliverability-health > div:first-child span { display: block; margin-top: var(--space-1); }
.campaign-deliverability-checks { display: grid; grid-template-columns: repeat(3,minmax(9rem,1fr)); gap: var(--space-2); }
.campaign-deliverability-checks span { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: color-mix(in srgb,var(--success) 9%,var(--surface-1)); }
.campaign-deliverability-checks span.warning { background: color-mix(in srgb,var(--warning) 12%,var(--surface-1)); color: var(--warn-text); }
.campaign-deliverability-checks strong,.campaign-deliverability-checks small { display: block; }
.campaign-deliverability-checks small { margin-top: var(--space-0); color: var(--ink-600); }
.campaign-performance-period { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); font-weight: 700; }
.campaign-performance-period select { min-width: 11rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-performance-totals { display: grid; grid-template-columns: repeat(6,minmax(8rem,1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.campaign-performance-totals span { padding: var(--space-4) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-400); }
.campaign-performance-totals strong { display: block; color: var(--ink-900); font-size: var(--text-3xl); }
.campaign-performance-table td:not(:first-child),.campaign-performance-table th:not(:first-child) { white-space: nowrap; }
.campaign-calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--line); gap: 1px; }
.campaign-calendar-heading { padding: var(--space-2); background: var(--surface-2); color: var(--ink-400); text-align: center; font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; }
.campaign-calendar-day { min-height: 9rem; padding: var(--space-2); background: var(--surface-1); }
.campaign-calendar-day.outside { background: var(--surface-2); opacity: .55; }
.campaign-calendar-day.today { box-shadow: inset 0 0 0 2px var(--module-campaign); }
.campaign-calendar-date { display: block; margin-bottom: var(--space-1); color: var(--ink-700); font-weight: 800; }
.campaign-calendar-event { display: grid; grid-template-columns: auto 1fr; width: 100%; margin-bottom: var(--space-1); padding: var(--space-2) var(--space-2); border: 0; border-left: 3px solid var(--module-campaign); border-radius: var(--radius-sm); background: var(--module-campaign-soft); color: var(--ink-900); text-align: left; cursor: pointer; }
.campaign-calendar-event time { margin-right: var(--space-2); font-weight: 800; }
.campaign-calendar-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-calendar-event small { grid-column: 2; color: var(--ink-400); }
.campaign-calendar-event.failed,.campaign-calendar-event.cancelled { border-left-color: var(--danger); }
.campaign-recipient-detail { max-width: 24rem; overflow-wrap: anywhere; }
.campaign-recipient-panel { margin-top: var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.campaign-recipient-panel h3 { margin: 0; }
.campaign-recipient-filters { display: grid; grid-template-columns: minmax(12rem,1fr) 11rem auto; gap: var(--space-3); margin: var(--space-3) 0; }
.campaign-recipient-filters input, .campaign-recipient-filters select { min-height: 2.45rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); background: var(--surface-1); color: var(--ink-900); }
.campaign-recipient-panel .table-scroll { max-height: 28rem; overflow: auto; }
.campaign-recipient-panel table { min-width: 58rem; }
.consent-import-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.consent-import-panel h2 { margin: 0; font-size: var(--text-xl); }
.consent-file-button { position: relative; overflow: hidden; cursor: pointer; }
.consent-file-button input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.campaign-sender-admin { display: grid; grid-template-columns: minmax(0,2fr) minmax(19rem,1fr); gap: var(--space-4); }
.campaign-sender-admin h2 { margin: 0 0 var(--space-3); font-size: var(--text-xl); }
.campaign-sender-form { display: flex; flex-direction: column; gap: var(--space-3); align-self: start; }
.campaign-sender-form > label:not(.campaign-toggle) { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 700; }
.campaign-sender-form input:not([type=checkbox]) { min-height: 2.45rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); }
.campaign-approval-queue { display: grid; gap: var(--space-4); }
.campaign-approval-card { display: grid; grid-template-columns: minmax(0,1fr) minmax(18rem,.7fr) auto; align-items: end; gap: var(--space-4); margin-top: 0; }
.campaign-approval-summary { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: var(--space-4); }
.campaign-approval-summary h2 { margin: var(--space-0) 0; }
.campaign-approval-summary .muted { display: flex; flex-direction: column; gap: var(--space-1); }
.campaign-approval-note { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 700; }
.campaign-approval-note textarea { padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); resize: vertical; }
.campaign-approval-self-note { margin: calc(-1 * var(--space-1)) 0 var(--space-2); }
.campaign-approval-history { display: grid; gap: var(--space-2); border-top: 1px solid var(--line-strong); padding-top: var(--space-3); }
.campaign-approval-history span { display: flex; gap: var(--space-1); align-items: baseline; flex-wrap: wrap; }
.campaign-approval-history small { display: block; width: 100%; color: var(--ink-400); }
.campaign-authoring-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.campaign-authoring-fields:disabled .campaign-editor { background: var(--surface-3); color: var(--ink-500); cursor: not-allowed; }
.campaign-content-lock { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--warning-line); border-radius: var(--radius-md); background: var(--warning-bg); }
.campaign-content-lock > div { display: flex; flex-direction: column; gap: var(--space-1); }
.campaign-default-badge { margin-left: var(--space-2); padding: var(--space-0) var(--space-2); border-radius: var(--radius-pill); background: var(--module-campaign-soft); color: var(--module-campaign); font-size: var(--text-2xs); text-transform: uppercase; }
@media (max-width: 800px) {
    .campaign-audience-tools { grid-template-columns: 1fr; }
    .campaign-audience-row { flex-wrap: wrap; }
    .campaign-email-fields, .campaign-sender-fields { grid-template-columns: 1fr; }
    .campaign-stat-grid { grid-template-columns: repeat(2,1fr); }
    .campaign-sender-heading { align-items: flex-start; flex-direction: column; }
    .campaign-schedule-row { grid-template-columns: 1fr; }
    .campaign-schedule-row .button { width: 100%; }
    .campaign-schedule-card { align-items: flex-start; flex-direction: column; }
    .campaign-recipient-filters { grid-template-columns: 1fr; }
    .campaign-link-tags { grid-template-columns: 1fr; }
    .campaign-performance-totals { grid-template-columns: repeat(2,1fr); }
    .campaign-calendar { min-width: 58rem; }
    .campaign-sender-admin { grid-template-columns: 1fr; }
    .campaign-deliverability-health,.campaign-deliverability-checks { grid-template-columns: 1fr; }
    .campaign-approval-card,.campaign-approval-summary { grid-template-columns: 1fr; }
    .campaign-checklist-add { grid-template-columns: 1fr; }
}
.record-avatar-company { color: var(--module-company); background: var(--module-company-soft); }
.record-avatar-person { color: var(--module-person); background: var(--module-person-soft); }
.record-avatar-large { width: 3.5rem; height: 3.5rem; flex-basis: 3.5rem; border-radius: var(--radius-lg); font-size: var(--text-lg); }
.record-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.record-avatar-company img { object-fit: contain; padding: var(--space-1); background: var(--print-paper); }
.record-avatar-person.record-avatar-large { border-radius: 50%; }
.avatar-menu { position: relative; z-index: 4; flex: 0 0 auto; }
.avatar-menu-details { position: relative; }
.avatar-menu-trigger { display: block; cursor: pointer; list-style: none; border-radius: var(--radius-lg); outline-offset: 3px; }
.avatar-menu-trigger::-webkit-details-marker { display: none; }
.avatar-menu-trigger .record-avatar { box-shadow: 0 0 0 3px var(--surface-1), 0 1px 5px rgba(18, 40, 78, .18); transition: transform .15s ease, box-shadow .15s ease; }
.avatar-menu-trigger:hover .record-avatar, .avatar-menu-details[open] .record-avatar { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--surface-1), 0 4px 12px rgba(18, 40, 78, .22); }
.avatar-menu-popover { position: absolute; top: calc(100% + .5rem); left: 0; width: 9.75rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: 0 9px 20px rgba(20, 36, 66, .2); }
.avatar-menu-popover > a, .avatar-menu-action { display: flex; align-items: center; width: 100%; min-height: 2.5rem; padding: var(--space-2) var(--space-3); border: 0; border-bottom: 1px solid var(--line-soft); background: var(--surface-1); color: var(--ink-700); font: inherit; font-size: var(--text-sm); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.avatar-menu-popover > a:hover, .avatar-menu-action:hover { background: var(--brand-50); color: var(--ink-900); }
.avatar-menu-remove { color: var(--danger); }
.avatar-menu-remove:hover { background: var(--danger-bg); color: var(--danger-fg); }
.avatar-upload-error { display: block; padding: var(--space-2) var(--space-3); color: var(--danger); background: var(--danger-bg); font-size: var(--text-2xs); line-height: 1.3; }
.crm-empty-state { min-height: 15rem; display: grid; place-content: center; justify-items: center; gap: var(--space-2); text-align: center; }
/* Was .mud-icon-root; MudIcon is now a plain material-icons span, so this
   selector would silently have stopped matching and the empty-state icon
   would have lost its tinted circle. */
.crm-empty-state .material-icons { color: var(--section-accent); font-size: var(--text-4xl); padding: var(--space-3); border-radius: 50%; background: var(--section-accent-soft); }

/* Was MudPaper: Outlined gave a border, Elevation a shadow. */
.panel { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-md); }
.panel.elevated { border-color: transparent; box-shadow: var(--shadow-sm), var(--highlight-top); }
.hotlist-row-overdue { border-left: 3px solid var(--danger); }
.hotlist-row:hover { background: var(--surface-2); }
.search-result-link {
    display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap;
    width: 100%; text-decoration: none; color: inherit;
}

.topbar .muted { margin-left: var(--space-2); font-size: var(--text-md); }

.facts {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: var(--space-2) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5);
    margin: var(--space-5) 0;
}

.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; }

@media (max-width: 520px) {
    .facts { grid-template-columns: 1fr; gap: 0 0; }
    .facts dd { margin-bottom: var(--space-3); }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background:var(--danger-bg);
    border-top: 1px solid var(--error-border);
    padding: var(--space-3) var(--space-4);
    z-index: 1000;
}

/* --- navigation --------------------------------------------------- */
.brand { display: flex; align-items: baseline; gap: var(--space-5); }
.brand nav { display: flex; gap: var(--space-4); }
.brand nav a { color: var(--accent); text-decoration: none; font-size: var(--text-lg); }
.brand nav a:hover { text-decoration: underline; }
.topbar .user { display: flex; align-items: center; gap: var(--space-4); }

/* --- home cards --------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5);
    text-decoration: none;
    color: inherit;
}
.card:hover { border-color: var(--accent); }
.card h2 { margin: 0 0 var(--space-1); font-size: var(--text-2xl); color: var(--accent); }
.card p { margin: 0; }

/* --- list views --------------------------------------------------- */
.list-header { display: flex; align-items: baseline; gap: var(--space-3); }
.list-header h1 { margin-bottom: var(--space-2); }

.searchbar { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); }
.searchbar input[type=search] {
    flex: 1;
    max-width: 460px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-lg);
    font-family: inherit;
}

/* --- saved views (Favourite Lists) --------------------------------- */
[hidden] { display: none !important; }
.saved-views { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-4); }
.saved-views select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
    background: var(--surface);
}
.saved-views input[type=text] {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
    max-width: 220px;
}
.saved-views .button.small { margin-top: 0; }
.list-view-toolbar { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.list-view-toolbar .saved-views { margin-bottom: 0; }

/* Wide tables scroll inside their own container so the page never
   scrolls sideways on a narrow screen. */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.table-scroll:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.table-scroll .column-layout-table { min-width: max-content; }
.table-scroll .column-layout-table table { width: max-content; min-width: 100%; table-layout: fixed; }
.table-scroll .column-layout-table th,
.table-scroll .column-layout-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Companies used to scroll inside a viewport-height box, so the page had a
   second scrollbar beside the list's (Graeme, 2026-10-01: "make it like
   People"). The page scrolls now; sideways is the list's own scrollbar or
   a click-and-drag (js/dragScroll.js). */
.company-list-scroll { overflow-x: auto; }

/* Column setup is a compact layout editor, not a stack of forms. */
.column-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.column-picker-pane { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.column-picker-pane > header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.column-picker-pane h3 { margin: 0; font-size: var(--text-xl); }
.column-picker-search { width: calc(100% - 2 * var(--space-3)); margin: var(--space-3); }
.column-picker-hint { margin: var(--space-3); }
.column-picker-list { min-height: 13rem; max-height: min(48vh, 28rem); overflow-y: auto; }
.column-picker-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink-700); font: inherit; text-align: left; cursor: pointer; }
.column-picker-item:hover { background: var(--brand-50); }
.column-picker-item .material-icons { color: var(--brand-600); font-size: var(--text-xl); }
.column-picker-item:focus-visible, .column-picker-selected button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.column-picker-selected { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) repeat(3, 2rem); gap: var(--space-1); align-items: center; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); }
.column-picker-position { color: var(--ink-400); font-size: var(--text-xs); font-weight: 700; }
.column-picker-width { display: flex; align-items: center; gap: var(--space-2); grid-column: 2 / -1; color: var(--ink-500); font-size: var(--text-xs); }
.column-picker-width input { width: 5.5rem; padding: var(--space-1) var(--space-2); }
@media (max-width: 700px) { .column-picker-grid { grid-template-columns: 1fr; } .column-picker-list { max-height: 15rem; } }
.modal.column-setup-modal { width: min(54rem, calc(100vw - 2rem)); max-width: 54rem; }
.column-setup-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:var(--space-4); margin-bottom:var(--space-4); }
.column-setup-heading h2 { margin:0; }
.column-setup-heading p { margin:var(--space-1) 0 0; }
.column-count { flex:0 0 auto; padding:var(--space-1) var(--space-2); border-radius:var(--radius-pill); background:var(--surface-2); color:var(--muted); font-size:var(--text-sm); }
.column-setup-labels, .column-setup-row { display:grid; grid-template-columns:minmax(0, 1fr) 8rem 5rem 2rem; gap:var(--space-3); align-items:center; }
.column-setup-labels { padding:0 var(--space-3) var(--space-1); color:var(--muted); font-size:var(--text-xs); font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.column-setup-list { max-height:min(46vh, 32rem); overflow:auto; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); }
.column-setup-row { min-height:3.3rem; padding:var(--space-2) var(--space-3); border-bottom:1px solid var(--border); }
.column-setup-row:last-child { border-bottom:0; }
.column-setup-row:hover { background:var(--surface-2); }
.column-setup-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; }
.column-width-input { display:flex; align-items:center; gap:var(--space-1); color:var(--muted); font-size:var(--text-sm); }
.column-width-input input { width:5.1rem; margin:0; padding:var(--space-1) var(--space-2); }
.column-order-actions { display:flex; gap:var(--space-1); }
.icon-action { width:2rem; height:2rem; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); color:var(--ink-800); cursor:pointer; }
.icon-action:hover:not(:disabled) { border-color:var(--brand-600); color:var(--brand-600); background:var(--surface-2); }
.icon-action:disabled { opacity:.38; cursor:default; }
.remove-column { color:var(--danger); }
.column-add-section { margin-top:var(--space-4); }
.column-add-section > label { display:block; margin-bottom:var(--space-2); }
.column-add-list { max-height:8.8rem; overflow:auto; display:flex; flex-wrap:wrap; gap:var(--space-2); padding:var(--space-0); }
.column-add-button { border:1px solid var(--border); background:var(--surface-2); color:var(--brand-600); padding:var(--space-1) var(--space-2); border-radius:var(--radius-sm); font:inherit; font-size:var(--text-sm); cursor:pointer; }
.column-add-button:hover { border-color:var(--brand-600); background:var(--surface); }
.column-setup-actions { margin-top:var(--space-4); }
@media (max-width: 640px) {
  .column-setup-labels { display:none; }
  .column-setup-row { grid-template-columns:minmax(0,1fr) 7rem 4.5rem 2rem; gap:var(--space-2); padding:var(--space-2); }
  .column-setup-heading { align-items:center; }
}

table.grid { border-collapse: collapse; width: 100%; font-size: var(--text-lg); }
table.grid th, table.grid td { padding: var(--space-2) var(--space-3); text-align: left; white-space: nowrap; }
table.grid th {
    background:var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--muted);
    position: sticky;
    top: 0;
}
table.grid tbody tr + tr td { border-top:1px solid var(--line-soft); }
table.grid tbody tr:hover { background:var(--surface-2); }
table.grid .num { text-align: right; }
table.grid tr.inactive-row { color: var(--muted); }
table.grid tr.inactive-row td:first-child { font-style: italic; }
.row-actions { display: flex; gap: var(--space-2); white-space: nowrap; }

.member-checklist {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: var(--space-2) var(--space-3); margin: var(--space-2) 0 var(--space-4);
    max-height: 10rem; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-3);
}

.badge {
    display: inline-block;
    padding: .0625rem var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    background:var(--surface-2);
    color: var(--muted);
}
.badge.contact { background:var(--brand-100); color:var(--brand-600); }
.badge.individual { background:var(--accent-purple-bg); color:var(--accent-purple-strong); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); margin-left: var(--space-2); }
.badge.success { background:var(--success-bg); color:var(--success); }
/* Added when MudChip was removed: the helper methods that fed it returned
   MudBlazor Color values, and these are the ones the app's own badge had
   no equivalent for. Default/Inherit/Tertiary stay on the base .badge. */
.badge.danger { background: var(--error-bg); color: var(--error-text); }
.badge.info { background: var(--brand-50); color: var(--brand-700); }
.badge.primary { background: var(--brand-100); color: var(--brand-600); }
.badge.secondary { background: var(--surface-3); color: var(--ink-600); }
/* A badge that is actually a filter control. Also from the MudChip removal:
   these four were OnClick chips, and a badge alone gives no affordance --
   it needs the pointer, the focus ring and a hit area you can aim at. The
   selected one just takes .primary on top, so the state lives in one place. */
.badge-button {
    padding: var(--space-1) var(--space-2);
    border: 1px solid transparent;
    font: inherit;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.badge-button:hover { border-color: var(--line); background: var(--surface-3); color: var(--ink-700); }
.badge-button.primary:hover { background: var(--brand-100); border-color: var(--brand-400); color: var(--brand-700); }
.badge-button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .badge-button { transition: none; } }
.opted-out { text-decoration: line-through; color: var(--muted); }

.empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 2.5rem var(--space-5);
    text-align: center;
}
.empty p { margin: 0 0 var(--space-2); }

.pager { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }
.pager button {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
}
.pager button:disabled { color: var(--muted); cursor: not-allowed; }

/* --- list header actions ------------------------------------------ */
.list-header { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.list-header .button.small { margin-left: auto; }
.button.small { padding: var(--space-2) var(--space-3); font-size: var(--text-md); margin-top: 0; }

/* Added when MudButton was removed. MudBlazor drew StartIcon itself and
   spaced it; these are that spacing, now the markup is ours. The Material
   Icons font is loaded by App.razor independently of MudBlazor, so the
   glyphs survive its removal. .success covers the one Variant.Text +
   Color.Success button the app had, which had no .button equivalent. */
.button .material-icons { font-size: 1.125em; line-height: 1; vertical-align: -.15em; margin-right: var(--space-1); }
/* Standalone icons (was MudIcon) and the flex gap MudSpacer used to
   provide. .spacer is the whole of what that component did: push
   everything after it to the far end of a flex row. */
.icon { font-size: var(--text-3xl); line-height: 1; vertical-align: -.2em; }
.icon.small { font-size: var(--text-xl); }
.spacer { flex: 1 1 auto; }
.button.icon-only .material-icons { margin-right: 0; }
.button.success { background: var(--surface); color: var(--success); border: 1px solid var(--success-line); }
.button.success:hover:not(:disabled) { background: var(--success-bg); }
/* .button.ghost is declared later in this file and would otherwise win on
   equal specificity, silently turning the one ghost+success button back to
   the default ink -- caught by rendering it, not by the compiler. */
.button.ghost.success { color: var(--success); }
tr.row-link { cursor: pointer; }

/* --- detail pages --------------------------------------------------- */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom:1px solid var(--line);
}
.detail-header:has(~ .detail-grid) .detail-actions { flex-wrap: wrap; }
.back-link { display: inline-block; margin-bottom: var(--space-2); color: var(--accent); text-decoration: none; font-size: var(--text-md); }
.back-link:hover { text-decoration: underline; }
.detail-header h1 { margin: 0 0 var(--space-1); font-size: clamp(var(--text-3xl), 2.2vw, var(--text-4xl)); letter-spacing: -.015em; }
.detail-actions { display: flex; align-items: center; gap: var(--space-3); }
/* "Read-only" beside a disabled Edit: the user may read this record but its
   Full Access does not let them change it (RecordEditButton). */
.record-readonly-note { display:inline-flex; align-items:center; gap:var(--space-1); padding:var(--space-1) var(--space-2); border-radius:var(--radius-sm); background:var(--surface-3); color:var(--ink-600); font-size:var(--text-xs); font-weight:600; }
.record-readonly-note .material-icons { font-size:var(--text-sm); }
.record-tabs { display: flex; gap: var(--space-1); margin: 0 0 var(--space-4); padding: var(--space-1); border:1px solid var(--line); border-radius: var(--radius-pill); background:var(--surface-3); width: fit-content; }
.record-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: var(--space-3) var(--space-0); color: var(--muted); cursor: pointer; font: inherit; font-size: var(--text-md); }
.record-tabs button:hover { color: var(--text); }
.record-tabs button { border-radius: var(--radius-pill); padding: var(--space-2) var(--space-4); margin: 0; }
.record-tabs button.active { border-bottom-color: transparent; background:var(--surface-1); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }
/* A record with more than two views (the opportunity has six) keeps each
   label on one line and scrolls sideways when the window is narrow. */
.record-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.record-tabs button { white-space: nowrap; flex-shrink: 0; }
.alert.inline { padding: var(--space-1) var(--space-3); margin: 0; font-size: var(--text-sm); }

/* Zoho's own record shape (researched off the real frames): a narrow
   "Related List" rail down the left, and ONE main column holding the
   record's fields and every related section at full width.

   This replaced a [form 2fr | panels 1fr] split, which was the real
   "doesn't flow right" problem Graeme reported -- Notes, Documents,
   Related Entries and Timeline were all crammed into a ~260px column,
   stacked five deep, so each got a sliver of the page and the record
   became an endless scroll. Same panels, same data; the layout is what
   was wrong.

   :has() rather than a modifier class so a NEW record -- which renders
   no rail, because there are no related sections until it's saved --
   falls back to a single full-width column automatically, with no
   per-page flag to remember to pass. */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); align-items: start; }
/* Related sections live in a horizontal row, matching Overview and
   Timeline, so record content always gets the full usable width. */
.detail-grid:has(.record-rail) { grid-template-columns:minmax(0, 1fr); }
@media (max-width: 860px) {
    .detail-grid, .detail-grid:has(.record-rail) { grid-template-columns: 1fr; }
}

.detail-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5) var(--space-5) var(--space-5);
    align-content: start;
}
.detail-form h2 {
    font-size: var(--text-lg);
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--muted);
    margin: var(--space-5) calc(-1 * var(--space-5)) var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border);
    border-bottom:1px solid var(--line-soft);
    background:linear-gradient(90deg, var(--field-accent-soft), var(--surface-2) 72%);
    color:var(--ink-800);
    font-size: var(--text-sm);
    letter-spacing: .08em;
    box-shadow:inset 4px 0 0 var(--section-accent);
}
.detail-form h2:first-child { margin-top: calc(-1 * var(--space-1)); padding-top: var(--space-3); border-top: 0; }

.detail-form > label { display: block; margin: var(--space-4) 0 var(--space-1); font-weight: 600; font-size: var(--text-sm); color: var(--muted); }
/* .quote-form is the same treatment for every field type, not only text:
   the Quotes forms carry numbers, dates and searches beside their text
   fields, and half a form styled and half at browser defaults is what
   that looked like before. */
.detail-form input[type=text], .detail-form input:not([type]), .detail-form textarea, .detail-form select,
.quote-form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),
.quote-form textarea, .quote-form select,
.quote-filters input:not([type=checkbox]), .quote-filters select,
.mass-update input:not([type=checkbox]), .mass-update textarea, .mass-update select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    font-family: inherit;
    background:var(--surface-1);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--ink-900) 7%, transparent);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.detail-form input[type=text]:hover, .detail-form input:not([type]):hover, .detail-form textarea:hover, .detail-form select:hover,
.quote-form input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, .quote-form textarea:hover, .quote-form select:hover {
    border-color: var(--field-accent);
    background: var(--field-accent-soft);
}
.detail-form input:focus, .detail-form textarea:focus, .detail-form select:focus,
.quote-form input:focus, .quote-form textarea:focus, .quote-form select:focus,
.mass-update input:focus, .mass-update textarea:focus, .mass-update select:focus {
    outline: none;
    border-color:var(--field-accent);
    background:var(--surface-1);
    box-shadow: 0 0 0 3px var(--field-accent-hover), 0 2px 5px color-mix(in srgb, var(--field-accent) 20%, transparent);
}
.detail-form textarea { resize: vertical; }

/* Existing edit pages use label/input pairs. On wide screens, lay those
   pairs out like Zoho: two balanced field groups per row. Explicit field
   rows and editors remain full-width components. */
@media (min-width: 980px) {
    .detail-form {
        display: grid;
        grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr) minmax(7rem, 10rem) minmax(0, 1fr);
        column-gap: var(--space-5);
        align-items: center;
    }
    .detail-form > h2,
    .detail-form > .field-row,
    /* A form is a block of its own label/input pairs, so it must span
       the card rather than being packed into one of the four columns.
       Without this it became a ~100px-wide grid item: the Account page's
       password fields and every button in them had been squeezed to a
       stub for as long as this grid has existed, which is how a
       six-digit code box ended up 41px wide. */
    .detail-form > form,
    .detail-form > textarea,
    .detail-form > .contact-method-editor,
    .detail-form > .address-editor,
    .detail-form > .udf-fields-editor { grid-column: 1 / -1; }
    /* Right-aligned against its input only in the four-column field grid:
       a stacked card is one column, and a checkbox row carries its own box
       on the left -- right-aligning those pushed a group tick to the far
       edge of a wide card (Access Rights > Security Groups). */
    .detail-form > label { margin: var(--space-2) 0; }
    .detail-form:not(.stacked) > label:not(.checkbox-row):not(.check) { text-align: right; }
    .detail-form > label + input,
    .detail-form > label + select { margin: var(--space-1) 0; }
    .detail-form > label + input + label { margin-left: 0; }
}
/* A card that holds a single column of prose, forms and lists
   rather than label/input pairs. Without this it inherits the
   four-column field grid above, which packs a paragraph into one
   ~100px column and a list of recovery codes into the next -- the
   grid is right for an edit form and wrong for everything else. */
.detail-form.stacked { display: block; }

@media (max-width: 700px) {
    .detail-form { padding: var(--space-5); }
    .detail-form h2 { margin-left: calc(-1 * var(--space-5)); margin-right: calc(-1 * var(--space-5)); padding-left: var(--space-5); padding-right: var(--space-5); }
}
/* RecordFieldGrid uses the same outer card class for the read-only view,
   but its definition list owns its own two-column layout. Never apply the
   edit form's four-column label/input grid to that view. */
.detail-form.record-view { display: block; }
.detail-form.record-view dl { margin: 0; }

/* Record edit forms use balanced field groups rather than the legacy
   label/control grid.  The latter is useful for compact admin forms but
   squeezes long CRM controls (company pickers, names and addresses) into
   narrow columns.  Keep every grid track shrink-safe and let editors span
   the card when they contain multiple controls. */
.detail-form.record-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-5);
    row-gap: var(--space-0);
    min-width: 0;
}
.record-edit-form > h2,
.record-edit-form > .field-row,
.record-edit-form > .form-field-full,
.record-edit-form > .contact-method-editor,
.record-edit-form > .address-editor,
.record-edit-form > .udf-fields-editor { grid-column: 1 / -1; }
.record-edit-form > h2 { min-width: 0; }
.record-edit-form .field-row,
.record-edit-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    gap: var(--space-4) var(--space-5);
    margin: var(--space-1) 0 var(--space-4);
}
.record-edit-form .field-row.three,
.record-edit-form .form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.record-edit-form .field-row > div,
.record-edit-form .form-field {
    min-width: 0;
    display: grid;
    gap: var(--space-1);
    align-content: start;
}
.record-edit-form .form-field-full { grid-column: 1 / -1; }
.record-edit-form .field-row label,
.record-edit-form .form-field > label {
    margin: 0;
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--field-label);
    letter-spacing: .01em;
}
.record-edit-form input:not([type="checkbox"]):not([type="radio"]),
.record-edit-form select,
.record-edit-form textarea,
.record-edit-form .company-picker,
.record-edit-form .locked-record-reference {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.record-edit-form .muted.small { margin: var(--space-0) 0 0; line-height: 1.45; }
.record-edit-form .contact-method-editor,
.record-edit-form .address-editor,
.record-edit-form .udf-fields-editor { margin-top: var(--space-1); min-width: 0; }
.record-edit-form .udf-fields-editor {
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:var(--space-2) var(--space-4);
    padding:var(--space-3) var(--space-4) var(--space-4);
    border:1px solid color-mix(in srgb, var(--field-accent) 30%, var(--line));
    border-radius:var(--radius-lg);
    background:linear-gradient(135deg, var(--field-accent-soft), var(--surface-1) 48%);
}
.record-edit-form .udf-fields-editor > h2,
.record-edit-form .udf-fields-editor > .muted,
.record-edit-form .udf-fields-editor > p { grid-column:1 / -1; }
.record-edit-form .udf-fields-editor > h2 {
    margin:calc(-1 * var(--space-3)) calc(-1 * var(--space-4)) var(--space-1);
    padding:var(--space-3) var(--space-4);
    box-shadow:inset 4px 0 0 var(--field-accent);
}
.record-edit-form .udf-fields-editor > label {
    margin:var(--space-1) 0 0;
    color:var(--field-label);
    font-size:var(--text-sm);
    font-weight:600;
}
.record-edit-form .udf-fields-editor > label.checkbox-row { grid-column:span 1; }
.record-edit-form .udf-fields-editor > label + input,
.record-edit-form .udf-fields-editor > label + select,
.record-edit-form .udf-fields-editor > label + textarea { margin-top:calc(-1 * var(--space-1)); }
.record-edit-form h2 + .contact-method-editor,
.record-edit-form h2 + .address-editor,
.record-edit-form h2 + .udf-fields-editor { margin-bottom: var(--space-2); }
@media (max-width: 900px) {
    .detail-form.record-edit-form { grid-template-columns: 1fr; }
    .record-edit-form .field-row,
    .record-edit-form .field-row.three,
    .record-edit-form .form-grid,
    .record-edit-form .form-grid.three { grid-template-columns: 1fr; }
    .record-edit-form .form-field-full { grid-column: auto; }
    .record-edit-form .udf-fields-editor { grid-template-columns:1fr; }
}

/* The list table in the left column is wrapped in .table-scroll only so a
   wide table can't bleed sideways into the side panel. The .detail-form card
   already frames it, so drop the wrapper's own border/background here. */
.detail-form .table-scroll { border: 0; border-radius: 0; background: none; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 560px) { .field-row, .field-row.three { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: var(--space-2); font-weight: 400; color: var(--text); }
.checkbox-row input { width: auto; }

/* The main column: the record's own fields, then every related section
   under them, each at full width with real room to work in. */
.detail-main { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }

/* Record-header facts, modelled on Zoho's compact Overview summary.
   They deliberately complement rather than duplicate the complete grid below. */
.record-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.record-summary-field { min-width: 0; padding: var(--space-3) var(--space-4); background: var(--surface); }
.record-summary-field span { display: block; margin-bottom: var(--space-1); color: var(--muted); font-size: var(--text-2xs); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.record-summary-field strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-md); font-weight: 600; }

/* The older [form | narrow aside] shape, still used by the Activity and
   Admin pages. Those asides hold a short helper panel (a picker, a
   preview), not a stack of five related-record sections, so the split
   that was wrong for a CRM record is right for them -- left as-is
   rather than churned for consistency's sake. */
.detail-grid:has(.detail-side) { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
@media (max-width: 860px) {
    .detail-grid:has(.detail-side) { grid-template-columns: minmax(0, 1fr); }
}
/* Blazor focuses the new page heading to announce navigation. */
h1[tabindex="-1"]:focus { outline: none; }
.detail-side { display: flex; flex-direction: column; gap: var(--space-5); }

/* --- related-record tabs (SectionJumpNav.razor) -----------------------
   The old sticky left rail squeezed the record content and hid useful
   space. These sit across the top, styled as the same quiet pills as the
   Overview / Timeline control. */
.record-rail {
    display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-1);
    padding:var(--space-2);
    background:var(--surface-3);
    border:1px solid var(--line);
    border-radius:var(--radius-lg);
    min-width:0;
}
.record-rail h3 {
    font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color:var(--field-label); margin:0 var(--space-1) 0 var(--space-0);
}
.record-rail button,
.record-rail a {
    display:inline-flex; align-items:center; width:auto; box-sizing:border-box; text-align:left !important;
    padding:var(--space-2) var(--space-3); border-radius:var(--radius-pill);
    font-size: var(--text-sm); font-family: inherit; color: var(--text);
    background:none; border:1px solid transparent; cursor:pointer; white-space:nowrap;
}
.record-rail a { text-decoration: none; }
.record-rail a:hover, .record-rail button:hover { background:var(--surface-1); border-color:var(--field-accent); color:var(--accent); box-shadow:var(--shadow-sm); }
.detail-grid:has(.record-rail) .detail-main { min-width:0; }
@media (max-width: 620px) {
    .record-rail { flex-wrap:nowrap; overflow-x:auto; }
    .record-rail h3 { position:sticky; left:0; background:var(--surface-3); padding-right:var(--space-1); }
}

/* Custom-field table item manager */
.user-profile-editor { display: grid; gap: var(--space-4); max-width: 56rem; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.user-profile-heading { display: flex; align-items: center; gap: var(--space-3); }
.user-profile-heading > div { display: grid; gap: var(--space-1); }
.user-profile-heading small { color: var(--ink-500); }
.user-profile-email-change { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.user-profile-email-change label { flex: 1 1 18rem; display: grid; gap: var(--space-1); font-weight: 600; }
.user-profile-email-change p, .user-profile-email-change .alert { flex-basis: 100%; margin: 0; }
.user-profile-avatar { display: grid; width: 3.5rem; height: 3.5rem; place-items: center; border-radius: var(--radius-pill); background: var(--module-person-soft); color: var(--module-person); font-weight: 700; }
.user-profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.user-profile-fields label { display: grid; gap: var(--space-1); color: var(--ink-700); font-weight: 600; }
.user-profile-wide { grid-column: 1 / -1; }
.user-profile-editor h3 { margin: var(--space-3) 0 0; }
.user-profile-contact-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--space-2); }
@media (max-width: 620px) { .user-profile-fields, .user-profile-contact-row { grid-template-columns: 1fr; } }
.system-info-panel { margin: var(--space-4) 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.system-info-panel summary { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--surface-2); color: var(--ink-800); font-weight: 700; cursor: pointer; list-style: none; }
.system-info-panel summary::-webkit-details-marker { display: none; }
.system-info-panel summary:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.system-info-panel summary .material-icons:first-child { color: var(--brand-600); }
.system-info-chevron { margin-left: auto; transition: transform .15s ease; }
.system-info-panel[open] .system-info-chevron { transform: rotate(180deg); }
.system-info-panel dl { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; padding: var(--space-4); }
.system-info-panel dt { color: var(--ink-500); font-weight: 600; }
.system-info-panel dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.system-info-id { font-family: ui-monospace, monospace; }
@media (max-width: 620px) { .system-info-panel dl { grid-template-columns: 1fr; } .system-info-panel dd { margin-bottom: var(--space-2); } }
.action-plan-scheduler { width: min(48rem, calc(100vw - 2rem)); max-width: 48rem; }
.action-plan-scheduler-heading { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.action-plan-scheduler-heading h2 { margin: 0; }
.action-plan-scheduler-heading p { margin: var(--space-1) 0 0; }
.action-plan-scheduler-fields { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr); align-items: center; gap: var(--space-3); margin: var(--space-4) 0; }
.action-plan-scheduler-fields label { color: var(--ink-600); font-weight: 600; }
.action-plan-scheduler-weekdays { margin: var(--space-3) 0; }
.action-plan-scheduler-description { padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.action-plan-scheduler-description + .action-plan-scheduler-description { margin-top: var(--space-2); }
.action-plan-scheduler-description p { margin: var(--space-1) 0 0; white-space: pre-wrap; }
.action-plan-scheduler-activities { margin-top: var(--space-4); }
.action-plan-scheduler-activities h3 { margin: 0 0 var(--space-2); }
.action-plan-scheduler-activities .material-icons { vertical-align: middle; font-size: var(--text-xl); }
.action-plan-scheduler-empty { padding: var(--space-4) 0; }
.interaction-call-dialog { width: min(48rem, calc(100vw - 2rem)); max-width: 48rem; }
.interaction-call-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.interaction-call-fields label { display: grid; gap: var(--space-1); }
.interaction-call-details { grid-column: 1 / -1; }
.interaction-call-wide { grid-column: 1 / -1; }

/* Log interaction (2026-10-02): the menu, as Maximizer's "+" on Interactions. */
.log-interaction { position: relative; }
.log-interaction > .button .material-icons { font-size: var(--text-xl); }
.log-interaction-menu {
    position: absolute; right: 0; top: calc(100% + var(--space-1)); z-index: 20;
    width: 15rem; max-height: min(28rem, calc(100vh - 8rem)); overflow-y: auto;
    padding: var(--space-1); background: var(--surface-1); border: 1px solid var(--line-strong);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.log-interaction-menu button {
    width: 100%; display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink-800); font: inherit; text-align: left; cursor: pointer;
}
.log-interaction-menu button:hover, .log-interaction-menu button:focus-visible { background: var(--brand-50); }
.log-interaction-menu .material-icons { font-size: var(--text-2xl); color: var(--ink-500); }
.log-interaction-divider { display: block; height: 1px; margin: var(--space-1) var(--space-2); background: var(--line); }

/* The Add Interaction window: what, which way, source, when, subject,
   category and result on the left; the timer and details on the right. */
.interaction-add-window { width: min(64rem, calc(100vw - 2rem)); max-width: 64rem; }
.interaction-add-head { display: flex; align-items: center; justify-content: center; position: relative; padding-bottom: var(--space-3); border-bottom: 1px solid var(--line-soft); }
.interaction-add-head h2 { margin: 0; font-size: var(--text-2xl); font-weight: 600; }
.interaction-add-head .icon-button { position: absolute; right: 0; }
.interaction-add-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); padding-top: var(--space-4); }
.interaction-add-left { display: grid; gap: var(--space-3); align-content: start; }
.interaction-add-left label { display: grid; gap: var(--space-1); }
.interaction-add-left select, .interaction-add-left input { width: 100%; min-width: 0; }
.interaction-add-kind { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); }
.interaction-add-kind .material-icons { color: var(--ink-500); }
.interaction-add-entry { color: var(--ink-800); }
.interaction-add-next { display: flex; justify-content: center; gap: var(--space-5); padding: var(--space-3) 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.interaction-add-next button { border: 0; background: transparent; color: var(--success); cursor: pointer; padding: var(--space-1); border-radius: var(--radius-sm); }
.interaction-add-next button:hover:not(:disabled) { background: var(--success-bg); }
.interaction-add-next button:disabled { color: var(--ink-300); cursor: not-allowed; }
.interaction-add-next .material-icons { font-size: var(--text-3xl); }
.interaction-add-right { display: grid; grid-template-rows: auto 1fr; gap: var(--space-3); min-height: 0; }
.interaction-add-duration { width: 7rem; font-variant-numeric: tabular-nums; }
.interaction-add-details { display: grid; grid-template-rows: auto 1fr; gap: var(--space-1); }
.interaction-add-details textarea { min-height: 22rem; height: 100%; resize: vertical; }
@media (max-width: 760px) { .interaction-add-body { grid-template-columns: 1fr; } }

/* Appointment / Task from Log interaction: the activity form in a window. */
.interaction-activity-window { width: min(72rem, calc(100vw - 2rem)); max-width: 72rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
/* A long "Work · 041 222 1101 · Susan Botha" option must not widen the
   column (a select sizes to its longest option). */
.interaction-call-fields select, .interaction-call-fields input { min-width: 0; width: 100%; }
/* The call timer: a clock, and the buttons that drive it, in one band. */
.interaction-call-timer {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2);
}
.interaction-call-timer > .material-icons { color: var(--ink-400); }
.interaction-call-clock { font-size: var(--text-2xl); font-variant-numeric: tabular-nums; color: var(--ink-700); min-width: 4.5rem; }
.interaction-call-clock.running { color: var(--success); }
.interaction-call-duration { display: flex !important; align-items: center; gap: var(--space-2); }
.interaction-call-duration input { width: 6rem; }
.interaction-call-timer-actions { display: flex; gap: var(--space-2); margin-left: auto; flex-wrap: wrap; }
.interaction-call-timer-actions .material-icons { font-size: var(--text-lg); vertical-align: middle; }
@media (max-width: 620px) { .action-plan-scheduler-fields, .interaction-call-fields { grid-template-columns: 1fr; } }
.table-items-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.table-items-dialog { width: min(46rem, calc(100vw - 2rem)); max-width: 46rem; }
.table-items-heading { display: flex; justify-content: space-between; align-items: start; gap: var(--space-4); border-bottom: 1px solid var(--line); padding-bottom: var(--space-3); }
.table-items-heading h2 { margin: 0; }
.table-items-heading p { margin: var(--space-1) 0 0; }
.table-items-add { display: flex; gap: var(--space-2); margin: var(--space-4) 0; }
.table-items-add input { flex: 1; min-width: 0; }
.table-items-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.table-items-list { display: grid; align-content: start; max-height: 22rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.table-items-empty { padding: var(--space-4); }
.table-items-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink-700); text-align: left; cursor: pointer; }
.table-items-row:last-child { border-bottom: 0; }
.table-items-row:hover { background: var(--surface-2); }
.table-items-row.selected { background: var(--accent-purple-bg); color: var(--accent-purple-strong); }
.table-items-row:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.table-items-order { color: var(--ink-400); font-size: var(--text-xs); font-weight: 700; }
@media (max-width: 620px) { .table-items-add { flex-direction: column; } .table-items-toolbar .button { flex: 1; } }

/* --- timeline history -------------------------------------------------
   A compact, date-grouped history rather than a generic notes list. The
   time, marker and event text sit on fixed tracks, so a busy record can
   still be scanned from top to bottom without the visual zig-zag. */
.timeline-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-5); }
.timeline-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.timeline-panel-head h2 { margin: 0; font-size: var(--text-xl); }
.timeline-panel-actions { display: flex; align-items: center; gap: var(--space-2); }
.record-ai-actions { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent-purple-bg) 48%, var(--surface-1)); }
.record-ai-intro { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-800); }
.record-ai-intro > .material-icons { color: var(--accent-purple); font-size: var(--text-2xl); }
.record-ai-intro strong, .record-ai-intro small { display: block; }
.record-ai-intro small { color: var(--ink-500); font-size: var(--text-xs); }
.record-ai-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.record-ai-result { display: grid; justify-items: start; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-1); }
.record-ai-result p { margin: 0; white-space: pre-wrap; }
.timeline-history { max-width: 56rem; }
.timeline-day + .timeline-day { margin-top: var(--space-6); }
.timeline-date { display: inline-block; padding: var(--space-1) var(--space-4); border:1px solid var(--line); border-radius: var(--radius-sm); background:var(--surface-2); color:var(--ink-500); font-weight: 600; font-size: var(--text-sm); }
.timeline-events { position: relative; margin-top: var(--space-5); }
.timeline-events::before { content: ""; position: absolute; left: 9.2rem; top: .5rem; bottom: .5rem; width: 1px; background:var(--line); }
.timeline-event { display: grid; grid-template-columns: 7.3rem 3.8rem minmax(0, 1fr); column-gap: var(--space-3); position: relative; min-height: 5rem; }
.timeline-event time { color:var(--ink-500); font-size: var(--text-md); text-align: right; padding-top: var(--space-3); font-variant-numeric: tabular-nums; }
.timeline-marker { z-index: 1; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border:1px solid var(--line); border-radius: 50%; background:var(--surface-1); color:var(--ink-500); }
.timeline-marker-note { color:var(--brand-600); background:var(--surface-3); }
.timeline-marker-activity { color:var(--warning); background:var(--warning-bg); }
.timeline-marker-document { color:var(--success); background:var(--success-bg); }
.timeline-marker-field_change { color:var(--accent-purple); background:var(--accent-purple-bg); }
/* The marker paints its own colour; the glyph only needs to be the small
   size MudIcon's Size.Small used to give it. */
.timeline-marker .material-icons { font-size: 20px; }
.timeline-copy { padding: var(--space-2) 0 var(--space-5); }
.timeline-title { color: var(--text); font-weight: 600; font-size: var(--text-lg); }
.timeline-detail { margin-top: var(--space-1); color:var(--ink-600); white-space: pre-wrap; }
.timeline-meta { margin-top: var(--space-1); color:var(--ink-500); font-size: var(--text-sm); }
@media (max-width: 640px) {
    .timeline-panel-head { align-items: flex-start; flex-direction: column; }
    .timeline-panel-actions { width: 100%; justify-content: space-between; }
    .timeline-events::before { left: 1.35rem; }
    .timeline-event { grid-template-columns: 2.75rem minmax(0, 1fr); }
    .timeline-event time { grid-column: 2; grid-row: 1; text-align: left; padding: 0; }
    .timeline-marker { grid-column: 1; grid-row: 1 / span 2; }
    .timeline-copy { grid-column: 2; grid-row: 2; padding-top: var(--space-1); }
}

/* A contact created from a company is intentionally not a free-form
   company picker: show the inherited relationship plainly and reserve
   white input fields for values the user is actually allowed to edit. */
.locked-record-reference { display: flex; align-items: center; gap: var(--space-3); min-height: 2.5rem; padding: var(--space-2) var(--space-3); border:1px solid var(--line-strong); border-radius: var(--radius-sm); background:var(--surface-3); color:var(--ink-800); }
.locked-record-reference span { color:var(--ink-500); font-size: var(--text-sm); }

/* --- related-record sections (RelatedRecordsPanel.razor) -------------
   Zoho's Deals / Cases / Activities blocks on a record. The count sits
   in the heading (so you know what's there without reading the table)
   and the "+ New" sits opposite it, the same pairing Zoho uses. */
.related-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.related-head h2 { margin: 0; }
.record-detail-icon {
    --detail-icon-color: var(--brand-700);
    --detail-icon-bg: var(--brand-100);
    display: inline-grid;
    place-items: center;
    width: var(--space-6);
    height: var(--space-6);
    flex: 0 0 auto;
    margin: 0 var(--space-2) 0 0;
    border-radius: var(--radius-sm);
    background: var(--detail-icon-bg);
    color: var(--detail-icon-color);
    vertical-align: middle;
    line-height: 1;
}
.record-detail-icon.compact { width: var(--space-5); height: var(--space-5); margin-right: var(--space-1); }
.record-detail-icon > .material-icons { display: block; margin: 0; font-size: var(--text-2xl); font-weight: normal; letter-spacing: normal; line-height: 1; color: inherit; text-transform: none; }
.record-detail-icon.tone-person { --detail-icon-color: var(--module-person); --detail-icon-bg: var(--module-person-soft); }
.record-detail-icon.tone-company { --detail-icon-color: var(--module-company); --detail-icon-bg: var(--module-company-soft); }
.record-detail-icon.tone-opportunity { --detail-icon-color: var(--module-opportunity); --detail-icon-bg: var(--module-opportunity-soft); }
.record-detail-icon.tone-case { --detail-icon-color: var(--module-case); --detail-icon-bg: var(--module-case-soft); }
.record-detail-icon.tone-activity { --detail-icon-color: var(--module-activity); --detail-icon-bg: var(--module-activity-soft); }
.record-detail-icon.tone-work { --detail-icon-color: var(--module-work); --detail-icon-bg: var(--module-work-soft); }
.record-detail-icon.tone-phone { --detail-icon-color: var(--module-company); --detail-icon-bg: var(--module-company-soft); }
.record-detail-icon.tone-email { --detail-icon-color: var(--module-report); --detail-icon-bg: var(--module-report-soft); }
.record-detail-icon.tone-campaign { --detail-icon-color: var(--module-campaign); --detail-icon-bg: var(--module-campaign-soft); }
.record-detail-icon.tone-quote { --detail-icon-color: var(--module-quote); --detail-icon-bg: var(--module-quote-soft); }
.record-detail-icon.tone-document { --detail-icon-color: var(--accent-purple); --detail-icon-bg: var(--accent-purple-bg); }
.record-rail :is(a,button) { align-items: center; }
.record-view dt { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-1); }
.record-view dt .record-detail-icon { margin-right: 0; }
.record-summary-field > span { display: flex; align-items: center; gap: var(--space-1); }
.record-summary-field .record-detail-icon { display: inline-grid; margin: 0; letter-spacing: normal; text-transform: none; }
.record-summary-field .record-detail-icon > .material-icons { margin: 0; font-size: var(--text-2xl); font-weight: normal; letter-spacing: normal; text-transform: none; }
.related-count {
    display: inline-block; margin-left: var(--space-2); padding: .0625rem var(--space-2);
    background:var(--surface-3); color: var(--muted); border-radius: var(--radius-pill);
    font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums;
}
.related-panel .related-grid { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.related-panel .related-grid th {
    text-align: left; font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .03em;
    color: var(--muted); font-weight: 700; padding: 0 var(--space-2) var(--space-2); border-bottom: 1px solid var(--border);
}
.related-panel .related-grid td { padding: var(--space-2); border-bottom:1px solid var(--line-soft); }
.related-panel .related-grid tr:last-child td { border-bottom: 0; }
.related-panel .related-grid tbody tr:hover { background:var(--surface-2); }
.related-panel .overdue { color: var(--error-text); font-weight: 600; }

/* Status/stage chip inside a related table -- neutral by default, with
   the same green/red this app already uses for won/closed everywhere
   else rather than a chip palette of its own. */
.pill {
    display: inline-block; padding: .0625rem var(--space-2); border-radius: var(--radius-pill);
    background:var(--surface-3); color: var(--muted); font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
}
.pill-won { background:var(--success-bg); color:var(--success); }
.pill-lost { background: var(--error-bg); color: var(--error-text); }

/* --- contact method editor ----------------------------------------- */
.cm-editor { margin-top: var(--space-2); }
.cm-group { margin-bottom: var(--space-4); }
.cm-group h3 { font-size: var(--text-sm); font-weight: 600; color: var(--muted); margin: 0 0 var(--space-2); }
.cm-row { display: grid; grid-template-columns: 7rem 1fr auto auto auto; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.cm-row input { padding: var(--space-2) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-md); }
.cm-primary { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--muted); white-space: nowrap; font-weight: 400; margin: 0; }
.cm-primary input { width: auto; }
.cm-remove {
    background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    width: 1.75rem; height: 1.75rem; cursor: pointer; color: var(--muted); font-size: var(--text-xl); line-height: 1;
}
.cm-remove:hover { border-color: var(--error-border); color: var(--error-text); }
.cm-add { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.cm-add-btn {
    background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); font-size: var(--text-sm); color: var(--accent); cursor: pointer;
}
.cm-add-btn:hover { border-color: var(--accent); background:var(--brand-50); }

.cm-row .cm-ext { max-width: 5.5rem; }

/* --- address editor --------------------------------------------------
   One block per address (Maximizer: "+ Add new address"), each with its
   own type + primary marker -- addr-block reuses .field-row from the
   surrounding form so its inputs line up with every other field. */
.addr-editor { margin-top: var(--space-2); }
.addr-block {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
}
.addr-block-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.addr-type {
    padding: var(--space-1) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: var(--text-sm); font-weight: 600; color: var(--text);
}
.addr-block .field-row { margin-top: 0; }
.addr-block label { margin: var(--space-2) 0 var(--space-1); }
.addr-block .field-row { gap: var(--space-3); }
.addr-block .field-row + .field-row { margin-top: var(--space-0); }

/* Keep the repeatable editors visually subordinate to the primary record
   fields, as in Zoho's compact related-field blocks. */
.detail-form .addr-editor,
.detail-form .cm-editor { font-size: var(--text-md); }
.detail-form .addr-editor input,
.detail-form .addr-editor select,
.detail-form .cm-editor input,
.detail-form .cm-editor select { padding: var(--space-2) var(--space-2); min-height: 2.25rem; }

/* --- company typeahead picker --------------------------------------- */
.company-picker { position: relative; }
.company-picker .chip {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background:var(--brand-100); color:var(--brand-600); border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2); font-size: var(--text-md); margin-top: var(--space-1);
}
.company-picker .chip button {
    background: none; border: 0; color: inherit; cursor: pointer; font-size: var(--text-xl); line-height: 1; padding: 0;
}
.typeahead {
    position: absolute; z-index: 10; top: 100%; left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin: var(--space-1) 0 0; padding: var(--space-1) 0; list-style: none;
    max-height: 220px; overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.typeahead li { padding: var(--space-2) var(--space-3); cursor: pointer; font-size: var(--text-lg); }
.typeahead li:hover { background:var(--surface-2); }
.typeahead li.typeahead-add { color: var(--accent); border-top: 1px solid var(--border); font-weight: 500; }

/* --- notes panel ----------------------------------------------------- */
.notes-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5);
}
.notes-panel h2 { font-size: var(--text-lg); margin: 0 0 var(--space-3); }
.notes-panel textarea {
    width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: var(--text-md); resize: vertical;
}
/* Text inputs match the panel's textarea. Unlike .detail-form the panel
   has no rule giving a bare <input> a border, so without this the admin
   add/edit "Name" box renders with no visible outline. */
.notes-panel input:not([type=checkbox]):not([type=radio]) {
    width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: var(--text-md);
}
.notes-panel .button { margin-top: var(--space-2); }
.macro-picker {
    display: block; width: 100%; margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm);
    font-family: inherit; background: var(--surface); color: var(--muted);
}
.note-list { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.note-list li { border-top:1px solid var(--line-soft); padding-top: var(--space-4); }
.note-list li:first-child { border-top: none; padding-top: 0; }
.note-list li p { margin: 0 0 var(--space-1); font-size: var(--text-lg); white-space: pre-wrap; }
.note-list li.pinned { background:var(--warning-bg); margin: 0 calc(-1 * var(--space-2)); padding: var(--space-4) var(--space-2); border-radius: var(--radius-sm); border-top: none; }

/* Internal notes: Zendesk's own convention is a warm, slightly urgent
   tint that reads as "careful, this is staff-only" -- distinct from
   pinned's neutral cream so the two never look like the same thing. */
.note-list li.note-internal { background:var(--warning-bg); margin: 0 calc(-1 * var(--space-2)); padding: var(--space-4) var(--space-2); border-radius: var(--radius-sm); border-top: none; border-left:3px solid var(--warning); }
.note-internal-badge {
    display: inline-block; font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color:var(--warning); background:var(--warning-bg); border-radius: var(--radius-sm);
    padding: .0625rem var(--space-2); margin-bottom: var(--space-1);
}

/* Timeline -- one small uppercase kind badge per entry, same shape as
   note-internal-badge above, three colours so a scan down the feed
   tells notes/activities/documents apart without reading every line. */
.timeline-kind {
    display: inline-block; font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; border-radius: var(--radius-sm); padding: .0625rem var(--space-2); margin-right: var(--space-2);
}
.timeline-kind-note { color:var(--brand-500); background:var(--brand-100); }
.timeline-kind-activity { color:var(--warning); background:var(--warning-bg); }
.timeline-kind-document { color:var(--success); background:var(--success-bg); }

/* --- documents --------------------------------------------------------- */
.documents-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5);
    margin-top: var(--space-5);
}
.documents-panel h2 { font-size: var(--text-lg); margin: 0 0 var(--space-3); }
.file-input { display: block; font-size: var(--text-sm); margin-bottom: var(--space-2); }
.document-list { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.document-list li { border-top:1px solid var(--line-soft); padding-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-0); }
.document-list li:first-child { border-top: none; padding-top: 0; }
.document-list a { font-size: var(--text-lg); font-weight: 600; }
.document-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.document-row .link-btn { margin-right: 0; }

.library-upload {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-4); margin: var(--space-4) 0 var(--space-5);
}
.library-upload input[type="text"], .library-upload input:not([type]) { max-width: 16rem; }

/* --- import wizard --------------------------------------------------- */
.import-steps { display: flex; gap: var(--space-5); margin: var(--space-5) 0; border-bottom: 1px solid var(--border); padding-bottom: var(--space-3); }
.import-steps .step { color: var(--muted); font-size: var(--text-md); }
.import-steps .step.current { color: var(--accent); font-weight: 600; }
.import-steps .step.done { color: var(--text); }

.import-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-5);
    max-width: 100%;
}
.import-panel label { display: block; margin: var(--space-4) 0 var(--space-2); font-weight: 600; font-size: var(--text-md); }
.import-panel label:first-child { margin-top: 0; }
.import-panel select {
    padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-lg); font-family: inherit;
}
.import-panel input[type=file] { display: block; margin-top: var(--space-1); }

.import-actions { display: flex; gap: var(--space-3); margin-top: var(--space-5); }

.import-progress { margin-top: var(--space-4); max-width: 34rem; }
.import-progress-label { margin-bottom: var(--space-1); font-weight: 600; }
.import-progress progress { width: 100%; height: .65rem; accent-color:var(--crm-primary, var(--brand-500)); }
.button.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }

.mapping-table select { width: 100%; }
.mapping-table td { vertical-align: middle; }
/* Action plan steps (Graeme, 2026-10-01: Subject was squeezed to a few
   characters). A width on a <td> is only a hint the inputs overrule, so the
   columns are fixed here and Subject, the one that needs room, takes the rest. */
.plan-steps-table { table-layout: fixed; width: 100%; }
.plan-steps-table .col-day { width: 5rem; }
.plan-steps-table .col-type { width: 9.5rem; }
.plan-steps-table .col-priority { width: 7.5rem; }
.plan-steps-table .col-remove { width: 3rem; }
.plan-steps-table input { width: 100%; }

.preview-summary { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.pill { padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 600; }
.pill.create { background:var(--success-bg); color:var(--success); }
.pill.update { background:var(--brand-100); color:var(--brand-600); }
.pill.invalid { background: var(--error-bg); color: var(--error-text); }

.preview-table { max-height: 420px; overflow-y: auto; margin-top: var(--space-4); }
tr.invalid-row { background: var(--error-bg); }

.result-list { list-style: none; padding: 0; display: flex; gap: var(--space-5); font-size: var(--text-2xl); margin: var(--space-4) 0 var(--space-5); }

/* --- delete confirmation modal --------------------------------------- */
.button.danger { background: var(--surface); color: var(--error-text); border: 1px solid var(--error-border); }
.button.danger:hover:not(:disabled) { background: var(--error-bg); }
.button.danger:disabled { color: var(--muted); border-color: var(--border); }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,22,26,.4);
    display: flex; align-items: center; justify-content: center;
    /* Above the app bar (1100) and the nav drawer (1000), below the
       skip-to-content link (3000). At 100 a dialog was drawn UNDER the
       chrome, so a tall one lost its heading and first fields behind the
       app bar with no way to scroll to them. */
    z-index: 2000; padding: var(--space-4);
}
.modal {
    background: var(--surface); border-radius: var(--radius-md); padding: var(--space-5);
    max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 var(--space-3); font-size: var(--text-2xl); }
.modal p { margin: 0 0 var(--space-5); color: var(--muted); font-size: var(--text-lg); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-3); }
/* Mass Update: one field, one value, then the outcome. */
.mass-update label { display: block; margin: var(--space-3) 0 var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--ink-700); }
.mass-update .alert { margin-top: var(--space-3); }
.mass-update .modal-actions { margin-top: var(--space-4); }
.modal.mass-update { max-width: 40rem; }
.mass-update-rows { display: grid; gap: var(--space-3); margin: var(--space-3) 0; }
.mass-update-row { display: grid; gap: var(--space-2); margin: 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); min-width: 0; }
.mass-update-row-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto; gap: var(--space-2); align-items: center; }
.mass-update-values { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.mass-update-values .checkbox-row { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: 400; }
.mass-update-values input[type=checkbox] { width: auto; }
@media (max-width: 600px) { .mass-update-row-head { grid-template-columns: minmax(0, 1fr) auto; } }

/* --- opportunities: pipeline summary bar ------------------------------ */
.pipeline-bar { display: flex; gap: var(--space-2); margin: var(--space-4) 0 var(--space-5); flex-wrap: wrap; align-items: stretch; }
.pipeline-stage {
    display: flex; flex-direction: column; gap: var(--space-0);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4); cursor: pointer; font: inherit; text-align: left;
    min-width: 7.5rem;
}
.pipeline-stage:hover { border-color: var(--accent); }
.pipeline-stage.active { border-color: var(--accent); background:var(--brand-50); box-shadow: inset 0 0 0 1px var(--accent); }
.pipeline-stage.won { border-color:var(--success-line); }
.pipeline-stage.lost { border-color:var(--danger-line-soft); opacity: .75; }
.pipeline-stage-name { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.pipeline-stage-count { font-size: var(--text-2xl); font-weight: 700; }
.pipeline-stage-amount { font-size: var(--text-sm); color: var(--muted); }
.pipeline-clear {
    align-self: center; background: none; border: 0; color: var(--accent);
    cursor: pointer; font-size: var(--text-md); text-decoration: underline;
}

.searchbar .checkbox-row.small { margin-left: var(--space-4); font-size: var(--text-md); }

.badge.won { background:var(--success-bg); color:var(--success); }
.badge.lost { background: var(--error-bg); color: var(--error-text); }

/* --- opportunity stage tracker ---------------------------------------- */
.stage-tracker { display: flex; gap: var(--space-2); margin: 0 0 var(--space-5); flex-wrap: wrap; }
.stage-tracker:has(+ .stage-age-note) { margin-bottom: var(--space-2); }
.stage-age-note { margin: 0 0 var(--space-5); }
.stage-age-note p { margin: 0 0 var(--space-1); }
.stage-stalled { color: var(--danger); font-weight: 600; }
.stage-guidance { color: var(--ink-600); max-width: 60rem; white-space: pre-line; }
.board-card .stage-age-stalled { color: var(--danger); font-weight: 600; }
.stage-step {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: var(--space-2) var(--space-4); font-size: var(--text-sm); cursor: pointer; color: var(--muted);
}
.stage-step:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.stage-step.current { background: var(--accent); border-color: var(--accent); color:var(--on-accent); font-weight: 600; }
.stage-step:disabled { cursor: default; }
/* 0141: stages already passed read as done; a deal that is not in progress
   shows where it stopped, outlined rather than filled -- the status banner
   above says how it ended. */
.stage-step.done { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.stage-step.current.stopped { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink-700); }
.stage-step-days { margin-left: var(--space-1); font-size: var(--text-2xs); opacity: .8; font-weight: 500; }
.stage-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin: 0 0 var(--space-5); }
.stage-bar .stage-tracker { margin: 0; }
.stage-bar:has(+ .stage-age-note) { margin-bottom: var(--space-2); }
.stage-bar-label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-400); text-transform: uppercase; letter-spacing: .04em; }

/* --- opportunity status (0141) ----------------------------------------- */
.badge.status-in-progress { background: var(--brand-50); color: var(--brand-700); }
.badge.status-won { background: var(--success-bg); color: var(--success); }
.badge.status-lost { background: var(--danger-bg); color: var(--danger-fg); }
.badge.status-abandoned { background: var(--surface-3); color: var(--ink-600); }
.badge.status-suspended { background: var(--warning-bg); color: var(--warning); }
.deal-title { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.deal-subtitle { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-top: var(--space-1); }
.deal-subtitle > * + *::before { content: "·"; margin-right: var(--space-3); color: var(--ink-300); }
.deal-status-banner {
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4);
    padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4);
    border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-md); background: var(--surface-1);
}
.deal-status-banner.status-won { border-left-color: var(--success); background: var(--success-bg); }
.deal-status-banner.status-lost { border-left-color: var(--danger); background: var(--danger-bg); }
.deal-status-banner.status-abandoned { border-left-color: var(--ink-400); background: var(--surface-3); }
.deal-status-banner.status-suspended { border-left-color: var(--warning); background: var(--warning-bg); }
.deal-status-banner .small { margin-top: var(--space-1); color: var(--ink-600); }
.deal-status-comment { margin: var(--space-1) 0 0; white-space: pre-line; }
.deal-team table { margin-top: var(--space-2); }

/* The record header's Actions menu: a <details>, so it opens without a
   script and closes on a second click. */
.action-menu { position: relative; }
.action-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu-panel {
    position: absolute; right: 0; top: calc(100% + var(--space-1)); z-index: 30; min-width: 16rem;
    display: flex; flex-direction: column; padding: var(--space-1); max-height: 70vh; overflow-y: auto;
    background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.action-menu-panel > a, .action-menu-panel > button {
    display: grid; grid-template-columns: var(--space-6) minmax(0, 1fr); align-items: center; gap: var(--space-2); width: 100%; margin: 0;
    padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm);
    background: none; box-shadow: none; color: var(--ink-700); font-family: inherit; font-size: var(--text-md); font-weight: 500;
    text-align: left; text-decoration: none; cursor: pointer;
}
.action-menu-panel > a:hover, .action-menu-panel > button:hover:not(:disabled) { background: var(--brand-50); color: var(--brand-700); }
.action-menu-panel > :is(a,button):focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.action-menu-panel > button:disabled { color: var(--ink-400); cursor: not-allowed; }
.action-menu-heading { padding: var(--space-2) var(--space-3) var(--space-1); color: var(--ink-500); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.action-menu-heading:not(:first-child) { border-top: 1px solid var(--line); margin-top: var(--space-1); }
.action-menu-panel > button.danger { color: var(--danger-fg); }
.action-menu-panel > button.danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-fg); }
.action-menu-panel > button.danger:disabled { color: var(--ink-400); }
.list-action-menu .action-menu-panel { min-width: min(19rem, calc(100vw - 2 * var(--space-4))); }
/* actionMenus.js sets --menu-shift when the panel would leave the screen. */
.action-menu-panel { max-width: calc(100vw - 2 * var(--space-4)); transform: translateX(var(--menu-shift, 0)); }
.list-action-menu .action-menu-panel > :is(a,button) { white-space: nowrap; }
.action-menu-panel > button:disabled > .material-icons { opacity: .55; }
.action-menu-panel > :is(a,button) > .material-icons { display: grid; place-items: center; width: var(--space-6); height: var(--space-6); margin: 0; border-radius: var(--radius-sm); background: var(--menu-icon-bg, var(--brand-100)); color: var(--menu-icon-color, var(--brand-700)); font-size: var(--text-2xl); font-weight: normal; line-height: 1; text-transform: none; }
.action-menu-panel .tone-person { --menu-icon-color: var(--module-person); --menu-icon-bg: var(--module-person-soft); }
.action-menu-panel .tone-opportunity { --menu-icon-color: var(--module-opportunity); --menu-icon-bg: var(--module-opportunity-soft); }
.action-menu-panel .tone-campaign { --menu-icon-color: var(--module-campaign); --menu-icon-bg: var(--module-campaign-soft); }
.action-menu-panel .tone-mail { --menu-icon-color: var(--module-report); --menu-icon-bg: var(--module-report-soft); }
.action-menu-panel .tone-meeting { --menu-icon-color: var(--module-work); --menu-icon-bg: var(--module-work-soft); }
.action-menu-panel .tone-task { --menu-icon-color: var(--module-activity); --menu-icon-bg: var(--module-activity-soft); }
.action-menu-panel .tone-danger { --menu-icon-color: var(--danger-fg); --menu-icon-bg: var(--danger-bg); }
.action-menu-panel .material-icons.tone-person { --menu-icon-color: var(--module-person); --menu-icon-bg: var(--module-person-soft); }
.action-menu-panel .material-icons.tone-opportunity { --menu-icon-color: var(--module-opportunity); --menu-icon-bg: var(--module-opportunity-soft); }
.action-menu-panel .material-icons.tone-campaign { --menu-icon-color: var(--module-campaign); --menu-icon-bg: var(--module-campaign-soft); }
.action-menu-panel .material-icons.tone-mail { --menu-icon-color: var(--module-report); --menu-icon-bg: var(--module-report-soft); }
.action-menu-panel .material-icons.tone-meeting { --menu-icon-color: var(--module-work); --menu-icon-bg: var(--module-work-soft); }
.action-menu-panel .material-icons.tone-task { --menu-icon-color: var(--module-activity); --menu-icon-bg: var(--module-activity-soft); }
.action-menu-panel .material-icons.tone-danger { --menu-icon-color: var(--danger-fg); --menu-icon-bg: var(--danger-bg); }

/* Fixed Saved Lists share the CRM's modal, button and access-picker language. */
.favorite-lists-dialog { max-width: 52rem; width: min(52rem, calc(100vw - var(--space-6))); max-height: 85vh; overflow-y: auto; }
.favorite-lists-header, .favorite-lists-list-head, .favorite-lists-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.favorite-lists-header { border-bottom: 1px solid var(--line); padding-bottom: var(--space-3); }
.favorite-lists-header h2 { margin: 0; }
.favorite-lists-header p { margin: var(--space-1) 0 0; }
.favorite-lists-layout { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--space-4); padding: var(--space-4) 0; }
.favorite-lists-list-head { margin-bottom: var(--space-2); }
.favorite-lists-list-head select { width: auto; }
.favorite-lists-list { min-height: 12rem; max-height: 20rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.favorite-lists-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink-700); text-align: left; cursor: pointer; }
.favorite-lists-row span:first-child { min-width: 0; }
.favorite-lists-row strong, .favorite-lists-row small { display: block; }
.favorite-lists-row small { color: var(--ink-500); }
.favorite-lists-row:hover, .favorite-lists-row.selected { background: var(--brand-100); }
.favorite-lists-row:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.favorite-lists-empty { padding: var(--space-3); }
.favorite-lists-actions { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2); min-width: 10rem; }
.favorite-lists-actions .button { justify-content: flex-start; }
.favorite-lists-properties { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.favorite-lists-properties h3 { margin: 0; }
.favorite-lists-properties label:not(.favorite-lists-check) { display: grid; gap: var(--space-1); }
.favorite-lists-check { display: inline-flex; align-items: center; gap: var(--space-2); }
.favorite-lists-footer { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.favorite-list-shortcuts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
@media (max-width: 40rem) { .favorite-lists-layout { grid-template-columns: 1fr; } .favorite-lists-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); } .favorite-lists-footer { align-items: flex-start; flex-direction: column; } }

/* The board's status drop targets: drop a card to change its status. */
.board-status-targets { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); }
.board-status-target {
    flex: 1 1 10rem; padding: var(--space-3); text-align: center; font-weight: 600; font-size: var(--text-sm);
    border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink-600);
}
.board-status-target.status-won { border-color: var(--success-line); color: var(--success); }
.board-status-target.status-lost { border-color: var(--danger-line); color: var(--danger-fg); }
.board-status-target.status-suspended { border-color: var(--warning-line); color: var(--warning); }
.board-status-target-over { border-style: solid; background: var(--surface-1); box-shadow: var(--shadow-md); }
/* A tracker built from <span> rather than <button> (leads: status changes
   through the field below, not by clicking a step) reads the same but
   isn't interactive, so it shouldn't look it. */
span.stage-step { cursor: default; }
span.stage-step:hover { border-color: var(--border); color: var(--muted); }
span.stage-step.current:hover { border-color: var(--accent); color:var(--on-accent); }

/* --- leads: status filter bar ------------------------------------------ */
.status-filter-bar { display: flex; gap: var(--space-2); margin: var(--space-4) 0 var(--space-5); flex-wrap: wrap; align-items: center; }
.status-chip {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: var(--space-2) var(--space-4); font-size: var(--text-sm); cursor: pointer; color: var(--muted); font: inherit;
}
.status-chip:hover { border-color: var(--accent); color: var(--text); }
.status-chip.active { border-color: var(--accent); background:var(--brand-50); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.status-chip.won { border-color:var(--success-line); }
.status-chip.lost { border-color:var(--danger-line-soft); opacity: .75; }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.history-list li { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-md); }

/* --- hotlist ----------------------------------------------------------- */
.hotlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.hotlist-item {
    display: flex; align-items: center; gap: var(--space-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
}
.hotlist-item.overdue { border-left:3px solid var(--danger-fg); }
.hotlist-done {
    flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    cursor: pointer; font-size: var(--text-md); line-height: 1;
}
.hotlist-done:hover { border-color:var(--success); color:var(--success); background:var(--success-bg); }
.hotlist-body { flex: 1; display: flex; align-items: center; gap: var(--space-2); cursor: pointer; min-width: 0; flex-wrap: wrap; }
.hotlist-subject { font-weight: 600; }
.hotlist-date { flex-shrink: 0; font-size: var(--text-md); color: var(--muted); }
.hotlist-date.overdue { color:var(--danger-fg); font-weight: 600; }

.badge.priority-high { background: var(--error-bg); color: var(--error-text); }
.badge.priority-normal { background:var(--surface-2); color: var(--muted); }
.badge.priority-low { background:var(--surface-2); color: var(--muted); }

td.overdue { color:var(--danger-fg); font-weight: 600; }

/* --- dashboard: KPI row --------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.stat-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1);
}
.stat-tile.stat-tile-warn { border-color:var(--warning-line-soft); }
.stat-label { font-size: var(--text-sm); color: var(--muted); }
.stat-value { font-size: var(--text-4xl); font-weight: 600; line-height: 1.1; font-variant-numeric: proportional-nums; }
.stat-sub { font-size: var(--text-sm); }
.stat-sub.stat-overdue { color:var(--danger); font-weight: 600; }

/* --- dashboard: panels ----------------------------------------------- */
.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: var(--space-5) var(--space-5); margin-bottom: var(--space-5);
}
.panel h2 { font-size: var(--text-lg); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin: 0 0 var(--space-4); }
.panel-link { display: inline-block; margin-top: var(--space-4); font-size: var(--text-md); color: var(--accent); text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
@media (max-width: 720px) { .dashboard-columns { grid-template-columns: 1fr; } }

/* --- dashboard: pipeline funnel bar chart ----------------------------
   Mark spec: bars <=24px thick, 4px rounded data-end square at the
   baseline, one sequential hue (blue), darker = closer to close. */
.funnel { display: flex; flex-direction: column; gap: var(--space-3); }
.funnel-row { display: grid; grid-template-columns: 9rem 1fr 5.5rem 2.5rem; align-items: center; gap: var(--space-3); }
.funnel-label { font-size: var(--text-md); color: var(--text); }
.funnel-track { background: var(--bg); border-radius: var(--radius-sm); height: 20px; overflow: hidden; }
.funnel-bar {
    height: 20px; min-width: 4px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;   /* 4px rounded data-end, square at the baseline (left) */
}
.funnel-value { font-size: var(--text-md); font-weight: 600; text-align: right; font-variant-numeric: proportional-nums; }
.funnel-count { font-size: var(--text-sm); text-align: right; }

/* --- dashboard: preview lists (upcoming, hotlist) --------------------- */
.preview-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.preview-list li {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0;
    border-top:1px solid var(--line-soft); cursor: pointer; flex-wrap: wrap;
}
.preview-list li:first-child { border-top: none; }
.preview-list li:hover { background:var(--surface-2); margin: 0 calc(-1 * var(--space-2)); padding-left: var(--space-2); padding-right: var(--space-2); border-radius: var(--radius-sm); }
.preview-when { font-size: var(--text-sm); color: var(--muted); flex-shrink: 0; min-width: 5.5rem; }
.preview-when.overdue { color:var(--danger); font-weight: 600; }
.preview-subject { font-weight: 500; }

/* --- custom fields admin ---------------------------------------------- */
.admin-tabs { display: flex; gap: var(--space-2); margin: var(--space-4) 0 var(--space-5); border-bottom: 1px solid var(--border); }
.admin-tab {
    background: none; border: 0; border-bottom: 2px solid transparent;
    padding: var(--space-3) var(--space-1); margin-right: var(--space-5); font: inherit; font-size: var(--text-lg);
    color: var(--muted); cursor: pointer;
}
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.admin-tab:hover:not(.active) { color: var(--text); }

/* Setup editors contain tables and lists, not record label/control pairs.
   Keeping them block-layout prevents the record form's four-column grid
   from shrinking a table into its first track (the broken Fields screen). */
.setup-admin-card { min-width: 0; }
.setup-admin-card > .table-scroll { width: 100%; }
.setup-admin-card .setup-table,
.setup-admin-card > .table-scroll > .grid { min-width: 42rem; }
/* The access editor splits the card into columns, so the rules above
   misfire inside it. The 42rem minimum forced the one-column Privileges
   list to scroll sideways in a ~450px column. And .detail-form h2 bleeds
   1.5rem past each side to reach the card edge, which pushed the two
   column headings into each other (and past a narrow viewport). This
   comes after .detail-form h2 and :first-child so it wins on order. */
.setup-admin-card .access-columns .setup-table { min-width: 0; }
.setup-admin-card .access-columns h2 { margin-left: 0; margin-right: 0; }
.setup-editor-grid { display:grid; grid-template-columns:minmax(0,1.45fr) minmax(22rem,.8fr); gap:var(--space-4); align-items:start; }
.setup-editor-grid.single { grid-template-columns:minmax(0,1fr); }
.security-flow { display:flex; align-items:center; flex-wrap:wrap; gap:var(--space-2); margin:0 0 var(--space-4); padding:var(--space-3) var(--space-4); border:1px solid var(--line); border-radius:var(--radius-lg); background:linear-gradient(90deg,var(--brand-50),var(--surface-1)); color:var(--ink-600); }
.security-flow strong { margin-right:var(--space-1); color:var(--ink-800); }
.security-flow span { padding:var(--space-1) var(--space-2); border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface-1); font-size:var(--text-sm); }
.security-member-list,.access-group-list { display:grid; gap:var(--space-1); max-height:18rem; overflow:auto; padding:var(--space-2); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-2); }
.security-member-list .checkbox-row,.access-group-list .checkbox-row { padding:var(--space-2) var(--space-2); border-radius:var(--radius-sm); background:var(--surface-1); }
.security-member-list span,.access-group-list span { display:grid; }
.security-member-list small,.access-group-list small { color:var(--ink-400); font-weight:400; }
.access-subhead { margin:var(--space-4) 0 var(--space-1); color:var(--ink-800); font-size:var(--text-md); }
.access-dialog > label { display:block; margin:var(--space-3) 0 var(--space-1); font-weight:650; }
.access-dialog > select { width:100%; padding:var(--space-2) var(--space-3); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface-1); }
.modal.record-access-dialog { width:min(58rem, calc(100vw - 2rem)); max-width:58rem; max-height:min(49rem, calc(100vh - 2rem)); overflow:auto; padding:0; }
.record-access-fields { display:grid; gap:var(--space-2); margin:var(--space-3) 0 var(--space-4); padding:var(--space-3) var(--space-4); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-1); box-shadow:var(--shadow-sm); }

.notes-data-grid tbody tr { cursor:pointer; }
.notes-data-grid tbody tr.selected { background:color-mix(in srgb, var(--brand-600) 13%, var(--surface-1)); }
.notes-data-grid td:nth-child(3) { max-width:34rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.note-editor-backdrop { z-index:2050; }
.modal.note-editor-window { width:min(64rem, calc(100vw - 2rem)); max-width:64rem; max-height:calc(100vh - 2rem); padding:0; overflow:auto; }
.note-editor-header { display:flex; align-items:center; justify-content:space-between; padding:var(--space-4) var(--space-5); border-bottom:1px solid var(--line); }
.note-editor-header h2 { margin:0; font-size:var(--text-2xl); }
.note-editor-toolbar { display:flex; gap:var(--space-2); padding:var(--space-2) var(--space-4); border-bottom:1px solid var(--line); background:var(--surface-2); }
.note-editor-toolbar button { border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-1); padding:var(--space-1) var(--space-3); color:var(--text); }
.note-editor-body { display:block; width:calc(100% - 2rem); min-height:20rem; margin:var(--space-4); padding:var(--space-4); resize:vertical; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-1); color:var(--text); font:inherit; line-height:1.5; }
.note-editor-details { display:grid; grid-template-columns:minmax(16rem, 1fr) minmax(20rem, 1fr); gap:var(--space-4); padding:0 var(--space-4) var(--space-4); }
.note-editor-details section { border:1px solid var(--line); border-radius:var(--radius-sm); padding:var(--space-3); }
.note-editor-details h3 { margin:0 0 var(--space-2); font-size:var(--text-md); }
.note-editor-details dl { display:grid; grid-template-columns:6rem 1fr; gap:var(--space-2) var(--space-3); margin:0 0 var(--space-3); }
.note-editor-details dt { font-weight:600; }
.note-editor-details dd { margin:0; }
.note-editor-window > .modal-actions { padding:var(--space-3) var(--space-4); border-top:1px solid var(--line); }
@media (max-width: 760px) { .note-editor-details { grid-template-columns:1fr; } }
/* A delete-confirm dialog opened from a button inside the note/document
   editor modal (z-index:2050) needs to stack above it, not behind it --
   the base .modal-backdrop's z-index:100 left it visually covered and
   unclickable, found live rather than assumed. */
.nested-confirm-backdrop { z-index:2100; }
.record-access-field-row { display:grid; grid-template-columns:8rem minmax(0,1fr); gap:var(--space-3); align-items:center; }
.record-access-field-label { color:var(--ink-700); font-size:var(--text-sm); font-weight:750; }
.record-access-value { display:flex; align-items:center; flex-wrap:wrap; gap:var(--space-1); min-height:2.55rem; padding:var(--space-1) var(--space-2); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface-1); color:var(--ink-800); cursor:pointer; text-align:left; }
.record-access-value:hover { border-color:var(--brand-400); box-shadow:0 0 0 2px color-mix(in srgb,var(--brand-400) 12%,transparent); }
.record-access-chip { display:inline-flex; align-items:center; gap:var(--space-2); max-width:15rem; padding:var(--space-1) var(--space-2); border-radius:var(--radius-sm); background:var(--surface-3); color:var(--ink-700); font-size:var(--text-xs); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.record-access-chip.public { background:color-mix(in srgb,var(--success) 12%,var(--surface-1)); color:var(--success); }
.record-access-chip.group { background:var(--brand-100); color:var(--brand-700); }
.record-access-chip b { font-size:var(--text-xl); line-height:.7; font-weight:500; }
.record-access-edit { margin-left:auto; padding:var(--space-1) var(--space-2); color:var(--brand-700); font-size:var(--text-xs); font-weight:700; }
.record-context-overlay { position:fixed; inset:0; z-index:1200; }
.record-context-menu { position:fixed; width:min(20rem,calc(100vw - 1rem)); max-height:75vh; overflow-y:auto; padding:var(--space-1); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface-1); box-shadow:var(--shadow-lg); }
.record-context-title { padding:var(--space-2) var(--space-3); color:var(--ink-600); font-size:var(--text-xs); font-weight:750; letter-spacing:.04em; text-transform:uppercase; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.record-context-heading { display:block; padding:var(--space-2) var(--space-3) var(--space-1); color:var(--ink-400); font-size:var(--text-2xs); font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.record-context-menu a,.record-context-menu button { display:grid; grid-template-columns:var(--space-6) minmax(0,1fr); align-items:center; gap:var(--space-2); width:100%; min-height:calc(var(--space-6) + var(--space-2)); padding:var(--space-1) var(--space-2); border:0; border-radius:var(--radius-sm); background:transparent; color:var(--ink-800); font:inherit; font-size:var(--text-md); text-align:left; text-decoration:none; cursor:pointer; }
.record-context-menu a:hover,.record-context-menu button:hover { background:var(--brand-50); color:var(--brand-700); }
.record-context-menu a:focus-visible,.record-context-menu button:focus-visible { outline:2px solid var(--brand-500); outline-offset:-2px; }
.record-context-menu button.danger:hover { background:var(--danger-bg); color:var(--danger-fg); }
.record-context-menu :is(a,button) > .material-icons { display:grid; place-items:center; width:var(--space-6); height:var(--space-6); margin:0; border-radius:var(--radius-sm); background:var(--context-icon-bg,var(--brand-100)); color:var(--context-icon-color,var(--brand-700)); font-size:var(--text-2xl); line-height:1; }
.record-context-menu :is(a,button) > .tone-edit { --context-icon-color:var(--brand-700); --context-icon-bg:var(--brand-100); }
.record-context-menu :is(a,button) > .tone-danger { --context-icon-color:var(--danger-fg); --context-icon-bg:var(--danger-bg); }
.record-context-menu :is(a,button) > .tone-mail { --context-icon-color:var(--module-report); --context-icon-bg:var(--module-report-soft); }
.record-context-menu :is(a,button) > .tone-interaction { --context-icon-color:var(--module-person); --context-icon-bg:var(--module-person-soft); }
.record-context-menu :is(a,button) > .tone-task { --context-icon-color:var(--module-activity); --context-icon-bg:var(--module-activity-soft); }
.record-context-menu :is(a,button) > .tone-meeting { --context-icon-color:var(--module-work); --context-icon-bg:var(--module-work-soft); }
.record-context-menu :is(a,button) > .tone-document { --context-icon-color:var(--accent-purple); --context-icon-bg:var(--accent-purple-bg); }
.record-context-menu :is(a,button) > .tone-opportunity { --context-icon-color:var(--module-opportunity); --context-icon-bg:var(--module-opportunity-soft); }
.record-context-menu :is(a,button) > .tone-case { --context-icon-color:var(--module-case); --context-icon-bg:var(--module-case-soft); }
.record-context-menu :is(a,button) > .tone-person { --context-icon-color:var(--module-person); --context-icon-bg:var(--module-person-soft); }
.record-context-menu :is(a,button) > .tone-open { --context-icon-color:var(--module-company); --context-icon-bg:var(--module-company-soft); }
.record-context-menu .record-context-action > .material-icons { --context-icon-color:var(--module-campaign); --context-icon-bg:var(--module-campaign-soft); }
.record-context-separator { height:1px; margin:var(--space-1) var(--space-2); background:var(--line); }
.record-access-head { display:grid; grid-template-columns:auto 1fr auto; gap:var(--space-3); align-items:center; padding:var(--space-5) var(--space-5); border-bottom:1px solid var(--line); background:linear-gradient(100deg,var(--brand-50),var(--surface-1)); }
.record-access-head h2 { margin:0 0 var(--space-0); font-size:var(--text-3xl); color:var(--ink-900); }
.record-access-head p { margin:0; font-size:var(--text-md); }
.record-access-head-icon { display:grid; place-items:center; width:2.6rem; height:2.6rem; border-radius:var(--radius-md); background:var(--brand-600); color:var(--on-accent); font-size:var(--text-2xl); box-shadow:var(--shadow-sm); }
.modal-close { border:0; background:transparent; color:var(--ink-400); font-size:var(--text-4xl); cursor:pointer; }

/* Custom-field browser: folders keep a long catalogue scannable without
   hiding the normal editor controls.  The folder rows deliberately use
   buttons rather than disclosure-only links so keyboard users get the same
   expand/collapse behaviour as pointer users. */
.record-custom-fields-page { max-width: none; padding-bottom: var(--space-6); }
.record-custom-fields-header { margin-bottom: var(--space-4); }
.record-custom-fields-header .eyebrow { margin: var(--space-3) 0 var(--space-1); }
.record-custom-fields-actions { display:flex; justify-content:flex-end; gap:var(--space-3); margin-top:var(--space-5); padding-top:var(--space-4); border-top:1px solid var(--line); }
.custom-fields-toolbar { display:flex; align-items:center; gap:var(--space-4); flex-wrap:wrap; margin:var(--space-4) 0 var(--space-4); padding:var(--space-3) var(--space-3); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-2); }
.custom-fields-toolbar .checkbox-row { margin:0; }
.custom-fields-search { margin-left:auto; min-width:min(19rem,100%); }
.custom-fields-search input { width:100%; }
.custom-fields-tree { display:grid; gap:var(--space-2); }
.custom-fields-folder { overflow:hidden; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-1); }
.custom-fields-folder-toggle { display:flex; align-items:center; gap:var(--space-2); width:100%; padding:var(--space-3) var(--space-3); border:0; background:linear-gradient(90deg,var(--brand-50),var(--surface-1)); color:var(--ink-800); font:inherit; text-align:left; cursor:pointer; }
.custom-fields-folder-toggle:hover { background:var(--brand-100); }
.custom-fields-folder-chevron { display:inline-grid; place-items:center; width:1.1rem; color:var(--brand-700); font-size:var(--text-2xl); line-height:1; }
.custom-fields-folder-icon { color:var(--brand-600); font-size:var(--text-sm); }
.custom-fields-folder-toggle .muted { margin-left:auto; }
.custom-fields-folder-content { padding:var(--space-3) var(--space-4) var(--space-4); border-top:1px solid var(--line); }
.custom-fields-folder-content .udf-fields-editor { margin:0; padding:0; }
.custom-fields-folder-content .udf-fields-editor > .form-field { margin-top:var(--space-1); }
.field-folder-create { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--space-3); align-items:end; padding:var(--space-4); margin-bottom:var(--space-3); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-2); }
.field-folder-create label { display:grid; gap:var(--space-1); font-weight:600; }
.field-folder-create-actions { display:flex; gap:var(--space-2); align-items:center; }
@media (max-width:760px) { .field-folder-create { grid-template-columns:1fr; } }
.modal.field-editor-dialog { width:min(46rem,calc(100vw - 2rem)); max-width:46rem; }
.field-editor-dialog .notes-panel { padding:0; border:0; border-radius:0; background:transparent; }
.field-editor-heading { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); margin-bottom:var(--space-4); }
.field-editor-heading h2 { margin:0; font-size:var(--text-xl); }
.field-editor-dialog .notes-panel > label:not(.checkbox-row) { display:block; margin:var(--space-4) 0 var(--space-2); font-weight:600; }
.field-editor-dialog .notes-panel > label.checkbox-row { margin:var(--space-4) 0; }
.field-editor-dialog .notes-panel > input:not([type=checkbox]),.field-editor-dialog .notes-panel > select { width:100%; min-height:2.6rem; padding:var(--space-2) var(--space-3); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-1); color:var(--ink-900); }
.field-editor-dialog .notes-panel > fieldset { margin:var(--space-4) 0; }
.field-catalog-view-switch { display:inline-flex; gap:var(--space-1); margin-left:auto; }
.field-tree-folder-row { background:var(--surface-2); }
.field-tree-toggle { display:flex; align-items:center; gap:var(--space-2); width:100%; padding:var(--space-2); padding-left:calc(var(--space-2) + var(--tree-depth) * var(--space-5)); border:0; border-radius:var(--radius-sm); background:transparent; color:var(--ink-900); text-align:left; cursor:pointer; }
.field-tree-toggle:hover,.field-tree-toggle:focus-visible { background:var(--brand-50); outline:2px solid var(--brand-400); outline-offset:-2px; }
.field-tree-chevron { color:var(--brand-700); font-size:var(--text-xl); }
.field-tree-folder-icon { color:var(--brand-600); font-size:var(--text-xl); }
.field-tree-field { padding-left:calc(var(--tree-depth) * var(--space-5)); }
.field-catalog-name { display:flex; align-items:center; gap:var(--space-2); min-width:12rem; }
.field-catalog-name > .material-icons { color:var(--brand-700); background:var(--brand-100); border-radius:var(--radius-sm); padding:var(--space-1); font-size:var(--text-xl); }
.field-catalog-name > span:last-child { display:grid; gap:var(--space-0); }
.field-catalog-name small { display:block; }
.field-row-actions { display:grid; grid-template-columns:repeat(5,var(--space-6)); gap:var(--space-1); align-items:center; width:max-content; }
.field-row-action,.field-row-action-spacer { display:grid; place-items:center; width:var(--space-6); height:var(--space-6); }
.field-row-action { padding:0; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-1); color:var(--brand-700); cursor:pointer; }
.field-row-action .material-icons { font-size:var(--text-lg); }
.field-row-action:hover { background:var(--brand-100); border-color:var(--brand-400); }
.field-row-action:focus-visible { outline:2px solid var(--brand-600); outline-offset:2px; }
.field-row-action.items { color:var(--success); }
.field-row-action.visibility { color:var(--ink-600); }
.field-row-action.delete { color:var(--danger); }
.field-row-action.delete:hover { background:var(--error-bg); border-color:var(--error-border); }
.modal.field-delete-dialog { width:min(32rem,calc(100vw - 2rem)); max-width:32rem; }
.field-delete-counts { list-style:none; padding:0; margin:0 0 var(--space-4); border:1px solid var(--line); border-radius:var(--radius-sm); }
.field-delete-counts li { display:flex; justify-content:space-between; gap:var(--space-3); padding:var(--space-2) var(--space-3); border-bottom:1px solid var(--line-soft); }
.field-delete-counts li:last-child { border-bottom:0; }
.field-delete-dialog .checkbox-row { margin-bottom:var(--space-4); }
.field-target-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-2) var(--space-4); }
.field-target-grid .checkbox-row { margin:0; }
@media (max-width:620px) { .field-target-grid { grid-template-columns:1fr; } }
.inline-form-row { display:flex; gap:var(--space-2); align-items:center; flex-wrap:wrap; }
.inline-form-row input { flex:1 1 14rem; }
.inline-form-row select { flex:1 1 14rem; }
.record-access-public-grid { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-3); padding:var(--space-4) var(--space-5) var(--space-3); }
.record-access-public-card { display:grid; grid-template-columns:auto auto 1fr; align-items:center; gap:var(--space-3); min-height:4.5rem; padding:var(--space-3); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-1); cursor:pointer; }
.record-access-public-card.selected { border-color:var(--brand-400); background:var(--brand-50); box-shadow:0 0 0 2px color-mix(in srgb,var(--brand-400) 14%,transparent); }
.record-access-public-card > span:last-child,.record-access-person-row > span:last-child { display:grid; }
.record-access-public-card small,.record-access-person-row small { color:var(--ink-400); font-weight:400; }
.access-card-icon { display:grid; place-items:center; width:2rem; height:2rem; border-radius:50%; background:var(--surface-3); }
.record-access-search { display:flex; align-items:center; gap:var(--space-2); margin:0 var(--space-5) var(--space-3); padding:0 var(--space-3); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface-1); }
.record-access-search input { flex:1; border:0; outline:0; padding:var(--space-3) 0; background:transparent; }
.record-access-columns { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-3); padding:0 var(--space-5) var(--space-4); }
.record-access-columns > section { min-width:0; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-2); overflow:hidden; }
.record-access-section-head { display:flex; justify-content:space-between; align-items:center; padding:var(--space-3) var(--space-3); border-bottom:1px solid var(--line); background:var(--surface-1); }
.record-access-section-head h3,.record-access-section-head p { margin:0; }
.record-access-section-head p { font-size:var(--text-xs); }
.record-access-section-head > span { padding:var(--space-1) var(--space-2); border-radius:var(--radius-pill); background:var(--brand-100); color:var(--brand-700); font-size:var(--text-xs); font-weight:700; }
.record-access-list { max-height:18rem; overflow:auto; padding:var(--space-2); }
.record-access-person-row { display:grid; grid-template-columns:auto auto 1fr; align-items:center; gap:var(--space-2); padding:var(--space-2); margin:var(--space-0) 0; border:1px solid transparent; border-radius:var(--radius-md); background:var(--surface-1); cursor:pointer; }
.record-access-person-row:hover { border-color:var(--brand-200); }
.record-access-person-row.selected { border-color:var(--brand-300); background:var(--brand-50); }
.access-identity-icon { display:grid; place-items:center; width:1.85rem; height:1.85rem; border-radius:50%; background:var(--module-person-soft); color:var(--module-person); font-size:var(--text-2xs); font-weight:800; }
.access-identity-icon.group { background:var(--brand-100); color:var(--brand-700); }
.record-access-footer { display:flex; align-items:center; justify-content:space-between; gap:var(--space-4); padding:var(--space-4) var(--space-5); border-top:1px solid var(--line); background:var(--surface-2); }
.record-access-footer p { margin:0; font-size:var(--text-xs); }
@media (max-width: 700px) {
    .record-access-columns,.record-access-public-grid { grid-template-columns:1fr; }
    .record-access-field-row { grid-template-columns:1fr; gap:var(--space-1); }
    .record-access-footer { align-items:flex-start; flex-direction:column; }
}
@media (max-width: 900px) { .setup-editor-grid { grid-template-columns:1fr; } }

.link-btn {
    display: inline-flex; align-items: center; gap: var(--space-1);
    background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
    color: var(--brand-700); cursor: pointer; font: inherit; font-size: var(--text-sm);
    font-weight: 650; padding: var(--space-1) var(--space-2); margin-right: var(--space-2);
    text-decoration: none;
}
.link-btn:hover, .link-btn:focus-visible { background: var(--brand-50); border-color: var(--line); text-decoration: none; }
.link-btn.danger { color: var(--error-text); }
html.theme-dark .link-btn { color: var(--brand-400); }
html.theme-dark .link-btn:hover, html.theme-dark .link-btn:focus-visible { background: var(--crm-surface-raised); border-color: var(--crm-line); }

/* --- Reports library ------------------------------------------------- */
.report-library, .report-result { max-width: 1320px; margin: 0 auto; }
.report-library-header, .report-result > header { display:flex; justify-content:space-between; align-items:flex-start; gap:var(--space-4); margin-bottom:var(--space-5); }
.report-library h1, .report-result h1 { margin:0; font-size:var(--text-4xl); font-weight:600; color:var(--text); }
.report-library-header p, .report-result header p { margin:var(--space-1) 0 0; color:var(--muted); }
.report-library-toolbar { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-4) var(--space-4); background:var(--surface-1); border:1px solid var(--line); border-bottom:0; border-radius:var(--radius-md) var(--radius-md) 0 0; }
.report-dashboard-callout { display:flex; align-items:center; justify-content:space-between; gap:var(--space-4); margin:var(--space-3) 0; padding:var(--space-4) var(--space-4); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:linear-gradient(110deg,var(--brand-50),var(--surface-1)); color:var(--ink-800); }
.report-dashboard-callout div { display:flex; flex-direction:column; gap:var(--space-1); }
.report-dashboard-callout span { color:var(--ink-500); font-size:var(--text-md); }
.sales-dashboard { max-width:1400px; margin:0 auto; padding:var(--space-5); background:var(--surface-3); min-height:calc(100vh - 80px); }
.sales-dashboard-header { display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:var(--space-5); }
.sales-dashboard-header h1 { margin:var(--space-1) 0; font-size:var(--text-4xl); color:var(--ink-900); }
.sales-dashboard-header p { margin:0; color:var(--ink-400); }
.dashboard-controls { display:flex; align-items:end; gap:var(--space-3); margin-bottom:var(--space-4); }.dashboard-controls label { display:grid; gap:var(--space-1); color:var(--ink-400); font-size:var(--text-xs); text-transform:uppercase; }.dashboard-controls input { border:1px solid var(--line-strong); border-radius:var(--radius-sm); padding:var(--space-2) var(--space-2); color:var(--ink-800); }
.sales-dashboard-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--space-4); }
.dashboard-panel { min-width:0; background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm), var(--highlight-top); overflow:hidden; }
.dashboard-panel.wide { grid-column:span 2; }
.dashboard-panel > header { display:flex; align-items:center; justify-content:space-between; padding:var(--space-3) var(--space-4); border-bottom:1px solid var(--line-soft); }
.dashboard-panel h2 { margin:0; font-size:var(--text-xl); color:var(--ink-800); }
.dashboard-panel > header span { color:var(--ink-400); font-size:var(--text-xs); }
.dashboard-empty { min-height:150px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--space-1); padding:var(--space-5); color:var(--ink-400); text-align:center; }
.dashboard-empty strong { color:var(--ink-700); font-size:var(--text-lg); }
.dashboard-empty span { font-size:var(--text-sm); }
.dashboard-bars { padding:var(--space-4); display:grid; gap:var(--space-3); }
.dashboard-bar { display:grid; grid-template-columns:130px 1fr 28px; gap:var(--space-2); align-items:center; font-size:var(--text-sm); color:var(--ink-600); }
.dashboard-bar i { height:10px; background:var(--surface-3); border-radius:var(--radius-sm); overflow:hidden; }
.dashboard-bar b { display:block; height:100%; background:linear-gradient(90deg,var(--brand-400),var(--data-progress)); border-radius:var(--radius-sm); }
.dashboard-bar strong { text-align:right; color:var(--ink-800); }
.dashboard-table { overflow:hidden; }
.dashboard-table table { width:100%; border-collapse:collapse; font-size:var(--text-xs); }
.dashboard-table th { text-align:left; color:var(--ink-400); font-size:var(--text-2xs); text-transform:uppercase; letter-spacing:.04em; padding:var(--space-3) var(--space-3); background:var(--surface-2); white-space:nowrap; }
.dashboard-table td { padding:var(--space-3) var(--space-3); border-top:1px solid var(--line-soft); color:var(--ink-700); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:180px; }
.dashboard-table th { overflow:hidden; text-overflow:ellipsis; }
.dashboard-table td.status-good { color:var(--success); font-weight:600; }.dashboard-table td.status-bad { color:var(--danger); font-weight:600; }.dashboard-table td.status-warn { color:var(--warning); font-weight:600; }
.report-share-check { display:flex; align-items:center; gap:var(--space-2); margin:var(--space-2) 0; color:var(--ink-600); font-size:var(--text-md); }
.workqueue-page { display:grid; grid-template-columns:300px minmax(0,1fr); min-height:calc(100vh - 80px); background:var(--surface-2); gap:var(--space-4); padding:var(--space-4); }.workqueue-sidebar { background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-4); }.workqueue-sidebar h2 { margin:0 0 var(--space-3); font-size:var(--text-xl); }.workqueue-sidebar select { width:100%; padding:var(--space-2); border:1px solid var(--line-strong); border-radius:var(--radius-sm); margin-bottom:var(--space-3); }.workqueue-sidebar a { display:flex; justify-content:space-between; padding:var(--space-3) var(--space-2); color:var(--ink-800); text-decoration:none; border-radius:var(--radius-sm); }.workqueue-sidebar a.active,.workqueue-sidebar a:hover { background:var(--brand-100); color:var(--brand-500); }.workqueue-sidebar hr { border:0; border-top:1px solid var(--line-soft); margin:var(--space-4) 0; }.workqueue-sidebar h3 { font-size:var(--text-md); margin:var(--space-2); }/* Workqueue uses the plain module header like every other module; it used to add a card frame whose side padding .module-page-header then zeroed, leaving the title and search flush against the border. */ .workqueue-header { min-width: 0; }.workqueue-header h1 { margin:0; color:var(--ink-800); }.workqueue-empty { margin-top:var(--space-4); background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); min-height:380px; display:grid; place-content:center; text-align:center; color:var(--ink-400); }.workqueue-empty h2 { color:var(--ink-800); }
.dashboard-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:var(--space-4); margin-bottom:var(--space-4); }.dashboard-kpis div { background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-4); box-shadow:var(--shadow-sm), var(--highlight-top); }.dashboard-kpis strong { display:block; font-size:var(--text-4xl); color:var(--brand-500); }.dashboard-kpis span { color:var(--ink-400); font-size:var(--text-sm); }.dashboard-kpi-link { display:flex; flex-direction:column; gap:var(--space-1); background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-4); box-shadow:var(--shadow-sm), var(--highlight-top); color:inherit; text-decoration:none; transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease; }.dashboard-kpi-link:hover,.dashboard-kpi-link:focus-visible { transform:translateY(-1px); border-color:var(--brand-500); box-shadow:var(--shadow-raise); outline:none; }.dashboard-kpi-link strong { display:block; font-size:var(--text-4xl); color:var(--brand-500); }.dashboard-kpi-link span { color:var(--ink-400); font-size:var(--text-sm); }.dashboard-funnel { padding:var(--space-4); display:flex; flex-direction:column; align-items:center; gap:var(--space-1); }.funnel-segment { color:var(--on-accent); text-align:center; padding:var(--space-2) var(--space-2); font-size:var(--text-xs); clip-path:polygon(5% 0,95% 0,82% 100%,18% 100%); }.dashboard-donut-wrap { display:flex; align-items:center; justify-content:center; gap:var(--space-5); padding:var(--space-5); }.dashboard-donut { width:130px; height:130px; border-radius:50%; display:grid; place-items:center; color:var(--ink-800); font-weight:700; font-size:var(--text-3xl); box-shadow:inset 0 0 0 28px var(--surface-1); }.dashboard-legend { display:grid; gap:var(--space-2); font-size:var(--text-xs); color:var(--ink-600); }
@media (max-width:900px) { .sales-dashboard-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.dashboard-panel.wide { grid-column:span 2; } }
@media (max-width:600px) { .sales-dashboard { padding:var(--space-3); }.sales-dashboard-header { align-items:flex-start; flex-direction:column; gap:var(--space-3); }.sales-dashboard-grid { grid-template-columns:1fr; }.dashboard-panel.wide { grid-column:span 1; }.dashboard-bar { grid-template-columns:100px 1fr 22px; } }

/* --- Sales Intelligence dashboards (/reports/dashboards) -------------
   Built on the rep-dashboard's own .sales-dashboard / .dashboard-panel
   shell so the two read the same. New here: the left rail, the shared
   filter bar, and semantic KPI tones (won / in progress / lost) -- the
   one thing borrowed from Maximizer's look. */
.sid { max-width:1600px; margin:0 auto; padding:var(--space-4) var(--space-5) var(--space-6); }
.sid-header { display:flex; align-items:baseline; justify-content:space-between; gap:var(--space-4); flex-wrap:wrap; }
.sid-header h1 { margin:0; font-size:var(--text-3xl); font-weight:600; color:var(--ink-900); letter-spacing:-.01em; }
.sid-header-actions { display:flex; align-items:center; gap:var(--space-4); }
.sid-header-link { color:var(--brand-600); font-size:var(--text-sm); text-decoration:none; }
.sid-header-link:hover { text-decoration:underline; }

/* Sync line + report actions, between the filter band and the panels. */
.sid-meta { display:flex; align-items:center; justify-content:space-between; gap:var(--space-4); padding:var(--space-0) var(--space-0) var(--space-3); }
.sid-sync { color:var(--ink-400); font-size:var(--text-xs); font-variant-numeric:tabular-nums; }
.sid-meta-action { border:1px solid var(--line); background:var(--surface-1); color:var(--ink-500); border-radius:var(--radius-sm); width:1.9rem; height:1.9rem; font-size:var(--text-lg); line-height:1; }
.sid-meta-action:hover:not(:disabled) { border-color:var(--brand-500); color:var(--brand-600); }
.sid-meta-action:disabled { opacity:.5; cursor:wait; }

/* The tab strip is the dashboard picker -- full width, no sidebar. */
.sid-tabs { display:flex; gap:var(--space-0); overflow-x:auto; margin:var(--space-3) 0 0; border-bottom:1px solid var(--line); scrollbar-width:thin; }
.sid-tabs a { flex:0 0 auto; padding:var(--space-2) var(--space-4); color:var(--ink-500); font-size:var(--text-md); font-weight:500; text-decoration:none; border-bottom:2px solid transparent; white-space:nowrap; }
.sid-tabs a:hover { color:var(--brand-600); background:var(--brand-50); }
.sid-tabs a.active { color:var(--brand-700); font-weight:600; border-bottom-color:var(--brand-600); background:var(--brand-50); }

.sid-loading { display:flex; flex-direction:column; align-items:center; gap:var(--space-2); padding:4rem var(--space-4); color:var(--ink-400); font-size:var(--text-md); }
.sid-loading strong { color:var(--ink-700); font-size:var(--text-xl); font-weight:600; }
.sid-spinner { width:26px; height:26px; border:3px solid var(--line); border-top-color:var(--brand-600); border-radius:50%; animation:sid-spin .8s linear infinite; }
@keyframes sid-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .sid-spinner { animation-duration:2.4s; } }

/* A flat band, not a floating card -- it belongs to the tab strip above
   it, the way Maximizer's own filter row does. */
.sid-filter-bar { display:flex; flex-wrap:wrap; align-items:end; gap:var(--space-4); padding:var(--space-3) var(--space-4); margin-bottom:var(--space-4); background:var(--surface-3); border:1px solid var(--line); border-top:0; border-radius:0 0 var(--radius-md) var(--radius-md); }
.sid-filter { position:relative; display:grid; gap:var(--space-1); }
.sid-filter-label { color:var(--ink-400); font-size:var(--text-2xs); text-transform:uppercase; letter-spacing:.04em; }
.sid-filter-control { min-height:2.3rem; min-width:9rem; padding:var(--space-2) var(--space-2); border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface-1); color:var(--ink-800); font:inherit; text-align:left; display:inline-flex; align-items:center; justify-content:space-between; gap:var(--space-2); }
.sid-owner-menu { position:absolute; top:100%; left:0; z-index:20; margin-top:var(--space-1); width:16rem; max-height:16rem; overflow:auto; padding:var(--space-2); background:var(--surface-1); border:1px solid var(--line-strong); border-radius:var(--radius-md); box-shadow:var(--shadow-lg); }
.sid-owner-menu-actions { display:flex; gap:var(--space-2); padding:var(--space-0) var(--space-0) var(--space-2); border-bottom:1px solid var(--line-soft); margin-bottom:var(--space-1); }
.sid-owner-menu-actions button { flex:1; border:0; background:var(--brand-50); color:var(--brand-600); border-radius:var(--radius-sm); padding:var(--space-1); font-size:var(--text-xs); }
.sid-owner-option { display:flex; align-items:center; gap:var(--space-2); padding:var(--space-1) var(--space-1); font-size:var(--text-sm); color:var(--ink-700); }
.sid-owner-option input { width:auto; }
.sid-filter-reset { align-self:end; display:inline-flex; align-items:center; gap:var(--space-1); border:0; background:transparent; color:var(--brand-600); font-size:var(--text-sm); padding:var(--space-2) var(--space-1); }
.sid-filter-reset .material-icons { font-size:var(--text-lg); }
/* DashboardMultiPick: a click outside the open menu lands on this and closes it. */
.sid-menu-backdrop { position:fixed; inset:0; z-index:19; background:transparent; }
.sid-pick-summary { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:12rem; }
.sid-pick-search { width:100%; margin:0 0 var(--space-1); }
.sid-pick-section { padding:var(--space-2) var(--space-1) var(--space-1); color:var(--ink-400); font-size:var(--text-2xs); font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.sid-pick-empty { padding:var(--space-2) var(--space-1); margin:0; }

/* KPI tiles -- Maximizer's anatomy: plain title top-left, a centred
   caption over an oversized light-weight figure, and a label/value
   footer line. The card is neutral; only the figure carries the
   won / in-progress / lost colour, because only the figure means one. */
.sid-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:var(--space-3); margin:0 0 var(--space-3); }
.sid-kpi { display:flex; flex-direction:column; background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-4) var(--space-4) 0; box-shadow:var(--shadow-sm), var(--highlight-top); transition:box-shadow .16s ease, transform .16s ease; }
.sid-kpi:hover { box-shadow:var(--shadow-raise), var(--highlight-top); transform:translateY(-1px); }
.sid-kpi-title { margin:0; font-size:var(--text-lg); font-weight:400; color:var(--ink-700); }
.sid-kpi-title a { color:inherit; text-decoration:none; }
.sid-kpi-title a:hover { color:var(--brand-600); text-decoration:underline; }
.sid-kpi-body { display:flex; flex-direction:column; align-items:center; gap:var(--space-0); padding:var(--space-2) 0 var(--space-3); }
.sid-kpi-caption { color:var(--ink-400); font-size:var(--text-md); }
.sid-kpi-figure { font-size:var(--text-4xl); font-weight:300; line-height:1.15; letter-spacing:-.01em; font-variant-numeric:tabular-nums; }
.sid-kpi-figure.tone-positive { color:var(--data-won); }
.sid-kpi-figure.tone-in-progress { color:var(--data-progress); }
.sid-kpi-figure.tone-negative { color:var(--data-lost); }
.sid-kpi-figure.tone-neutral { color:var(--brand-600); }
.sid-kpi-foot { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); padding:var(--space-2) 0; border-top:1px solid var(--line-soft); color:var(--ink-300); font-size:var(--text-xs); min-height:1.9rem; }
.sid-kpi-foot span:last-child { color:var(--ink-500); font-variant-numeric:tabular-nums; }

/* Panels -- flat bordered cards, plain titles, dense content. */
.sid .sales-dashboard-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(360px,1fr)); gap:var(--space-3); }
.sid-panel { min-width:0; background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); overflow:hidden; box-shadow:var(--shadow-sm), var(--highlight-top); }
.sid-panel.wide { grid-column:span 2; }
.sid-panel-head { display:flex; align-items:baseline; gap:var(--space-2); padding:var(--space-3) var(--space-4) var(--space-1); }
.sid-panel-head h2 { margin:0; font-size:var(--text-lg); font-weight:400; color:var(--ink-700); }
.sid-panel-subtitle { color:var(--ink-300); font-size:var(--text-xs); }
.sid-panel-link { margin-left:auto; color:var(--brand-600); font-size:var(--text-xs); text-decoration:none; white-space:nowrap; }
.sid-panel-link:hover { text-decoration:underline; }

/* Bordered data grid, like Maximizer's own report tables. */
.sid-panel .dashboard-table { padding:var(--space-2) var(--space-4) var(--space-4); }
.sid-panel .dashboard-table table { border:1px solid var(--line); }
.sid-panel .dashboard-table th { background:var(--surface-2); border:1px solid var(--line); color:var(--ink-500); font-size:var(--text-xs); font-weight:600; text-transform:none; letter-spacing:0; padding:var(--space-2) var(--space-3); }
.sid-panel .dashboard-table td { border:1px solid var(--line-soft); padding:var(--space-2) var(--space-3); font-size:var(--text-sm); }
/* Wide tables scroll inside their own panel rather than being clipped
   by the next panel in the grid -- the first build cut the amount and
   close-date columns off entirely. */
.sid .dashboard-table { overflow-x:auto; }

/* The shared .dashboard-bar grid gives its value column a fixed 28px,
   which suited the rep dashboard's two-digit counts but clipped
   "ZAR5.19M" to "ZAR5.1". Size it to the content instead, and let the
   label truncate rather than the figure -- the number is the point. */
.sid .dashboard-bar { grid-template-columns:minmax(0,120px) 1fr auto; }
.sid .dashboard-bar > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sid .dashboard-bar strong { min-width:4.5rem; font-variant-numeric:tabular-nums; }
.sid-group-row th { background:var(--surface-1) !important; border-left:1px solid var(--line) !important; border-right:1px solid var(--line) !important; color:var(--ink-700) !important; font-weight:700 !important; text-align:left; }
.sid-table-pager { display:flex; align-items:center; gap:var(--space-2); padding:0 var(--space-4) var(--space-4); color:var(--ink-300); font-size:var(--text-xs); }
.sid-table-pager .button.small { padding:var(--space-1) var(--space-2); font-size:var(--text-xs); }

.report-dashboard-strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:var(--space-3); margin:var(--space-3) 0; }
.report-dashboard-card { display:flex; flex-direction:column; gap:var(--space-1); padding:var(--space-4) var(--space-4); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:linear-gradient(110deg,var(--brand-50),var(--surface-1)); color:var(--ink-800); text-decoration:none; transition:transform .15s ease,box-shadow .15s ease; }
.report-dashboard-card:hover, .report-dashboard-card:focus-visible { transform:translateY(-1px); box-shadow:var(--shadow-raise); outline:none; }
.report-dashboard-card span { color:var(--ink-500); font-size:var(--text-sm); line-height:1.35; }

html.theme-dark .sid-filter-bar,
html.theme-dark .sid-kpi,
html.theme-dark .sid-panel,
html.theme-dark .sid-meta-action,
html.theme-dark .sid-owner-menu { background:var(--crm-surface); border-color:var(--crm-line); color:var(--crm-text); }
html.theme-dark .sid-header h1,
html.theme-dark .sid-kpi-title,
html.theme-dark .sid-panel-head h2 { color:var(--crm-text); }
/* The blanket `html.theme-dark a` rule below outranks
   `.sid-kpi-title a { color: inherit }` on specificity, so every KPI
   heading turned link-blue in dark mode. */
html.theme-dark .sid-kpi-title a { color:inherit; }
html.theme-dark .sid-kpi-foot { border-top-color:var(--crm-line); }
html.theme-dark .sid-panel .dashboard-table table,
html.theme-dark .sid-panel .dashboard-table th,
html.theme-dark .sid-panel .dashboard-table td { border-color:var(--crm-line); }
html.theme-dark .sid-panel .dashboard-table th { background:var(--crm-surface-raised); color:var(--crm-muted); }
html.theme-dark .sid-group-row th { background:var(--crm-surface) !important; color:var(--crm-text) !important; }
html.theme-dark .sid-tabs { border-bottom-color:var(--crm-line); }
html.theme-dark .sid-tabs a { color:var(--crm-muted); }
html.theme-dark .sid-tabs a:hover, html.theme-dark .sid-tabs a.active { background:var(--crm-surface-raised); color:var(--brand-400); }
html.theme-dark .sid-loading strong { color:var(--crm-text); }
/* No dark override for .sid-kpi-figure on purpose: its colour comes
   from the --data-* tokens via the tone classes, which already have
   dark variants. Forcing --crm-text here turned every figure white and
   threw away the won / in-progress / lost meaning. */
html.theme-dark .sid-filter-control { background:var(--crm-surface-raised); color:var(--crm-text); border-color:var(--crm-line); }
html.theme-dark .report-dashboard-card { background:var(--crm-surface); border-color:var(--crm-line); color:var(--crm-text); }

@media (max-width:1100px) { .sid-panel.wide { grid-column:span 1; } }
@media (max-width:700px) { .sid { padding:var(--space-3); } .sid-header { flex-direction:column; align-items:flex-start; gap:var(--space-2); } }
.report-search { display:flex; gap:var(--space-2); align-items:center; flex:1; max-width:480px; border:1px solid var(--line); border-radius:var(--radius-sm); padding:0 var(--space-3); color:var(--muted); }
.report-search input { width:100%; border:0; outline:0; padding:var(--space-2) 0; background:transparent; }
.report-library-toolbar select { min-width:150px; }
.report-count { color:var(--muted); font-size:var(--text-md); white-space:nowrap; }
.report-library-body { display:grid; grid-template-columns:210px minmax(0, 1fr); min-height:470px; background:var(--surface-1); border:1px solid var(--line); border-radius:0 0 var(--radius-md) var(--radius-md); overflow:hidden; }
.report-library-nav { padding:var(--space-4) 0; border-right:1px solid var(--line); background:var(--surface-2); }
.report-library-nav p { margin:var(--space-1) var(--space-4) var(--space-2); color:var(--ink-400); font-size:var(--text-2xs); font-weight:700; letter-spacing:.07em; }
.report-table-head button { border:0; background:transparent; color:inherit; font:inherit; font-weight:700; letter-spacing:inherit; text-align:left; padding:0; cursor:pointer; }
.report-table-head button:hover { color:var(--brand-600); }
.report-library-nav button { width:100%; text-align:left; padding:var(--space-2) var(--space-4); border:0; background:transparent; color:var(--ink-700); font-size:var(--text-md); }
.report-library-nav button:hover, .report-library-nav button.active { background:var(--brand-100); color:var(--brand-600); font-weight:600; }
.report-library-nav .report-starter-install { color:var(--crm-primary,var(--brand-600)); font-weight:600; border:1px dashed var(--line-strong); background:var(--surface-3); }
.report-library-nav .report-starter-install:hover:not(:disabled) { background:var(--brand-100); border-color:var(--brand-600); }
.report-library-nav .report-starter-install:disabled { opacity:.65; cursor:wait; }
.report-starter-message { margin:var(--space-1) var(--space-4) var(--space-2); color:var(--ink-500); font-size:var(--text-xs); line-height:1.35; }
.report-library-main { min-width:0; container-type: inline-size; }
.report-table-head, .report-row { display:grid; grid-template-columns:minmax(260px,2.25fr) minmax(120px,.9fr) minmax(120px,.9fr) 100px minmax(190px,1.3fr); gap:var(--space-4); align-items:center; }
.report-table-head { padding:var(--space-3) var(--space-5); border-bottom:1px solid var(--line); color:var(--ink-400); font-size:var(--text-2xs); font-weight:700; letter-spacing:.04em; }
.report-row { padding:var(--space-4) var(--space-5); border-bottom:1px solid var(--line-soft); font-size:var(--text-md); color:var(--ink-500); }
.report-row:hover { background:var(--surface-2); }
/* The available list width also depends on the saved navigation mode. */
@container (max-width: 900px) {
    .report-table-head { display: flex; flex-wrap: wrap; gap: var(--space-3); }
    .report-row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); }
    .report-row > :first-child { grid-column: 1 / -1; }
    .report-row .report-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}
@container (max-width: 380px) {
    .report-row { grid-template-columns: minmax(0, 1fr); }
}
.report-name { border:0; background:transparent; padding:0; color:var(--brand-600); font-size:var(--text-lg); font-weight:600; text-align:left; }
.report-name:hover { text-decoration:underline; }
.report-row p { margin:var(--space-1) 0 0; color:var(--ink-400); font-size:var(--text-xs); line-height:1.35; }
.report-folder { display:inline-flex; width:max-content; background:var(--surface-3); color:var(--ink-500); border-radius:var(--radius-lg); padding:var(--space-1) var(--space-2); font-size:var(--text-xs); }
.report-actions { display:flex; justify-content:flex-end; gap:var(--space-1); }
.report-actions button { border:0; background:transparent; color:var(--brand-600); font-size:var(--text-xs); padding:var(--space-1); }
.report-actions button.danger { color:var(--error-text); }
.report-empty { text-align:center; padding:4.5rem var(--space-5); color:var(--muted); }
.report-empty h2 { margin:var(--space-3) 0 var(--space-1); color:var(--text); font-size:var(--text-2xl); }.report-empty p { margin:0 0 var(--space-5); }.report-empty-icon { display:inline-flex; width:42px; height:42px; align-items:center; justify-content:center; border-radius:50%; background:var(--brand-100); color:var(--brand-600); font-size:var(--text-3xl); }
.report-result { background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-5); }
.report-result > header { border-bottom:1px solid var(--line); padding-bottom:var(--space-4); }.report-result > header > div:last-child { display:flex; gap:var(--space-2); }.back-link { border:0; background:transparent; color:var(--brand-600); padding:0; margin-bottom:var(--space-2); }.report-result-meta { display:flex; gap:var(--space-5); color:var(--ink-500); font-size:var(--text-md); padding:var(--space-4) 0; }.report-result-meta span:not(:last-child)::after { content:""; border-right:1px solid var(--line); margin-left:var(--space-5); }
.report-data-table { width:100%; border-collapse:collapse; font-size:var(--text-md); }.report-data-table th { background:var(--surface-2); padding:var(--space-3) var(--space-3); color:var(--ink-500); font-size:var(--text-xs); letter-spacing:.03em; text-align:left; }.report-data-table td { padding:var(--space-3) var(--space-3); border-bottom:1px solid var(--line-soft); color:var(--ink-700); }
.report-view-tabs { display:flex; gap:var(--space-4); border-bottom:1px solid var(--line); margin-bottom:var(--space-5); }.report-view-tabs button { padding:var(--space-2) var(--space-1); border:0; border-bottom:2px solid transparent; background:transparent; color:var(--ink-500); font-weight:600; }.report-view-tabs button.active { color:var(--brand-600); border-bottom-color:var(--brand-600); }.report-bars { padding:var(--space-2) var(--space-2) var(--space-4); max-width:850px; }.report-bar-row { display:grid; grid-template-columns:180px minmax(120px,1fr) 45px; gap:var(--space-3); align-items:center; margin:var(--space-3) 0; color:var(--ink-600); font-size:var(--text-md); }.report-bar-row > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:right; }.report-bar-row > div { height:22px; background:var(--surface-3); border-radius:var(--radius-sm); overflow:hidden; }.report-bar-row i { display:block; height:100%; min-width:5px; background:linear-gradient(90deg,var(--brand-600),var(--brand-400)); border-radius:var(--radius-sm); }.report-bar-row strong { color:var(--ink-800); font-size:var(--text-sm); }.report-donut-layout { display:flex; align-items:center; justify-content:center; gap:3rem; padding:var(--space-5) var(--space-4); }.report-donut { position:relative; width:230px; height:230px; border-radius:50%; display:grid; place-items:center; }.report-donut::after { content:""; position:absolute; width:138px; height:138px; border-radius:50%; background:var(--surface-1); }.report-donut span { position:relative; z-index:1; text-align:center; color:var(--ink-800); font-size:var(--text-3xl); font-weight:700; line-height:1.1; }.report-donut small { color:var(--ink-400); font-size:var(--text-xs); font-weight:500; }.report-chart-legend { min-width:240px; max-width:380px; }.report-chart-legend div { display:grid; grid-template-columns:12px 1fr auto; gap:var(--space-2); align-items:center; padding:var(--space-2) 0; border-bottom:1px solid var(--line-soft); color:var(--ink-500); font-size:var(--text-md); }.report-chart-legend i { width:10px; height:10px; border-radius:2px; }.report-chart-legend strong { color:var(--ink-800); }
.report-step { color:var(--brand-600); font-size:var(--text-xs); font-weight:700; letter-spacing:.07em; margin-bottom:var(--space-2); }.report-create-step { width:min(510px, calc(100vw - 2rem)); }.report-create-step h3, .report-builder h3 { margin:0 0 var(--space-2); font-size:var(--text-xl); }.modal.report-builder { width:min(1040px, calc(100vw - 2rem)); max-width:min(1040px, calc(100vw - 2rem)); min-width:0; max-height:calc(100vh - 2rem); overflow:auto; resize:both; }.report-builder-grid { display:grid; grid-template-columns:minmax(0, .9fr) minmax(0, 1.4fr); gap:var(--space-6); border-top:1px solid var(--line); border-bottom:1px solid var(--line); padding:var(--space-5) 0; }.report-builder-grid > section { min-width:0; }.report-builder-grid > section + section { border-left:1px solid var(--line); padding-left:var(--space-6); }.report-builder label, .report-create-step label { display:block; margin:var(--space-3) 0 var(--space-1); font-size:var(--text-sm); color:var(--ink-600); font-weight:600; }.report-builder input:not([type=checkbox]), .report-builder textarea, .report-builder select, .report-create-step input, .report-create-step select { width:100%; min-width:0; min-height:2.5rem; padding:var(--space-2) var(--space-3); border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-1); color:var(--text); font:inherit; }.report-builder textarea { resize:vertical; }.report-builder .report-name-input { min-height:3rem; font-size:var(--text-xl); border-color:var(--line-strong); box-shadow:0 0 0 2px var(--brand-100); }.report-builder .required { color:var(--error-text); }.report-fields { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-1) var(--space-3); }.report-field { font-weight:400!important; color:var(--ink-700)!important; margin:var(--space-0) 0!important; }.report-field input { width:auto; margin-right:var(--space-1); }.report-date-row { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-3); }
@media (max-width: 800px) { .report-dashboard-callout { align-items:flex-start; flex-direction:column; }.report-library-body { grid-template-columns:1fr; }.report-library-nav { display:flex; gap:var(--space-1); overflow:auto; border-right:0; border-bottom:1px solid var(--line); padding:var(--space-2); }.report-library-nav p { display:none; }.report-library-nav button { width:auto; white-space:nowrap; }.report-table-head { display:none; }.report-row { grid-template-columns:1fr; gap:var(--space-2); }.report-actions { justify-content:flex-start; }.report-library-toolbar { flex-wrap:wrap; }.report-search { flex:1 1 100%; max-width:none; }.report-builder-grid { grid-template-columns:1fr; }.report-builder-grid > section + section { border-left:0; border-top:1px solid var(--line); padding:var(--space-4) 0 0; }.report-library-header, .report-result > header { flex-direction:column; }.report-result > header > div:last-child { width:100%; }.report-result > header > div:last-child .button { flex:1; } }

/* --- calendar ----------------------------------------------------------
   Mark spec, kept consistent with the rest of the app's badge/pill
   language rather than inventing a new one: task items get the same
   neutral chip as the Hotlist priority badge, appointments get the
   blue used for the "contact" badge elsewhere -- identity by fixed
   colour per type, not per record. */
.calendar-toolbar { display: flex; gap: var(--space-2); margin: 0 0 var(--space-5); }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(7rem, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
}
.calendar-grid:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.calendar-day, .calendar-item { min-width: 0; }
.calendar-owner-picker { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); color: var(--ink-600); font-size: var(--text-sm); }
.calendar-owner-picker select { padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-800); font: inherit; }

.calendar-weekday {
    background:var(--surface-2);
    color: var(--muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .02em;
    text-align: center;
    padding: var(--space-2) 0;
}

.calendar-day {
    background: var(--surface);
    min-height: 6.5rem;
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.calendar-day-outside { background:var(--surface-2); }
.calendar-day-outside .calendar-day-number { color: var(--muted); }
.calendar-day-today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day-today .calendar-day-number { color: var(--accent); }

.calendar-day-header { display: flex; justify-content: space-between; align-items: center; }
.calendar-day-number { font-size: var(--text-sm); font-weight: 600; }

.calendar-day-add {
    background: none; border: 0; color: var(--muted); cursor: pointer;
    font-size: var(--text-lg); line-height: 1; padding: var(--space-1) var(--space-2); opacity: 0;
}
.calendar-day:hover .calendar-day-add,
.calendar-day:focus-within .calendar-day-add,
.calendar-agenda-day .calendar-day-add { opacity: 1; }
@media (hover: none) { .calendar-day-add { opacity: 1; } }
.calendar-day-add:hover { color: var(--accent); }

.calendar-day-items { display: flex; flex-direction: column; gap: var(--space-0); overflow: hidden; }

.calendar-item {
    display: flex; align-items: baseline; gap: var(--space-1);
    width: 100%; border: 0; text-align: left; font-family: inherit;
    padding: var(--space-0) var(--space-1); border-radius: var(--radius-sm); font-size: var(--text-xs);
    cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.calendar-item-task { background:var(--surface-2); color: var(--text); }
.calendar-item-appointment { background:var(--module-opportunity-soft); color:var(--ink-700); box-shadow: inset 2px 0 var(--module-opportunity); }
.calendar-item-done { opacity: .55; text-decoration: line-through; }
.calendar-item-time { font-weight: 600; flex-shrink: 0; }
.calendar-item-subject { overflow: hidden; text-overflow: ellipsis; }
.calendar-item:hover { filter: brightness(0.95); }

.calendar-more { padding: 0 var(--space-1); }
.sales-inbox-page .module-page-header { margin-bottom:var(--space-4); }
.email-inbox-toolbar { display:flex; gap:var(--space-2); align-items:center; margin:0 0 var(--space-3); }
.email-inbox-toolbar input { flex:1; min-width:12rem; border:1px solid var(--border); border-radius:var(--radius-sm); padding:var(--space-3) var(--space-3); background:var(--surface); color:var(--text); }
.email-inbox-toolbar select { min-height:2.45rem; border:1px solid var(--border); border-radius:var(--radius-sm); padding:var(--space-1) var(--space-3); background:var(--surface); color:var(--text); }
.email-inbox { display:grid; grid-template-columns:minmax(18rem,30rem) minmax(0,1fr); min-height:34rem; border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--surface); box-shadow:0 6px 20px rgba(20,30,80,.06); }
.email-thread-list { display:flex; flex-direction:column; overflow:auto; border-right:1px solid var(--border); background:var(--surface-2); }
.email-thread { display:flex; flex-direction:column; gap:var(--space-1); width:100%; border:0; border-bottom:1px solid var(--border); padding:var(--space-3) var(--space-4); text-align:left; background:transparent; color:var(--text); cursor:pointer; }
.email-thread:hover,.email-thread.selected { background:var(--brand-100); }
.email-thread strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink-900); }
.email-thread span,.email-thread small { color:var(--muted); font-size:var(--text-sm); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.email-conversation { min-width:0; padding:var(--space-5); overflow:auto; }
.email-message { margin-top:var(--space-4); padding:var(--space-4); border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); }
.email-message > div { display:flex; justify-content:space-between; gap:var(--space-4); padding-bottom:var(--space-2); border-bottom:1px solid var(--border); }
.email-message small { color:var(--muted); white-space:nowrap; }.email-message p { white-space:pre-wrap; line-height:1.55; margin:var(--space-3) 0 0; }
.mail-folder-tabs{display:flex;gap:var(--space-1);margin-bottom:var(--space-3);border-bottom:1px solid var(--border)}
.mail-folder-tabs button{border:0;background:transparent;padding:var(--space-3) var(--space-4);color:var(--muted);font-weight:650;cursor:pointer;border-bottom:3px solid transparent}
.mail-folder-tabs button.active{color:var(--brand-600);border-bottom-color:var(--brand-500)}
.email-conversation-header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-4);padding-bottom:var(--space-4);border-bottom:1px solid var(--border)}
.email-conversation-header h2{margin:0 0 var(--space-1)}.email-conversation-header span{color:var(--muted)}.email-header-actions{display:flex;gap:var(--space-2)}
.email-message header{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:var(--space-3);padding-bottom:var(--space-3);border-bottom:1px solid var(--border)}
.email-message header>div:nth-child(2){display:flex;flex-direction:column}.email-message h3{font-size:var(--text-xl);margin:var(--space-3) 0 var(--space-1)}.email-message header small{white-space:normal}
.mail-direction{font-size:var(--text-xs);font-weight:750;border-radius:var(--radius-pill);padding:var(--space-1) var(--space-2)}.mail-direction.inbound{background:var(--success-bg);color:var(--success)}.mail-direction.outbound{background:var(--brand-100);color:var(--brand-600)}
.message-actions{display:flex!important;flex-direction:row!important;align-items:center;gap:var(--space-2)}.message-actions a,.message-actions button{border:0;background:transparent;color:var(--brand-600);font:inherit;font-weight:650;cursor:pointer}.filed-badge{font-size:var(--text-xs);color:var(--success);background:var(--success-bg);border-radius:var(--radius-pill);padding:var(--space-1) var(--space-2)}
.message-attachments{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-3)}.message-attachments span{font-size:var(--text-sm);padding:var(--space-1) var(--space-2);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface-2)}
.email-thread em{font-style:normal;color:var(--success);background:var(--success-bg);border-radius:var(--radius-pill);padding:var(--space-0) var(--space-1);margin-left:var(--space-1)}
.email-filing-dialog{width:min(46rem,calc(100vw - 2rem));max-width:none;padding:0;overflow:hidden}.email-filing-dialog>header{display:flex;justify-content:space-between;gap:var(--space-4);padding:var(--space-5) var(--space-5);background:linear-gradient(135deg,var(--brand-50),var(--surface-2));border-bottom:1px solid var(--border)}
.email-filing-dialog h2{margin:0}.email-filing-dialog header p{margin:var(--space-1) 0 0;color:var(--muted)}.email-filing-dialog>label{display:block;font-weight:700;margin:var(--space-4) var(--space-5) var(--space-2)}
.record-search-box{display:flex;align-items:center;gap:var(--space-2);margin:0 var(--space-5);border:1px solid var(--brand-300);border-radius:var(--radius-md);padding:0 var(--space-3);background:var(--surface)}.record-search-box input{width:100%;border:0;outline:0;padding:var(--space-3) 0;background:transparent;color:var(--text)}
.email-record-results{max-height:20rem;overflow:auto;margin:var(--space-3) var(--space-5);border:1px solid var(--border);border-radius:var(--radius-md)}.email-record-results button{display:grid;grid-template-columns:6.5rem minmax(0,1fr) auto;align-items:center;gap:var(--space-3);width:100%;padding:var(--space-3);border:0;border-bottom:1px solid var(--border);background:var(--surface);text-align:left;color:var(--text);cursor:pointer}.email-record-results button:hover{background:var(--brand-100)}.email-record-results button>span:nth-child(2){display:flex;flex-direction:column}.email-record-results small{color:var(--muted)}
.record-kind{display:inline-flex;justify-content:center;border-radius:var(--radius-pill);padding:var(--space-1) var(--space-2);font-size:var(--text-xs);font-weight:750;background:var(--surface-2)}.record-kind.company{color:var(--success)}.record-kind.person{color:var(--module-person)}.record-kind.case{color:var(--module-case)}.record-kind.opportunity{color:var(--module-opportunity)}.record-kind.lead{color:var(--module-lead)}
.no-record-match{display:flex;flex-direction:column;margin:var(--space-3) var(--space-5);padding:var(--space-4);border-radius:var(--radius-md);background:var(--surface-2)}.no-record-match span{color:var(--muted)}.create-record-strip{display:flex;flex-wrap:wrap;gap:var(--space-2);align-items:center;margin:var(--space-4) var(--space-5);padding-top:var(--space-4);border-top:1px solid var(--border)}.create-record-strip a{font-weight:650}.email-filing-dialog footer{display:flex;justify-content:flex-end;padding:var(--space-3) var(--space-5);border-top:1px solid var(--border)}
.email-interactions-panel{border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);overflow:hidden}.interaction-panel-heading{display:flex;justify-content:space-between;align-items:center;padding:var(--space-4) var(--space-5);background:linear-gradient(90deg,var(--brand-50),var(--surface-2))}.interaction-panel-heading h2{margin:0}.interaction-panel-heading p{margin:var(--space-1) 0 0;color:var(--muted)}
.interaction-list{display:flex;flex-direction:column}.interaction-row{display:grid;grid-template-columns:2rem minmax(0,1fr) 11rem;gap:var(--space-3);align-items:center;border:0;border-bottom:1px solid var(--border);background:var(--surface);padding:var(--space-3) var(--space-4);text-align:left;color:var(--text);cursor:pointer}.interaction-row:hover{background:var(--surface-2)}.interaction-row>span:nth-child(2),.interaction-meta{display:flex;flex-direction:column}.interaction-row small{color:var(--muted)}.interaction-meta{text-align:right}.interaction-direction{display:grid;place-items:center;width:1.8rem;height:1.8rem;border-radius:50%;font-weight:800}.interaction-direction.inbound{background:var(--success-bg);color:var(--success)}.interaction-direction.outbound{background:var(--brand-100);color:var(--brand-600)}
.email-viewer{width:min(62rem,calc(100vw - 2rem));max-width:none;max-height:88vh;overflow:auto;padding:0}.email-viewer-actions{display:flex;gap:var(--space-2);align-items:center;padding:var(--space-3) var(--space-4);background:var(--nav-mid)}.email-viewer-actions .icon-button{margin-left:auto;color:var(--on-accent)}.email-viewer>h2{padding:var(--space-4) var(--space-5);margin:0;border-bottom:1px solid var(--border)}.email-headers{display:grid;grid-template-columns:4rem 1fr;gap:var(--space-1) var(--space-3);padding:var(--space-4) var(--space-5);margin:0;border-bottom:1px solid var(--border)}.email-headers dt{font-weight:700}.email-headers dd{margin:0}.email-viewer-body{padding:var(--space-5);white-space:pre-wrap;line-height:1.55;min-height:12rem}.email-attachments{display:flex;flex-wrap:wrap;gap:var(--space-2);padding:var(--space-4) var(--space-5);border-top:1px solid var(--border)}.email-attachments strong{width:100%}.email-attachments a{padding:var(--space-2) var(--space-3);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface-2)}
@media (max-width:850px) { .email-inbox { grid-template-columns:1fr; }.email-thread-list { max-height:20rem; border-right:0; border-bottom:1px solid var(--border); }.email-inbox-toolbar { align-items:stretch; flex-direction:column; } }
.calendar-toolbar { display:flex; justify-content:space-between; align-items:center; gap:var(--space-4); margin:0 0 var(--space-4); }
.calendar-nav,.calendar-view-switch { display:flex; gap:var(--space-1); align-items:center; }
.calendar-agenda { display:flex; flex-direction:column; gap:var(--space-2); }
.calendar-agenda-day { display:grid; grid-template-columns:10rem 1fr; min-height:4.75rem; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); overflow:hidden; }
.calendar-agenda-date { display:flex; align-items:center; gap:var(--space-2); padding:var(--space-3) var(--space-4); background:var(--surface-2); color:var(--text); }
.calendar-agenda-date span { color:var(--muted); }
.calendar-agenda-items { display:flex; flex-wrap:wrap; align-content:center; gap:var(--space-1); padding:var(--space-2) var(--space-3); }
.calendar-access-card { max-width:70rem; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:var(--space-5); box-shadow:0 8px 24px rgba(20,30,80,.08); }
.calendar-access-columns { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-4); margin:var(--space-5) 0 var(--space-5); }
.calendar-access-columns>div { border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-4); background:var(--surface-2); }
.calendar-access-card h3,.calendar-access-card h4 { margin:var(--space-0) 0 var(--space-2); }
.access-public { display:flex; align-items:center; gap:var(--space-2); font-weight:600; }
.calendar-principal-list { border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; margin:var(--space-3) 0 var(--space-5); }
.calendar-principal { display:grid; grid-template-columns:1fr 10rem 10rem; align-items:center; gap:var(--space-4); padding:var(--space-3) var(--space-3); border-bottom:1px solid var(--border); }
.calendar-principal:last-child { border-bottom:0; }
.calendar-principal span { display:flex; flex-direction:column; }.calendar-principal small { color:var(--muted); text-transform:capitalize; }
.calendar-defaults { display:flex; flex-wrap:wrap; gap:var(--space-4); align-items:end; padding-top:var(--space-4); border-top:1px solid var(--border); }.calendar-defaults label { display:flex; flex-direction:column; gap:var(--space-1); }
.calendar-defaults select,.calendar-defaults input { min-height:2.25rem; border:1px solid var(--border); border-radius:var(--radius-sm); padding:var(--space-1) var(--space-2); }
.form-actions { display:flex; justify-content:flex-end; gap:var(--space-2); margin-top:var(--space-5); }
@media (max-width:700px) { .calendar-access-columns,.calendar-principal { grid-template-columns:1fr; }.calendar-toolbar { align-items:flex-start; flex-direction:column; }.calendar-agenda-day { grid-template-columns:1fr; } }

@media (max-width: 640px) {
    .calendar-day { min-height: 4rem; }
    .calendar-weekday { font-size: var(--text-2xs); }
}

/* --- record read view (RecordFieldGrid.razor) ------------------------
   Zoho's Overview tab: a two-column label/value grid, label right-
   aligned against its value so the eye has a single seam to scan down
   rather than a ragged left edge. Two pairs per row on a wide screen,
   one on a narrow one -- the fields themselves are short, so a single
   column wastes most of the width the layout rework just freed up. */
.record-view .field-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-0) 2.5rem; margin: 0 0 var(--space-2);
}
@media (max-width: 700px) { .record-view .field-grid { grid-template-columns: minmax(0, 1fr); } }

.record-view .field-grid-row {
    display: grid; grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr);
    gap: var(--space-4); align-items: baseline; padding: var(--space-2) var(--space-2);
    border-bottom:1px solid var(--line-soft); border-radius:var(--radius-sm);
    transition:background-color .15s ease;
}
.record-view .field-grid-row:hover { background:var(--field-accent-soft); }
/* A long or multi-line value (a description, an email thread filed as a
   case) takes the full width and keeps its line breaks, instead of being
   squeezed into one column as a single run-on paragraph. */
.record-view .field-grid-row.wide { grid-column: 1 / -1; }
.record-view .field-grid-row.wide:hover { background: transparent; }
.record-view .field-grid-row.wide dd {
    max-height: 32rem; overflow-y: auto; padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--surface-2);
    font-size: var(--text-md); font-weight: 400; line-height: 1.6; white-space: pre-wrap;
}
.record-view .field-grid-row.wide dd.empty { padding: 0; border: 0; background: transparent; }
.record-view dt { text-align: right; font-size: var(--text-sm); color: var(--field-label); }
.record-view dd { margin: 0; font-size: var(--text-lg); color: var(--text); overflow-wrap: anywhere; font-weight:500; }
/* The global .empty class is a large empty-state card. A missing property
   in a record overview is only a value placeholder and must not inherit
   that card's padding/border (the old rule created giant dashed boxes). */
.record-view dd.empty {
    color: var(--ink-300);
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    text-align: left;
}
.record-view dd a { color: var(--accent); text-decoration: none; }
.record-view dd a:hover { text-decoration: underline; }

/* The read view carries its own section rhythm -- .detail-form's h2
   rule assumes a form's taller field spacing above it. */
.record-view h2 { margin-top: var(--space-5); padding-top: var(--space-4); }
.record-view h2:first-child { margin-top: 0; padding-top: 0; }
.layout-admin-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(22rem, .8fr); gap:var(--space-4); align-items:start; }
.layout-list { display:grid; gap:var(--space-2); }
.layout-list-item { display:flex; justify-content:space-between; align-items:center; gap:var(--space-3); padding:var(--space-3); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-1); }
.layout-list-item > div:first-child { display:grid; gap:var(--space-1); }
.layout-list-actions { display:flex; align-items:center; gap:var(--space-2); flex-wrap:wrap; justify-content:flex-end; }
.layout-section-editor { border:1px solid var(--line); border-radius:var(--radius-md); padding:var(--space-3); margin:var(--space-3) 0; background:var(--surface-1); }
.layout-section-editor h3 { margin:0 0 var(--space-2); font-size:var(--text-md); color:var(--ink-800); }
.layout-field-check { justify-content:flex-start; padding:var(--space-1) 0; }
.form-actions { display:flex; gap:var(--space-2); margin-top:var(--space-4); }
@media (max-width: 900px) { .layout-admin-grid { grid-template-columns:1fr; } }
.workqueue-view-settings { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-3) var(--space-4); margin-top:var(--space-3); padding:var(--space-3) var(--space-4); background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); color:var(--ink-600); font-size:var(--text-md); }.workqueue-view-settings label { display:flex; align-items:center; gap:var(--space-1); }
.workqueue-link { display:flex; justify-content:space-between; align-items:center; width:100%; box-sizing:border-box; padding:var(--space-3) var(--space-2); background:transparent; border:0; border-radius:var(--radius-sm); font:inherit; text-align:left; cursor:pointer; color:var(--ink-800); }
.workqueue-link:hover,.workqueue-link.active { background:var(--brand-100); color:var(--brand-500); }
.workqueue-table { margin-top:var(--space-4); background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); }
.workqueue-actions { display:flex; align-items:center; gap:var(--space-3); }.workqueue-actions input { min-width:13rem; padding:var(--space-2) var(--space-3); border:1px solid var(--line-strong); border-radius:var(--radius-sm); font:inherit; }
.workqueue-module-link-bar { display:flex; justify-content:space-between; align-items:center; gap:var(--space-3); margin-top:var(--space-3); padding:var(--space-2) var(--space-3); background:var(--brand-100); border:1px solid var(--line-strong); border-radius:var(--radius-md); color:var(--ink-600); font-size:var(--text-sm); }.workqueue-module-link-bar a { color:var(--brand-600); font-weight:600; text-decoration:none; }.workqueue-module-link-bar a:hover { text-decoration:underline; }
.workqueue-pagination,.report-pagination { display:flex; align-items:center; justify-content:flex-end; gap:var(--space-3); padding:var(--space-3) var(--space-4); color:var(--ink-400); font-size:var(--text-md); background:var(--surface-1); border:1px solid var(--line); border-top:0; border-radius:0 0 var(--radius-md) var(--radius-md); }.workqueue-pagination label,.report-pagination label { display:flex; align-items:center; gap:var(--space-1); }.workqueue-pagination select,.report-pagination select { padding:var(--space-1) var(--space-2); border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface-1); }
.table-sort-button { border:0; background:transparent; padding:0; color:inherit; font:inherit; font-weight:600; cursor:pointer; text-align:left; }.table-sort-button:hover { color:var(--brand-600); }
@media (max-width: 900px) { .workqueue-page { grid-template-columns:1fr; } .workqueue-sidebar { display:flex; flex-wrap:wrap; gap:var(--space-1); } .workqueue-sidebar h2,.workqueue-sidebar h3,.workqueue-sidebar hr,.workqueue-sidebar select { width:100%; } .workqueue-actions { flex-wrap:wrap; } .workqueue-actions input { min-width:0; flex:1 1 12rem; } }
/* Additional report visualisations */
.report-line-chart { padding:var(--space-5) var(--space-4) var(--space-4); max-width:900px; }
.report-line-chart svg { display:block; width:100%; height:260px; overflow:visible; background:linear-gradient(to bottom,transparent 24%,var(--surface-3) 25%,transparent 26%,transparent 49%,var(--surface-3) 50%,transparent 51%,transparent 74%,var(--surface-3) 75%,transparent 76%); border-bottom:1px solid var(--line); }
.report-line-labels { display:grid; grid-template-columns:repeat(auto-fit,minmax(0,1fr)); gap:var(--space-2); margin-top:var(--space-3); color:var(--ink-500); font-size:var(--text-xs); text-align:center; }
.report-line-labels span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.report-funnel-chart { display:flex; flex-direction:column; align-items:center; gap:var(--space-1); padding:var(--space-5) var(--space-4) var(--space-5); }
.report-funnel-segment { display:flex; justify-content:space-between; align-items:center; gap:var(--space-4); min-width:24%; padding:var(--space-3) var(--space-4); color:var(--on-accent); clip-path:polygon(3% 0,97% 0,90% 100%,10% 100%); font-size:var(--text-sm); transition:width .2s ease; }
.report-funnel-segment span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.report-funnel-segment strong { flex:0 0 auto; }
.dashboard-customize { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-3) var(--space-4); margin-bottom:var(--space-4); padding:var(--space-3) var(--space-4); background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-md); color:var(--ink-600); font-size:var(--text-sm); }
.dashboard-customize label { display:flex; align-items:center; gap:var(--space-1); }
/* Report condition editor layout */
.report-condition-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,.9fr) minmax(0,1.2fr) auto; gap:var(--space-2); align-items:center; margin:var(--space-2) 0; }
.report-condition-row input:disabled { background:var(--surface-2); color:var(--ink-400); }
.report-condition-row .button { min-height:2.5rem; padding:var(--space-2) var(--space-3); }
.report-condition-draft { border-top:1px dashed var(--line); padding-top:var(--space-2); margin-top:var(--space-3); }
@media (max-width:800px) {
  .report-condition-row { grid-template-columns:1fr 1fr; }
  .report-condition-row input { grid-column:1 / -1; }
  .report-condition-row .button { justify-self:start; }
}
.report-truncated-warning, .workqueue-truncated { color:var(--warning); background:var(--warning-bg); border:1px solid var(--warning-line); border-radius:var(--radius-sm); padding:var(--space-1) var(--space-2); font-size:var(--text-xs); }
.workqueue-truncated { margin-top:var(--space-3); }
.layout-error { max-width:40rem; margin:4rem auto; padding:2.5rem; background:var(--surface-1); border:1px solid var(--line); border-radius:var(--radius-lg); text-align:center; box-shadow:var(--shadow-md); }.layout-error h1 { margin:0 0 var(--space-3); color:var(--ink-800); }.layout-error p { margin:0 0 var(--space-5); color:var(--ink-400); }

/* --- app chrome density ----------------------------------------------
   Measured against Maximizer's own shell (2026-09-04) because "the app
   looks amateur" turned out to be mostly this: our chrome was
   systematically bigger and heavier than the reference, so it competed
   with the data instead of receding behind it.

       reference   before   after
   top bar      38px     65px     48px
   rail width  207px    240px    208px
   nav row      36px     42px     36px
   nav label 14px/400 15px/500 14px/400
   nav icon     ~16px     24px     20px

   Not matched to 38px exactly: this bar carries a search field and a
   row of 36px controls, which 38px cannot hold without clipping them.
   The numbers themselves live on .app-shell as --appbar-h and --rail-w
   (see the app shell block above) so the rail and the content offset
   read them from one place. -------------------------------------------- */

/* The "Rows" page-size control on list toolbars -- a label stacked over a
   native select, matching SavedViewsBar's own filter. */
.list-rows { display: inline-flex; flex-direction: column; gap: var(--space-0); flex: 0 0 auto;
    font-size: var(--text-2xs); color: var(--ink-400); text-transform: uppercase; letter-spacing: .04em; }
.list-rows select { min-width: 5rem; padding: var(--space-1) var(--space-2); font-size: var(--text-md);
    border: 1px solid var(--line-strong); border-radius: var(--radius-md);
    background: var(--surface-1); color: var(--ink-800); font-family: inherit;
    text-transform: none; letter-spacing: 0; }

/* --- list-page filter rail (ListFilterPanel) ------------------------
   Zoho's own list layout: a persistent filter panel down the left, the
   results to its right. The panel is toggled from the toolbar and its
   open state is remembered per module. */
.list-shell { display: block; }
.list-shell.with-filter { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.list-main { min-width: 0; }

.list-filter { position: sticky; top: calc(var(--appbar-h, 54px) + var(--space-3));
    display: flex; flex-direction: column; max-height: calc(100vh - var(--appbar-h, 54px) - var(--space-5));
    background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), var(--highlight-top); overflow: hidden; }
/* Inside a form (the workflow rule builder) the rail is just a
   fieldset: nothing to stick to, and no list beside it to stay level
   with. */
.list-filter.embedded { position: static; max-height: 26rem; }

.lf-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
    padding: var(--space-3) var(--space-3) var(--space-2); border-bottom: 1px solid var(--line-soft); }
.lf-head strong { font-size: var(--text-md); color: var(--ink-800); }
.lf-x { border: 0; background: transparent; color: var(--ink-400); font-size: var(--text-2xl); line-height: 1; padding: 0 var(--space-1); cursor: pointer; }
.lf-x:hover { color: var(--ink-700); }
.lf-search { padding: var(--space-2) var(--space-3); }
.lf-search input { width: 100%; padding: var(--space-2) var(--space-2); border: 1px solid var(--line-strong);
    border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-800); font: inherit;
    box-shadow: inset 0 1px 2px rgba(20,35,80,.06); }
.lf-match { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3) var(--space-2);
    font-size: var(--text-xs); color: var(--ink-400); }
.lf-match select { padding: var(--space-0) var(--space-1); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--ink-700); font: inherit; }
.lf-section { margin: 0; padding: var(--space-2) var(--space-3); font-size: var(--text-2xs);
    font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-300);
    border-top: 1px solid var(--line-soft); }
.lf-fields { overflow-y: auto; padding: 0 var(--space-2) var(--space-2); }
.lf-fields:last-of-type { flex: 1; }
.lf-system { flex: 0 0 auto; max-height: 12rem; }
.lf-field { border-radius: var(--radius-sm); }
.lf-field.on { background: var(--brand-50); }
.lf-check { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm); color: var(--ink-700); cursor: pointer; }
.lf-check input { width: auto; margin: 0; }
.lf-clause { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-0) var(--space-2) var(--space-2) var(--space-6); }
.lf-clause input, .lf-clause select { padding: var(--space-1) var(--space-2); border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--surface-1); color: var(--ink-800); font: inherit;
    font-size: var(--text-sm); width: 100%; }
.lf-clause .lf-op { width: auto; }
.lf-picklist { display: flex; flex-direction: column; gap: var(--space-0); }
.lf-picklist label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--ink-600); }
.lf-picklist input { width: auto; }
.lf-range { display: flex; align-items: center; gap: var(--space-2); }
.lf-range span { color: var(--ink-400); font-size: var(--text-xs); }
.lf-empty { padding: var(--space-3); color: var(--ink-400); font-size: var(--text-sm); }
.lf-foot { display: flex; gap: var(--space-2); padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.lf-foot .button.small { margin-top: 0; }

@media (max-width: 960px) {
    .list-shell.with-filter { grid-template-columns: 1fr; }
    .list-filter { position: static; max-height: 22rem; margin-bottom: var(--space-3); }
}

/* Workflow rule editor. The aside is already a narrow column, so an
   action is a bordered block rather than another nested card -- one
   border deep is enough to say "these inputs belong together". */
.wf-fieldset { max-height: 12rem; overflow-y: auto; border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: var(--space-2); margin-bottom: var(--space-3); }
/* The round-robin pool. Same scrolling box as the field picker above
   it -- a workspace with forty people must not push the Save button off
   the screen. */
.wf-pool { max-height: 12rem; overflow-y: auto; border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: var(--space-2); margin-bottom: var(--space-2);
    display: flex; flex-direction: column; gap: var(--space-1); }
.wf-action { border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3) var(--space-3); margin-bottom: var(--space-3);
    background: var(--surface-2); }
.wf-action-head { display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-2); margin-bottom: var(--space-2); }
.wf-action-head strong { font-size: var(--text-sm); color: var(--ink-700); }
/* One merge placeholder and what it means, listed under the alert
   editor so a rule author picks a real field instead of guessing. */
.merge-field { display: flex; gap: var(--space-2); align-items: baseline;
    font-size: var(--text-sm); padding: var(--space-0) 0; }
.merge-field code { font-family: var(--font-mono, monospace); }
.wf-add { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }

/* Run status. Colours come off the data ramp the dashboards use, so a
   failed run reads the same as a lost deal elsewhere in the app. */
.wf-status { text-transform: capitalize; font-weight: 500; }
.wf-status.succeeded { color: var(--data-won); }
.wf-status.failed { color: var(--data-lost); }
.wf-status.skipped { color: var(--ink-400); }

/* This page is a list plus a log, not a record form, so it must opt out
   of .detail-form's four-column label/input grid -- otherwise the rules
   table is placed in a 10rem LABEL track and rendered about 90px wide
   with its own scrollbar. Same reasoning as .detail-form.record-view
   above; scoped to this page rather than loosened globally, because the
   other Admin screens genuinely are label/input forms. */
.detail-form.wf-list { display: block; }

/* .detail-grid is single-column by default, which would drop the rule
   editor underneath a full-width table and put the field you are
   editing off-screen. Give it the second track only while the editor
   is open. */
.wf-grid:has(.detail-side) { grid-template-columns: minmax(0, 1fr) 24rem; }
@media (max-width: 1100px) {
    .wf-grid:has(.detail-side) { grid-template-columns: minmax(0, 1fr); }
}

/* Permission matrix: many narrow boolean columns, one label column.
   Centring the boxes is what makes a row scannable -- the question the
   reader is asking is "which of these are ticked", not "what is in this
   cell". */
.perm-grid th, .perm-grid td { text-align: center; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; white-space: nowrap; }
.perm-grid th { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .04em; }
.perm-grid input[type=checkbox] { width: auto; margin: 0; }

/* Setup landing page. A directory, not a dashboard: the reader is
   looking for one named thing, so every entry is a plain link at a
   readable size and nothing competes for attention. Cards carry a
   border and no shadow -- they group, they do not need lifting. */
.setup-head { display: flex; align-items: center; gap: var(--space-4);
    flex-wrap: wrap; margin-bottom: var(--space-5); }
.setup-head h1 { margin: 0; font-size: var(--text-3xl); font-weight: 500; color: var(--ink-900); }
.setup-search { flex: 0 1 22rem; padding: var(--space-2) var(--space-3); font-size: var(--text-sm);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--ink-800); }
.setup-search:focus { outline: none; border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100); }

.setup-grid { display: grid; gap: var(--space-4);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); align-items: start; }

.setup-card { background: var(--surface-1); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: var(--space-4); }
.setup-card h2 { margin: 0 0 var(--space-3); font-size: var(--text-2xs);
    text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); font-weight: 600; }
.setup-card ul { list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: var(--space-3); }
.setup-card a { color: var(--brand-600); text-decoration: none; font-size: var(--text-md); }
.setup-card a:hover { text-decoration: underline; }
.setup-hint { display: block; margin-top: var(--space-0); font-size: var(--text-xs); color: var(--ink-400); }

.setup-note { margin-top: var(--space-5); }

/* Sign-in policy: label/control pairs where several controls are groups
   rather than single inputs, so the label column is fixed and the
   control column takes whatever it needs. */
.policy-grid { display: grid; grid-template-columns: minmax(11rem, 16rem) minmax(0, 1fr);
    gap: var(--space-3) var(--space-4); align-items: start; margin-top: var(--space-3); }
.policy-grid > label { text-align: right; font-weight: 600; font-size: var(--text-sm);
    color: var(--ink-600); padding-top: var(--space-1); }
.policy-grid input[type=number] { width: 8rem; }
.policy-grid textarea { width: 100%; font-family: var(--font-mono, monospace); font-size: var(--text-sm); }
.policy-grid .checkbox-row { margin: var(--space-0) 0; }
/* Two fields under one label -- a street's two lines, an address and the
   name beside it. Without this they share an edge and read as one
   control with a rule through it. Only adjacent inputs, so the helper
   paragraphs that share these wrappers keep their own margins. */
.policy-grid > div > input + input { margin-top: var(--space-2); }
@media (max-width: 700px) {
    .policy-grid { grid-template-columns: 1fr; }
    .policy-grid > label { text-align: left; padding-top: 0; }
}

/* --- sample data: what is left, before you delete it ----------------- */
.sample-list { list-style: none; padding: 0; margin: var(--space-3) 0;
               display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.sample-list li { color: var(--ink-600); font-size: var(--text-sm); }
.sample-list strong { color: var(--ink-800); font-variant-numeric: tabular-nums; }

/* --- business hours: the week, and the holiday list ------------------ */
.hours-table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0; }
.hours-table th { text-align: left; font-size: var(--text-xs); text-transform: uppercase;
                  letter-spacing: .04em; color: var(--ink-400); padding: var(--space-2); }
.hours-table td { padding: var(--space-2); border-top: 1px solid var(--line-soft); color: var(--ink-700); }
.hours-table tr.closed-day td { color: var(--ink-400); }
.hours-table input[type=time] { width: 8rem; }

.holiday-add { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
               margin-bottom: var(--space-3); }
.holiday-add input[type=text], .holiday-add input:not([type]) { min-width: 18rem; }

/* --- an amount and the currency it is in, as one control ------------- */
.amount-row { display: flex; gap: var(--space-2); align-items: stretch; }
.amount-row .currency-select { width: 6rem; flex: none; }
.amount-row .currency-fixed { display: flex; align-items: center; padding: 0 var(--space-2);
                              color: var(--ink-500); font-weight: 600; font-size: var(--text-sm); }
.amount-row input { flex: 1 1 auto; min-width: 0; }

/* --- currencies: a rate is an input, a button and its unit ----------- */
.currency-table td { vertical-align: middle; }
.rate-cell { display: flex; gap: var(--space-2); align-items: center; }
.rate-cell input { width: 9rem; }

/* ============================================================
   2026 POLISH LAYER
   A calm neutral workspace with colour used for navigation and
   recognition. Module tint is deliberately local: identity, active
   navigation and section rails, never large blocks behind CRM data.
   ============================================================ */

body,
button,
input,
select,
textarea { font-family: var(--font-sans); }

.main-content {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--brand-100) 48%, transparent) 0, transparent 28rem),
        var(--canvas);
}

/* Product identity and account controls. The bar's own box -- height,
   fill, hairline and the module gradient under it -- is in the app shell
   block above, with the two variables the layout keys off. */
.workspace-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 0 0 auto;
    margin-right: var(--space-5);
    color: var(--ink-900);
    text-decoration: none;
}
.workspace-brand-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, var(--brand-500), var(--module-person));
    color: var(--on-accent);
    font-size: var(--text-sm);
    font-weight: 750;
    text-transform: uppercase;
    box-shadow: 0 5px 12px color-mix(in srgb, var(--brand-600) 24%, transparent), var(--highlight-top);
}
.workspace-brand-copy { display: grid; line-height: 1.08; }
.workspace-brand-copy strong { font-size: var(--text-md); font-weight: 700; letter-spacing: -.01em; }
.workspace-brand-copy small { margin-top: var(--space-0); color: var(--ink-400); font-size: var(--text-2xs); letter-spacing: .055em; text-transform: uppercase; }
.appbar-search {
    min-height: 2.25rem;
    border: 1px solid transparent;
    background: var(--surface-3);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.appbar-search:focus-within {
    border-color: color-mix(in srgb, var(--brand-500) 58%, var(--line));
    background: var(--surface-1);
    box-shadow: 0 0 0 3px var(--brand-100);
}
/* Matches .appbar-logout below -- both are bare 36px icon targets in the
   app bar, one an anchor and one a submit button, so neither inherits the
   .button box. */
.appbar-icon-button {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--ink-500);
    text-decoration: none;
}
.appbar-icon-button:hover { background: var(--brand-50); color: var(--brand-600); }

/* The notification bell (NotificationBell.razor, tenant 0172). */
.notify { position: relative; }
.notify-button { position: relative; background: transparent; cursor: pointer; }
.notify-badge {
    position: absolute; top: calc(var(--space-0) * -1); right: calc(var(--space-0) * -1);
    min-width: 1.1rem; height: 1.1rem; padding: 0 var(--space-1);
    border-radius: var(--radius-pill); background: var(--danger); color: var(--on-accent);
    font-size: var(--text-2xs); font-weight: 700; line-height: 1.1rem; text-align: center;
    box-shadow: 0 0 0 2px var(--surface-1);
}
.notify-backdrop { position: fixed; inset: 0; z-index: 1190; background: transparent; }
.notify-panel {
    position: absolute; right: 0; top: calc(100% + var(--space-2)); z-index: 1200;
    width: min(26rem, calc(100vw - 2rem)); max-height: min(36rem, calc(100vh - 6rem));
    display: flex; flex-direction: column;
    background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.notify-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line-soft); }
.notify-head strong { display: block; color: var(--ink-800); font-size: var(--text-lg); }
.notify-head small { color: var(--ink-400); }
.notify-list { list-style: none; margin: 0; padding: var(--space-1); overflow-y: auto; }
.notify-item {
    width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: start;
    padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md);
    background: transparent; color: var(--ink-700); text-align: left; cursor: pointer; font: inherit;
}
.notify-item:hover, .notify-item:focus-visible { background: var(--surface-2); }
.notify-item.unread { background: var(--brand-50); }
.notify-item.unread:hover { background: var(--brand-100); }
.notify-icon { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--radius-md); font-size: var(--text-xl); }
.notify-alarm .notify-icon { color: var(--module-work); background: var(--module-work-soft); }
.notify-late .notify-icon { color: var(--danger); background: var(--danger-bg); }
.notify-case .notify-icon { color: var(--module-case); background: var(--module-case-soft); }
.notify-text { display: grid; gap: var(--space-0); min-width: 0; }
.notify-text strong { color: var(--ink-800); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-kind { color: var(--ink-400); font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.notify-detail { color: var(--ink-500); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-when { color: var(--ink-400); font-size: var(--text-xs); white-space: nowrap; padding-top: var(--space-1); }
.notify-empty { padding: var(--space-6) var(--space-4); margin: 0; text-align: center; }
/* Column Setup's list of setups (0173), Maximizer's "Available Column
   Setup Views": the list on the left, its buttons stacked on the right. */
.column-setup-show { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-500); font-size: var(--text-sm); }
.column-setup-show select { width: auto; }
.column-setup-views { display: grid; grid-template-columns: minmax(0, 1fr) 10rem; gap: var(--space-4); align-items: start; }
.column-setup-views .table-scroll { max-height: 22rem; overflow-y: auto; }
.column-setup-table tbody tr { cursor: pointer; }
.column-setup-table tbody tr.selected td { background: var(--brand-100); }
.column-setup-buttons { display: grid; gap: var(--space-2); }
.column-setup-buttons .button { width: 100%; justify-content: center; }
.column-setup-confirm { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }
.column-setup-props { display: flex; align-items: end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.column-setup-props label:first-child { display: grid; gap: var(--space-1); flex: 1 1 16rem; }
@media (max-width: 640px) { .column-setup-views { grid-template-columns: 1fr; } }
/* RowsPerPageMenu: a labelled select sitting among the More menu's items. */
.action-menu-rows { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); color: var(--ink-700); font-size: var(--text-sm); }
.action-menu-rows .material-icons { font-size: var(--text-xl); color: var(--ink-400); }
.action-menu-rows select { margin-left: auto; width: auto; min-height: 0; padding: var(--space-1) var(--space-2); }
.case-notify-warning { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-1) 0 var(--space-2) var(--space-6); color: var(--ink-600); font-size: var(--text-sm); }
.case-notify-warning select { width: auto; }
.notify-foot { padding: var(--space-2) var(--space-4); border-top: 1px solid var(--line-soft); }
.appbar-user {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 2.25rem;
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    color: var(--ink-700);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
}
.appbar-user:hover { border-color: var(--line); background: var(--surface-2); }
.appbar-user-avatar {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--module-company-soft), var(--module-person-soft));
    color: var(--brand-700);
    font-size: var(--text-xs);
    font-weight: 750;
}
/* Its sibling .appbar-user (the account link) is already inline-flex;
   this form wasn't, which mattered once the button inside it stopped
   inheriting the generic button[type=submit] rule's margin-top (see
   that rule's own comment) -- without inline-flex the form still added
   its own inline-layout leading around the button. */
.appbar-signout { margin-left: var(--space-0); display: inline-flex; align-items: center; }
.appbar-logout {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink-500);
    cursor: pointer;
}
.appbar-logout:hover { border-color: var(--line); background: var(--surface-2); color: var(--brand-700); }

/* A static caption above a field, from when MudBlazor's own Label
   parameter was in use: it floated a label into space above the input
   that this app's global input styling does not reserve, so it landed on
   top of the value instead -- true in the compact filter bars AND in the
   roomy composer forms, so it was the label mechanism that was wrong,
   not any one field's height. A caption sits outside the control
   entirely and cannot collide with anything. Same shape as the global
   `label` rule above, just tightened for use inside a form card. */
.field-caption { display: block; margin: var(--space-1) 0 var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--ink-600); }

/* The filter row above the Notes/Documents/Activities lists. Every field
   in it would otherwise grow to fill the row on a wide screen -- a date
   field ended up ~350px wide for ten characters of content, and the row
   read as a few enormous empty boxes (seen at 1760px; it looks fine at
   800px, which is why it took a full-width screenshot to notice). Caps
   are per field type because a search box genuinely earns more width
   than a date. */
.record-filter-bar > * { flex: 0 1 auto; }
.record-filter-bar > .date-field { max-width: 14rem; }
.record-filter-bar > .select-field select { min-width: 9rem; }
.record-filter-bar > .select { min-width: 10rem; max-width: 14rem; }
.record-filter-bar > .search-field { max-width: 22rem; }

/* The house dropdown, for a <select> that has no container rule of its
   own. Same box as .detail-form/.campaign-* selects already draw, pulled
   out once so the standalone ones (filter bars, composer cards) don't
   each re-declare it -- there was no global `select` rule, so a bare
   select landed on the browser's default and looked nothing like the
   inputs beside it. */
.select {
    min-height: 2.25rem;
    max-width: 100%;
    padding: var(--space-2) var(--space-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-900);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}
.select:hover { border-color: var(--ink-400); }
.select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); outline: none; }
.select:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.select.block { display: block; width: 100%; }

/* The sentinel constants (AllFilter/NoSelection/AllKinds in
   Activities.razor/Notes.razor/RecordDocuments.razor/TimelinePanel.razor)
   are left over from MudSelect, which treated "" as "no value" and so
   rendered the floating label full-size on top of "All types". A native
   <select> has no such problem and "" would work fine now -- they stay
   only because the filter comparisons are written against them, and
   swapping them out buys nothing. */

/* Module-aware navigation. */
.nav-home { --module-color: var(--nav-icon-home); }
.module-home { --module-color: var(--brand-500); --module-soft: var(--brand-50); }
.nav-company { --module-color: var(--nav-icon-company); }
.module-company { --module-color: var(--module-company); --module-soft: var(--module-company-soft); }
.nav-person { --module-color: var(--nav-icon-person); }
.module-person { --module-color: var(--module-person); --module-soft: var(--module-person-soft); }
.nav-lead { --module-color: var(--nav-icon-lead); }
.module-lead { --module-color: var(--module-lead); --module-soft: var(--module-lead-soft); }
.nav-work { --module-color: var(--nav-icon-work); --module-soft: var(--module-work-soft); }
.module-work { --module-color: var(--module-work); --module-soft: var(--module-work-soft); }
.nav-calendar { --module-color: var(--nav-icon-calendar); --module-soft: var(--module-opportunity-soft); }
.nav-activity { --module-color: var(--nav-icon-activity); }
.module-activity { --module-color: var(--module-activity); --module-soft: var(--module-activity-soft); }
.nav-opportunity { --module-color: var(--nav-icon-opportunity); }
.module-opportunity { --module-color: var(--module-opportunity); --module-soft: var(--module-opportunity-soft); }
.nav-case { --module-color: var(--nav-icon-case); }
.nav-quote { --module-color: var(--nav-icon-quote); }
.module-case { --module-color: var(--module-case); --module-soft: var(--module-case-soft); }
.module-quote { --module-color: var(--module-quote); --module-soft: var(--module-quote-soft); }
.nav-campaign { --module-color: var(--nav-icon-campaign); }
.module-campaign { --module-color: var(--module-campaign); --module-soft: var(--module-campaign-soft); }
.nav-library { --module-color: var(--nav-icon-library); }
.nav-report { --module-color: var(--nav-icon-report); --module-soft: var(--module-report-soft); }
.module-report { --module-color: var(--module-report); --module-soft: var(--module-report-soft); }
.nav-inbox { --module-color: var(--nav-icon-inbox); }
.nav-import { --module-color: var(--nav-icon-import); }
.nav-setup { --module-color: var(--nav-icon-setup); }
/* What each .nav-* --module-color above actually paints -- the icon
   tile, the active fill and the active left stripe -- is in the app
   shell block at the top of this file, with the rest of the rail. */

/* Compact module identity with enough room for titles and wrapped tools. */
.module-page-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    min-height: calc(var(--space-6) + var(--space-5));
    margin: 0 0 var(--space-4);
    padding: var(--space-2) 0 var(--space-4);
    border-bottom: 1px solid var(--line);
}
.module-page-icon {
    display: grid;
    place-items: center;
    width: calc(var(--space-6) + var(--space-2));
    height: calc(var(--space-6) + var(--space-2));
    flex: 0 0 calc(var(--space-6) + var(--space-2));
    border-radius: var(--radius-lg);
    background: var(--module-soft);
    color: var(--module-color);
}
.module-page-icon .material-icons { font-size: var(--text-3xl); }
.module-page-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); min-width: 0; max-width: 100%; }
.module-page-title h1,
.module-page-title .text-h4 {
    margin: 0;
    color: var(--ink-900);
    font-size: var(--text-3xl);
    font-weight: 650;
    letter-spacing: -.015em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.module-page-title > p,
.module-page-title > small,
.module-page-title .muted { margin: 0; color: var(--ink-400) !important; font-size: var(--text-xs); font-weight: 500; }
.module-page-title > p { flex-basis: 100%; line-height: 1.5; }
.module-page-spacer { margin-left: auto; }
.module-page-header > .button { margin-top: 0; }
.record-name-button {
    border: 0; padding: 0; background: transparent; color: var(--ink-900);
    font: inherit; font-weight: 650; text-align: left; cursor: pointer;
    border-radius: var(--radius-sm);
}
.record-name-button:hover { color: var(--brand-600); text-decoration: underline; }

/* Dense grid. The point of losing the rail is that the space goes to
   rows, so this is the mockup's 12.5px/7px table rather than the roomier
   one the card layout could afford. */
.table-scroll,
.company-list-scroll { border-radius: var(--radius-md); }
.grid { font-size: var(--text-md); }
.grid th { height: auto; padding: var(--space-2) var(--space-3); font-size: var(--text-2xs); }
.grid td { padding: var(--space-2) var(--space-3); }
.grid td .badge { font-size: var(--text-2xs); }

/* Record hero: title, identity, metadata and actions are one object. */
.detail-header {
    position: relative;
    overflow: visible;
    margin-bottom: var(--space-4);
    padding: var(--space-4) var(--space-4);
    border: 1px solid color-mix(in srgb, var(--module-color, var(--brand-500)) 18%, var(--line));
    border-radius: var(--radius-lg);
    background: linear-gradient(110deg, var(--module-soft, var(--brand-50)) 0, var(--surface-1) 34%, var(--surface-1) 100%);
    box-shadow: inset 4px 0 0 var(--module-color, var(--brand-500)), var(--shadow-sm), var(--highlight-top);
}
.detail-header .back-link { margin-bottom: var(--space-1); color: var(--ink-600); font-size: var(--text-xs); font-weight: 600; }
.detail-header .back-link:hover { color: var(--module-color, var(--brand-700)); }
.detail-actions { flex-wrap: wrap; justify-content: flex-end; }
.record-avatar-large { width: 3.75rem; height: 3.75rem; flex-basis: 3.75rem; border-radius: var(--radius-lg); }
.record-avatar-company { color: var(--module-company); background: var(--module-company-soft); }
.record-avatar-person { color: var(--module-person); background: var(--module-person-soft); }
.detail-grid[class*="module-"] {
    --section-accent: var(--module-color);
    --section-accent-soft: var(--module-soft);
    --field-accent: var(--module-color);
    --field-accent-soft: var(--module-soft);
    --field-accent-hover: color-mix(in srgb, var(--module-color) 18%, transparent);
}

/* One card language across record content. */
.detail-form,
.record-summary,
.notes-panel,
.documents-panel,
.timeline-panel,
.related-panel,
.dashboard-panel,
.sid-panel,
.sid-kpi,
.workqueue-card,
.list-filter {
    border-color: var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm), var(--highlight-top);
}
.detail-form { padding: var(--space-5) var(--space-5) var(--space-5); }
/* A related panel took the card's shadow and corners above but never any
   padding, so its heading and text sat on the frame. */
.related-panel { margin-top: var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--line); background: var(--surface-1); }
.related-panel > h2 { margin: 0 0 var(--space-2); color: var(--ink-800); font-size: var(--text-lg); }
.detail-form.record-edit-form { row-gap: var(--space-3); }
.detail-form h2 {
    margin-right: calc(-1 * var(--space-5));
    margin-left: calc(-1 * var(--space-5));
    padding: var(--space-3) var(--space-5);
    border-color: var(--line-soft);
    background: linear-gradient(90deg, var(--section-accent-soft), color-mix(in srgb, var(--surface-2) 74%, transparent));
    box-shadow: inset 4px 0 0 var(--section-accent);
    color: var(--ink-700);
    font-size: var(--text-xs);
    font-weight: 750;
    letter-spacing: .075em;
}
.record-summary {
    gap: 0;
    border-color: var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: var(--shadow-sm), var(--highlight-top);
}
.record-summary-field {
    position: relative;
    padding: var(--space-3) var(--space-4);
    border-right: 1px solid var(--line-soft);
}
.record-summary-field::before {
    content: "";
    position: absolute;
    top: 0;
    right: 1rem;
    left: 1rem;
    height: 2px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--section-accent), var(--brand-400));
    opacity: .65;
}
.record-summary-field:last-child { border-right: 0; }
.record-summary-field span { color: var(--ink-400); letter-spacing: .055em; }
.record-summary-field strong { color: var(--ink-800); font-size: var(--text-md); }

.key-fields-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); margin-bottom: var(--space-3); }
.key-fields-toolbar label { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-600); font-size: var(--text-sm); }
.key-fields-toolbar select { min-width: 11rem; }
.key-fields-toolbar .key-fields-hide { margin-left: auto; }
.key-fields-toolbar .button { display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap; }
.key-fields-toolbar .button .material-icons { margin-right: 0; }

.key-fields-admin-grid { grid-template-columns: minmax(14rem, .55fr) minmax(0, 1.45fr); }
.key-fields-editor > label { text-align: left; }
.key-fields-layout-tools, .key-fields-layout-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-3) 0; }
.key-fields-layout-tools select { width: auto; min-width: 11rem; flex: 1 1 12rem; }
.key-fields-layout-tools input { width: auto; min-width: 9rem; flex: 1 1 10rem; }
.key-fields-layout-tools .button, .key-fields-layout-actions .button { margin-top: 0; white-space: nowrap; }
.key-fields-layout-actions { padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.key-fields-layout-actions .danger { color: var(--error-text); }
.key-fields-layout-preview, .record-summary.key-fields-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); align-content: start; }
.key-fields-layout-preview { min-height: 8rem; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); }
.key-fields-layout-preview > p { grid-column: 1 / -1; }
.key-fields-layout-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 0; min-height: 3rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-700); font: inherit; text-align: left; cursor: pointer; }
.key-fields-layout-item:hover { border-color: var(--brand-300); background: var(--brand-50); }
.key-fields-layout-item.selected { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-100); }
.key-fields-layout-item.left, .key-fields-layout .record-summary-field.left { grid-column: 1; }
.key-fields-layout-item.right, .key-fields-layout .record-summary-field.right { grid-column: 2; }
.key-fields-layout-item.wide { grid-column: 1 / -1; }
.key-fields-layout-item small { color: var(--ink-400); font-size: var(--text-xs); }
.key-fields-layout-item.wide strong { color: var(--ink-800); font-size: var(--text-sm); }
.key-fields-layout-rule { flex: 1; height: 1px; background: var(--line-strong); }
.record-summary.key-fields-layout { padding: var(--space-2); }
.key-fields-layout .record-summary-field { border: 1px solid var(--line-soft); border-radius: var(--radius-md); }
.key-fields-section-title { grid-column: 1 / -1; padding: var(--space-2) var(--space-3); border-left: 3px solid var(--section-accent); background: var(--section-accent-soft); color: var(--ink-800); font-size: var(--text-sm); font-weight: 700; }
.key-fields-section-rule { grid-column: 1 / -1; height: 1px; margin: var(--space-2) 0; background: var(--line-strong); }
@media (max-width: 900px) { .key-fields-admin-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .key-fields-layout-preview, .record-summary.key-fields-layout { grid-template-columns: 1fr; } .key-fields-layout-item.left, .key-fields-layout-item.right, .key-fields-layout .record-summary-field.left, .key-fields-layout .record-summary-field.right { grid-column: 1; } }

/* All native CRM fields now share one size and focus treatment. */
.record-edit-form .form-field > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.record-edit-form .udf-field > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.record-edit-form .field-row > div > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.record-edit-form .amount-row > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.record-edit-form .form-field > textarea,
.record-edit-form .udf-field > textarea,
.record-edit-form .field-row > div > textarea {
    min-height: 2.55rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-800);
    font: inherit;
    font-size: var(--text-md);
    box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink-900) 6%, transparent);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.record-edit-form .form-field > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
.record-edit-form .udf-field > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
.record-edit-form .field-row > div > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
    width: 100%;
    min-width: 0;
}
.record-edit-form .amount-row > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) { min-width: 0; }
.record-edit-form .form-field > textarea,
.record-edit-form .udf-field > textarea,
.record-edit-form .field-row > div > textarea { min-height: 6rem; resize: vertical; }
.record-edit-form .form-field > select[multiple],
.record-edit-form .udf-field > select[multiple] { min-height: 7rem; }
.record-edit-form .form-field > :where(input, select, textarea):hover,
.record-edit-form .udf-field > :where(input, select, textarea):hover,
.record-edit-form .field-row > div > :where(input, select, textarea):hover,
.record-edit-form .amount-row > :where(input, select, textarea):hover { border-color: color-mix(in srgb, var(--field-accent) 68%, var(--line-strong)); }
.record-edit-form .form-field > :where(input, select, textarea):focus,
.record-edit-form .udf-field > :where(input, select, textarea):focus,
.record-edit-form .field-row > div > :where(input, select, textarea):focus,
.record-edit-form .amount-row > :where(input, select, textarea):focus {
    outline: 0;
    border-color: var(--field-accent);
    box-shadow: 0 0 0 3px var(--field-accent-hover), inset 0 1px 2px color-mix(in srgb, var(--ink-900) 4%, transparent);
}
.record-edit-form .form-field > label,
.record-edit-form .udf-label { color: var(--field-label); font-size: var(--text-sm); font-weight: 650; }
.record-edit-form .udf-fields-editor { padding: var(--space-4) var(--space-4) var(--space-4); }
.record-edit-form .udf-fields-editor > h2 { margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-1); padding: var(--space-3) var(--space-4); }
.udf-field { display: grid; gap: var(--space-1); min-width: 0; align-content: start; }
.udf-field-wide { grid-column: 1 / -1; }
.udf-multi-trigger { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); width:100%; text-align:left; }
.udf-multi-trigger span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.udf-multi-trigger span:last-child { flex:none; }
.udf-multi-dialog { max-width:48rem; }
.udf-multi-columns { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:var(--space-4); margin:var(--space-4) 0; }
.udf-multi-columns h3 { margin:0 0 var(--space-2); font-size:var(--text-sm); color:var(--ink-700); }
.udf-multi-list { min-height:12rem; max-height:20rem; overflow:auto; border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface-1); }
.udf-multi-option, .udf-multi-selected-row { display:flex; align-items:center; gap:var(--space-2); min-height:2.25rem; padding:var(--space-2) var(--space-3); border-bottom:1px solid var(--line-soft); }
.udf-multi-option:hover { background:var(--brand-50); }
.udf-multi-option input { width:auto; margin:0; accent-color:var(--brand-600); }
.udf-multi-selected-row { justify-content:space-between; }
.udf-multi-selected .muted { padding:var(--space-3); }
@media (max-width:600px) { .udf-multi-columns { grid-template-columns:minmax(0,1fr); } .udf-multi-list { min-height:6rem; max-height:12rem; } }
.udf-help { margin: 0; color: var(--ink-400); font-size: var(--text-xs); line-height: 1.4; }
.udf-checkbox { min-height: 2.55rem; margin: 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }

/* Buttons: one silhouette across every control in the app. */
.button {
    min-height: 2.25rem;
    margin-top: 0;
    border-radius: var(--radius-md) !important;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
.button:not(.secondary):not(.danger):not(.ghost) {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-500)) !important;
    color: var(--on-accent) !important;
    box-shadow: 0 4px 10px color-mix(in srgb, var(--brand-600) 22%, transparent), var(--highlight-top);
}
.button:not(.secondary):not(.danger):not(.ghost):hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 15px color-mix(in srgb, var(--brand-600) 25%, transparent), var(--highlight-top); }
.button.ghost {
    border: 1px solid transparent;
    background: transparent;
    color: var(--brand-700);
    box-shadow: none;
}
.button.ghost:hover:not(:disabled) { border-color: var(--line); background: var(--brand-50); box-shadow: none; }
.button:disabled,
.button:not(.secondary):not(.danger):not(.ghost):disabled,
button[type=submit]:disabled {
    border-color: var(--line) !important;
    background: var(--surface-3) !important;
    color: var(--ink-300) !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed;
}

/* Dense data can still breathe without losing CRM efficiency. */
.table-scroll,
.company-list-scroll {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: var(--shadow-sm), var(--highlight-top);
}
.column-layout-table { box-shadow: none !important; }
.column-layout-table thead,
.grid thead { background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--brand-50) 42%, var(--surface-2))); }
.column-layout-table th,
.grid th {
    height: 2.65rem;
    color: var(--ink-500);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .025em;
    border-bottom-color: var(--line);
}
.column-layout-table td,
.grid td { min-height: 2.85rem; border-bottom-color: var(--line-soft); }
.column-layout-table tbody tr,
.grid tbody tr { transition: background .12s ease, box-shadow .12s ease; }
.column-layout-table tbody tr.clickable-row:hover,
.grid tbody tr.clickable-row:hover,
tr.row-link:hover { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-400); }
.record-cell strong { color: var(--ink-800); font-weight: 680; }

/* Module lists draw each record as its own rounded row on a tinted tray
   (Graeme, 2026-10-01). Only the main list of a module carries
   .row-cards; related lists and setup tables stay ruled, where the gaps
   would cost more density than they buy.
   The cells, not the <tr>, carry the card: a row background is a square
   painted under rounded cells, so a hover or a colouring-rule tint on the
   <tr> would show square corners. That is why the colouring rules set
   --row-tint rather than background. */
.grid tbody tr { background-color: var(--row-tint, transparent); }
.table-scroll:has(> table.row-cards) { background: var(--surface-3); padding: 0 var(--space-2) var(--space-1); }
table.grid.row-cards { border-collapse: separate; border-spacing: 0 var(--space-1); }
table.grid.row-cards thead { background: none; }
table.grid.row-cards th { background: var(--surface-3); border-bottom: 0; }
table.grid.row-cards tbody tr,
table.grid.row-cards tbody tr:hover { background: transparent; box-shadow: none; }
/* Every row the same height whether or not it has a trading-name line, so
   the list reads as an even stack. The 1px drop under each cell has no
   blur on purpose: a blurred shadow per cell shows a seam where cells meet. */
table.grid.row-cards tbody td {
    height: calc(var(--space-6) + var(--space-3));
    padding-block: var(--space-1);
    vertical-align: middle;
    color: var(--ink-700);
    background: linear-gradient(var(--row-tint, transparent), var(--row-tint, transparent)), var(--surface-1);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--ink-900) 5%, transparent);
    transition: background-color .12s ease, border-color .12s ease;
}
table.grid.row-cards tbody td:first-child { border-left: 1px solid var(--line); border-radius: var(--radius-md) 0 0 var(--radius-md); }
table.grid.row-cards tbody td:last-child { border-right: 1px solid var(--line); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
table.grid.row-cards tbody td:only-child { border-radius: var(--radius-md); }
table.grid.row-cards tbody tr:hover td { background: linear-gradient(var(--row-tint, transparent), var(--row-tint, transparent)), var(--brand-50); border-color: var(--brand-200); }
table.grid.row-cards tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand-400), 0 1px 0 color-mix(in srgb, var(--ink-900) 5%, transparent); }
/* Tighter lines in the name cell so a name with a trading-name line fits
   the same 44px as one without (Graeme, 2026-10-01: rows were 52-60px,
   which put six companies on a laptop screen). */
table.grid.row-cards .record-name-button { line-height: 1.25; }
table.grid.row-cards .record-cell .muted { line-height: 1.2; }
/* js/dragScroll.js: while a list is being dragged, the hand shows it and no
   row reacts to the pointer passing over it. */
html.drag-scrolling, html.drag-scrolling * { cursor: grabbing !important; user-select: none; }
html.drag-scrolling table.row-cards tbody tr { pointer-events: none; }
/* A ticked row stays marked, so a selection reads at a glance down a long list. */
table.grid.row-cards tbody tr:has(> td:first-child input[type=checkbox]:checked) td { background: var(--brand-50); border-color: var(--brand-300); }
table.grid.row-cards tbody tr:has(> td:first-child input[type=checkbox]:checked) td:first-child { box-shadow: inset 3px 0 0 var(--brand-500); }

/* ListCellValue: an empty value recedes, the owner is a person, a
   pick-list choice is a tag. */
.cell-empty { color: var(--ink-300); }
.owner-chip { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink-700); }
.cell-tags { display: inline-flex; gap: var(--space-1); }
.badge.cell-tag { background: var(--surface-3); color: var(--ink-600); font-weight: 600; }
.record-avatar.record-avatar-small { width: 1.5rem; height: 1.5rem; flex-basis: 1.5rem; border-radius: 50%; font-size: var(--text-2xs); letter-spacing: 0; }

/* RecordAvatar picks a tone from the name, so a list of initials is not
   eight hundred identical squares. The same name always gets the same one. */
.record-avatar.avatar-tone-0 { color: var(--module-company); background: var(--module-company-soft); }
.record-avatar.avatar-tone-1 { color: var(--module-person); background: var(--module-person-soft); }
.record-avatar.avatar-tone-2 { color: var(--module-opportunity); background: var(--module-opportunity-soft); }
.record-avatar.avatar-tone-3 { color: var(--module-activity); background: var(--module-activity-soft); }
.record-avatar.avatar-tone-4 { color: var(--module-report); background: var(--module-report-soft); }
.record-avatar.avatar-tone-5 { color: var(--module-campaign); background: var(--module-campaign-soft); }
.record-avatar.avatar-tone-6 { color: var(--module-case); background: var(--module-case-soft); }
.record-avatar.avatar-tone-7 { color: var(--module-lead); background: var(--module-lead-soft); }

/* Equal-width cards in a row, replacing MudGrid/MudItem. The column
   count is the modifier, not twelve xs/sm/md numbers per item: every
   grid in this app was one of three shapes, and the item count is a
   property of the row, so it belongs on the row. Breakpoints match
   MudBlazor's sm/md so nothing reflows at a new width. */
/* A search box with its magnifier, replacing the MudTextField that had
   Adornment.Start on every list page. The <label> wrapper means a click
   anywhere in the box -- icon included -- focuses the input, which is
   what MudBlazor's adornment slot did. The box is the same one .select
   draws, so a search field and a filter dropdown sitting beside each
   other in a filter bar match. */
.search-field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 2.5rem;
    padding: 0 var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.search-field > .material-icons { flex: 0 0 auto; font-size: 20px; color: var(--ink-400); }
.search-field > input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: none;
    color: var(--ink-900);
    font: inherit;
    font-size: var(--text-md);
}
.search-field > input::placeholder { color: var(--ink-400); }
.search-field.block { width: 100%; }
@media (prefers-reduced-motion: reduce) { .search-field { transition: none; } }

/* Date and time, replacing MudDatePicker/MudTimePicker. The browser's own
   picker does the job MudBlazor's popup calendar did, and does it without
   the popup-clipping trap that cost three rounds here: MudDatePicker's
   calendar paper carried the same "mud-picker" class as the closed input,
   so any Style meant for the field landed on the calendar instead and
   silently clipped Thu/Fri/Sat off the week.

   A native date input ignores `placeholder` and shows dd/mm/yyyy instead,
   which does not say whether it is the From or the To -- hence the
   visible caption, which was MudBlazor's Placeholder/Label. */
.date-field, .select-field { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--ink-600); white-space: nowrap; }
.date-field.stacked { flex-direction: column; align-items: stretch; gap: var(--space-1); font-weight: 600; }
.date-input {
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-900);
    font: inherit;
    font-size: var(--text-md);
}
.date-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); outline: none; }

/* A single-line text input outside any of the form containers that style
   their own inputs (.detail-form, .record-edit-form, .campaign-*). */
.text-input {
    width: 100%;
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-900);
    font: inherit;
    font-size: var(--text-md);
}
.text-input::placeholder { color: var(--ink-400); }
.text-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); outline: none; }

/* A multi-line text input that matches the fields around it. */
.textarea {
    width: 100%;
    min-height: 5.5rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-900);
    font: inherit;
    font-size: var(--text-md);
    resize: vertical;
}
.textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); outline: none; }

/* A checkbox and its label as one control, replacing MudCheckBox. The
   <label> wrapper is what makes the words clickable, which MudCheckBox's
   Label parameter was doing and a bare input + sibling text would not. */
.check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.check input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--brand-600); cursor: pointer; }

.card-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.card-grid > * { min-width: 0; }
@media (min-width: 600px) {
    .card-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
    .card-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* Three short label/value pairs, never worth stacking. */
.card-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* The home screen is the daily landing point, so its figures should scan
   like a dashboard rather than a row of identical white rectangles. */
.home-kpis > .panel:nth-child(4n + 1) { border-top: 3px solid var(--brand-500); }
.home-kpis > .panel:nth-child(4n + 2) { border-top: 3px solid var(--module-person); }
.home-kpis > .panel:nth-child(4n + 3) { border-top: 3px solid var(--module-activity); }
.home-kpis > .panel:nth-child(4n) { border-top: 3px solid var(--module-work); }

/* The Home preview lists (appointments, tasks, leads, deals). Each row
   is a real control -- it navigates to the record -- so it is a button,
   not a div with a click handler. */
.preview-list { list-style: none; margin: 0; padding: 0; }
.preview-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.preview-item:hover { background: var(--surface-2); }
.preview-item .preview-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Menus and dialogs should feel part of the same raised layer. */
.avatar-menu-popover,
.modal {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: var(--shadow-lg), var(--highlight-top);
    /* A dialog taller than the window scrolls inside itself. Without this
       the backdrop centres it and the top -- its heading and first fields
       -- is cut off above the viewport with no way to reach it. */
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}
/* The buttons stay reachable at the bottom of a scrolling dialog. The
   offset is the dialog's own padding (1.5rem = --space-5), so they sit on
   its bottom edge rather than floating above it. */
.modal-actions {
    position: sticky;
    bottom: calc(var(--space-5) * -1);
    padding: var(--space-3) 0 var(--space-2);
    background: var(--surface-1);
}
.avatar-menu-popover { width: 11rem; padding: var(--space-1); }
.avatar-menu-popover > a,
.avatar-menu-action { min-height: 2.6rem; border: 0; border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-700); }
.avatar-menu-trigger .record-avatar { box-shadow: 0 0 0 3px var(--surface-1), 0 2px 8px color-mix(in srgb, var(--ink-900) 18%, transparent); }
.avatar-menu-popover > a:hover,
.avatar-menu-action:hover { background: var(--brand-50); color: var(--brand-700); }
.avatar-menu-remove { color: var(--danger); }
.avatar-menu-remove:hover { background: var(--danger-bg); color: var(--danger-fg); }
.modal-backdrop,

/* Segmented navigation and status affordances. */
.record-tabs,
.record-rail { border-color: var(--line); background: color-mix(in srgb, var(--surface-3) 84%, var(--brand-50)); box-shadow: var(--shadow-sm); }
.record-tabs button.active { color: var(--brand-700); box-shadow: var(--shadow-sm), inset 0 -2px 0 var(--brand-500); }
.pill,
.related-count { background: var(--brand-100); color: var(--brand-700); }

/* Dashboard colour is tied to meaning, not decoration. */
.sid-kpis > :nth-child(4n + 1),
.dashboard-kpis > :nth-child(4n + 1) { box-shadow: inset 0 3px 0 var(--module-company), var(--shadow-sm), var(--highlight-top); }
.sid-kpis > :nth-child(4n + 2),
.dashboard-kpis > :nth-child(4n + 2) { box-shadow: inset 0 3px 0 var(--module-opportunity), var(--shadow-sm), var(--highlight-top); }
.sid-kpis > :nth-child(4n + 3),
.dashboard-kpis > :nth-child(4n + 3) { box-shadow: inset 0 3px 0 var(--module-person), var(--shadow-sm), var(--highlight-top); }
.sid-kpis > :nth-child(4n),
.dashboard-kpis > :nth-child(4n) { box-shadow: inset 0 3px 0 var(--module-campaign), var(--shadow-sm), var(--highlight-top); }


html.theme-dark .button.secondary,
html.theme-dark .button.ghost { color: var(--brand-400); }
html.theme-dark .button.secondary { border-color: color-mix(in srgb, var(--brand-400) 70%, var(--line)); }

/* Sales Inbox: private mailbox chrome, deliberately distinct from a CRM
   record page.  The narrow folder rail and dense rows mirror a familiar
   mail client while CRM filing stays an explicit action. */
.sales-mailbox { min-height: calc(100vh - 6.5rem); margin: calc(-1 * var(--space-1)); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-1); box-shadow: var(--shadow-sm); }
.sales-mailbox-topbar { display: grid; grid-template-columns: minmax(16rem,1fr) minmax(18rem,34rem) auto; align-items: center; gap: var(--space-4); min-height: 4.4rem; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); background: var(--surface-1); }
.sales-mailbox-title { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.sales-mailbox-title .module-page-icon { width: 2.4rem; height: 2.4rem; flex-basis: 2.4rem; }
.sales-mailbox-title h1 { margin: 0; color: var(--ink-900); font-size: var(--text-xl); }
.sales-mailbox-title small { display: block; overflow: hidden; margin-top: var(--space-0); color: var(--ink-400); text-overflow: ellipsis; white-space: nowrap; }
.sales-mailbox-search { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-2); }
.sales-mailbox-search input { width: 100%; min-height: 2.45rem; border: 0; outline: 0; background: transparent; color: var(--ink-800); }
.sales-mailbox-shell { display: grid; grid-template-columns: 14.5rem minmax(0,1fr); min-height: calc(100vh - 11rem); }
.sales-mailbox-folders { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-3) 78%, var(--brand-50)); }
.mailbox-new-email { display: flex; justify-content: center; width: 100%; }
.mailbox-account-picker { display: grid; gap: var(--space-1); color: var(--ink-400); font-size: var(--text-xs); font-weight: 700; }
.mailbox-account-picker select { width: 100%; min-height: 2.35rem; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-700); }
.mailbox-current-account { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--surface-1); min-width: 0; }
.mailbox-current-account > span, .mailbox-row-avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem; border-radius: 50%; background: linear-gradient(135deg, var(--brand-100), var(--module-person-soft)); color: var(--brand-700); font-size: var(--text-xs); font-weight: 750; }
.mailbox-current-account div { min-width: 0; }
.mailbox-current-account strong, .mailbox-current-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-current-account strong { color: var(--ink-700); font-size: var(--text-sm); }.mailbox-current-account small { color: var(--ink-400); font-size: var(--text-xs); }
.sales-mailbox-folders nav { display: grid; gap: var(--space-1); }
.sales-mailbox-folders nav button { display: grid; grid-template-columns: 1.4rem 1fr auto; align-items: center; gap: var(--space-2); min-height: 2.6rem; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-600); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.sales-mailbox-folders nav button:hover { background: var(--surface-1); }.sales-mailbox-folders nav button.active { background: var(--brand-100); color: var(--brand-700); box-shadow: inset 3px 0 0 var(--brand-500); }
.sales-mailbox-folders nav em { min-width: 1.55rem; padding: .08rem var(--space-1); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--ink-400); font-size: var(--text-xs); font-style: normal; text-align: center; }
.mailbox-private-note { display: flex; gap: var(--space-2); margin-top: auto; padding: var(--space-3); border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-400); }
.mailbox-private-note p { margin: 0; font-size: var(--text-xs); line-height: 1.45; }.mailbox-private-note strong { display: block; margin-bottom: var(--space-0); color: var(--ink-600); }
.sales-mailbox-content { min-width: 0; background: var(--surface-1); container-type: inline-size; }
.sales-mailbox-toolbar { display: flex; align-items: center; gap: var(--space-3); min-height: 3.5rem; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface-1); }
.sales-mailbox-toolbar strong { color: var(--ink-800); }.sales-mailbox-toolbar > span { color: var(--ink-400); font-size: var(--text-sm); }
.mailbox-message-list { min-width: 0; }
.whatsapp-thread { min-height: 18rem; max-height: 48rem; overflow: auto; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--surface-2); }
.whatsapp-bubble { max-width: min(38rem, 82%); padding: var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.whatsapp-bubble.outbound { align-self: flex-end; background: var(--brand-50); border-color: var(--brand-200); }
.whatsapp-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.whatsapp-bubble small { display: block; margin-top: var(--space-1); color: var(--ink-400); font-size: var(--text-xs); }
.whatsapp-compose { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line-soft); }
.whatsapp-compose textarea { min-height: 5rem; resize: vertical; }
.whatsapp-template-send { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) auto; gap: var(--space-2); align-items: center; }
@media (max-width: 680px) { .whatsapp-template-send { grid-template-columns: 1fr; } }
.mailbox-message-row { display: grid; grid-template-columns: 2rem minmax(9rem,15rem) minmax(13rem,20rem) minmax(12rem,1fr) auto 5rem; align-items: center; gap: var(--space-3); width: 100%; min-height: 3.65rem; padding: var(--space-2) var(--space-4); border: 0; border-bottom: 1px solid var(--line-soft); background: var(--surface-1); color: var(--ink-700); text-align: left; cursor: pointer; transition: background .12s ease, box-shadow .12s ease; }
.mailbox-message-row:hover { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-400); }
.mailbox-message-row strong, .mailbox-message-row b, .mailbox-row-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-message-row b { color: var(--ink-800); font-weight: 680; }.mailbox-row-preview { color: var(--ink-400); }.mailbox-message-row time { grid-column: 6; color: var(--ink-500); font-size: var(--text-xs); text-align: right; }
.mailbox-crm-badge { padding: var(--space-0) var(--space-2); border-radius: var(--radius-pill); background: var(--module-company-soft); color: var(--module-company); font-size: var(--text-2xs); font-weight: 750; }
.mailbox-loading, .mailbox-empty { min-height: 28rem; }
.mailbox-conversation-layout { display: grid; grid-template-columns: minmax(0,1fr) 18rem; min-height: calc(100vh - 14.5rem); }
.mailbox-conversation-view { min-width: 0; padding: var(--space-4); background: var(--surface-2); overflow: auto; }
.mailbox-conversation-view > header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); padding: var(--space-4) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.mailbox-conversation-view h2 { margin: var(--space-0) 0 0; color: var(--ink-900); font-size: var(--text-3xl); }.mailbox-conversation-view header small { color: var(--ink-400); }
.mailbox-message-card { margin-bottom: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.mailbox-message-card > header { display: grid; grid-template-columns: 2rem minmax(0,1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line-soft); }
.mailbox-message-card > header div { display: grid; }.mailbox-message-card > header small, .mailbox-message-card time { color: var(--ink-400); font-size: var(--text-xs); }
.mailbox-message-body { min-height: 6rem; padding: var(--space-5) var(--space-5); color: var(--ink-700); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }.mailbox-message-body:has(img),.mailbox-message-body:has(table){white-space:normal}.mailbox-message-body img{max-width:100%;height:auto}.mailbox-message-body a{color:var(--brand-700)}.mailbox-message-body table{max-width:100%;border-collapse:collapse}.mailbox-message-body blockquote{margin:var(--space-3) 0;padding:var(--space-2) var(--space-4);border-left:3px solid var(--brand-400);background:var(--surface-2);color:var(--ink-500)}
.mailbox-message-card > footer { display: flex; align-items: center; gap: var(--space-4); min-height: 2.8rem; padding: var(--space-2) var(--space-4); border-top: 1px solid var(--line-soft); }
.mailbox-message-card > footer :where(a,button) { border: 0; background: transparent; color: var(--brand-700); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }.mailbox-message-card > footer .filed-badge { margin-left: auto; }
.mailbox-crm-panel { padding: var(--space-4); border-left: 1px solid var(--line); background: var(--surface-1); }.mailbox-crm-panel h3 { margin: 0 0 var(--space-2); color: var(--ink-800); }.mailbox-crm-panel p { color: var(--ink-500); font-size: var(--text-sm); line-height: 1.55; }.mailbox-crm-panel .button { width: 100%; margin: var(--space-2) 0; }.mailbox-crm-panel small { color: var(--ink-400); line-height: 1.45; }
.mailbox-crm-actions{display:grid;gap:var(--space-1);margin:var(--space-4) 0 var(--space-4);padding:var(--space-3);border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface-1)}.mailbox-crm-actions .button{margin:0}.mailbox-crm-actions small{margin:0 0 var(--space-2)}.filing-suggestions-state,.filing-section-heading{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin:var(--space-4) var(--space-5) var(--space-2)}.filing-suggestions-state{justify-content:flex-start;padding:var(--space-3);border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-2)}.filing-suggestions-state>div,.filing-section-heading>div{display:flex;flex-direction:column}.filing-suggestions-state small,.filing-section-heading small{color:var(--muted)}.filing-section-heading>span{padding:var(--space-1) var(--space-2);border-radius:var(--radius-pill);background:var(--brand-100);color:var(--brand-700);font-size:var(--text-xs);font-weight:700}.email-record-results.suggested{margin-top:var(--space-2);border-color:color-mix(in srgb,var(--brand-500) 35%,var(--border))}.filing-no-suggestion{margin-top:var(--space-4)}

/* Full email composer. */
.composer-page { width: min(92rem,100%); margin: 0 auto; }
.composer-format-toolbar { flex-wrap: wrap; }
.composer-format-toolbar select { width: auto; max-width: 12rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-2); background: var(--surface-1); color: var(--ink-700); }
.composer-format-toolbar input[type=color] { width: 2rem; height: 2rem; padding: 0; border: 0; }
.composer-recipient-toggles { display: flex; gap: var(--space-3); }
.composer-editor img { max-width: 100%; height: auto; }
.email-html-body { display: block; width: 100%; height: 12rem; min-height: 10rem; max-height: 65vh; border: 0; background: var(--surface-1); }
.email-plain-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer-crm-save { display: flex; align-items: center; gap: var(--space-2); }
.composer-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }.composer-page-header h1 { margin: var(--space-1) 0 0; color: var(--ink-900); font-size: var(--text-3xl); }.composer-page-header p { margin: var(--space-1) 0 0; color: var(--ink-400); }.composer-page-header a { color: var(--brand-700); font-size: var(--text-sm); font-weight: 650; text-decoration: none; }.composer-header-actions { display: flex; gap: var(--space-2); }
.email-composer-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-lg), var(--highlight-top); }
.composer-address-row { display: grid; grid-template-columns: 4.5rem minmax(0,1fr) auto; align-items: center; min-height: 3.15rem; padding: 0 var(--space-4); border-bottom: 1px solid var(--line-soft); }.composer-address-row > label { color: var(--ink-500); font-size: var(--text-sm); font-weight: 700; }.composer-address-row :where(input,select) { width: 100%; min-height: 2.6rem; border: 0; outline: 0; background: transparent; color: var(--ink-800); font: inherit; }.composer-recipient-toggles { display: flex; }.composer-recipient-toggles button,.composer-remove-row { border: 0; background: transparent; color: var(--brand-700); cursor: pointer; }
.composer-inline-warning { padding: var(--space-2) var(--space-4); background: var(--warning-bg); color: var(--warn-text); font-size: var(--text-sm); }
.composer-format-toolbar { display: flex; align-items: center; gap: var(--space-1); min-height: 2.8rem; padding: var(--space-1) var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }.composer-format-toolbar button { min-width: 2.1rem; min-height: 2rem; padding: var(--space-1) var(--space-2); border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-600); cursor: pointer; }.composer-format-toolbar button:hover { border-color: var(--line); background: var(--surface-1); }.composer-format-toolbar > span { width: 1px; height: 1.4rem; margin: 0 var(--space-1); background: var(--line); }
.composer-footer{align-items:center}.composer-footer .composer-attach-button{order:1}.composer-footer .composer-file-limit{order:2}.composer-footer .composer-crm-save{order:3}.composer-footer .composer-discard{order:4}.composer-footer .composer-send{order:5;margin-left:auto;min-width:7rem}
.composer-editor { min-height: 24rem; padding: var(--space-4) var(--space-4); outline: 0; color: var(--ink-800); font-size: var(--text-xl); line-height: 1.6; }.composer-editor:empty::before { content: attr(data-placeholder); color: var(--ink-300); pointer-events: none; }

/* My Account signature designer. */
.account-page { max-width: 68rem; }
.account-page > form { max-width: 44rem; }
.signature-settings { display: grid; gap: var(--space-2); margin: var(--space-5) 0 var(--space-4); }
.signature-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--space-4); }
.signature-heading label,.signature-heading small { display: block; margin: 0; }
.signature-safe-note { color: var(--ink-400); font-size: var(--text-xs); white-space: nowrap; }
.signature-editor-shell { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.signature-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); min-height: 2.75rem; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.signature-toolbar button,.signature-toolbar select,.signature-toolbar input[type=color],.signature-image-button { min-height: 2rem; margin: 0; padding: var(--space-1) var(--space-2); border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-700); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.signature-toolbar button:hover,.signature-image-button:hover { border-color: var(--line); background: var(--surface-1); }
.signature-toolbar select { border-color: var(--line); background: var(--surface-1); }
.signature-toolbar input[type=color] { width: 2.25rem; padding: var(--space-1); }
.signature-image-button { display: inline-flex; align-items: center; }
.signature-image-button input,.signature-value { display: none !important; }
.signature-editor { min-height: 13rem; max-height: 32rem; overflow: auto; padding: var(--space-4) var(--space-4); outline: none; color: var(--ink-800); line-height: 1.45; }
.signature-editor:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand-500) 22%, transparent); }
.signature-editor:empty::before { content: attr(data-placeholder); color: var(--ink-300); pointer-events: none; }
.signature-editor img { max-width: 100%; height: auto; }
.signature-editor table { max-width: 100%; border-collapse: collapse; }
@media (max-width: 700px) { .signature-heading { align-items: start; flex-direction: column; }.signature-safe-note { white-space: normal; } }
.composer-attachments { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line-soft); }.composer-attachments > span { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink-600); }.composer-attachments small { color: var(--ink-400); }.composer-attachments button { border: 0; background: transparent; color: var(--ink-400); cursor: pointer; }
.composer-footer { display: flex; align-items: center; gap: var(--space-3); min-height: 4rem; padding: var(--space-3) var(--space-3); border-top: 1px solid var(--line); background: var(--surface-2); }.composer-send { min-width: 7rem; }.composer-attach-button { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 2.3rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-600); font-weight: 650; cursor: pointer; }.composer-attach-button input { display: none; }.composer-file-limit { color: var(--ink-400); font-size: var(--text-xs); }.composer-crm-save { margin-left: auto; color: var(--module-company); font-size: var(--text-sm); font-weight: 650; }.composer-discard { margin-left: auto; }.composer-crm-save + .composer-discard { margin-left: 0; }.composer-saved-state { padding: var(--space-2) var(--space-4); background: var(--module-company-soft); color: var(--module-company); font-size: var(--text-sm); }

@media (max-width: 900px) {
    .sales-mailbox-topbar { grid-template-columns: 1fr auto; }.sales-mailbox-search { grid-column: 1 / -1; grid-row: 2; }.sales-mailbox-shell { grid-template-columns: 4.25rem minmax(0,1fr); }.sales-mailbox-folders { padding: var(--space-2); }.mailbox-new-email { font-size: 0; }.mailbox-new-email::after { content: "+"; font-size: var(--text-3xl); }.mailbox-current-account div,.mailbox-private-note,.sales-mailbox-folders nav button:not(.active) em { display: none; }.sales-mailbox-folders nav button { grid-template-columns: 1fr; text-align: center; }.mailbox-conversation-layout { grid-template-columns: 1fr; }.mailbox-crm-panel { border-top: 1px solid var(--line); border-left: 0; }.mailbox-message-row { grid-template-columns: 2rem minmax(7rem,12rem) minmax(10rem,1fr) 4rem; }.mailbox-row-preview,.mailbox-crm-badge { display: none; }.mailbox-message-row time { grid-column: 4; }
}

@media (max-width: 620px) {
    .composer-address-row { grid-template-columns: 3.5rem minmax(0,1fr) auto; }.composer-editor { min-height: 18rem; }.composer-footer { align-items: flex-start; flex-wrap: wrap; }.composer-crm-save { order: 5; width: 100%; margin-left: 0; }.composer-file-limit { display: none; }.mailbox-message-row { grid-template-columns: 2rem minmax(0,1fr) 4rem; }.mailbox-message-row b { grid-column: 2; grid-row: 2; }.mailbox-message-row strong { display: block; grid-column: 2; grid-row: 1; }.mailbox-message-row time { grid-column: 3; grid-row: 1; }
}

/* Respond to the inbox pane, including space used by folders and navigation. */
@container (max-width: 960px) {
    .mailbox-message-row { grid-template-columns: var(--space-6) minmax(0, 1fr) minmax(0, 1.5fr) 4rem; }
    .mailbox-message-row time { grid-column: 4; }
    .mailbox-row-preview, .mailbox-crm-badge { display: none; }
    .mailbox-conversation-layout { grid-template-columns: minmax(0, 1fr); }
    .mailbox-crm-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@container (max-width: 560px) {
    .mailbox-message-row { grid-template-columns: var(--space-6) minmax(0, 1fr) auto; gap: var(--space-1) var(--space-2); padding: var(--space-3); }
    .mailbox-message-row > :first-child { grid-column: 1; grid-row: 1 / 3; }
    .mailbox-message-row strong { display: block; grid-column: 2; grid-row: 1; }
    .mailbox-message-row b { grid-column: 2 / -1; grid-row: 2; font-weight: 500; }
    .mailbox-message-row time { grid-column: 3; grid-row: 1; }
    .sales-mailbox-toolbar { flex-wrap: wrap; }
}
/* Record interactions use a full-width, searchable history grid.  Email and
   notes live together here because both are client communication, while the
   Timeline remains the broader audit/history view. */
.interaction-workspace {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
}
.interaction-workspace-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-left: 4px solid var(--module-activity);
    border-radius: var(--radius-lg);
    background: linear-gradient(115deg, var(--module-activity-soft), var(--surface-1) 42%);
    box-shadow: var(--shadow-sm), var(--highlight-top);
}
.interaction-workspace-header h1 { margin: var(--space-1) 0 0; color: var(--ink-900); font-size: var(--text-4xl); }
.interaction-workspace-header p { margin: var(--space-1) 0 0; color: var(--ink-500); }
.interaction-back { color: var(--brand-700); font-size: var(--text-sm); font-weight: 650; text-decoration: none; }
.interaction-header-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.interaction-toolbar {
    display: flex;
    align-items: end;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: var(--shadow-sm);
}
.interaction-toolbar > label { display: grid; gap: var(--space-1); color: var(--ink-500); font-size: var(--text-xs); font-weight: 650; }
.interaction-toolbar :where(input, select) {
    min-height: 2.35rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--ink-800);
}
.interaction-toolbar :where(input, select):focus { outline: 0; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.interaction-search { position: relative; flex: 1 1 22rem; }
.interaction-search > span { position: absolute; left: .7rem; bottom: .53rem; color: var(--ink-400); font-size: var(--text-3xl); }
.interaction-search input { width: 100%; padding-left: 2.1rem; }
.interaction-result-count { margin: 0 0 var(--space-2) auto; color: var(--ink-400); font-size: var(--text-sm); white-space: nowrap; }
.interaction-grid-wrap {
    overflow: auto;
    max-height: calc(100vh - 16.5rem);
    min-height: 20rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: var(--shadow-sm), var(--highlight-top);
}
.interaction-grid { width: 100%; min-width: 72rem; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.interaction-grid thead { position: sticky; top: 0; z-index: 1; background: linear-gradient(180deg, var(--surface-2), var(--surface-3)); }
.interaction-grid th {
    height: 2.75rem;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--ink-500);
    font-size: var(--text-xs);
    font-weight: 750;
    letter-spacing: .025em;
    text-align: left;
}
.interaction-grid th:nth-child(1) { width: 10rem; }
.interaction-grid th:nth-child(2) { width: 10.5rem; }
.interaction-grid th:nth-child(3) { width: 18rem; }
.interaction-grid th:nth-child(4) { width: 30%; }
.interaction-grid th:nth-child(5) { width: 16rem; }
.interaction-grid th:nth-child(6) { width: 11rem; }
.interaction-grid th:nth-child(7) { width: 4.5rem; }
.interaction-grid td {
    height: 3rem;
    padding: var(--space-2) var(--space-3);
    overflow: hidden;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink-700);
    font-size: var(--text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.interaction-grid tbody tr { cursor: pointer; transition: background .12s ease, box-shadow .12s ease; }
.interaction-grid tbody tr:hover { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-400); }
.interaction-grid tbody tr.selected { background: color-mix(in srgb, var(--module-activity-soft) 75%, var(--surface-1)); box-shadow: inset 4px 0 0 var(--module-activity); }
.interaction-grid td:first-child { display: flex; align-items: center; gap: var(--space-2); }
.interaction-type-icon {
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    flex: 0 0 1.7rem;
    border-radius: var(--radius-md);
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: var(--text-md);
}
.interaction-type-icon.inbound { background: var(--module-company-soft); color: var(--module-company); }
.interaction-type-icon.outbound { background: var(--module-opportunity-soft); color: var(--module-opportunity); }
.interaction-type-icon.note { background: var(--module-work-soft); color: var(--module-work); }
.interaction-type-icon.call { background: var(--module-person-soft); color: var(--module-person); }
.interaction-type-icon.meeting { background: var(--module-activity-soft); color: var(--module-activity); }
.interaction-type-icon.appointment, .interaction-type-icon.actionplan { background: var(--module-activity-soft); color: var(--module-activity); }
.interaction-type-icon.task { background: var(--module-work-soft); color: var(--module-work); }
.interaction-type-icon.chat, .interaction-type-icon.whatsapp { background: var(--module-person-soft); color: var(--module-person); }
.interaction-type-icon.sms, .interaction-type-icon.quote { background: var(--module-opportunity-soft); color: var(--module-opportunity); }
.interaction-loading, .interaction-empty { min-height: 18rem; }
.interaction-detail-window { align-self: flex-start; width: min(80rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 2rem); margin-block: var(--space-4); overflow: auto; padding: 0; }
.interaction-detail-backdrop { z-index: 2100; overflow: auto; }
.interaction-detail-actions { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: auto auto 1fr auto; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-1) 94%, transparent); backdrop-filter: blur(8px); }
.interaction-detail-title { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-3); }
.interaction-detail-title h2 { margin: var(--space-0) 0 0; color: var(--ink-900); font-size: var(--text-3xl); }
.interaction-detail-title small { color: var(--ink-400); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.interaction-detail-window .email-headers, .interaction-detail-window .email-viewer-body, .interaction-detail-window .email-attachments { margin-right: var(--space-5); margin-left: var(--space-5); }
.interaction-detail-window .email-viewer-body { min-height: 15rem; margin-bottom: var(--space-5); }
/* The window itself has no padding (its header bar runs edge to edge), so
   the note editor carries the same side inset as the headers above it --
   left bare, Category and the access rows sat flush with the frame. */
.interaction-note-editor { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5); }
.interaction-note-editor .interaction-note-body { min-height: 14rem; margin: 0; }
.interaction-note-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); }
.interaction-note-field { display: grid; gap: var(--space-1); color: var(--field-label); font-size: var(--text-sm); font-weight: 600; }
.interaction-note-field select { min-width: 14rem; font-weight: 400; }
.interaction-note-fields .checkbox-row { min-height: 2.25rem; }
/* The headers carry their own side padding AND the window's side margin;
   drop the padding so they line up with the title and the editor. */
.interaction-detail-window .email-headers { grid-template-columns: max-content minmax(0, 1fr); padding-inline: 0; }
/* Save stays in view however long the note is. */
.interaction-detail-footer {
    position: sticky; bottom: 0; z-index: 2; margin: 0; padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--line); background: var(--surface-1);
}
.interaction-detail-link { margin: var(--space-3) var(--space-5); }
.interaction-ai-followup {
    display: grid;
    gap: var(--space-4);
    margin: var(--space-5) var(--space-5);
    padding: var(--space-5);
    border: 1px solid color-mix(in srgb, var(--accent-purple) 28%, var(--line));
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--accent-purple-bg), var(--surface-1) 42%);
    box-shadow: var(--shadow-sm);
}
.interaction-ai-followup h3, .interaction-ai-followup p { margin: 0; }
.interaction-ai-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--space-3); }
.interaction-ai-heading small, .interaction-ai-summary small { color: var(--accent-purple-strong); font-size: var(--text-2xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.interaction-ai-heading h3 { margin-top: var(--space-0); color: var(--ink-900); font-size: var(--text-2xl); }
.interaction-ai-heading p { margin-top: var(--space-1); color: var(--ink-500); }
.interaction-ai-mark, .ai-panel-icon, .ai-master-icon {
    display: grid;
    width: var(--space-6);
    height: var(--space-6);
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--accent-purple);
    color: var(--on-accent);
    font-size: var(--text-2xl);
}
.interaction-ai-review { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); border: 1px solid color-mix(in srgb, var(--accent-purple) 28%, var(--line)); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--accent-purple-strong); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.interaction-ai-review .material-icons { font-size: var(--text-xl); }
.interaction-ai-intro { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent-purple-bg) 72%, var(--surface-2)); color: var(--ink-600); font-size: var(--text-sm); }
.interaction-ai-intro .material-icons { color: var(--accent-purple); font-size: var(--text-xl); }
.interaction-ai-generate { justify-self: start; }
.interaction-ai-generate .material-icons { color: inherit; }
.interaction-ai-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); border-left: var(--space-1) solid var(--accent-purple); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.interaction-ai-summary > .material-icons { color: var(--accent-purple); }
.interaction-ai-summary p { margin-top: var(--space-1); color: var(--ink-700); line-height: 1.6; }
.interaction-ai-results-heading, .interaction-ai-reply > header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.interaction-ai-results-heading > div, .interaction-ai-reply > header > div { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink-800); }
.interaction-ai-results-heading .material-icons, .interaction-ai-reply header .material-icons { color: var(--accent-purple); font-size: var(--text-2xl); }
.interaction-ai-results-heading > small, .interaction-ai-reply > header > small { color: var(--ink-400); font-size: var(--text-xs); }
.interaction-ai-task, .interaction-ai-reply { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.interaction-ai-task.is-created { border-color: var(--success-line); background: var(--success-bg); }
.interaction-ai-task > header { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-800); }
.interaction-ai-task > header > .material-icons { margin-left: auto; color: var(--success); font-size: var(--text-2xl); }
.interaction-ai-task-number { display: grid; width: var(--space-5); height: var(--space-5); place-items: center; border-radius: var(--radius-pill); background: var(--accent-purple-bg); color: var(--accent-purple-strong); font-size: var(--text-xs); font-weight: 800; }
.interaction-ai-task label { display: grid; gap: var(--space-1); color: var(--ink-600); font-size: var(--text-sm); font-weight: 700; }
.interaction-ai-task input, .interaction-ai-task textarea, .interaction-ai-reply textarea { width: 100%; border-color: var(--line-strong); background: var(--surface-1); }
.interaction-ai-task .button { justify-self: start; }
.interaction-ai-reply-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.interaction-ai-copy-notice { color: var(--success); font-size: var(--text-sm); font-weight: 700; }
.interaction-note-dialog { width: min(38rem, calc(100vw - 2rem)); padding: var(--space-5); }
.interaction-note-dialog > header { display: flex; justify-content: space-between; align-items: start; margin-bottom: var(--space-4); }
.interaction-note-dialog h2 { margin: var(--space-0) 0 0; }
.interaction-note-dialog > label:not(.checkbox-row) { display: grid; gap: var(--space-2); color: var(--ink-600); font-weight: 650; }
.interaction-note-dialog textarea { width: 100%; padding: var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-800); font: inherit; resize: vertical; }
.interaction-note-dialog footer { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

@media (max-width: 900px) {
    .interaction-workspace-header { align-items: flex-start; flex-direction: column; }
    .interaction-toolbar { align-items: stretch; flex-wrap: wrap; }
    .interaction-toolbar > label:not(.interaction-search) { flex: 1 1 9rem; }
    .interaction-result-count { margin-left: 0; }
    .interaction-grid-wrap { max-height: none; }
}

@media (max-width: 820px) {
    .workspace-brand-copy small,
    .appbar-user > span:last-child { display: none; }
    .workspace-brand { margin-right: var(--space-2); }
    .appbar-search { width: min(16rem, 44vw); max-width: none; }
    .module-page-header { align-items: flex-start; flex-wrap: wrap; }
    .detail-header { padding: var(--space-3); }
}

@media (max-width: 560px) {
    .workspace-brand-copy { display: none; }
    .appbar-search-kbd { display: none; }
    .appbar-search { width: 42vw; padding-right: var(--space-2); padding-left: var(--space-2); }
    .module-page-header { padding: var(--space-3); }
    .module-page-icon { width: 2.4rem; height: 2.4rem; flex-basis: 2.4rem; }
    .record-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .record-summary-field { border-bottom: 1px solid var(--line-soft); }
}

/* ============================================================
   LAYOUT UTILITIES
   ------------------------------------------------------------
   Ported from MudBlazor when it was removed. 300-odd usages
   across the app leaned on its stylesheet for these and nothing
   defined them here, so deleting MudBlazor.min.css without this
   block would have collapsed spacing and flex layout app-wide --
   silently, since no build or test looks at CSS.

   The values are not invented: MudBlazor's spacing scale is n x
   4px, which is exactly this project's --space-* ramp, so mb-3
   is var(--space-3) and pa-8 is var(--space-6). Same pixels,
   now from our own tokens -- which is what made dropping the
   library's stylesheet a no-op rather than a cliff.

   Only the classes actually in use are here. If a new one is
   needed, add it; do not reach for the library's.
   ============================================================ */

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-wrap { flex-wrap: wrap; }
.flex-grow-1 { flex-grow: 1; }

.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.align-self { align-self: center; }

.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-space-between { justify-content: space-between; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.mx-auto { margin-left: auto; margin-right: auto; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-6); }

.ml-1 { margin-left: var(--space-1); }
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }

.pa-4 { padding: var(--space-4); }
.pa-8 { padding: var(--space-6); }

/* --- the record slide-over (RecordPeek.razor) -------------------------
   S3's answer to "you keep your place in the grid": a list row opens a
   summary beside the list rather than navigating away. Sized and placed
   off the mockup's .s3-over -- fixed to the right, below the bar, full
   height. The backdrop is transparent rather than dimmed on purpose: the
   list underneath is meant to stay readable, since keeping your place in
   it is the entire reason this exists. */
.peek-backdrop { position: fixed; inset: var(--appbar-h) 0 0; z-index: 1190; }
.record-peek {
    position: fixed;
    top: var(--appbar-h);
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    width: min(25rem, 92vw);
    padding: var(--space-4) var(--space-5);
    background: var(--surface-1);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px -18px color-mix(in srgb, var(--ink-900) 28%, transparent);
    overflow-y: auto;
}
.record-peek:focus { outline: none; }
.peek-head { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-4); }
.peek-heading { min-width: 0; }
.peek-head h2 { margin: 0 0 var(--space-0); color: var(--ink-900); font-size: var(--text-xl); font-weight: 660; letter-spacing: -.02em; line-height: 1.2; }
.peek-sub { color: var(--ink-400); font-size: var(--text-md); }
.peek-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.85rem;
    height: 1.85rem;
    margin-left: auto;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-400);
    cursor: pointer;
}
.peek-close:hover { background: var(--surface-2); color: var(--ink-700); }
.peek-close .material-icons { font-size: 18px; }
.peek-rows { flex: 1 1 auto; }
.peek-row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) 0; border-bottom: 1px solid var(--line-soft); font-size: var(--text-md); }
.peek-row .k { flex: 0 0 auto; color: var(--ink-400); }
.peek-row .v { min-width: 0; color: var(--ink-800); font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.peek-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

@media (max-width: 640px) {
    .record-peek { width: 100%; }
}

/* People on a deal (0136) -- OpportunityContactsPanel. */
.opportunity-contacts { margin-top: var(--space-4); }
.deal-people { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.deal-people li { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--line-soft); }
.deal-people li:last-child { border-bottom: 0; }
.deal-people .deal-people-role { width: auto; margin-left: auto; }
.deal-people-add { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-start; }
.deal-people-add .company-picker { flex: 1 1 16rem; min-width: 0; }
.deal-people-add select { width: auto; }
.deal-companies-kind { font-size: var(--text-sm); font-weight: 600; color: var(--ink-600); margin: var(--space-2) 0 0; }
.deal-people .deal-company-note { flex: 1 1 14rem; min-width: 0; width: auto; }

/* Line items (0138) -- OpportunityLineItemsPanel. */
.line-items .num, .quote-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
.line-items input { width: 100%; min-width: 4rem; }
.line-items tfoot th { text-align: right; }
.quote-create { display: grid; gap: var(--space-2); max-width: 32rem; margin-top: var(--space-3); }

/* The printable quote (QuotePrint, PrintLayout). */
.print-page { max-width: 52rem; margin: 0 auto; padding: var(--space-5) var(--space-4); background: var(--surface-1); color: var(--ink-900); }
.print-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); }
.quote-doc { display: grid; gap: var(--space-5); font-size: var(--text-md); }
.quote-head { display: flex; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; }
.quote-seller { font-size: var(--text-2xl); font-weight: 600; }
.quote-meta { text-align: right; }
.quote-meta h1 { margin: 0 0 var(--space-1); font-size: var(--text-3xl); }
.quote-lines { width: 100%; border-collapse: collapse; }
.quote-lines th, .quote-lines td { padding: var(--space-2); border-bottom: 1px solid var(--line); vertical-align: top; }
.quote-lines thead th { text-align: left; font-size: var(--text-sm); color: var(--ink-600); }
.quote-lines tfoot td { border-bottom: 0; text-align: right; }
.quote-lines .quote-total td { font-weight: 700; font-size: var(--text-lg); border-top: 2px solid var(--ink-900); }
.quote-terms h2 { font-size: var(--text-lg); margin: 0 0 var(--space-1); }
.quote-terms p { white-space: pre-line; margin: 0; }
@media print {
    body { background: var(--print-paper); }
    .print-actions { display: none; }
    .print-page, .print-page * { color: var(--print-ink) !important; border-color: var(--print-ink); }
    .print-page { padding: 0; max-width: none; background: var(--print-paper); }
}

/* The quarterly forecast (0139). */
.forecast-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.forecast-table tfoot th { border-top: 2px solid var(--line); }
.forecast-target { width: 8rem; text-align: right; }

/* Pipelines (0140) -- the picker above stages and the board. */
.pipeline-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.pipeline-bar label { margin: 0; font-weight: 600; }
.pipeline-bar select, .pipeline-bar input { width: auto; min-width: 12rem; }
.pipeline-select { width: auto; min-width: 10rem; }

/* --- App Store (control 0015) ------------------------------------------- */
.app-store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--space-4); }
.app-card {
    display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5);
    background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.app-card.installed { border-color: var(--success-line); }
.app-card p { margin: 0; }
.app-card-head { display: flex; align-items: center; gap: var(--space-3); }
.app-card-head h2 { margin: 0; font-size: var(--text-2xl); color: var(--ink-900); }
.app-card-head .badge { margin-left: auto; }
.app-card-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
    border-radius: var(--radius-md); background: var(--module-quote-soft); color: var(--module-quote);
}
.app-card-price { font-size: var(--text-sm); font-weight: 600; color: var(--ink-600); }
.app-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }

/* ------------------------------------------------------------------
   Quotes app (tenant 0143). Status badges, the line editor, totals and
   the client's public page. Tokens only.
   ------------------------------------------------------------------ */
.badge.quote-draft { background: var(--surface-3); color: var(--ink-600); }
.badge.quote-sent { background: var(--brand-50); color: var(--brand-700); }
.badge.quote-accepted { background: var(--success-bg); color: var(--success); }
.badge.quote-declined { background: var(--danger-bg); color: var(--danger-fg); }
.badge.quote-expired { background: var(--warning-bg); color: var(--warning); }

.quote-head-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.quote-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.quote-notice { margin-bottom: var(--space-3); }

.quote-lines { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.quote-lines th { text-align: left; font-weight: 600; color: var(--ink-600); padding: var(--space-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.quote-lines td { padding: var(--space-1) var(--space-2); vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.quote-lines .num { text-align: right; white-space: nowrap; }
.quote-lines input, .quote-lines textarea { width: 100%; min-width: 0; }
.quote-lines textarea { min-height: 2.5rem; resize: vertical; }
.quote-lines .col-code { width: 8rem; }
.quote-lines .col-qty, .quote-lines .col-disc { width: 5.5rem; }
.quote-lines .col-price, .quote-lines .col-uom { width: 7rem; }
.quote-lines .col-total { width: 8rem; }
.quote-lines .col-actions { width: 5rem; white-space: nowrap; }
.quote-lines-wrap { overflow-x: auto; }
.quote-line-cost { color: var(--ink-500); font-size: var(--text-xs); }

.quote-add-line { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-start; margin-top: var(--space-3); }
.quote-add-line .company-picker { flex: 1 1 18rem; }

.quote-totals { margin-left: auto; min-width: 16rem; max-width: 22rem; border-collapse: collapse; font-size: var(--text-sm); }
.quote-totals td { padding: var(--space-1) var(--space-2); }
.quote-totals td:last-child { text-align: right; white-space: nowrap; }
.quote-totals tr.grand td { font-weight: 700; font-size: var(--text-md); border-top: 1px solid var(--line-strong); }
.quote-margin { color: var(--ink-500); font-size: var(--text-xs); text-align: right; margin-top: var(--space-1); }

.quote-terms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.quote-terms-list li { display: flex; gap: var(--space-2); align-items: flex-start; }
.quote-terms-list textarea { flex: 1; min-height: 3.5rem; }

.quote-response { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); background: var(--surface-2); }
.quote-response img { max-width: 16rem; max-height: 6rem; background: var(--surface-1); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }

.quote-settings-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

/* The client's page: no app shell, readable on a phone. */
.quote-public { max-width: 56rem; margin: 0 auto; padding: var(--space-5) var(--space-4); }
.quote-public-head { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.quote-public-head img { max-height: 4rem; max-width: 14rem; }
.quote-public-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-sm); margin-bottom: var(--space-4); }
.quote-public-parties { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-bottom: var(--space-4); }
.quote-public-parties p { margin: 0; white-space: pre-line; }
.quote-signature-pad { width: 100%; max-width: 32rem; height: 10rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--print-paper); touch-action: none; display: block; }
.quote-public-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
@media (max-width: 640px) {
  .quote-public { padding: var(--space-3) var(--space-3); }
  .quote-public .quote-lines .col-code, .quote-public .quote-lines .col-uom { display: none; }
}
/* Fields inside the Quotes forms take the shared form treatment above;
   the line editor's cells are tighter, because a table row is not a
   stack of labelled fields. */
.quote-lines input[type=number] { text-align: right; padding: var(--space-1) var(--space-2); }
.quote-lines input, .quote-lines textarea { padding: var(--space-1) var(--space-2); }
.quote-public input:not([type=hidden]), .quote-public textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--surface-1);
  color: inherit;
}
.quote-public input[type=text] { max-width: 32rem; }
.quote-public .form-field { margin-bottom: var(--space-3); }
.quote-public .form-field label { display: block; font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-1); }

/* A field in a form fills its row; a control in a toolbar sizes to its
   content. Without this the Quotes filter bar and the small "add from
   the library" rows stretch one control per line. */
.quote-form .d-flex > select, .quote-form .d-flex > input[type=search],
.quote-form label > input[type=number], .quote-actions select, .quote-filters select {
  width: auto;
}
.quote-filters input[type=search] { flex: 1 1 18rem; width: auto; }

/* ------------------------------------------------------------------
   Calendar: several people's appointments in one view.

   The colour scale is the module hues, reused -- each person keeps one
   colour everywhere they appear (their place in the People list), and
   dark mode follows because those tokens are already redefined there.
   Eight is the whole scale; a ninth person starts it again.
   ------------------------------------------------------------------ */
:root {
  --cal-0: var(--module-opportunity);
  --cal-1: var(--module-person);
  --cal-2: var(--module-quote);
  --cal-3: var(--module-campaign);
  --cal-4: var(--accent-purple);
  --cal-5: var(--module-case);
  --cal-6: var(--module-company);
  --cal-7: var(--module-lead);
}
.calendar-owner-0 { --calendar-colour: var(--cal-0); }
.calendar-owner-1 { --calendar-colour: var(--cal-1); }
.calendar-owner-2 { --calendar-colour: var(--cal-2); }
.calendar-owner-3 { --calendar-colour: var(--cal-3); }
.calendar-owner-4 { --calendar-colour: var(--cal-4); }
.calendar-owner-5 { --calendar-colour: var(--cal-5); }
.calendar-owner-6 { --calendar-colour: var(--cal-6); }
.calendar-owner-7 { --calendar-colour: var(--cal-7); }

.calendar-toolbar { flex-wrap: wrap; align-items: center; }
.calendar-new-for { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.calendar-new-for select { width: auto; padding: var(--space-1) var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: inherit; font: inherit; }

/* Whose calendars are on screen. A swatch, not a coloured label: the
   name has to stay readable in both themes. */
.calendar-people { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.calendar-person { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--ink-600); font-size: var(--text-sm); cursor: pointer; }
.calendar-person.on { border-color: var(--calendar-colour); color: var(--ink-800); }
.calendar-person input { margin: 0; }
.calendar-person-swatch { width: .75rem; height: .75rem; border-radius: 50%; background: var(--calendar-colour); }

.calendar-time-grid { --calendar-hour-height: 3rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); overflow: hidden; }
.calendar-time-head,
.calendar-allday-row,
.calendar-time-body { display: grid; grid-template-columns: 3.5rem repeat(var(--calendar-days, 7), minmax(0, 1fr)); }
.calendar-time-head { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.calendar-time-corner { border-right: 1px solid var(--line); }
.calendar-time-day { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-left: 1px solid var(--line-soft); }
.calendar-time-day.is-today { background: var(--brand-50); }
.calendar-time-dayname { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; }
.calendar-time-daynum { color: var(--ink-800); font-size: var(--text-md); font-weight: 700; }
.calendar-time-day .calendar-day-add { margin-left: auto; }

.calendar-allday-row { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.calendar-allday-label { padding: var(--space-2); border-right: 1px solid var(--line); color: var(--muted); font-size: var(--text-xs); }
.calendar-allday-cell { display: grid; gap: var(--space-1); padding: var(--space-1); border-left: 1px solid var(--line-soft); }

/* The hours scroll; the header above them does not. The grid fills the
   page below the toolbar (Graeme, 2026-10-02: "not the full page"). */
.calendar-time-body { max-height: calc(100vh - 15rem); min-height: 24rem; overflow-y: auto; }
.calendar-hours { border-right: 1px solid var(--line); background: var(--surface-2); }
.calendar-hour-label { position: relative; height: var(--calendar-hour-height); }
.calendar-hour-label span { position: absolute; top: -.55rem; right: var(--space-2); color: var(--muted); font-size: var(--text-xs); }
.calendar-hour-label:first-child span { top: var(--space-1); }

.calendar-time-column { position: relative; border-left: 1px solid var(--line-soft); }
.calendar-time-column.is-today { background: color-mix(in srgb, var(--brand-50) 60%, transparent); }
.calendar-slot { display: block; width: 100%; height: var(--calendar-hour-height); padding: 0; border: 0; border-top: 1px solid var(--line-soft); background: transparent; cursor: pointer; }
/* Outside working hours is shaded, as Maximizer does; a dashed line marks the half hour. */
.calendar-slot { position: relative; }
.calendar-slot::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--line-soft); pointer-events: none; }
.calendar-slot.off-hours { background: var(--surface-3); }
.calendar-slot:hover { background: var(--brand-50); }

/* A block is placed by its times (inline style) and coloured by whose it
   is; overlapping ones share the width rather than hiding each other. */
.calendar-block { position: absolute; z-index: 1; display: flex; flex-direction: column; gap: var(--space-0); overflow: hidden; padding: var(--space-1) var(--space-2); border: 0; border-left: 3px solid var(--calendar-colour); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--calendar-colour) 16%, var(--surface-1)); color: var(--ink-800); font: inherit; font-size: var(--text-xs); text-align: left; cursor: pointer; }
.calendar-block:hover { background: color-mix(in srgb, var(--calendar-colour) 26%, var(--surface-1)); box-shadow: var(--shadow-sm); }
.calendar-block-time { font-weight: 700; }
.calendar-block-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-block-owner { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.calendar-now { position: absolute; left: 0; right: 0; z-index: 2; height: 2px; background: var(--danger); pointer-events: none; }
.calendar-now::before { content: ""; position: absolute; left: 0; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* The month fills the page: its weeks share the height below the toolbar. */
.calendar-grid { grid-template-rows: auto repeat(var(--calendar-weeks, 6), minmax(6.5rem, 1fr)); min-height: calc(100vh - 15rem); }
.calendar-week-number { margin-right: auto; margin-left: var(--space-2); color: var(--ink-400); font-size: var(--text-xs); }

/* The people window (0179): who to show, and in which colour. */
.calendar-people-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
.calendar-people-window { width: min(34rem, calc(100vw - 2rem)); }
.calendar-people-head { display: flex; align-items: center; justify-content: space-between; }
.calendar-people-head h2 { margin: 0; font-size: var(--text-2xl); }
.calendar-people-tools { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) 0; }
.calendar-people-tools input { flex: 1; }
.calendar-people-list { list-style: none; margin: 0; padding: 0; max-height: min(26rem, calc(100vh - 16rem)); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.calendar-people-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line-soft); }
.calendar-people-list li:last-child { border-bottom: 0; }
.calendar-people-name { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-800); min-width: 0; }
.calendar-colour-choice { display: flex; gap: var(--space-1); flex-shrink: 0; }
.calendar-colour-dot { width: 1.25rem; height: 1.25rem; padding: 0; border: 2px solid var(--surface-1); border-radius: 50%; background: var(--calendar-colour); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.calendar-colour-dot.chosen { box-shadow: 0 0 0 2px var(--ink-800); }

/* A month tile's items take the owner's colour too. */
.calendar-item { border-left: 3px solid var(--calendar-colour, var(--module-opportunity)); background: color-mix(in srgb, var(--calendar-colour, var(--module-opportunity)) 14%, var(--surface-1)); color: var(--ink-700); }

@media (max-width: 900px) {
  /* A week of columns does not fit a phone: the grid scrolls sideways
     with the hour column pinned by the header above it. */
  .calendar-time-grid { overflow-x: auto; }
  .calendar-time-head, .calendar-allday-row, .calendar-time-body { min-width: 48rem; }
  .calendar-people { margin-left: 0; }
}

/* A quick dialog (send email, new task, new appointment) is a wider modal
   than a confirmation: it holds a form, and a message box needs room. */
.quick-dialog { max-width: 34rem; }
.quick-dialog .modal-actions { align-items: center; }
.quick-dialog .modal-actions .spacer { flex: 1; }
.action-menu-panel button[role=menuitem] {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: var(--space-2) var(--space-3);
  border: 0; background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.action-menu-panel button[role=menuitem]:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------
   SMS app (tenant 0148). Built from the same primitives as the rest
   of the app: the send form is a .detail-form, the recipients a
   .data-table, and the status pills reuse .badge's shape so an SMS
   outcome reads like every other state in the product.
   --------------------------------------------------------------- */

/* The numbers you check before spending money: recipients, how many
   will actually be texted, and what is left in the account. */
.sms-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: baseline;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.sms-summary strong { font-size: var(--text-2xl); }
.sms-summary > div { display: flex; align-items: baseline; gap: var(--space-1); }

/* .detail-form is a four-column field grid at >=980px, so a card
   holding one column of content needs `stacked` -- see CLAUDE.md.
   These are the grids inside it. */
.sms-settings-grid {
  display: grid;
  gap: var(--space-3) var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.sms-merge-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* A merge field already in the message: clicking it again takes it out,
   so it has to look switched on rather than merely available. */
.sms-merge-buttons .button.active {
  background: var(--brand-100);
  border-color: var(--brand-400);
  color: var(--brand-700);
}

.sms-form textarea { width: 100%; font-family: inherit; }
.sms-counter strong { font-variant-numeric: tabular-nums; }
.sms-sent-template { white-space: pre-wrap; margin: 0; }

.sms-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* The send bar stays at the foot of the page, as the original's did, so
   the button is reachable without scrolling back up a long list. */
.sms-action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.sms-action-bar .spacer { flex: 1; }

.sms-table .sms-preview-cell { max-width: 32rem; white-space: pre-wrap; }
/* Somebody who cannot be texted is still listed -- with the reason --
   rather than silently dropped, so the count on screen is explained. */
.sms-table tr.sms-skipped td { color: var(--ink-500); }

.sms-status {
  display: inline-block;
  padding: .0625rem var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}
.sms-status-sent { background: var(--success-bg); color: var(--success); }
.sms-status-failed { background: var(--error-bg); color: var(--error-text); }
.sms-status-skipped { background: var(--warn-bg); color: var(--warn-text); }
.sms-status-sending, .sms-status-queued { background: var(--brand-50); color: var(--brand-700); }

.alert.inline { display: inline-block; margin-left: var(--space-2); }

/* AI assistance keeps provider setup, trust guidance and feature controls
   visually separate. All AI actions remain review-first; this is polish only. */
.ai-page-header .module-page-icon { background: var(--accent-purple-bg); color: var(--accent-purple); }
.ai-settings-shell { display: grid; gap: var(--space-5); padding-bottom: var(--space-6); }
.ai-readiness { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-left: var(--space-1) solid var(--ink-400); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.ai-readiness.is-ready { border-left-color: var(--success); background: color-mix(in srgb, var(--success-bg) 56%, var(--surface-1)); }
.ai-readiness.is-paused { border-left-color: var(--module-work); background: color-mix(in srgb, var(--module-work-soft) 58%, var(--surface-1)); }
.ai-readiness.needs-setup { border-left-color: var(--accent-purple); background: color-mix(in srgb, var(--accent-purple-bg) 62%, var(--surface-1)); }
.ai-readiness-icon { color: var(--accent-purple); font-size: var(--text-3xl); }
.ai-readiness.is-ready .ai-readiness-icon { color: var(--success); }
.ai-readiness.is-paused .ai-readiness-icon { color: var(--module-work); }
.ai-readiness-copy small, .ai-panel-heading small, .ai-trust-panel > div small, .ai-master-control small, .ai-feature-section > header small { color: var(--ink-400); font-size: var(--text-2xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ai-readiness-copy h2, .ai-panel-heading h2, .ai-trust-panel h2, .ai-master-control h2, .ai-feature-section h2 { margin: var(--space-0) 0 0; color: var(--ink-900); font-size: var(--text-2xl); }
.ai-readiness-copy p, .ai-panel-heading p, .ai-master-control p, .ai-feature-section > header p { margin: var(--space-1) 0 0; color: var(--ink-500); }
.ai-readiness-meta { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); }
.ai-readiness-meta > span, .ai-feature-count, .ai-field-status { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--ink-600); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.ai-readiness-meta .material-icons, .ai-field-status .material-icons { color: var(--accent-purple); font-size: var(--text-xl); }
.ai-settings-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, .8fr); gap: var(--space-4); align-items: stretch; }
.ai-settings-panel, .ai-trust-panel, .ai-feature-section { padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--shadow-sm); }
.ai-panel-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); align-items: start; margin-bottom: var(--space-5); }
.ai-provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.ai-provider-grid .form-field { display: grid; gap: var(--space-1); }
.ai-provider-grid .form-field > label { color: var(--ink-600); font-size: var(--text-sm); font-weight: 700; }
.ai-provider-grid input, .ai-provider-grid select { width: 100%; min-height: 2.5rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink-800); font: inherit; }
.ai-provider-grid input:focus, .ai-provider-grid select:focus { outline: 2px solid color-mix(in srgb, var(--accent-purple) 36%, transparent); border-color: var(--accent-purple); }
.ai-provider-wide { grid-column: 1 / -1; }
.ai-field-status { margin-left: var(--space-1); padding-block: 0; border: 0; color: var(--success); }
.ai-field-status .material-icons { color: var(--success); }
.ai-provider-grid .field-help { color: var(--ink-400); font-size: var(--text-xs); font-weight: 400; }
.ai-remove-key { margin-top: var(--space-4); }
.ai-trust-panel { display: grid; align-content: start; gap: var(--space-3); background: linear-gradient(145deg, var(--accent-purple-bg), var(--surface-1)); }
.ai-trust-icon { color: var(--accent-purple); font-size: var(--text-3xl); }
.ai-trust-panel ul { display: grid; gap: var(--space-3); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.ai-trust-panel li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); color: var(--ink-600); font-size: var(--text-sm); }
.ai-trust-panel li > .material-icons { color: var(--accent-purple); font-size: var(--text-2xl); }
.ai-trust-panel li strong { display: block; margin-bottom: var(--space-0); color: var(--ink-800); }
.ai-trust-panel > p { margin: var(--space-2) 0 0; padding-top: var(--space-3); border-top: 1px solid color-mix(in srgb, var(--accent-purple) 18%, var(--line)); color: var(--ink-500); font-size: var(--text-xs); }
.ai-master-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); transition: border-color .15s ease, background .15s ease; }
.ai-master-control.is-on { border-color: color-mix(in srgb, var(--accent-purple) 36%, var(--line)); background: var(--accent-purple-bg); }
.ai-master-control:not(.is-on) .ai-master-icon { background: var(--surface-3); color: var(--ink-400); }
.ai-switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.ai-switch input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.ai-switch-track { display: inline-flex; align-items: center; width: 2.75rem; height: 1.5rem; padding: var(--space-0); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-3); transition: background .15s ease, border-color .15s ease; }
.ai-switch-track > span { width: 1rem; height: 1rem; border-radius: var(--radius-pill); background: var(--surface-1); box-shadow: var(--shadow-sm); transition: transform .15s ease; }
.ai-switch input:checked + .ai-switch-track { border-color: var(--accent-purple); background: var(--accent-purple); }
.ai-switch input:checked + .ai-switch-track > span { transform: translateX(1.2rem); }
.ai-switch input:focus-visible + .ai-switch-track { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.ai-switch > strong { min-width: var(--space-6); color: var(--ink-700); font-size: var(--text-sm); }
.ai-feature-section { display: grid; gap: var(--space-4); }
.ai-feature-section > header { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); }
.ai-feature-count { border-color: color-mix(in srgb, var(--accent-purple) 25%, var(--line)); color: var(--accent-purple-strong); }
.ai-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.ai-feature-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.ai-feature-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ai-feature-card.is-on { border-color: color-mix(in srgb, var(--accent-purple) 34%, var(--line)); background: color-mix(in srgb, var(--accent-purple-bg) 62%, var(--surface-1)); }
.ai-feature-icon { display: grid; width: var(--space-6); height: var(--space-6); place-items: center; border-radius: var(--radius-md); background: var(--surface-3); color: var(--ink-500); font-size: var(--text-2xl); }
.ai-feature-card.is-on .ai-feature-icon { background: var(--accent-purple); color: var(--on-accent); }
.ai-feature-copy { display: grid; gap: var(--space-1); }
.ai-feature-copy strong { color: var(--ink-800); }
.ai-feature-copy small { color: var(--ink-500); font-size: var(--text-sm); line-height: 1.45; }
.ai-coming-soon { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink-500); font-size: var(--text-sm); }
.ai-coming-soon .material-icons { color: var(--ink-400); font-size: var(--text-xl); }
.ai-save-bar { position: sticky; bottom: var(--space-3); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface-1) 94%, transparent); box-shadow: var(--shadow-md); backdrop-filter: blur(10px); }
.ai-save-bar > span { display: grid; gap: var(--space-0); color: var(--ink-700); }
.ai-save-bar > span small { color: var(--ink-400); font-size: var(--text-xs); }

@media (max-width: 900px) {
    .ai-settings-layout, .ai-feature-grid { grid-template-columns: 1fr; }
    .ai-readiness { grid-template-columns: auto minmax(0, 1fr); }
    .ai-readiness-meta { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 620px) {
    .ai-readiness, .ai-settings-panel, .ai-trust-panel, .ai-feature-section, .interaction-ai-followup { padding: var(--space-4); }
    .ai-provider-grid { grid-template-columns: 1fr; }
    .ai-provider-wide { grid-column: auto; }
    .ai-master-control { grid-template-columns: auto minmax(0, 1fr); }
    .ai-master-control > .ai-switch { grid-column: 1 / -1; justify-self: end; }
    .ai-feature-section > header, .ai-save-bar { align-items: stretch; flex-direction: column; }
    .ai-save-bar .button { width: 100%; }
    .interaction-ai-heading { grid-template-columns: auto minmax(0, 1fr); }
    .interaction-ai-review { grid-column: 1 / -1; justify-self: start; }
}

/* ------------------------------------------------------------------
   Appointments (tenant 0163): repeats, attendees, and the repeat/private
   markers on calendar items.
   ------------------------------------------------------------------ */
.appointment-repeat-detail { display: grid; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--surface-2); }
.appointment-repeat-every { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: 400; }
/* Outranks .record-edit-form's own input rule (width: 100%), which comes later. */
.record-edit-form .appointment-repeat .appointment-repeat-every input[type=number] { width: 4.5rem; display: inline-block; }
.appointment-days { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.appointment-days .checkbox-row { margin: 0; }
.appointment-repeat-end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.appointment-repeat-end label { margin: 0; }
.detail-form .appointment-repeat-end select, .detail-form .appointment-repeat-end input { width: auto; display: inline-block; }
.record-edit-form .appointment-repeat .appointment-repeat-end input[type=number] { width: 5rem; }
.appointment-attendee-list { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: grid; gap: var(--space-1); }
.appointment-attendee-list li { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.appointment-attendee-name { font-weight: 500; }
.appointment-attendee-list .button { margin: 0 0 0 auto; }
.appointment-attendee-add { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.detail-form .appointment-attendee-add input { flex: 1 1 12rem; width: auto; }
.appointment-attendee-add .button { margin: 0; }
.field-error { margin: var(--space-1) 0 0; color: var(--danger); font-size: var(--text-sm); }
.account-outlook { max-width: 40rem; }
.account-outlook-lists { margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-soft); border-radius: var(--radius-md); display: grid; gap: var(--space-1); }
.account-outlook-lists legend { padding: 0 var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--ink-600); }
.calendar-item-flag { font-size: var(--text-md); vertical-align: -2px; margin-right: var(--space-0); opacity: .75; }

/* ------------------------------------------------------------------
   Outlook app (control 0024): the setup page, the sign-in relay's
   "connected" page, and the add-in pane (wwwroot/outlook/pane), which
   loads this file for its tokens. The pane is ~320px wide inside
   Outlook, so everything in it is a single column.
   ------------------------------------------------------------------ */
.outlook-setup h2 { font-size: var(--text-xl); margin: var(--space-5) 0 var(--space-2); }
.outlook-setup h2:first-child { margin-top: 0; }
.outlook-setup-steps { margin: 0 0 var(--space-3); padding-left: var(--space-5); display: grid; gap: var(--space-1); }

.outlook-connected { display: grid; place-items: center; min-height: 100vh; margin: 0; background: var(--canvas); }
.outlook-connected-card { max-width: 26rem; padding: var(--space-6); text-align: center; }
.outlook-connected-card h1 { font-size: var(--text-3xl); margin: 0 0 var(--space-2); }

.oa-pane { margin: 0; padding: var(--space-3); background: var(--surface-1); color: var(--text); font-family: var(--font-sans); font-size: var(--text-md); }
.oa-pane h1 { font-size: var(--text-xl); margin: 0 0 var(--space-1); }
.oa-pane h2 { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); margin: var(--space-4) 0 var(--space-2); }
/* button[type=submit] (0,2,1) outranks .oa-pane .button, so Create kept the
   app-wide 24px top margin and sat below Cancel; name it here too. */
.oa-pane .button, .oa-pane button[type=submit] { margin-top: 0; }
.oa-pane [hidden] { display: none !important; }
.oa-head { display: flex; align-items: baseline; gap: var(--space-2); justify-content: space-between; }
.oa-link { background: none; border: 0; padding: 0; color: var(--brand-600); font: inherit; font-size: var(--text-sm); cursor: pointer; text-decoration: underline; }
.oa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.oa-head { align-items: flex-start; }
.oa-head h1 { line-height: 1.3; overflow-wrap: anywhere; }
.oa-icon-button {
    display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; padding: 0;
    border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-400); cursor: pointer;
}
.oa-icon-button:hover { border-color: var(--line); background: var(--surface-2); color: var(--danger-fg); }
.oa-icon-button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.oa-icon-button .material-icons { font-size: 18px; }
.oa-from { display: flex; align-items: center; gap: var(--space-1); margin: 0 0 var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line-soft); color: var(--ink-500); font-size: var(--text-sm); overflow-wrap: anywhere; }
.oa-from .material-icons { flex: none; font-size: 16px; color: var(--ink-300); }

/* Each record kind in its module colour and icon, as the CRM's own
   navigation shows it (KIND_ICON in taskpane.js). */
.k-company     { --k: var(--module-company);     --k-soft: var(--module-company-soft); }
.k-person      { --k: var(--module-person);      --k-soft: var(--module-person-soft); }
.k-lead        { --k: var(--module-lead);        --k-soft: var(--module-lead-soft); }
.k-opportunity { --k: var(--module-opportunity); --k-soft: var(--module-opportunity-soft); }
.k-case        { --k: var(--module-case);        --k-soft: var(--module-case-soft); }
.oa-kind-icon {
    display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem;
    border-radius: var(--radius-md); background: var(--k-soft, var(--brand-50)); color: var(--k, var(--brand-600));
}
.oa-kind-icon .material-icons { font-size: 20px; }
.oa-kind-icon.small { width: 1.375rem; height: 1.375rem; border-radius: var(--radius-sm); background: transparent; }
.oa-kind-icon.small .material-icons { font-size: 16px; }

.oa-item {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1);
    box-shadow: var(--shadow-sm); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.oa-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.oa-item.is-selected { border-color: var(--brand-400); background: var(--brand-50); }
.oa-item label { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-width: 0; margin: 0; cursor: pointer; }
.oa-item input { flex: none; width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--brand-600); cursor: pointer; }
.oa-check input { flex: none; width: auto; margin: 0; accent-color: var(--brand-600); }
.oa-item-text { display: grid; gap: var(--space-0); min-width: 0; }
.oa-item-title { font-weight: 600; color: var(--ink-900); overflow-wrap: anywhere; }
.oa-item-sub { color: var(--ink-500); font-size: var(--text-sm); overflow-wrap: anywhere; }
.oa-kind { color: var(--k, var(--brand-700)); font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.oa-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.oa-chip {
    display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%;
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
    border: 1px solid color-mix(in srgb, var(--k, var(--brand-600)) 30%, transparent); border-radius: var(--radius-pill);
    background: var(--k-soft, var(--brand-50)); color: var(--k, var(--brand-700)); font-size: var(--text-sm); font-weight: 600; text-decoration: none;
}
.oa-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oa-chip:hover { border-color: var(--k, var(--brand-600)); }
.oa-chip:focus-visible { outline: 2px solid var(--k, var(--brand-500)); outline-offset: 2px; }
.oa-create .button .material-icons { font-size: 16px; margin-right: var(--space-1); vertical-align: -3px; color: var(--k); }
.oa-create .button[data-create="company"] { --k: var(--module-company); }
.oa-create .button[data-create="person"] { --k: var(--module-person); }
.oa-create .button[data-create="company_person"] { --k: var(--module-company); }
.oa-create .button[data-create="lead"] { --k: var(--module-lead); }
.oa-create .button[data-create="case"] { --k: var(--module-case); }
.oa-create .button[data-create="opportunity"] { --k: var(--module-opportunity); }
.oa-field { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); }
.oa-field label { font-size: var(--text-sm); color: var(--ink-600); }
.oa-field input, .oa-field select, .oa-field textarea { width: 100%; box-sizing: border-box; padding: var(--space-1) var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; background: var(--surface-1); color: var(--text); }
.oa-check { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); margin: var(--space-2) 0; }
.oa-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.oa-lookup { position: relative; }
.oa-lookup-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: var(--space-1) 0 0; padding: var(--space-1); list-style: none; max-height: 14rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: var(--shadow-lg); }
.oa-lookup-option { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-800); font: inherit; text-align: left; cursor: pointer; }
.oa-lookup-option:hover, .oa-lookup-option:focus-visible { background: var(--brand-50); color: var(--brand-700); outline: none; }
.oa-lookup-option small { color: var(--ink-400); font-size: var(--text-xs); }
.oa-lookup-empty { padding: var(--space-2); color: var(--ink-400); font-size: var(--text-sm); }
.oa-create { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.oa-form { margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.oa-status { margin: var(--space-2) 0 0; }
/* "Already in the CRM?" -- likely duplicates offered before creating. */
.oa-duplicates {
    display: grid; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3);
    border: 1px solid var(--warning-line); border-radius: var(--radius-md); background: var(--warning-bg);
}
.oa-duplicates > p { margin: 0; }
.oa-dup {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2);
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1);
}
.oa-dup .oa-item-text { flex: 1; }
.oa-dup a.oa-item-title { color: var(--ink-900); text-decoration: none; }
.oa-dup a.oa-item-title:hover { color: var(--brand-600); text-decoration: underline; }
.oa-dup .button { flex: none; }

/* --- Components used in markup but never styled ------------------------
   Found 2026-10-01 by listing every class a .razor file uses that no
   stylesheet defines: the SMS history was a bare browser table, empty
   states were plain paragraphs, and the WhatsApp inbox had no layout. */
:where(.empty-state) {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center;
    color: var(--ink-400); font-size: var(--text-sm);
}
:where(.empty-state) > :is(h2, strong) { margin: 0; color: var(--ink-800); font-size: var(--text-lg); font-weight: 600; }
:where(.empty-state) > p { margin: 0; }
:where(.empty-state) > .material-icons {
    display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--brand-50); color: var(--brand-600); font-size: var(--text-3xl);
}
:where(.empty-state) > .button { margin-top: var(--space-2); }
:where(p.empty-state) { display: block; padding: var(--space-4); }

.form-error {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3);
    border: 1px solid var(--danger-line); border-radius: var(--radius-md);
    background: var(--danger-bg); color: var(--danger-fg); font-size: var(--text-sm);
}
.form-error > .button { margin-left: auto; }
.text-danger { color: var(--danger-fg); }

.callout {
    margin: var(--space-3) 0; padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line); border-left: 3px solid var(--brand-500);
    border-radius: var(--radius-md); background: var(--surface-3); color: var(--ink-600); font-size: var(--text-sm);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: minmax(0, 1fr); } }

.table-responsive { overflow-x: auto; }
.align-self-center { align-self: center; }

.consent-scopes { margin: var(--space-3) 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.consent-scopes > li { padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.consent-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

.new-credentials { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-3); }
.new-credentials dt { color: var(--ink-400); font-size: var(--text-xs); font-weight: 600; }
.new-credentials dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-sm); word-break: break-all; }

a.workqueue-link { text-decoration: none; }
a.workqueue-link:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.user-profile-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.report-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.report-empty-actions > .button, .report-empty-actions > button { margin-top: 0; }

.composer-loading, .report-result-loading { padding: var(--space-5); color: var(--ink-400); text-align: center; }
.report-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* Maximizer's "Show all" switch on a record's Notes / Documents /
   Interactions filter bar. The Interactions toolbar stacks its labels
   (caption over control), which would put the tick above its words. */
.show-all-toggle { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; cursor: pointer; }
.interaction-toolbar > label.show-all-toggle {
    display: inline-flex; flex: 0 0 auto; align-self: flex-end; min-height: 2.5rem;
    color: var(--ink-700); font-size: var(--text-sm); font-weight: 600;
}
.show-all-toggle input { width: 1rem; height: 1rem; margin: 0; }

/* "All 25 on this page are selected -- Select all 340 in this list". */
.selection-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2);
    margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3);
    border: 1px solid var(--brand-100); border-radius: var(--radius-md);
    background: var(--brand-50); color: var(--ink-700); font-size: var(--text-sm);
}
.selection-banner strong { color: var(--ink-900); }

/* WhatsApp inbox: a conversation list beside the open conversation. */
.mailbox-layout {
    display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    min-height: calc(100vh - 14rem); border: 1px solid var(--line); border-radius: var(--radius-lg);
    overflow: hidden; background: var(--surface-1); box-shadow: var(--shadow-sm);
}
.mailbox-list { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface-2); }
.mailbox-list > p { padding: var(--space-3); }
.list-toolbar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface-1); }
.list-toolbar select { width: auto; }
@media (max-width: 760px) {
    .mailbox-layout { grid-template-columns: minmax(0, 1fr); }
    .mailbox-list { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
}
