/* Native Leads – leads dashboard (page template). Builds on base.css. */

/* ---------- sign-in / no-access / setup: split screen ---------- */

.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }

.auth__aside {
	position: relative; overflow: hidden; isolation: isolate;
	display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
	padding: 44px 56px; color: var(--side-text);
	background: var(--side-bg);
}
.auth__aside::before {
	content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.6;
	background-image: linear-gradient(var(--side-line) 1px, transparent 1px), linear-gradient(90deg, var(--side-line) 1px, transparent 1px);
	background-size: 48px 48px;
	mask-image: radial-gradient(120% 80% at 20% 30%, #000 20%, transparent 75%);
}
.auth__aside::after {
	content: ""; position: absolute; z-index: -1; right: -180px; bottom: -220px; width: 560px; height: 560px; border-radius: 50%;
	background: radial-gradient(closest-side, rgba(130, 175, 210, 0.28), transparent);
}
.brand--light .brand__text small { color: var(--side-muted); }
.brand--light .brand__mark { background: rgba(255, 255, 255, 0.12); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset; }
.auth__eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-300); }
.auth__pitch h2 { margin-top: 14px; max-width: 460px; font-size: clamp(28px, 3vw, 40px); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; }
.auth__pitch ul { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.auth__pitch li { display: flex; align-items: center; gap: 12px; color: var(--side-muted); font-size: 14.5px; }
.auth__pitch li svg { width: 32px; height: 32px; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #fff; }
.auth__mock { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 460px; }
.auth__mock-kpi {
	display: grid; gap: 4px; padding: 16px 18px; border-radius: 16px;
	background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(8px);
}
.auth__mock-kpi small { font-size: 11.5px; color: var(--side-muted); }
.auth__mock-kpi strong { font: 700 24px/1.1 var(--font-display); letter-spacing: -0.02em; }
.auth__mock-kpi svg { width: 100% !important; height: 30px !important; margin-top: 4px; stroke: var(--brand-300); stroke-width: 2; vector-effect: non-scaling-stroke; }
.auth__mock-bar { display: block; height: 6px; margin-top: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.auth__mock-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-300), #fff); }

.auth__main { display: grid; place-items: center; align-content: center; gap: 20px; padding: 40px 24px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__card > .brand { display: none; }
.auth__card h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.auth__lead { margin: 8px 0 28px !important; color: var(--muted); font-size: 15px; }
.auth__lead code { font-family: var(--mono); font-size: 13px; color: var(--accent-ink); }
.auth__form { display: grid; gap: 18px; }
.auth__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth__row a { color: var(--accent-ink); font-weight: 600; }
.auth__row a:hover { text-decoration: underline; }
.auth__foot { color: var(--faint); font-size: 12px; }
.auth__foot a:hover { color: var(--text); }

.field { display: grid; gap: 7px; }
.field span { font-size: 13px; font-weight: 600; color: var(--text); }
.field input {
	height: 48px; padding: 0 15px; width: 100%;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border-strong); border-radius: 12px;
	font: 400 15px var(--font); box-shadow: 0 1px 2px rgba(14, 27, 38, 0.04);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.notice { padding: 11px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 18px !important; }
.notice--error { background: var(--c-failed-bg); color: var(--c-failed); border: 1px solid color-mix(in srgb, var(--c-failed) 30%, transparent); }

/* ---------- app shell: sidebar + main ---------- */

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
	position: sticky; top: 0; height: 100vh; z-index: 40; isolation: isolate;
	display: flex; flex-direction: column; gap: 26px; padding: 22px 16px 16px;
	background: var(--side-bg); color: var(--side-text);
	overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent;
}
.sidebar::after {
	content: ""; position: absolute; z-index: -1; left: -120px; bottom: -160px; width: 380px; height: 380px; border-radius: 50%;
	background: radial-gradient(closest-side, rgba(130, 175, 210, 0.16), transparent); pointer-events: none;
}
.sidebar .brand__text small { color: var(--side-muted); }
.sidebar .brand__mark { background: rgba(255, 255, 255, 0.12); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset; }
.sidebar .icon-btn { background: transparent; border-color: var(--side-line); color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.sidebar__top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.sidebar__close { display: none !important; }
.sidebar__label { margin: 0 0 8px !important; padding: 0 12px; font: 700 10.5px/1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--side-faint); }

.sidenav { display: grid; gap: 3px; }
.sidenav__link {
	display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
	color: var(--side-muted); font-weight: 500; transition: color 0.15s, background-color 0.15s;
}
.sidenav__link span { flex: 1; }
.sidenav__link em { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--side-text); font-variant-numeric: tabular-nums; }
.sidenav__link:hover { color: #fff; background: var(--side-hover); }
.sidenav__link.is-current { color: var(--brand); background: #fff; font-weight: 600; box-shadow: 0 6px 18px rgba(4, 14, 22, 0.25); }
.sidenav__link.is-current em { background: var(--brand-100); color: var(--brand); }
:root[data-theme="dark"] .sidenav__link.is-current { color: #fff; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
:root[data-theme="dark"] .sidenav__link.is-current em { background: rgba(255, 255, 255, 0.14); color: #fff; }

.sidepages ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidepage {
	display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px;
	color: var(--side-muted); font-size: 13.5px; transition: color 0.15s, background-color 0.15s;
}
.sidepage:hover { color: #fff; background: var(--side-hover); }
.sidepage.is-active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.sidepage__dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--side-faint); flex: none; }
.sidepage.is-active .sidepage__dot { background: var(--brand-300); border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(130, 175, 210, 0.22); }
.sidepage__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidepage__count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--side-faint); }
.sidepage.is-active .sidepage__count { color: #fff; }
.sidepages__empty { padding: 0 12px; font-size: 12.5px; color: var(--side-faint) !important; }

.sidebar__foot { margin-top: auto; display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--side-line); }
.me { display: flex; align-items: center; gap: 11px; min-width: 0; }
.me .avatar { background: #fff; color: var(--brand); }
.me__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me__text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__text small { font-size: 11.5px; color: var(--side-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__tools { display: flex; gap: 6px; }
.sidebar__tools .icon-btn { flex: 1; width: auto; height: 34px; }
.sidebar-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.mainbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
	padding: 18px 40px;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	border-bottom: 1px solid var(--border);
	backdrop-filter: saturate(1.4) blur(16px);
}
.mainbar__menu { display: none !important; }
.mainbar__title { margin-right: auto; min-width: 0; }
.mainbar__title p { font-size: 12.5px; font-weight: 500; }
.mainbar__title h1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.mainbar__date { font: 500 13px var(--font); letter-spacing: 0; color: var(--faint); }
.mainbar__range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.mainbar__actions { display: flex; align-items: center; gap: 8px; }

.segmented { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--accent-gradient); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(33, 80, 115, 0.25); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.dates { display: flex; align-items: center; gap: 8px; }
.dates label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dates input {
	height: 36px; padding: 0 10px; background: var(--surface); color: var(--text);
	border: 1px solid var(--border-strong); border-radius: 10px; font: 400 13px var(--font);
}
.dates input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px 40px 48px; display: grid; gap: 22px; }

.active-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.fchip {
	display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px 5px 12px; border-radius: 999px;
	border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 12.5px;
	box-shadow: 0 1px 2px rgba(14, 27, 38, 0.04); transition: border-color 0.15s, color 0.15s;
}
.fchip small { color: var(--faint); font-weight: 500; }
.fchip svg { width: 14px; height: 14px; color: var(--faint); }
a.fchip:hover { border-color: var(--down); }
a.fchip:hover svg { color: var(--down); }
.fchip--range { padding-right: 12px; color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.fchip--range svg { color: currentColor; }
.link-reset { color: var(--accent-ink) !important; font-size: 13px; font-weight: 600; }
.link-reset:hover { text-decoration: underline; }

.card {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: center; gap: 12px; margin: -2px 0 20px; }
.card__head > div { flex: 1; min-width: 0; }
.card__head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card__head p { font-size: 12px; margin-top: 1px; }
.card__icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.card__icon svg { width: 17px; height: 17px; }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.kpi {
	position: relative; overflow: hidden; padding: 20px 22px;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); box-shadow: var(--shadow);
	transition: box-shadow 0.2s, transform 0.2s;
}
.kpi:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.kpi__label { display: flex; align-items: center; gap: 7px; min-height: 36px; padding-right: 44px; font: 500 13px var(--font); color: var(--muted); }
.kpi__label svg {
	position: absolute; right: 18px; top: 18px; width: 36px !important; height: 36px !important; padding: 9px;
	border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink);
}
.kpi__value { margin: 6px 0 10px !important; font: 700 36px/1.05 var(--font-display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 19px; font-weight: 600; margin-left: 2px; color: var(--muted); }
.kpi__foot { position: relative; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
a.trend:hover { text-decoration: underline; }

.kpi--hero {
	background: var(--gloss), var(--accent-gradient); border-color: transparent; color: #fff;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, var(--shadow-brand);
}
.kpi--hero::before {
	content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%;
	background: radial-gradient(closest-side, rgba(255, 255, 255, 0.16), transparent);
}
.kpi--hero .kpi__label,
.kpi--hero .kpi__note { color: rgba(255, 255, 255, 0.72); }
.kpi--hero .kpi__label { padding-right: 0; }
.kpi__spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100% !important; height: 46px !important; opacity: 0.9; }
.kpi__spark-area { fill: rgba(255, 255, 255, 0.1); stroke: none; }
.kpi__spark-line { fill: none; stroke: rgba(255, 255, 255, 0.7) !important; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.kpi--hero .kpi__foot { margin-bottom: 30px; }

/* ---------- chart + CRM ---------- */

.insights { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(290px, 1fr); gap: 18px; }
.chart,
.crm,
.breakdown { padding: 22px 24px; }

.chart__total { text-align: right; line-height: 1.2; }
.chart__total strong { display: block; font: 700 24px/1.1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.chart__total span { font-size: 12px; }

.chart__plot { position: relative; height: 230px; margin-left: 30px; }
.chart__grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart__grid span { position: relative; border-top: 1px dashed var(--border); }
.chart__grid span:last-child { border-top: 1px solid var(--border-strong); }
.chart__grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 10px); top: -8px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chart__svg { position: absolute; inset: 0; width: 100% !important; height: 100% !important; overflow: visible; color: var(--bar); }
.chart__area { fill: url(#nl-area); stroke: none; }
.chart__line { fill: none; stroke: var(--bar); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart__cols {
	position: absolute; inset: 0; margin: 0; padding: 0; list-style: none;
	display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr));
}
.chart__col { position: relative; height: 100%; cursor: default; outline-offset: -2px !important; }
.chart__col::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px dashed transparent; }
.chart__dot {
	position: absolute; left: 50%; width: 11px; height: 11px; margin: 0 0 -5.5px -5.5px; border-radius: 50%;
	background: var(--surface); border: 2.5px solid var(--bar); opacity: 0; transform: scale(0.6);
	box-shadow: 0 0 0 4px var(--accent-soft);
	transition: opacity 0.12s, transform 0.12s;
}
.chart__col:hover::before,
.chart__col:focus-visible::before { border-left-color: var(--border-strong); }
.chart__col:hover .chart__dot,
.chart__col:focus-visible .chart__dot { opacity: 1; transform: none; }
.chart__axis { display: flex; justify-content: space-between; margin: 10px 0 0 30px; font-size: 11px; color: var(--faint); }

.chart-tip {
	position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
	padding: 7px 11px; border-radius: 9px; white-space: nowrap;
	background: var(--brand-900); color: #fff; font-size: 12px; font-weight: 600;
	box-shadow: var(--shadow-pop);
}

.crm { display: flex; flex-direction: column; }
.crm__ring {
	--rate: 0;
	position: relative; display: grid; place-content: center; justify-items: center; align-self: center;
	width: 140px; height: 140px; margin: 0 0 20px; border-radius: 50%;
	background: conic-gradient(var(--bar) calc(var(--rate) * 1%), var(--surface-2) 0);
}
.crm__ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 2px 6px rgba(14, 27, 38, 0.06); }
.crm__ring > * { position: relative; }
.crm__ring strong { font: 700 28px/1 var(--font-display); letter-spacing: -0.03em; }
.crm__ring span { font-size: 11.5px; margin-top: 4px; }
.crm__bar { display: flex; gap: 3px; height: 8px; margin-bottom: 14px; }
.crm__seg { flex: 1 1 0; border-radius: 999px; min-width: 6px; }
.crm__seg--sent { background: var(--c-sent); }
.crm__seg--pending { background: var(--c-pending); }
.crm__seg--failed { background: var(--c-failed); }
.crm__seg--off { background: var(--c-off); }
.crm__legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.crm__item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; font-size: 12.5px; color: var(--muted); transition: background-color 0.15s, border-color 0.15s; }
.crm__item span:nth-child(2) { flex: 1; }
.crm__item strong { color: var(--text); font-variant-numeric: tabular-nums; }
.crm__item:hover { background: var(--surface-2); }
.crm__item.is-active { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.crm__key { width: 8px; height: 8px; border-radius: 50%; background: var(--c-off); }
.crm__item--sent .crm__key { background: var(--c-sent); }
.crm__item--pending .crm__key { background: var(--c-pending); }
.crm__item--failed .crm__key { background: var(--c-failed); }

/* ---------- breakdowns ---------- */

.breakdowns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.breakdown__empty { padding: 12px 0; font-size: 13px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank__row {
	--pct: 0%;
	position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; overflow: hidden;
	border: 1px solid var(--border); font-size: 13.5px; isolation: isolate;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.rank__row::before {
	content: ""; position: absolute; inset: 0; z-index: -1; width: var(--pct);
	background: linear-gradient(90deg, var(--accent-soft), color-mix(in srgb, var(--accent) 3%, transparent));
}
.rank__row:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.rank__row.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.rank__pos { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank__name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank__name .mono { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.rank__count { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank__count small { margin-left: 6px; font-weight: 500; font-size: 11.5px; color: var(--faint); }
.cc { display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--brand-100); color: var(--brand); font: 700 10.5px/1 var(--mono); letter-spacing: 0.04em; }
:root[data-theme="dark"] .cc { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- filters ---------- */

.table-card { overflow: hidden; scroll-margin-top: 100px; }
.filters { display: grid; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.filters__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters__head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.filters__head p { font-size: 12.5px; }
.filters__row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

.search { position: relative; flex: 0 1 380px; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search kbd {
	position: absolute; right: 10px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-strong);
	font: 600 11px var(--mono); color: var(--faint); background: var(--surface-2);
}
.search input,
.select select {
	height: var(--control); width: 100%;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border-strong); border-radius: 12px;
	font: 400 13.5px var(--font); box-shadow: 0 1px 2px rgba(14, 27, 38, 0.04);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.search input { padding: 0 40px 0 42px; }
.search input::placeholder { color: var(--faint); }
.search input:focus + kbd { display: none; }
.select { flex: 1 1 170px; max-width: 230px; position: relative; display: grid; gap: 6px; }
.select > span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.select select { appearance: none; padding: 0 36px 0 14px; cursor: pointer; }
.select::after { content: ""; position: absolute; right: 16px; bottom: 18px; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); pointer-events: none; }
.select select option { background: var(--surface); color: var(--text); }
.search input:focus,
.select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
.js .filters__apply { display: none; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; }

.leads { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.leads th {
	padding: 11px 12px; text-align: left; white-space: nowrap;
	background: var(--surface-2); border-bottom: 1px solid var(--border);
	font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}
.leads th:first-child,
.leads td:first-child { padding-left: 24px; }
.leads th:last-child,
.leads td:last-child { padding-right: 24px; }
.th-sort { display: inline-flex; align-items: center; gap: 5px; }
.th-sort:hover { color: var(--text); }
.th-sort svg { width: 8px; height: 11px; fill: currentColor; stroke: none; opacity: 0.35; }
.th-sort.is-asc,
.th-sort.is-desc { color: var(--accent-ink); }
.th-sort.is-asc svg,
.th-sort.is-desc svg { opacity: 1; }
.th-sort.is-asc svg path:last-child,
.th-sort.is-desc svg path:first-child { opacity: 0.25; }

.leads td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.leads tbody tr { cursor: pointer; transition: background-color 0.12s, box-shadow 0.12s; }
.leads tbody tr:hover,
.leads tbody tr:focus-visible { background: var(--surface-hover); outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.leads tbody tr:hover .person__name { color: var(--accent-ink); }
.leads tbody tr:last-child td { border-bottom: 0; }

.person { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.person > span:last-child { display: flex; flex-direction: column; }
.person__name { font-weight: 600; transition: color 0.12s; }
.person__ref { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.contact { display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact:hover { color: var(--accent-ink); }
.contact--line { display: flex; align-items: center; gap: 8px; }
.contact--line .cc { height: 16px; font-size: 9.5px; }
.contact--phone { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: left; }
.profile,
.campaign { display: flex; flex-direction: column; }
.profile small,
.campaign small { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.profile > span,
.campaign > span { white-space: nowrap; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; white-space: nowrap; }
.leads time { display: flex; flex-direction: column; white-space: nowrap; }
.leads time small { color: var(--faint); font-size: 11.5px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; padding: 18px 24px; border-top: 1px solid var(--border); }
.pager__btn { min-width: 38px; height: 38px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
a.pager__btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.pager__btn.is-current { background: var(--accent-gradient); border-color: transparent; color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(33, 80, 115, 0.25); }
.pager__gap { color: var(--faint); padding: 0 4px; }

.empty { display: grid; justify-items: center; gap: 8px; padding: 64px 20px; text-align: center; }
.empty svg { width: 46px; height: 46px; padding: 11px; border-radius: 14px; color: var(--accent-ink); background: var(--accent-soft); }
.empty h3 { font-size: 16px; margin-top: 6px; }
.empty .btn { margin-top: 8px; }

/* ---------- lead drawer ---------- */

.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(8, 21, 31, 0.45); backdrop-filter: blur(4px); animation: fade 0.2s ease; }
.drawer__panel {
	position: absolute; top: 14px; right: 14px; bottom: 14px; width: min(490px, calc(100% - 28px));
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
	box-shadow: var(--shadow-pop); animation: slide 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer__head {
	position: relative; isolation: isolate; display: flex; align-items: flex-start; gap: 14px; padding: 24px 24px 20px;
	background: var(--side-bg); color: #fff;
}
.drawer__head::after { content: ""; position: absolute; z-index: -1; right: -60px; top: -90px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(closest-side, rgba(130, 175, 210, 0.25), transparent); }
.drawer__head .avatar { background: #fff; color: var(--brand); }
.drawer__head .person__ref { color: rgba(255, 255, 255, 0.6); }
.drawer__head .icon-btn { background: transparent; border-color: rgba(255, 255, 255, 0.18); color: rgba(255, 255, 255, 0.8); }
.drawer__head .icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.drawer__head > div { flex: 1; min-width: 0; }
.drawer__head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.drawer__head p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.drawer__head .badge { background: rgba(255, 255, 255, 0.92); }
:root[data-theme="dark"] .drawer__head .badge { background: rgba(255, 255, 255, 0.12); }
.drawer__actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 16px 24px; }
.drawer__actions .btn { padding: 0 8px; gap: 6px; }
.drawer__hint { margin: 0 24px 14px !important; padding: 9px 12px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.drawer__body { flex: 1; overflow-y: auto; padding: 0 24px 28px; border-top: 1px solid var(--border); }
.drawer__body section { padding: 18px 0; border-bottom: 1px solid var(--border); }
.drawer__body section:last-child { border-bottom: 0; }
.drawer__body h3 { margin-bottom: 12px; font: 700 10.5px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); }
.drawer__body dl { display: grid; grid-template-columns: 120px 1fr; gap: 9px 12px; margin: 0; font-size: 13.5px; }
.drawer__body dt { color: var(--muted); }
.drawer__body dd { margin: 0; overflow-wrap: anywhere; text-align: left; font-weight: 500; }
.drawer__body dd.small { font-size: 12px; color: var(--muted); font-weight: 400; }
.drawer__body dd.mono { font-family: var(--mono); font-size: 12.5px; }
.drawer__body dd:empty::before { content: "—"; color: var(--faint); }

@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- responsive ---------- */

@media (max-width: 1320px) {
	.mainbar__range { order: 3; width: 100%; }
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
	.insights { grid-template-columns: 1fr; }
	.breakdowns { grid-template-columns: 1fr 1fr; }
	.crm { display: grid; grid-template-columns: auto 1fr; column-gap: 28px; align-items: center; }
	.crm .card__head { grid-column: 1 / -1; }
	.crm__ring { grid-row: span 2; margin: 0; }
}

@media (max-width: 960px) {
	.auth { grid-template-columns: 1fr; }
	.auth__aside { display: none; }
	.auth__card > .brand { display: inline-flex; margin-bottom: 28px; }

	.shell { grid-template-columns: minmax(0, 1fr); }
	.sidebar {
		position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw);
		transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
		box-shadow: var(--shadow-pop);
	}
	.sidebar.is-open { transform: none; }
	.sidebar__close { display: inline-grid !important; }
	.sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 21, 31, 0.5); }
	.mainbar__menu { display: inline-grid !important; }
	.mainbar,
	.content { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
	.mainbar { padding: 12px 16px; gap: 10px; }
	.mainbar__title h1 { font-size: 19px; }
	.mainbar__date { display: none; }
	.mainbar__actions .btn span { display: none; }
	.segmented { flex-wrap: nowrap; overflow-x: auto; width: 100%; min-width: 0; scrollbar-width: none; }
	.segmented span { white-space: nowrap; }
	.dates { width: 100%; flex-wrap: wrap; }
	.dates label { flex: 1; }
	.dates input { width: 100%; }
	.content { padding: 16px 16px 32px; gap: 14px; }
	.kpis { gap: 10px; }
	.kpi { padding: 16px; }
	.kpi__label svg { right: 14px; top: 14px; width: 32px !important; height: 32px !important; padding: 8px; }
	.kpi__value { font-size: 28px; }
	.breakdowns { grid-template-columns: 1fr; }
	.chart,
	.crm,
	.breakdown,
	.filters { padding: 18px; }
	.chart__plot { height: 170px; }
	.crm { grid-template-columns: 1fr; }
	.crm__ring { grid-row: auto; margin: 0 0 16px; }
	.search { flex-basis: 100%; }
	.select { flex: 1 1 140px; max-width: none; }

	/* Table rows become cards. */
	.leads thead { display: none; }
	.leads,
	.leads tbody,
	.leads tr,
	.leads td { display: block; width: 100%; }
	.leads tbody { display: grid; gap: 10px; padding: 12px; }
	.leads tr { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
	.leads tbody tr:hover { box-shadow: var(--shadow-lift); }
	.leads td,
	.leads td:first-child,
	.leads td:last-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
	.leads td::before { content: attr(data-label); flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
	.leads td:first-child { padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
	.leads td:first-child::before { display: none; }
	.leads td:nth-child(2) { flex-wrap: wrap; }
	.leads td:nth-child(2) .contact { flex-basis: 100%; max-width: 100%; text-align: right; }
	.leads td:nth-child(2) .contact--line { flex-basis: 100%; justify-content: flex-end; }
	.leads td:nth-child(2) .contact--line .contact { flex-basis: auto; }
	.leads td:nth-child(2)::before { flex-basis: 100%; text-align: left; }
	.profile,
	.campaign,
	.leads time { align-items: flex-end; }
	.person { min-width: 0; }
	.person > span:last-child { align-items: flex-start; text-align: left; }
	.drawer__panel { top: auto; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation-name: rise; }
	.drawer__actions { grid-template-columns: 1fr 1fr; }
	.drawer__body dl { grid-template-columns: 104px 1fr; }
}

@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
