/*
 * Admin stylesheet for sprava.hofmanncar.cz.
 *
 * This file is the single source of truth for how the admin looks. The coder
 * MOVES it (git mv) to www/subdom/sprava/assets/admin.css and points
 * docs/admin/ui-kit/index.html at the new path - there must never be two
 * copies. Every component is shown with all its states in ui-kit/index.html.
 *
 * Rules:
 *   - No inline style="" in admin markup: the admin's CSP forbids it.
 *   - No external fonts or assets: system font stack only.
 *   - Colours only through the tokens below.
 */

/* ---------- Tokens ---------- */

:root {
	--ink: #1d1f21;
	--ink-2: #4a4d50;
	--muted: #5f6368;
	--bg: #f4f4f2;
	--surface: #ffffff;
	--surface-2: #fafafa;
	--surface-3: #f6f6f4;
	--line: #e3e3e3;
	--line-soft: #efefef;
	--field-line: #d6d6d6;
	--field-line-strong: #c9c9c9;

	--accent: #ff7900;          /* brand orange - fills only, never text on white */
	--accent-ink: #a84f00;      /* orange text/links on white, 5.3:1 */
	--accent-ink-hover: #7a3900;
	--accent-soft: #fff1e4;
	--accent-line: #d08a4a;

	--ok: #2e7d32;
	--ok-ink: #1f5a23;
	--ok-soft: #e8f4e9;
	--ok-line: #b5d8b8;

	--warn-ink: #6b4e00;
	--warn-soft: #fff6dc;
	--warn-line: #e8c766;

	--err: #b3261e;
	--err-ink: #8a2c20;
	--err-soft: #fdecea;
	--err-line: #e6b3ad;

	--focus: #1a5fb4;

	--r-field: 6px;
	--r-card: 10px;
	--r-dialog: 12px;

	--shadow-bar: 0 -4px 16px rgba(0, 0, 0, 0.06);
	--shadow-dialog: 0 20px 60px rgba(0, 0, 0, 0.3);

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

	--container: 1200px;        /* content width 1120 + 2 x 40 gutter */
	--gutter: 40px;
	--topbar-h: 64px;
	--savebar-h: 76px;
}

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

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

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

body {
	margin: 0;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink);
	background: var(--bg);
}

a { color: var(--accent-ink); }
a:hover { color: var(--accent-ink-hover); }

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

h1, h2, h3, p { margin: 0; }

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* The inline icon sprite printed at the top of <body> (no inline style: CSP). */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
	width: 18px; height: 18px;
	flex: none;
	fill: none; stroke: currentColor; stroke-width: 2;
	stroke-linecap: round; stroke-linejoin: round;
	vertical-align: middle;
}
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */

.topbar {
	height: var(--topbar-h);
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}
.topbar__inner {
	max-width: var(--container);
	height: 100%;
	margin: 0 auto;
	padding: 0 var(--gutter);
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--ink); }
/* The customer's raster logo (SPEC 6.1): native size, never upscaled. */
.brand__logo { display: block; flex: none; width: 231px; height: 25px; }
.brand__sub { font-size: 14px; color: var(--muted); }
h1.brand__sub { font-weight: 400; }
.topbar__nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.topbar__user { color: var(--muted); }
.topbar__nav form { margin: 0; }

.container {
	max-width: var(--container);
	margin: 0 auto;
	padding: 28px var(--gutter) 0;
}
.page--with-savebar { padding-bottom: calc(var(--savebar-h) + 40px); }
.page--plain { padding-bottom: 64px; }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--accent-ink); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-title { font-size: 28px; font-weight: 700; line-height: 1.25; margin-bottom: 6px; }
.lead { font-size: 15px; color: var(--muted); }

.section-label {
	font-size: 13px; font-weight: 700;
	letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--muted);
	margin: 28px 0 10px;
}

.stack { display: flex; flex-direction: column; gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-split { display: grid; grid-template-columns: 600px minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---------- Card & tile ---------- */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-card);
	padding: 22px 24px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card__head .card__title { margin-bottom: 0; }

.tile {
	display: flex; flex-direction: column; gap: 10px;
	min-height: 190px;
	padding: 22px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-card);
	color: var(--ink);
	text-decoration: none;
}
.tile:hover { border-color: var(--accent-line); color: var(--ink); }
.tile__top { display: flex; justify-content: space-between; align-items: flex-start; }
.tile__icon {
	width: 40px; height: 40px; border-radius: 8px;
	display: flex; align-items: center; justify-content: center;
	background: var(--accent-soft); color: var(--accent-ink);
}
.tile__title { font-size: 18px; font-weight: 700; }
.tile__text { font-size: 14px; color: var(--muted); }
.tile__foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.tile__meta { color: var(--muted); }
.tile__go { font-weight: 600; color: var(--accent-ink); }

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px;
	padding: 10px 20px;
	font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
	border: 1px solid transparent;
	border-radius: var(--r-field);
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: var(--ink); font-weight: 700; }
.btn--primary:hover { background: #ec7000; color: var(--ink); }

.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--field-line-strong); }
.btn--secondary:hover { border-color: var(--ink-2); color: var(--ink); }

.btn--danger { background: var(--err); color: #ffffff; font-weight: 700; }
.btn--danger:hover { background: #962019; color: #ffffff; }

.btn--danger-outline { background: var(--surface); color: var(--err); border-color: var(--err-line); }
.btn--danger-outline:hover { border-color: var(--err); color: var(--err); }

.btn--success { background: var(--ok); color: #ffffff; font-weight: 700; }
.btn--success-outline { background: var(--surface); color: var(--ok-ink); border-color: var(--ok-line); }

.btn--add {
	background: var(--surface); color: var(--accent-ink);
	border: 1px dashed var(--accent-line);
	font-size: 14px; min-height: 40px; padding: 8px 16px;
}
.btn--add:hover { border-style: solid; color: var(--accent-ink-hover); }

.btn--link {
	min-height: 0; padding: 0;
	background: none; border: 0;
	color: var(--accent-ink); font-weight: 600; font-size: 14px;
}
.btn--link:hover { text-decoration: underline; }

.btn--icon {
	width: 36px; min-height: 36px; padding: 0;
	background: transparent; color: var(--muted);
}
.btn--icon:hover { background: var(--surface-3); color: var(--ink); }
.btn--icon.is-danger { color: var(--err); }
.btn--icon.is-danger:hover { background: var(--err-soft); color: var(--err); }

.btn--sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }

/* Busy state while a POST is in flight: label changes to "Ukládám…" */
.btn.is-busy { cursor: progress; opacity: 0.75; pointer-events: none; }
.btn.is-busy::before {
	content: ""; width: 14px; height: 14px; flex: none;
	border: 2px solid currentColor; border-right-color: transparent;
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::before { animation: none; } }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn-row--end { justify-content: flex-end; }

/* ---------- Form fields ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.label { font-size: 14px; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--muted); }

.input, .textarea, .select {
	width: 100%;
	min-height: 40px;
	padding: 9px 12px;
	font: inherit; font-size: 15px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--field-line);
	border-radius: var(--r-field);
}
.textarea { min-height: 84px; line-height: 1.5; resize: vertical; }
.input:hover, .textarea:hover { border-color: var(--field-line-strong); }
.input:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.25); }
.input--strong { font-weight: 600; }
.input--num { text-align: right; font-variant-numeric: tabular-nums; }
.input--center { text-align: center; }
.input:disabled { background: var(--surface-3); color: var(--muted); }

/* Money field: input + "Kč" suffix inside one border */
.money {
	display: flex; align-items: center; gap: 4px;
	padding-right: 9px;
	background: var(--surface);
	border: 1px solid var(--field-line);
	border-radius: var(--r-field);
}
.money .input { border: 0; background: transparent; padding-right: 4px; min-width: 0; }
.money .input:focus { box-shadow: none; }
.money:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.25); }
.money__unit { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Changed since load: orange frame + "dříve X Kč" under it */
.is-changed, .money.is-changed { border: 2px solid var(--accent); background: var(--accent-soft); }
.is-changed .input, .input.is-changed { font-weight: 700; }
.was { font-size: 12px; color: var(--accent-ink); margin-top: 3px; }

/* Invalid: red frame + message under it */
.is-invalid, .money.is-invalid { border: 2px solid var(--err); background: var(--err-soft); }
.error-text { font-size: 13px; color: var(--err-ink); margin-top: 3px; display: flex; gap: 6px; align-items: flex-start; }

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

/* Two equal option cards (Osobní / Dodávka) */
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-card {
	display: flex; align-items: center; gap: 10px;
	height: 46px; padding: 0 14px;
	border: 2px solid var(--field-line);
	border-radius: var(--r-field);
	background: var(--surface);
	font-size: 14px; font-weight: 600; white-space: nowrap;
	cursor: pointer;
}
.radio-card input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-ink); flex: none; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Badges ---------- */

.badge {
	display: inline-flex; align-items: center;
	padding: 2px 10px;
	border-radius: 20px;
	font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
	background: #ececec; color: var(--ink-2);
	white-space: nowrap;
}
.badge--on { background: var(--ok-soft); color: var(--ok-ink); }
.badge--planned { background: var(--warn-soft); color: var(--warn-ink); }
.badge--hidden { background: #ececec; color: var(--ink-2); text-transform: uppercase; font-size: 11px; }

/* ---------- Alerts ---------- */

.alert {
	display: flex; gap: 12px; align-items: flex-start;
	padding: 12px 16px;
	border: 1px solid; border-radius: 8px;
	font-size: 14px; line-height: 1.5;
}
.alert .icon { margin-top: 1px; }
.alert__title { font-weight: 700; }
.alert__body { flex: 1; min-width: 0; }
.alert__actions { display: flex; gap: 10px; flex: none; align-items: center; }
.alert__body .check { display: flex; margin-top: 8px; }
.alert--success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.alert--error   { background: var(--err-soft); border-color: var(--err-line); color: var(--err-ink); }
.alert--warning { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.alert--info    { background: var(--surface-3); border-color: var(--line); color: var(--ink-2); }

/* Page banner after a save: big success alert with a round check */
.banner { padding: 18px 22px; border-radius: var(--r-card); align-items: center; gap: 16px; }
.banner__check {
	width: 36px; height: 36px; border-radius: 50%; flex: none;
	display: flex; align-items: center; justify-content: center;
	background: var(--ok); color: #ffffff;
}
.banner .alert__title { font-size: 17px; }
.banner--error .banner__check { background: var(--err); }

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

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
	text-align: left; font-weight: 600; color: var(--muted);
	padding: 12px 16px; background: var(--surface-2);
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table--edit td { padding: 7px 8px; }
.table--edit td:first-child, .table--edit th:first-child { padding-left: 16px; }
.table--edit td:last-child, .table--edit th:last-child { padding-right: 16px; }
.table__actions { display: flex; gap: 2px; justify-content: flex-end; }
.table__foot { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
tr.is-hidden-row > td { opacity: 0.55; }
tr.is-hidden-row > td:last-child, tr.is-hidden-row > td.keep-opacity { opacity: 1; }
tr.is-new-row > td { background: var(--accent-soft); }

.thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; display: block; background: #e6e6e6; }
.thumb--lg { width: 120px; height: 90px; }
.thumb--gray { filter: grayscale(1); opacity: 0.8; }
.thumb--empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }

.order { display: flex; flex-direction: column; }
.order .btn--icon { width: 28px; min-height: 24px; }

.diff { width: 100%; border-collapse: collapse; font-size: 14px; }
.diff th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.diff th:first-child, .diff td:first-child { padding-left: 0; }
.diff th:last-child, .diff td:last-child { padding-right: 0; }
.diff td { padding: 10px; border-bottom: 1px solid var(--line-soft); }
.diff .num { text-align: right; }
.diff .was-val { text-align: right; color: var(--muted); text-decoration: line-through; white-space: nowrap; }
.diff .new-val { text-align: right; font-weight: 700; white-space: nowrap; }
.diff tr.is-large td { background: var(--err-soft); }
.diff tr.is-large .new-val { color: var(--err-ink); }
.diff .kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.diff .kind--add { color: var(--ok-ink); }
.diff .kind--del { color: var(--err-ink); }

/* ---------- Save bar ---------- */

.savebar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
	height: var(--savebar-h);
	background: var(--surface);
	border-top: 1px solid var(--line);
	box-shadow: var(--shadow-bar);
}
.savebar[hidden] { display: none; }
.savebar__inner {
	max-width: var(--container); height: 100%;
	margin: 0 auto; padding: 0 var(--gutter);
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.savebar__status { display: flex; align-items: center; gap: 10px; font-size: 15px; min-width: 0; }
.savebar__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.savebar__detail { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Dialog ---------- */

.dialog {
	width: min(640px, calc(100vw - 32px));
	max-height: calc(100vh - 64px);
	overflow: auto;
	padding: 30px 32px;
	border: 0; border-radius: var(--r-dialog);
	background: var(--surface);
	box-shadow: var(--shadow-dialog);
	color: var(--ink);
}
.dialog--sm { width: min(560px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(20, 22, 24, 0.55); }
.dialog__body { display: flex; flex-direction: column; gap: 18px; }
.dialog__title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.dialog__text { font-size: 15px; color: var(--muted); }
.dialog__head { display: flex; gap: 18px; align-items: center; }

/* ---------- Chips (history filter) ---------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
	padding: 8px 14px; border-radius: 20px;
	font-size: 14px; text-decoration: none;
	background: var(--surface); border: 1px solid var(--field-line); color: var(--ink);
}
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #ffffff; font-weight: 600; }

/* ---------- History ---------- */

.history { display: flex; flex-direction: column; gap: 12px; }
.history-item {
	display: flex; gap: 18px; align-items: center;
	padding: 18px 22px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-card);
}
.history-item--open { flex-wrap: wrap; border: 2px solid var(--ink); }
.history-item__main { flex: 1; min-width: 0; }
.history-item__meta { font-size: 13px; color: var(--muted); }
.history-item__title { font-size: 16px; font-weight: 700; margin-top: 2px; }
.history-item__text { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.history-item__diff { flex-basis: 100%; }

/* ---------- Upload ---------- */

.photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: #e6e6e6; }
/* S9-03: the photo is a <label> for the one file input; click or drop on it. */
.photo-pick { position: relative; display: block; border-radius: 8px; cursor: pointer; }
.photo-pick__overlay {
	position: absolute; inset: 0; border-radius: 8px;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
	background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 15px; font-weight: 700;
	opacity: 0; transition: opacity 0.15s;
}
.photo-pick.is-dragover .photo-pick__overlay,
.photo-pick.is-busy .photo-pick__overlay,
.photo-pick:has(~ .drop input:focus-visible) .photo-pick__overlay { opacity: 1; }
@media (hover: hover) {
	.photo-pick:hover .photo-pick__overlay { opacity: 1; }
}
.photo-pick__chip {
	position: absolute; right: 10px; bottom: 10px;
	display: none; align-items: center; gap: 6px;
	padding: 6px 12px; border-radius: 999px;
	background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 13px; font-weight: 700;
}
@media (hover: none) {
	.photo-pick__chip { display: inline-flex; }
}
.photo-pick.is-dragover { outline: 3px solid var(--ok); outline-offset: 2px; }
.photo-pick.is-busy { cursor: progress; opacity: 0.65; pointer-events: none; }
.drop {
	position: relative;
	display: flex; align-items: center; gap: 14px;
	padding: 16px 18px;
	border: 2px dashed var(--field-line-strong);
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
}
/* No photo yet: the drop zone itself is the big 4:3 area (S9-03). */
.drop--empty {
	aspect-ratio: 4 / 3; flex-direction: column; justify-content: center; gap: 10px;
	text-align: center; font-size: 15px; background: var(--surface-3);
}
.drop--empty .drop__icon { width: 40px; height: 40px; }
.drop__icon--empty, .drop--empty .drop__icon--more { display: none; }
.drop--empty .drop__icon--empty { display: inline-block; }
.drop:hover, .drop:focus-within { border-color: var(--accent-line); background: #fffdf9; }
.drop:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop.is-dragover { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.drop.is-busy { cursor: progress; opacity: 0.65; pointer-events: none; }
.drop__icon { color: var(--accent-ink); }
.drop__text strong { display: block; }
.drop__text span { color: var(--muted); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.preview-card { display: flex; gap: 16px; align-items: flex-start; font-size: 13px; line-height: 1.55; }
.preview-card img { width: 160px; height: 120px; object-fit: cover; border-radius: 4px; flex: none; }
.preview-card__name { font-size: 16px; font-weight: 700; }

/* ---------- Empty state ---------- */

.empty { padding: 32px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.empty__title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

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

.login { min-height: 100vh; display: flex; justify-content: center; padding: 11vh 24px 40px; }
.login__box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 22px; }
.login__brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login__form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 28px; display: flex; flex-direction: column; }
.login__form .input { min-height: 48px; font-size: 17px; margin-bottom: 14px; }
.login__form .btn { width: 100%; min-height: 50px; font-size: 17px; margin-top: 6px; }
.login__form .alert { margin-bottom: 16px; }
.login__note { text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- Hours editor ---------- */

.hours-row {
	display: grid;
	grid-template-columns: 90px 110px minmax(0, 1fr) 20px minmax(0, 1fr);
	gap: 10px; align-items: center;
	font-size: 14px;
	margin-bottom: 10px;
}
.hours-row__closed { grid-column: span 3; color: var(--muted); }
.hours-row__dash { text-align: center; color: var(--muted); }
.result-line { padding: 12px 14px; background: var(--surface-3); border-radius: 8px; font-size: 14px; }
.result-line span { color: var(--muted); }

/* Announcement preview = the same bar the public site shows */
.announce-preview {
	padding: 12px 18px; border-radius: var(--r-field);
	background: var(--accent); color: var(--ink);
	font-size: 15px; font-weight: 600; text-align: center;
}

/* ---------- Phone layout (< 700px) ---------- */

@media (max-width: 700px) {
	:root { --gutter: 16px; --topbar-h: 56px; }
	.topbar__inner { padding: 0 var(--gutter); }
	.brand__sub, .topbar__user { display: none; }
	.topbar__nav { gap: 16px; }
	.container { padding-top: 18px; }
	.page-title { font-size: 22px; }
	.page-head { flex-direction: column; align-items: stretch; }
	.grid-2, .grid-3, .grid-split { grid-template-columns: minmax(0, 1fr); }
	.card { padding: 18px 16px; }
	.history-item { flex-wrap: wrap; }

	/* Editing tables become one card per row. Each cell carries data-label.
	   Cells span the full card; price cells (td.cell-price) sit three per line. */
	.table--cards thead { display: none; }
	.table--cards, .table--cards tbody { display: block; width: 100%; }
	.table--cards tr {
		display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px;
		padding: 14px; border-bottom: 1px solid var(--line);
	}
	.table--cards td { display: block; grid-column: 1 / -1; padding: 4px 0 !important; border: 0; min-width: 0; }
	.table--cards td.cell-price { grid-column: auto; }
	.table--cards .money { padding-right: 6px; }
	.table--cards .money .input { padding-left: 6px; padding-right: 2px; }
	.table--cards td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

	.savebar { height: auto; }
	.savebar__inner { padding: 12px var(--gutter) 20px; flex-direction: column; align-items: stretch; gap: 10px; }
	.savebar__detail { display: none; }
	.savebar .btn-row { flex-direction: row-reverse; }
	.savebar .btn { flex: 1; }
	.dialog { padding: 22px 18px; }
	.hours-row { grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); }
	.hours-row strong, .hours-row .check, .hours-row__closed { grid-column: 1 / -1; }
	.radio-cards { grid-template-columns: minmax(0, 1fr); }

	/* Touch targets: everything tappable is at least 44 px on a phone. */
	.btn, .btn--sm, .btn--add { min-height: 44px; }
	.btn--icon, .order .btn--icon { width: 44px; min-width: 44px; min-height: 44px; flex: none; }
	.btn--link { min-height: 44px; padding: 0 4px; }
	.chip { padding: 12px 16px; }
}

/* ---------- Coder additions: layout glue the kit has no class for ---------- */

/* The alert/banner area at the top of every page (server and script alerts). */
.page-alerts { display: flex; flex-direction: column; gap: 12px; }
.page-alerts:not(:empty) { margin-bottom: 22px; }

/* A diff table never widens a dialog past the screen; it scrolls inside. */
.diff-wrap { overflow-x: auto; }

/* The list of newer changes inside the S11 warning. */
.alert__list { margin: 6px 0 0; padding-left: 20px; }

/* Topbar on a phone: brand and both links fit on one line from 360 px. */
@media (max-width: 700px) {
	.brand__logo { width: 185px; height: 20px; }
	/* SPEC 6.1: next to the logo „Zobrazit web“ is only the icon (aria-label + title). */
	.topbar__site-text { display: none; }
	.topbar__nav .topbar__site { width: 44px; justify-content: center; }
	.topbar__site .icon { width: 20px; height: 20px; }
	.topbar__nav { gap: 8px; font-size: 13px; }
	.topbar__nav .btn--link { font-size: 13px; }
	.topbar__nav a { white-space: nowrap; }
}

/* Edit-table column widths (canvas artboards 3 and 8). */
.col-service { width: 200px; }
.col-price { width: 118px; }
.col-actions { width: 120px; }

/* S6 phone rows: label, number, delete; the header checkbox under them. */
.phone-row { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.phone-row__fields { display: flex; gap: 10px; align-items: flex-start; }
.phone-row__field { flex: 1; min-width: 0; }
.hint--block { margin: 10px 0 0; }
.field--top { margin-top: 18px; margin-bottom: 0; }
.card--spaced { margin-top: 22px; }
.field-row { display: flex; gap: 20px; flex-wrap: wrap; }
.field-row .field { min-width: 180px; }
.hours-row + .error-text { margin: -6px 0 10px; }
.result-line { margin-top: 10px; }

@media (max-width: 700px) {
	.phone-row__fields { flex-wrap: wrap; }
	.phone-row__field { flex-basis: calc(100% - 54px); }
	.phone-row__field:first-child { flex-basis: 100%; }
	.field-row .field { flex: 1; min-width: 140px; }
}

/* S8 car table. */
.car-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.car-specs { font-size: 13px; color: var(--muted); margin-top: 2px; }
.table--cars td { vertical-align: middle; }
.col-order { width: 44px; }
.col-thumb { width: 96px; }
.col-money { width: 86px; }
.col-check { width: 72px; text-align: center !important; }
.col-edit { width: 84px; }
.cell-check { text-align: center; }
.check--tap { min-width: 44px; min-height: 44px; justify-content: center; }
.check--tap input { width: 20px; height: 20px; }
.card--row { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.card--row .card__title { margin-bottom: 2px; }

@media (max-width: 700px) {
	.card--row { flex-direction: column; align-items: flex-start; }
	.cell-check { text-align: left; }
	.table--cars .order { flex-direction: row; }
}

/* The hidden attribute always wins over a component's display rule. */
[hidden] { display: none !important; }

/* S9 car detail. */
.stack--tight { gap: 14px; }
.grid-3--prices { gap: 12px; }
.field--flush { margin-bottom: 0; }
.delete-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.section-label--first { margin-top: 0; }
.drop[data-error-anchor] + .error-text { margin-top: -6px; }

/* S12: "only hide it" box inside the delete dialog. */
.accent-box {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	padding: 14px 16px; border-radius: 8px;
	background: var(--accent-soft); border: 1px solid var(--accent-line);
	font-size: 14px;
}
.accent-box span { color: var(--ink-2); }

@media (max-width: 700px) {
	.accent-box { flex-direction: column; align-items: stretch; }
	.preview-card { flex-direction: column; }
	.preview-card img { width: 100%; height: auto; aspect-ratio: 4 / 3; }
	.grid-split > * { min-width: 0; }
}

/* S10: an entry whose change table was opened with „Zobrazit změny“. */
.history-item--expanded { flex-wrap: wrap; }
.more { margin-top: 18px; text-align: center; }

/* S2: recent changes. */
.nowrap { white-space: nowrap; }
.table--recent td { vertical-align: middle; }
@media (max-width: 700px) {
	.table--recent td.num { text-align: left; }
}

/* S10 actions (Zobrazit změny, Vrátit, Obnovit) stay together. */
.history-item__actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

@media (max-width: 700px) {
	/* FX-001: alerts and the S5 banner wrap their buttons under the text and
	   stack them full width, so nothing pushes the page wider than the phone. */
	.alert { flex-wrap: wrap; }
	.alert__body { flex: 1 1 0; min-width: 0; }
	.alert__actions { flex: 1 1 100%; flex-direction: column; align-items: stretch; }
	.alert__actions .btn { width: 100%; white-space: normal; }

	/* FX-002: a history entry stacks - meta and title full width, actions on their own line. */
	.history-item__main { flex: 1 1 100%; }
	.history-item__actions { flex: 1 1 100%; gap: 12px; }

	/* FX-003: everything tappable is at least 44 px high on a phone. */
	.input, .select { min-height: 44px; }
	.brand, .topbar__nav a { min-height: 44px; display: inline-flex; align-items: center; }
	.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
	.crumbs { margin-bottom: 0; }
	.check { min-height: 44px; align-items: center; }
}

/* ---------- Mid widths, 701 px up to the full desktop (SPEC §6.3) ----------
   FX-009..FX-012: the desktop layout must work at every width from 700 px up
   and never clip a price or number. Narrower than the full layout needs, the
   screens stack or switch to cards instead of squeezing their inputs. */

/* S8 inputs carry no unit: give the digits the room. */
.table--cars .money { padding-right: 6px; }
.table--cars .money .input { padding-left: 6px; padding-right: 2px; }

/* S9: the photo column shares the width instead of a fixed 600 px
   (desktop only: the kit stacks it below 700 px). */
@media (min-width: 701px) {
	.grid-split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

@media (min-width: 701px) and (max-width: 1180px) {
	/* S6: phones and hours one below the other (time inputs need the width). */
	.grid-2--wide { grid-template-columns: minmax(0, 1fr); }

	/* S8: one card per car, six columns: order, photo, name / 6 prices / Na webu, Upravit. */
	.table--cars thead { display: none; }
	.table--cars, .table--cars tbody { display: block; width: 100%; }
	.table--cars tr {
		display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px; row-gap: 6px;
		align-items: end; padding: 14px 16px; border-bottom: 1px solid var(--line);
	}
	.table--cars td { display: block; padding: 0 !important; border: 0; min-width: 0; }
	.table--cars td:nth-child(3) { grid-column: span 4; align-self: center; }
	.table--cars td.cell-check, .table--cars td:last-child { grid-column: span 3; }
	.table--cars td:last-child { text-align: right; }
	.table--cars .order { flex-direction: row; }
	.table--cars td[data-label]:not(:nth-child(-n+3))::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
}

@media (min-width: 701px) and (max-width: 960px) {
	/* S9: photo above the data. */
	.grid-split { grid-template-columns: minmax(0, 1fr); }
	.grid-split .photo-pick, .grid-split .drop--empty { max-width: 480px; }

	/* S3: one card per row: service | description / 3 prices / actions. */
	.table--tyres thead { display: none; }
	.table--tyres, .table--tyres tbody { display: block; width: 100%; }
	.table--tyres tr {
		display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px; row-gap: 6px;
		padding: 14px 16px; border-bottom: 1px solid var(--line);
	}
	.table--tyres td { display: block; padding: 0 !important; border: 0; min-width: 0; grid-column: span 6; }
	.table--tyres td:nth-child(1) { grid-column: span 2; }
	.table--tyres td:nth-child(2) { grid-column: span 4; }
	.table--tyres td.cell-price { grid-column: span 2; }
	.table--tyres td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
}

/* FX-013: alerts and S5 banners wrap by content, not by breakpoint. The text
   keeps at least 280 px; when the buttons do not fit beside it they drop
   below it and wrap among themselves, so nothing ever overlaps. (Below
   700 px the phone rules above stack them full width instead.) */
@media (min-width: 701px) {
	.alert { flex-wrap: wrap; row-gap: 12px; }
	.alert__body { flex: 1 1 280px; min-width: 0; }
	.alert__actions { flex: 0 1 auto; flex-wrap: wrap; max-width: 100%; }
}

/* Section navigation under the topbar (step 3). Wraps, so it never overflows at 360 px. */
.mainnav { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 0 var(--gutter, 24px); max-width: 1200px; margin: 0 auto; border-bottom: 1px solid var(--line); font-size: 15px; }
.mainnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.mainnav a:hover { color: var(--ink); text-decoration: underline; }
.mainnav a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* S6 glue. */
.announce-preview.muted { opacity: .6; font-weight: 400; }
@media (max-width: 700px) {
	.table--recent td { overflow-wrap: anywhere; }
}

/* ---------- Page changes without a white frame (view transitions, no JS) ---------- */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.mainnav { view-transition-name: mainnav; }
::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }
	::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
