/* =====================================================================
   LEGEND CRM — DESIGN SYSTEM (ui.css)
   RTL · עברית · Salesforce-grade · zero build step
   Owns: design tokens, reset, app shell, every component.
   Builders consume via classes + the global UI.* helpers (ui.js).
   ===================================================================== */

/* ------------------------------------------------------------------ */
/* 1. DESIGN TOKENS                                                    */
/* ------------------------------------------------------------------ */
:root {
  /* brand palette (authoritative — matches Idan's existing app) */
  --emerald:        #0e7a5f;
  --emerald-d:      #0a5e49;
  --emerald-l:      #128a6c;
  --emerald-soft:   #e6f4ef;
  --emerald-soft-2: #d4ece4;
  --ink:            #16202c;
  --ink-2:          #243140;
  --muted:          #69788a;
  --muted-2:        #94a3b3;
  --gold:           #b07d12;
  --gold-soft:      #f7eccf;
  --bg:             #eef2f7;
  --surface:        #ffffff;
  --surface-2:      #f7f9fc;
  --line:           #e4e9f0;
  --line-2:         #eef1f6;

  /* status / tone palette */
  --red:            #c0392b;
  --red-soft:       #fbe6e3;
  --blue:           #2563a8;
  --blue-soft:      #e4eef9;
  --amber:          #c98a14;
  --green:          #1e9e6a;

  /* spacing scale (4px base — use everywhere for rhythm) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;

  /* geometry */
  --radius:         15px;
  --radius-sm:      10px;
  --radius-xs:      8px;
  --radius-pill:    999px;

  /* layout rhythm helpers */
  --content-max:    1280px;
  --board-top:      150px; /* topbar + page-head reserve for kanban height calc */

  /* elevation */
  --shadow-sm:      0 1px 2px rgba(16,32,48,.05);
  --shadow-md:      0 4px 14px rgba(16,32,48,.08);
  --shadow-lg:      0 10px 30px rgba(16,32,48,.07);
  --shadow-xl:      0 22px 60px rgba(16,32,48,.16);
  --ring:           0 0 0 3px rgba(14,122,95,.18);

  /* typography */
  --font:           'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;

  /* layout metrics */
  --topbar-h:       60px;
  --nav-w:          228px;
  --nav-w-collapsed: 72px;

  /* motion */
  --t-fast:   120ms cubic-bezier(.4,0,.2,1);
  --t:        200ms cubic-bezier(.4,0,.2,1);
  --t-slow:   320ms cubic-bezier(.16,1,.3,1);

  /* z-index scale */
  --z-nav:    40;
  --z-topbar: 50;
  --z-drawer: 70;
  --z-modal:  80;
  --z-toast:  100;
  --z-palette:90;
}

/* ------------------------------------------------------------------ */
/* 2. RESET / BASE                                                     */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; color: var(--ink); line-height: 1.3; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8e3; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b6c2d1; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* utility */
.lc-hidden { display: none !important; }
.lc-row { display: flex; align-items: center; }
.lc-col { display: flex; flex-direction: column; }
.lc-gap-xs { gap: 6px; } .lc-gap-sm { gap: 10px; } .lc-gap { gap: 16px; } .lc-gap-lg { gap: 24px; }
.lc-grow { flex: 1 1 auto; min-width: 0; }
.lc-spacer { flex: 1 1 auto; }
.lc-wrap { flex-wrap: wrap; }
.lc-muted { color: var(--muted); }
.lc-strong { font-weight: 700; }
.lc-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.lc-center { text-align: center; }

/* ------------------------------------------------------------------ */
/* 3. APP SHELL                                                        */
/* ------------------------------------------------------------------ */
#app { min-height: 100vh; }

/* top bar (fixed) */
.lc-topbar {
  position: fixed; inset-block-start: 0; inset-inline: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-topbar);
}
.lc-brand { display: flex; align-items: center; gap: 11px; user-select: none; }
.lc-brand__mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--emerald) 0%, var(--emerald-d) 100%);
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(14,122,95,.32);
}
.lc-brand__name { font-weight: 800; font-size: 17px; letter-spacing: -.3px; }
.lc-brand__sub { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: -2px; }

.lc-topbar__search {
  flex: 0 1 380px; margin-inline-start: 8px;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  cursor: text;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.lc-topbar__search:hover { border-color: #d6dde7; }
.lc-topbar__search:focus-within { background: #fff; border-color: var(--emerald); box-shadow: var(--ring); }
.lc-topbar__search input { flex: 1; border: none; background: none; outline: none; font-size: 14px; color: var(--ink); }
.lc-topbar__search kbd {
  font-family: var(--font); font-size: 11px; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; box-shadow: 0 1px 0 var(--line);
}
.lc-topbar__actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

/* nav toggle (mobile) */
.lc-nav-toggle {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center; font-size: 18px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
}

/* side nav (RIGHT in RTL) */
.lc-nav {
  position: fixed; inset-block: var(--topbar-h) 0; inset-inline-end: 0;
  width: var(--nav-w);
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: var(--z-nav);
  overflow-y: auto;
  transition: transform var(--t-slow);
}
.lc-nav__group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted-2); text-transform: uppercase;
  padding: 14px 12px 6px;
}
.lc-nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 600; font-size: 14.5px;
  position: relative; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.lc-nav__item:hover { background: var(--surface-2); }
.lc-nav__icon { font-size: 18px; width: 22px; text-align: center; flex: none; line-height: 1; }
.lc-nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-nav__count {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 1px 8px; min-width: 22px; text-align: center;
}
.lc-nav__item.is-active {
  background: var(--emerald-soft); color: var(--emerald-d);
}
.lc-nav__item.is-active .lc-nav__count { background: #fff; color: var(--emerald-d); border-color: var(--emerald-soft-2); }
.lc-nav__item.is-active::before {
  content: ""; position: absolute; inset-inline-end: -12px; inset-block: 8px;
  width: 3px; border-radius: 3px; background: var(--emerald);
}
.lc-nav__foot { margin-top: auto; padding: 12px; color: var(--muted-2); font-size: 11.5px; }

/* main */
.lc-main {
  margin-block-start: var(--topbar-h);
  margin-inline-end: var(--nav-w);
  min-height: calc(100vh - var(--topbar-h));
  padding: 26px 30px 60px;
}
.lc-view { max-width: var(--content-max); margin: 0 auto; animation: lc-fade-up var(--t) both; }
@keyframes lc-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* page header */
.lc-page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.lc-page-head__titles { min-width: 0; }
.lc-page-head h1 { font-size: 23px; letter-spacing: -.4px; }
.lc-page-head__sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.lc-page-head__actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; flex-wrap: wrap; }

/* toolbar (search + filters above lists) */
.lc-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.lc-search {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 13px; min-width: 230px; flex: 0 1 320px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--muted);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.lc-search:focus-within { border-color: var(--emerald); box-shadow: var(--ring); color: var(--ink); }
.lc-search input { flex: 1; border: none; outline: none; background: none; font-size: 14px; }

/* ------------------------------------------------------------------ */
/* 4. BUTTONS                                                          */
/* ------------------------------------------------------------------ */
.lc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  border: 1px solid transparent; user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.lc-btn:active { transform: translateY(1px); }
.lc-btn[disabled], .lc-btn.is-loading { opacity: .6; pointer-events: none; }
.lc-btn__ico { font-size: 16px; line-height: 1; }

.lc-btn--primary {
  background: linear-gradient(145deg, var(--emerald) 0%, var(--emerald-d) 100%);
  color: #fff; box-shadow: 0 4px 12px rgba(14,122,95,.26);
}
.lc-btn--primary:hover { box-shadow: 0 6px 18px rgba(14,122,95,.34); filter: brightness(1.03); }

.lc-btn--ghost {
  background: var(--surface); color: var(--ink-2); border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.lc-btn--ghost:hover { border-color: #d3dbe5; background: var(--surface-2); }

.lc-btn--subtle { background: var(--surface-2); color: var(--ink-2); }
.lc-btn--subtle:hover { background: #eef2f7; }

.lc-btn--danger { background: var(--surface); color: var(--red); border-color: var(--red-soft); box-shadow: var(--shadow-sm); }
.lc-btn--danger:hover { background: var(--red-soft); border-color: #f3c9c3; }

.lc-btn--danger-solid { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(192,57,43,.24); }
.lc-btn--danger-solid:hover { filter: brightness(1.05); }

.lc-btn--gold { background: var(--gold); color: #fff; box-shadow: 0 4px 12px rgba(176,125,18,.24); }
.lc-btn--gold:hover { filter: brightness(1.05); }

.lc-btn--sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-xs); }
.lc-btn--lg { height: 46px; padding: 0 22px; font-size: 15px; }
.lc-btn--icon { width: 40px; padding: 0; }
.lc-btn--icon.lc-btn--sm { width: 32px; }
.lc-btn--block { width: 100%; }

/* link button */
.lc-link { color: var(--emerald-d); font-weight: 600; cursor: pointer; }
.lc-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* 5. CARDS / SURFACES                                                 */
/* ------------------------------------------------------------------ */
.lc-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.lc-card--pad { padding: 20px; }
.lc-card--hover { transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.lc-card--hover:hover { box-shadow: var(--shadow-lg); border-color: #dbe2ec; }
.lc-card__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.lc-card__title { font-size: 15px; font-weight: 700; }
.lc-card__title .lc-card__sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.lc-card__body { padding: 18px 20px; }
.lc-card__foot { padding: 14px 20px; border-top: 1px solid var(--line-2); }

.lc-section-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; margin-bottom: 12px; }

/* ------------------------------------------------------------------ */
/* 6. STAT CARDS (dashboard KPIs)                                      */
/* ------------------------------------------------------------------ */
.lc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.lc-stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t);
}
.lc-stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.lc-stat::after {
  content: ""; position: absolute; inset-block-start: 0; inset-inline-start: 0;
  width: 4px; height: 100%; background: var(--emerald); opacity: .9;
}
.lc-stat--gold::after { background: var(--gold); }
.lc-stat--blue::after { background: var(--blue); }
.lc-stat--red::after { background: var(--red); }
.lc-stat__label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.lc-stat__ico { font-size: 15px; }
.lc-stat__value { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.lc-stat__meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.lc-stat__meta .up { color: var(--green); font-weight: 700; }
.lc-stat__meta .down { color: var(--red); font-weight: 700; }

/* ------------------------------------------------------------------ */
/* 7. BADGES / PILLS                                                   */
/* ------------------------------------------------------------------ */
.lc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.lc-badge--neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.lc-badge--emerald { background: var(--emerald-soft); color: var(--emerald-d); border-color: var(--emerald-soft-2); }
.lc-badge--gold    { background: var(--gold-soft); color: var(--gold); border-color: #efdcb0; }
.lc-badge--red     { background: var(--red-soft); color: var(--red); border-color: #f3c9c3; }
.lc-badge--blue    { background: var(--blue-soft); color: var(--blue); border-color: #cfe0f3; }
.lc-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* stage chip — color driven inline by stages.color (var --chip) */
.lc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; line-height: 1;
  padding: 5px 11px; border-radius: var(--radius-pill);
  color: var(--chip, var(--muted));
  background: color-mix(in srgb, var(--chip, var(--muted)) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--chip, var(--muted)) 26%, #fff);
}
.lc-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip, var(--muted)); }

/* probability meter */
.lc-prob { display: inline-flex; align-items: center; gap: 8px; min-width: 92px; }
.lc-prob__track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.lc-prob__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--emerald-l), var(--emerald)); }
.lc-prob__num { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; }

/* ------------------------------------------------------------------ */
/* 8. TABLES / LIST VIEWS                                              */
/* ------------------------------------------------------------------ */
.lc-table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.lc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lc-table thead th {
  text-align: right; font-weight: 700; font-size: 12px; color: var(--muted);
  letter-spacing: .02em; padding: 12px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.lc-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.lc-table tbody tr:last-child td { border-bottom: none; }
.lc-table tbody tr { transition: background var(--t-fast); }
.lc-table tbody tr.is-clickable { cursor: pointer; }
.lc-table tbody tr.is-clickable:hover { background: var(--emerald-soft); }
.lc-table tbody tr.is-clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--emerald); }
.lc-table .lc-cell-strong { font-weight: 700; color: var(--ink); }
.lc-table .lc-cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lc-table td.lc-cell-num { font-variant-numeric: tabular-nums; }
.lc-table td.lc-cell-actions { text-align: left; white-space: nowrap; }

.lc-table-foot {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; background: var(--surface-2);
}

/* avatar */
.lc-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: var(--emerald-d); background: var(--emerald-soft); border: 1px solid var(--emerald-soft-2);
}
.lc-avatar--gold { color: var(--gold); background: var(--gold-soft); border-color: #efdcb0; }
.lc-avatar--blue { color: var(--blue); background: var(--blue-soft); border-color: #cfe0f3; }
.lc-id-cell { display: flex; align-items: center; gap: 11px; }

/* ------------------------------------------------------------------ */
/* 9. FORM FIELDS                                                      */
/* ------------------------------------------------------------------ */
.lc-field { display: flex; flex-direction: column; gap: 6px; }
.lc-field__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.lc-field__label .req { color: var(--red); margin-inline-start: 2px; }
.lc-field__hint { font-size: 11.5px; color: var(--muted); }
.lc-input, .lc-select, .lc-textarea {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--ink); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.lc-input::placeholder, .lc-textarea::placeholder { color: var(--muted-2); }
.lc-input:hover, .lc-select:hover, .lc-textarea:hover { border-color: #d3dbe5; }
.lc-input:focus, .lc-select:focus, .lc-textarea:focus { outline: none; border-color: var(--emerald); box-shadow: var(--ring); }
.lc-textarea { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.lc-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2369788a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; padding-inline-start: 38px;
}
.lc-input.is-error, .lc-select.is-error, .lc-textarea.is-error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.14); }
.lc-field__err { font-size: 11.5px; color: var(--red); font-weight: 600; }

/* inline-editable field used in drawers (auto-save) */
.lc-inline-field { position: relative; }
.lc-inline-field .lc-saving {
  position: absolute; inset-block-start: 0; inset-inline-start: 0; font-size: 11px; color: var(--emerald);
  font-weight: 700; opacity: 0; transition: opacity var(--t-fast); pointer-events: none;
}
.lc-inline-field.is-saving .lc-saving { opacity: 1; }

/* checkbox / switch */
.lc-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-weight: 600; }
.lc-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.lc-check__box {
  width: 20px; height: 20px; border-radius: 6px; border: 1.6px solid var(--line);
  background: #fff; display: grid; place-items: center; transition: background var(--t-fast), border-color var(--t-fast);
}
.lc-check__box::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: rotate(45deg) scale(0); transition: transform var(--t-fast); margin-top: -2px; }
.lc-check input:checked + .lc-check__box { background: var(--emerald); border-color: var(--emerald); }
.lc-check input:checked + .lc-check__box::after { transform: rotate(45deg) scale(1); }
.lc-check input:focus-visible + .lc-check__box { box-shadow: var(--ring); }

.lc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lc-form-grid .lc-col-full { grid-column: 1 / -1; }

/* segmented control / filter tabs */
.lc-seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.lc-seg__btn {
  padding: 6px 14px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.lc-seg__btn:hover { color: var(--ink-2); }
.lc-seg__btn.is-active { background: var(--surface); color: var(--emerald-d); box-shadow: var(--shadow-sm); }

/* filter select (compact, in toolbar) */
.lc-filter { height: 40px; min-width: 150px; }

/* ------------------------------------------------------------------ */
/* 10. KANBAN / PIPELINE                                               */
/* ------------------------------------------------------------------ */
.lc-kanban { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 18px; align-items: flex-start; }
.lc-kanban__col {
  flex: 0 0 288px; width: 288px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 230px);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.lc-kanban__col-head {
  display: flex; align-items: center; gap: 9px; padding: 13px 15px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0; z-index: 1;
}
.lc-kanban__col-head .lc-col-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--chip, var(--muted)); flex: none; }
.lc-kanban__col-title { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.lc-kanban__col-count { font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 9px; }
.lc-kanban__col-sum { font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 0 15px 8px; }
.lc-kanban__list { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; min-height: 80px; }
.lc-kanban__col.is-drop-target { background: var(--emerald-soft); border-color: var(--emerald); }
.lc-kanban__col.is-drop-target .lc-kanban__col-head { background: var(--emerald-soft); }

.lc-kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; box-shadow: var(--shadow-sm); cursor: grab;
  transition: box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
}
.lc-kcard:hover { box-shadow: var(--shadow-md); border-color: #dbe2ec; transform: translateY(-1px); }
.lc-kcard:active { cursor: grabbing; }
.lc-kcard.is-dragging { opacity: .45; box-shadow: var(--shadow-xl); transform: rotate(1.5deg) scale(1.02); border-color: var(--emerald); }
.lc-kcard__title { font-weight: 700; font-size: 14px; margin-bottom: 6px; line-height: 1.35; }
.lc-kcard__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.lc-kcard__val { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.lc-kcard__foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line-2); }

/* ------------------------------------------------------------------ */
/* 11. DASHBOARD CHARTS (CSS-only)                                     */
/* ------------------------------------------------------------------ */
/* horizontal bar list (pipeline by stage) */
.lc-bars { display: flex; flex-direction: column; gap: 13px; }
.lc-bar__top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.lc-bar__label { font-size: 13px; font-weight: 600; }
.lc-bar__value { margin-inline-start: auto; font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lc-bar__track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.lc-bar__fill { height: 100%; border-radius: 999px; background: var(--chip, var(--emerald)); width: 0; transition: width var(--t-slow); }

/* donut (conic-gradient driven by --p 0..100 and --chip color) */
.lc-donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.lc-donut {
  --p: 0; --chip: var(--emerald);
  width: 132px; height: 132px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--chip) calc(var(--p) * 1%), var(--line) 0);
}
.lc-donut::after {
  content: ""; position: absolute; inset: 16px; border-radius: 50%; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.lc-donut__center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 1; }
.lc-donut__center b { font-size: 22px; font-weight: 800; display: block; line-height: 1; }
.lc-donut__center span { font-size: 11px; color: var(--muted); }
.lc-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 160px; }
.lc-legend__item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.lc-legend__dot { width: 10px; height: 10px; border-radius: 3px; background: var(--chip, var(--muted)); flex: none; }
.lc-legend__val { margin-inline-start: auto; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* urgent / today panel */
.lc-urgent { display: flex; flex-direction: column; gap: 10px; }
.lc-urgent__item {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.lc-urgent__item:hover { box-shadow: var(--shadow-md); border-color: #dbe2ec; }
.lc-urgent__rank {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums;
  background: linear-gradient(145deg, var(--gold) 0%, #946810 100%); box-shadow: 0 3px 9px rgba(176,125,18,.28);
}
.lc-urgent__item.is-hot .lc-urgent__rank { background: linear-gradient(145deg, var(--red) 0%, #9c2b1f 100%); box-shadow: 0 3px 9px rgba(192,57,43,.28); }
.lc-urgent__body { flex: 1; min-width: 0; }
.lc-urgent__title { font-weight: 700; font-size: 14px; }
.lc-urgent__why { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lc-urgent__actions { display: flex; align-items: center; gap: 7px; flex: none; }

/* activity feed */
.lc-feed { display: flex; flex-direction: column; }
.lc-feed__item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.lc-feed__item:last-child { border-bottom: none; }
.lc-feed__ico { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; }
.lc-feed__body { flex: 1; min-width: 0; }
.lc-feed__text { font-size: 13.5px; }
.lc-feed__time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------------ */
/* 12. DRAWER (slide-in from right edge in RTL)                        */
/* ------------------------------------------------------------------ */
.lc-overlay {
  position: fixed; inset: 0; background: rgba(16,32,48,.34);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity var(--t); z-index: var(--z-drawer);
}
.lc-overlay.is-open { opacity: 1; }
.lc-drawer {
  position: fixed; inset-block: 0; inset-inline-start: 0; /* visually slides from right edge in RTL */
  width: min(480px, 100vw); max-width: 100vw; height: 100%;
  background: var(--surface); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform var(--t-slow);
  z-index: calc(var(--z-drawer) + 1);
}
.lc-drawer.is-open { transform: none; }
.lc-drawer__head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--line); flex: none;
}
.lc-drawer__title { font-size: 17px; font-weight: 800; flex: 1; min-width: 0; }
.lc-drawer__title .lc-drawer__sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.lc-drawer__close {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 19px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  transition: background var(--t-fast), color var(--t-fast);
}
.lc-drawer__close:hover { background: var(--red-soft); color: var(--red); border-color: #f3c9c3; }
.lc-drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.lc-drawer__foot { flex: none; padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; }

/* drawer detail rows */
.lc-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.lc-detail-grid .lc-col-full { grid-column: 1 / -1; }
.lc-detail { display: flex; flex-direction: column; gap: 3px; }
.lc-detail__label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.lc-detail__value { font-size: 14px; font-weight: 600; color: var(--ink); }

/* drawer tabs */
.lc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 18px; }
.lc-tab { padding: 9px 13px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast); }
.lc-tab:hover { color: var(--ink-2); }
.lc-tab.is-active { color: var(--emerald-d); border-bottom-color: var(--emerald); }

/* timeline (related activities) */
.lc-timeline { display: flex; flex-direction: column; gap: 2px; }
.lc-timeline__item { display: flex; gap: 12px; }
.lc-timeline__rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.lc-timeline__dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.lc-timeline__line { flex: 1; width: 2px; background: var(--line); margin: 2px 0; }
.lc-timeline__item:last-child .lc-timeline__line { display: none; }
.lc-timeline__content { padding-bottom: 16px; flex: 1; min-width: 0; }
.lc-timeline__content b { font-size: 13.5px; }
.lc-timeline__content p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.lc-timeline__time { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ------------------------------------------------------------------ */
/* 13. MODAL                                                           */
/* ------------------------------------------------------------------ */
.lc-modal-overlay {
  position: fixed; inset: 0; background: rgba(16,32,48,.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; transition: opacity var(--t); z-index: var(--z-modal);
}
.lc-modal-overlay.is-open { opacity: 1; }
.lc-modal {
  width: min(540px, 100%); max-height: calc(100vh - 48px);
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-xl); display: flex; flex-direction: column;
  transform: translateY(14px) scale(.98); opacity: 0; transition: transform var(--t-slow), opacity var(--t-slow);
}
.lc-modal-overlay.is-open .lc-modal { transform: none; opacity: 1; }
.lc-modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.lc-modal__title { font-size: 17px; font-weight: 800; flex: 1; }
.lc-modal__close { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); transition: background var(--t-fast), color var(--t-fast); }
.lc-modal__close:hover { background: var(--red-soft); color: var(--red); }
.lc-modal__body { padding: 22px; overflow-y: auto; }
.lc-modal__foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }

/* confirm variant */
.lc-confirm__msg { font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* ------------------------------------------------------------------ */
/* 14. TOASTS                                                          */
/* ------------------------------------------------------------------ */
.lc-toast-host {
  position: fixed; inset-block-end: 22px; inset-inline-start: 22px;
  display: flex; flex-direction: column; gap: 10px; z-index: var(--z-toast); pointer-events: none;
}
.lc-toast {
  display: flex; align-items: center; gap: 11px; min-width: 260px; max-width: 380px;
  padding: 12px 15px; border-radius: var(--radius-sm); background: var(--ink);
  color: #fff; box-shadow: var(--shadow-xl); pointer-events: auto;
  transform: translateY(14px); opacity: 0; transition: transform var(--t-slow), opacity var(--t-slow);
  border-inline-start: 4px solid var(--emerald-l);
}
.lc-toast.is-in { transform: none; opacity: 1; }
.lc-toast.is-out { transform: translateY(8px); opacity: 0; }
.lc-toast--success { border-inline-start-color: var(--green); }
.lc-toast--error   { border-inline-start-color: var(--red); }
.lc-toast--info    { border-inline-start-color: var(--blue); }
.lc-toast__ico { font-size: 17px; flex: none; }
.lc-toast__msg { flex: 1; font-size: 13.5px; font-weight: 600; line-height: 1.4; }

/* ------------------------------------------------------------------ */
/* 15. SPINNER / LOADING / SKELETON                                    */
/* ------------------------------------------------------------------ */
.lc-spinner-wrap { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 48px 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.lc-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--emerald);
  animation: lc-spin .7s linear infinite; flex: none;
}
.lc-spinner--sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes lc-spin { to { transform: rotate(360deg); } }

.lc-skel { background: linear-gradient(90deg, var(--line-2) 25%, #f3f6fa 37%, var(--line-2) 63%); background-size: 400% 100%; animation: lc-shimmer 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes lc-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* skeleton loader utility (UI.skeleton) */
.lc-skeleton { display: flex; flex-direction: column; gap: var(--s3); }
.lc-skeleton__line { height: 13px; border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--line-2) 25%, #f3f6fa 37%, var(--line-2) 63%); background-size: 400% 100%; animation: lc-shimmer 1.3s ease-in-out infinite; }
.lc-skeleton__line.w-40 { width: 40%; } .lc-skeleton__line.w-60 { width: 60%; } .lc-skeleton__line.w-80 { width: 80%; }
.lc-skeleton--card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--shadow-sm); gap: var(--s4); }
.lc-skeleton__block { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--line-2) 25%, #f3f6fa 37%, var(--line-2) 63%); background-size: 400% 100%; animation: lc-shimmer 1.3s ease-in-out infinite; }
.lc-skel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.lc-skel-rows { display: flex; flex-direction: column; gap: var(--s2); }
.lc-skel-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.lc-skel-row .lc-skel-av { width: 34px; height: 34px; border-radius: 10px; flex: none; }

/* ------------------------------------------------------------------ */
/* 16. EMPTY / ERROR STATES                                            */
/* ------------------------------------------------------------------ */
.lc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 52px 24px; color: var(--muted); }
.lc-empty__ico {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  font-size: 30px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px;
}
.lc-empty__msg { font-size: 15px; font-weight: 600; color: var(--ink-2); max-width: 360px; line-height: 1.5; }
.lc-empty__sub { font-size: 13px; margin-top: 6px; max-width: 360px; }
.lc-empty__action { margin-top: 18px; }

/* ------------------------------------------------------------------ */
/* 17. COMMAND PALETTE                                                 */
/* ------------------------------------------------------------------ */
.lc-palette-overlay {
  position: fixed; inset: 0; background: rgba(16,32,48,.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px;
  opacity: 0; transition: opacity var(--t); z-index: var(--z-palette);
}
.lc-palette-overlay.is-open { opacity: 1; }
.lc-palette {
  width: min(560px, 100%); background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-xl); overflow: hidden; transform: translateY(-12px); opacity: 0;
  transition: transform var(--t-slow), opacity var(--t-slow);
}
.lc-palette-overlay.is-open .lc-palette { transform: none; opacity: 1; }
.lc-palette__search { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.lc-palette__search input { flex: 1; border: none; outline: none; background: none; font-size: 16px; }
.lc-palette__search .ico { font-size: 18px; color: var(--muted); }
.lc-palette__list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.lc-palette__group { font-size: 11px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px 4px; }
.lc-palette__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.lc-palette__item .ico { font-size: 17px; width: 22px; text-align: center; }
.lc-palette__item .label { flex: 1; font-weight: 600; font-size: 14px; }
.lc-palette__item .hint { font-size: 11.5px; color: var(--muted); }
.lc-palette__item.is-active, .lc-palette__item:hover { background: var(--emerald-soft); color: var(--emerald-d); }
.lc-palette__empty { padding: 30px; text-align: center; color: var(--muted); font-size: 14px; }

/* ==================================================================== */
/* 19. APP SHELL + VIEW MODULES (consolidated from former bridge.css)   */
/*     Unprefixed structural classes the shell (index.html/core.js) and */
/*     the seven view modules depend on. Reuses the same tokens above.  */
/*     PUBLIC CONTRACT — do not rename these selectors; views need them.*/
/* ==================================================================== */

/* ---- top bar (fixed) ---- */
.topbar {
  position: fixed; inset-block-start: 0; inset-inline: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s5);
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); z-index: var(--z-topbar);
}
.topbar-brand { display: flex; align-items: center; gap: var(--s2); font-weight: 800; font-size: 18px; color: var(--ink); user-select: none; }
.topbar-brand .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; color: #fff; font-size: 15px;
  background: linear-gradient(145deg, var(--emerald) 0%, var(--emerald-d) 100%);
  box-shadow: 0 4px 12px rgba(14,122,95,.30);
}
.brand-name { letter-spacing: -.3px; }
.brand-accent { color: var(--emerald); }

/* mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none; width: 38px; height: 38px; border-radius: 10px; flex: none;
  align-items: center; justify-content: center; font-size: 18px;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.nav-toggle:hover { background: #eef2f7; border-color: #d6dde7; }

.topbar-search {
  flex: 0 1 400px; margin-inline-start: var(--s2);
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 8px 14px; color: var(--muted); cursor: text;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.topbar-search:hover { border-color: #d6dde7; }
.topbar-search:focus-within { background: #fff; border-color: var(--emerald); box-shadow: var(--ring); }
.topbar-search input { flex: 1; border: none; background: none; outline: none; font-size: 14px; color: var(--ink); }
.topbar-search .ts-ico { font-size: 14px; color: var(--muted); flex: none; }
.topbar-search kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
  box-shadow: 0 1px 0 var(--line); flex: none; line-height: 1.6;
}
.topbar-actions { display: flex; align-items: center; gap: var(--s2); margin-inline-start: auto; }
.topbar-owner {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 13px 6px 7px;
}
.topbar-owner::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--emerald) 0%, var(--emerald-d) 100%);
  box-shadow: 0 2px 6px rgba(14,122,95,.30);
}

/* ---- side nav (RIGHT in RTL) — contained, elegant active state ---- */
.sidenav {
  position: fixed; inset-block-start: var(--topbar-h); inset-inline-end: 0; inset-block-end: 0;
  width: var(--nav-w); background: var(--surface); border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; padding: var(--s4) var(--s3);
  z-index: var(--z-nav); overflow-y: auto; overflow-x: hidden;
  transition: transform var(--t-slow);
}
.nav-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted-2);
  text-transform: uppercase; padding: var(--s4) var(--s3) var(--s1);
}
.nav-group-label:first-child { padding-top: 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--s3);
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink-2);
  font-weight: 600; font-size: 14.5px; isolation: isolate;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--surface-2); }
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; flex: none; line-height: 1; }
.nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-count {
  font-size: 11.5px; font-weight: 700; color: var(--muted); flex: none;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 1px 8px; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.nav-item.active { background: var(--emerald-soft); color: var(--emerald-d); }
.nav-item.active .nav-label { font-weight: 700; }
.nav-item.active .nav-count { background: #fff; color: var(--emerald-d); border-color: var(--emerald-soft-2); }
/* contained RTL active rail — sits INSIDE the item, flush to the inner (right) edge, never bleeds */
.nav-item.active::before {
  content: ""; position: absolute; inset-inline-end: 0; inset-block: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--emerald);
}
.nav-foot { margin-top: auto; padding: var(--s3); color: var(--muted-2); font-size: 11.5px; }

/* ---- main + page scaffold ---- */
.view {
  margin-block-start: var(--topbar-h); margin-inline-end: var(--nav-w);
  padding: var(--s6) var(--s7) 64px; min-height: calc(100vh - var(--topbar-h));
}
.page, .view > .page { max-width: var(--content-max); margin: 0 auto; animation: lc-fade-up var(--t) both; }

.page-head, .view-head {
  display: flex; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6);
}
.view-title-wrap, .page-head .page-head-titles { min-width: 0; }
.page-title, .view-title { font-size: 23px; letter-spacing: -.4px; line-height: 1.2; }
.page-sub, .view-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-head-actions, .view-actions { display: flex; align-items: center; gap: var(--s3); margin-inline-start: auto; flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.toolbar .search-input, .toolbar .select-input { margin: 0; }
.toolbar-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.list-region { min-height: 120px; }

/* ---- inputs / selects (view-local controls) ---- */
.input, .select-input, .search-input {
  width: 100%; height: 40px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 13px; font-size: 14px; color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); outline: none;
}
.input::placeholder, .search-input::placeholder { color: var(--muted-2); }
.input:hover, .select-input:hover, .search-input:hover { border-color: #d3dbe5; }
.input:focus, .select-input:focus, .search-input:focus { border-color: var(--emerald); box-shadow: var(--ring); }
.input.saving { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(201,138,20,.12); }
.input.saved { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,158,106,.12); }
.search-input { flex: 1 1 260px; }
.select-input {
  flex: 0 0 auto; min-width: 170px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2369788a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; padding-inline-start: 36px;
}
textarea.input { height: auto; min-height: 84px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* ---- buttons (view-local .btn family) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  box-shadow: var(--shadow-sm); white-space: nowrap; line-height: 1.2;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), filter var(--t-fast);
}
.btn:hover { border-color: #d6dde7; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn-primary {
  background: linear-gradient(145deg, var(--emerald) 0%, var(--emerald-d) 100%);
  color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(14,122,95,.26);
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 6px 18px rgba(14,122,95,.34); background: linear-gradient(145deg, var(--emerald-l) 0%, var(--emerald) 100%); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--emerald-soft); border-color: var(--emerald-soft-2); color: var(--emerald-d); box-shadow: none; }
.btn-soft:hover { background: var(--emerald-soft-2); }
.btn-success { background: var(--green); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(30,158,106,.22); }
.btn-success:hover { filter: brightness(1.05); }
.btn-danger { background: var(--red); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(192,57,43,.22); }
.btn-danger:hover { filter: brightness(1.05); }
.btn-danger-ghost { background: var(--surface); border-color: var(--red-soft); color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: #f3c9c3; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-mini { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-xs); margin-inline-start: auto; }
.icon-btn {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface); color: var(--muted);
  font-size: 14px; box-shadow: var(--shadow-sm);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: #d6dde7; }
.icon-btn:active { transform: translateY(1px); }

/* ---- generic cards / sections ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5) 0; }
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { margin-inline-start: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.card-body { padding: var(--s4) var(--s5) var(--s5); }
.section-error { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red); font-size: 13.5px; font-weight: 600; border: 1px solid #f3c9c3; }
.dash-loading, .dash-empty, .drawer-loading, .picker-loading { padding: 22px; text-align: center; color: var(--muted); }
.drawer-error { padding: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.lbl { color: var(--muted); font-weight: 600; }
.hint-row { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 8px 11px; margin-bottom: 10px; }
.cell-strong { font-weight: 700; color: var(--ink); }
.cell-sub { display: block; font-size: 11.5px; margin-top: 2px; color: var(--muted); }
.cell-link { color: var(--emerald-d); font-weight: 600; }
.cell-link:hover { text-decoration: underline; }

/* ==== DASHBOARD ==== */
/* KPI grid — responsive auto-fit that NEVER clips a value. minmax floor large */
/* enough that 6 cards lay out as 3×2 / 2×3 instead of 5+1 orphans.            */
.kpi-grid {
  display: grid; gap: var(--s4); margin-bottom: var(--s6);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.kpi-card {
  display: flex; align-items: center; gap: var(--s4); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; min-width: 0;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.kpi-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #dbe2ec; }
/* accent rail on the inner (right/start) edge in RTL — fully contained */
.kpi-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--muted-2); }
.kpi-emerald::before { background: var(--emerald); }
.kpi-blue::before { background: var(--blue); }
.kpi-gold::before { background: var(--gold); }
.kpi-red::before { background: var(--red); }
.kpi-neutral::before { background: var(--muted-2); }
.kpi-icon { font-size: 22px; width: 48px; height: 48px; flex: none; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line-2); }
.kpi-meta { min-width: 0; flex: 1; }
.kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -.6px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.12; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-top: 3px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.kpi-card[role="button"], .kpi-card.is-clickable { cursor: pointer; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); margin-bottom: var(--s5); align-items: start; }
.dash-cols .card { display: flex; flex-direction: column; }
.dash-activity { margin-top: 0; }

.sample-bar {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: var(--gold-soft); border: 1px solid #ecdcb4; border-radius: var(--radius-sm);
  padding: 11px 15px; margin-bottom: var(--s5); font-size: 13px; color: #7a5a0f;
}
.sample-bar-text { flex: 1; min-width: 0; }
.sample-bar .btn { margin-inline-start: auto; }

.urgent-list { display: flex; flex-direction: column; gap: var(--s3); }
.urgent-item { display: flex; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.urgent-item:hover { box-shadow: var(--shadow-md); border-color: #dbe2ec; transform: translateY(-1px); }
.urgent-icon { font-size: 18px; width: 38px; height: 38px; flex: none; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line-2); }
.urgent-main { flex: 1; min-width: 0; }
.urgent-title-row { display: flex; align-items: center; gap: var(--s2); }
.urgent-title { font-weight: 700; font-size: 14px; }
.urgent-score { margin-inline-start: auto; flex: none; min-width: 30px; text-align: center; font-weight: 800; font-size: 12px; color: #fff; background: var(--muted); border-radius: var(--radius-pill); padding: 2px 9px; font-variant-numeric: tabular-nums; }
.urgent-score.score-red { background: var(--red); }
.urgent-score.score-gold { background: var(--gold); }
.urgent-score.score-neutral { background: var(--muted); }
.urgent-why { font-size: 12.5px; color: var(--muted); margin: 3px 0 var(--s2); }
.urgent-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ua-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: var(--radius-xs); border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); transition: background var(--t-fast), border-color var(--t-fast); }
.ua-btn:hover { background: var(--surface-2); border-color: #d6dde7; }
.ua-call { color: var(--emerald-d); border-color: var(--emerald-soft-2); background: var(--emerald-soft); }
.ua-call:hover { background: var(--emerald-soft-2); }

.pipe-group { margin-bottom: var(--s4); }
.pipe-group:last-child { margin-bottom: 0; }
.pipe-group-title { font-weight: 700; font-size: 13px; color: var(--ink-2); margin-bottom: var(--s2); }
.pipe-bars { display: flex; flex-direction: column; gap: 11px; }
.pipe-row { display: grid; grid-template-columns: 1fr; gap: 5px; }
.pipe-row-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.pipe-stage { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-2); }
.pipe-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pipe-count { color: var(--muted); font-weight: 700; }
.pipe-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pipe-fill { height: 100%; border-radius: 999px; min-width: 4px; transition: width var(--t-slow); }
.pipe-val { font-size: 11.5px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }

.feed { display: flex; flex-direction: column; gap: 2px; }
.feed-item { display: flex; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: none; }
.feed-icon { font-size: 16px; width: 32px; height: 32px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line-2); }
.feed-main { flex: 1; min-width: 0; }
.feed-line { font-size: 13.5px; }
.feed-type { font-weight: 700; color: var(--ink); margin-inline-end: 6px; }
.feed-body { color: var(--ink-2); }
.feed-when { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ==== PIPELINE / KANBAN ==== */
.seg-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg-btn { padding: 7px 14px; border-radius: var(--radius-xs); font-weight: 700; font-size: 13px; color: var(--muted); background: none; transition: background var(--t-fast), color var(--t-fast); }
.seg-btn:hover { color: var(--ink-2); }
.seg-btn.active { background: var(--surface); color: var(--emerald-d); box-shadow: var(--shadow-sm); }

/* board fills the viewport height; horizontal scroll only when columns overflow, */
/* and the scrollbar is anchored to the bottom of the board (no floating mid-page).*/
.kanban {
  display: flex; gap: var(--s4); align-items: stretch;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 2px var(--s3); margin: 0 -2px;
  height: calc(100vh - var(--topbar-h) - var(--board-top));
  min-height: 420px;
  scroll-snap-type: x proximity;
}
.kanban-col {
  flex: 1 0 280px; max-width: 360px; min-width: 264px; scroll-snap-align: start;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  transition: background var(--t), border-color var(--t);
}
.kanban-col.drop-target { background: var(--emerald-soft); border-color: var(--emerald); box-shadow: inset 0 0 0 1px var(--emerald); }
.kanban-col-head { display: flex; align-items: center; gap: var(--s2); padding: 13px 15px 9px; border-bottom: 1px solid var(--line-2); flex: none; }
.kanban-col-title { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.kanban-col-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col-count { font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 9px; flex: none; font-variant-numeric: tabular-nums; }
.kanban-stuck-flag { font-size: 11.5px; font-weight: 700; color: var(--amber); background: var(--gold-soft); border-radius: var(--radius-pill); padding: 2px 8px; flex: none; }
.kanban-col-sum { font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 7px 15px 4px; font-variant-numeric: tabular-nums; flex: none; }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; min-height: 60px; }
.kanban-empty { opacity: .7; margin: auto 0; }

.kanban-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; cursor: grab; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: #dbe2ec; transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; box-shadow: var(--shadow-xl); transform: rotate(1.5deg) scale(1.02); border-color: var(--emerald); }
.kanban-card.just-moved { animation: lc-pop var(--t-slow) both; }
.kanban-card.is-stuck { border-inline-start: 3px solid var(--amber); }
.card-stuck-ribbon { font-size: 10.5px; font-weight: 800; color: var(--amber); margin-bottom: 6px; }
.kanban-card-title { font-weight: 700; font-size: 14px; margin-bottom: 5px; line-height: 1.35; }
.kanban-card-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.kanban-card-value { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.kanban-card-prob { font-size: 12px; font-weight: 700; color: var(--muted); }
.kanban-card-prob.prob-emerald { color: var(--emerald-d); }
.kanban-card-prob.prob-gold { color: var(--gold); }
.kanban-card-foot { display: flex; align-items: center; gap: var(--s2); margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line-2); }
.kanban-card-when { font-size: 11.5px; color: var(--muted); }
.kanban-card-call { margin-inline-start: auto; font-size: 15px; text-decoration: none; }
@keyframes lc-pop { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* ==== RECORD DRAWER (leads / deals / contacts) ==== */
.rec-drawer { display: flex; flex-direction: column; gap: 4px; }
.rec-hero { padding-bottom: var(--s4); border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.rec-hero-name { font-size: 19px; font-weight: 800; color: var(--ink); letter-spacing: -.3px; }
.rec-hero-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.prob-inline { display: inline-flex; }
.rec-hero-actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.rec-section { padding: var(--s4) 0; border-bottom: 1px solid var(--line-2); }
.rec-section:last-child { border-bottom: none; }
.rec-section-head { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 13.5px; color: var(--ink-2); margin-bottom: var(--s3); }
.rec-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.edit-field { min-width: 0; }
.edit-field:has(textarea) { grid-column: 1 / -1; }
.danger-zone { padding-top: var(--s5); }
.forecast-strip { display: flex; gap: var(--s3); flex-wrap: wrap; padding: var(--s4) 0; }
.fc-item { flex: 1; min-width: 110px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.fc-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fc-val { font-size: 16px; font-weight: 800; color: var(--ink); margin-top: 3px; font-variant-numeric: tabular-nums; }
.fc-val.emerald { color: var(--emerald-d); }
.stage-stepper { display: flex; flex-wrap: wrap; gap: 6px; }
.step { padding: 6px 12px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--muted); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.step:hover { border-color: var(--chip, var(--emerald)); color: var(--ink-2); }
.step.active { background: var(--chip, var(--emerald)); border-color: var(--chip, var(--emerald)); color: #fff; }
.stage-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.stage-chip .stage-dot, .stage-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip, var(--muted)); flex: none; }
.quick-activity { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.quick-activity .select-input { min-width: 130px; flex: 0 0 auto; }
.quick-activity .input { flex: 1 1 160px; }
.quick-activity .btn { flex: none; }
.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline-empty { padding: 10px 2px; font-size: 13px; }
.tl-item { display: flex; gap: 11px; padding: 9px 2px; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--muted-2); }
.tl-dot[data-type="שיחה"] { background: var(--emerald); }
.tl-dot[data-type="וואטסאפ"] { background: var(--green); }
.tl-dot[data-type="מייל"] { background: var(--blue); }
.tl-dot[data-type="פגישה"] { background: var(--gold); }
.tl-dot[data-type="הערה"] { background: var(--muted); }
.tl-body { flex: 1; min-width: 0; }
.tl-top { display: flex; align-items: center; gap: var(--s2); }
.tl-type { font-weight: 700; font-size: 13px; }
.tl-time { font-size: 11.5px; margin-inline-start: auto; color: var(--muted); }
.tl-text { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: var(--s2); background: var(--surface); transition: border-color var(--t-fast), background var(--t-fast); }
.link-row:hover { border-color: #d6dde7; background: var(--surface-2); }
.link-row-title { font-weight: 700; font-size: 13.5px; }
.link-row-meta { font-size: 12px; color: var(--muted); }
.task-mini { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-bottom: 1px solid var(--line-2); }
.task-mini:last-child { border-bottom: none; }
.task-mini.done .task-mini-title { text-decoration: line-through; color: var(--muted); }
.task-mini-title { flex: 1; min-width: 0; font-size: 13.5px; }
.task-mini-date { font-size: 11.5px; color: var(--muted); }
.draft-mini { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 9px; background: var(--surface); }
.draft-mini-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.draft-mini-subj { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.draft-mini-body { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.draft-mini-foot { margin-top: 7px; }

/* view-local checkbox (.chk) */
.chk { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.chk span { width: 19px; height: 19px; border: 1.5px solid var(--muted-2); border-radius: 6px; display: inline-block; transition: background var(--t-fast), border-color var(--t-fast); }
.chk input:checked + span { background: var(--emerald); border-color: var(--emerald); }
.chk input:checked + span::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; height: 100%; }
.chk input:focus-visible + span { box-shadow: var(--ring); }

/* modal forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.form-grid .lc-field:has(textarea), .form-grid .hint-row, .related-picker { grid-column: 1 / -1; }
.related-picker:empty { display: none; }

/* ==== TASKS ==== */
.tasks-region { display: flex; flex-direction: column; gap: var(--s5); }
.task-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.task-group-head { display: flex; align-items: center; gap: 9px; padding: 13px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line-2); }
.task-group-count { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 10px; }
.task-group.g-overdue .task-group-head { color: var(--red); }
.task-group.g-today .task-group-head { color: var(--emerald-d); }
.task-group-body { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: var(--s3); padding: 12px 16px; border-bottom: 1px solid var(--line-2); transition: background var(--t-fast); }
.task-row:hover { background: var(--surface-2); }
.task-row:last-child { border-bottom: none; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-main { flex: 1; min-width: 0; }
.task-title-line { display: flex; align-items: center; gap: var(--s2); }
.task-title { font-weight: 700; font-size: 14px; }
.task-meta { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: 4px; }
.task-due { font-size: 12px; color: var(--muted); }
.task-link { font-size: 12px; font-weight: 700; color: var(--emerald-d); }
.task-link:hover { text-decoration: underline; }
.task-row-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ==== DRAFTS APPROVAL QUEUE ==== */
.draft-guard { display: flex; gap: var(--s3); align-items: flex-start; padding: 14px 16px; margin-bottom: var(--s5); background: var(--emerald-soft); border: 1px solid var(--emerald-soft-2); border-radius: var(--radius-sm); }
.draft-guard-icon { font-size: 20px; flex: none; }
.draft-guard-text { font-size: 13px; color: var(--emerald-d); line-height: 1.55; }
.draft-guard-text strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.draft-filters { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s5); }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-sm); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.filter-chip:hover { background: var(--surface-2); border-color: #d6dde7; }
.filter-chip.active { background: var(--emerald); border-color: var(--emerald); color: #fff; box-shadow: 0 4px 12px rgba(14,122,95,.22); }
.filter-count { font-weight: 700; opacity: .85; }
.draft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s4); }
.draft-card { display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: box-shadow var(--t), opacity var(--t), transform var(--t); }
.draft-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.draft-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--muted-2); }
.draft-card.status-gold::before { background: var(--gold); }
.draft-card.status-emerald::before { background: var(--emerald); }
.draft-card.status-red::before { background: var(--red); }
.draft-card.is-busy { opacity: .55; pointer-events: none; }
.draft-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.draft-channel { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; }
.draft-channel-icon { font-size: 16px; }
.draft-recipient { font-size: 13px; color: var(--ink-2); }
.draft-recipient-label, .draft-subject-label { color: var(--muted); font-weight: 600; }
.draft-recipient-name { font-weight: 700; }
.draft-subject { font-size: 13px; }
.draft-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 10px 12px; white-space: pre-wrap; }
.draft-card-foot { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.draft-meta { display: flex; align-items: center; gap: var(--s3); flex: 1; min-width: 0; }
.draft-when { font-size: 11.5px; color: var(--muted); }
.draft-related { font-size: 12px; font-weight: 700; color: var(--emerald-d); }
.draft-related:hover { text-decoration: underline; }
.draft-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.draft-edit { display: flex; flex-direction: column; gap: var(--s3); }
.draft-edit-note { font-size: 12.5px; color: var(--emerald-d); background: var(--emerald-soft); border-radius: var(--radius-xs); padding: 9px 12px; }
.draft-edit-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.draft-edit-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.draft-edit-text { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; line-height: 1.55; resize: vertical; }
.draft-edit-text:focus { border-color: var(--emerald); box-shadow: var(--ring); outline: none; }
.draft-edit-actions { display: flex; gap: var(--s2); }

/* ==== BOOT SPLASH + ROUTE ERROR (core.js fallbacks) ==== */
.boot-splash { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4); min-height: 50vh; color: var(--muted); }
.boot-spinner { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--emerald); border-radius: 50%; animation: lc-spin .8s linear infinite; }
.boot-text { font-size: 14px; font-weight: 600; }
.route-error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); text-align: center; min-height: 50vh; padding: var(--s7); }
.route-error-icon { font-size: 40px; }
.route-error h2 { font-size: 19px; }
.route-error p { color: var(--muted); max-width: 460px; }
.route-error .btn { margin-top: var(--s2); }

/* nav scrim (mobile drawer backdrop) */
.nav-scrim { display: none; position: fixed; inset-block: var(--topbar-h) 0; inset-inline: 0; background: rgba(16,32,48,.34); z-index: calc(var(--z-nav) - 1); }

/* ------------------------------------------------------------------ */
/* 20. RESPONSIVE                                                      */
/* ------------------------------------------------------------------ */
@media (max-width: 1240px) {
  :root { --nav-w: 212px; }
  .view, .lc-main { padding-inline: var(--s6); }
}

@media (max-width: 1080px) {
  :root { --nav-w: 200px; }
  .lc-main { padding: 22px 22px 56px; }
  .dash-cols { gap: var(--s4); }
}

@media (max-width: 980px) {
  .dash-cols { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .lc-topbar__search, .topbar-search { display: none; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 56px; }

  .nav-toggle, .lc-nav-toggle { display: inline-flex; }

  /* lc-* nav */
  .lc-nav { transform: translateX(100%); width: min(280px, 86vw); box-shadow: var(--shadow-xl); }
  body.lc-nav-open .lc-nav { transform: none; }
  body.lc-nav-open .lc-nav-scrim { display: block; }
  .lc-nav-scrim { display: none; position: fixed; inset-block: var(--topbar-h) 0; inset-inline: 0; background: rgba(16,32,48,.34); z-index: calc(var(--z-nav) - 1); }
  .lc-main { margin-inline-end: 0; padding: 18px 16px 48px; }
  .lc-brand__sub { display: none; }
  .lc-page-head h1 { font-size: 20px; }
  .lc-page-head__actions { width: 100%; margin-inline-start: 0; }
  .lc-page-head__actions .lc-btn { flex: 1; }
  .lc-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .lc-stat__value { font-size: 23px; }
  .lc-form-grid, .lc-detail-grid { grid-template-columns: 1fr; }
  .lc-table-wrap { border: none; box-shadow: none; background: none; overflow: visible; }
  .lc-table, .lc-table thead, .lc-table tbody, .lc-table th, .lc-table td, .lc-table tr { display: block; }
  .lc-table thead { display: none; }
  .lc-table tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px; padding: 6px 4px; }
  .lc-table tbody tr.is-clickable:hover td:first-child { box-shadow: none; }
  .lc-table tbody td { border-bottom: 1px solid var(--line-2); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
  .lc-table tbody td:last-child { border-bottom: none; }
  .lc-table tbody td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); flex: none; min-width: 88px; }
  .lc-table td.lc-cell-actions { justify-content: flex-start; }
  .lc-kanban__col { flex-basis: 84vw; width: 84vw; }
  .lc-drawer { width: 100vw; }
  .lc-modal { width: 100%; }

  /* unprefixed shell: slide-in drawer nav from the right edge (RTL).
     Anchor physically to the right edge and push fully off-screen when closed. */
  .sidenav {
    inset-inline: auto; right: 0; left: auto;
    inset-block-start: var(--topbar-h); inset-block-end: 0; height: auto;
    width: min(286px, 86vw); transform: translateX(100%);
    flex-direction: column; gap: 2px; padding: var(--s4) var(--s3);
    border-inline-start: 1px solid var(--line); border-bottom: none;
    box-shadow: var(--shadow-xl); overflow-y: auto;
  }
  body.nav-open .sidenav { transform: none; }
  body.nav-open .nav-scrim { display: block; }
  .nav-item { flex-direction: row; gap: var(--s3); padding: 10px 12px; font-size: 14.5px; flex: none; }
  .nav-item .nav-label { font-size: 14.5px; }
  .nav-item.active::before { display: block; }

  .view { margin-inline-end: 0; margin-block-start: var(--topbar-h); padding: 18px 14px 56px; }
  .page-title, .view-title { font-size: 20px; }
  .rec-fields, .form-grid { grid-template-columns: 1fr; }
  .page-head-actions, .view-actions { width: 100%; margin-inline-start: 0; }
  .page-head-actions .btn, .view-actions .btn { flex: 1; }

  /* KPI: 2-up on small, 1-up on tiny */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-card { padding: var(--s3) var(--s4); }
  .kpi-icon { width: 42px; height: 42px; font-size: 20px; }
  .kpi-value { font-size: 21px; }
  .draft-grid { grid-template-columns: 1fr; }

  /* kanban: full-width columns, horizontal scroll; cap height for mobile */
  .kanban { height: auto; min-height: 0; display: flex; }
  .kanban-col { flex: 0 0 86vw; max-width: 86vw; min-width: 0; height: auto; max-height: calc(100vh - var(--topbar-h) - 170px); }
}

@media (max-width: 420px) {
  .lc-stats { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * Access gate (login) — PII protection screen. Appended by migrate/auth.
 * ============================================================ */
.login-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, var(--bg) 60%);
  direction: rtl;
}
.login-card {
  width: min(92vw, 360px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(20, 33, 51, .14);
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.login-brand { font-size: 22px; font-weight: 800; letter-spacing: .01em; }
.login-brand .brand-mark { color: var(--green); margin-inline-end: 4px; }
.login-brand .brand-accent { color: var(--green); }
.login-sub { color: var(--muted, #69788a); font-size: 13px; margin-top: -6px; }
.login-err {
  background: var(--red-soft); color: var(--red);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600;
}
.login-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px; font-size: 16px; text-align: center; letter-spacing: .08em;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 158, 106, .15); }
.login-btn {
  width: 100%; padding: 12px 14px; font-size: 15px; font-weight: 700;
  color: #fff; background: var(--green); border: none; border-radius: 12px;
  cursor: pointer; transition: filter .15s;
}
.login-btn:hover { filter: brightness(1.05); }
.login-btn:active { filter: brightness(.96); }

/* ============================================================
 * dataTable — POWER list backbone (pagination, sort, filters,
 * multi-select + bulk, inline-edit, CSV export, saved views).
 * Appended for the power-features pass. RTL-first.
 * ============================================================ */
.lc-dt { display: flex; flex-direction: column; gap: 12px; }

/* toolbar */
.lc-dt__toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.lc-dt__spacer { flex: 1 1 auto; }
.lc-dt__search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 0 12px; min-width: 240px; flex: 0 1 320px;
}
.lc-dt__search input {
  border: none; outline: none; background: transparent; flex: 1;
  font: inherit; font-size: 14px; padding: 10px 0; color: var(--ink);
}
.lc-dt__search span { color: var(--muted); font-size: 14px; }
.lc-dt__filter {
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  font: inherit; font-size: 13.5px; padding: 9px 12px; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s; max-width: 180px;
}
.lc-dt__filter:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,158,106,.12); }
.lc-dt__export { white-space: nowrap; }

/* saved-views bar */
.lc-dt__views {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 4px 2px; font-size: 13px;
}
.lc-dt__views-label { color: var(--muted); font-weight: 700; }
.lc-dt__views-list { display: flex; gap: 7px; flex-wrap: wrap; }
.lc-dt__viewchip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 4px 2px 10px;
}
.lc-dt__viewname {
  border: none; background: transparent; font: inherit; font-weight: 600;
  color: var(--emerald-d); cursor: pointer; padding: 4px 2px;
}
.lc-dt__viewname:hover { text-decoration: underline; }
.lc-dt__viewdel {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 4px; border-radius: 50%;
}
.lc-dt__viewdel:hover { background: var(--red-soft); color: var(--red); }
.lc-dt__views-save { font-size: 12.5px; }

/* bulk toolbar */
.lc-dt__bulk {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--emerald-soft); border: 1px solid var(--emerald-soft-2);
  border-radius: 12px; padding: 9px 14px;
  animation: lc-dt-slide .18s ease;
}
@keyframes lc-dt-slide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lc-dt__bulkcount { font-weight: 800; color: var(--emerald-d); margin-inline-end: 4px; }

/* sortable headers */
.lc-dt__sortable { cursor: pointer; user-select: none; }
.lc-dt__sortable:hover { background: var(--emerald-soft); color: var(--emerald-d); }
.lc-dt__sortlabel { display: inline-flex; align-items: center; gap: 6px; }
.lc-dt__arrow { font-size: 11px; opacity: .4; transition: opacity .15s; }
.lc-dt__arrow.is-active { opacity: 1; color: var(--green); }

/* checkbox cells */
.lc-dt__chkcell { width: 38px; text-align: center; }
.lc-dt__chkcell input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--green); }
.lc-table tbody tr.is-selected { background: var(--emerald-soft); }
.lc-table tbody tr.is-selected:hover { background: var(--emerald-soft-2); }

/* inline-edit cells */
.lc-dt__editcell { cursor: text; }
.lc-dt__editval {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border-radius: 7px; padding: 2px 6px; margin: -2px -6px;
  transition: background .12s;
}
.lc-dt__editval:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.lc-dt__editpen { opacity: 0; font-size: 11px; color: var(--muted); transition: opacity .12s; }
.lc-dt__editval:hover .lc-dt__editpen { opacity: .8; }
.lc-dt__editval:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.lc-dt__editor { width: 100%; box-sizing: border-box; padding: 6px 8px; font-size: 13.5px; }
.lc-dt__editcell.is-saving { opacity: .55; pointer-events: none; }

.lc-dt__skelrow td { padding: 14px 16px; }

/* footer: count + pager */
.lc-dt__foot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; padding: 4px 2px 2px;
}
.lc-dt__count { color: var(--muted); font-size: 13.5px; }
.lc-dt__count strong { color: var(--ink); }
.lc-dt__pager { display: flex; align-items: center; gap: 6px; }
.lc-dt__pager .lc-btn { padding: 6px 11px; font-size: 13px; }
.lc-dt__pager .lc-btn:disabled { opacity: .4; cursor: not-allowed; }
.lc-dt__pginfo { color: var(--muted); font-size: 13px; padding: 0 4px; white-space: nowrap; }

@media (max-width: 640px) {
  .lc-dt__search { flex: 1 1 100%; min-width: 0; }
  .lc-dt__filter { max-width: none; flex: 1 1 calc(50% - 5px); }
  .lc-dt__foot { flex-direction: column; align-items: stretch; }
  .lc-dt__pager { justify-content: center; }
}

/* ============================================================
 * Reports / analytics module — CSS charts (no JS chart lib).
 * ============================================================ */
.rpt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.rpt-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius, 15px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(16,32,48,.05)); padding: 18px 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.rpt-card--wide { grid-column: 1 / -1; }
.rpt-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rpt-card__title { font-size: 15px; font-weight: 800; color: var(--ink); }
.rpt-card__sub { font-size: 12.5px; color: var(--muted); }

/* KPI strip */
.rpt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.rpt-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.rpt-kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rpt-kpi__val { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.rpt-kpi__val.is-emerald { color: var(--emerald-d); }
.rpt-kpi__val.is-gold { color: var(--gold); }
.rpt-kpi__meta { font-size: 12px; color: var(--muted); }

/* horizontal bar chart (funnel/conversion/sources) */
.rpt-bars { display: flex; flex-direction: column; gap: 9px; }
.rpt-bar { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; }
.rpt-bar__label { font-size: 13px; color: var(--ink); font-weight: 600; text-align: start;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpt-bar__track { background: var(--surface-2); border-radius: 8px; height: 22px; overflow: hidden; position: relative; }
.rpt-bar__fill { height: 100%; border-radius: 8px; min-width: 2px; transition: width .4s ease; }
.rpt-bar__val { font-size: 12.5px; color: var(--muted); font-weight: 700; white-space: nowrap; min-width: 54px; text-align: start; }

/* column chart (activity over time) */
.rpt-cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.rpt-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.rpt-col__bar { width: 100%; max-width: 34px; background: var(--emerald-soft);
  border-radius: 6px 6px 0 0; display: flex; flex-direction: column-reverse; overflow: hidden;
  transition: height .4s ease; }
.rpt-col__seg { width: 100%; }
.rpt-col__x { font-size: 10.5px; color: var(--muted); white-space: nowrap; transform: rotate(0); }
.rpt-col__v { font-size: 11px; font-weight: 700; color: var(--ink); }

/* legend */
.rpt-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.rpt-legend__item { display: inline-flex; align-items: center; gap: 5px; }
.rpt-legend__dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* win/loss split */
.rpt-split { display: flex; gap: 14px; flex-wrap: wrap; }
.rpt-split__cell { flex: 1; min-width: 130px; background: var(--surface-2); border-radius: 12px; padding: 14px; }
.rpt-split__k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rpt-split__v { font-size: 20px; font-weight: 800; color: var(--ink); margin-top: 4px; }
.rpt-note { font-size: 12.5px; color: var(--muted); background: var(--surface-2);
  border-radius: 10px; padding: 10px 12px; line-height: 1.5; }

/* tone on split values (forecast hero) */
.rpt-split__v.is-emerald { color: var(--emerald-d); }
.rpt-split__v.is-gold { color: var(--gold); }

/* forecast share bar — active vs land split of the weighted forecast */
.rpt-share { display: flex; height: 12px; border-radius: 7px; overflow: hidden;
  background: var(--surface-2); margin-top: 12px; }
.rpt-share__seg { height: 100%; transition: width .4s ease; min-width: 0; }
.rpt-share__seg.is-emerald { background: var(--emerald-d, #0e7a5f); }
.rpt-share__seg.is-gold { background: var(--gold, #b07d12); }

/* drill-through funnel/source rows */
.rpt-bar--link { cursor: pointer; border-radius: 9px; padding: 3px 5px; margin: -3px -5px;
  transition: background .15s ease; }
.rpt-bar--link:hover, .rpt-bar--link:focus-visible {
  background: var(--surface-2); outline: none; }
.rpt-bar--link:focus-visible { box-shadow: 0 0 0 2px var(--emerald-soft, rgba(14,122,95,.25)); }

/* stage→stage conversion chip inside funnel labels */
.rpt-conv { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.rpt-conv.is-up { background: rgba(4,120,87,.12); color: #047857; }
.rpt-conv.is-down { background: rgba(220,38,38,.10); color: #b91c1c; }

/* activity range control */
.rpt-range { display: inline-flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.rpt-range__btn { font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); transition: all .15s ease; }
.rpt-range__btn:hover { border-color: var(--emerald-d, #0e7a5f); color: var(--ink); }
.rpt-range__btn.is-active { background: var(--emerald-d, #0e7a5f); border-color: var(--emerald-d, #0e7a5f); color: #fff; }

/* win/loss donut + legend */
.rpt-wl { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.rpt-donut { position: relative; width: 116px; height: 116px; border-radius: 50%; flex: none; }
.rpt-donut__hole { position: absolute; inset: 22px; background: var(--surface); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rpt-donut__pct { font-size: 20px; font-weight: 800; color: var(--ink); }
.rpt-donut__cap { font-size: 11px; color: var(--muted); font-weight: 600; }
.rpt-wl__legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 10px; }
.rpt-wl__item { display: grid; grid-template-columns: auto auto 1fr; align-items: center;
  gap: 8px; row-gap: 2px; }
.rpt-wl__lbl { font-size: 13px; font-weight: 700; color: var(--ink); }
.rpt-wl__val { font-size: 14px; font-weight: 800; color: var(--ink); text-align: start; }
.rpt-wl__share { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); padding-inline-start: 18px; }

/* print / PDF — clean, white, no chrome */
@media print {
  .lc-nav, .lc-sidebar, .lc-topbar, .view-actions, .rpt-range, #rpt-refresh,
  #rpt-csv, #rpt-print { display: none !important; }
  .rpt-card, .rpt-kpi { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff !important; }
}
