/* ===== Design tokens ===== */
:root {
  --bg: oklch(0.985 0.003 250);
  --surface: #ffffff;
  --surface-2: oklch(0.975 0.004 250);
  --surface-hover: oklch(0.965 0.005 250);
  --border: oklch(0.92 0.005 250);
  --border-strong: oklch(0.86 0.008 250);
  --text: oklch(0.22 0.015 260);
  --text-2: oklch(0.45 0.012 260);
  --text-3: oklch(0.62 0.01 260);
  --text-inv: #ffffff;

  --primary: oklch(0.55 0.15 265);
  --primary-hover: oklch(0.5 0.16 265);
  --primary-soft: oklch(0.96 0.025 265);
  --primary-soft-text: oklch(0.4 0.16 265);

  --c-blue: oklch(0.58 0.13 240);
  --c-blue-soft: oklch(0.96 0.025 240);
  --c-green: oklch(0.58 0.13 150);
  --c-green-soft: oklch(0.96 0.025 150);
  --c-amber: oklch(0.7 0.13 75);
  --c-amber-soft: oklch(0.96 0.04 80);
  --c-red: oklch(0.58 0.18 25);
  --c-red-soft: oklch(0.96 0.025 25);
  --c-violet: oklch(0.58 0.16 295);
  --c-violet-soft: oklch(0.96 0.025 295);
  --c-slate: oklch(0.55 0.012 260);
  --c-slate-soft: oklch(0.95 0.004 260);

  --shadow-xs: 0 1px 0 rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05), 0 1px 1px rgba(15,23,42,0.03);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  --sidebar-w: 224px;
  --topbar-h: 52px;

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

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11','ss01','ss03';
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: oklch(0.88 0.005 260); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.008 260); }

/* ===== App shell ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.app__topbar { grid-column: 1 / -1; grid-row: 1; }
.app__sidebar { grid-column: 1; grid-row: 2; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.app__main { grid-column: 2; grid-row: 2; overflow: auto; background: var(--bg); }

/* ===== Topbar ===== */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative; z-index: 20;
}
.topbar__brand { display: flex; align-items: center; gap: 8px; width: calc(var(--sidebar-w) - 16px); padding-right: 12px; }
.topbar__logo {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--text); color: var(--text-inv);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: -0.02em; flex-shrink: 0;
}
.topbar__brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }

.topbar__search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text-3);
  transition: border-color .12s, background .12s;
}
.topbar__search:focus-within { border-color: var(--primary); background: var(--surface); color: var(--text); }
.topbar__search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 13px; }
.topbar__search kbd { font-family: var(--font-mono); font-size: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; color: var(--text-3); }

.topbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-2); position: relative; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn__dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); border: 2px solid var(--surface); }
.icon-btn__badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--c-amber); color: white; border: 2px solid var(--surface); font-size: 10px; font-weight: 700; line-height: 13px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); }
.icon-btn__badge--urgent { background: var(--c-red); }

.user-chip { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 4px; border-radius: var(--r-md); transition: background .12s; }
.user-chip:hover { background: var(--surface-hover); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--text-inv); flex-shrink: 0; }
.user-chip__name { font-size: 13px; font-weight: 500; }
.user-chip__role { font-size: 11px; color: var(--text-3); }

/* ===== Sidebar ===== */
.sidebar { padding: 8px 8px 16px; display: flex; flex-direction: column; height: 100%; }
.sidebar__section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 12px 10px 6px; font-weight: 600; }
.sidebar__nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; transition: background .12s, color .12s; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item--active { background: var(--primary-soft); color: var(--primary-soft-text); }
.nav-item--active:hover { background: var(--primary-soft); color: var(--primary-soft-text); }
.nav-item__icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item__count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 1px 6px; border-radius: 8px; min-width: 20px; text-align: center; }
.nav-item--active .nav-item__count { background: rgba(255,255,255,0.7); color: var(--primary-soft-text); }
.sidebar__footer { margin-top: auto; padding: 8px; border-top: 1px solid var(--border); }
.sidebar__upgrade { padding: 10px; border-radius: var(--r-md); background: var(--surface-2); font-size: 12px; color: var(--text-2); display: flex; gap: 8px; align-items: flex-start; }

/* ===== Page chrome ===== */
.page { padding: 20px 24px 40px; max-width: 1600px; }
.page__header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page__title-block { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.page__title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.page__subtitle { font-size: 13px; color: var(--text-3); }
.page__actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-md); font-size: 13px; font-weight: 500; color: var(--text); transition: background .12s, border-color .12s, color .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn--primary { background: var(--primary); color: var(--text-inv); border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-hover); border-color: transparent; }
.btn--danger { color: var(--c-red); }
.btn--danger:hover { background: var(--c-red-soft); border-color: var(--c-red-soft); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--icon { width: 32px; padding: 0; justify-content: center; }
.btn--icon.btn--sm { width: 28px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ===== Inputs ===== */
.input, .select, .textarea { height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); font-size: 13px; color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s; width: 100%; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; line-height: 1.5; }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field__hint { font-size: 11px; color: var(--text-3); }
.field__error { font-size: 12px; color: var(--c-red); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.checkbox input { appearance: none; width: 14px; height: 14px; border: 1px solid var(--border-strong); border-radius: 3px; display: grid; place-items: center; background: var(--surface); transition: all .12s; cursor: pointer; flex-shrink: 0; }
.checkbox input:checked { background: var(--primary); border-color: var(--primary); }
.checkbox input:checked::after { content: ''; width: 8px; height: 8px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card__header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__title { font-size: 13px; font-weight: 600; margin: 0; }
.card__sub { font-size: 12px; color: var(--text-3); }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 500; background: var(--c-slate-soft); color: var(--c-slate); white-space: nowrap; }
.badge--blue { background: var(--c-blue-soft); color: var(--c-blue); }
.badge--green { background: var(--c-green-soft); color: var(--c-green); }
.badge--amber { background: var(--c-amber-soft); color: var(--c-amber); }
.badge--red { background: var(--c-red-soft); color: var(--c-red); }
.badge--violet { background: var(--c-violet-soft); color: var(--c-violet); }
.badge--primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.badge--solid-red { background: var(--c-red); color: white; }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 0 12px; border-bottom: 1px solid var(--border); height: 44px; vertical-align: middle; }
.table tbody tr { transition: background .1s; cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { font-family: var(--font-mono); font-size: 12px; }
.table .col-checkbox { width: 36px; padding-right: 0; }
.table .col-actions { width: 40px; text-align: right; }
.row-cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-cell-name__main { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-cell-name__sub { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

/* ===== Filter bar ===== */
.filterbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface); }
.filterbar__search { flex: 1; min-width: 220px; max-width: 320px; }
.filterbar__sep { width: 1px; height: 20px; background: var(--border); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 12px; }
.tabs__tab { padding: 10px 12px; font-size: 13px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; display: flex; align-items: center; gap: 6px; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tabs__tab:hover { color: var(--text); }
.tabs__tab--active { color: var(--primary-soft-text); border-bottom-color: var(--primary); }
.tabs__count { font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 0 6px; border-radius: 8px; }

/* ===== Segmented control ===== */
.segmented { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.segmented button { height: 26px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--text-2); border-radius: 4px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ===== KPI tiles ===== */
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.kpi__label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-feature-settings: 'tnum'; }
.kpi__delta { font-size: 11px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta--up { color: var(--c-green); }
.kpi__delta--down { color: var(--c-red); }

/* ===== Modal / Drawer ===== */
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 50; animation: fade-in .14s ease-out; }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-in-right { from { transform: translateX(100%) } to { transform: translateX(0) } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96) } to { opacity: 1; transform: scale(1) } }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 92vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 51; display: flex; flex-direction: column; animation: slide-in-right .22s cubic-bezier(.2,.7,.2,1); }
.drawer__header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.drawer__title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.drawer__body { flex: 1; overflow-y: auto; }
.drawer__footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 51; width: min(520px, 92vw); animation: pop-in .14s ease-out; }
.modal--lg { width: min(680px, 92vw); }
.modal__inner { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.modal__header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal__title { font-size: 15px; font-weight: 600; flex: 1; }
.modal__body { padding: 18px; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal__footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ===== Create card (create-menu) ===== */
.create-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); text-align: left; transition: background .12s, border-color .12s; background: transparent; }
.create-card:hover { background: var(--surface-2); border-color: var(--border-strong); }
.create-card__icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }

/* ===== Toasts ===== */
.toasts { position: fixed; top: calc(var(--topbar-h) + 14px); right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 11px; padding: 12px 15px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c-green); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; animation: pop-in .18s ease-out; min-width: 300px; max-width: min(420px, calc(100vw - 40px)); pointer-events: all; }
.toast__icon { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.toast__text { min-width: 0; line-height: 1.35; }
.toast--success { border-left-color: var(--c-green); }
.toast--success .toast__icon { background: var(--c-green-soft); color: var(--c-green); }
.toast--error { border-left-color: var(--c-red); }
.toast--error .toast__icon { background: var(--c-red-soft); color: var(--c-red); }
.toast--info { border-left-color: var(--c-blue); }
.toast--info .toast__icon { background: var(--c-blue-soft); color: var(--c-blue); }

/* ===== Activity feed ===== */
.activity { display: flex; flex-direction: column; }
.activity__item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity__item:last-child { border-bottom: 0; }
.activity__icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.activity__body { flex: 1; min-width: 0; }
.activity__text { font-size: 13px; line-height: 1.45; }
.activity__text strong { font-weight: 600; }
.activity__meta { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: var(--font-mono); }

/* ===== Kanban ===== */
.kanban { display: flex; gap: 12px; padding: 12px; overflow-x: auto; min-height: 100%; }
.kanban__col { flex: 0 0 280px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 100%; }
.kanban__col-header { padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.kanban__col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kanban__col-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.kanban__col-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.kanban__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; cursor: grab; transition: box-shadow .12s, transform .12s, border-color .12s; }
.kanban__card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kanban__card.dragging { opacity: 0.4; }
.kanban__card-title { font-size: 13px; font-weight: 500; }
.kanban__card-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.kanban__card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.kanban__col.drop-target { background: var(--primary-soft); border-color: var(--primary); }

/* ===== Score bars ===== */
.score { display: inline-flex; align-items: center; gap: 3px; }
.score__bar { width: 4px; height: 10px; background: var(--border); border-radius: 1px; }
.score__bar--on { background: var(--primary); }

/* ===== Bar chart rows ===== */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 8px; font-size: 12px; }
.bar-row__label { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.bar-row__track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-row__fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s ease; }
.bar-row__num { font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--text-2); }

/* ===== Dropdown menus ===== */
.dropdown-menu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); min-width: 180px; padding: 4px; z-index: 30; animation: pop-in .12s ease-out; }
.dropdown-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 4px; font-size: 13px; color: var(--text); text-align: left; transition: background .1s; }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item--danger { color: var(--c-red); }
.dropdown-item--danger:hover { background: var(--c-red-soft); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Notification panel ===== */
.notif-panel { position: fixed; top: var(--topbar-h); right: 0; width: 340px; max-height: calc(100vh - var(--topbar-h)); background: var(--surface); border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 40; display: flex; flex-direction: column; animation: slide-in-right .18s cubic-bezier(.2,.7,.2,1); border-radius: 0 0 0 var(--r-lg); }
.notif-panel__header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 13px; flex-shrink: 0; }

/* ===== Toggle switch ===== */
.toggle-switch { cursor: pointer; display: inline-flex; align-items: center; }
.toggle-switch__track { width: 32px; height: 18px; border-radius: 9px; background: var(--border-strong); position: relative; transition: background .15s; }
.toggle-switch__track--on { background: var(--primary); }
.toggle-switch__thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .15s; }
.toggle-switch__track--on .toggle-switch__thumb { transform: translateX(14px); }

/* ===== Reminder check button ===== */
.reminder-check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; transition: background .12s, border-color .12s; color: var(--c-green); }
.reminder-check:hover, .reminder-check--done { background: var(--c-green-soft); border-color: var(--c-green); }
.reminder-check__box { display: flex; align-items: center; justify-content: center; }

/* ===== Auth layout ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth__form { width: 100%; max-width: 360px; }
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.auth__title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
.auth__sub { font-size: 13px; color: var(--text-3); margin: 0 0 24px; }
.auth__art { background: linear-gradient(180deg, oklch(0.98 0.005 260) 0%, oklch(0.94 0.01 260) 100%); border-left: 1px solid var(--border); display: flex; align-items: center; justify-content: center; padding: 40px; overflow: hidden; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth__art { display: none; } }

/* ===== Empty state ===== */
.empty { padding: 48px 24px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty__icon { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); margin-bottom: 4px; }
.empty__title { font-size: 14px; font-weight: 600; color: var(--text); }
.empty__sub { font-size: 12px; max-width: 360px; }

/* ===== Skeleton loader ===== */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, oklch(0.94 0.005 250) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ===== Utils ===== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; }
.w-full { width: 100%; } .flex-1 { flex: 1; min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Help tooltip ===== */
.help-tip { position: relative; display: inline-flex; align-items: center; }
.help-tip__trigger { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px 6px; border-radius: var(--r-md); font-size: 12px; font-weight: 500; transition: color .12s, background .12s; }
.help-tip__trigger:hover { color: var(--text-2); background: var(--surface-2); }
.help-tip__popover { display: none; position: absolute; right: 0; top: calc(100% + 6px); width: 290px; background: oklch(0.17 0.008 260); border: 1px solid rgba(255,255,255,.07); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 12px 14px; z-index: 60; }
.help-tip:hover .help-tip__popover, .help-tip.is-open .help-tip__popover { display: block; }
.help-tip__title { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.help-tip__row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.8); padding: 4px 0; }
.help-tip__row span:last-child { flex: 1; }
.help-tip__row--sep { border-top: 1px solid rgba(255,255,255,.08); margin-top: 5px; padding-top: 9px; }
.help-tip__sla { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: rgba(255,255,255,.35); display: flex; align-items: center; gap: 6px; }
.help-tip__sla strong { color: rgba(255,255,255,.5); }

/* ===== SLA indicators ===== */
.sla-chip { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 5px; border-radius: 4px; background: var(--c-amber-soft); color: var(--c-amber); font-size: 10px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.sla-chip--warning { background: var(--c-amber-soft); color: var(--c-amber); }
.sla-chip--urgent { background: var(--c-red-soft); color: var(--c-red); }
.row-sla--warning td { background: color-mix(in oklab, var(--c-amber-soft) 36%, transparent); }
.row-sla--warning td:first-child { box-shadow: inset 3px 0 0 var(--c-amber); }
.row-sla--warning:hover td { background: color-mix(in oklab, var(--c-amber-soft) 54%, transparent); }
.row-sla--urgent td { background: color-mix(in oklab, var(--c-red-soft) 42%, transparent); }
.row-sla--urgent td:first-child { box-shadow: inset 3px 0 0 var(--c-red); }
.row-sla--urgent:hover td { background: color-mix(in oklab, var(--c-red-soft) 58%, transparent); }
.kanban__card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kanban__card-title > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kanban__card--sla-warning { border-left: 3px solid var(--c-amber); background: color-mix(in oklab, var(--c-amber-soft) 26%, var(--surface)); }
.kanban__card--sla-warning:hover { background: color-mix(in oklab, var(--c-amber-soft) 38%, var(--surface)); }
.kanban__card--sla-urgent { border-left: 3px solid var(--c-red); background: color-mix(in oklab, var(--c-red-soft) 30%, var(--surface)); }
.kanban__card--sla-urgent:hover { background: color-mix(in oklab, var(--c-red-soft) 42%, var(--surface)); }
.kanban__col--won { opacity: .85; }
.kanban__col--lost { opacity: .75; }

/* ===== Danger button variant ===== */
.btn--danger { background: var(--c-red); color: #fff; border-color: var(--c-red); }
.btn--danger:hover { opacity: .88; }

/* ===== Resolved / Closed tab style ===== */
.tabs__tab--resolved { border-left: 1px solid var(--border); margin-left: 4px; padding-left: 16px; }

/* ===== Kanban column stats bar ===== */
.kanban__col-stats { display: flex; align-items: center; gap: 10px; padding: 5px 10px 7px; font-size: 11px; color: var(--text-3); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.kanban__col-stats span { display: inline-flex; align-items: center; gap: 3px; }

/* ===== Kanban "+ Add lead" and "View more" ===== */
.kanban__add { display: flex; align-items: center; gap: 5px; width: 100%; padding: 8px 10px; margin-top: 6px; background: none; border: 1px dashed var(--border); border-radius: var(--r-md); color: var(--text-3); font-size: 12px; cursor: pointer; transition: background .12s, color .12s; justify-content: center; }
.kanban__add:hover { background: var(--surface-2); color: var(--text-2); border-color: var(--border-strong); }
.kanban__view-more { display: block; text-align: center; padding: 8px; font-size: 12px; color: var(--primary); border-radius: var(--r-md); margin-top: 4px; transition: background .12s; }
.kanban__view-more:hover { background: var(--surface-2); text-decoration: none; }

/* ===== Recently Closed panel ===== */
.kanban__panel { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface-2); border-left: 1px solid var(--border); padding: 14px 14px 0; overflow-y: auto; }
.kanban__panel-header { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.kanban__panel-arrow { color: var(--text-3); display: flex; align-items: center; transition: color .12s; }
.kanban__panel-arrow:hover { color: var(--text); }
.kanban__panel-stats { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.kanban__panel-stat { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.kanban__panel-stat-count { color: var(--text-2); font-weight: 500; }
.kanban__panel-stat-val { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text); }
.win-rate-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; gap: 2px; }
.win-rate-bar__won { background: var(--c-green); border-radius: 3px 0 0 3px; transition: width .4s; }
.win-rate-bar__lost { background: var(--c-red); border-radius: 0 3px 3px 0; transition: width .4s; flex: 1; }
.kanban__panel-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.kanban__panel-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px; border-radius: var(--r-md); cursor: pointer; transition: background .1s; }
.kanban__panel-item:hover { background: var(--surface); }
.kanban__panel-indicator { width: 3px; height: 36px; border-radius: 2px; flex-shrink: 0; margin-top: 2px; }
.kanban__panel-indicator--won { background: var(--c-green); }
.kanban__panel-indicator--lost { background: var(--c-red); }
.kanban__panel-item-name { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.kanban__panel-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.text-won { color: var(--c-green); font-weight: 500; }
.text-lost { color: var(--c-red); font-weight: 500; }
.kanban__panel-footer { display: block; padding: 12px 6px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); margin-top: 8px; display: flex; align-items: center; gap: 5px; transition: color .12s; position: sticky; bottom: 0; background: var(--surface-2); }
.kanban__panel-footer:hover { color: var(--text-2); text-decoration: none; }

/* ===== Responsive collapse ===== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }
  .nav-item span:not(.nav-item__count) { display: none; }
  .nav-item__count { display: none; }
  .sidebar__section-label { display: none; }
  .sidebar__upgrade { display: none; }
  .topbar__brand-name { display: none; }
  .nav-item { justify-content: center; }
  .topbar__brand { width: auto; }
}
