/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #fbfbf8; --bg-subtle: #f5f4f0; --surface: #ffffff; --surface-2: #f7f6f2; --surface-3: #efeee9; --overlay: rgba(17, 17, 15, .32);
  --border: #e8e7e2; --border-strong: #d8d7d1; --grid-line: rgba(17, 17, 15, .03);
  --text: #11110f; --text-2: #34332f; --muted: #65635d; --faint: #8c8981;
  --accent: #f77337; --accent-hover: #e96329; --accent-soft: rgba(247, 115, 55, .1); --accent-border: rgba(247, 115, 55, .3); --accent-text: #c4511c; --on-accent: #ffffff;
  --purple: #877eed; --purple-soft: rgba(135, 126, 237, .12); --purple-text: #5b52c7;
  --success: #1c9a53; --success-soft: #e7f5ec; --success-text: #157341;
  --warning: #d48a12; --warning-soft: #fcf3e1; --warning-text: #94600b;
  --danger: #d93c3c; --danger-soft: #fcebeb; --danger-text: #b42525;
  --info: #3d73d9; --info-soft: #e9f0fc; --info-text: #2c5bb5;
  --neutral-soft: #f0efea; --neutral-text: #5f5d57;
  --shadow-sm: 0 1px 2px rgba(22, 18, 14, .05);
  --shadow: 0 1px 2px rgba(22, 18, 14, .04), 0 4px 16px rgba(22, 18, 14, .04);
  --shadow-lg: 0 24px 64px rgba(22, 18, 14, .16), 0 2px 8px rgba(22, 18, 14, .06);
  --focus: 0 0 0 3px rgba(247, 115, 55, .22);
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --sidebar: 248px;
  --series-1: #e9632a; --series-2: #877eed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0c; --bg-subtle: #0f0f11; --surface: #141416; --surface-2: #19191c; --surface-3: #222226; --overlay: rgba(0, 0, 0, .6);
    --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14); --grid-line: rgba(255, 255, 255, .025);
    --text: #f4f4f5; --text-2: #d4d4d8; --muted: #9a98a3; --faint: #6b6975;
    --accent-soft: rgba(247, 115, 55, .14); --accent-border: rgba(247, 115, 55, .35); --accent-text: #ff9a6b;
    --purple-soft: rgba(135, 126, 237, .16); --purple-text: #aea7ff;
    --success-soft: rgba(52, 199, 112, .12); --success-text: #5fd890;
    --warning-soft: rgba(240, 170, 50, .13); --warning-text: #f2c063;
    --danger-soft: rgba(240, 80, 80, .13); --danger-text: #ff8f8f;
    --info-soft: rgba(90, 140, 240, .14); --info-text: #8db2ff;
    --neutral-soft: rgba(255, 255, 255, .06); --neutral-text: #b4b2bc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c; --bg-subtle: #0f0f11; --surface: #141416; --surface-2: #19191c; --surface-3: #222226; --overlay: rgba(0, 0, 0, .6);
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14); --grid-line: rgba(255, 255, 255, .025);
  --text: #f4f4f5; --text-2: #d4d4d8; --muted: #9a98a3; --faint: #6b6975;
  --accent-soft: rgba(247, 115, 55, .14); --accent-border: rgba(247, 115, 55, .35); --accent-text: #ff9a6b;
  --purple-soft: rgba(135, 126, 237, .16); --purple-text: #aea7ff;
  --success-soft: rgba(52, 199, 112, .12); --success-text: #5fd890;
  --warning-soft: rgba(240, 170, 50, .13); --warning-text: #f2c063;
  --danger-soft: rgba(240, 80, 80, .13); --danger-text: #ff8f8f;
  --info-soft: rgba(90, 140, 240, .14); --info-text: #8db2ff;
  --neutral-soft: rgba(255, 255, 255, .06); --neutral-text: #b4b2bc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 26px; font-weight: 750; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.icon { flex: 0 0 auto; display: block; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--faint); font: 600 11px/1 inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--accent-soft); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; font-weight: 650; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .seg button:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(196, 81, 28, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:not(:disabled):hover { border-color: var(--faint); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:not(:disabled):hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger-text); }
.btn-danger-ghost:not(:disabled):hover { background: var(--danger-soft); }
.btn-success { background: var(--success-soft); color: var(--success-text); cursor: default; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { min-height: 42px; padding: 0 18px; font-size: 14px; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; border-color: var(--on-accent) var(--on-accent) transparent transparent; animation: spin .7s linear infinite; }
.btn-secondary.loading::after, .btn-ghost.loading::after { border-color: var(--muted) var(--muted) transparent transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--faint); transition: background .15s, color .15s; }
.icon-btn:not(:disabled):hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:not(:disabled):hover { background: var(--danger-soft); color: var(--danger-text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { display: flex; align-items: baseline; gap: 4px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.field-label small { margin-left: auto; padding-left: 8px; }
.field > .seg { align-self: flex-start; }
.req { color: var(--accent); }
.field-label small, .field-hint { color: var(--faint); font-size: 12px; font-weight: 450; }
.field-error { display: none; color: var(--danger-text); font-size: 12px; font-weight: 500; }
.field.has-error .field-error { display: block; }
.field.has-error .input, .field.has-error .tags { border-color: var(--danger); }
.input, .select, textarea.input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { resize: vertical; line-height: 1.55; padding: 10px 12px; }
.input::placeholder, .tag-input::placeholder { color: var(--faint); }
.input:focus, .select:focus, .tags:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c8981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-all { grid-column: 1 / -1; }

.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: text; transition: border-color .15s, box-shadow .15s; }
.tags.readonly { cursor: default; background: var(--surface-2); }
.tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 26px; padding: 0 4px 0 9px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.tags.readonly .tag { padding-right: 9px; }
.tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--faint); }
.tag button:hover { background: var(--border-strong); color: var(--text); }
.tag-input { flex: 1; min-width: 110px; height: 26px; padding: 0 4px; border: 0; outline: none; background: transparent; font-size: 13px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; flex: 0 0 auto; width: 34px; height: 20px; margin-top: 1px; border-radius: 99px; background: var(--border-strong); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:disabled + .switch-track { opacity: .5; }
.switch strong { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); }
.switch small { display: block; color: var(--faint); font-size: 12px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-3); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .count { color: var(--faint); font-weight: 500; }
.toolbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 4px; border-radius: 10px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.dropzone strong { color: var(--text-2); font-size: 13px; }
.dropzone small { font-size: 12px; color: var(--faint); }
.dropzone input { display: none; }
.file-list { display: grid; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-item > .icon { color: var(--faint); }
.file-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.file-item small { color: var(--faint); font-size: 12px; }

/* ---------- Badges & dots ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-text); }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-purple { background: var(--purple-soft); color: var(--purple-text); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--faint); }
.dot-success { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot-warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot-accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot-neutral { background: var(--border-strong); }
.dot-info { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.dot.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.avatar.lg { width: 44px; height: 44px; border-radius: 11px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }
.avatar-0 { background: var(--accent-soft); color: var(--accent-text); }
.avatar-1 { background: var(--purple-soft); color: var(--purple-text); }
.avatar-2 { background: var(--success-soft); color: var(--success-text); }
.avatar-3 { background: var(--info-soft); color: var(--info-text); }
.avatar-4 { background: var(--warning-soft); color: var(--warning-text); }
.avatar-5 { background: var(--surface-3); color: var(--text-2); }

/* ---------- Cards & layout primitives ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.card-head + .card-body { padding-top: 0; }
.card-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.card-title p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.card-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text-2); }
.card-icon.accent { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.card-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.card-body { padding: 18px 20px 20px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-foot .hint { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.card-foot .group { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.callout > .icon { color: var(--muted); }
.callout p { flex: 1; }
.callout strong { color: var(--text); }
.callout-warning { border-color: color-mix(in srgb, var(--warning) 30%, transparent); background: var(--warning-soft); }
.callout-warning > .icon { color: var(--warning-text); }
.callout-danger { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); }
.callout-danger > .icon { color: var(--danger-text); }
.callout-info { border-color: color-mix(in srgb, var(--info) 25%, transparent); background: var(--info-soft); }
.callout-info > .icon { color: var(--info-text); }
.callout-accent { border-color: var(--accent-border); background: var(--accent-soft); }
.callout-accent > .icon { color: var(--accent-text); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.empty-icon.accent { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.empty h3 { font-size: 15px; }
.empty p { max-width: 420px; color: var(--muted); font-size: 13px; }
.empty .btn { margin-top: 12px; }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; height: 100vh; padding: 14px 12px; border-right: 1px solid var(--border); background: var(--bg-subtle); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; text-decoration: none; }
.brand strong { display: block; font-size: 15px; font-weight: 750; letter-spacing: -.01em; }
.brand small { display: block; margin-top: -1px; color: var(--faint); font-size: 11.5px; font-weight: 550; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; margin-bottom: 10px; padding: 0 6px 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--faint); font-size: 13px; text-align: left; box-shadow: var(--shadow-sm); }
.search-trigger span { flex: 1; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius); color: var(--muted); font-size: 13.5px; font-weight: 550; text-decoration: none; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-item .count { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 500; }
.nav-item .count.alert { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.nav-section { margin: 18px 0 4px; padding: 0 10px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.nav-client { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 10px; border-radius: var(--radius); color: var(--muted); font-size: 13px; text-decoration: none; }
.nav-client span:not(.dot) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-client:hover { background: var(--surface-3); color: var(--text); }
.nav-client.active { color: var(--text); font-weight: 600; background: var(--surface-3); }
.sidebar-foot { display: grid; gap: 8px; margin-top: auto; padding-top: 12px; }
.mode-pill { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 12px; }
.mode-pill strong { display: block; font-size: 12.5px; font-weight: 650; }
.mode-pill small { display: block; color: var(--faint); font-size: 11.5px; line-height: 1.35; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 2px; }
.foot-row .who { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.main { min-width: 0; background-color: var(--bg); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 56px 56px; background-attachment: fixed; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 40px 96px; }
.mobile-bar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; text-align: left; }
button.stat { border: 1px solid var(--border); cursor: pointer; transition: border-color .15s; }
button.stat:hover { border-color: var(--border-strong); }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-label .icon { color: var(--faint); }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value small { color: var(--faint); font-size: 15px; font-weight: 600; }
.stat-detail { color: var(--faint); font-size: 12px; }
.stat.attention .stat-value { color: var(--accent-text); }
button.stat.active { border-color: var(--accent); box-shadow: var(--focus); }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input-icon { width: 300px; max-width: 100%; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--faint); font-size: 11.5px; font-weight: 600; text-align: left; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background .12s; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr.clickable:hover .row-chevron { color: var(--text); transform: translateX(2px); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-main strong { display: block; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-main small, .cell-sub { display: block; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chevron { color: var(--faint); transition: transform .15s, color .15s; }
.next-step { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.pager .group { display: flex; gap: 6px; }

/* ---------- Workspace header & tabs ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--faint); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.ws-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ws-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-meta { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: 13px; }
.ws-meta span, .ws-meta a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.ws-meta a:hover { color: var(--text); }
.ws-meta .icon { color: var(--faint); }
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .filter-tabs::-webkit-scrollbar, .campaign-switch::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab .count { padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tab:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Operations ---------- */
.campaign-switch { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.campaign-chip { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-sm); }
.campaign-chip:hover { border-color: var(--border-strong); color: var(--text); }
.campaign-chip.active { border-color: var(--accent); color: var(--text); box-shadow: var(--focus); }
.campaign-chip small { color: var(--faint); font-weight: 500; }

.campaign-hero { margin-bottom: 16px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 18px; }
.hero-top h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 19px; }
.hero-target { max-width: 720px; margin-top: 6px; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.hero-cta small { color: var(--faint); font-size: 12px; text-align: right; max-width: 260px; }

.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.stage { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 16px 18px 18px; border: 0; border-right: 1px solid var(--border); background: none; text-align: left; }
.stage:last-child { border-right: 0; }
button.stage { cursor: pointer; transition: background .15s; }
button.stage:hover { background: var(--surface-2); }
.stage-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stage-num { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; border: 1.5px solid var(--border-strong); border-radius: 50%; color: var(--faint); font-size: 10.5px; font-weight: 700; }
.stage.done .stage-num { border-color: var(--success); background: var(--success); color: #fff; }
.stage.current .stage-num { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.stage.warning .stage-num { border-color: var(--warning); background: var(--warning); color: #fff; }
.stage.error .stage-num { border-color: var(--danger); background: var(--danger); color: #fff; }
.stage-label { color: var(--muted); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-value { color: var(--text); font-size: 18px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage.idle .stage-value { color: var(--faint); }
.stage-detail { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage::after { content: ""; position: absolute; top: 25px; right: -5px; z-index: 1; width: 8px; height: 8px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--surface); transform: rotate(45deg); }
.stage:last-child::after { display: none; }
button.stage:hover::after { background: var(--surface-2); }

.ops-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.ops-main, .ops-side { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 1360px) { .ops-grid { grid-template-columns: minmax(0, 1fr) 320px; } .ops-side { position: sticky; top: 24px; } }

.core-target { margin-bottom: 16px; }
.core-target .field-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }

.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.step { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.step:hover { border-color: var(--border-strong); }
.step.open { border-color: var(--border-strong); box-shadow: var(--shadow); }
.step-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 700; }
.step.locked .step-num { background: var(--success-soft); color: var(--success-text); }
.step-main { min-width: 0; }
.step-name { width: 100%; height: 28px; margin-left: -6px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font-size: 13.5px; font-weight: 650; outline: none; }
.step-name:not(:disabled):hover { border-color: var(--border); }
.step-name:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.step-name:disabled { color: var(--text); }
.step-summary { margin-top: 1px; overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.step-meta { display: flex; align-items: center; gap: 8px; }
.estimate { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.estimate .icon { color: var(--faint); }
.estimate.missing { color: var(--warning-text); }
.estimate.missing .icon { color: currentColor; }
.estimate.too-broad { color: var(--danger-text); }
.estimate.too-broad .icon { color: currentColor; }
.step-tools { display: flex; align-items: center; gap: 2px; }
.step-tools .divider { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.step-toggle .icon { transition: transform .2s; }
.step.open .step-toggle .icon { transform: rotate(180deg); }
.step-detail { display: none; padding: 4px 16px 16px 50px; }
.step.open .step-detail { display: grid; gap: 14px; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.filters .field-label { font-size: 12px; }
.plan-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 42px; margin-top: 8px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.plan-add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.prompt-tabs { margin-bottom: 12px; }
.prompt-editor textarea { min-height: 300px; font-size: 13.5px; line-height: 1.65; }
.prompt-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--faint); font-size: 12px; }

.kv { display: grid; gap: 0; margin: 0; }
.kv > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv > div:first-child { padding-top: 0; }
.kv dt { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.kv dt .icon { color: var(--faint); }
.kv dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; }
.kv dd small { display: block; color: var(--faint); font-weight: 450; font-size: 12px; }

.feed { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed li:first-child { padding-top: 0; }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.feed-icon.danger { background: var(--danger-soft); color: var(--danger-text); }
.feed-icon.success { background: var(--success-soft); color: var(--success-text); }
.feed strong { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.feed p { color: var(--muted); font-size: 12.5px; word-break: break-word; }
.feed small { color: var(--faint); font-size: 11.5px; }
.feed .btn { margin-top: 6px; }

.generating { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--accent-border); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 550; }
.generating .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- Contacts ---------- */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 12px; padding: 3px; overflow-x: auto; scrollbar-width: none; border-radius: 10px; background: var(--surface-3); width: fit-content; max-width: 100%; }
.filter-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.filter-tabs button:hover { color: var(--text); }
.filter-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.filter-tabs .count { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.filter-tabs button.has-errors .count { color: var(--danger-text); font-weight: 700; }
.review-cell strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.review-cell small { display: block; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.review-cell.live strong { color: var(--warning-text); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--overlay); animation: fade .2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; display: flex; flex-direction: column; width: min(680px, 100vw); border-left: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); animation: slide-in .25s cubic-bezier(.2, .8, .2, 1); }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 17px; }
.drawer-head p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.drawer-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 18px; align-content: start; }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.section-label { margin-bottom: 8px; color: var(--faint); font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.detail-grid dt { color: var(--faint); font-size: 12px; }
.detail-grid dd { margin: 2px 0 0; color: var(--text); font-size: 13px; font-weight: 550; word-break: break-word; }
.email-preview { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.email-preview + .email-preview { margin-top: 10px; }
.email-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.email-subject { padding: 12px 14px 0; color: var(--text); font-size: 14px; font-weight: 650; }
.email-body { padding: 12px 16px 16px; color: var(--text-2); font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.email-edit { display: grid; gap: 12px; }
.error-box { padding: 10px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger-text); font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-word; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Settings & wizard ---------- */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: grid; gap: 2px; }
.settings-nav button { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); font-size: 13px; font-weight: 550; text-align: left; white-space: nowrap; }
.settings-nav button:hover { background: var(--surface-3); color: var(--text); }
.settings-nav button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.settings-nav button .icon { color: var(--faint); }
.settings-sections { display: grid; gap: 16px; min-width: 0; }
.form-section { scroll-margin-top: 24px; }
.form-section .card-body { display: grid; gap: 16px; }
.campaign-form { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); display: grid; gap: 14px; }
.campaign-form-head { display: flex; align-items: center; gap: 10px; }
.campaign-form-head .num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.campaign-form-head strong { font-size: 13.5px; }
.campaign-form .tags, .campaign-form .input { background: var(--surface); }
.helper-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.ai-missing { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
[data-ai-loading] [data-campaign-forms] { opacity: .45; pointer-events: none; transition: opacity .2s; }
.campaign-form-head strong { margin-right: auto; }
.target-view h4 { font-size: 15px; font-weight: 650; }
.target-view > p { margin-top: 4px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.target-meta { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: baseline; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.target-meta .chip-row { margin-top: 0; }
.target-meta p { color: var(--text-2); font-size: 13px; }
.target-fields { display: grid; gap: 14px; }
.callout .btn { flex: 0 0 auto; }
.helper-row .icon { color: var(--faint); }

.savebar { position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding: 10px 10px 10px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); animation: rise .2s ease; }
.savebar p { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.savebar .group { display: flex; gap: 8px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.wizard { max-width: 760px; margin: 0 auto; }
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
.stepper-item { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 0; border: 0; background: none; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.stepper-item:disabled { cursor: default; }
.stepper-item .n { display: grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); font-size: 11px; font-weight: 700; }
.stepper-item.active { color: var(--text); }
.stepper-item.active .n { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.stepper-item.done { color: var(--text-2); }
.stepper-item.done .n { border-color: var(--success); background: var(--success); color: #fff; }
.stepper-line { flex: 1; min-width: 16px; height: 1.5px; margin: 0 10px; background: var(--border); }
.stepper-line.done { background: var(--success); }
.wizard-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.summary-list { display: grid; gap: 0; margin: 0; }
.summary-list > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; color: var(--text); font-weight: 550; word-break: break-word; }
.summary-list dd p { color: var(--muted); font-weight: 450; margin-top: 2px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip-row .tag { height: 22px; padding: 0 8px; font-size: 12px; }

/* ---------- Overlays ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--text); color: var(--bg); font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); animation: rise .2s ease; pointer-events: auto; }
.toast-success .icon { color: #5fd890; }
.toast-error .icon { color: #ff8f8f; }
.toast-info .icon { color: #8db2ff; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }
.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: var(--overlay); animation: fade .15s ease; }
.modal { width: min(420px, 100%); padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg); animation: rise .2s ease; }
.modal-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 11px; background: var(--info-soft); color: var(--info-text); }
.modal-icon.danger { background: var(--danger-soft); color: var(--danger-text); }
.modal h2 { font-size: 17px; }
.modal p { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.palette-backdrop { place-items: start center; padding-top: 12vh; }
.palette { width: min(560px, 100%); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg); animation: rise .15s ease; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--faint); }
.palette-input input { flex: 1; height: 52px; border: 0; outline: none; background: none; font-size: 15px; }
.palette-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius); background: none; text-align: left; font-size: 13.5px; }
.palette-item small { margin-left: auto; color: var(--faint); font-size: 12px; }
.palette-item.active { background: var(--surface-3); }
.palette-empty { padding: 24px; color: var(--faint); text-align: center; font-size: 13px; }

/* ---------- Client dashboard ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; padding: 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); }
.topbar .brand { padding: 0; }
.topbar .sep { width: 1px; height: 20px; background: var(--border-strong); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-client { overflow: hidden; color: var(--text-2); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.review-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 560px; overflow: hidden; }
.review-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: calc(100vh - 300px); min-height: 560px; }
.review-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; transition: background .12s; }
.review-item:hover { background: var(--surface-2); }
.review-item.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.review-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.review-item strong { overflow: hidden; color: var(--text); font-size: 13.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.review-item .when { flex: 0 0 auto; color: var(--faint); font-size: 11.5px; font-weight: 600; }
.review-item .when.urgent { color: var(--warning-text); }
.review-item .company { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-item .subject { margin-top: 4px; color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-detail { display: flex; flex-direction: column; min-width: 0; }
.review-detail-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.review-detail-head > div { flex: 1; min-width: 0; }
.review-detail-body { flex: 1; display: grid; gap: 16px; align-content: start; padding: 20px 24px; }
.review-detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Login ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-form-side { display: flex; flex-direction: column; justify-content: space-between; padding: 28px 32px; background-color: var(--bg); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 56px 56px; }
.auth-card { width: min(380px, 100%); margin: 0 auto; }
.auth-card h1 { margin-bottom: 6px; font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
.auth-card > p { margin-bottom: 28px; color: var(--muted); }
.auth-card form { display: grid; gap: 16px; }
.auth-card .btn { width: 100%; margin-top: 4px; }
.auth-foot { color: var(--faint); font-size: 12px; text-align: center; }
.auth-visual { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 56px; overflow: hidden; background: #0b0b0c; color: #fff; }
.auth-visual::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(247, 115, 55, .28), transparent 65%); }
.auth-visual h2 { position: relative; max-width: 460px; color: #fff; font-size: 36px; font-weight: 800; line-height: 1.08; letter-spacing: -.03em; }
.auth-visual p { position: relative; max-width: 420px; color: #9a98a3; font-size: 15px; }
.auth-flow { position: relative; display: grid; gap: 8px; max-width: 420px; }
.auth-flow div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; background: rgba(255, 255, 255, .04); color: #d4d4d8; font-size: 13.5px; font-weight: 550; }
.auth-flow b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: rgba(247, 115, 55, .15); color: #ff9a6b; font-size: 11px; }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger-text); font-size: 13px; font-weight: 550; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage:nth-child(3) { border-right: 0; }
  .stage:nth-child(n + 4) { border-top: 1px solid var(--border); }
  .stage:nth-child(3)::after { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .review-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 45; background: var(--overlay); }
  .mobile-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
  .mobile-bar .brand { padding: 0; }
  .page { padding: 20px 16px 80px; }
  .page-head, .ws-head, .hero-top { flex-direction: column; align-items: stretch; }
  .hero-cta { align-items: stretch; }
  .hero-cta small { text-align: left; max-width: none; }
  .grid-2, .grid-3, .filters, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { border-right: 0 !important; border-top: 1px solid var(--border); }
  .stage:nth-child(odd) { border-right: 1px solid var(--border) !important; }
  .stage:nth-child(-n + 2) { border-top: 0; }
  .stage::after { display: none; }
  .step-row { grid-template-columns: 24px minmax(0, 1fr); }
  .step-meta, .step-tools { grid-column: 2; }
  .step-detail { padding-left: 16px; }
  .summary-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hide-sm { display: none !important; }
  .toolbar .input-icon { width: 100%; }
  .review-layout { grid-template-columns: minmax(0, 1fr); }
  .review-list { max-height: 360px; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .topbar { padding: 0 16px; }
  .stepper-item .label { display: none; }
  .stepper-item.active .label { display: inline; }
}
@media (max-width: 560px) {
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .stat-detail { display: none; }
  .savebar { flex-direction: column; align-items: stretch; }
  .savebar .group .btn { flex: 1; }
  .drawer-foot, .review-detail-foot { flex-direction: column-reverse; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Client dashboard: navigation & charts ---------- */
.topnav { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.topnav button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.topnav button:hover { color: var(--text); }
.topnav button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chart-grid-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.chart-card { padding: 20px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.chart-head p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-bar { outline: none; cursor: default; transition: opacity .12s; }
.chart-bar.dim { opacity: .45; }
.chart-bar:focus-visible rect { stroke: var(--accent); stroke-width: 1.5; }
.chart-tip { position: absolute; z-index: 2; min-width: 120px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); font-size: 12.5px; pointer-events: none; }
.chart-tip-title { margin-bottom: 4px; color: var(--muted); font-size: 11.5px; }
.chart-tip div:not(.chart-tip-title) { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; }
.chart-tip strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-table { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.chart-table summary { color: var(--muted); font-size: 12.5px; font-weight: 550; cursor: pointer; }
.chart-table table { margin-top: 8px; }
.chart-table .table th { background: none; }
.barlist { display: grid; gap: 12px; }
.barlist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.barlist-label { overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.barlist-value { color: var(--text); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.barlist-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-3); }
.barlist-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); }
@media (max-width: 1000px) { .chart-grid-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; } .topnav { order: 3; width: 100%; } .topnav button { flex: 1; justify-content: center; } }

/* ---------- Replies & leads ---------- */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.new-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.reply-cell { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 520px; }
.reply-cell .badge { flex: none; }
.reply-cell > span:last-child { overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
tr.is-new .reply-cell > span:last-child { color: var(--text); font-weight: 500; }
@media (max-width: 700px) { .reply-cell { flex-direction: column; align-items: flex-start; gap: 4px; max-width: 220px; } }
@media (max-width: 700px) { .callout { flex-wrap: wrap; } .callout > p { flex: 1 1 200px; } .callout > .btn { margin-left: 28px; } }

/* ---------- Contact drawer: conversation ---------- */
.drawer-body { gap: 22px; padding: 22px 24px 28px; }
.drawer-body > * { min-width: 0; }
.drawer-head { padding: 22px 24px 18px; }
.email-preview { min-width: 0; background: var(--surface); }
.email-head { padding: 10px 16px; }
.email-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-subject { padding: 14px 16px 0; overflow-wrap: anywhere; }
.email-preview.is-reply { border-color: var(--accent-border); box-shadow: inset 3px 0 0 var(--accent); }
.email-preview.is-reply .email-head { background: var(--accent-soft); color: var(--text-2); }
.email-head .select { width: auto; height: 28px; padding: 0 28px 0 10px; font-size: 12px; }
details.quoted { border-top: 1px dashed var(--border); }
details.quoted > summary, details.sent-email > summary { cursor: pointer; padding: 10px 16px; color: var(--muted); font-size: 12.5px; font-weight: 600; list-style: none; }
details.quoted > summary::-webkit-details-marker, details.sent-email > summary::-webkit-details-marker { display: none; }
details.quoted > summary:hover, details.sent-email > summary:hover { color: var(--text); }
details.quoted[open] > summary { border-bottom: 1px dashed var(--border); }
details.quoted .email-body { color: var(--muted); font-size: 13px; }
details.sent-email { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
details.sent-email > summary { display: flex; align-items: center; gap: 10px; background: var(--surface-2); color: var(--text-2); }
details.sent-email > summary strong { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
details.sent-email > summary .icon:last-child { transition: transform .15s ease; }
details.sent-email[open] > summary { border-bottom: 1px solid var(--border); }
details.sent-email[open] > summary .icon:last-child { transform: rotate(90deg); }
details.sent-email .email-preview { border: 0; border-radius: 0; }
details.sent-email .email-preview + .email-preview { margin-top: 0; border-top: 1px solid var(--border); }

.range-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.range-note .icon { flex: none; color: var(--faint); }
