/* Cygne MedRep — design system (from Orbit CRM)
   Type: Instrument Sans (variable width 75–100%) — condensed widths for headings & figures.
   Palette: deep forest + lime signal from the Orbit mark, on cool paper. */

@font-face { font-family: 'Instrument Sans'; font-style: normal; font-display: swap; font-weight: 400 700; font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-wdth-normal.woff2) format('woff2-variations'), url(../fonts/instrument-sans-latin-wdth-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-display: swap; font-weight: 400 700; font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-ext-wdth-normal.woff2) format('woff2-variations'), url(../fonts/instrument-sans-latin-ext-wdth-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --bg: #f1f4f2; --surface: #ffffff; --surface-2: #f6f8f7; --surface-3: #ecf0ee; --hover: #f0f4f1;
  --ink: #13221d; --ink-2: #44544e; --ink-3: #64736d; --ink-4: #8d9a95;
  --line: #e0e6e2; --line-2: #cbd5d0;
  --primary: #1f4d40; --primary-hover: #173b31; --on-primary: #ffffff; --primary-soft: #e3eee8;
  --lime: #d4f28a; --lime-ink: #2f4a00;
  --side-bg: #12201b; --side-ink: #b9c7c1; --side-ink-strong: #f2f7f4; --side-hover: #1b2c26; --side-line: #22352e;
  --green: #23845a; --blue: #2b5fc2; --amber: #a86400; --red: #bf3b2a; --violet: #6d45c0; --teal: #11808a;
  --green-bg: #e3f3ea; --blue-bg: #e6eefb; --amber-bg: #fbefdb; --red-bg: #fbe7e3; --violet-bg: #efe9fb; --gray-bg: #edf1ef; --teal-bg: #e0f2f3;
  --shadow-1: 0 1px 2px rgb(19 34 29 / .06); --shadow-2: 0 4px 16px rgb(19 34 29 / .08); --shadow-3: 0 18px 60px rgb(19 34 29 / .22);
  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px;
  --font: 'Instrument Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --side-w: 236px; --top-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0c1411; --surface: #121c18; --surface-2: #17221e; --surface-3: #1d2a25; --hover: #1a2621;
  --ink: #e5ede9; --ink-2: #b2c0ba; --ink-3: #8c9c95; --ink-4: #66766f;
  --line: #233029; --line-2: #2f3e37;
  --primary: #c6ec7a; --primary-hover: #d6f59a; --on-primary: #11201a; --primary-soft: #23331d;
  --side-bg: #08100d; --side-hover: #121d19; --side-line: #18241f;
  --green: #5ccf94; --blue: #7da6f5; --amber: #e6a54a; --red: #f08371; --violet: #b49bf5; --teal: #5cc8d1;
  --green-bg: #15301f; --blue-bg: #18253d; --amber-bg: #33260f; --red-bg: #3a1c17; --violet-bg: #251d3b; --gray-bg: #1d2925; --teal-bg: #12302f;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 6px 20px rgb(0 0 0 / .35); --shadow-3: 0 24px 70px rgb(0 0 0 / .6);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0c1411; --surface: #121c18; --surface-2: #17221e; --surface-3: #1d2a25; --hover: #1a2621;
  --ink: #e5ede9; --ink-2: #b2c0ba; --ink-3: #8c9c95; --ink-4: #66766f;
  --line: #233029; --line-2: #2f3e37;
  --primary: #c6ec7a; --primary-hover: #d6f59a; --on-primary: #11201a; --primary-soft: #23331d;
  --side-bg: #08100d; --side-hover: #121d19; --side-line: #18241f;
  --green: #5ccf94; --blue: #7da6f5; --amber: #e6a54a; --red: #f08371; --violet: #b49bf5; --teal: #5cc8d1;
  --green-bg: #15301f; --blue-bg: #18253d; --amber-bg: #33260f; --red-bg: #3a1c17; --violet-bg: #251d3b; --gray-bg: #1d2925; --teal-bg: #12302f;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 6px 20px rgb(0 0 0 / .35); --shadow-3: 0 24px 70px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); font-feature-settings: 'tnum' 0; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 650; font-stretch: 84%; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 620; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--lime); color: var(--lime-ink); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack-sm { display: grid; gap: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Boot / auth ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-3); text-align: center; padding: 24px; }
.boot img { width: 48px; animation: spin 1.6s cubic-bezier(.5,0,.5,1) infinite; }
.boot h2 { color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; background: var(--side-bg); color: #e9f2ec; padding: 44px 56px; display: flex; flex-direction: column; }
.auth-art .brand { color: #fff; }
.auth-art h1 { font-size: clamp(38px, 5vw, 64px); font-stretch: 78%; line-height: 1.02; letter-spacing: -.03em; max-width: 9.5em; margin-top: auto; font-weight: 640; }
.auth-art p { color: #9fb2aa; max-width: 34em; margin: 18px 0 auto; font-size: 15px; line-height: 1.6; }
.auth-art svg.orbits { position: absolute; right: -180px; top: 50%; transform: translateY(-50%); width: 640px; height: 640px; opacity: .9; pointer-events: none; }
.auth-art .foot { color: #6f857c; font-size: 12.5px; position: relative; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.auth-form h2 { font-size: 26px; font-stretch: 86%; font-weight: 640; letter-spacing: -.02em; }
.auth-form .lede { color: var(--ink-3); margin-top: -8px; }
.auth-form .btn { height: 44px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 21px; letter-spacing: -.03em; font-stretch: 88%; }
.brand img { width: 30px; height: 30px; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; overflow-y: auto; z-index: 30; scrollbar-width: thin; }
.sidebar .brand { color: var(--side-ink-strong); padding: 6px 10px 14px; }
.ws { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--side-line); border-radius: var(--r); margin-bottom: 8px; color: var(--side-ink-strong); }
.ws-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.ws small { display: block; color: var(--side-ink); font-size: 11.5px; }
.ws strong { font-size: 13px; font-weight: 600; display: block; }
.nav { display: grid; gap: 1px; }
.nav-group { font-size: 11.5px; color: #6d8279; padding: 14px 10px 6px; font-weight: 500; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--side-ink); position: relative; }
.nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.nav a.active { background: var(--side-hover); color: var(--side-ink-strong); font-weight: 560; }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.nav a .icon { width: 17px; height: 17px; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 10px; background: #2a3d35; color: var(--side-ink-strong); font-variant-numeric: tabular-nums; }
.nav .count.alert { background: var(--lime); color: var(--lime-ink); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--side-line); display: grid; gap: 4px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; color: var(--side-ink-strong); }
.me .meta { min-width: 0; flex: 1; }
.me strong { font-size: 13px; font-weight: 560; display: block; }
.me small { font-size: 11.5px; color: var(--side-ink); }
.me .icon-btn { color: var(--side-ink); }
.me .icon-btn:hover { background: var(--side-hover); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.search-trigger { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink-3); width: min(420px, 100%); font-size: 13.5px; box-shadow: var(--shadow-1); }
.search-trigger:hover { border-color: var(--line-2); }
.search-trigger .kbd { margin-left: auto; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.kbd { font: 500 11px/1 var(--font); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r); color: var(--ink-2); position: relative; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn .pip { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); box-sizing: content-box; }
.mobile-only { display: none !important; }

.page { padding: 26px 28px 64px; width: 100%; max-width: 1560px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; flex: 1; }
.page-head p { color: var(--ink-3); margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin-bottom: 10px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Buttons & inputs ---------- */
.btn { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 540; white-space: nowrap; box-shadow: var(--shadow-1); transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--ink-4); }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.sm .icon { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--ink-3) transparent var(--ink-3) transparent; animation: spin .7s linear infinite; }
.link { color: var(--primary); font-weight: 540; }
:root[data-theme="dark"] .link, .link:hover { text-decoration: underline; }
.link-btn { color: var(--ink-2); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }

.input, .field input, .field select, .field textarea, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.field textarea, textarea.input { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.55; }
.field select, select.input { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364736d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; cursor: pointer; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input.sm, select.input.sm { height: 32px; font-size: 13px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; margin: 0; }
input[type=color] { padding: 2px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 520; align-content: start; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.field.check { display: flex; align-items: center; gap: 9px; font-weight: 450; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { font-size: 13px; color: var(--ink-3); font-weight: 600; padding-top: 6px; grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 14px; }
.form-error:empty { display: none; }
.form-error { padding: 10px 12px; border-radius: var(--r); background: var(--red-bg); color: var(--red); font-size: 13px; }
.searchbox { position: relative; }
.searchbox .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; pointer-events: none; }
.searchbox input { padding-left: 33px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; min-height: 44px; }
.card-head h2 { font-size: 15px; }
.card-head .sub { color: var(--ink-3); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 14px 18px 18px; }
.card-body.flush { padding: 8px 0 4px; }
.card.pad { padding: 18px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.callout .icon { color: var(--ink-3); margin-top: 1px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 540; background: var(--gray-bg); color: var(--ink-2); white-space: nowrap; line-height: 1; }
.badge .dot { width: 6px; height: 6px; }
.t-green { background: var(--green-bg); color: var(--green); }
.t-blue { background: var(--blue-bg); color: var(--blue); }
.t-amber { background: var(--amber-bg); color: var(--amber); }
.t-red { background: var(--red-bg); color: var(--red); }
.t-violet { background: var(--violet-bg); color: var(--violet); }
.t-teal { background: var(--teal-bg); color: var(--teal); }
.t-gray { background: var(--gray-bg); color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; flex-shrink: 0; }

.avatar { --a: #dfe8e3; --b: #33544a; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 640; background: var(--a); color: var(--b); flex-shrink: 0; letter-spacing: .02em; font-stretch: 90%; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.sq { border-radius: 9px; }
.avatar.lg.sq { border-radius: 14px; }
.av1 { --a: #e3ecd4; --b: #4c6421; } .av2 { --a: #f6e2d4; --b: #8b4f22; } .av3 { --a: #dce6f8; --b: #2f4f8c; } .av4 { --a: #ece2f7; --b: #63408f; } .av5 { --a: #d7efef; --b: #1c6a70; } .av6 { --a: #f5dcdc; --b: #8d3434; }
:root[data-theme="dark"] .avatar { --a: #22302b; --b: #c2d1ca; }
:root[data-theme="dark"] .av1 { --a: #263317; --b: #c4e18c; } :root[data-theme="dark"] .av2 { --a: #3a2718; --b: #f0bd92; } :root[data-theme="dark"] .av3 { --a: #1b2840; --b: #a8c2f2; } :root[data-theme="dark"] .av4 { --a: #2b2140; --b: #cbb4f2; } :root[data-theme="dark"] .av5 { --a: #133234; --b: #8fd9de; } :root[data-theme="dark"] .av6 { --a: #3a1d1d; --b: #f1a9a9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { --a: #22302b; --b: #c2d1ca; } :root:not([data-theme="light"]) .av1 { --a: #263317; --b: #c4e18c; } :root:not([data-theme="light"]) .av2 { --a: #3a2718; --b: #f0bd92; } :root:not([data-theme="light"]) .av3 { --a: #1b2840; --b: #a8c2f2; } :root:not([data-theme="light"]) .av4 { --a: #2b2140; --b: #cbb4f2; } :root:not([data-theme="light"]) .av5 { --a: #133234; --b: #8fd9de; } :root:not([data-theme="light"]) .av6 { --a: #3a1d1d; --b: #f1a9a9; } }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -7px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r); border: 1px solid var(--line); }
.seg button, .seg a { height: 28px; padding: 0 11px; border-radius: 6px; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 520; }
.seg button:hover, .seg a:hover { color: var(--ink); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 0 11px; border-bottom: 2px solid transparent; color: var(--ink-3); font-size: 14px; font-weight: 540; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .on { color: var(--ink); border-color: var(--primary); }
.tabs .n { font-size: 11.5px; padding: 1px 6px; border-radius: 9px; background: var(--surface-3); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.progress.lime > i { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--lime))); }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); display: grid; justify-items: center; gap: 8px; }
.empty .icon { width: 28px; height: 28px; color: var(--ink-4); }
.empty h3 { color: var(--ink); font-size: 15px; }
.empty p { max-width: 36em; font-size: 13.5px; }
.empty .btn { margin-top: 6px; }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .searchbox { width: 280px; max-width: 100%; }
.filter-chip { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--r); border: 1px dashed var(--line-2); color: var(--ink-2); font-size: 13px; background: transparent; }
.filter-chip.on { border-style: solid; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--ink); }
.filter-chip select { border: 0; background: transparent; font-size: 13px; color: inherit; outline: none; cursor: pointer; padding-right: 2px; max-width: 150px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 560; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arrow { font-size: 10px; margin-left: 3px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .08s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.sel { background: var(--primary-soft); }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl td.primary-cell { color: var(--ink); font-weight: 540; }
.tbl td .sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.tbl .cb { width: 36px; padding-right: 0; }
.tbl .num, .tbl th.num { text-align: right; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .trunc strong { display: block; color: var(--ink); font-weight: 560; }
.bulkbar { position: sticky; bottom: 16px; z-index: 15; margin: 14px auto 0; width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: var(--ink); color: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); flex-wrap: wrap; animation: rise .18s ease-out; }
.bulkbar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--surface) 25%, transparent); box-shadow: none; }
.bulkbar .btn:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }
.bulkbar strong { margin-right: 6px; font-size: 13.5px; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.health .dot { width: 7px; height: 7px; }
.h-good { color: var(--green); } .h-warn { color: var(--amber); } .h-bad { color: var(--red); } .h-none { color: var(--ink-4); }
.score { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); }
.score .bar { width: 38px; height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* ---------- Dialogs: drawer + modal ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-3); }
dialog::backdrop { background: rgb(8 16 13 / .42); backdrop-filter: blur(2px); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); border-radius: var(--r-xl) 0 0 var(--r-xl); display: flex; flex-direction: column; }
dialog.drawer[open] { animation: slidein .2s cubic-bezier(.2,.8,.2,1); }
dialog.drawer.wide { width: min(760px, 100vw); }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } }
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 820px); border-radius: var(--r-xl); display: flex; flex-direction: column; margin: auto; }
dialog.modal[open] { animation: pop .16s ease-out; }
dialog.modal.palette { margin: 10vh auto auto; width: min(640px, calc(100vw - 24px)); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 18px; font-stretch: 90%; }
.dlg-head .icon-btn { margin-left: auto; margin-right: -8px; }
.dlg-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
dialog.drawer .dlg-foot { border-radius: 0 0 0 var(--r-xl); }
.dlg-foot .left { margin-right: auto; }

/* Command palette */
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; outline: 0; height: 58px; font-size: 17px; background: transparent; width: 100%; }
.palette-input .icon { color: var(--ink-3); }
.palette-list { overflow-y: auto; padding: 8px; max-height: 56vh; }
.palette-group { font-size: 12px; color: var(--ink-3); padding: 10px 10px 4px; font-weight: 560; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r); text-align: left; color: var(--ink); }
.palette-item .icon { color: var(--ink-3); }
.palette-item .meta { color: var(--ink-3); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.palette-item.on { background: var(--primary-soft); }
.palette-item.on .icon { color: var(--ink); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }

/* Popover menu */
.menu { position: fixed; z-index: 200; min-width: 200px; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 6px; animation: pop .12s ease-out; max-height: 70vh; overflow-y: auto; }
.menu button, .menu a { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-align: left; font-size: 13.5px; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .icon { color: var(--ink-3); width: 16px; height: 16px; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .menu-title { font-size: 12px; color: var(--ink-3); padding: 6px 10px 4px; font-weight: 560; }
.menu .danger { color: var(--red); }
.menu .danger .icon { color: var(--red); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; min-height: 44px; background: var(--ink); color: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); font-size: 13.5px; animation: rise .2s ease-out; max-width: min(560px, calc(100vw - 32px)); }
.toast.err { background: var(--red); color: #fff; }
.toast button { color: var(--lime); font-weight: 600; padding: 4px 8px; border-radius: 6px; }
:root[data-theme="dark"] .toast button { color: var(--lime-ink); }
.toast button:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.toast .x { color: inherit; opacity: .7; font-weight: 400; }

/* ---------- Home ---------- */
.home-head h1 { font-size: 34px; font-stretch: 78%; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 30px; font-weight: 620; font-stretch: 78%; letter-spacing: -.02em; margin: 6px 0 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .foot { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi .progress { margin-top: 10px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 16px; align-items: start; }

.orbit-card { display: grid; grid-template-columns: minmax(280px, 1.05fr) minmax(240px, 1fr); }
.orbit-viz { position: relative; padding: 8px; border-right: 1px solid var(--line); }
.orbit-viz svg { width: 100%; height: auto; display: block; }
.orbit-viz .ring { fill: none; stroke: var(--line-2); stroke-dasharray: 2 4; }
.orbit-viz .ring.r0 { stroke: color-mix(in srgb, var(--primary) 40%, transparent); stroke-dasharray: none; }
.orbit-viz .ring-label { font-size: 10.5px; fill: var(--ink-3); font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.orbit-viz .core { fill: var(--primary); }
.orbit-viz .core-label { fill: var(--on-primary); font: 600 11px var(--font); }
.orbit-viz .planet { cursor: pointer; stroke: var(--surface); stroke-width: 2; transition: r .12s; }
.orbit-viz .planet:hover, .orbit-viz .planet:focus { stroke: var(--ink); outline: none; }
.orbit-viz .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 7px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-2); z-index: 3; }
.orbit-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 14px 14px; font-size: 12px; color: var(--ink-3); }
.orbit-legend span { display: inline-flex; align-items: center; gap: 6px; }
.orbit-side { padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; }
.drift { display: grid; gap: 2px; margin-top: 10px; }
.drift-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; margin: 0 -8px; border-radius: var(--r); }
.drift-row:hover { background: var(--surface-2); }
.drift-row .meta { min-width: 0; flex: 1; }
.drift-row .meta strong { display: block; font-weight: 560; font-size: 13.5px; }
.drift-row .meta span { font-size: 12.5px; color: var(--ink-3); }
.drift-row .quick { display: flex; gap: 2px; opacity: .0; transition: opacity .1s; }
.drift-row:hover .quick, .drift-row:focus-within .quick { opacity: 1; }

.agenda-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-time { width: 52px; flex-shrink: 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda-time strong { color: var(--ink); font-weight: 600; display: block; font-size: 13.5px; }
.agenda-body { min-width: 0; flex: 1; }
.agenda-body .t { font-weight: 540; color: var(--ink); display: block; }
.agenda-body .s { font-size: 12.5px; color: var(--ink-3); }
.ev-bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--violet); flex-shrink: 0; }

.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; background: var(--surface); color: transparent; transition: background .1s, border-color .1s; }
.check:hover { border-color: var(--primary); }
.check.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.check .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.field.check, .field.check:hover { width: auto; height: auto; border: 0; border-radius: 0; background: none; place-items: normal; margin-top: 0; color: var(--ink); transition: none; } /* checkbox fields share the .check class name with task tick boxes */

.insight { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.insight:last-child { border-bottom: 0; }
.insight .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.insight .ico .icon { width: 16px; height: 16px; }
.insight .body { min-width: 0; flex: 1; }
.insight .body strong { display: block; font-weight: 560; font-size: 13.5px; }
.insight .body p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.stagebar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface-3); }
.stagebar i { display: block; height: 100%; min-width: 3px; }
.stage-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 14px; margin-top: 14px; font-size: 12.5px; }
.stage-legend div { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.stage-legend b { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.feed-item { display: flex; gap: 10px; padding: 9px 0; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { color: var(--ink-4); font-size: 12px; white-space: nowrap; margin-left: auto; padding-left: 8px; }

/* ---------- Pipeline board ---------- */
.board-wrap { overflow-x: auto; padding-bottom: 12px; margin: 0 -28px; padding-left: 28px; padding-right: 28px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(258px, 1fr); gap: 12px; align-items: start; min-height: 60vh; }
.kcol { background: var(--surface-3); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.kcol.over { border-color: var(--primary); background: var(--primary-soft); }
.kcol-head { padding: 2px 4px 4px; }
.kcol-head .name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.kcol-head .name .n { color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
.kcol-head .sum { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.kcol-head .meter { height: 3px; border-radius: 2px; margin-top: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; box-shadow: var(--shadow-1); cursor: grab; display: grid; gap: 8px; position: relative; }
.kcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.kcard.dragging { opacity: .45; }
.kcard .title { font-weight: 560; font-size: 13.5px; line-height: 1.35; color: var(--ink); }
.kcard .co { font-size: 12.5px; color: var(--ink-3); margin-top: -4px; }
.kcard .line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.kcard .amt { font-weight: 640; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; font-stretch: 88%; }
.kcard .next { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; line-height: 1.4; }
.kcard .next .icon { width: 13px; height: 13px; margin-top: 2px; color: var(--ink-3); }
.kcard .rot { color: var(--amber); }
.kcard .late { color: var(--red); }
.kcol .add { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 6px; padding: 7px 6px; border-radius: 6px; }
.kcol .add:hover { color: var(--ink); background: var(--surface); }
.board-sum { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: var(--ink-3); }
.board-sum b { color: var(--ink); font-weight: 620; font-variant-numeric: tabular-nums; font-size: 15px; margin-left: 4px; }

/* ---------- Record pages ---------- */
.rec-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.rec-head .titles { min-width: 0; flex: 1; }
.rec-head h1 { font-size: 30px; font-stretch: 80%; }
.rec-head .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-3); margin-top: 6px; font-size: 13.5px; }
.rec-head .meta a:hover { color: var(--ink); text-decoration: underline; }
.rec-head .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.props { display: grid; gap: 0; }
.prop { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.prop:last-child { border-bottom: 0; }
.prop dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.prop dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.prop dd a { color: var(--primary); }
.prop dd .empty-val { color: var(--ink-4); }
.inline-select { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 4px; margin: -3px -5px; font-size: 13.5px; color: var(--ink); max-width: 100%; cursor: pointer; }
.inline-select:hover { border-color: var(--line-2); background: var(--surface); }

.stepper { display: flex; gap: 3px; margin-bottom: 16px; flex-wrap: wrap; }
.stepper button { flex: 1 1 0; min-width: 84px; height: 34px; padding: 0 12px; font-size: 12.5px; font-weight: 560; background: var(--surface-3); color: var(--ink-3); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 7px 0 0 7px; }
.stepper button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 7px 7px 0; }
.stepper button:hover { color: var(--ink); background: var(--line-2); }
.stepper button.done { background: color-mix(in srgb, var(--primary) 22%, var(--surface-3)); color: var(--ink); }
.stepper button.current { background: var(--primary); color: var(--on-primary); }
.stepper button.won.current { background: var(--green); color: #fff; }
.stepper button.lost.current { background: var(--red); color: #fff; }

.composer { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.composer .tabs { padding: 0 14px; margin: 0; gap: 16px; }
.composer .tabs button { font-size: 13px; padding: 10px 0; }
.composer textarea { border: 0; width: 100%; min-height: 84px; padding: 12px 14px; resize: vertical; outline: none; background: transparent; font-size: 14px; line-height: 1.55; display: block; }
.composer .bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px 14px; flex-wrap: wrap; }
.composer .bar .hint { color: var(--ink-4); font-size: 12px; }
.timeline { position: relative; margin-top: 18px; }
.tl-filter { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tl-day { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 18px 0 8px; display: flex; align-items: center; gap: 10px; }
.tl-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tl-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 6px 0 12px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 15.5px; top: 38px; bottom: -4px; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.tl-ico .icon { width: 15px; height: 15px; }
.tl-main { min-width: 0; }
.tl-title { font-size: 13.5px; color: var(--ink-2); position: relative; padding-right: 64px; line-height: 1.6; }
.tl-title > * { vertical-align: baseline; }
.tl-title strong { color: var(--ink); font-weight: 580; }
.tl-title .when { color: var(--ink-4); font-size: 12px; white-space: nowrap; position: absolute; right: 0; top: 1px; }
.tl-title .tl-tools { vertical-align: middle; margin-left: 4px; }
.tl-body { margin-top: 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; color: var(--ink); position: relative; }
.tl-body.pinned { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber-bg) 60%, var(--surface)); }
.tl-tools { display: inline-flex; gap: 0; opacity: 0; transition: opacity .1s; }
.tl-item:hover .tl-tools, .tl-item:focus-within .tl-tools { opacity: 1; }
.mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); border-radius: 4px; padding: 0 3px; }
.change { font-size: 12.5px; color: var(--ink-3); }
.change s { color: var(--ink-4); }

.mini-list { display: grid; }
.mini { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; min-width: 0; }
.mini:last-child { border-bottom: 0; }
.mini .meta { min-width: 0; flex: 1; }
.mini .meta strong { display: block; font-weight: 560; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .meta span { font-size: 12.5px; color: var(--ink-3); }
.mini .end { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
a.mini:hover strong, a.mini:hover { color: var(--primary); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer; transition: background .1s, border-color .1s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); }
.file-ico { width: 32px; height: 32px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; flex-shrink: 0; letter-spacing: .02em; }

/* ---------- Tasks ---------- */
.quickadd { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); margin-bottom: 8px; }
.quickadd:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.quickadd input { border: 0; outline: 0; background: transparent; height: 38px; flex: 1; font-size: 14.5px; min-width: 0; }
.quickadd .icon { color: var(--ink-3); }
.parse-preview { display: flex; gap: 6px; flex-wrap: wrap; min-height: 26px; margin-bottom: 14px; padding-left: 4px; font-size: 12.5px; color: var(--ink-3); align-items: center; }
.task-group { margin-bottom: 18px; }
.task-group > h3 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.task-group > h3 .n { font-weight: 500; color: var(--ink-4); }
.task-group.g-overdue > h3 { color: var(--red); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 0; }
.task:first-of-type { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.task:last-child { border-bottom-width: 1px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.task:only-of-type { border-radius: var(--r-lg); border-bottom-width: 1px; }
.task:hover { background: var(--surface-2); }
.task .body { min-width: 0; flex: 1; }
.task .t { color: var(--ink); font-weight: 520; cursor: pointer; }
.task .t:hover { text-decoration: underline; }
.task.done .t { text-decoration: line-through; color: var(--ink-4); }
.task .s { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; align-items: center; }
.task .s a:hover { color: var(--ink); text-decoration: underline; }
.task .due.late { color: var(--red); font-weight: 560; }
.task .due.today { color: var(--amber); font-weight: 560; }
.prio { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; margin-top: 7px; }
.prio.High { background: var(--red); } .prio.Medium { background: var(--amber); } .prio.Low { background: var(--line-2); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 10px; font-size: 12.5px; color: var(--ink-3); font-weight: 560; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .d { color: var(--ink-4); }
.cal-day .d { font-size: 12.5px; font-weight: 560; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-day.today .d { background: var(--primary); color: var(--on-primary); }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--violet-bg); color: var(--violet); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; width: 100%; min-height: 21px; }
.cal-chip.is-task { background: transparent; color: var(--ink-2); padding-left: 3px; }
.cal-chip.is-task::before { content: ''; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 3px; flex-shrink: 0; }
.cal-chip.is-task.done { text-decoration: line-through; color: var(--ink-4); }
.cal-chip.is-task.late { color: var(--red); }
.cal-chip .tm { font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-more { font-size: 11.5px; color: var(--ink-3); padding-left: 6px; text-align: left; }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); position: relative; }
.week-head { display: contents; }
.week-head > div { padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); text-align: center; background: var(--surface); }
.week-head > div strong { display: block; font-size: 20px; color: var(--ink); font-weight: 600; font-stretch: 85%; }
.week-head > div.today strong { color: var(--primary); }
.week-hour { height: 52px; font-size: 11px; color: var(--ink-4); text-align: right; padding: 0 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.week-col { position: relative; border-left: 1px solid var(--line); }
.week-slot { height: 52px; border-bottom: 1px solid var(--line); cursor: pointer; }
.week-slot:nth-child(odd) { border-bottom-style: dashed; }
.week-slot:hover { background: var(--surface-2); }
.week-ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; background: var(--violet-bg); border-left: 3px solid var(--violet); padding: 3px 6px; font-size: 12px; color: var(--ink); overflow: hidden; cursor: pointer; text-align: left; line-height: 1.3; }
.week-ev .tm { color: var(--violet); font-weight: 600; font-size: 11.5px; margin-right: 4px; }
.week-ev.tall .tm { display: block; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 1; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.allday { display: flex; flex-direction: column; gap: 2px; padding: 4px; min-height: 30px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- Reports ---------- */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-grid .span2 { grid-column: 1 / -1; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--ink-3); }
.chart .grid { stroke: var(--line); }
.chart .axis { stroke: var(--line-2); }
.chart .bar-hit:hover + .bar, .chart .bar:hover { opacity: .85; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 90px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .track { height: 12px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 560; }
.funnel-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px; gap: 12px; align-items: center; padding: 5px 0; font-size: 13px; }
.funnel-row .track { height: 28px; display: flex; justify-content: center; }
.funnel-row .track i { display: block; height: 100%; border-radius: 5px; background: var(--primary); opacity: .9; }
.funnel-row .v { text-align: right; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.funnel-row .v b { color: var(--ink); font-weight: 600; font-size: 13.5px; }

/* ---------- Automations ---------- */
.rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 16px 18px; align-items: center; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule h3 { font-size: 14.5px; }
.rule-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; }
.rule-flow .step { padding: 3px 9px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.rule-flow .step.when { background: var(--blue-bg); color: var(--blue); }
.rule-flow .step.if { background: var(--amber-bg); color: var(--amber); }
.rule-flow .step.then { background: var(--green-bg); color: var(--green); }
.rule-flow .icon { width: 13px; height: 13px; color: var(--ink-4); }
.rule .stats { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.switch { width: 38px; height: 22px; border-radius: 12px; background: var(--line-2); position: relative; transition: background .15s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(16px); }
:root[data-theme="dark"] .switch.on::after { background: var(--on-primary); }
.builder-block { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; background: var(--surface-2); }
.builder-block > .lbl { font-size: 12.5px; font-weight: 640; display: flex; align-items: center; gap: 8px; }
.builder-row { padding-right: 40px !important; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; position: relative; }
.builder-row .rm { position: absolute; top: 4px; right: 4px; }
.var-list { display: flex; flex-wrap: wrap; gap: 4px; }
.var-list button { font-size: 11.5px; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); font-family: ui-monospace, Consolas, monospace; }
.var-list button:hover { background: var(--primary-soft); color: var(--ink); }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: calc(var(--top-h) + 20px); }
.settings-nav a { padding: 8px 10px; border-radius: var(--r); color: var(--ink-2); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.settings-nav a:hover { background: var(--hover); color: var(--ink); }
.settings-nav a.on { background: var(--surface); color: var(--ink); font-weight: 560; box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.settings-nav .icon { width: 16px; height: 16px; color: var(--ink-3); }
.settings-section { margin-bottom: 18px; }
.settings-section .card-body > p.desc { color: var(--ink-3); font-size: 13px; margin-bottom: 14px; max-width: 64ch; }
.list-editor { display: grid; gap: 6px; }
.list-editor .item { display: flex; gap: 6px; align-items: center; }
.list-editor .item .grip { color: var(--ink-4); cursor: grab; }
.stage-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 110px 110px 36px; gap: 8px; align-items: center; }
.theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 140px)); gap: 10px; }
.theme-pick button { border: 2px solid var(--line); border-radius: var(--r-lg); padding: 8px; display: grid; gap: 8px; text-align: left; font-size: 13px; font-weight: 540; }
.theme-pick button.on { border-color: var(--primary); }
.theme-pick .sw { height: 56px; border-radius: 7px; border: 1px solid var(--line); }

/* ---------- Quotes ---------- */
.quote-lines { width: 100%; border-collapse: collapse; }
.quote-lines th { text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 560; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.quote-lines td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.quote-lines td .input { height: 34px; }
.quote-lines .num { text-align: right; }
.quote-lines .amt { padding-top: 14px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 560; white-space: nowrap; }
.totals { margin-left: auto; width: min(340px, 100%); display: grid; gap: 6px; font-size: 13.5px; padding-top: 12px; }
.totals div { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-2); align-items: center; }
.totals .grand { font-size: 20px; font-weight: 650; color: var(--ink); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-stretch: 86%; }
.totals input { width: 80px; height: 30px; text-align: right; }

/* ---------- Inbox / notifications ---------- */
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.notif .body { min-width: 0; flex: 1; }
.notif .body strong { display: block; font-weight: 560; font-size: 13.5px; }
.notif .body p { font-size: 13px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.notif .when { font-size: 12px; color: var(--ink-4); white-space: nowrap; }
.notif .u { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.menu.notif-menu { width: 380px; max-width: calc(100vw - 20px); padding: 0; }
.notif-menu .head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-menu .head h3 { font-size: 14.5px; }
.notif-menu .list { max-height: 60vh; overflow-y: auto; }

.shortcut-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; font-size: 13.5px; align-items: center; }
.shortcut-grid .k { display: flex; gap: 4px; justify-content: flex-end; }

.company-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.co-card { padding: 16px; display: grid; gap: 12px; }
.co-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.co-card .stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 10px; }
.co-card .stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.print-only { display: none; }
.sample-note { margin-top: 26px; font-size: 12.5px; color: var(--ink-4); display: flex; gap: 8px; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .rec-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .rec-grid > .rec-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
}
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --side-w: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-3); visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; }
  .scrim { position: fixed; inset: 0; background: rgb(8 16 13 / .45); z-index: 25; }
  .mobile-only { display: inline-grid !important; }
  .topbar { padding: 0 14px; gap: 8px; }
  .page { padding: 18px 16px 96px; }
  .board-wrap { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .rec-grid > .rec-right { grid-template-columns: minmax(0, 1fr); }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav a { white-space: nowrap; }
  .orbit-card { grid-template-columns: minmax(0, 1fr); }
  .orbit-viz { border-right: 0; border-bottom: 1px solid var(--line); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 260px; padding: 28px; }
  .auth-art h1 { font-size: 38px; margin-top: 40px; }
  .auth-art p, .auth-art .foot { display: none; }
  .auth-art svg.orbits { width: 420px; height: 420px; right: -170px; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 22; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); padding: 4px 0; }
  .tabbar .on { color: var(--primary); font-weight: 600; }
  .bulkbar { bottom: 76px; }
  .toasts { bottom: 82px; }
  .search-trigger .kbd { display: none; }
}
@media (min-width: 961px) { .tabbar, .scrim { display: none; } }
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .home-head h1 { font-size: 27px; }
  .rec-head h1 { font-size: 25px; }
  .kpi .value { font-size: 25px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .page-head .titles { flex-basis: 100%; }
  .toolbar .searchbox { width: 100%; }
  dialog.drawer { border-radius: 0; width: 100vw; }
  dialog.drawer .dlg-foot { border-radius: 0; }
  .cal-day { min-height: 76px; padding: 3px; }
  .cal-chip { font-size: 10.5px; padding: 1px 3px; }
  .cal-chip .tm { display: none; }
  .hbar { grid-template-columns: 90px minmax(0, 1fr) 70px; }
  .funnel-row { grid-template-columns: 84px minmax(0, 1fr) 86px; }
  .stage-row { grid-template-columns: 18px minmax(0, 1fr) 80px 36px; }
  .stage-row .type-col { display: none; }
  .theme-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .drift-row .quick { opacity: 1; }
  .tl-tools { opacity: 1; }
  .week { grid-template-columns: 40px repeat(7, minmax(44px, 1fr)); min-width: 560px; }
}

@media print {
  .sidebar, .topbar, .tabbar, .toasts, .page-head .actions, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ---------- Field sales ---------- */
.prop > span { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.prop > div { color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.prop > div .sub { display: block; }
.weak-banner { display: flex; align-items: center; gap: 10px; padding: 9px 16px; background: var(--amber-bg); color: var(--ink); font-size: 13px; border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.weak-banner .icon { color: var(--amber); }
.weak-banner a { color: var(--ink); font-weight: 600; text-decoration: underline; }
.weak-banner .icon-btn { margin-left: auto; }
.radio-seg { display: flex; flex-wrap: wrap; width: 100%; }
.radio-seg label { position: relative; flex: 1; min-width: max-content; height: 34px; padding: 0 12px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 520; }
.radio-seg label.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.radio-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.radio-seg label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.gps { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--r); font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); min-height: 40px; }
.gps .gps-msg { flex: 1; min-width: 0; }
.gps-good { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--ink); } .gps-good > .icon { color: var(--green); }
.gps-fair { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--ink); } .gps-fair > .icon { color: var(--amber); }
.gps-bad { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--ink); } .gps-bad > .icon { color: var(--red); }
.gps-wait > .icon { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.f-map { height: 220px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); z-index: 0; position: relative; }
.f-map.big { height: min(68vh, 640px); border: 0; border-radius: var(--r-lg); }
.f-map .leaflet-popup-content a { color: var(--primary); font-weight: 600; }
.week-bars text.bar-n { fill: var(--ink-2); font-weight: 600; }
.goal-ring .ring-n { font: 650 34px var(--font); font-stretch: 80%; fill: var(--ink); }
.goal-ring .ring-of { font: 12px var(--font); fill: var(--ink-3); }
.f-streak { display: inline-flex; align-items: center; gap: 5px; color: var(--amber); font-weight: 600; font-size: 12.5px; }
.f-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.f-agents .inactive { opacity: .6; }
.f-agent-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.f-agent-stats div { display: grid; }
.f-agent-stats b { font-size: 21px; font-weight: 620; font-stretch: 80%; color: var(--ink); font-variant-numeric: tabular-nums; }
.f-agent-stats b small { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.f-agent-stats span { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.goal-matrix td, .goal-matrix th { padding: 8px 8px; }
.gm { display: inline-block; min-width: 46px; text-align: center; padding: 3px 6px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.gm small { font-weight: 400; color: var(--ink-3); }
.gm.met { background: var(--green-bg); color: var(--green); }
.gm.miss { background: var(--red-bg); color: var(--red); }
.gm.cur { background: var(--blue-bg); color: var(--blue); }

/* The sales user's phone app */
.fapp { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.f-top { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 16px; background: var(--side-bg); color: var(--side-ink-strong); padding-top: env(safe-area-inset-top); }
.f-top .brand { display: flex; align-items: center; gap: 9px; font-weight: 640; font-size: 15px; color: var(--side-ink-strong); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-top .brand img { width: 26px; height: 26px; }
.f-top .icon-btn { color: var(--side-ink); }
.f-top .icon-btn:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.f-me { display: grid; place-items: center; width: 40px; height: 40px; }
.f-page { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }
.f-page .card-body.flush { padding: 4px 0 6px; }
.f-hello h1 { font-size: 24px; letter-spacing: -.01em; }
.f-hello p, .f-head p { color: var(--ink-3); margin-top: 4px; font-size: 13.5px; }
.f-head { display: grid; gap: 6px; }
.f-head h1 { font-size: 23px; letter-spacing: -.01em; }
.f-goal { display: flex; align-items: center; gap: 18px; padding: 16px 18px; }
.f-goal-text { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.f-goal-text .label { color: var(--ink-3); font-size: 12.5px; }
.f-goal-text strong { font-size: 18px; font-weight: 620; }
.f-goal-text .btn { margin-top: 8px; }
.f-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); min-width: 0; color: var(--ink); }
.f-row:last-child { border-bottom: 0; }
.f-row:hover, .f-row:active { background: var(--surface-2); }
.f-row .meta { flex: 1; min-width: 0; display: grid; }
.f-row .meta strong { font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row .meta span { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row .end { flex-shrink: 0; }
.f-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.f-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 10px 18px 4px; display: flex; gap: 6px; }
.f-group h3.red { color: var(--red); } .f-group h3.amber { color: var(--amber); }
.f-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 4px; scrollbar-width: none; }
.f-chips .filter-chip { flex-shrink: 0; }
.f-actions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.f-actions .btn { flex-shrink: 0; }
.f-form { display: grid; gap: 14px; }
.f-stamp { display: grid; gap: 8px; }
.f-clock { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.btn.lg { height: 48px; font-size: 15px; }
.f-form input, .f-form select, .f-dialog input, .f-dialog select { font-size: 16px; } /* no zoom-on-focus on iPhone */
.f-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 22; display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); }
.f-tabs > a { display: grid; justify-items: center; gap: 2px; font-size: 11.5px; color: var(--ink-3); padding: 4px 0; }
.f-tabs > a.on { color: var(--primary); font-weight: 600; }
.f-tabs .f-new { display: flex; align-items: center; gap: 6px; padding: 0 16px; height: 46px; border-radius: 23px; background: var(--primary); color: var(--on-primary); font-weight: 620; font-size: 14px; box-shadow: var(--shadow-2); margin-top: -18px; }
.f-tabs .f-new.on { color: var(--on-primary); }
@media (max-width: 640px) {
  .f-agent-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f-agents { grid-template-columns: minmax(0, 1fr); }
  dialog.modal.f-dialog { width: 100vw; max-height: 94vh; margin: auto auto 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .radio-seg label { padding: 0 8px; font-size: 13px; }
}

/* Sales app: tasks, calendar, deals */
.f-row.f-task, .f-row.f-meet { width: 100%; text-align: left; }
.f-task .meta { text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.f-task.done .meta strong { text-decoration: line-through; color: var(--ink-3); }
.f-check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; color: transparent; background: var(--surface); }
.f-check .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.f-check:hover { border-color: var(--primary); }
.f-check.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.f-check.log { border-style: dashed; color: var(--amber); border-color: color-mix(in srgb, var(--amber) 60%, transparent); }
.f-quick { display: grid; grid-template-columns: minmax(0, 1fr) 150px 44px; gap: 8px; }
.f-quick .input { height: 44px; font-size: 16px; }
.f-quick .btn { height: 44px; padding: 0; }
.f-time { display: grid; justify-items: center; min-width: 46px; font-variant-numeric: tabular-nums; }
.f-time b { font-size: 15px; font-weight: 640; color: var(--ink); }
.f-time small { font-size: 11.5px; color: var(--ink-3); }
.f-meet { border-left: 3px solid var(--violet); }
.f-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 4px 8px 10px; }
.f-days button { display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; border-radius: 12px; color: var(--ink-2); }
.f-days button small { font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.f-days button b { font-size: 17px; font-weight: 620; font-variant-numeric: tabular-nums; }
.f-days button i { display: flex; gap: 3px; height: 6px; }
.f-days em { width: 6px; height: 6px; border-radius: 50%; display: block; }
.f-days em.m { background: var(--violet); } .f-days em.t { background: var(--amber); }
.f-days button.today b { color: var(--primary); }
.f-days button.on { background: var(--primary); color: var(--on-primary); }
.f-days button.on small, .f-days button.on b { color: var(--on-primary); }
.f-day-title { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 2px 2px -4px; }
.f-seg { display: flex; width: 100%; }
.f-seg a { flex: 1; justify-content: center; height: 34px; }
.f-deal-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f-deal-kpis .card { padding: 12px 14px; display: grid; gap: 2px; }
.f-deal-kpis span, .f-deal-kpis small { font-size: 12.5px; color: var(--ink-3); }
.f-deal-kpis b { font-size: 22px; font-weight: 640; font-stretch: 80%; }
.f-deal-end { display: grid; justify-items: end; gap: 3px; }
.f-deal-end b { font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.f-today { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
@media (max-width: 380px) { .f-tabs .f-new span { display: none; } .f-tabs .f-new { padding: 0 14px; } }
.f-top .icon-btn { position: relative; }
.f-top .icon-btn .pip { top: 3px; right: 1px; }

/* =====================================================================
   Cygne MedRep additions
   ===================================================================== */
.neg { color: var(--red); } .pos { color: var(--green); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.hidden-amt { letter-spacing: .12em; color: var(--ink-3); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kpi .value small { font-size: 17px; color: var(--ink-3); font-weight: 500; }
a.kpi { display: block; transition: border-color .12s, box-shadow .12s; }
a.kpi:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.kpi .foot .meter { flex: 1; max-width: 120px; }
.brand-logo { max-height: 32px; width: auto !important; max-width: 140px; border-radius: 6px; background: #fff; padding: 2px 4px; }
.sidebar .brand span { min-width: 0; }
.auth-logo { max-height: 60px; max-width: 220px; margin-bottom: 4px; }
.top-pill { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 15px; background: var(--violet-bg); color: var(--violet); font-weight: 600; font-size: 12.5px; margin-right: 4px; }
.top-pill .icon { width: 15px; height: 15px; }
.lg.btn, .btn.lg { height: 46px; font-size: 15px; }

/* Period picker */
.period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period-nav { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.period-nav strong { min-width: 116px; text-align: center; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Meters, rings, badges */
.meter { display: inline-block; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; width: 100%; min-width: 40px; vertical-align: middle; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter.m-green > i { background: var(--green); } .meter.m-amber > i { background: var(--amber); } .meter.m-red > i { background: var(--red); } .meter.m-gray > i { background: var(--ink-4); }
.t-green-ink { color: var(--green); } .t-amber-ink { color: var(--amber); } .t-red-ink { color: var(--red); } .t-gray-ink { color: var(--ink-3); }
.score-ring { display: block; flex-shrink: 0; }
.tbl td .score-ring { margin-left: auto; }
.seg-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 700; vertical-align: 1px; flex-shrink: 0; }
.seg-badge.s-A { background: var(--violet-bg); color: var(--violet); } .seg-badge.s-B { background: var(--blue-bg); color: var(--blue); } .seg-badge.s-C { background: var(--gray-bg); color: var(--ink-3); }
.rep-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 3px 0 8px; border-radius: 11px; background: var(--primary-soft); color: var(--ink); font-size: 12px; font-weight: 540; white-space: nowrap; }
.rep-chip b { font-size: 10.5px; padding: 1px 5px; border-radius: 8px; background: var(--surface); color: var(--ink-2); font-weight: 600; }
.rep-chip.sec { background: var(--surface-3); color: var(--ink-2); }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-2); }
.dots i.on { background: var(--green); border-color: var(--green); }

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.tri-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.team-tbl td .sub { text-align: right; }
.alerts .insight { padding: 12px 18px; align-items: center; cursor: pointer; }
.alerts .insight:hover { background: var(--surface-2); }
.alerts .insight .btn { flex-shrink: 0; }
.drift-row { margin: 0; padding: 8px 18px; cursor: pointer; border-radius: 0; }
.feed-row { display: flex; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.feed-row:last-child { border-bottom: 0; }
.feed-row[data-href]:hover, .feed-row[data-act]:hover { background: var(--surface-2); cursor: pointer; }
.feed-row > .icon { color: var(--ink-3); margin-top: 2px; }
.feed-row .meta { min-width: 0; flex: 1; display: grid; gap: 2px; }
.feed-row .meta p { font-size: 13px; color: var(--ink-2); }
.feed-row .meta strong { font-weight: 560; color: var(--ink); }
.feed-row .when { font-size: 12px; color: var(--ink-3); }
.hbar { grid-template-columns: minmax(90px, 170px) minmax(0, 1fr) 96px; }
.hbar[data-href]:hover { background: var(--surface-2); }

/* Customer page */
.cust-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.rec-head .avatar.lg { width: 60px; height: 60px; font-size: 21px; }
.rec-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-head h1 .seg-badge { width: 26px; height: 26px; font-size: 14px; border-radius: 8px; }
.rec-head p { color: var(--ink-3); margin-top: 4px; }
.persona .card-body { display: grid; gap: 14px; }
.p-class { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.p-class b { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; font-stretch: 80%; }
.p-class.s-A b { background: var(--violet); color: #fff; } .p-class.s-B b { background: var(--blue); color: #fff; } .p-class.s-C b { background: var(--ink-4); color: #fff; }
.p-class span { display: grid; font-weight: 600; color: var(--ink); }
.p-class small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.p-lab { font-size: 12px; color: var(--ink-3); font-weight: 560; }
.p-lab strong { color: var(--ink); }
.p-block { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.adopt { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.adopt i { height: 7px; border-radius: 4px; background: var(--surface-3); }
.adopt i.on { background: var(--green); }
.p-val { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.p-style { padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--teal-bg); border-radius: 0 var(--r) var(--r) 0; }
.p-style p { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.p-note { display: flex; gap: 10px; }
.p-note > .icon { color: var(--ink-3); margin-top: 2px; }
.p-note p { font-size: 13px; color: var(--ink); white-space: pre-line; line-height: 1.5; margin-top: 1px; }
.persona .props .prop { grid-template-columns: 120px minmax(0, 1fr); }
.assign-view { display: grid; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.assign-view:last-child { border-bottom: 0; }
.assign-prog { display: flex; align-items: center; gap: 8px; padding-left: 36px; }
.assign-prog small { color: var(--ink-3); font-size: 12px; }
.mini-kpis { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin-bottom: 14px; }
.mini-kpis > div:not(.mk-actions) { flex: 1; min-width: 120px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); display: grid; gap: 2px; }
.mini-kpis span { font-size: 12.5px; color: var(--ink-3); }
.mini-kpis b { font-size: 20px; font-stretch: 82%; font-weight: 640; font-variant-numeric: tabular-nums; }
.mk-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bday-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 10px; }
.assign-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 92px 30px; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; background: var(--surface-2); }
.assign-row.prim { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); background: var(--primary-soft); }
.mini-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.mini-field .input { width: 62px; text-align: center; padding: 0 6px; }
.prim-pick { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.st-quick { margin-bottom: 4px; }

/* Visit cards */
.visit-card { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.visit-card:last-child { border-bottom: 0; }
.vc-date { width: 42px; flex-shrink: 0; text-align: center; display: grid; align-content: start; padding-top: 1px; }
.vc-date b { font-size: 20px; font-stretch: 80%; font-weight: 650; line-height: 1; color: var(--ink); }
.vc-date small { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.vc-body { min-width: 0; flex: 1; display: grid; gap: 6px; }
.vc-body .strong { color: var(--ink); }
.vc-notes { color: var(--ink); line-height: 1.55; white-space: pre-line; }
.vc-sub { font-size: 12.5px; color: var(--ink-2); }
.vc-sub b { font-weight: 600; color: var(--ink-3); }
.vc-next { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--primary); font-weight: 560; }
.vc-steps { display: flex; gap: 3px; align-items: center; }
.vc-steps i { width: 16px; height: 5px; border-radius: 3px; background: var(--surface-3); }
.vc-steps i.on { background: var(--green); }
.vc-steps small { margin-left: 6px; font-size: 11.5px; color: var(--ink-3); }
.visit-card.v-planned { background: color-mix(in srgb, var(--blue-bg) 40%, transparent); }
.visit-card.v-missed, .visit-card.v-cancelled { opacity: .75; }
.day-group { margin-bottom: 14px; }
.day-group h3 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 0 2px 8px; display: flex; gap: 8px; }
.day-group h3 span { font-weight: 400; }

/* Forms: steps, pills, picker */
.steps-check { display: grid; gap: 6px; }
.step-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.step-item:hover { border-color: var(--line-2); }
.step-item.on { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: var(--green-bg); }
.step-item input { margin-top: 3px; }
.step-item .n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2); flex-shrink: 0; }
.step-item.on .n { background: var(--green); color: #fff; }
.step-item span:last-child { display: grid; gap: 1px; }
.step-item strong { font-weight: 600; color: var(--ink); }
.step-item small { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); cursor: pointer; font-weight: 500; background: var(--surface); user-select: none; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pill:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.seg.radio-seg { display: flex; flex-wrap: wrap; width: 100%; }
.seg.radio-seg label { flex: 0 1 auto; }
.picker { position: relative; }
.pk-input { width: 100%; }
.pk-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); max-height: 280px; overflow-y: auto; padding: 4px; }
.pk-list button { width: 100%; display: grid; text-align: left; padding: 7px 10px; border-radius: 6px; }
.pk-list button small { color: var(--ink-3); font-size: 12px; font-weight: 400; }
.pk-list button:hover, .pk-list button.on { background: var(--primary-soft); }
.pk-none { padding: 10px; color: var(--ink-3); font-size: 13px; }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
.field-lab { font-size: 13px; color: var(--ink-2); font-weight: 520; }

/* Planner */
.plan-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.pweek { display: grid; grid-template-columns: repeat(var(--n), minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.pday { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-height: 420px; display: flex; flex-direction: column; transition: border-color .1s, background .1s; }
.pday.today { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent); }
.pday.off { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 8px, var(--surface-3) 8px, var(--surface-3) 16px); }
.pday.drop-on { border-color: var(--primary); background: var(--primary-soft); }
.pday-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.pday-head small { display: block; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pday-head b { font-size: 20px; font-stretch: 80%; font-weight: 650; }
.pday-count { font-size: 18px; font-weight: 650; font-stretch: 80%; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pday-count small { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.pday-count.met { color: var(--green); }
.pday-tag { margin: 8px 10px 0; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 560; }
.pday-list { display: grid; gap: 6px; padding: 8px; align-content: start; flex: 1; }
.pcard { padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; gap: 2px; box-shadow: var(--shadow-1); border-left: 3px solid var(--blue); }
.pcard:hover { border-color: var(--line-2); border-left-color: var(--blue); }
.pcard strong { font-size: 13px; font-weight: 580; color: var(--ink); }
.pcard small { font-size: 11.5px; color: var(--ink-3); }
.pcard.s-done { border-left-color: var(--green); background: var(--green-bg); box-shadow: none; }
.pcard.s-missed { border-left-color: var(--red); opacity: .7; }
.pcard.late { border-left-color: var(--amber); }
.pcard[draggable=true] { cursor: grab; }
.dragging .pday:not(.off) { border-style: dashed; }
.padd { display: flex; align-items: center; gap: 6px; justify-content: center; height: 32px; border-radius: var(--r); color: var(--ink-3); font-size: 12.5px; border: 1px dashed var(--line-2); margin-top: 2px; }
.padd:hover { color: var(--ink); border-color: var(--primary); background: var(--primary-soft); }
.due-card { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); display: flex; flex-direction: column; }
.due-list { overflow-y: auto; padding: 0 8px 8px; }
.due-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r); cursor: grab; }
.due-row:hover { background: var(--surface-2); }
.due-row .meta { min-width: 0; flex: 1; display: grid; }
.due-row .meta strong { font-size: 13px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-row .meta span { font-size: 12px; color: var(--ink-3); }
.due-n { min-width: 24px; height: 24px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.team-week th.today { color: var(--primary); }
.tw { display: inline-block; min-width: 54px; text-align: center; padding: 5px 8px; border-radius: 7px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tw small { font-weight: 400; opacity: .7; }
.tw.met { background: var(--green-bg); color: var(--green); } .tw.near { background: var(--amber-bg); color: var(--amber); } .tw.low { background: var(--red-bg); color: var(--red); } .tw.off { background: var(--surface-3); color: var(--ink-3); font-weight: 500; font-size: 12px; }
.sugg { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.sugg-day h3 { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--ink); }
.sugg-day h3 span { color: var(--ink-3); font-weight: 500; }
.sugg-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.sugg-row:hover { background: var(--surface-2); }
.sugg-row input { margin-top: 3px; }
.sugg-row small { display: block; color: var(--ink-3); font-size: 11.5px; }
.sugg-row strong { font-weight: 560; font-size: 13px; }

/* Team */
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rep-card { padding: 18px; display: grid; gap: 10px; color: inherit; transition: box-shadow .12s, border-color .12s; }
.rep-card:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); }
.rc-head { display: flex; gap: 12px; align-items: center; }
.rc-head > div { flex: 1; min-width: 0; display: grid; gap: 3px; justify-items: start; }
.rc-head h2 { font-size: 17px; }
.rc-head p { color: var(--ink-3); font-size: 12.5px; }
.rc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rc-stats div { display: grid; text-align: center; }
.rc-stats b { font-size: 19px; font-stretch: 80%; font-weight: 640; font-variant-numeric: tabular-nums; }
.rc-stats span { font-size: 11.5px; color: var(--ink-3); }
.rk-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 42px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.rk-row b { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.rk-row small { display: none; }
.kpi-score { display: flex; gap: 20px; align-items: center; padding: 18px 20px; margin-bottom: 16px; flex-wrap: wrap; }
.ks-ring { display: flex; gap: 16px; align-items: center; flex: 1; min-width: 260px; }
.ks-ring h2 { font-size: 18px; }
.ks-facts { display: grid; grid-template-columns: repeat(5, auto); gap: 6px 24px; }
.ks-facts div { display: grid; }
.ks-facts span { font-size: 12px; color: var(--ink-3); }
.ks-facts b { font-size: 21px; font-stretch: 80%; font-weight: 640; font-variant-numeric: tabular-nums; }
.ks-facts b small { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-part .weight { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--surface-3); color: var(--ink-3); }
.kpi-part .meter { margin: 2px 0 8px; }
.qty { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 2px; }
.qty button { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-2); }
.qty button:hover { background: var(--hover); color: var(--ink); }
.qty b { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }

/* Invoices */
.doc-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.doc-ico .icon { width: 24px; height: 24px; }
.inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.inv-totals { margin-left: auto; width: min(320px, 100%); padding: 14px 18px 18px; display: grid; gap: 6px; }
.inv-totals div, .totals-box div { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; color: var(--ink-2); }
.inv-totals b, .totals-box b { color: var(--ink); font-variant-numeric: tabular-nums; }
.inv-totals .grand, .totals-box .grand { border-top: 1px solid var(--line); padding-top: 8px; font-size: 16px; }
.inv-totals .grand span, .totals-box .grand span { color: var(--ink); font-weight: 600; }
.totals-box { display: grid; gap: 6px; align-content: end; padding: 10px 2px 0; }
.lines { display: grid; gap: 6px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 80px 110px 100px 30px; gap: 8px; align-items: center; }
.line.r { grid-template-columns: minmax(0, 1fr) 80px 120px 30px; }
.line.head { font-size: 12px; color: var(--ink-3); font-weight: 560; }
.line .input.num, .input.num { text-align: right; }
.line .lt { text-align: right; font-weight: 560; color: var(--ink); }
.stock-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stock-pill.ok { background: var(--green-bg); color: var(--green); } .stock-pill.low { background: var(--amber-bg); color: var(--amber); } .stock-pill.out { background: var(--red-bg); color: var(--red); }
.exp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.sub-row td { font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; background: var(--surface-2); }
.total-row td { font-weight: 650; color: var(--ink); border-top: 2px solid var(--line-2); }
tr.dim td { opacity: .55; }
.tbl.compact td, .tbl.compact th { padding: 6px 10px; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-card { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.media-card.sel { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.mc-check { position: absolute; top: 10px; left: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 8px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow-1); cursor: pointer; }
.mc-thumb { position: relative; height: 140px; display: grid; place-items: center; align-content: center; gap: 6px; background: linear-gradient(140deg, var(--side-bg), color-mix(in srgb, var(--primary) 70%, var(--side-bg))); color: var(--lime); overflow: hidden; }
.mc-thumb.t-layers { background: linear-gradient(140deg, #3b2a14, #a86400); color: #ffe3b0; }
.mc-thumb.t-play { background: linear-gradient(140deg, #1c2340, #2b5fc2); color: #cfe0ff; }
.mc-thumb.t-note { background: linear-gradient(140deg, #24183a, #6d45c0); color: #e2d6ff; }
.mc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mc-thumb > span { font-size: 11px; font-weight: 700; letter-spacing: .08em; opacity: .85; }
.mc-thumb em { position: absolute; right: 10px; bottom: 10px; font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgb(0 0 0 / .35); color: #fff; }
.mc-body { padding: 12px 14px 4px; display: grid; gap: 3px; flex: 1; align-content: start; }
.mc-body strong { font-weight: 600; color: var(--ink); line-height: 1.35; }
.mc-body p { color: var(--ink-2); }
.mc-actions { display: flex; gap: 4px; padding: 8px 10px 12px; justify-content: flex-end; }
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; }
.dropzone.on { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.busy { opacity: .7; pointer-events: none; }
.up-row { display: flex; gap: 8px; align-items: center; padding: 6px 2px; font-size: 13px; border-bottom: 1px dashed var(--line); }
.up-row small { color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.up-row .st { font-size: 12px; max-width: 45%; }
.send-files { display: grid; gap: 4px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 4px; }
.send-file { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.send-file:hover { background: var(--surface-2); }
.send-file.on { background: var(--primary-soft); }
.send-file span.trunc { display: grid; }
.send-file strong { font-weight: 560; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.send-file small { font-size: 11.5px; color: var(--ink-3); }
.sf-ico { width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }

/* Reports */
.score-tbl th small { font-weight: 400; color: var(--ink-4); margin-left: 3px; }
.kcell { display: grid; grid-template-columns: minmax(50px, 1fr) 42px; gap: 2px 8px; align-items: center; min-width: 150px; }
.kcell b { text-align: right; font-variant-numeric: tabular-nums; }
.kcell small { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); }
.hcell { display: inline-block; min-width: 38px; padding: 4px 6px; border-radius: 7px; font-weight: 650; text-align: center; }
.kpi-explain { display: grid; gap: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.kpi-explain b { color: var(--ink); }
.pl { display: grid; gap: 0; }
.pl-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.pl-row span small { display: block; font-size: 11.5px; color: var(--ink-3); }
.pl-row b { font-variant-numeric: tabular-nums; }
.pl-row.sub { padding-left: 14px; color: var(--ink-2); font-size: 13px; }
.pl-row.total { font-weight: 650; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.pl-row.grand { font-size: 17px; font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 12px; }
.pl-row.grand.neg b { color: var(--red); } .pl-row.grand.pos b { color: var(--green); }

/* Settings */
.settings-body { min-width: 0; }
.logo-row { display: flex; gap: 16px; align-items: center; }
.logo-row img { max-height: 64px; max-width: 180px; border-radius: 8px; border: 1px solid var(--line); padding: 4px; background: #fff; }
.logo-ph { width: 72px; height: 64px; border-radius: 10px; border: 1px dashed var(--line-2); display: grid; place-items: center; color: var(--ink-4); }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lists-grid textarea { min-height: 150px; font-size: 13px; }
.step-edit { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; background: var(--surface-2); }
.step-edit .n { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.se-fields { display: grid; gap: 6px; }
.se-tools { display: flex; gap: 2px; }
.se-tools [data-step-up] .icon { transform: rotate(90deg); }
.hol-date { width: 40px; text-align: center; display: grid; flex-shrink: 0; }
.hol-date b { font-size: 18px; font-stretch: 80%; line-height: 1; }
.hol-date small { font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.imp-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); line-height: 1.55; }
.imp-sheets { display: grid; gap: 12px; }
.imp-sheet { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; }
.imp-sh-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.imp-sh-head select { width: 200px; margin-left: auto; }
.imp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; margin-top: 12px; }
.imp-grid label { display: grid; gap: 3px; font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.imp-result { display: grid; gap: 8px; }
.imp-result div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.imp-result span { color: var(--ink-3); font-size: 13px; }

/* Rep phone app additions */
.f-logo { width: auto !important; max-width: 90px; max-height: 28px; background: #fff; border-radius: 5px; padding: 1px 3px; }
.f-top .avatar { border: 2px solid var(--side-line); }
.f-row.f-done .meta strong { color: var(--ink-2); }
.f-row .btn.sm.primary { pointer-events: none; }
.f-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.bday-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--teal-bg); color: var(--teal); display: grid; place-items: center; flex-shrink: 0; }
.bday-ico.today { background: var(--violet); color: #fff; }
.f-freq { min-width: 38px; text-align: center; font-weight: 650; font-size: 12.5px; padding: 3px 7px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); font-variant-numeric: tabular-nums; }
.f-freq.met { background: var(--green-bg); color: var(--green); }
.f-doc-head { display: flex; gap: 14px; align-items: center; }
.f-doc-head h1 { font-size: 22px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; letter-spacing: -.01em; }
.f-doc-head p { color: var(--ink-3); font-size: 13px; margin: 2px 0 6px; }
.f-doc-head.sm h1 { font-size: 19px; }
.f-doc-head.sm p { margin-bottom: 0; }
.prep summary { list-style: none; display: flex; align-items: baseline; gap: 10px; padding: 14px 18px; cursor: pointer; }
.prep summary::-webkit-details-marker { display: none; }
.prep summary h2 { font-size: 15px; display: flex; gap: 6px; align-items: center; }
.prep[open] summary { padding-bottom: 0; }
.prep .card-body { display: grid; gap: 8px; font-size: 13.5px; }
.prep .card-body p { line-height: 1.5; }
.prep-tip { padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--teal-bg); border-radius: 0 8px 8px 0; }
.prep-facts { display: flex; gap: 6px; flex-wrap: wrap; }
.prep-facts span { display: grid; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.prep-facts small { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.prep-last { padding: 10px 12px; border-radius: 8px; border: 1px dashed var(--line-2); display: grid; gap: 4px; }
.f-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.f-step:last-child { border-bottom: 0; }
.f-step input { position: absolute; opacity: 0; pointer-events: none; }
.f-step .meta { display: grid; gap: 2px; min-width: 0; }
.f-step .meta strong { font-weight: 600; }
.f-step .meta span { font-size: 12.5px; color: var(--ink-3); }
.f-step.on { background: var(--green-bg); }
.f-step.on .f-check { background: var(--green); border-color: var(--green); color: #fff; }
.f-step:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.f-outcomes .radio-seg { gap: 6px; background: none; border: 0; padding: 0; }
.f-outcomes .radio-seg label { border: 1px solid var(--line-2); border-radius: 17px; flex: 0 1 auto; background: var(--surface); }
.f-outcomes .radio-seg label.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.f-form textarea { font-size: 16px; }
.saved-ok { display: grid; justify-items: center; text-align: center; gap: 4px; margin-bottom: 16px; }
.saved-ok .icon { width: 44px; height: 44px; color: var(--green); }
.f-kpi { display: grid; gap: 5px; padding: 6px 0; }
.f-kpi b { font-variant-numeric: tabular-nums; }
.f-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 15px; }
.f-total strong { font-size: 22px; font-stretch: 80%; }
.f-hist { padding: 10px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; font-size: 13.5px; }
.f-hist:last-child { border-bottom: 0; }
.f-page .persona { font-size: 13.5px; }
.f-seg button { flex: 1; justify-content: center; height: 34px; }
button.f-row { width: 100%; text-align: left; }

/* Responsive additions */
@media (max-width: 1400px) { .cust-grid { grid-template-columns: 300px minmax(0, 1fr); } .cust-grid > .stack:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
@media (max-width: 1180px) {
  .dash-grid, .inv-grid, .exp-grid { grid-template-columns: minmax(0, 1fr); }
  .tri-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .plan-wrap { grid-template-columns: minmax(0, 1fr); }
  .due-card { position: static; max-height: 420px; }
  .ks-facts { grid-template-columns: repeat(3, auto); }
}
@media (max-width: 960px) {
  .cust-grid { grid-template-columns: minmax(0, 1fr); }
  .cust-grid > .stack:last-child { grid-template-columns: minmax(0, 1fr); }
  .tri-grid { grid-template-columns: minmax(0, 1fr); }
  .pweek { grid-template-columns: repeat(var(--n), minmax(160px, 1fr)); }
  .period-nav strong { min-width: 96px; }
}
@media (max-width: 640px) {
  .assign-row { grid-template-columns: minmax(0, 1fr) 30px; }
  .assign-row .mini-field, .assign-row .prim-pick { grid-column: 1; }
  .line { grid-template-columns: minmax(0, 1fr) 64px 84px 30px; }
  .line .lt, .line.head span:nth-child(4) { display: none; }
  .line.r { grid-template-columns: minmax(0, 1fr) 64px 84px 30px; }
  .ks-facts { grid-template-columns: repeat(2, auto); }
  .bday-row { grid-template-columns: 1fr 1fr; }
  .bday-row > :last-child { grid-column: 1 / -1; }
  .rec-head .actions { width: 100%; }
}

/* =====================================================================
   Visual refresh v2 — depth, colour accents, hero headers, doctor profile
   ===================================================================== */
:root { --r-lg: 14px; --r-xl: 18px; --shadow-1: 0 1px 2px rgb(19 34 29 / .05), 0 2px 8px -2px rgb(19 34 29 / .06); --shadow-2: 0 2px 4px rgb(19 34 29 / .05), 0 12px 32px -8px rgb(19 34 29 / .16);
  --grad-forest: linear-gradient(135deg, #0f1d18 0%, #173a30 55%, #1f4d40 100%); --accent-glow: radial-gradient(60% 80% at 100% 0%, rgb(212 242 138 / .22), transparent 60%); }
body { background: radial-gradient(1200px 520px at 85% -120px, color-mix(in srgb, var(--lime) 22%, transparent), transparent 70%), radial-gradient(900px 480px at -10% -80px, color-mix(in srgb, var(--teal) 10%, transparent), transparent 70%), var(--bg); background-attachment: fixed; }
.card { border-color: color-mix(in srgb, var(--line) 85%, transparent); }
.card-head h2 { font-size: 15.5px; letter-spacing: -.01em; }
.page-head h1 { font-size: 32px; font-stretch: 80%; letter-spacing: -.025em; }

/* Sidebar */
.sidebar { background: linear-gradient(180deg, #13241e 0%, #0e1915 100%); }
.sidebar .brand { padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--side-line); }
.sidebar .brand img:not(.brand-logo) { width: 34px; height: 34px; filter: drop-shadow(0 4px 10px rgb(212 242 138 / .25)); }
.nav-group { text-transform: uppercase; letter-spacing: .09em; font-size: 10.5px; font-weight: 650; color: #5c7269; padding-top: 18px; }
.nav a { padding: 9px 12px; border-radius: 9px; transition: background .15s, color .15s; }
.nav a.active { background: linear-gradient(90deg, rgb(212 242 138 / .16), rgb(212 242 138 / .04)); color: #fff; box-shadow: inset 0 0 0 1px rgb(212 242 138 / .12); }
.nav a.active .icon { color: var(--lime); }
.nav a.active::before { left: -12px; top: 9px; bottom: 9px; width: 3px; box-shadow: 0 0 12px var(--lime); }
.me { margin-top: 6px; padding: 10px; border-radius: 12px; background: rgb(255 255 255 / .04); }

/* Buttons */
.btn { border-radius: 10px; transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 88%, #fff) 0%, var(--primary) 100%); box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 6px 14px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 10px 20px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.icon-btn.round { border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); width: 38px; height: 38px; box-shadow: var(--shadow-1); }
.icon-btn.round:hover { border-color: var(--primary); color: var(--primary); }

/* KPI tiles */
.kpi { position: relative; overflow: hidden; padding: 18px 20px; --kc: var(--primary); --kb: var(--primary-soft); }
.kpi::after { content: ''; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--kc) 16%, transparent), transparent 70%); pointer-events: none; }
.kpi.k-green { --kc: var(--green); --kb: var(--green-bg); } .kpi.k-amber { --kc: var(--amber); --kb: var(--amber-bg); } .kpi.k-violet { --kc: var(--violet); --kb: var(--violet-bg); }
.kpi.k-blue { --kc: var(--blue); --kb: var(--blue-bg); } .kpi.k-teal { --kc: var(--teal); --kb: var(--teal-bg); } .kpi.k-red { --kc: var(--red); --kb: var(--red-bg); }
.kpi .label { font-weight: 540; color: var(--ink-2); }
.k-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--kb); color: var(--kc); flex-shrink: 0; }
.k-ic .icon { width: 16px; height: 16px; }
.kpi .value { font-size: 32px; margin: 12px 0 6px; }
a.kpi:hover { transform: translateY(-2px); }
a.kpi { transition: transform .15s, box-shadow .15s, border-color .15s; }

/* Tables & tabs */
.tbl th { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 650; color: var(--ink-3); background: var(--surface-2); }
.tbl thead tr th:first-child { border-top-left-radius: var(--r-lg); } .tbl thead tr th:last-child { border-top-right-radius: var(--r-lg); }
.tbl td { padding-top: 12px; padding-bottom: 12px; }
.tabs { gap: 6px; border-bottom: 0; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a, .tabs button { padding: 7px 14px; border-radius: 9px; border-bottom: 0; margin: 0; font-size: 13.5px; }
.tabs .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs .n { background: var(--surface-3); }
.tabs .on .n { background: var(--primary-soft); color: var(--primary); }
.seg { border-radius: 11px; } .seg .on { border-radius: 8px; }
.period-nav { border-radius: 11px; box-shadow: var(--shadow-1); }
.badge { height: 23px; padding: 0 9px; font-weight: 580; }
.badge .icon { width: 13px; height: 13px; }

/* Dashboard hero */
.dash-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; padding: 28px 30px; margin-bottom: 18px; border-radius: 22px; color: #eaf3ee; background: var(--accent-glow), var(--grad-forest); box-shadow: 0 24px 50px -24px rgb(15 29 24 / .55); }
.dash-hero::before { content: ''; position: absolute; right: -120px; bottom: -220px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgb(212 242 138 / .14); box-shadow: 0 0 0 60px rgb(212 242 138 / .03), 0 0 0 140px rgb(212 242 138 / .025); pointer-events: none; }
.dh-left { position: relative; min-width: 0; }
.dh-date { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--lime); font-weight: 650; }
.dash-hero h1 { font-size: 38px; font-stretch: 76%; font-weight: 650; letter-spacing: -.03em; margin: 6px 0 6px; color: #fff; }
.dash-hero p { color: #a9bdb4; }
.dash-hero p strong { color: #fff; }
.dh-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.dh-chip { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px; background: rgb(255 255 255 / .07); border: 1px solid rgb(255 255 255 / .09); color: #dfeae4; backdrop-filter: blur(6px); transition: background .15s; }
.dh-chip:hover { background: rgb(255 255 255 / .12); }
.dh-chip > .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgb(212 242 138 / .14); color: var(--lime); }
.dh-chip span { display: grid; font-size: 11.5px; color: #9fb2aa; line-height: 1.25; }
.dh-chip b { font-size: 18px; font-stretch: 82%; color: #fff; font-weight: 650; }
.dh-chip b small { font-size: 12px; color: #9fb2aa; font-weight: 500; }
.dh-right { position: relative; }
.dash-hero .seg { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .1); }
.dash-hero .seg button { color: #b9c9c2; } .dash-hero .seg .on { background: var(--lime); color: var(--lime-ink); }
.dash-hero .period-nav { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .1); color: #fff; box-shadow: none; }
.dash-hero .period-nav .icon-btn { color: #cfe0d8; } .dash-hero .period-nav .icon-btn:hover { background: rgb(255 255 255 / .1); color: #fff; }

/* Customer hero */
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }
.avatar.xl.sq { border-radius: 22px; }
.hero-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-1); margin-bottom: 18px; overflow: hidden; --hc: #4f7fd6; }
.hero-card.s-A { --hc: #7b5ad1; } .hero-card.s-C { --hc: #7d8f87; } .hero-card.s-none { --hc: #11808a; }
.hero-cover { height: 84px; background: radial-gradient(60% 140% at 85% 0%, color-mix(in srgb, var(--hc) 70%, transparent), transparent 70%), radial-gradient(40% 120% at 10% 100%, rgb(212 242 138 / .3), transparent 70%), var(--grad-forest); }
.hero-main { display: flex; gap: 18px; align-items: flex-end; padding: 0 24px 16px; margin-top: -44px; flex-wrap: wrap; position: relative; }
.hero-av { position: relative; }
.hero-av .avatar { border: 4px solid var(--surface); box-shadow: var(--shadow-2); }
.hero-seg { position: absolute; right: -4px; bottom: 2px; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: 15px; color: #fff; background: var(--hc); border: 3px solid var(--surface); }
.hero-main .titles { flex: 1; min-width: 220px; padding-bottom: 2px; }
.hero-main h1 { font-size: 30px; font-stretch: 80%; letter-spacing: -.02em; }
.hero-main p { color: var(--ink-3); margin-top: 3px; }
.hero-main .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-bottom: 4px; }
.hero-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--surface-2); }
.hero-stats div { padding: 12px 24px; display: grid; gap: 2px; border-left: 1px solid var(--line); min-width: 0; }
.hero-stats div:first-child { border-left: 0; }
.hero-stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; }
.hero-stats b { font-size: 18px; font-stretch: 84%; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Doctor profile (persona) */
.persona2 { overflow: hidden; padding: 0; }
.pz-head { position: relative; padding: 16px 18px 18px; color: #eaf3ee; background: var(--accent-glow), var(--grad-forest); --pc: #4f7fd6; }
.pz-head.s-A { --pc: #9b7cf0; } .pz-head.s-C { --pc: #9aa9a2; } .pz-head.s-none { --pc: #5cc8d1; }
.pz-top { display: flex; align-items: center; gap: 10px; }
.pz-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--lime); flex: 1; }
.pz-score { position: relative; display: grid; place-items: center; }
.pz-score b { position: absolute; font-size: 9.5px; font-weight: 700; color: #fff; }
.pz-edit { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #cfe0d8; background: rgb(255 255 255 / .08); }
.pz-edit:hover { background: rgb(255 255 255 / .16); color: #fff; }
.pz-class { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.pz-class > div:not(.pz-pot) { display: grid; flex: 1; min-width: 0; }
.pz-class strong { font-size: 17px; color: #fff; font-weight: 650; }
.pz-class small { font-size: 12px; color: #a9bdb4; }
.pz-medal { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; font-weight: 750; font-stretch: 78%; color: #fff; background: linear-gradient(145deg, color-mix(in srgb, var(--pc) 90%, #fff), var(--pc)); box-shadow: 0 8px 20px -6px var(--pc), inset 0 1px 0 rgb(255 255 255 / .35); flex-shrink: 0; }
.pz-medal.none { background: rgb(255 255 255 / .1); box-shadow: none; color: #9fb2aa; }
.pz-pot { display: grid; justify-items: end; gap: 3px; }
.pz-pot small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.pz-pot span { font-size: 12px; font-weight: 600; color: #fff; }
.lvl { display: inline-flex; gap: 3px; align-items: flex-end; height: 14px; }
.lvl i { width: 6px; border-radius: 2px; background: rgb(127 140 135 / .3); }
.lvl i:nth-child(1) { height: 6px; } .lvl i:nth-child(2) { height: 10px; } .lvl i:nth-child(3) { height: 14px; }
.lvl-lime i.on { background: var(--lime); } .lvl-green i.on { background: var(--green); } .lvl-amber i.on { background: var(--amber); } .lvl-red i.on { background: var(--red); }
.pz-head .lvl i { background: rgb(255 255 255 / .16); } .pz-head .lvl-lime i.on { background: var(--lime); }
.pz-body { padding: 16px 18px 18px; display: grid; gap: 16px; }
.pz-body h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; margin-bottom: 8px; }
.journey { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.journey::before { content: ''; position: absolute; left: 10%; right: 10%; top: 7px; height: 2px; background: var(--surface-3); }
.jn { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; }
.jn i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); position: relative; z-index: 1; }
.jn span { font-size: 10.5px; color: var(--ink-4); font-weight: 560; }
.jn.done i { background: var(--green); border-color: var(--green); }
.jn.done:not(:first-child)::before, .jn.cur:not(:first-child)::before { content: ''; position: absolute; right: 50%; width: 100%; top: 7px; height: 2px; background: var(--green); }
.jn.cur i { background: var(--surface); border: 4px solid var(--green); box-shadow: 0 0 0 4px var(--green-bg); width: 18px; height: 18px; margin-top: -1px; }
.jn.done span { color: var(--ink-3); } .jn.cur span { color: var(--green); font-weight: 700; }
.style-box { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 12px; align-items: center; }
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-3); }
.quad div { padding: 7px 6px; border-radius: 9px; text-align: center; display: grid; gap: 0; }
.quad b { font-size: 11px; font-weight: 650; color: var(--ink-3); }
.quad small { font-size: 9.5px; color: var(--ink-4); line-height: 1.2; }
.quad .on { background: var(--teal); box-shadow: 0 6px 14px -6px var(--teal); }
.quad .on b, .quad .on small { color: #fff; }
.style-tip { display: flex; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--ink); }
.style-tip .icon { color: var(--teal); margin-top: 2px; }
.pz-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pz-fact { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.pz-fact > div { min-width: 0; }
.pf-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); flex-shrink: 0; }
.pz-fact small { display: block; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.pf-v { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.pf-v b { font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 14px; font-size: 12.5px; font-weight: 560; background: var(--surface-3); color: var(--ink-2); }
.chip .icon { width: 13px; height: 13px; }
.chip.c-green { background: var(--green-bg); color: var(--green); }
.pz-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; }
.pz-note > .icon { margin-top: 1px; }
.pz-note h4 { margin-bottom: 3px; }
.pz-note p { font-size: 13px; line-height: 1.5; color: var(--ink); white-space: pre-line; }
.pz-note.n-amber { background: var(--amber-bg); } .pz-note.n-amber > .icon, .pz-note.n-amber h4 { color: var(--amber); }
.pz-note.n-violet { background: var(--violet-bg); } .pz-note.n-violet > .icon, .pz-note.n-violet h4 { color: var(--violet); }
.pz-more { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--ink-3); font-size: 12.5px; font-weight: 560; }
.pz-more:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.pz-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 8px 4px; color: var(--ink-3); font-size: 13px; }
.pz-empty > .icon { width: 28px; height: 28px; color: var(--teal); }

/* Team & rep cards */
.rep-card { position: relative; overflow: hidden; }
.rep-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--lime)); }
.kpi-score { background: var(--accent-glow), var(--grad-forest); color: #eaf3ee; border: 0; }
.kpi-score h2 { color: #fff; } .kpi-score .muted { color: #a9bdb4; } .kpi-score .ks-facts span { color: #9fb2aa; } .kpi-score .ks-facts b { color: #fff; } .kpi-score .ks-facts b small { color: #9fb2aa; }
.kpi-score .ks-facts .neg { color: #ff9a88; } .kpi-score .ks-facts .pos { color: var(--lime); }
.kpi-score .score-ring circle:first-child { stroke: rgb(255 255 255 / .12); } .kpi-score .score-ring text { fill: #fff !important; }

/* Visit cards */
.visit-card { transition: background .12s; }
.visit-card:hover { background: var(--surface-2); }
.vc-date { width: 46px; height: 50px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); align-content: center; }

/* Rep phone app */
.f-top { background: var(--grad-forest); }
.f-goal { background: var(--accent-glow), var(--grad-forest); border: 0; color: #eaf3ee; box-shadow: 0 18px 40px -20px rgb(15 29 24 / .6); }
.f-goal .ring-n, .f-goal .score-ring text { fill: #fff !important; } .f-goal .ring-of { fill: #9fb2aa; }
.f-goal .goal-ring circle:first-child, .f-goal .score-ring circle:first-child { stroke: rgb(255 255 255 / .12); }
.f-goal .goal-ring circle:nth-child(2) { stroke: var(--lime); }
.f-goal-text .label { color: var(--lime); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 650; }
.f-goal-text strong { color: #fff; } .f-goal-text .muted { color: #a9bdb4; }
.f-goal .btn.primary { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); box-shadow: 0 8px 18px -8px rgb(212 242 138 / .6); }
.f-tabs .f-new { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 85%, #fff), var(--primary)); box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.f-page .card { border-radius: 16px; }

/* Dark theme tweaks */
:root[data-theme="dark"] body { background: radial-gradient(1200px 520px at 85% -120px, rgb(198 236 122 / .07), transparent 70%), var(--bg); }
:root[data-theme="dark"] .hero-av .avatar, :root[data-theme="dark"] .hero-seg { border-color: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background: radial-gradient(1200px 520px at 85% -120px, rgb(198 236 122 / .07), transparent 70%), var(--bg); } }

@media (max-width: 960px) {
  .dash-hero { padding: 22px 20px; border-radius: 18px; }
  .dash-hero h1 { font-size: 30px; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-stats div:nth-child(4) { border-left: 0; }
  .hero-stats div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .tabs { width: 100%; }
}
@media (max-width: 640px) {
  .hero-main { padding: 0 16px 14px; }
  .hero-stats div { padding: 10px 14px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats div:nth-child(odd) { border-left: 0; } .hero-stats div:nth-child(4) { border-left: 1px solid var(--line); }
  .hero-stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .style-box { grid-template-columns: minmax(0, 1fr); }
  .pz-facts { grid-template-columns: minmax(0, 1fr); }
}
/* v2 fixes */
.hero-main { margin-top: 0; align-items: flex-start; padding-top: 14px; }
.hero-av { margin-top: -58px; }
.kpi::after { display: none; }
.kpi { border-top: 3px solid color-mix(in srgb, var(--kc) 55%, transparent); }
.pf-v b { white-space: normal; }
.prop > div a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Profile form (add / edit customer) */
.pf-section { margin-top: 8px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface)); overflow: hidden; }
.pf-sec-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--accent-glow), var(--grad-forest); }
.pf-progress { display: flex; align-items: center; gap: 8px; width: 180px; }
.pf-progress .meter { background: rgb(255 255 255 / .14); height: 7px; }
.pf-progress .meter > i { background: var(--lime); transition: width .25s; }
.pf-progress b { color: #fff; font-size: 12.5px; min-width: 34px; text-align: right; }
.pf-intro { padding: 12px 18px 0; font-size: 12.5px; color: var(--ink-3); }
.pf-group { padding: 12px 18px 4px; min-width: 0; }
.pf-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.pf-group h4 small { text-transform: none; letter-spacing: 0; font-weight: 450; color: var(--ink-4); }
.pf-group h4 .icon { width: 13px; height: 13px; }
.pf-row2 { display: grid; grid-template-columns: 1fr 1fr; }
.pf-section label input[type=radio], .pf-section label input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.pf-section label { position: relative; cursor: pointer; }
.pf-section label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
/* class cards */
.pf-class { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt-card { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .1s; }
.opt-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.opt-card .pz-medal { width: 38px; height: 38px; font-size: 20px; border-radius: 11px; --pc: #9aa9a2; background: var(--surface-3); color: var(--ink-3); box-shadow: none; }
.opt-card span:last-child { display: grid; min-width: 0; }
.opt-card strong { font-size: 13.5px; color: var(--ink); }
.opt-card small { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.cls-A { --pc: #7b5ad1; } .cls-B { --pc: #4f7fd6; } .cls-C { --pc: #7d8f87; }
.opt-card:has(input:checked) { border-color: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 16%, transparent), 0 8px 18px -10px var(--pc); background: color-mix(in srgb, var(--pc) 6%, var(--surface)); }
.opt-card:has(input:checked) .pz-medal { background: linear-gradient(145deg, color-mix(in srgb, var(--pc) 85%, #fff), var(--pc)); color: #fff; box-shadow: 0 6px 14px -6px var(--pc); }
/* segmented with bars */
.opt-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-3); }
.opt-seg label { display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border-radius: 9px; font-size: 13px; font-weight: 560; color: var(--ink-3); }
.opt-seg label:hover { color: var(--ink); }
.opt-seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.opt-seg .lvl i.on { opacity: .35; }
.opt-seg label:has(input:checked) .lvl i.on { opacity: 1; }
/* clickable journey */
.journey.pick .jn { cursor: pointer; padding-bottom: 2px; }
.journey.pick .jn i { transition: transform .12s; }
.journey.pick .jn:hover i { transform: scale(1.15); border-color: var(--green); }
.journey.pick .jn:has(input:checked) i { background: var(--surface); border: 4px solid var(--green); box-shadow: 0 0 0 4px var(--green-bg); width: 18px; height: 18px; margin-top: -1px; }
.journey.pick .jn:has(input:checked) span { color: var(--green); font-weight: 700; }
.journey.pick .jn:has(~ .jn input:checked) i { background: var(--green); border-color: var(--green); }
.journey.pick .jn:has(~ .jn input:checked) span { color: var(--ink-3); }
.journey.pick .jn:has(~ .jn input:checked):not(:first-child)::before, .journey.pick .jn:has(input:checked):not(:first-child)::before { content: ''; position: absolute; right: 50%; width: 100%; top: 7px; height: 2px; background: var(--green); }
/* style quad */
.pf-style { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: center; }
.quad.pick label { padding: 10px 6px; border-radius: 9px; text-align: center; display: grid; transition: background .12s; }
.quad.pick label:hover { background: var(--surface); }
.quad.pick b { font-size: 12.5px; } .quad.pick small { font-size: 10.5px; }
.quad.pick label:has(input:checked) { background: var(--teal); box-shadow: 0 6px 14px -6px var(--teal); }
.quad.pick label:has(input:checked) b, .quad.pick label:has(input:checked) small { color: #fff; }
.pf-style .style-tip { padding: 12px 14px; border-radius: 12px; background: var(--teal-bg); }
/* chips */
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-chips label { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 540; color: var(--ink-2); transition: all .12s; }
.opt-chips label:hover { border-color: var(--primary); color: var(--ink); }
.opt-chips label .icon { width: 15px; height: 15px; }
.opt-chips label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 14px -8px var(--primary); }
.opt-chips.days label { width: 46px; justify-content: center; padding: 0; }
.pf-num { display: flex; align-items: center; gap: 10px; }
.pf-num > .icon { width: 36px; height: 36px; padding: 9px; border-radius: 10px; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); flex-shrink: 0; }
/* tag input */
.ti-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: text; }
.ti-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.ti-box .chip { padding-right: 4px; }
.ti-box .chip button { width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 1; color: inherit; opacity: .6; }
.ti-box .chip button:hover { opacity: 1; background: rgb(0 0 0 / .08); }
.ti-in { flex: 1; min-width: 140px; border: 0; outline: 0; background: transparent; height: 28px; font-size: 13.5px; }
.ti-sugg { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.ti-s { height: 24px; padding: 0 9px; border-radius: 12px; font-size: 11.5px; color: var(--ink-3); background: var(--surface-3); }
.ti-s:hover { color: var(--primary); background: var(--primary-soft); }
.ti-s.used { display: none; }
/* notes */
.pf-note { margin: 8px 18px 0; display: flex; cursor: text; }
.pf-row2 > .pf-note:first-child { margin-right: 6px; } .pf-row2 > .pf-note:last-child { margin-left: 6px; }
.pf-section > .pf-row2:last-child { padding-bottom: 18px; }
.pf-note > div { flex: 1; min-width: 0; }
.pf-note textarea { width: 100%; border: 0; background: transparent; resize: vertical; outline: 0; font: inherit; font-size: 13.5px; color: var(--ink); line-height: 1.5; padding: 0; min-height: 60px; }
.pf-note textarea::placeholder { color: color-mix(in srgb, var(--ink-3) 80%, transparent); }
@media (max-width: 700px) {
  .pf-row2, .pf-class, .pf-style { grid-template-columns: minmax(0, 1fr); }
  .pf-row2 > .pf-note:first-child, .pf-row2 > .pf-note:last-child { margin: 8px 18px 0; }
  .pf-progress { width: 120px; }
}

/* ---------- Purchases, average cost, VAT ---------- */
.seg label { height: 28px; padding: 0 11px; border-radius: 6px; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; cursor: pointer; font-weight: 560; }
.seg label.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.field .row > .input { min-width: 0; }
.switch-row { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.field .switch-row input[type=checkbox], .switch-row input[type=checkbox] { width: 16px; height: 16px; padding: 0; margin: 0; box-shadow: none; accent-color: var(--primary); }
.line { row-gap: 2px; }
.line.pl { grid-template-columns: minmax(0, 1fr) 76px 100px 70px 100px 30px; }
.line .line-hint { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); padding: 0 2px 6px; min-height: 0; }
.line .line-hint:empty { display: none; }
.line .line-hint b { color: var(--ink); font-weight: 600; }
.line.short select { border-color: var(--red); }
#lines .line, #plines .line { padding-bottom: 4px; border-bottom: 1px dashed var(--line); margin-bottom: 6px; }
.line.r .r-prod { display: grid; min-width: 0; font-size: 13.5px; }
.line.r .r-prod strong { color: var(--ink); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line.r .r-prod .sub { font-size: 12px; color: var(--ink-3); }
.line.r:has(.r-prod) { grid-template-columns: minmax(0, 1fr) 80px 110px 64px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.line input[readonly] { background: var(--surface-2); color: var(--ink-3); }
.warn-t { color: var(--amber); }
.totals-box .est { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.totals-box .est b.pos { color: var(--green); }
.totals-box .warn-line { display: flex; justify-content: flex-start; gap: 6px; align-items: center; color: var(--red); background: var(--red-bg); border-radius: var(--r); padding: 8px 10px; font-size: 13px; }
.totals-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg, 12px); padding: 12px 14px; }
.callout a.link { font-weight: 600; }
option.opt-out { color: #9aa5a0; }
@media (max-width: 640px) {
  .line.pl { grid-template-columns: minmax(0, 1fr) 60px 76px 30px; }
  .line.pl > :nth-child(4), .line.pl .lt, .line.pl.head span:nth-child(4), .line.pl.head span:nth-child(5) { display: none; }
  .line.r:has(.r-prod) { grid-template-columns: minmax(0, 1fr) 64px 84px; }
  .line.r:has(.r-prod) > :last-child { display: none; }
}

/* ---------- Orders vs invoices ---------- */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: grid; gap: 6px; justify-items: start; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); background: var(--surface); color: var(--ink-2); font-size: 13px; line-height: 1.45; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.choice svg { width: 22px; height: 22px; color: var(--primary); }
.choice strong { color: var(--ink); font-size: 15px; font-weight: 620; }
.choice:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); transform: translateY(-1px); }
.choice:disabled { opacity: .55; cursor: progress; }
.approve-dlg .form-error:not(:empty) { margin-top: 12px; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: 1fr; } }

/* ---------- Events & holidays ---------- */
.kpi .value .kpi-sm { font-size: 21px; display: block; line-height: 1.2; }
.cal-card { padding: 0; overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cal-head h2 { margin: 0; font-size: 17px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-cell { min-height: 112px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.we { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal-cell.out { opacity: .45; }
.cal-cell.hol { background: color-mix(in srgb, var(--red-bg) 55%, transparent); }
.cal-top { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.cal-n { font-size: 12.5px; font-weight: 600; color: var(--ink-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-n { background: var(--primary); color: var(--on-primary, #fff); }
.cal-add { opacity: 0; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); transition: opacity .15s; }
.cal-cell:hover .cal-add { opacity: 1; } .cal-add:hover { background: var(--surface-3); color: var(--ink); }
.cal-ev { display: block; font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 560; text-decoration: none; border-left: 3px solid currentColor; }
.cal-ev.cont { opacity: .75; }
.cal-ev b { font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-ev:hover { filter: brightness(.96); }
.cal-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-meta svg { flex-shrink: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid currentColor; }
.ev-month-h { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 18px 2px 8px; }
.ev-list { padding: 0; }
.ev-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto 16px; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.ev-row:last-child { border-bottom: 0; }
.ev-row:hover { background: var(--surface-2); }
.ev-main { display: grid; gap: 2px; min-width: 0; }
.ev-main strong { color: var(--ink); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-main .small { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ev-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); }
.ev-stats b { color: var(--ink); font-size: 14px; margin-right: 3px; }
.avatars { display: flex; } .avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); } .avatars .avatar:first-child { margin-left: 0; }
.ev-date { display: grid; justify-items: center; width: 52px; padding: 6px 0; border-radius: 10px; line-height: 1.1; background: var(--surface-2); border: 1px solid var(--line); }
.ev-date small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; opacity: .8; }
.ev-date b { font-size: 21px; font-weight: 680; font-stretch: 80%; }
.ev-hero { display: flex; gap: 18px; align-items: center; padding: 20px 22px; border-radius: var(--r-lg, 14px); border: 1px solid var(--line); background: var(--surface); margin: 6px 0 16px; position: relative; overflow: hidden; }
.ev-hero::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: currentColor; }
.ev-hero .ev-date { width: 64px; background: var(--surface); color: var(--ink); }
.ev-hero .ev-date b { font-size: 28px; }
.ev-hero .titles { flex: 1; min-width: 0; color: var(--ink); }
.ev-hero h1 { margin: 8px 0 4px; font-size: 26px; font-stretch: 80%; letter-spacing: -.01em; }
.ev-hero p { margin: 0; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.ev-hero .sep { color: var(--ink-3); }
.ev-hero .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-hero.t-red, .ev-hero.t-violet, .ev-hero.t-blue, .ev-hero.t-green, .ev-hero.t-amber, .ev-hero.t-teal, .ev-hero.t-gray { background: var(--surface); }
.ev-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg, 14px); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.ev-kpis div { padding: 14px 18px; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.ev-kpis div:first-child { border-left: 0; }
.ev-kpis span { font-size: 12px; color: var(--ink-3); }
.ev-kpis b { font-size: 24px; font-weight: 640; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.seg.sm button { height: 26px; padding: 0 9px; font-size: 12px; }
.g-status button:disabled { opacity: .4; cursor: not-allowed; }
.g-status .on.s-confirmed { color: var(--green); } .g-status .on.s-attended { color: var(--teal); } .g-status .on.s-declined { color: var(--ink-3); } .g-status .on.s-invited { color: var(--blue); }
.chip-u { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 4px 0; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); font-size: 12px; margin: 0 4px 4px 0; }
.inv-filters { margin-bottom: 10px; }
.inv-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.inv-list { display: grid; gap: 2px; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); cursor: pointer; }
.inv-item:hover { background: var(--surface-2); }
.inv-item.on { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.inv-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.inv-item .trunc { display: grid; }
.inv-item small { color: var(--ink-3); font-size: 12px; }
.field-label { display: block; font-size: 13px; color: var(--ink-2); font-weight: 520; margin-bottom: 6px; }
.ev-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.f-guest { padding: 10px 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.f-guest .meta { display: grid; color: inherit; text-decoration: none; }
.f-guest .meta span { font-size: 12.5px; color: var(--ink-3); }
.f-guest .seg { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .cal-cell { min-height: 74px; padding: 4px; }
  .cal-ev { font-size: 10.5px; padding: 1px 4px; }
  .cal-meta { display: none; }
  .ev-row { grid-template-columns: auto minmax(0, 1fr) 16px; }
  .ev-row .ev-stats, .ev-row .avatars, .ev-row > .muted { display: none; }
  .ev-hero { flex-wrap: wrap; }
}

/* ---------- Leaves ---------- */
.lv-mine { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.lv-bal { padding: 20px; display: grid; gap: 4px; }
.lv-bal .label { font-size: 12.5px; color: var(--ink-3); }
.lv-bal b { font-size: 42px; font-weight: 640; font-stretch: 78%; line-height: 1; }
.lv-bal .btn { margin-top: 12px; justify-self: start; }
.lv-dlg { width: min(560px, calc(100vw - 24px)); }
.lv-balline { font-size: 13px; color: var(--ink-2); padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.lv-balline:empty { display: none; }
.callout.warn { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--ink); }
.callout.warn svg { color: var(--amber); }
.lv-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); margin-bottom: 16px; }
.lv-sum div { display: grid; gap: 3px; } .lv-sum span { font-size: 12px; color: var(--ink-3); } .lv-sum b { font-size: 14px; }
.lv-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 0; }
.lv-steps li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 0 0 14px; position: relative; }
.lv-steps li:not(:last-child)::after { content: ''; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.lv-steps .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 2px; background: var(--surface-3); border: 2px solid var(--line); }
.lv-steps .ok .dot { background: var(--green); border-color: var(--green); }
.lv-steps .no .dot { background: var(--red); border-color: var(--red); }
.lv-steps .wait .dot { background: var(--surface); border-color: var(--amber); }
.lv-steps strong { display: block; font-size: 13.5px; }
.lv-steps span { font-size: 12.5px; color: var(--ink-3); }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) { .lv-mine { grid-template-columns: 1fr; } }
.f-group:has(> .btn, > a) { display: flex; align-items: center; justify-content: space-between; padding-right: 14px; }
.f-group > a.link { font-weight: 600; }
