/*
 * TabIS — veřejné stránky přihlášení (Sign:*): přihlášení, 2FA, obnova a reset hesla, registrace.
 * Rám: Sign/@layout.latte. Barvy navazují na layout.css (lesní zelená + tmavý sidebar).
 * Tmavý režim: html[data-theme="dark"] (stejný přepínač jako zbytek webu, theme-toggle.js).
 */

:root {
	--a-bg: #f4f6f3;
	--a-surface: #ffffff;
	--a-text: #1c2420;
	--a-muted: #5d6862;
	--a-border: #cfd6d1;
	--a-border-soft: #e2e6e2;
	--a-input: #ffffff;
	--a-accent: #1f7a4d;
	--a-accent-hover: #18633e;
	--a-accent-soft: #e2f0e7;
	--a-accent-text: #17603b;
	--a-ink: #1c2420;
	--a-ink-hover: #2c3731;
	--a-ink-text: #ffffff;
	--a-ring: rgba(31, 122, 77, .22);
	--a-brand-bg: #13201a;
	--a-brand-text: #c8d3cc;
	--a-brand-muted: #8b9b92;
	--a-brand-accent: #5fd39c;
	--a-danger: #b42318;
	--a-danger-soft: #fdecea;
	--a-warning: #6b4a00;
	--a-warning-soft: #fff4dc;
	--a-info: #1b4f8a;
	--a-info-soft: #e8f1fb;
	--a-success-soft: #e2f0e7;
	--a-radius: 12px;
	--a-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--a-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
	color-scheme: light;
}

html[data-theme="dark"] {
	--a-bg: #1a1d23;
	--a-surface: #22262e;
	--a-text: #e1e5ec;
	--a-muted: #a0a8b6;
	--a-border: #434a57;
	--a-border-soft: #333843;
	--a-input: #1a1d23;
	--a-accent: #2a8f5c;
	--a-accent-hover: #33a56b;
	--a-accent-soft: rgba(76, 195, 138, .16);
	--a-accent-text: #6fdba6;
	--a-ink: #e9ecef;
	--a-ink-hover: #ffffff;
	--a-ink-text: #14171c;
	--a-ring: rgba(76, 195, 138, .3);
	--a-brand-bg: #111a15;
	--a-danger: #ff8a80;
	--a-danger-soft: rgba(255, 99, 71, .14);
	--a-warning: #ffd37a;
	--a-warning-soft: rgba(255, 193, 7, .13);
	--a-info: #9cc7ff;
	--a-info-soft: rgba(80, 150, 255, .14);
	--a-success-soft: rgba(76, 195, 138, .16);
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body.auth {
	margin: 0;
	min-height: 100vh;
	background: var(--a-bg);
	color: var(--a-text);
	font-family: var(--a-font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

body.auth a { color: var(--a-accent-text); font-weight: 600; text-decoration: none; }
body.auth a:hover { text-decoration: underline; }
html:not([data-theme="dark"]) body.auth a { color: var(--a-accent); }

/* ===== Rám: brand panel + obsah ===== */

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

.auth-brand {
	position: relative;
	flex: 0 0 min(44vw, 540px);
	background: var(--a-brand-bg);
	color: var(--a-brand-text);
	padding: 48px 52px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	overflow: hidden;
}
.auth-logo { display: inline-flex; align-items: center; gap: 12px; color: #fff !important; text-decoration: none !important; position: relative; z-index: 1; }
.auth-logo img { width: 42px; height: 42px; border-radius: 11px; background: #fff; padding: 4px; }
.auth-logo span { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-brand-copy { position: relative; z-index: 1; }
.auth-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--a-brand-accent); margin-bottom: 14px; }
.auth-claim { margin: 0; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.12; font-weight: 800; color: #fff; letter-spacing: -.03em; max-width: 13ch; }
.auth-illustration { position: absolute; left: 0; right: 0; bottom: 64px; width: 100%; height: auto; opacity: .32; color: var(--a-brand-accent); pointer-events: none; }
.auth-brand-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; font-size: 13px; color: var(--a-brand-muted); }

.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.auth-mobile-head { display: none; }
.auth-center { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-panel { width: 100%; max-width: 410px; display: flex; flex-direction: column; gap: 18px; }
.auth-panel-wide { max-width: 460px; }

.auth-foot { width: 100%; display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 20px 24px; font-size: 13px; color: var(--a-muted); }
body.auth .auth-foot a { color: var(--a-muted); font-weight: 500; }
.auth-theme-btn { border: 0; background: transparent; color: var(--a-muted); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.auth-theme-btn:hover { background: var(--a-border-soft); color: var(--a-text); }

@media (max-width: 899px) {
	.auth-brand { display: none; }
	.auth-mobile-head {
		display: flex; align-items: center; gap: 10px; width: 100%;
		background: var(--a-brand-bg); padding: 18px 20px;
	}
	.auth-mobile-head .auth-logo img { width: 34px; height: 34px; border-radius: 9px; }
	.auth-mobile-head .auth-logo span { font-size: 18px; }
	.auth-center { align-items: flex-start; padding-top: 28px; }
}

/* ===== Typografie ===== */

.auth-title { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.auth-lead { margin: -8px 0 0; color: var(--a-muted); }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-head .auth-lead { margin: 0; }
.auth-icon {
	width: 52px; height: 52px; border-radius: 14px;
	background: var(--a-accent-soft); color: var(--a-accent-text);
	display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.auth-icon-lg { width: 72px; height: 72px; border-radius: 50%; font-size: 30px; }
.auth-center-text { text-align: center; align-items: center; }
.auth-muted { color: var(--a-muted); font-size: 14px; }
.auth-small { font-size: 13px; }

/* ===== Zapamatovaný uživatel ===== */

.auth-who {
	display: flex; align-items: center; gap: 12px;
	background: var(--a-surface); border: 1px solid var(--a-border-soft);
	border-radius: 999px; padding: 6px 6px 6px 6px;
}
.auth-avatar {
	width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
	background: var(--a-accent-soft); color: var(--a-accent-text);
	display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; text-transform: uppercase;
}
.auth-avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-who-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Tlačítka ===== */

.auth-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 48px; padding: 0 20px; border-radius: 10px;
	border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 15px;
	cursor: pointer; text-decoration: none !important; transition: background-color .15s, border-color .15s, box-shadow .15s;
	width: 100%;
}
.auth-btn:focus-visible, .auth-link-btn:focus-visible, .auth-method:focus-visible, .auth-tab:focus-visible, .auth-theme-btn:focus-visible {
	outline: none; box-shadow: 0 0 0 3px var(--a-ring);
}
.auth-btn-primary { background: var(--a-accent); color: #fff !important; }
.auth-btn-primary:hover { background: var(--a-accent-hover); }
.auth-btn-lg { min-height: 54px; font-size: 16px; border-radius: 12px; }
.auth-btn-ink { background: var(--a-ink); color: var(--a-ink-text) !important; }
.auth-btn-ink:hover { background: var(--a-ink-hover); }
.auth-btn-outline { background: var(--a-surface); border-color: var(--a-border); color: var(--a-text) !important; }
.auth-btn-outline:hover { border-color: var(--a-muted); }
.auth-btn[disabled], .auth-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.auth-btn-sm { min-height: 40px; font-size: 14px; padding: 0 14px; width: auto; }
.auth-link-btn {
	border: 0; background: transparent; padding: 8px 12px; border-radius: 999px;
	color: var(--a-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.auth-link-btn:hover { color: var(--a-text); background: var(--a-border-soft); }

.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--a-muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--a-border-soft); }

/* ===== Formuláře ===== */

.auth-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.auth-label { font-size: 14px; font-weight: 600; }
.auth-label-row a { font-size: 13px; }
.auth-input {
	width: 100%; height: 48px; padding: 0 14px;
	border: 1px solid var(--a-border); border-radius: 10px;
	background: var(--a-input); color: var(--a-text);
	font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: var(--a-muted); opacity: .8; }
.auth-input:focus { outline: none; border-color: var(--a-accent); box-shadow: 0 0 0 3px var(--a-ring); }
.auth-input.is-invalid, .auth-input[aria-invalid="true"] { border-color: var(--a-danger); }
.auth-input[disabled] { opacity: .6; }
.auth-pw { position: relative; }
.auth-pw .auth-input { padding-right: 50px; }
.auth-pw-toggle {
	position: absolute; right: 2px; top: 2px; width: 44px; height: 44px;
	border: 0; background: transparent; color: var(--a-muted); border-radius: 8px; cursor: pointer;
}
.auth-pw-toggle:hover { color: var(--a-text); }
.auth-pw-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--a-ring); }
.auth-hint { font-size: 13px; color: var(--a-muted); }
.auth-field-error { font-size: 13px; color: var(--a-danger); font-weight: 600; }
.auth-field-error:empty { display: none; }
.auth-capslock { font-size: 13px; color: var(--a-warning); font-weight: 600; }

.auth-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.auth-check input { width: 18px; height: 18px; accent-color: var(--a-accent); margin: 0; flex-shrink: 0; }

.auth-otp {
	height: 60px; text-align: center; font-family: var(--a-mono);
	font-size: 28px; letter-spacing: .35em; padding-left: calc(14px + .35em);
}
.auth-otp.is-recovery { font-size: 20px; letter-spacing: .12em; padding-left: 14px; text-transform: uppercase; }

/* ===== Hlášky ===== */

.auth-alert {
	display: flex; gap: 10px; align-items: flex-start;
	padding: 12px 14px; border-radius: 10px; font-size: 14px;
	background: var(--a-info-soft); color: var(--a-info);
}
.auth-alert > i { margin-top: 3px; flex-shrink: 0; }
.auth-alert-success { background: var(--a-success-soft); color: var(--a-accent-text); }
.auth-alert-danger, .auth-alert-error { background: var(--a-danger-soft); color: var(--a-danger); }
.auth-alert-warning { background: var(--a-warning-soft); color: var(--a-warning); }

/* ===== Další způsoby přihlášení ===== */

.auth-more { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.auth-more-label { font-size: 13px; color: var(--a-muted); font-weight: 600; }
.auth-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.auth-method {
	min-height: 64px; border-radius: 10px; border: 1px solid var(--a-border); background: var(--a-surface);
	color: var(--a-text) !important; font: inherit; font-size: 12px; font-weight: 600;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
	cursor: pointer; text-decoration: none !important; padding: 6px;
}
.auth-method i { font-size: 18px; }
.auth-method:hover { border-color: var(--a-muted); }
.auth-method[aria-expanded="true"] { border: 2px solid var(--a-accent); background: var(--a-accent-soft); }
.auth-method-panel {
	background: var(--a-surface); border: 1px solid var(--a-border-soft); border-radius: 12px;
	padding: 14px; display: flex; gap: 16px; align-items: center;
}
.auth-method-panel-col { flex-direction: column; align-items: stretch; gap: 10px; }
.auth-qr { width: 132px; height: 132px; flex-shrink: 0; border-radius: 8px; background: #fff; padding: 6px; display: flex; align-items: center; justify-content: center; }
.auth-qr svg { width: 100%; height: 100%; }
.auth-number {
	width: 96px; height: 96px; flex-shrink: 0; border-radius: 14px;
	background: var(--a-accent-soft); color: var(--a-accent-text);
	display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 800;
}
.auth-method-text { display: flex; flex-direction: column; gap: 6px; font-size: 14px; min-width: 0; }
.auth-row { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-row > .auth-btn { flex: 1 1 140px; }

/* ===== Taby (2FA) ===== */

.auth-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--a-border-soft); border-radius: 10px; padding: 4px; }
.auth-tab {
	min-height: 40px; border: 0; border-radius: 8px; background: transparent;
	color: var(--a-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.auth-tab[aria-selected="true"] { background: var(--a-surface); color: var(--a-text); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ===== Síla hesla ===== */

.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-top: 4px; }
.auth-meter span { height: 6px; border-radius: 3px; background: var(--a-border-soft); transition: background-color .2s; }
.auth-meter[data-score="1"] span:nth-child(-n+1) { background: #d9534f; }
.auth-meter[data-score="2"] span:nth-child(-n+2) { background: #e0a100; }
.auth-meter[data-score="3"] span:nth-child(-n+3) { background: var(--a-accent); }
.auth-meter[data-score="4"] span:nth-child(-n+4) { background: var(--a-accent); }
.auth-meter-label { font-size: 13px; font-weight: 700; color: var(--a-muted); min-height: 1.5em; }
.auth-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--a-muted); }
.auth-rules li { display: flex; gap: 8px; align-items: center; }
.auth-rules li i { width: 16px; text-align: center; }
.auth-rules li.is-ok { color: var(--a-accent-text); }

/* ===== Čekání (schválení správcem, QR) ===== */

.auth-spinner {
	width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
	border: 2px solid currentColor; border-right-color: transparent;
	animation: auth-spin .8s linear infinite; display: inline-block;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-code-big { font-family: var(--a-mono); font-size: 30px; font-weight: 700; letter-spacing: .25em; }
.auth-sep { border: 0; border-top: 1px solid var(--a-border-soft); margin: 4px 0; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
	.auth-spinner { animation-duration: 2.4s; }
	* { transition: none !important; }
}
