:root {
	--acc-bg: #f6f7fb;
	--acc-surface: #ffffff;
	--acc-border: #e6e8ef;
	--acc-text: #111827;
	--acc-text-muted: #6b7280;
	--acc-text-faint: #9aa1b1;
	--acc-primary: #4f46e5;
	--acc-primary-hover: #4338ca;
	--acc-primary-soft: #eef2ff;
	--acc-danger: #dc2626;
	--acc-danger-soft: #fef2f2;
	--acc-radius-lg: 14px;
	--acc-radius-sm: 7px;
	--acc-shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.06);
	--acc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color-scheme: light;
}

/* Kept in sync with assets/css/app.css's token set — same three-state
   (system / explicit light / explicit dark) pattern, see header.php for
   the blocking inline script that sets data-theme before first paint. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--acc-bg: #0b0d12;
		--acc-surface: #171922;
		--acc-border: #2a2d3a;
		--acc-text: #e8e9ee;
		--acc-text-muted: #9aa1b1;
		--acc-text-faint: #6b7280;
		--acc-primary: #6366f1;
		--acc-primary-hover: #818cf8;
		--acc-primary-soft: rgba(99, 102, 241, 0.16);
		--acc-danger: #f87171;
		--acc-danger-soft: rgba(220, 38, 38, 0.14);
		--acc-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--acc-bg: #0b0d12;
	--acc-surface: #171922;
	--acc-border: #2a2d3a;
	--acc-text: #e8e9ee;
	--acc-text-muted: #9aa1b1;
	--acc-text-faint: #6b7280;
	--acc-primary: #6366f1;
	--acc-primary-hover: #818cf8;
	--acc-primary-soft: rgba(99, 102, 241, 0.16);
	--acc-danger: #f87171;
	--acc-danger-soft: rgba(220, 38, 38, 0.14);
	--acc-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* {
	box-sizing: border-box;
}

body.acc-auth-page {
	margin: 0;
	background: var(--acc-bg);
	color: var(--acc-text);
	font-family: var(--acc-font);
	-webkit-font-smoothing: antialiased;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 1.5rem;
}

.acc-auth-shell {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
}

.acc-auth-card {
	background: var(--acc-surface);
	border: 1px solid var(--acc-border);
	border-radius: var(--acc-radius-lg);
	box-shadow: var(--acc-shadow);
	padding: 2rem;
	width: 100%;
	max-width: 420px;
}

.acc-auth-card h1 {
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 0 0 0.6rem;
	color: var(--acc-text);
}

.acc-auth-card h1.acc-brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 1.25rem;
}

/* Same white-chip treatment as app.css — the logo SVG's baked-in dark text
   needs it in dark mode; kept unconditional for one consistent look. */
/* The wrapped inline SVG's dark-text paths use fill="currentColor" (edited
   into the vendored file) — setting color here is what makes the logo's
   text repaint for dark mode. The auth card's own background/text already
   follow --acc-surface/--acc-text with the theme, so no override is needed
   here the way app.css needs one for the always-dark sidebar. */
.acc-logo-img {
	display: block;
	flex-shrink: 0;
	color: var(--acc-text);
}

.acc-logo-img svg {
	height: 30px;
	width: auto;
	display: block;
}

.acc-brand-text {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.acc-brand-divider {
	opacity: 0.35;
	font-weight: 400;
}

.acc-product-name {
	color: var(--acc-text-muted);
	font-weight: 500;
}

.acc-auth-card p {
	color: var(--acc-text-muted);
	font-size: 0.9rem;
	line-height: 1.5;
}

.acc-auth-card form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.acc-auth-card label {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--acc-text-muted);
	margin-top: 0.5rem;
}

.acc-auth-card input[type="email"],
.acc-auth-card input[type="password"],
.acc-auth-card input[type="text"] {
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--acc-border);
	border-radius: var(--acc-radius-sm);
	font-size: 0.95rem;
	background: var(--acc-surface);
	color: var(--acc-text);
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.acc-auth-card input:focus {
	outline: none;
	border-color: var(--acc-primary);
	box-shadow: 0 0 0 3px var(--acc-primary-soft);
}

.acc-auth-card button,
.acc-button {
	margin-top: 1rem;
	padding: 0.7rem;
	border: none;
	border-radius: var(--acc-radius-sm);
	background: var(--acc-primary);
	color: #fff;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	display: inline-block;
	transition: background-color 0.12s ease;
}

.acc-auth-card button:hover,
.acc-button:hover {
	background: var(--acc-primary-hover);
}

.acc-button-secondary {
	width: 100%;
	background: var(--acc-surface);
	color: var(--acc-primary);
	border: 1px solid var(--acc-border);
	font: inherit;
	font-weight: 600;
}

.acc-button-secondary:hover {
	background: var(--acc-primary-soft);
	border-color: var(--acc-primary);
}

.acc-auth-error {
	background: var(--acc-danger-soft);
	color: var(--acc-danger);
	padding: 0.6rem 0.7rem;
	border-radius: var(--acc-radius-sm);
	font-size: 0.87rem;
}

/* First-run hint on the login page while no owner exists. */
.acc-auth-card p.acc-auth-notice {
	background: var(--acc-primary-soft);
	color: var(--acc-text);
	padding: 0.6rem 0.7rem;
	border-radius: var(--acc-radius-sm);
	font-size: 0.87rem;
	line-height: 1.5;
}

.acc-qr {
	display: flex;
	justify-content: center;
	margin: 1rem 0;
}

.acc-qr svg {
	max-width: 220px;
	height: auto;
	border: 1px solid var(--acc-border);
	border-radius: var(--acc-radius-sm);
}

.acc-secret,
.acc-uri {
	display: inline-block;
	word-break: break-all;
	background: var(--acc-bg);
	color: var(--acc-text);
	padding: 0.45rem 0.6rem;
	border-radius: var(--acc-radius-sm);
	font-size: 0.87rem;
}

details {
	font-size: 0.87rem;
	color: var(--acc-text-muted);
	margin-top: 0.75rem;
}

details summary {
	cursor: pointer;
	font-weight: 600;
}

.acc-backup-codes {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.5rem;
}

.acc-backup-codes code {
	display: block;
	background: var(--acc-bg);
	color: var(--acc-text);
	padding: 0.5rem;
	border-radius: var(--acc-radius-sm);
	text-align: center;
	font-size: 0.87rem;
}

/* --- Theme switcher (shown on every acc-auth-page) --- */

.acc-theme-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	border: 1px solid var(--acc-border);
	background: var(--acc-surface);
	color: var(--acc-text-muted);
	cursor: pointer;
	box-shadow: var(--acc-shadow);
	padding: 0;
	transition: color 0.12s ease, border-color 0.12s ease;
}

.acc-theme-toggle:hover {
	color: var(--acc-primary);
	border-color: var(--acc-primary);
}

.acc-theme-toggle svg {
	width: 18px;
	height: 18px;
}

.acc-theme-switch-fixed {
	position: fixed;
	top: 1.25rem;
	right: 1.25rem;
}
