@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════
   CRM & Client Dashboard — HTML/CSS Kit v1.0.0 — Relay CRM design system
   © 2026 Ashlar Studio · https://ohgotit.com/creator/ashlar-studio
   Support: seller-ashlar@ohgotit.com
   ═══════════════════════════════════════ */

/* ── Tokens (dark theme is the default) ── */
:root {
  color-scheme: dark;
  --primary: #6366f1;
  --primary-strong: #4f46e5;
  --primary-text: #a5b4fc;
  --primary-muted: rgba(99, 102, 241, 0.14);
  --primary-glow: rgba(99, 102, 241, 0.3);
  --success: #34d399;
  --success-muted: rgba(16, 185, 129, 0.14);
  --warning: #fbbf24;
  --warning-muted: rgba(245, 158, 11, 0.14);
  --danger: #f87171;
  --danger-muted: rgba(239, 68, 68, 0.14);
  --info: #60a5fa;
  --info-muted: rgba(59, 130, 246, 0.14);

  --bg-body: #0b0f1a;
  --bg-surface: #111827;
  --bg-card: #161f31;
  --bg-elevated: #1e293b;
  --bg-input: #0f172a;
  --bg-hover: rgba(99, 102, 241, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #a3b0c2;
  --text-muted: #8392a7;
  --text-inverse: #0f172a;

  --border: #1f2a3d;
  --border-hover: #334155;

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --primary-text: #4338ca;
  --primary-muted: rgba(79, 70, 229, 0.1);
  --primary-glow: rgba(79, 70, 229, 0.22);
  --success: #047857;
  --success-muted: rgba(4, 120, 87, 0.1);
  --warning: #a14a04;
  --warning-muted: rgba(217, 119, 6, 0.12);
  --danger: #c81e1e;
  --danger-muted: rgba(200, 30, 30, 0.08);
  --info: #1d5fd1;
  --info-muted: rgba(29, 95, 209, 0.1);

  --bg-body: #f5f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #eef0f5;
  --bg-input: #ffffff;
  --bg-hover: rgba(79, 70, 229, 0.05);

  --text-primary: #111827;
  --text-secondary: #475569;
  --text-muted: #5f6b7d;
  --text-inverse: #ffffff;

  --border: #e3e7ee;
  --border-hover: #cbd2dd;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

/* ── Accessibility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--primary-strong); color: #fff; font-weight: 600;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.75rem; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; }
.form-input:focus-visible, .topbar__search input:focus-visible { outline: none; }
main:focus { outline: none; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
[data-theme="dark"] .icon--moon, [data-theme="light"] .icon--sun { display: none; }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: transform var(--duration-normal) var(--ease);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  color: var(--text-primary); font-weight: 700; font-size: 1.05rem;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-strong), #8b5cf6);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.sidebar__logo .icon { width: 18px; height: 18px; }
.sidebar__nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.sidebar__section { margin-bottom: 1.5rem; }
.sidebar__label {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); padding: 0 0.75rem; margin-bottom: 0.5rem;
}
.sidebar__link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}
.sidebar__link:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
.sidebar__link[aria-current="page"] { color: var(--primary-text); background: var(--primary-muted); font-weight: 600; }
.sidebar__badge {
  margin-left: auto; font-size: 0.7rem; font-weight: 600;
  padding: 0.1rem 0.5rem; border-radius: var(--radius-full);
  background: var(--primary-muted); color: var(--primary-text);
}
.sidebar__footer {
  padding: 0.75rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.25rem;
}
.sidebar__user {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem; border-radius: var(--radius-sm); color: inherit;
}
.sidebar__user:hover { background: var(--bg-hover); text-decoration: none; }
.sidebar__user-name { display: block; font-size: 0.85rem; font-weight: 600; }
.sidebar__user-role { display: block; font-size: 0.72rem; color: var(--text-muted); }
.sidebar__signout {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--text-muted);
}
.sidebar__signout:hover { background: var(--bg-hover); color: var(--danger); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.5); }

.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.78rem; color: #fff;
  background: linear-gradient(135deg, #6366f1, #ec4899);
}
.avatar--sm { width: 28px; height: 28px; font-size: 0.68rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar--c1 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.avatar--c2 { background: linear-gradient(135deg, #10b981, #3b82f6); }
.avatar--c3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar--c4 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.avatar--c5 { background: linear-gradient(135deg, #14b8a6, #84cc16); }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; min-height: 100vh; }

/* ── Top bar ── */
.topbar {
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 2rem; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); position: sticky; top: 0; z-index: 30;
}
.topbar__left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar__title { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar__search {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.875rem; min-width: 240px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.topbar__search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.topbar__search input { background: transparent; border: none; outline: none; font-size: 0.85rem; width: 100%; color: var(--text-primary); }
.topbar__search input::placeholder { color: var(--text-muted); }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.icon-btn__dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-surface); }
.menu-btn { display: none; border: none; }

/* ── Page ── */
.page { padding: 2rem; max-width: 1400px; }
.page__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page__title { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.page__subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }
.page__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.breadcrumb { display: flex; gap: 0.5rem; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.breadcrumb a { color: var(--text-secondary); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem; font-size: 0.85rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease); white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--primary-strong); color: #fff; }
.btn--primary:hover { background: #4338ca; box-shadow: 0 4px 14px var(--primary-glow); }
.btn--outline { background: transparent; border-color: var(--border-hover); color: var(--text-secondary); }
.btn--outline:hover { border-color: var(--primary); color: var(--text-primary); }
.btn--danger { background: var(--danger-muted); color: var(--danger); }
.btn--ghost { background: none; color: var(--primary-text); padding-inline: 0.5rem; }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn--block { width: 100%; }

/* ── Cards ── */
.card, .data-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.card { padding: 1.25rem; }
.data-card { overflow: hidden; }
.card__header, .data-card__header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.card__header { margin-bottom: 1rem; }
.data-card__header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__title, .data-card__title { font-size: 1rem; font-weight: 600; }
.card__subtitle { font-size: 0.8rem; color: var(--text-muted); }
.stack > * + * { margin-top: 1.25rem; }

/* ── KPI cards ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; transition: border-color var(--duration-fast) var(--ease);
}
.kpi-card:hover { border-color: var(--border-hover); }
.kpi-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.kpi-card__icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.kpi-card__icon--primary { background: var(--primary-muted); color: var(--primary-text); }
.kpi-card__icon--success { background: var(--success-muted); color: var(--success); }
.kpi-card__icon--warning { background: var(--warning-muted); color: var(--warning); }
.kpi-card__icon--info { background: var(--info-muted); color: var(--info); }
.kpi-card__trend { font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: var(--radius-full); }
.kpi-card__trend--up { background: var(--success-muted); color: var(--success); }
.kpi-card__trend--down { background: var(--danger-muted); color: var(--danger); }
.kpi-card__value { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.kpi-card__label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Tables ── */
.table-scroll { position: relative; overflow-x: auto; }
.data-table th {
  padding: 0.7rem 1.25rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); text-align: left; background: var(--bg-hover); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 0.75rem 1.25rem; font-size: 0.875rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td, .data-table tr.is-selected td { background: var(--bg-hover); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; color: var(--text-primary); }
.cell-money { font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 0.75rem; }
.person__name { display: block; font-weight: 600; color: var(--text-primary); }
a.person__name:hover { color: var(--primary-text); }
.person__meta { display: block; font-size: 0.78rem; color: var(--text-muted); }
.check { width: 16px; height: 16px; accent-color: var(--primary-strong); cursor: pointer; }
.row-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; border-color: transparent; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-muted); }

/* ── Status badges ── */
.status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: var(--radius-full); white-space: nowrap; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--active, .status--won { background: var(--success-muted); color: var(--success); }
.status--inactive { background: var(--bg-elevated); color: var(--text-muted); }
.status--pending, .status--proposal { background: var(--warning-muted); color: var(--warning); }
.status--lost { background: var(--danger-muted); color: var(--danger); }
.status--lead { background: var(--info-muted); color: var(--info); }
.status--qualified, .status--negotiation { background: var(--primary-muted); color: var(--primary-text); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 500; padding: 0.1rem 0.5rem; border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text-secondary); }

/* ── Toolbar & filters ── */
.toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar__search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.toolbar__search .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.toolbar__search .form-input { padding-left: 2.25rem; }
.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; gap: 2px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.segmented__btn { flex-shrink: 0; }
.segmented__btn { border: none; background: none; padding: 0.35rem 0.8rem; border-radius: 4px; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); }
.segmented__btn:hover { color: var(--text-primary); }
.segmented__btn[aria-pressed="true"] { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.bulk-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.6rem 1.25rem; background: var(--primary-muted); border-bottom: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--primary-text);
}
.bulk-bar__actions { display: flex; gap: 0.5rem; margin-left: auto; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: 0.7rem 1rem; border: none; background: none; white-space: nowrap;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--primary-text); border-bottom-color: var(--primary); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-input {
  width: 100%; padding: 0.6rem 0.875rem;
  background: var(--bg-input); border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.875rem; outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
select.form-input { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238392a7' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; cursor: pointer; }
.form-input--auto { width: auto; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }
.form-status { font-size: 0.85rem; color: var(--success); margin-right: auto; }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form .form-input { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--border); }
.card__header + .switch-row { border-top: none; padding-top: 0; }
.switch-row__label { font-size: 0.875rem; font-weight: 500; }
.switch-row__desc { font-size: 0.78rem; color: var(--text-muted); }
.toggle {
  position: relative; flex-shrink: 0; width: 42px; height: 24px; padding: 0; border: none;
  border-radius: var(--radius-full); background: var(--border-hover);
  transition: background var(--duration-fast) var(--ease);
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform var(--duration-fast) var(--ease);
}
.toggle[aria-checked="true"] { background: var(--primary-strong); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 1.25rem; align-items: start; }
.grid-2 > *, .grid-3 > *, .grid-2-1 > *, .grid-1-2 > * { min-width: 0; }
.mb { margin-bottom: 1.25rem; }

/* ── Bar chart ── */
.bar-chart { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; padding: 1.25rem 1.25rem 2.5rem; }
.bar-chart__axis { display: flex; flex-direction: column; justify-content: space-between; height: calc(220px + 0.7rem); margin-top: -0.35rem; font-size: 0.7rem; line-height: 0.7rem; color: var(--text-muted); text-align: right; }
.bar-chart__plot { display: flex; align-items: flex-end; gap: 0.5rem; height: 220px; border-bottom: 1px solid var(--border-hover); background: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px calc(100% / 3)); }
.bar-chart__col { flex: 1; position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.bar-chart__bar { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); }
.bar-chart__bar--muted { background: var(--primary-muted); border: 1px dashed var(--primary); border-bottom: none; }
.bar-chart__label { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.45rem; text-align: center; font-size: 0.7rem; color: var(--text-muted); }
.legend { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-secondary); }
.legend__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; background: var(--primary); }
.legend__swatch--muted { background: var(--primary-muted); }

/* ── Horizontal bars / progress ── */
.hbar { margin-bottom: 0.9rem; }
.hbar:last-child { margin-bottom: 0; }
.hbar__head { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 0.3rem; }
.hbar__label { color: var(--text-secondary); }
.hbar__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar__track { height: 8px; border-radius: var(--radius-full); background: var(--bg-elevated); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: inherit; background: var(--primary); }
.hbar__fill--success { background: var(--success); }
.hbar__fill--warning { background: var(--warning); }
.hbar__fill--info { background: var(--info); }

/* ── Funnel ── */
.funnel__row { display: grid; grid-template-columns: 110px 1fr 70px; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; font-size: 0.82rem; }
.funnel__bar { height: 28px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--primary-strong), #8b5cf6); }
.funnel__label { color: var(--text-secondary); }
.funnel__value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Activity feed / timeline ── */
.activity-feed { padding: 0.5rem 1.25rem 1rem; }
.activity-item { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-item__icon { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.activity-item__icon .icon { width: 14px; height: 14px; }
.activity-item__icon--call { background: var(--primary-muted); color: var(--primary-text); }
.activity-item__icon--email { background: var(--success-muted); color: var(--success); }
.activity-item__icon--deal { background: var(--warning-muted); color: var(--warning); }
.activity-item__icon--note { background: var(--bg-elevated); color: var(--text-secondary); }
.activity-item__icon--meeting { background: var(--info-muted); color: var(--info); }
.activity-item__text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.activity-item__text strong { color: var(--text-primary); font-weight: 600; }
.activity-item__time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.activity-item__body { margin-top: 0.4rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--bg-elevated); font-size: 0.85rem; color: var(--text-secondary); white-space: pre-wrap; }

/* ── Tasks ── */
.task-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--bg-hover); }
.task-item__check { width: 18px; height: 18px; accent-color: var(--primary-strong); cursor: pointer; flex-shrink: 0; }
.task-item__content { flex: 1; min-width: 0; }
.task-item__title { font-size: 0.875rem; font-weight: 500; }
.task-item.is-done .task-item__title { text-decoration: line-through; color: var(--text-muted); }
.task-item__meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.1rem; }
.task-item__meta a { color: var(--text-secondary); }
.task-item__due { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.task-item__due--overdue { color: var(--danger); font-weight: 600; }
.priority { font-size: 0.66rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.priority--high { background: var(--danger-muted); color: var(--danger); }
.priority--medium { background: var(--warning-muted); color: var(--warning); }
.priority--low { background: var(--success-muted); color: var(--success); }
.empty-note { padding: 2rem 1.25rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* ── Kanban ── */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 1rem; position: relative; overflow-x: auto; padding-bottom: 0.5rem; }
.kanban__col { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.9rem; min-height: 420px; display: flex; flex-direction: column; transition: border-color var(--duration-fast), background var(--duration-fast); }
.kanban__col.is-over { border-color: var(--primary); background: var(--bg-hover); }
.kanban__col-header { margin-bottom: 0.9rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.kanban__col-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; font-weight: 600; }
.kanban__col-total { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
.kanban__count { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: var(--radius-full); background: var(--primary-muted); color: var(--primary-text); }
.kanban__list { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.kanban__card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.9rem; cursor: grab; transition: border-color var(--duration-fast), box-shadow var(--duration-fast), opacity var(--duration-fast); }
.kanban__card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.kanban__card.is-dragging { opacity: 0.5; }
.kanban__card-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.15rem; }
.kanban__card-company { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.kanban__card-amount { font-size: 1rem; font-weight: 700; color: var(--success); margin-bottom: 0.6rem; font-variant-numeric: tabular-nums; }
.kanban__card-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
.kanban__move { font-size: 0.75rem; padding: 0.3rem 1.6rem 0.3rem 0.5rem; background-position: right 0.45rem center; width: 100%; margin-top: 0.65rem; border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot--lead { background: var(--info); } .dot--qualified { background: var(--primary); } .dot--proposal { background: var(--warning); } .dot--negotiation { background: #a78bfa; } .dot--won { background: var(--success); }

/* ── Profile / detail ── */
.profile-card { text-align: center; }
.profile-card .avatar--lg { margin: 0 auto 0.75rem; }
.profile-card__name { font-size: 1.15rem; font-weight: 700; }
.profile-card__role { font-size: 0.85rem; color: var(--text-muted); }
.profile-card__actions { display: flex; justify-content: center; gap: 0.5rem; margin: 1rem 0; }
.detail-list { text-align: left; border-top: 1px solid var(--border); padding-top: 1rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; font-size: 0.85rem; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { color: var(--text-primary); text-align: right; overflow-wrap: anywhere; }

/* ── Companies ── */
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.company-card { display: flex; flex-direction: column; gap: 0.75rem; }
.company-card__head { display: flex; align-items: center; gap: 0.75rem; }
.company-card__logo { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.company-card__name { font-weight: 600; color: var(--text-primary); }
.company-card__industry { font-size: 0.8rem; color: var(--text-muted); }
.company-card__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.company-card__stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.company-card__stat-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Calendar ── */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar__dow { padding: 0.5rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.calendar__day { min-height: 104px; padding: 0.4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 0.78rem; }
.calendar__day--muted { background: var(--bg-hover); }
.calendar__day--muted .calendar__date { color: var(--text-muted); opacity: 0.6; }
.calendar__date { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.25rem; }
.calendar__day--today .calendar__date { background: var(--primary-strong); color: #fff; }
.event { display: block; margin-bottom: 0.25rem; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.72rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--primary-muted); color: var(--primary-text); border-left: 3px solid var(--primary); }
.event--call { background: var(--success-muted); color: var(--success); border-color: var(--success); }
.event--demo { background: var(--warning-muted); color: var(--warning); border-color: var(--warning); }
.event--deadline { background: var(--danger-muted); color: var(--danger); border-color: var(--danger); }
.agenda__item { display: flex; gap: 0.9rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.agenda__item:last-child { border-bottom: none; }
.agenda__time { width: 64px; flex-shrink: 0; font-size: 0.8rem; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.agenda__title { font-size: 0.875rem; font-weight: 500; }
.agenda__meta { font-size: 0.78rem; color: var(--text-muted); }

/* ── Auth & error ── */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse at top, var(--primary-muted), transparent 60%), var(--bg-body);
}
.auth__theme { position: fixed; top: 1rem; right: 1rem; z-index: 5; }
.auth__card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-lg); }
.auth__brand { display: flex; align-items: center; justify-content: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: var(--text-primary); margin-bottom: 1.5rem; }
.auth__brand:hover { text-decoration: none; }
.auth__title { font-size: 1.35rem; font-weight: 700; text-align: center; }
.auth__subtitle { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin: 0.25rem 0 1.5rem; }
.auth__row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font-size: 0.85rem; }
.auth__reset { display: none; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.auth__reset:target { display: block; }
.auth__reset-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.75rem; }
.auth__footer { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 1.5rem; }
.error-page { text-align: center; max-width: 440px; }
.error-page__code { font-size: 5rem; font-weight: 800; line-height: 1; color: var(--primary-text); }
.error-page__title { font-size: 1.6rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.error-page__text { color: var(--text-secondary); margin-bottom: 1.5rem; }
.error-page__actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (min-width: 769px) { .sidebar-backdrop { display: none !important; } }
@media (max-width: 768px) {
  .kanban { grid-template-columns: repeat(5, 82%); scroll-snap-type: x mandatory; }
  .kanban__col { scroll-snap-align: start; min-height: 0; }
  .sidebar { width: min(var(--sidebar-width), 85vw); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar--open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 0.75rem; }
  .topbar__search { display: none; }
  .topbar__new-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page { padding: 1rem; }
  .kpi-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .data-table { min-width: 680px; }
  .toolbar__search { max-width: none; flex-basis: 100%; }
  .calendar__day { min-height: 64px; }
  .calendar .event { font-size: 0; padding: 0; height: 6px; border-left: none; border-radius: 3px; }
  .funnel__row { grid-template-columns: 90px 1fr 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
