/* B2C CRM — the shared type scale, spacing grid and role classes for the pages under /b2c/ (UI density pass, 3 Oct 2026).
   One scale (five sizes, three weights) and an 8px spacing grid. Colours stay Erobella's (public/_ds/…/colors_and_type.css);
   the density and hierarchy borrow Pipedrive's conventions: 13px body / 12px secondary, semibold (600) titles and never 800,
   regular (400) values under grey labels, one colour signal per item, sentence-case grey column headers, and whitespace
   between groups rather than inside them. Spec: b2c-crm-research/ui-density-spec.md.
   Every page links this file in <head>; common.js also adds it to a page that does not link it yet (admin.html), because
   the style strings in common.js (B2C.S, nav, sync pill) use these variables. */

:root {
  --b2c-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* ── type scale ── */
  --b2c-text-xs: 11px;   /* chips, card meta tags, the nav footer */
  --b2c-text-sm: 12px;   /* labels, secondary text, meta, table headers */
  --b2c-text-md: 13px;   /* body, table cells, values, buttons, inputs */
  --b2c-text-lg: 14px;   /* card and section titles, nav items */
  --b2c-text-xl: 22px;   /* page title, big stat numbers */
  --b2c-regular: 400;    /* body text and values */
  --b2c-medium: 500;     /* controls, chips, table headers, meta tags */
  --b2c-semibold: 600;   /* titles and the one emphasised value per row (never 700/800) */

  /* ── colour roles (Erobella's neutrals; brand pink only for real links and the primary action) ── */
  --b2c-ink: rgb(3,7,18);          /* titles, body, values */
  --b2c-ink-2: rgb(58,57,50);      /* neutral chip text, quiet body text */
  --b2c-grey: rgb(107,114,128);    /* labels, subtitles, meta, table headers */
  --b2c-faint: rgb(140,137,128);   /* card meta tags, disabled text */
  --b2c-dash: rgb(205,202,190);    /* the "—" placeholder */
  --b2c-line: rgb(238,236,230);    /* card borders */
  --b2c-line-2: rgb(228,226,215);  /* control borders */
  --b2c-divider: rgb(243,242,238); /* row dividers inside a card */
  --b2c-tile: rgb(248,247,244);    /* inner blocks (no border inside a card) */
  --b2c-chip: rgb(244,243,239);    /* neutral chip background */
  --b2c-field: rgb(246,245,242);   /* search fields, segmented controls */
  --b2c-paper: rgb(251,250,247);   /* app background */
  --b2c-card: rgb(255,255,255);
  --b2c-dark: rgb(29,28,23);       /* nav, primary button, selected state */
  --b2c-nav: rgb(29,28,23);        /* the left nav (stays dark in both themes) */
  --b2c-link: rgb(200,40,95);
  --b2c-link-2: rgb(160,25,75);    /* link hover */
  --b2c-pink: rgb(231,64,124);
  --b2c-gradient: linear-gradient(180deg, rgb(231,64,124), rgb(239,128,94));

  /* ── status colours: text on its own tint, one hue per meaning. The dark theme (public/theme.css) swaps every value here;
     colours used only once or twice are written var(--b2c-x-<hex>, rgb(…)) in the pages, and theme.css gives those a dark value ── */
  --b2c-red: rgb(176,40,40);       /* errors, expired, do not call */
  --b2c-red-bg: rgb(253,237,237);
  --b2c-red-line: rgb(240,190,190);
  --b2c-green: rgb(74,124,53);     /* active gold, healthy, sent */
  --b2c-green-2: rgb(54,100,36);
  --b2c-green-bg: rgb(233,244,227);
  --b2c-green-line: rgb(190,220,175);
  --b2c-amber: rgb(176,96,10);     /* ending soon, at risk, waiting */
  --b2c-amber-2: rgb(150,80,0);
  --b2c-amber-bg: rgb(255,243,224);
  --b2c-amber-line: rgb(245,214,170);
  --b2c-blue: rgb(32,78,207);      /* info, running */
  --b2c-blue-bg: rgb(232,240,253);

  /* ── spacing: 8px grid ── */
  --b2c-page-pad: 24px;     /* page padding */
  --b2c-section-gap: 20px;  /* between page sections */
  --b2c-card-gap: 12px;     /* between cards */
  --b2c-card-pad: 16px;     /* inside a card */
  --b2c-row-gap: 8px;       /* between rows inside a card */

  /* ── shapes and control heights ── */
  --b2c-radius-card: 12px;
  --b2c-radius-ctl: 10px;
  --b2c-radius-chip: 6px;
  --b2c-h-ctl: 34px;        /* buttons, inputs */
  --b2c-h-ctl-sm: 30px;     /* selects, segmented controls, small tabs */
  --b2c-h-chip: 20px;
  --b2c-h-nav: 38px;
}

body { margin: 0; background: var(--b2c-paper); font-family: var(--b2c-font); color: var(--b2c-ink); -webkit-font-smoothing: antialiased; }

/* ── type roles ── */
.b2c-h1 { margin: 0; font: var(--b2c-semibold) var(--b2c-text-xl)/28px var(--b2c-font); letter-spacing: -0.01em; color: var(--b2c-ink); }
.b2c-sub { margin: 0; font: var(--b2c-regular) var(--b2c-text-md)/18px var(--b2c-font); color: var(--b2c-grey); }
.b2c-h2 { margin: 0; font: var(--b2c-semibold) var(--b2c-text-lg)/20px var(--b2c-font); color: var(--b2c-ink); }
.b2c-tag { font: var(--b2c-medium) var(--b2c-text-xs)/16px var(--b2c-font); color: var(--b2c-faint); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.b2c-body { font: var(--b2c-regular) var(--b2c-text-md)/18px var(--b2c-font); color: var(--b2c-ink); }
.b2c-strong { font-weight: var(--b2c-semibold); }
.b2c-meta { font: var(--b2c-regular) var(--b2c-text-sm)/16px var(--b2c-font); color: var(--b2c-grey); }
.b2c-th { font: var(--b2c-medium) var(--b2c-text-sm)/16px var(--b2c-font); color: var(--b2c-grey); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.b2c-stat { font: var(--b2c-semibold) var(--b2c-text-xl)/28px var(--b2c-font); letter-spacing: -0.01em; color: var(--b2c-ink); font-variant-numeric: tabular-nums; }
.b2c-num { font-variant-numeric: tabular-nums; text-align: right; }
.b2c-dash { color: var(--b2c-dash); }

/* ── surfaces ── */
.b2c-card { background: var(--b2c-card); border: 1px solid var(--b2c-line); border-radius: var(--b2c-radius-card); box-sizing: border-box; }
.b2c-card-head { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.b2c-tile { background: var(--b2c-tile); border-radius: var(--b2c-radius-ctl); padding: 12px; box-sizing: border-box; }

/* label → value rows: label 12px grey, value 13px regular, left-aligned beside it; long values wrap under themselves */
.b2c-kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--b2c-row-gap) 12px; align-items: baseline; margin: 0; }
.b2c-kv-l { font: var(--b2c-regular) var(--b2c-text-sm)/18px var(--b2c-font); color: var(--b2c-grey); }
.b2c-kv-v { font: var(--b2c-regular) var(--b2c-text-md)/18px var(--b2c-font); color: var(--b2c-ink); min-width: 0; overflow-wrap: anywhere; }

/* ── timeline: a quiet list on a 1px rail; 24px tinted icon, title + grey meta on one line, body below ── */
.b2c-tl { display: flex; flex-direction: column; gap: 16px; }
.b2c-tl-date { font: var(--b2c-medium) var(--b2c-text-sm)/16px var(--b2c-font); color: var(--b2c-grey); padding: 4px 0 0 36px; }
.b2c-tl-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; }
.b2c-tl-item::before { content: ''; position: absolute; left: 11.5px; top: 28px; bottom: -14px; width: 1px; background: var(--b2c-line); }
.b2c-tl-item:last-child::before { display: none; }
.b2c-tl-icon { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: var(--b2c-semibold) 9px/1 var(--b2c-font); letter-spacing: 0; flex-shrink: 0; }
.b2c-tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-height: 24px; align-content: center; }
.b2c-tl-title { font: var(--b2c-semibold) var(--b2c-text-md)/18px var(--b2c-font); color: var(--b2c-ink); }
.b2c-tl-meta { font: var(--b2c-regular) var(--b2c-text-sm)/18px var(--b2c-font); color: var(--b2c-grey); }
.b2c-tl-body { margin-top: 4px; font: var(--b2c-regular) var(--b2c-text-md)/19px var(--b2c-font); color: var(--b2c-ink-2); overflow-wrap: anywhere; }

/* a grid "table" that is wider than a phone scrolls inside its card instead of widening the page */
.b2c-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── app shell: header, search, user, icon buttons, page section ── */
.b2c-hdr { height: 56px; flex-shrink: 0; box-sizing: border-box; padding: 0 var(--b2c-page-pad); display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--b2c-line); background: var(--b2c-card); }
.b2c-seg { display: flex; padding: 2px; border-radius: var(--b2c-radius-ctl); background: var(--b2c-field); gap: 2px; flex-shrink: 0; }
.b2c-hdr-search { flex: 1 1 auto; min-width: 0; max-width: 480px; display: flex; align-items: center; gap: 8px; height: var(--b2c-h-ctl); box-sizing: border-box; padding: 0 12px; border-radius: var(--b2c-radius-ctl); background: var(--b2c-field); color: var(--b2c-grey); }
.b2c-hdr-search input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; font: var(--b2c-regular) var(--b2c-text-md) var(--b2c-font); color: var(--b2c-ink); outline: none; }
.b2c-hdr-user { display: flex; align-items: center; gap: 8px; border: 0; padding: 0; background: transparent; cursor: pointer; font-family: var(--b2c-font); }
.b2c-avatar-me { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--b2c-gradient); color: rgb(255,255,255); font: var(--b2c-semibold) var(--b2c-text-xs)/1 var(--b2c-font); display: flex; align-items: center; justify-content: center; }
.b2c-hdr-name { font: var(--b2c-medium) var(--b2c-text-md) var(--b2c-font); color: var(--b2c-ink); white-space: nowrap; }
/* the role part only: DC renders every {{ x }} as <span class="sc-interp">, so never style a bare descendant span */
.b2c-hdr-name > span:not(.sc-interp) { color: var(--b2c-grey); font-weight: var(--b2c-regular); }
.b2c-icon-btn { position: relative; flex-shrink: 0; width: var(--b2c-h-ctl); height: var(--b2c-h-ctl); box-sizing: border-box; border-radius: var(--b2c-radius-ctl); border: 1px solid var(--b2c-line-2); background: var(--b2c-card); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--b2c-ink); padding: 0; }
.b2c-menu { position: absolute; right: 0; top: 38px; z-index: 30; background: var(--b2c-card); border: 1px solid var(--b2c-line-2); border-radius: var(--b2c-radius-ctl); box-shadow: 0 4px 24px rgba(0,0,0,0.12); padding: 4px; min-width: 160px; display: flex; flex-direction: column; }
.b2c-menu > a, .b2c-menu > button { padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--b2c-ink); font: var(--b2c-medium) var(--b2c-text-md) var(--b2c-font); }
.b2c-menu > a:hover, .b2c-menu > button:hover { background: var(--b2c-field); color: var(--b2c-ink); }
.b2c-page { padding: var(--b2c-page-pad) var(--b2c-page-pad) 40px; display: flex; flex-direction: column; gap: var(--b2c-section-gap); box-sizing: border-box; min-width: 0; }
.b2c-sync-text { white-space: nowrap; }
/* Light / Dark / System in the user menu (public/theme.js) */
.b2c-theme { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; margin: 2px 0; border-top: 1px solid var(--b2c-divider); border-bottom: 1px solid var(--b2c-divider); min-width: 200px; }
.b2c-theme-l { font: var(--b2c-medium) var(--b2c-text-sm)/16px var(--b2c-font); color: var(--b2c-grey); }
.b2c-sr { position: absolute; left: -9999px; }

/* ── nav extras (the links themselves are styled by common.js navVals) ── */
.b2c-nav-foot { margin-top: auto; padding: 0 12px; font: var(--b2c-regular) var(--b2c-text-xs)/16px var(--b2c-font); color: rgb(150,147,137); cursor: default; }

/* ── phones: header wraps (search drops to its own row), page padding tightens; wide grids scroll inside their card ── */
@media (max-width: 760px) {
  :root { --b2c-page-pad: 12px; }
  .b2c-hdr { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px 10px; }
  .b2c-hdr-search { order: 10; flex: 1 1 100%; max-width: none; }
  .b2c-hdr-name, .b2c-sync-text { display: none; }
  .b2c-page { padding: 16px var(--b2c-page-pad) 32px; }
}
