/* Sign-in screen. Tokens follow coss ui naming; the dashboard uses the React app's own CSS (app/src/index.css). */

/* ---------- Tokens: dark is the default ---------- */
:root {
	color-scheme: dark;
	--background: #09090b;
	--foreground: #fafafa;
	--card: #111113;
	--muted: #18181b;
	--muted-foreground: #a1a1aa;
	--accent: #1f1f23;
	--border: #27272a;
	--input: #65656f;
	--primary: #fafafa;
	--primary-foreground: #18181b;
	--ring: #a1a1aa;
	--destructive: #f87171;
	--info: #60a5fa;
	--success: #4ade80;
	--warning: #fbbf24;
	--radius: 10px;
	--shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px -12px rgb(0 0 0 / 0.6);
	--font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
	color-scheme: light;
	--background: #fafafa;
	--foreground: #09090b;
	--card: #ffffff;
	--muted: #f4f4f5;
	--muted-foreground: #52525b;
	--accent: #f4f4f5;
	--border: #e4e4e7;
	--input: #8b8b94;
	--primary: #18181b;
	--primary-foreground: #fafafa;
	--ring: #71717a;
	--destructive: #dc2626;
	--info: #2563eb;
	--success: #16a34a;
	--warning: #b45309;
	--shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 12px 32px -16px rgb(0 0 0 / 0.18);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--background);
	color: var(--foreground);
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.5;
	font-feature-settings: "cv11", "ss01";
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.015em;
}

p { margin: 0; }

a { color: inherit; }

:focus-visible {
	outline: 2px solid var(--ring);
	outline-offset: 2px;
}

.muted { color: var(--muted-foreground); }

.icon {
	width: 16px;
	height: 16px;
	flex: none;
}

/* ---------- Brand ---------- */
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.brand-mark {
	width: 28px;
	height: 28px;
	flex: none;
}

.brand-mark rect { fill: var(--foreground); }

.brand-mark path {
	fill: none;
	stroke: var(--background);
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- Controls ---------- */
.controls {
	display: flex;
	align-items: center;
	gap: 8px;
}

.segmented {
	display: inline-flex;
	padding: 2px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card);
}

.segmented-item {
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 8px;
	border-radius: 6px;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 500;
	color: var(--muted-foreground);
	text-decoration: none;
}

.segmented-item:hover { color: var(--foreground); }

.segmented-item[aria-current="true"] {
	background: var(--accent);
	color: var(--foreground);
	box-shadow: inset 0 0 0 1px var(--border);
}

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card);
	color: var(--muted-foreground);
	cursor: pointer;
}

.icon-btn:hover { color: var(--foreground); background: var(--accent); }

/* Show the icon of the theme you'd switch to. */
:root:not([data-theme="light"]) .icon-btn .icon-moon,
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 36px;
	padding: 0 14px;
	border: 1px solid transparent;
	border-radius: 8px;
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s, opacity 0.15s;
}

.btn-primary {
	background: var(--primary);
	color: var(--primary-foreground);
}

.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
	background: transparent;
	color: var(--muted-foreground);
}

.btn-ghost:hover { background: var(--accent); color: var(--foreground); }

.btn-block {
	width: 100%;
	height: 40px;
}

.btn:disabled {
	opacity: 0.6;
	cursor: progress;
}

/* ---------- Card ---------- */
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) + 4px);
	box-shadow: var(--shadow);
}

/* ---------- Form ---------- */
.auth-form {
	display: grid;
	gap: 16px;
}

.field {
	display: grid;
	gap: 6px;
}

.field label { font-weight: 500; }

.field-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.link-muted {
	color: var(--muted-foreground);
	font-size: 13px;
	text-decoration: none;
}

.link-muted:hover {
	color: var(--foreground);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.input {
	width: 100%;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--input);
	border-radius: 8px;
	background: var(--background);
	color: var(--foreground);
	font: inherit;
	font-size: 14px;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus-visible {
	outline: none;
	border-color: var(--ring);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}

.input[aria-invalid="true"] { border-color: var(--destructive); }

.input[aria-invalid="true"]:focus-visible {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 30%, transparent);
}

.input-group { position: relative; }

.input-group .input { padding-right: 44px; }

.input-addon {
	position: absolute;
	top: 4px;
	right: 4px;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--muted-foreground);
	cursor: pointer;
}

.input-addon:hover { color: var(--foreground); background: var(--accent); }

.input-addon .icon-eye-off,
.input-addon[aria-pressed="true"] .icon-eye { display: none; }

.input-addon[aria-pressed="true"] .icon-eye-off { display: block; }

.checkbox {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	color: var(--muted-foreground);
	cursor: pointer;
}

.checkbox input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--primary);
}

/* ---------- Notices ---------- */
.notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid;
	border-radius: 8px;
	font-size: 13.5px;
}

.notice .icon { margin-top: 2px; }

.notice-error {
	border-color: color-mix(in srgb, var(--destructive) 45%, transparent);
	background: color-mix(in srgb, var(--destructive) 10%, transparent);
}

.notice-error .icon { color: var(--destructive); }

.notice-info {
	border-color: color-mix(in srgb, var(--info) 45%, transparent);
	background: color-mix(in srgb, var(--info) 10%, transparent);
}

.notice-info .icon { color: var(--info); }

/* ---------- Auth screen ---------- */
.vigie-auth {
	background:
		radial-gradient(900px 480px at 50% -8%, color-mix(in srgb, var(--info) 9%, transparent), transparent 70%),
		var(--background);
}

.auth-shell {
	position: relative;
	display: grid;
	grid-template-rows: auto 1fr;
	min-height: 100vh;
	min-height: 100dvh;
	overflow: hidden;
}

.auth-shell::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-image: radial-gradient(color-mix(in srgb, var(--foreground) 14%, transparent) 1px, transparent 1px);
	background-size: 22px 22px;
	-webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
	mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
	pointer-events: none;
}

.auth-top,
.auth-main { position: relative; z-index: 1; }

.auth-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
}

.auth-main {
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 20px;
	padding: 24px 16px 96px;
}

.auth-card {
	display: grid;
	gap: 20px;
	width: min(100vw - 32px, 400px);
	padding: 32px;
}

.auth-heading {
	display: grid;
	gap: 6px;
}

.auth-foot {
	color: var(--muted-foreground);
	font-size: 12.5px;
	text-align: center;
}

.auth-pulse {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 24px;
	z-index: 0;
	width: 100%;
	height: 80px;
	pointer-events: none;
}

.auth-pulse path {
	fill: none;
	stroke: var(--success);
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	opacity: 0.35;
	stroke-dasharray: 1600;
	stroke-dashoffset: 1600;
	animation: vigie-pulse 6s linear infinite;
}

@keyframes vigie-pulse {
	to { stroke-dashoffset: -1600; }
}

/* ---------- Responsive & motion ---------- */
@media (max-width: 640px) {
	.auth-top { padding: 12px 16px; }
	.auth-card { padding: 24px 20px; }
	.input { font-size: 16px; } /* no iOS zoom on focus */
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
	.auth-pulse path { stroke-dashoffset: 0; }
}
