/* Performa CRM. Every colour is a token; dark mode only changes the tokens. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/poppins-latin-700-normal.woff2') format('woff2'); }

:root {
  --brand: #0A6CDB;
  --brand-ink: #FFFFFF;
  --brand-hover: #0858B5;
  --brand-rgb: 10, 108, 219;
  --brand-soft: #E7F0FC;
  --navy: #0B2A5B;
  --grad-btn: linear-gradient(135deg, #0B4EA8 0%, #0A6CDB 100%);
  --ink: #0F1B2D;
  --ink-2: #33415A;
  --muted: #627089;
  --line: #E1E6EE;
  --line-2: #EEF2F7;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --input-bg: #FFFFFF;
  --input-line: #D5DCE6;
  --input-line-hover: #B9C3D1;
  --sidebar: #0B1E3F;
  --sidebar-2: #10284F;
  --sidebar-line: #1A3360;
  --sidebar-text: #B6C3D9;
  --sidebar-label: #6F82A3;
  --sidebar-active: #FFFFFF;
  --topbar: rgba(255, 255, 255, .9);
  --ok: #17864A;  --ok-bg: #E4F5EB;  --ok-ink: #0F5A32;
  --warn: #A2620B; --warn-bg: #FDF2DF; --warn-ink: #6E4307;
  --bad: #C2343B;  --bad-bg: #FBE9EA; --bad-ink: #87232A;
  --info: #2B5FC4; --info-bg: #E6EEFB; --info-ink: #1C3F86;
  --purple: #6F45C9; --purple-bg: #EFE9FB;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 1px 3px rgba(15, 27, 45, .06);
  --shadow-lg: 0 14px 40px rgba(15, 27, 45, .18);
  --backdrop: rgba(9, 16, 30, .45);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3D8DF2; --brand-ink: #FFFFFF; --brand-hover: #5CA0F5; --brand-rgb: 61, 141, 242; --brand-soft: #142B4D; --navy: #9CC2F7;
    --grad-btn: linear-gradient(135deg, #1D5FC2 0%, #3D8DF2 100%);
    --ink: #E5ECF6; --ink-2: #BCC8D9; --muted: #8796AE; --line: #22314A; --line-2: #1A273C;
    --bg: #0A1120; --surface: #101A2C; --surface-2: #142036; --input-bg: #0D1626; --input-line: #2A3A56; --input-line-hover: #3A4D6E;
    --sidebar: #070D1A; --sidebar-2: #0E1830; --sidebar-line: #16233D; --sidebar-text: #A3B1C8; --sidebar-label: #5E7091; --sidebar-active: #FFFFFF;
    --topbar: rgba(16, 26, 44, .9);
    --ok: #3FBF78; --ok-bg: #12301F; --ok-ink: #8BE0B1;
    --warn: #E0A23D; --warn-bg: #33250E; --warn-ink: #F2CF92;
    --bad: #F0646B; --bad-bg: #3A1619; --bad-ink: #F8AEB2;
    --info: #6C9CF0; --info-bg: #13254A; --info-ink: #AFC8F7;
    --purple: #A889EC; --purple-bg: #261B44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 44px rgba(0, 0, 0, .55); --backdrop: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #3D8DF2; --brand-ink: #FFFFFF; --brand-hover: #5CA0F5; --brand-rgb: 61, 141, 242; --brand-soft: #142B4D; --navy: #9CC2F7;
  --grad-btn: linear-gradient(135deg, #1D5FC2 0%, #3D8DF2 100%);
  --ink: #E5ECF6; --ink-2: #BCC8D9; --muted: #8796AE; --line: #22314A; --line-2: #1A273C;
  --bg: #0A1120; --surface: #101A2C; --surface-2: #142036; --input-bg: #0D1626; --input-line: #2A3A56; --input-line-hover: #3A4D6E;
  --sidebar: #070D1A; --sidebar-2: #0E1830; --sidebar-line: #16233D; --sidebar-text: #A3B1C8; --sidebar-label: #5E7091; --sidebar-active: #FFFFFF;
  --topbar: rgba(16, 26, 44, .9);
  --ok: #3FBF78; --ok-bg: #12301F; --ok-ink: #8BE0B1;
  --warn: #E0A23D; --warn-bg: #33250E; --warn-ink: #F2CF92;
  --bad: #F0646B; --bad-bg: #3A1619; --bad-ink: #F8AEB2;
  --info: #6C9CF0; --info-bg: #13254A; --info-ink: #AFC8F7;
  --purple: #A889EC; --purple-bg: #261B44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 44px rgba(0, 0, 0, .55); --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* Logos: one for light screens, one for dark */
.logo-for-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-for-light { display: none; } :root:not([data-theme="light"]) .logo-for-dark { display: block; } }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: block; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; border-right: 1px solid var(--sidebar-line); }
.sidebar__brand { padding: 18px 20px 14px; border-bottom: 1px solid var(--sidebar-line); }
.sidebar__brand img { display: block; height: 44px; width: auto; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.nav-group { margin-top: 14px; }
.nav-group__label { padding: 0 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--sidebar-label); }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; }
.nav-link:hover { background: var(--sidebar-2); color: var(--sidebar-active); }
.nav-link.is-active { background: linear-gradient(90deg, rgba(var(--brand-rgb), .32), rgba(var(--brand-rgb), .06)); color: var(--sidebar-active); box-shadow: inset 3px 0 0 var(--brand); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.sidebar__foot { padding: 12px 20px; border-top: 1px solid var(--sidebar-line); font-size: 11.5px; color: var(--sidebar-label); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: 62px; display: flex; align-items: center; gap: 10px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); background: var(--topbar); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar__title { font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1360px; }

.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 40px; background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.user-chip:hover { border-color: var(--input-line-hover); }
.user-chip__name { font-weight: 600; font-size: 13px; }
.user-chip__role { font-size: 11.5px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-btn); color: #FFFFFF; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar--lg { width: 52px; height: 52px; font-size: 18px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); display: none; z-index: 50; }
.dropdown.is-open { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--line-2); color: var(--ink); }
.bell-btn { position: relative; }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #FFFFFF; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--surface); line-height: 1; }
.bell-dropdown { width: 340px; max-width: calc(100vw - 32px); }
.bell-dropdown__head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 8px; }
.bell-item { align-items: flex-start !important; }
.bell-item > span { display: grid; gap: 1px; }
.bell-item.is-unread { background: var(--brand-soft); }
.bell-empty { padding: 8px 10px; }
.theme-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--line-2); border: 1px solid var(--line); }
.theme-switch button { width: 30px; height: 28px; border: 0; border-radius: 999px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.theme-switch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 21px; }
.page-head p { color: var(--muted); margin-top: 3px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card__head h2, .card__head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
a.kpi:hover { border-color: var(--brand); color: var(--ink); }
.kpi__icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.kpi__icon--warn { background: var(--warn-bg); color: var(--warn); }
.kpi__icon--bad { background: var(--bad-bg); color: var(--bad); }
.kpi__icon--ok { background: var(--ok-bg); color: var(--ok); }
.kpi__value { font-size: 22px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: 12.5px; color: var(--muted); }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pipe { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); min-width: 0; }
.pipe:hover { border-color: var(--brand); color: var(--ink); }
.pipe__count { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pipe__bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.pipe__bar span { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.pipe--won .pipe__bar span { background: var(--ok); }
.pipe--lost .pipe__bar span { background: var(--bad); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, filter .15s; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad-btn); color: #FFFFFF; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .25); }
.btn-primary:hover { filter: brightness(1.08); color: #FFFFFF; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--input-line-hover); background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ok { background: var(--ok); color: #FFFFFF; }
.btn-ok:hover { filter: brightness(1.08); color: #FFFFFF; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 4px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link-btn:hover { color: var(--brand-hover); text-decoration: underline; }
.link-btn--bad { color: var(--bad); }
.wa .icon { color: #1E9E55; }

/* ---------- Badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-brand { background: var(--purple-bg); color: var(--purple); }
.badge-muted { background: var(--line-2); color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Segmented filter */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg a, .seg button { padding: 5px 12px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500; border: 0; background: none; font-family: inherit; cursor: pointer; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .count { margin-left: 4px; color: var(--muted); font-size: 12px; }
.tabs-scroll { overflow-x: auto; margin-bottom: 14px; }
.status-tabs { display: flex; gap: 6px; }
.status-tab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.status-tab:hover { color: var(--ink); border-color: var(--input-line-hover); }
.status-tab .count { font-size: 11.5px; padding: 0 7px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.status-tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.status-tab.is-active .count { background: rgba(127, 127, 127, .25); color: var(--surface); }

/* Tabs inside a card */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 12px 12px 11px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.cell-main { font-weight: 500; color: var(--ink); }
a.cell-main:hover { color: var(--brand); }
.cell-sub { font-size: 12px; color: var(--muted); }
.is-overdue { color: var(--bad); font-weight: 500; }
.is-today { color: var(--warn); font-weight: 500; }

/* Empty state */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .icon-wrap { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--brand-soft); color: var(--brand); }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.req { color: var(--bad); margin-left: 3px; }
.help { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: var(--bad); }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--input-line); border-radius: 9px; background: var(--input-bg); color: var(--ink); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { 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='%23627089' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover { border-color: var(--input-line-hover); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16); }
.input.is-invalid { border-color: var(--bad); }
.input-sm { height: 34px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section__head { margin-bottom: 14px; }
.form-section__head h3 { font-size: 15px; }
.form-section__head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.inline-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--input-line-hover); }
.choice input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.choice strong { display: block; font-weight: 500; font-size: 13.5px; }
.choice span { font-size: 12px; color: var(--muted); }
.choice.is-locked { opacity: .55; cursor: not-allowed; }
.pw-field { position: relative; }
.pw-field .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; display: grid; place-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .input { width: auto; min-width: 150px; height: 36px; font-size: 13px; }
.filters .search { flex: 1 1 220px; position: relative; }
.filters .search .input { width: 100%; padding-left: 34px; }
.filters .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-dates button { height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
.quick-dates button:hover { border-color: var(--brand); color: var(--brand); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; border-radius: 22px; background: var(--input-line); transition: background .15s; cursor: pointer; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }

/* ---------- Drawer ---------- */
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 520px; max-width: 100vw; padding: 0; border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.drawer[open] { display: flex; flex-direction: column; }
dialog.drawer::backdrop { background: var(--backdrop); }
.drawer form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 16px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px 22px; display: grid; gap: 16px; align-content: start; }
.drawer__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---------- Alerts and flash ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert-error { background: var(--bad-bg); color: var(--bad-ink); }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert a { color: inherit; text-decoration: underline; font-weight: 500; }
.flash-stack { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--info); box-shadow: var(--shadow-lg); }
.flash p { flex: 1; font-size: 13.5px; }
.flash button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.flash--success { border-left-color: var(--ok); } .flash--success > .icon { color: var(--ok); }
.flash--error { border-left-color: var(--bad); } .flash--error > .icon { color: var(--bad); }
.flash--info > .icon { color: var(--info); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth__art { position: relative; overflow: hidden; color: #FFFFFF; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background: radial-gradient(90% 70% at 90% 5%, rgba(10, 108, 219, .55) 0%, rgba(10, 108, 219, 0) 60%), radial-gradient(70% 60% at 0% 100%, rgba(30, 90, 200, .35) 0%, rgba(30, 90, 200, 0) 60%), #071530; }
.auth__art::after { content: ''; position: absolute; right: -60px; bottom: 90px; width: 260px; height: 260px; background-image: radial-gradient(rgba(255, 255, 255, .16) 1.5px, transparent 1.5px); background-size: 18px 18px; pointer-events: none; }
.auth__art h2 { font-size: 34px; line-height: 1.2; max-width: 460px; }
.auth__art h2 span { color: #6FB1FF; }
.auth__art p { color: #B9C6DD; margin-top: 12px; max-width: 430px; }
.auth__art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth__art li { display: flex; gap: 10px; align-items: center; color: #E2E9F5; }
.auth__art li .icon-wrap { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(111, 177, 255, .16); color: #8EC3FF; }
.auth__foot { color: #8193B2; font-size: 12px; }
.auth__foot a { color: inherit; text-decoration: underline; }
.auth__panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth__box { width: 100%; max-width: 380px; }
.auth__box .logo img { height: 50px; width: auto; margin-bottom: 26px; }
.auth__box h1 { font-size: 24px; }
.auth__box > p { color: var(--muted); margin: 4px 0 22px; }
.auth__box form { display: grid; gap: 16px; }
.auth__theme { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- Lists: follow-ups, tasks, timeline ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 500; color: var(--ink); }
.list__meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-check { width: 22px; height: 22px; border-radius: 6px; border: 1.8px solid var(--input-line-hover); background: var(--input-bg); display: grid; place-items: center; color: transparent; cursor: pointer; flex-shrink: 0; padding: 0; margin-top: 1px; transition: border-color .15s, background .15s, color .15s; }
.task-check:hover { border-color: var(--ok); color: var(--ok); }
.task-check.is-checked { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.task-row.is-done .task-row__title { color: var(--muted); text-decoration: line-through; }
.task-row__title { font-weight: 500; color: var(--ink); }
a.task-row__title:hover { color: var(--brand); }
.task-row__meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.checklist li.is-done span { text-decoration: line-through; color: var(--muted); }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 18px; }
.timeline li::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline__dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.timeline__dot--stage { background: var(--purple-bg); color: var(--purple); }
.timeline__dot--system { background: var(--line-2); color: var(--muted); }
.timeline__body { flex: 1; min-width: 0; padding-top: 4px; }
.timeline__body p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.next-fu { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--brand-soft); color: var(--ink); }
.next-fu.is-late { background: var(--bad-bg); }

/* Link cards (Google Sheets) */
.link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.link-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.link-card__icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); flex-shrink: 0; }
.link-card__body { flex: 1; min-width: 0; }
.link-card__title { font-weight: 500; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card__title:hover { color: var(--brand); }
.link-group + .link-group { margin-top: 18px; }
.link-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.rank-up { color: var(--ok); font-weight: 600; }
.rank-down { color: var(--bad); font-weight: 600; }

/* Daily report sheet */
.report-grid { overflow-x: auto; }
.report-grid table { border-collapse: collapse; width: 100%; }
.report-grid th, .report-grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: center; font-size: 12.5px; white-space: nowrap; }
.report-grid th:first-child, .report-grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.report-grid th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
.rdot { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; }
.rdot--yes { background: var(--ok-bg); color: var(--ok); }
.rdot--no { background: var(--bad-bg); color: var(--bad); }
.rdot--off { background: var(--line-2); color: var(--muted); }
.report-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 18px; }
.report-box.is-done { border-color: var(--ok); background: var(--ok-bg); }
.report-box__text { flex: 1; min-width: 200px; }
.report-box__text strong { display: block; }
.report-box form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 360px; }
.report-box form .input { flex: 1 1 200px; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager__links { display: flex; align-items: center; gap: 10px; }

/* Credentials box after adding an employee */
.creds { border-color: var(--ok); margin-bottom: 18px; }
.creds__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.creds__grid > div { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 9px; background: var(--surface-2); min-width: 0; overflow-wrap: anywhere; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-side { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: var(--backdrop); z-index: 35; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
  .topbar { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .user-chip__text, .user-chip > .icon { display: none; }
  .user-chip { padding: 3px; }
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi__icon { width: 36px; height: 36px; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-section { padding: 16px; }
  .form-actions { padding: 14px 16px; }
  .filters { padding: 12px; }
  .filters .input { flex: 1 1 140px; min-width: 0; }
  .creds__grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .theme-switch { display: none; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  .table.responsive td.actions { justify-content: flex-end; }
  .table.responsive td.actions::before { content: none; }
  .table.responsive td:first-child { text-align: left; }
  .table.responsive td:first-child::before { content: none; }
}

/* Error pages */
.center-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--bg); }
.center-page .code { font-size: 64px; font-weight: 700; line-height: 1; color: var(--brand); }

/* Dashboard lead stages */
.stage-list { display: grid; gap: 4px; padding: 10px 12px; }
.stage-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; }
.stage-row:hover { background: var(--surface-2); color: var(--ink); }
.stage-row__bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.stage-row__bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.stage-row--won .stage-row__bar span { background: var(--ok); }
.stage-row--lost .stage-row__bar span { background: var(--bad); }
