/* Korporátní vzhled — paleta a tvarosloví podle helpdesk.bmrc.cz (navy + modrá).
   Světlý i tmavý režim: tokeny níže, tmavé hodnoty přepisuje html[data-theme=dark]
   (explicitní volba, cookie bmrc_theme) nebo systémová preference. */

:root {
	--navy: #0a2c54;
	--navy2: #103a6b;
	--blue: #1565c0;
	--blue-hover: #0d51a0;
	--ink: #1f2733;
	--muted: #6b7480;
	--line: #e6e9ef;
	--bg: #f4f6fa;
	--panel: #fff;
	--hover: #eef2f8;
	--active: #e8f1fd;
	--hover2: #f8fafd;
	--heading: var(--navy);
	--input-bg: #f4f6fa;
	--shadow: rgba(10, 44, 84, .05);
	--ok-bg: #e7f7ee;  --ok-fg: #11633f;  --ok-line: #bfe8d2;
	--err-bg: #fdecec; --err-fg: #8a1f1f; --err-line: #f5c6c6;
	--info-bg: #e8f1fd; --info-fg: #134a8e; --info-line: #c5dbf6;
	--radius: 14px;
	color-scheme: light;
}

html[data-theme=dark] {
	--blue: #4c9aff;
	--blue-hover: #71b0ff;
	--ink: #e6ebf2;
	--muted: #8b98a8;
	--line: #2a3644;
	--bg: #0f1720;
	--panel: #18222e;
	--hover: #1f2b3a;
	--active: #173252;
	--hover2: #1c2836;
	--heading: #dfe8f5;
	--input-bg: #101a24;
	--shadow: rgba(0, 0, 0, .35);
	--ok-bg: #10301f;  --ok-fg: #7fd7a5;  --ok-line: #1d4d33;
	--err-bg: #3a1a1a; --err-fg: #f1a0a0; --err-line: #5a2727;
	--info-bg: #14283f; --info-fg: #9ec8f5; --info-line: #1f4066;
	color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme=light]) {
		--blue: #4c9aff;
		--blue-hover: #71b0ff;
		--ink: #e6ebf2;
		--muted: #8b98a8;
		--line: #2a3644;
		--bg: #0f1720;
		--panel: #18222e;
		--hover: #1f2b3a;
		--active: #173252;
		--hover2: #1c2836;
		--heading: #dfe8f5;
		--input-bg: #101a24;
		--shadow: rgba(0, 0, 0, .35);
		--ok-bg: #10301f;  --ok-fg: #7fd7a5;  --ok-line: #1d4d33;
		--err-bg: #3a1a1a; --err-fg: #f1a0a0; --err-line: #5a2727;
		--info-bg: #14283f; --info-fg: #9ec8f5; --info-line: #1f4066;
		color-scheme: dark;
	}
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink);
	background: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--heading); }

h1 {
	margin: 0 0 1rem;
	font-size: 1.45rem;
	font-weight: 650;
}

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

/* ---------- Levá lišta s ikonami (firemní shell) ---------- */
body.app { padding-left: 56px; }

.rail {
	position: fixed;
	left: 0;
	top: 0;
	bottom: 0;
	width: 56px;
	background: var(--panel);
	border-right: 1px solid var(--line);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 0;
	z-index: 40;
}

.rail__logo {
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	border-radius: 11px;
	background: linear-gradient(160deg, var(--navy), #1565c0);
	color: #fff;
}

.rail__nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: center;
}

.rail__nav a {
	position: relative;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 11px;
	color: var(--muted);
}

.rail__nav a:hover { background: var(--hover); color: var(--blue); text-decoration: none; }

.rail__nav a.active { background: var(--active); color: var(--blue); }

.rail__nav a.active::before {
	content: "";
	position: absolute;
	left: -7px;
	top: 8px;
	bottom: 8px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--blue);
}

.rail__bottom { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); width: 42px; }

/* Zaškrtávátka dnů v týdnu */
.checks { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; padding: .45rem 0; }
.checks br { display: none; }
.checks label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; color: var(--ink); }

h2.sekce {
	font-size: 1.1rem;
	margin: 1.75rem 0 .75rem;
}

.pagetitle {
	color: var(--heading);
	font-weight: 700;
	font-size: 1.02rem;
}

.avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: linear-gradient(160deg, var(--navy), #1565c0);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

/* ---------- Topbar ---------- */
.topbar {
	display: flex;
	align-items: center;
	gap: 18px;
	height: 60px;
	padding: 0 22px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 30;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--heading);
	font-weight: 700;
	font-size: 1.02rem;
	white-space: nowrap;
}

.brand:hover { text-decoration: none; }

.brand__mark {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: linear-gradient(160deg, var(--navy), #1565c0);
	color: #fff;
}

.topbar__right {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-left: auto;
}

.userbox {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: .9rem;
}

.userbox .user-email { color: var(--muted); }

/* Přepínač tmavého režimu — měsíček ve světlém, sluníčko v tmavém */
.theme-toggle {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 1px solid transparent;
	border-radius: 9px;
	color: var(--muted);
	cursor: pointer;
	padding: 0;
}

.theme-toggle:hover { background: var(--hover); color: var(--blue); }

.theme-toggle .icon-sun { display: none; }

html[data-theme=dark] .theme-toggle .icon-sun { display: block; }
html[data-theme=dark] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
	html:not([data-theme=light]) .theme-toggle .icon-sun { display: block; }
	html:not([data-theme=light]) .theme-toggle .icon-moon { display: none; }
}

.langs {
	display: flex;
	gap: .4rem;
}

/* Vlaječka: neaktivní jazyk je zesvětlený, aktivní má rámeček. */
.lang {
	display: inline-flex;
	padding: 2px;
	border: 2px solid transparent;
	border-radius: 4px;
	line-height: 0;
	opacity: .55;
	transition: opacity .15s;
}

.lang:hover { opacity: 1; }

.lang.is-active {
	opacity: 1;
	border-color: var(--blue);
}

/* ---------- Obsah ---------- */
.content {
	max-width: 68rem;
	margin: 0 auto;
	padding: 1.75rem 1.25rem;
}

/* ---------- Flash ---------- */
.flash {
	padding: 12px 16px;
	border-radius: 10px;
	margin-bottom: 12px;
	font-size: 14px;
}

.flash.success { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.flash.error   { background: var(--err-bg); color: var(--err-fg); border: 1px solid var(--err-line); }
.flash.info    { background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-line); }

/* ---------- Karty ---------- */
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.25rem 1.4rem;
	box-shadow: 0 2px 10px var(--shadow);
}

.card--table { padding: .4rem .4rem; overflow-x: auto; }

.empty {
	color: var(--muted);
	text-align: center;
	padding: 2.5rem 1.4rem;
}

.empty p { margin: 0; }

/* ---------- Tabulky ---------- */
.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.table th {
	text-align: left;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--muted);
	padding: 10px 14px;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}

.table td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr:hover { background: var(--hover2); }

/* ---------- Tlačítka ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid transparent;
	border-radius: 10px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: .15s;
}

.btn:hover { text-decoration: none; }

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-hover); }

html[data-theme=dark] .btn--primary { color: #0f1720; }

@media (prefers-color-scheme: dark) {
	html:not([data-theme=light]) .btn--primary { color: #0f1720; }
}

.btn--ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }

.btn--sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Stránky agend ---------- */
.page-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.page-head h1 { margin: 0; }

.page-actions { display: flex; gap: .6rem; }

/* Měsíční stavy tachometru */
.month-nav {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin-bottom: 1rem;
	color: var(--heading);
}

.km-input { max-width: 9rem; }

.vaha-input { max-width: 4.5rem; }

.firma-select { min-width: 10rem; }

.firmy-card { max-width: 32rem; }

/* Kniha jízd */
.auta-prepinac { display: flex; gap: .4rem; margin-left: auto; }

.gen-form { display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem; flex-wrap: wrap; }

.gen-form .hint { margin: 0; }

.km-ok { color: var(--ok-fg); }

.km-spatne { color: var(--err-fg); }

.th-km, .td-km { text-align: right; }
.td-check { text-align: center; }

.pozn-tank {
	display: inline-block;
	font-size: .8rem;
	color: var(--blue);
	margin-top: .15rem;
}

/* Nepřiřazené tankování zvýrazněné */
.table tr.radek-nepr td { background: var(--err-bg); }
.table tr.radek-nepr:hover td { background: var(--err-bg); }

.table input[type=text] {
	padding: .35rem .5rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	font: inherit;
	font-size: .85rem;
	color: var(--ink);
	background: var(--input-bg);
	width: 100%;
}

.table select,
.table input[type=number] {
	padding: .35rem .5rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	font: inherit;
	font-size: .85rem;
	color: var(--ink);
	background: var(--input-bg);
}

.foto-cell input[type=file] {
	max-width: 15rem;
	font-size: .85rem;
	color: var(--muted);
	display: block;
	margin-bottom: .25rem;
}

.table-actions {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .75rem .9rem;
	border-top: 1px solid var(--line);
}

.table a strong { color: var(--blue); }

/* Široký formulář (auto) */
form.form--wide { max-width: 46rem; }

form.form--wide h2 {
	font-size: .82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	margin: 1.5rem 0 .75rem;
	padding-bottom: .35rem;
	border-bottom: 1px solid var(--line);
}

form.form--wide h2:first-of-type { margin-top: .25rem; }

.fgrid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 1.25rem;
}

@media (max-width: 640px) {
	.fgrid { grid-template-columns: 1fr; }
}

/* ---------- Formuláře ---------- */
.frow { margin-bottom: 1rem; }

.frow label {
	display: block;
	font-size: .88rem;
	font-weight: 600;
	color: var(--heading);
	margin-bottom: .3rem;
}

.frow input[type=email],
.frow input[type=text],
.frow input[type=date],
.frow input[type=number],
.frow select,
.frow textarea {
	width: 100%;
	padding: .6rem .75rem;
	border: 1px solid var(--line);
	border-radius: 10px;
	font: inherit;
	color: var(--ink);
	background: var(--input-bg);
}

.frow input:focus,
.frow select:focus,
.frow textarea:focus {
	outline: none;
	border-color: var(--blue);
	background: var(--panel);
}

.frow textarea { resize: vertical; }

.radios { display: flex; gap: 1.25rem; padding: .45rem 0; }

.radios label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; color: var(--ink); }

.hint {
	display: block;
	color: var(--muted);
	font-size: .82rem;
	margin-top: .3rem;
}

.factions {
	display: flex;
	gap: .75rem;
	margin-top: 1.25rem;
}

.btn--danger { background: var(--panel); border-color: var(--err-line); color: var(--err-fg); }
.btn--danger:hover { background: var(--err-bg); border-color: var(--err-fg); }

.danger-zone { margin-top: 1rem; }

.form-errors {
	color: var(--err-fg);
	margin: 0 0 1rem;
	padding-left: 1.1rem;
}

.input-error {
	display: block;
	color: var(--err-fg);
	font-size: .85rem;
	margin-top: .3rem;
}

/* Načtení techničáku */
form.tp-card { max-width: 46rem; margin-bottom: 1.25rem; }

.tp-card h2 {
	font-size: .82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	margin: 0 0 .5rem;
}

.tp-card p { margin: 0 0 .9rem; }

.tp-row {
	display: flex;
	align-items: center;
	gap: .75rem;
	flex-wrap: wrap;
}

.tp-row input[type=file] {
	flex: 1;
	min-width: 14rem;
	font-size: .9rem;
	color: var(--muted);
}

.spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 3px solid rgba(76, 154, 255, .3);
	border-top-color: var(--blue);
	border-radius: 50%;
	animation: spin .8s linear infinite;
	flex: none;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

form.tp-card.is-loading .btn {
	opacity: .7;
	cursor: progress;
}

/* ---------- app.contelio.cz: fronta nových aplikací ---------- */
.grid2 { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.subdomain-row { display: flex; align-items: center; gap: 8px; }
.subdomain-row input { flex: 1; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; border: 1px solid; }
.badge--muted { color: var(--muted); border-color: var(--muted); }
.badge--warn { color: #8a5a00; border-color: #e5b45b; }
.badge--info { color: var(--blue); border-color: var(--blue); }
.badge--ok { color: #11633f; border-color: #4fbe8b; }
.badge--err { color: #8a1f1f; border-color: #e08585; }
.job { margin-bottom: 14px; }
.job__head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.job__meta { margin-left: 8px; font-size: 13px; }
.job__actions { display: flex; align-items: center; gap: 10px; }
.job__log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12.5px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; margin: 8px 0 0; }
html[data-theme="dark"] .job__log { background: #0f141b; border-color: #2b333f; }

/* ---------- TOTP enrollment ---------- */
.totp-setup { text-align: center; }
.totp-qr svg { max-width: 220px; height: auto; background: #fff; border-radius: 8px; padding: 6px; }
.totp-secret code { user-select: all; font-size: 15px; letter-spacing: 1px; }
