/* ==========================================================================
   Scanluma Admin — statistics dashboard (separate, signed-in environment)
   Loads on top of app.css; only admin-specific surfaces live here.
   ========================================================================== */

:root {
	--adm-churned: oklch(55% 0.2 25);
	--adm-churned-tint: oklch(55% 0.2 25 / 0.12);
	--adm-dormant: oklch(58% 0.13 78);
	--adm-dormant-tint: oklch(78% 0.15 78 / 0.2);
	--adm-activated: var(--success);
	--adm-activated-tint: var(--success-tint);
}

/* ---- Header variant: no product nav, no quota ---- */
.adm-header .app-header-right {
	gap: 12px;
}
.adm-tag {
	font-family: var(--font-mono);
	font-size: 10.5px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--fg-nav);
	background: var(--surface-2);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-pill);
	padding: 4px 9px;
	align-self: center;
}
.adm-user {
	font-size: 13px;
	color: var(--fg-muted);
	max-width: 34ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---- Stat cards ---- */
.adm-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: var(--space-4);
}
.adm-stat {
	background: var(--surface-1);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card);
	padding: var(--space-5);
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}
.adm-stat-label {
	font-size: 13px;
	color: var(--fg-muted);
}
.adm-stat-value {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(24px, 3vw, 30px);
	letter-spacing: var(--tracking-snug);
	color: var(--fg-heading);
	overflow-wrap: anywhere;
}
.adm-stat-value--sm {
	font-size: clamp(18px, 2.2vw, 22px);
}
.adm-stat-meta {
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.02em;
	color: var(--fg-muted);
}

/* ---- Users panel ---- */
.adm-panel {
	background: var(--surface-1);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card);
	padding: var(--space-6);
}
.adm-panel-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-4);
	flex-wrap: wrap;
	margin-bottom: var(--space-5);
}
.adm-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-4);
	margin-bottom: var(--space-5);
}
.adm-toolbar-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	flex: 1 1 180px;
	min-width: 0;
}
.adm-toolbar-field--grow {
	flex: 2 1 260px;
}
.adm-toolbar-label {
	font-family: var(--font-mono);
	font-size: 10.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fg-muted);
}
.adm-search {
	width: 100%;
	height: 38px;
	padding: 0 13px;
	font-family: inherit;
	font-size: 14px;
	color: var(--fg-primary);
	background: var(--surface-1);
	border: 1px solid var(--border-medium);
	border-radius: var(--radius-sm);
}
.adm-search:hover {
	border-color: var(--border-strong);
}
.adm-search:focus {
	outline: 2px solid var(--accent-border);
	outline-offset: 1px;
}

/* ---- Table ---- */
.adm-table-scroll {
	overflow-x: auto;
	margin: 0 calc(var(--space-6) * -1);
}
.adm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	white-space: nowrap;
}
.adm-table th {
	font-family: var(--font-mono);
	font-size: 10.5px;
	font-weight: 400;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fg-muted);
	text-align: left;
	padding: 0 var(--space-4) 10px 0;
	border-bottom: 1px solid var(--border-subtle);
}
.adm-table td {
	padding: 13px var(--space-4) 13px 0;
	border-bottom: 1px solid var(--border-subtle);
	color: var(--fg-heading);
	font-weight: 600;
	vertical-align: middle;
}
.adm-table tbody tr:last-child td {
	border-bottom: none;
}
.adm-table tbody tr:hover {
	background: var(--surface-2-alt);
}
/* Outer cells carry the panel gutter so the row hover runs edge to edge
   while the text stays aligned with the panel content. */
.adm-table th:first-child,
.adm-table td:first-child {
	padding-left: var(--space-6);
}
.adm-table th:last-child,
.adm-table td:last-child {
	padding-right: var(--space-6);
}
.adm-col-num {
	font-family: var(--font-mono);
	font-weight: 400;
}
.adm-email {
	font-weight: 700;
	color: var(--fg-heading);
	overflow-wrap: anywhere;
}
.adm-empty {
	color: var(--fg-muted);
	font-weight: 400;
}

/* ---- Pills ---- */
.adm-plan,
.adm-status {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.03em;
	border-radius: var(--radius-pill);
	padding: 3px 10px;
	white-space: nowrap;
}
.adm-plan--free {
	background: var(--surface-2);
	color: var(--fg-nav);
	border: 1px solid var(--border-medium);
}
.adm-plan--pro {
	background: var(--success-tint);
	color: var(--success);
	border: 1px solid var(--success-tint);
}
.adm-status {
	font-weight: 700;
}
.adm-status--activated {
	background: var(--adm-activated-tint);
	color: var(--adm-activated);
}
.adm-status--dormant {
	background: var(--adm-dormant-tint);
	color: var(--adm-dormant);
}
.adm-status--churned {
	background: var(--adm-churned-tint);
	color: var(--adm-churned);
}
.adm-status--never-activated {
	background: var(--surface-2);
	color: var(--fg-muted);
	border: 1px solid var(--border-medium);
}

/* ---- Toolbar actions (Clear filters) ---- */
.adm-toolbar-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex: 0 0 auto;
}

/* ---- Sortable column headers ---- */
.adm-sort-link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}
.adm-sort-link:hover,
.adm-sort-link:focus-visible {
	color: var(--fg-heading);
	text-decoration: none;
}
.adm-sort-icon {
	flex-shrink: 0;
	opacity: 0.45;
}
.adm-th-sortable.is-sorted .adm-sort-link {
	color: var(--fg-heading);
}
.adm-th-sortable.is-sorted .adm-sort-icon {
	opacity: 1;
}

/* ---- Empty result row ---- */
.adm-table-empty td {
	text-align: center;
	padding: var(--space-6) 0;
}
.adm-table tbody tr.adm-table-empty:hover {
	background: transparent;
}

/* ---- Responsive: stacked cards below the table breakpoint ---- */
@media (max-width: 860px) {
	.adm-panel {
		padding: var(--space-5);
	}
	.adm-table-scroll {
		overflow-x: visible;
		margin: 0;
	}
	.adm-table td:first-child,
	.adm-table td:last-child {
		padding-left: 0;
		padding-right: 0;
	}
	.adm-table,
	.adm-table tbody,
	.adm-table tr,
	.adm-table td {
		display: block;
		width: 100%;
	}
	.adm-table thead {
		display: none;
	}
	.adm-table {
		white-space: normal;
	}
	.adm-table tbody tr {
		border: 1px solid var(--border-subtle);
		border-radius: var(--radius-sm);
		padding: var(--space-4);
		margin-bottom: var(--space-3);
		background: var(--surface-1);
	}
	.adm-table tbody tr:hover {
		background: var(--surface-1);
	}
	.adm-table tbody tr:last-child {
		margin-bottom: 0;
	}
	.adm-table td {
		display: grid;
		grid-template-columns: 13ch minmax(0, 1fr);
		gap: var(--space-4);
		align-items: baseline;
		padding: 6px 0;
		border-bottom: none;
		font-size: 13.5px;
	}
	.adm-table td::before {
		content: attr(data-label);
		font-family: var(--font-mono);
		font-size: 10.5px;
		font-weight: 400;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: var(--fg-muted);
	}
	.adm-table td.adm-cell-email {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		padding-bottom: 10px;
		margin-bottom: 6px;
		border-bottom: 1px solid var(--border-subtle);
		font-size: 14.5px;
	}
	.adm-table td.adm-cell-email::before {
		display: none;
	}
	.adm-table-empty td {
		grid-template-columns: minmax(0, 1fr);
		text-align: left;
	}
	.adm-table-empty td::before {
		display: none;
	}
}

@media (max-width: 480px) {
	.adm-stats {
		grid-template-columns: 1fr;
	}
	.adm-toolbar-field {
		flex: 1 1 100%;
	}
	.adm-user {
		display: none;
	}
}
