/* ParkHelp portal design system (RDDEV-1851). No dependencies, no build.
   Tokens first; light theme by default, dark via prefers-color-scheme or
   the theme toggle (html[data-theme]). */

:root {
	--brand: #0076a3;
	--brand-strong: #005f83;
	--brand-soft: #e3f2f8;
	--bg: #f4f6f9;
	--surface: #ffffff;
	--surface-2: #f8fafc;
	--surface-3: #eef2f6;
	--border: #e2e8f0;
	--border-strong: #cbd5e1;
	--text: #0f172a;
	--text-2: #475569;
	--text-3: #64748b;
	--ok: #15803d;
	--ok-soft: #dcfce7;
	--warn: #a16207;
	--warn-soft: #fef3c7;
	--bad: #b91c1c;
	--bad-soft: #fee2e2;
	--info: #1d4ed8;
	--info-soft: #dbeafe;
	--sidebar-bg: #0b1f2e;
	--sidebar-text: #b8c7d3;
	--sidebar-text-strong: #ffffff;
	--sidebar-hover: rgba(255, 255, 255, .06);
	--sidebar-active: rgba(56, 189, 248, .14);
	--sidebar-accent: #38bdf8;
	--focus: 0 0 0 3px rgba(0, 118, 163, .28);
	--shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
	--shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .04);
	--radius: 10px;
	--radius-sm: 7px;
	--sidebar-w: 248px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--brand: #38a9d6;
		--brand-strong: #63bfe3;
		--brand-soft: rgba(56, 169, 214, .14);
		--bg: #0b1118;
		--surface: #121a23;
		--surface-2: #16202b;
		--surface-3: #1c2834;
		--border: #243241;
		--border-strong: #33465a;
		--text: #e6edf3;
		--text-2: #a9b6c3;
		--text-3: #8293a3;
		--ok: #4ade80;
		--ok-soft: rgba(74, 222, 128, .12);
		--warn: #fbbf24;
		--warn-soft: rgba(251, 191, 36, .12);
		--bad: #f87171;
		--bad-soft: rgba(248, 113, 113, .13);
		--info: #93c5fd;
		--info-soft: rgba(147, 197, 253, .12);
		--sidebar-bg: #070d13;
		--focus: 0 0 0 3px rgba(56, 169, 214, .35);
		--shadow-sm: none;
		--shadow: 0 0 0 1px rgba(255, 255, 255, .02);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--brand: #38a9d6;
	--brand-strong: #63bfe3;
	--brand-soft: rgba(56, 169, 214, .14);
	--bg: #0b1118;
	--surface: #121a23;
	--surface-2: #16202b;
	--surface-3: #1c2834;
	--border: #243241;
	--border-strong: #33465a;
	--text: #e6edf3;
	--text-2: #a9b6c3;
	--text-3: #8293a3;
	--ok: #4ade80;
	--ok-soft: rgba(74, 222, 128, .12);
	--warn: #fbbf24;
	--warn-soft: rgba(251, 191, 36, .12);
	--bad: #f87171;
	--bad-soft: rgba(248, 113, 113, .13);
	--info: #93c5fd;
	--info-soft: rgba(147, 197, 253, .12);
	--sidebar-bg: #070d13;
	--focus: 0 0 0 3px rgba(56, 169, 214, .35);
	--shadow-sm: none;
	--shadow: 0 0 0 1px rgba(255, 255, 255, .02);
	color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.5 var(--font);
	-webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre {
	margin: 0;
	padding: 14px 16px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	overflow: auto;
	max-height: 70vh;
	white-space: pre-wrap;
	word-break: break-word;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
img { max-width: 100%; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -3px; }

/* ---- Shell: sidebar + main ---------------------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--sidebar-w);
	display: flex;
	flex-direction: column;
	background: var(--sidebar-bg);
	color: var(--sidebar-text);
	z-index: 40;
	transition: transform .2s ease;
}
.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 20px;
	color: var(--sidebar-text-strong);
	font-weight: 700;
	font-size: 16px;
	letter-spacing: -.01em;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: linear-gradient(135deg, #0ea5e9, #0076a3);
	color: #fff;
	font-weight: 800;
	font-size: 16px;
}
.brand-sub { display: block; font-size: 11.5px; font-weight: 500; color: var(--sidebar-text); letter-spacing: 0; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.nav-section {
	margin: 18px 10px 6px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: #6b8093;
}
.nav a {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 8px 10px;
	margin: 1px 0;
	border-radius: 8px;
	color: var(--sidebar-text);
	font-weight: 500;
}
.nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.nav a.active .icon { color: var(--sidebar-accent); }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 12px; color: #6b8093; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 12px;
	height: 60px;
	padding: 0 28px;
	background: color-mix(in srgb, var(--bg) 85%, transparent);
	backdrop-filter: saturate(1.4) blur(8px);
	-webkit-backdrop-filter: saturate(1.4) blur(8px);
	border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.topbar { background: var(--bg); }
}
.topbar-title { font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 13px; border-radius: 999px; padding: 2px 10px 2px 2px; }
.user-chip:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.avatar {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--brand-soft);
	color: var(--brand);
	font-weight: 700;
	font-size: 12px;
}
.menu-toggle { display: none; }
.view-as .select { width: auto; height: 32px; font-size: 13px; padding: 0 8px; }
.view-as-note form { margin-left: 8px; }

.content { flex: 1; width: 100%; max-width: 1440px; padding: 26px 28px 40px; }
.footer { padding: 18px 28px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-3); }

.scrim { display: none; }

@media (max-width: 960px) {
	.sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
	.nav-open .sidebar { transform: none; }
	.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 12, .45); z-index: 35; }
	.main { margin-left: 0; }
	.menu-toggle { display: inline-flex; }
	.topbar { padding: 0 16px; }
	.content { padding: 20px 16px 32px; }
	.user-chip .user-name { display: none; }
	.view-as .select { max-width: 120px; }
}

/* ---- Cards, grids -------------------------------------------------------- */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	margin-bottom: 20px;
	min-width: 0;
}
.card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding: 14px 18px;
	border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: start; }
.grid > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-sidebar { grid-template-columns: minmax(0, 1fr); } }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.stat {
	padding: 16px 18px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.stat-value { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.stat.tone-ok .stat-value { color: var(--ok); }
.stat.tone-warn .stat-value { color: var(--warn); }
.stat.tone-bad .stat-value { color: var(--bad); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
a.stat { color: inherit; display: block; }

/* ---- Tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
	position: sticky;
	top: 0;
	padding: 10px 14px;
	background: var(--surface-2);
	color: var(--text-2);
	font-size: 12px;
	font-weight: 600;
	text-align: left;
	text-transform: uppercase;
	letter-spacing: .03em;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table tr.is-selected td { background: var(--brand-soft); }
.table-compact td, .table-compact th { padding: 7px 12px; }
.table .check { width: 36px; }
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 8px 18px; margin: 0; }
dl.kv dt { color: var(--text-3); font-size: 13px; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty-state h2 { color: var(--text); }

/* ---- Badges, alerts ----------------------------------------------------- */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 18px;
	white-space: nowrap;
	background: var(--surface-3);
	color: var(--text-2);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.alert {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 12px 14px;
	margin-bottom: 16px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	background: var(--info-soft);
	color: var(--text);
}
.alert .icon { margin-top: 1px; color: var(--info); }
.alert-ok { background: var(--ok-soft); }
.alert-ok .icon { color: var(--ok); }
.alert-warn { background: var(--warn-soft); }
.alert-warn .icon { color: var(--warn); }
.alert-bad { background: var(--bad-soft); }
.alert-bad .icon { color: var(--bad); }
.alert p:last-child { margin-bottom: 0; }

.secret-box {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 10px 12px;
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	font-family: var(--mono);
	font-size: 13px;
	overflow-wrap: anywhere;
}
.secret-box code { flex: 1; min-width: 0; }

/* ---- Forms and buttons -------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	height: 36px;
	padding: 0 14px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-weight: 550;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
form.inline { display: inline; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--bad); }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input, .select, .textarea,
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=url],
.field input[type=date], .field input[type=datetime-local], .field input[type=email], .field select, .field textarea {
	width: 100%;
	height: 36px;
	padding: 0 11px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	transition: border-color .15s, box-shadow .15s;
}
.textarea, .field textarea { height: auto; min-height: 96px; padding: 9px 11px; line-height: 1.45; resize: vertical; }
.textarea.mono, .field textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.input:focus, .select:focus, .textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.field input[type=file] { font: inherit; color: var(--text-2); }
.check-row { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--brand); }
input[type=checkbox] { accent-color: var(--brand); }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.toolbar .field { margin: 0; }
.toolbar .field > label { font-size: 12px; }
.toolbar .input, .toolbar .select { min-width: 150px; }

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span {
	display: inline-grid;
	place-items: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	color: var(--text-2);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}
.pagination a:hover { background: var(--surface-3); text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .gap { border: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px; color: var(--text); }
.list a:hover { background: var(--surface-2); text-decoration: none; }
.list a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---- Login --------------------------------------------------------------- */

.auth-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 24px 16px;
	background:
		radial-gradient(1200px 500px at 10% -10%, rgba(14, 165, 233, .18), transparent 60%),
		radial-gradient(900px 500px at 110% 110%, rgba(0, 118, 163, .16), transparent 60%),
		var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card-body { padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 19px; border-radius: 11px; }
.auth-brand strong { display: block; font-size: 18px; }
.auth-brand span { color: var(--text-3); font-size: 13px; }

@media print {
	.sidebar, .topbar, .footer, .page-actions, .btn { display: none !important; }
	.main { margin: 0; }
}
