:root {
	--c-bg: #f4f6f8;
	--c-surface: #ffffff;
	--c-border: #e1e5ea;
	--c-text: #1a2434;
	--c-muted: #6b7383;
	--c-primary: #2c5cdd;
	--c-primary-dark: #1d44a8;
	--c-success: #1f9d55;
	--c-warning: #d97706;
	--c-danger: #c0392b;
	--c-accent: #f0f4ff;
	--radius: 6px;
	--shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: var(--c-bg);
	color: var(--c-text);
	font-size: 14px;
	line-height: 1.5;
}

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

/* Topbar */
.topbar {
	display: flex; align-items: center;
	background: #fff;
	border-bottom: 1px solid var(--c-border);
	padding: 12px 24px;
	gap: 32px;
}
.topbar__brand { display: flex; align-items: center; }
.topbar__brand a { display: block; line-height: 0; }
.topbar__logo { height: 26px; width: auto; display: block; }
/* Bez zalomení by se 14. položka menu vytlačila mimo obrazovku. */
.topbar__nav { display: flex; flex-wrap: wrap; gap: 6px 20px; flex: 1; }
.topbar__nav a { color: var(--c-muted); font-weight: 500; }
.topbar__nav a:hover { color: var(--c-primary); text-decoration: none; }
/* Uživatelské menu v topbaru — <details>, aby fungovalo i bez JS (skript
   v layoutu jen zavírá po kliknutí mimo). */
.usermenu { position: relative; }
.usermenu__trigger {
	display: flex; align-items: center; gap: 6px;
	padding: 4px 8px; border-radius: var(--radius);
	cursor: pointer; user-select: none; list-style: none;
	font-size: 13px; font-weight: 500;
}
.usermenu__trigger::-webkit-details-marker { display: none; }
.usermenu__trigger:hover { background: var(--c-accent); }
.usermenu__caret {
	width: 0; height: 0; border-left: 4px solid transparent;
	border-right: 4px solid transparent; border-top: 5px solid var(--c-muted);
}
.usermenu[open] .usermenu__caret { transform: rotate(180deg); }
.usermenu__panel {
	position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
	padding: 4px; z-index: 60;
	background: var(--c-surface); border: 1px solid var(--c-border);
	border-radius: var(--radius); box-shadow: var(--shadow);
}
.usermenu__panel a { display: block; padding: 8px 10px; border-radius: 4px; color: var(--c-text); }
.usermenu__panel a:hover { background: var(--c-accent); color: var(--c-primary); text-decoration: none; }

/* Modál změny hesla (položka uživatelského menu) */
dialog.pwdialog {
	border: 0; border-radius: var(--radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
	padding: 22px 24px; width: 420px; max-width: calc(100vw - 32px);
}
dialog.pwdialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.pwdialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pwdialog__title { font-size: 16px; font-weight: 600; margin: 0; }
.pwdialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pwdialog .form-row { margin-top: 12px; }
.pwdialog .form-row input { width: 100%; }

/* Layout */
.layout { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Headings */
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }

/* Cards */
.card {
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 16px;
	box-shadow: var(--shadow);
}
.card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card__title { font-weight: 600; font-size: 16px; }

/* Upozornění na vzor u nahrávání — text vlevo, tlačítko ke stažení vpravo. */
.sample-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sample-notice__text { flex: 1; }

/* Ověřená identifikace — dvousloupcový výpis údajů */
.kyc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
@media (max-width: 640px) { .kyc-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
	display: inline-block;
	padding: 8px 14px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	font-size: 13px; font-weight: 500;
	cursor: pointer;
	background: #f1f3f6;
	color: var(--c-text);
	text-decoration: none;
}
.btn:hover { background: #e6e9ee; text-decoration: none; }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dark); color: #fff; }
.btn--danger { background: var(--c-danger); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--c-border); }
.btn--small { padding: 4px 10px; font-size: 12px; }
/* Mini POST formulář kolem mutační akce (CSRF token) — chová se jako inline odkaz */
.inline-form { display: inline; }
.inline-form .btn { font-family: inherit; }

/* Tables */
table.data {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	overflow: hidden;
}
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.data th { background: #fafbfc; font-size: 12px; text-transform: uppercase; color: var(--c-muted); letter-spacing: .02em; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover { background: #fafbfc; }

/* Forms */
form .form-row { margin-bottom: 14px; }
form label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; }
/* Jednotná výška všech typů vstupů. Bez explicitní `line-height` a `height`
   si ji každý typ počítá po svém — <select> dědí `normal`, <input type=date>
   si přidá výšku kvůli vnitřnímu tlačítku kalendáře — a sousední pole pak
   nesedí v řadě (u identifikace klienta se lišila o 1,5 až 3,5 px). */
form input[type=text], form input[type=email], form input[type=date], form input[type=number],
form select, form textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	box-sizing: border-box;
	height: 38px;
	background: #fff;
}
/* Vnitřní části nativního kalendáře si jinak drží vlastní výšku. */
form input[type=date]::-webkit-datetime-edit { padding: 0; }
form input[type=date]::-webkit-calendar-picker-indicator { margin: 0; padding: 0; }
/* Víceřádkový text výšku nedědí — roste podle obsahu. */
form textarea { height: auto; min-height: 80px; resize: vertical; }
form .form-actions { display: flex; gap: 8px; margin-top: 16px; }
form .form-help { color: var(--c-muted); font-size: 12px; margin-top: 4px; }

.form-row__choice { display: flex; flex-wrap: wrap; gap: 8px; }
.form-row__radio {
	display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0;
	padding: 8px 14px; border: 1px solid var(--c-border); border-radius: var(--radius);
	background: #fff; cursor: pointer; font-size: 14px; font-weight: 400; user-select: none;
	transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.form-row__radio:hover { background: #f4f7fb; border-color: #b7c3d6; }
.form-row__radio:has(input:checked) { background: #eaf1ff; border-color: #4d7df0; box-shadow: inset 0 0 0 1px #4d7df0; font-weight: 600; }
.form-row__radio input { margin: 0; width: auto; }

/* Badges */
.badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .03em;
	white-space: nowrap;
}
/* Badge, na kterou se dá kliknout (schválení interního formuláře, žádost
   klientovi) — jako <button> by jinak měla rámeček a systémové písmo. */
/* :where() drží specificitu na nule, aby si badge s vlastním rámečkem
   (--not-requested) svůj styl udržela. */
button:where(.badge) { border: 0; font-family: inherit; cursor: pointer; }
button:where(.badge)[disabled] { opacity: .5; cursor: progress; }
.badge--awaited { background: #f1f3f6; color: var(--c-muted); }
/* „Nepožadováno" — klientský dokument, který auditor ještě klientovi
   nevyžádal. Klik na pilulku otevře dialog „Zažádat klienta?". */
.badge--not-requested {
	background: #eef2f7; color: #64748b; border: 1px dashed #94a3b8;
	cursor: pointer; font-style: italic;
}
.badge--not-requested:hover { background: #dbeafe; color: #1e3a8a; border-color: #4d7df0; }
.badge--review { background: #fff3cd; color: #856404; }
.badge--approved { background: #d4edda; color: #155724; }
.badge--returned { background: #f8d7da; color: #721c24; }
.badge--mandatory { background: #fde2e1; color: #9c2924; }
.badge--optional { background: #e1f0fa; color: #1e5d8a; }

/* Flash */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.flash--info { background: #e1f0fa; color: #1e5d8a; }
.flash--success { background: #d4edda; color: #155724; }
.flash--error { background: #f8d7da; color: #721c24; }
.flash--warning { background: #fff3cd; color: #856404; }

/* Empty state */
.empty { text-align: center; color: var(--c-muted); padding: 40px; }

/* Requirement matrix */
.matrix__filter { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.matrix__filter select, .matrix__filter input { padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); }

.template-picker {
	max-height: 360px; overflow-y: auto;
	border: 1px solid var(--c-border); border-radius: var(--radius);
	padding: 8px; background: #fafbfc;
}
.template-picker label {
	display: flex; align-items: flex-start; padding: 8px;
	border-radius: var(--radius); cursor: pointer;
	gap: 10px;
}
.template-picker label:hover { background: #eef2f9; }
.template-picker label.disabled { opacity: .5; cursor: not-allowed; }
.template-picker .tp-name { font-weight: 500; }
.template-picker .tp-desc { color: var(--c-muted); font-size: 12px; margin-top: 2px; }
.template-picker input[type=checkbox] { margin-top: 3px; }

/* Upload zone (thermometer) */
.upload-zone {
	border: 2px dashed #b6c0d2;
	border-radius: var(--radius);
	padding: 32px 20px;
	text-align: center;
	background: #fafbfc;
	transition: all .15s ease;
}
.upload-zone.dragover {
	background: var(--c-accent);
	border-color: var(--c-primary);
}
.upload-zone__hint { color: var(--c-muted); font-size: 13px; margin-top: 6px; }
.upload-zone input[type=file] { display: none; }
.upload-zone__btn {
	display: inline-block; cursor: pointer;
	margin-top: 12px;
	padding: 10px 18px;
	background: var(--c-primary); color: #fff;
	border-radius: var(--radius); font-weight: 500;
}

.upload-list { list-style: none; padding: 0; margin: 16px 0 0; }
.upload-item {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4px 16px;
	padding: 12px;
	background: #fff;
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	margin-bottom: 8px;
}
.upload-item__name { font-weight: 500; word-break: break-all; }
.upload-item__meta { color: var(--c-muted); font-size: 12px; text-align: right; }
.upload-item__progress { grid-column: 1 / -1; }

/* Thermometer */
.thermo {
	position: relative;
	height: 18px;
	background: #eef1f5;
	border-radius: 9px;
	overflow: hidden;
	margin-top: 6px;
}
.thermo__bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #2c5cdd 0%, #4d7df0 100%);
	border-radius: 9px;
	transition: width .2s ease;
}
.thermo__bar--done { background: linear-gradient(90deg, #1f9d55 0%, #2dbf6c 100%); }
.thermo__bar--error { background: linear-gradient(90deg, #c0392b 0%, #e85f50 100%); }
.thermo__label {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	font-size: 11px; font-weight: 600;
	color: #1a2434;
	mix-blend-mode: difference;
	color: #fff;
}

.upload-item__status { font-size: 12px; }
.upload-item__status--done { color: var(--c-success); }
.upload-item__status--error { color: var(--c-danger); }

/* Submission history */
.submission { border-left: 3px solid var(--c-primary); padding: 10px 14px; margin-bottom: 10px; background: #fafbfc; border-radius: var(--radius); }
.submission__meta { color: var(--c-muted); font-size: 12px; }
.submission__files { margin-top: 6px; }
.submission__files li { margin: 2px 0; }

.dl-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
	background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
	padding: 16px;
}
.stat__label { color: var(--c-muted); font-size: 12px; text-transform: uppercase; }
.stat__value { font-size: 26px; font-weight: 700; margin-top: 4px; }

/* Delivery progress (klient list) */
.delivery { min-width: 140px; }
.delivery__count { font-size: 13px; margin-bottom: 4px; }
.delivery__count strong { font-size: 14px; }
.delivery__bar {
	height: 6px;
	background: #eef1f5;
	border-radius: 3px;
	overflow: hidden;
}
.delivery__fill {
	height: 100%;
	background: linear-gradient(90deg, #2c5cdd 0%, #4d7df0 100%);
	transition: width .2s ease;
}
.delivery__fill--done {
	background: linear-gradient(90deg, #1f9d55 0%, #2dbf6c 100%);
}

/* Online form */
.online-form .card { padding: 24px 28px; }
.online-form label { display: block; margin-bottom: 4px; font-weight: 500; }
.online-form input[type=text], .online-form input[type=email], .online-form input[type=number],
.online-form input[type=date], .online-form textarea, .online-form select {
	width: 100%; padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px;
}
.online-form textarea { min-height: 80px; }
.online-form .row { margin-bottom: 12px; }
.online-form h2, .online-form h3 { margin: 18px 0 10px; }

.form-preview {
	background: #fafbfc;
	padding: 20px 24px;
	border-radius: var(--radius);
	border: 1px dashed var(--c-border);
}
.form-preview input, .form-preview textarea, .form-preview select {
	background: #fff;
	pointer-events: none;
}

/* Signature methods */
.signature-methods { display: grid; gap: 10px; }
.signature-method {
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	padding: 14px 18px;
	background: #fff;
}
.signature-method.disabled { opacity: .5; }
.signature-method__label { margin-bottom: 8px; }
.signature-method__detail input[type=text] {
	font-size: 18px;
	letter-spacing: .3em;
	text-align: center;
	font-family: 'SF Mono', Consolas, monospace;
}

.muted { color: var(--c-muted); }
.text-right { text-align: right; }
.small { font-size: 12px; }

/* ======================================================================
   Auth screen — login, forgot, reset
   ====================================================================== */
body.auth-body {
	min-height: 100vh;
	background: #0a1628;
}
.auth-bg {
	position: fixed; inset: 0; z-index: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.auth-bg__overlay {
	position: absolute; inset: 0;
	background: linear-gradient(
		135deg,
		rgba(10, 22, 40, .35) 0%,
		rgba(10, 22, 40, .55) 50%,
		rgba(10, 22, 40, .75) 100%
	);
}
.auth-shell {
	position: relative; z-index: 1;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px;
}
.auth-card {
	width: 100%;
	max-width: 420px;
	background: rgba(255, 255, 255, .97);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 14px;
	padding: 36px 40px 32px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .35), 0 0 1px rgba(255, 255, 255, .2);
}
/* Pozvánka nese víc textu než přihlášení, proto širší karta. */
.auth-card--wide { max-width: 588px; }
.auth-card__brand {
	text-align: center;
	margin-bottom: 28px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--c-border);
}
.auth-card__home {
	display: block;
	transition: opacity .15s;
}
.auth-card__home:hover { opacity: .75; }
.auth-card__logo {
	display: block; margin: 0 auto;
	width: 70%; height: auto;
}
.auth-card__title {
	font-size: 18px;
	margin: 0 0 18px;
	color: var(--c-text);
	font-weight: 600;
}
.auth-card__back { text-align: center; margin-top: 16px; }

/* Chybové stránky (403, 404, …) — stejná karta jako přihlášení. */
.errpage { text-align: center; }
.errpage__code {
	margin: 0 0 6px;
	font-size: 44px; font-weight: 800; letter-spacing: 2px;
	color: var(--c-muted); opacity: .55;
}
.errpage__title { font-size: 19px; font-weight: 600; margin: 0 0 12px; color: var(--c-text); }
.errpage__text { margin: 0 0 22px; color: var(--c-muted); font-size: 14px; line-height: 1.55; }
.errpage__actions { display: flex; justify-content: center; }

.auth-card form .form-row { margin-bottom: 14px; }
.auth-card form .form-row label { font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.auth-card form input[type=email],
.auth-card form input[type=password],
.auth-card form input[type=text] {
	padding: 10px 12px;
	font-size: 14px;
	border-radius: 8px;
}
.auth-card form input[type=email]:focus,
.auth-card form input[type=password]:focus,
.auth-card form input[type=text]:focus {
	outline: 2px solid var(--c-primary);
	outline-offset: -1px;
	border-color: var(--c-primary);
}

.form-row--inline {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 18px !important;
}
.checkbox {
	display: flex; align-items: center; gap: 8px;
	font-size: 13px; color: var(--c-muted);
	cursor: pointer;
	font-weight: 400 !important;
	margin-bottom: 0 !important;
}
.checkbox input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.checkbox span { user-select: none; }

.auth-link {
	font-size: 13px;
	color: var(--c-primary);
	text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

.btn--block { display: block; width: 100%; padding: 12px; font-size: 14px; font-weight: 600; }

.auth-footer {
	color: rgba(255, 255, 255, .6);
	font-size: 12px;
	margin-top: 24px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.auth-shell .flash {
	width: 100%;
	max-width: 420px;
	margin-bottom: 12px;
}

/* Skupina tlačítek v buňce tabulky — udrží tlačítka na jednom řádku */
.row-actions {
	display: inline-flex;
	gap: 6px;
	justify-content: flex-end;
	white-space: nowrap;
}

/* ===== Grid zakázek (excel-like) ===== */
/* Toolbar sedí nad full-bleed gridem — sdílí s ním horizontální rozsah,
   aby h1 „Zakázky / Klienti" bylo u levého okraje stránky, ne uprostřed
   1200-wide layoutu jako ostatní obsah. */
.egrid-toolbar {
	display: flex; align-items: center; gap: 16px; margin-bottom: 8px;
	width: calc(100vw - 48px);
	margin-left: calc(50% - 50vw + 24px);
}
.egrid-toolbar__count { color: var(--c-muted); font-size: 13px; white-space: nowrap; }
.egrid-toolbar__years { display: flex; gap: 6px; flex: 1; }
.egrid-create { position: relative; }
.egrid-create summary { list-style: none; }
.egrid-create summary::-webkit-details-marker { display: none; }
.egrid-create__panel {
	position: absolute; right: 0; top: calc(100% + 6px);
	width: 360px; padding: 16px;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	z-index: 60;
}
.egrid-create__panel label { display: block; font-weight: 500; margin: 8px 0 2px; }
.egrid-create__panel select { width: 100%; padding: 6px; border: 1px solid var(--c-border); border-radius: var(--radius); }
.egrid-create__panel button { margin-top: 12px; }

.egrid-wrap {
	/* full-bleed — tabulka je širší než layout (max-width 1200px) */
	width: calc(100vw - 48px);
	margin-left: calc(50% - 50vw + 24px);
	max-height: calc(100vh - 220px);
	overflow: auto;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.egrid {
	border-collapse: separate; border-spacing: 0;
	font-size: 12px;
	width: max-content;
}
.egrid th, .egrid td {
	border-right: 1px solid var(--c-border);
	border-bottom: 1px solid var(--c-border);
	padding: 4px 8px;
	white-space: nowrap;
	background: var(--c-surface);
}

/* Záhlaví — ukotvené nahoře (řádek skupin + řádek popisků) */
.egrid thead th { position: sticky; z-index: 3; font-weight: 600; text-align: left; }
.egrid__grouprow th { top: 0; height: 28px; background: var(--c-accent); }
.egrid__group { color: var(--c-primary-dark); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.egrid__headrow th { top: 28px; background: #f8fafc; max-width: 150px; white-space: normal; vertical-align: bottom; font-weight: 500; line-height: 1.25; }

/* První sloupce — ukotvené vlevo */
.egrid__sticky { position: sticky; z-index: 2; }
/* šířka pro až 7 ikon (✕ 🚗 📋 🤝 💰 + zámeček a stažení u smlouvy) */
.egrid__sticky--icons { left: 0; min-width: 164px; max-width: 164px; }
.egrid__sticky--client { left: 164px; min-width: 180px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.egrid thead .egrid__sticky { z-index: 5; background: var(--c-accent); vertical-align: middle; }

.egrid tbody tr.egrid__row--even td { background: #fafbfc; }
.egrid tbody tr:hover td { background: var(--c-accent); }

/* Součtový řádek — ukotvený dole, aby zůstal vidět při scrollu dlouhého gridu */
.egrid tfoot td {
	position: sticky; bottom: 0; z-index: 3;
	background: #f1f5f9; font-weight: 600;
	border-top: 2px solid var(--c-border);
}
.egrid tfoot .egrid__sticky { z-index: 5; background: var(--c-accent); }
.egrid--selectable tfoot .egrid__sticky--check { min-width: 76px; max-width: 76px; }

/* Průběžkové sloupce — jemně žluté; zebra i hover mají vlastní žluté odstíny */
.egrid td.egrid__col--interim { background: #fdf9e3; }
.egrid tbody tr.egrid__row--even td.egrid__col--interim { background: #f8f2d6; }
.egrid tbody tr:hover td.egrid__col--interim { background: #f1e7bd; }
.egrid__grouprow th.egrid__col--interim { background: #f3edd2; }
.egrid__headrow th.egrid__col--interim { background: #faf5df; }

/* Řazení — klik na záhlaví sloupce */
.egrid__sortable { cursor: pointer; user-select: none; }
.egrid__sortable[data-dir='asc']::after { content: ' ▲'; font-size: 9px; }
.egrid__sortable[data-dir='desc']::after { content: ' ▼'; font-size: 9px; }

/* Filtrovací řádek pod záhlavím u ostatních gridů (faktury, klienti, šablony).
   Grid zakázek přešel na popover pattern (viz .egrid__filterbtn níže) — ostatní
   gridy pořád vytvářejí <tr class="egrid__filterrow"> a čekají tato pravidla. */
.egrid thead .egrid__filterrow th { background: #f1f5f9; padding: 2px 4px; }
.egrid__filterrow .egrid__filter {
	width: 100%; min-width: 70px; box-sizing: border-box;
	font: inherit; font-size: 11px; padding: 2px 4px;
	border: 1px solid var(--c-border); border-radius: 3px; background: #fff;
}
.egrid__filterrow .egrid__filterwrap { display: flex; gap: 2px; }
.egrid__filterrow .egrid__filterop { width: auto; min-width: 0; flex: 0 0 auto; padding: 2px 1px; }
.egrid__filterrow .egrid__filterwrap input.egrid__filter { flex: 1 1 auto; width: auto; min-width: 84px; }

/* Filtr popover v záhlaví — místo filtrovacího řádku pod záhlavím sedí
   ikonka 🔍 vedle popisku sloupce, klik otevře plovoucí popover s ovládáním
   filtru. Aktivní filtr se pozná modrým kruhovým badgem kolem lupy. */
.egrid__filterbtn {
	background: none; border: 0; cursor: pointer;
	color: var(--c-muted); font-size: 12px;
	padding: 0; margin-left: 6px;
	line-height: 1; vertical-align: middle;
	opacity: 0.55;
	width: 22px; height: 22px;
	border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
}
.egrid__filterbtn:hover { opacity: 1; background: rgba(44, 92, 221, 0.1); }
.egrid__filterbtn--active {
	opacity: 1;
	background: var(--c-primary);
	color: #fff;
	box-shadow: 0 1px 3px rgba(44, 92, 221, 0.4);
}
.egrid__filterbtn--active:hover { background: var(--c-primary-dark); }
.egrid__filterpopover {
	position: fixed; z-index: 200;
	background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 10px 12px;
	min-width: 220px; font-size: 12px;
}
.egrid__filterpopover .egrid__filter {
	width: 100%; box-sizing: border-box;
	font: inherit; font-size: 13px; padding: 4px 8px;
	border: 1px solid var(--c-border); border-radius: 3px; background: #fff;
}
.egrid__filterpopover .egrid__filterwrap { display: flex; gap: 4px; margin-top: 4px; }
.egrid__filterpopover .egrid__filterop { flex: 0 0 auto; width: auto; }
.egrid__filterpopover .egrid__filterwrap input.egrid__filter { flex: 1 1 auto; min-width: 0; }
.egrid__filterlist { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.egrid__filterlist__item {
	display: flex; align-items: center; gap: 6px;
	padding: 3px 4px; border-radius: 3px; cursor: pointer;
	font-size: 13px; white-space: nowrap;
}
.egrid__filterlist__item:hover { background: var(--c-accent); }
.egrid__filterlist__item input { margin: 0; cursor: pointer; }
.egrid__filterpopover__actions {
	display: flex; justify-content: space-between; align-items: center;
	margin-top: 8px; gap: 6px;
}
.egrid__filterpopover__label {
	font-size: 11px; color: var(--c-muted);
	text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.egrid__filterpopover__clear {
	background: none; border: 0; cursor: pointer;
	color: var(--c-muted); font-size: 12px; padding: 2px 6px;
}
.egrid__filterpopover__clear:hover { color: var(--c-danger); }
.egrid__filterreset {
	background: none; border: 1px solid var(--c-border); border-radius: 3px;
	cursor: pointer; font-size: 12px; padding: 2px 8px; color: var(--c-muted);
	margin-left: 6px;
}
.egrid__filterreset:hover { color: var(--c-danger); border-color: var(--c-danger); }

.egrid__icons { text-align: center; }
.egrid__icons form { display: inline; }
.egrid__iconbtn {
	display: inline-block; background: none; border: 0; cursor: pointer;
	font-size: 13px; padding: 0 3px; text-decoration: none; vertical-align: middle;
}
.egrid__iconbtn:hover { text-decoration: none; transform: scale(1.2); }
.egrid__iconbtn--danger { color: var(--c-danger); font-weight: 700; }
.egrid__iconbtn--warn { filter: drop-shadow(0 0 2px rgba(217, 119, 6, 0.6)); }
/* Nedostupná akce — místo zmizelé ikony zůstane šedý otisk s vysvětlením
   v titulku, aby bylo poznat, že akce existuje, jen tady nejde. */
.egrid__iconbtn--disabled { color: var(--c-border); cursor: not-allowed; }
.egrid__iconbtn--disabled:hover { transform: none; }

/* Akce v hlavičce detailu šablony spisu (archivovat / smazat). */
.tpl-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-actions__note { max-width: 22ch; text-align: right; }

/* Dropdown menu akcí v gridu zakázek — místo řady ikonek jedna ikona ⋯,
   klik otevře plovoucí panel s pojmenovanými akcemi. Panel je fixed a JS
   ho polohuje k tlačítku, aby ho sticky sousední buňky neschovaly. */
.egrid-menu { display: inline-block; }
.egrid-menu__trigger { font-size: 18px; font-weight: 700; padding: 0 6px; }
.egrid-menu__panel {
	display: none; position: fixed; z-index: 200;
	background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
	box-shadow: var(--shadow); min-width: 220px; padding: 4px 0;
	text-align: left;
	overflow-y: auto; /* max-height nastaví kebab-menu.js, když se menu nevejde do okna */
}
.egrid-menu--open .egrid-menu__panel,
.egrid-menu__panel--open { display: block; }
.egrid-menu__item {
	display: flex; align-items: center; gap: 8px; width: 100%;
	padding: 8px 12px; background: none; border: 0;
	color: var(--c-text); font-size: 13px; text-align: left;
	cursor: pointer; text-decoration: none;
	font-family: inherit;
}
.egrid-menu__item:hover { background: var(--c-accent); text-decoration: none; }
.egrid-menu__icon { display: inline-block; width: 20px; text-align: center; }
.egrid-menu__separator {
	height: 1px; background: var(--c-border); margin: 4px 0;
}
.egrid-menu__form { margin: 0; padding: 0; display: block; }
.egrid-menu__item--danger { color: var(--c-danger); }
.egrid-menu__item--danger:hover { background: #fde2e1; }

.egrid__cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.egrid__cell--num { text-align: right; }
.egrid__cell--edit { cursor: cell; }
/* jen ztlumený text — opacity na celé buňce by zprůhlednila i rámečky */
.egrid__cell--faded { color: rgba(26, 36, 52, .22); }
.egrid__cell--editing { padding: 0; overflow: visible; }
.egrid__cell--saved { animation: egrid-saved .9s; }
@keyframes egrid-saved { from { background: #d6f5e3; } }
.egrid__triplink { display: block; }

.egrid__editor {
	width: 100%; min-width: 110px;
	font: inherit; padding: 3px 6px;
	border: 2px solid var(--c-primary); border-radius: 0;
	outline: none; background: #fff;
}
select[multiple].egrid__editor { min-width: 90px; }

/* ===== Grid klientů (variant egrid) ===== */
/* Klientský grid — širší client sloupec (jméno klienta), užší icons sloupec (3 akce) */
.cgrid .egrid__sticky--icons { min-width: 96px; max-width: 96px; }
.cgrid .egrid__sticky--client { left: 96px; min-width: 220px; max-width: 220px; }
.cgrid .egrid__sticky--client a { color: inherit; text-decoration: none; }
.cgrid .egrid__sticky--client a:hover { color: var(--c-primary); text-decoration: underline; }
/* Zástupce — dlouhý text s ellipsis */
.cgrid__cell--long { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
/* Kompaktní zobrazení dodáno/požadováno */
.cgrid__delivery { font-size: 12px; white-space: nowrap; }
.cgrid__delivery--done { color: var(--c-success, #16a34a); font-weight: 600; }
/* Toolbar rozšíření — oddělovač a AML label */
.cgrid-toolbar__divider { color: var(--c-muted); margin: 0 4px; }
.cgrid-toolbar__label { color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* Grid šablon — širší jméno pro popis, kompaktní ikony (jen 3 akce) */
.tgrid .egrid__sticky--icons { min-width: 88px; max-width: 88px; }
.tgrid .egrid__sticky--client { left: 88px; min-width: 300px; max-width: 300px; white-space: normal; }
.tgrid .egrid__sticky--client a { color: inherit; text-decoration: none; }
.tgrid .egrid__sticky--client a:hover { color: var(--c-primary); text-decoration: underline; }
.tgrid .egrid__sticky--client .small { white-space: normal; line-height: 1.3; }

/* ===== Potvrzovací dialog ===== */
dialog.confirm {
	border: 0; border-radius: var(--radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
	padding: 22px 24px; max-width: 420px; min-width: 300px;
}
dialog.confirm::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.confirm__title { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
/* pre-line: víceřádkové hlášky se sázejí přes \n, dialog plní jen textContent */
.confirm__message { color: var(--c-muted); line-height: 1.5; margin-bottom: 18px; white-space: pre-line; }
.confirm__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Plán, program a rozpočet auditorské zakázky ===== */
.plan tbody td { vertical-align: top; }
.plan .plan__sectionrow th {
	background: var(--c-accent); color: var(--c-primary-dark);
	font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
	text-align: left; padding: 8px 12px;
}
.plan .plan__titlecell span:first-child { margin-right: 4px; }
.plan__pencil { color: var(--c-muted); font-size: 11px; }
.plan__notecell { min-width: 10em; }

/* Buňka termínu: [−][+] čtvereček s posunem, datum, pod tím vysvětlivka */
.plan__dateline { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.plan__hint { margin-top: 3px; line-height: 1.3; max-width: 16em; }
.plan__shiftbtn {
	width: 20px; height: 20px; padding: 0; line-height: 1;
	border: 1px solid var(--c-border); border-radius: 3px; background: #fff;
	color: var(--c-muted); font-size: 13px; cursor: pointer;
}
.plan__shiftbtn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.plan__shiftbtn:disabled { opacity: .4; cursor: default; }
.plan__offset {
	display: inline-block; min-width: 24px; padding: 1px 3px; text-align: center;
	border: 1px solid var(--c-border); border-radius: 3px; background: #fafbfc;
	font-size: 11px; color: var(--c-muted); font-variant-numeric: tabular-nums;
}

/* Inline editace — vzor gridu zakázek */
.plan__cell--edit { cursor: cell; }
.plan td.plan__cell--editing { padding: 4px 6px; }
.plan__editor {
	width: 100%; min-width: 6em; box-sizing: border-box;
	font: inherit; padding: 3px 6px;
	border: 2px solid var(--c-primary); border-radius: 0;
	outline: none; background: #fff;
}
.plan__cell--saved { animation: plan-saved .9s; }
@keyframes plan-saved { from { background: #d6f5e3; } }

/* Překročení smluvní ceny — decentní zvýraznění v rozpočtu */
.plan__over { color: var(--c-danger); }
.plan__overnote { color: var(--c-danger); margin: 8px 2px 0; }

/* ===== Dialog smlouvy zakázky (contract.js) ===== */
dialog.cdialog {
	border: 0; border-radius: var(--radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
	padding: 22px 24px; width: 560px; max-width: calc(100vw - 32px);
}
dialog.cdialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.cdialog__title { font-weight: 600; font-size: 16px; margin-bottom: 14px; }
.cdialog__note { color: var(--c-muted); }
.cdialog__loading { padding: 20px 0; text-align: center; }
.cdialog__error { background: #f8d7da; color: #721c24; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.cdialog__error[hidden] { display: none; }
.cdialog__warning { background: #fff3cd; color: #856404; padding: 8px 12px; border-radius: var(--radius); font-size: 12px; margin: 10px 0; }
.cdialog__notice { background: #d4edda; color: #155724; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.cdialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Kroky 1–3: číslovaná sekce, hotový krok zelené ✓, neaktivní ztlumený */
.cstep { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.cstep--inactive { opacity: .55; }
.cstep--done { border-color: #bfe5cd; background: #f4fbf7; }
.cstep__head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cstep__num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 20px; height: 20px; border-radius: 50%; flex: none;
	background: var(--c-accent); color: var(--c-primary-dark);
	font-size: 11px; font-weight: 700;
}
.cstep--done .cstep__num { background: var(--c-success); color: #fff; }
.cstep__body { margin-top: 8px; }
.cstep__body p { margin: 6px 0; }
.cstep__ok { color: var(--c-success); font-weight: 500; }
.cstep__fields { display: grid; gap: 8px; margin-bottom: 10px; }
.cstep__field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.cstep__field input, .cstep__field select { width: 100%; padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); font: inherit; }
.cstep__ares { margin-top: 4px; }

/* ===== Dialog fakturace (invoice.js) ===== */
dialog.idialog { width: 860px; }
.idialog__sectiontitle { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); margin-bottom: 6px; }
.idialog__issued { margin-bottom: 4px; }
.idialog__table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.idialog__table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--c-muted); padding: 4px 8px; border-bottom: 2px solid var(--c-border); }
.idialog__table td { padding: 5px 8px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.idialog__row--editing td { background: #eef3fd; }
.idialog__num { text-align: right; white-space: nowrap; }
.idialog__state span { margin-right: 4px; }
.idialog__paid { white-space: nowrap; }
.idialog__paid input { font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid var(--c-border); border-radius: 4px; }
.idialog__paid .egrid__iconbtn { margin-left: 4px; }
/* akce jsou <td> — flex by rozbil table layout, mezery řeší marginy */
.idialog__rowactions { text-align: right; white-space: nowrap; }
.idialog__rowactions > * + * { margin-left: 6px; }
.idialog__rowactions .btn,
.idialog__rowactions .egrid__iconbtn { vertical-align: middle; }

/* formulář nové/editované faktury — vizuálně oddělený box pod seznamem dokladů */
.iform { background: #f6f8fc; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
.iform__heading { font-weight: 600; margin: 0 0 10px; }
.iform__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; margin-bottom: 12px; }
.iform__advance { display: flex; align-items: center; gap: 6px; font-weight: 500; padding: 6px 0; }
.iform__advance input { width: auto; }
.iform__items { border-top: 1px solid var(--c-border); padding-top: 8px; }
.iform__itemrow { display: grid; grid-template-columns: 1fr 90px 120px 120px 28px; gap: 6px; align-items: center; margin-bottom: 6px; }
.iform__itemrow--head { font-size: 11px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.iform__itemrow input { width: 100%; padding: 6px 8px; border: 1px solid var(--c-border); border-radius: var(--radius); font: inherit; }
.iform__linetotal { font-size: 13px; }
.iform__itemsfoot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 8px; }
.iform__totals { text-align: right; font-size: 13px; }
.iform__grand { font-weight: 700; font-size: 14px; margin-top: 2px; }
.iform__buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Seznam faktur (/auditor/faktury) — bez skupinového řádku má záhlaví top 0 */
.egrid.ilist .egrid__headrow th { top: 0; }
.ilist__num { text-align: right; }
.ilist__state span { margin-right: 4px; }
/* akce jsou <td> — flex by rozbil table layout */
.ilist__actions { white-space: nowrap; }
.ilist__actions > * + * { margin-left: 6px; }
.ilist__actions .btn,
.ilist__actions .egrid__iconbtn { vertical-align: middle; }

/* Editor šablony smlouvy — textarea je fallback bez JS, jinak ji nahradí Quill */
textarea.contract-editor {
	width: 100%; min-height: 60vh;
	font-family: 'SF Mono', Consolas, Menlo, monospace;
	font-size: 13px; line-height: 1.5;
}
.contract-editor__quill { background: #fff; }
.contract-editor__quill .ql-editor { min-height: 60vh; font-size: 14px; line-height: 1.55; }

/* Sticky toolbar — smlouva je dlouhá, panel nesmí odscrollovat s obsahem.
   Umístěn nad textareou (Quill jej vloží před .contract-editor__quill), proto
   vybíráme přes sourozeneckou vazbu — vyplňuje šířku karty, drží se u vrcholu. */
.card .ql-toolbar.ql-snow {
	position: sticky; top: 0; z-index: 5;
	background: #fff;
	border-top-left-radius: var(--radius);
	border-top-right-radius: var(--radius);
	box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

/* Vlastní tlačítko „Zalomit stránku" — Quill snow tlačítka jsou 28×24, s textem
   potřebují automatickou šířku. Necháváme dostatek prostoru a stylujeme jako pill. */
.ql-toolbar.ql-snow button.ql-pagebreak {
	width: auto; height: 24px; padding: 0 10px;
	border: 1px solid var(--c-border); border-radius: 12px;
	background: #f6f7fb;
	margin-left: 6px;
}
.ql-toolbar.ql-snow button.ql-pagebreak:hover { background: var(--c-accent); border-color: var(--c-primary); }
.ql-pagebreak__label { font-size: 11px; font-weight: 500; letter-spacing: .02em; }

/* Vizuální marker zalomení stránky v editoru — přerušovaná čára s popiskem */
.contract-editor__quill .ql-editor hr.page-break {
	position: relative;
	border: 0;
	height: 24px;
	margin: 12px 0;
	background:
		linear-gradient(to right, transparent 50%, transparent 50%) no-repeat center/100% 2px,
		repeating-linear-gradient(90deg, var(--c-primary) 0 8px, transparent 8px 16px) no-repeat center/100% 2px;
	background-position: center;
	cursor: default;
	user-select: none;
}
.contract-editor__quill .ql-editor hr.page-break::after {
	content: "— zalomení stránky —";
	position: absolute; left: 50%; top: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	padding: 0 12px;
	font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
	color: var(--c-primary);
}

/* ===== Hodnocení AML rizik (checklist 55 položek, Auditor:Kyc:assess) ===== */
.risk-table { width: 100%; border-collapse: collapse; }
.risk-table td { padding: 6px 4px; border-bottom: 1px solid var(--c-border); vertical-align: top; transition: background-color .12s ease; }
.risk-table tr:last-child td { border-bottom: 0; }
/* Zebra + modrý hover — stejný feel jako v gridu klientů a v ARES panelu.
   Aplikujeme na <td> (ne na <tr>), protože při `border-collapse: collapse`
   se background na řádku v některých prohlížečích neaplikuje na buňky. */
.risk-table tr:nth-child(odd) td { background-color: #fafbfc; }
.risk-table tr:hover td { background-color: var(--c-accent); }
.risk-table__item { padding-right: 16px; }
/* Trojice radií na jednom řádku vpravo — přepisuje globální blokové labely formulářů */
.risk-table__answers { white-space: nowrap; text-align: right; width: 1%; }
.risk-table__answers label {
	display: inline-flex; align-items: center; gap: 4px;
	font-weight: 400; font-size: 13px;
	margin: 0 0 0 14px; cursor: pointer;
}
.risk-table__answers input[type=radio] { margin: 0; }

/* Chybové hlášky AJAX akcí ve vizuálu flash zpráv */
.toast-stack {
	position: fixed; top: 16px; right: 16px; z-index: 1000;
	display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast-stack .flash { margin: 0; box-shadow: 0 8px 24px rgba(15, 23, 42, .18); }

/* Tabby — přepínání sekcí na detailu (JS setuje aria-selected/hidden podle hashe) */
.tabs {
	display: flex; gap: 4px; border-bottom: 2px solid var(--c-border);
	margin: 16px 0 20px;
}
.tabs__btn {
	background: transparent; border: none; padding: 10px 18px;
	font: inherit; color: var(--c-muted); cursor: pointer;
	border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs__btn:hover { color: var(--c-text); }
.tabs__btn[aria-selected="true"] { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.tab-panel[hidden] { display: none; }

/* Dvojpanel „naše DB ‖ ARES" v tabu Obecné */
.dualpanel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .dualpanel { grid-template-columns: 1fr; } }
.dualpanel .card { margin-top: 0; }
.dualpanel .card--ares { background: #eff5ff; border-color: #cfe0ff; }

/* Řádky panelu — na obou stranách stejná mřížka, aby label/hodnota seděly vedle sebe.
   Levý panel (formulář) používá stejné row grid layoutem `.arespanel-row` obalujícím formulářová pole. */
.arespanel-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--c-border); min-height: 44px; }
.arespanel-row:last-child { border-bottom: none; }
.arespanel-row > label { color: var(--c-muted); font-size: 12px; margin: 0; font-weight: normal; }
.arespanel-row input[type=text], .arespanel-row input:not([type]), .arespanel-row select { width: 100%; margin: 0; }
.arespanel-extra { margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--c-border); }
.arespanel-extra > h4 { margin: 0 0 8px; font-size: 12px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .5px; }

.field-diff { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--c-border); min-height: 44px; }
.field-diff:last-child { border-bottom: none; }
.field-diff__label { color: var(--c-muted); font-size: 12px; }
.field-diff__value { word-break: break-word; }
.field-diff__value--empty { color: var(--c-muted); font-style: italic; }
.field-diff__value--diff { background: #fff8e1; padding: 2px 6px; border-radius: 3px; }
.field-diff__copy { font-size: 11px; padding: 3px 8px; }

/* Zebra + modrý hover na řádcích detailu klienta — stejný feel jako grid klientů.
   Kryjeme oba panely (form + ARES); nth-child pracuje v rámci vlastního parentu,
   takže levý formulář a pravý panel počítají řádky samostatně, ale vizuálně to
   sedí — obě strany začínají první „obchodní jméno" a mají stejnou výšku řádku. */
.arespanel-row,
.field-diff { transition: background-color .12s ease; }
.arespanel-row:nth-child(odd),
.field-diff:nth-child(odd) { background-color: #fafbfc; }
.arespanel-row:hover,
.field-diff:hover { background-color: var(--c-accent); }

.ares-empty { text-align: center; padding: 20px; color: var(--c-muted); }
.ares-error { background: #f8d7da; color: #721c24; padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; }
.ares-buffered { background: #fff8e1; border-left: 4px solid #f2b90b; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

/* Historie snapshotů */
.snapshot-list { max-height: 260px; overflow-y: auto; }

/* Porovnání aktuální vs vybraný snapshot — dvousloupcová mřížka, uvnitř kartu ARES-only. */
.snapcompare { display: grid; grid-template-columns: 200px 1fr 1fr; gap: 4px 12px; align-items: start; }
.snapcompare__label { color: var(--c-muted); font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--c-border); }
.snapcompare__cell { padding: 6px 8px; border-bottom: 1px solid var(--c-border); word-break: break-word; }
.snapcompare__cell--diff { background: #fff8e1; }
.snapcompare__header { font-weight: 600; padding: 6px 8px; background: var(--c-accent); border-bottom: 2px solid var(--c-border); }
.snapcompare__section { grid-column: 1 / -1; margin-top: 16px; padding-top: 8px; border-top: 2px solid var(--c-border); font-weight: 600; font-size: 13px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .5px; }
.snapcompare__cell table { width: 100%; font-size: 12px; }
.snapcompare__cell table th, .snapcompare__cell table td { padding: 4px 6px; }
.snapshot-picker { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.snapshot-picker select { padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); }

/* Panel „detaily z ARES" (VR) — rozbalovací */
.ares-vr { margin-top: 12px; }
.ares-vr__section { margin: 12px 0; }
.ares-vr__section h4 { margin: 8px 0 6px; font-size: 13px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .5px; }
.ares-vr table { width: 100%; }

/* Sankční kontroly EU — bloky prověřených subjektů v tabu AML */
.sanction-subject { margin: 10px 0; padding: 8px 0; border-bottom: 1px solid var(--c-border); }
.sanction-subject:last-of-type { border-bottom: none; }

/* ===== E-mailové notifikace klientům ===== */
/* Podnavigace sekcí (Odeslání | Šablony | Historie) + skupina toolbar tlačítek */
.subnav { display: flex; gap: 6px; align-items: center; }

/* Sloupec výběru v gridu zakázek — sticky úplně vlevo. Offsety následujících
   sticky sloupců posouvá jen varianta egrid--selectable, aby se nerozbily
   ostatní gridy (cgrid, tgrid, ilist) bez checkboxů. Ikonový sloupec drží
   trigger dropdown menu (⋯) + volitelně 🙈 pro nepublikovanou smlouvu —
   výrazně užší než dřív (88 px místo 188 px). Záhlaví sloupce výběru je
   širší (76 px), aby se do něj vešly velké přepínače „vybrat vše / zrušit". */
.egrid--selectable .egrid__sticky--check { left: 0; min-width: 36px; max-width: 36px; text-align: center; }
.egrid--selectable .egrid__sticky--check-head { min-width: 76px; max-width: 76px; padding: 4px 4px; }
.egrid--selectable thead ~ tbody .egrid__sticky--check { min-width: 76px; max-width: 76px; }
.egrid--selectable .egrid__sticky--icons { left: 76px; min-width: 88px; max-width: 88px; }
.egrid--selectable .egrid__sticky--client { left: 164px; }
.egrid__clientlink { color: inherit; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; }
.egrid__clientlink:hover { color: var(--c-primary); text-decoration: underline; }

/* Pozvánkový odkaz klienta — URL je dlouhá, drží se v readonly inputu vedle tlačítka. */
.invite-generate { display: inline-flex; align-items: center; gap: 8px; }
.invite-generate select { width: auto; min-width: 220px; }
.invite-link { display: flex; align-items: center; gap: 6px; }
.invite-link__url {
	flex: 1; min-width: 240px; padding: 4px 8px; border: 1px solid var(--c-border);
	border-radius: var(--radius); font-family: 'SF Mono', Menlo, monospace; font-size: 12px;
	background: #f8fafc; color: var(--c-muted);
}
.notify-check { margin: 0; vertical-align: middle; cursor: pointer; width: 18px; height: 18px; }
.egrid__checktoggle { display: flex; gap: 3px; justify-content: center; }
.egrid__checkbtn {
	background: #fff; border: 1px solid var(--c-border); border-radius: 4px;
	cursor: pointer; font-size: 16px; line-height: 1; padding: 3px 6px;
	color: var(--c-primary);
}
.egrid__checkbtn:hover { background: var(--c-accent); }

/* Badge pilulky v gridu zakázek — HTML `<span class="egrid-badge …">` renderuje
   server (EngagementGridService::badgeHtml). JS při AJAX úpravě zapíše
   innerHTML jen pro buňky se `data-html="1"`. Barvy stejné jako u pilulek
   na stránce klientů, jen s tmavším podbarvením pro lepší kontrast. */
.egrid-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	/* Stejně velké jako text buňky (.egrid = 12px) — sloupec s pilulkou nemá
	   vypadat drobněji než sloupec s prostým textem vedle něj. */
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .03em;
	line-height: 1.4;
	white-space: nowrap;
}
.egrid__cell[data-field="wg_interim"],
.egrid__cell[data-field="wg_inventory"],
.egrid__cell[data-field="wg_final"] { line-height: 1.8; }
.egrid__cell[data-field="wg_interim"] .egrid-badge,
.egrid__cell[data-field="wg_inventory"] .egrid-badge,
.egrid__cell[data-field="wg_final"] .egrid-badge { margin-right: 2px; }

/* Kategorie zakázky */
.egrid-badge--category-AUD { background: #d4edda; color: #155724; }
.egrid-badge--category-PRE { background: #e1f0fa; color: #1e5d8a; }
.egrid-badge--category-VYK { background: #e5e0ff; color: #4b3a99; }
.egrid-badge--category-DOT { background: #fff3cd; color: #856404; }
.egrid-badge--category-KON { background: #ffe8d1; color: #7a3e00; }
.egrid-badge--category-PRO { background: #fde2e1; color: #9c2924; }
.egrid-badge--category-ZAH { background: #f1f3f6; color: var(--c-muted); }

/* Povinnost auditu — dobrovolný audit je výjimka, tak ať je vidět. */
.egrid-badge--required-yes { background: #f1f3f6; color: var(--c-muted); }
.egrid-badge--required-no { background: #fff3cd; color: #856404; }
/* Ano/ne u průběžné kontroly — na rozdíl od `required` tady jde o rozhodnutí
   „děláme / neděláme", proto zelená a červená, ne šedá a jantarová. */
.egrid-badge--yesno-yes { background: #d4edda; color: #155724; }
.egrid-badge--yesno-no { background: #f8d7da; color: #721c24; }

/* Právní forma klienta — barvy odpovídají badge v seznamu klientů:
   obchodní společnosti červeně, neziskovky modře, samospráva zeleně. */
.egrid-badge--clienttype-sro,
.egrid-badge--clienttype-as,
.egrid-badge--clienttype-vos,
.egrid-badge--clienttype-ks,
.egrid-badge--clienttype-druzstvo { background: #fde2e1; color: #9c2924; }
.egrid-badge--clienttype-spolek,
.egrid-badge--clienttype-ustav,
.egrid-badge--clienttype-nadace,
.egrid-badge--clienttype-ops { background: #e1f0fa; color: #1e5d8a; }
.egrid-badge--clienttype-obec,
.egrid-badge--clienttype-dso,
.egrid-badge--clienttype-pro { background: #d4edda; color: #155724; }
.egrid-badge--clienttype-osvc,
.egrid-badge--clienttype-jine { background: #f1f3f6; color: var(--c-muted); }

/* Velikost jednotky */
.egrid-badge--size-M { background: #f0f4ff; color: var(--c-primary-dark); }
.egrid-badge--size-L { background: #e1f0fa; color: #1e5d8a; }
.egrid-badge--size-S { background: #fff3cd; color: #856404; }
.egrid-badge--size-V { background: #fde2e1; color: #9c2924; }

/* Zálohová faktura */
.egrid-badge--advance-0\.5 { background: #fff3cd; color: #856404; }
.egrid-badge--advance-1\.0 { background: #d4edda; color: #155724; }

/* Uživatelské pilulky (referent + pracovní skupina) — paleta 8 barev
   deterministicky přiřazená podle user_id % 8, aby si uživatel držel
   stejnou barvu napříč gridem. Kontrastní tmavý text na světlém pozadí. */
/* Zdroj dokumentu — interní oranžová (auditor pracuje sám), klient světle modrá (očekává upload) */
.egrid-badge--source-internal { background: #ffedd5; color: #7c2d12; }
.egrid-badge--source-client { background: #e1f0fa; color: #1e5d8a; }

/* Fáze požadavku — průběžná kontrola se odlišuje od ročního auditu, aby dvojice
   dokladů z téže šablony (stav k 30.9. vs. k 31.12.) nesplynula. */
.egrid-badge--phase-interim { background: #ede9fe; color: #5b21b6; }

/* Klikatelný badge klient ve spisu → modal zámku. Reset button defaults,
   aby vypadal identicky jako <span class="egrid-badge"> (interní badge). */
button.egrid-badge--clickable {
	border: 0; margin: 0; cursor: pointer; font-family: inherit;
	/* Musíme znovu zopakovat některé egrid-badge hodnoty, protože button
	   je form control a browser reset (`font: -webkit-small-control`) je
	   silnější než parent inheritance. */
	padding: 2px 8px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .03em;
	line-height: 1.4;
	transition: filter .12s ease;
	vertical-align: middle;
}
button.egrid-badge--clickable:hover { filter: brightness(0.92); }

/* Malý zámek nalevo od badge zdroje ve spisu. Vertikální zarovnání jde
   na střed badge — obojí vertical-align: middle, ať se nekryjí špatně. */
.lock-icon {
	display: inline-block; vertical-align: middle;
	margin-right: 4px; font-size: 13px; line-height: 1;
}


.egrid-badge--user-0 { background: #dbeafe; color: #1e3a8a; }
.egrid-badge--user-1 { background: #dcfce7; color: #14532d; }
.egrid-badge--user-2 { background: #fef3c7; color: #78350f; }
.egrid-badge--user-3 { background: #fce7f3; color: #831843; }
.egrid-badge--user-4 { background: #ede9fe; color: #4c1d95; }
.egrid-badge--user-5 { background: #ffedd5; color: #7c2d12; }
.egrid-badge--user-6 { background: #ccfbf1; color: #134e4a; }
.egrid-badge--user-7 { background: #fee2e2; color: #7f1d1d; }

/* Compose — řádek příjemce bez primárního kontaktu (přeskočí se) */
tr.notify-skip td { color: var(--c-muted); background: #fafbfc; }

/* Náhledy šablon na compose obrazovce */
.notification-previews details { border-bottom: 1px solid var(--c-border); padding: 4px 0; }
.notification-previews details:last-child { border-bottom: 0; }
.notification-previews summary { cursor: pointer; font-weight: 500; padding: 6px 0; }
.notification-preview {
	border: 1px solid var(--c-border); border-radius: var(--radius);
	background: #fafbfc; padding: 12px 16px; margin: 4px 0 12px;
}

/* Editor šablony notifikace — textarea je fallback bez JS, jinak ji nahradí Quill.
   E-mail je krátký — nižší minimální výška než u smluv. */
.form-fields--meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .form-fields--meta { grid-template-columns: 1fr; } }
textarea.notification-editor {
	width: 100%; min-height: 320px;
	font-family: 'SF Mono', Consolas, Menlo, monospace;
	font-size: 13px; line-height: 1.5;
}
.notification-editor__quill { background: #fff; }
.notification-editor__quill .ql-editor { min-height: 320px; font-size: 14px; line-height: 1.55; }

/* ===== Šablona spisu — stromový pohled (grid s vloženými řádky kapitol) ===== */
/* Používá stejné .egrid třídy jako plochý seznam; kapitoly a subkategorie
   jsou plnošířkové řádky vsazené mezi dokumenty, barevně dle Excelu KAČR. */
.tgrid__chapter td {
	padding: 10px 16px !important;
	font-size: 14px; font-weight: 600;
	background: #a8c4f2; color: #0f2b5b !important;
}
.tgrid__chapter--stala td { background: #a9d99e; color: #1e4d16 !important; }
.tgrid__chapter--interni td { background: #f4b184; color: #6b2c0b !important; }
.tgrid__chapter-code {
	display: inline-block; min-width: 44px;
	font-family: 'SF Mono', Menlo, monospace; font-size: 12px; opacity: 0.85;
}
.tgrid__chapter-name { margin-right: 12px; }
.tgrid__chapter-count { color: rgba(0,0,0,.5); font-size: 11px; font-weight: 400; }

.tgrid__sub td {
	padding: 6px 16px !important;
	font-size: 12px; font-weight: 500;
	background: #d6e4f7 !important; color: #1a3a70 !important;
}
.tgrid__sub--stala td { background: #d5efc9 !important; color: #1e4d16 !important; }
.tgrid__sub--interni td { background: #fadfcb !important; color: #6b2c0b !important; }
.tgrid__sub-code {
	display: inline-block; min-width: 44px;
	font-family: 'SF Mono', Menlo, monospace; font-size: 11px; opacity: 0.85;
}
.tgrid__sub-name { margin-right: 12px; }
.tgrid__sub-count { color: rgba(0,0,0,.5); font-size: 11px; font-weight: 400; }

/* ===== Legacy .spis-tree (spis zakázky používá jinak, ale ponecháno) ===== */
/* Kapitoly = tmavší modrá (variant main), subkategorie = světlejší modrá.
   Odstín přesně kopíruje Excel obsahu spisu (theme 4 tint 0.6 vs 0.8).
   Stálá složka (A.) = zelenkavá, interní část (Z.) = oranžová. */
.spis-tree { margin-top: 12px; }
.spis-chapter { margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.spis-chapter__header {
	display: flex; align-items: baseline; gap: 12px;
	padding: 10px 16px; font-size: 15px; font-weight: 600;
	background: #a8c4f2; color: #0f2b5b;
}
.spis-chapter__code { min-width: 44px; font-family: 'SF Mono', Menlo, monospace; font-size: 13px; opacity: 0.85; }
.spis-chapter--stala .spis-chapter__header { background: #a9d99e; color: #1e4d16; }
.spis-chapter--interni .spis-chapter__header { background: #f4b184; color: #6b2c0b; }

.spis-sub { background: #fff; border-top: 1px solid var(--c-border); }
.spis-sub__header {
	display: flex; align-items: baseline; gap: 12px;
	padding: 6px 16px; font-size: 13px; font-weight: 500;
	background: #d6e4f7; color: #1a3a70;
}
.spis-sub__code { min-width: 44px; font-family: 'SF Mono', Menlo, monospace; font-size: 12px; opacity: 0.85; }
.spis-sub__name { flex: 1; }
.spis-sub__count { color: var(--c-muted); font-size: 11px; font-weight: 400; }
.spis-chapter--stala .spis-sub__header { background: #d5efc9; color: #1e4d16; }
.spis-chapter--interni .spis-sub__header { background: #fadfcb; color: #6b2c0b; }

.spis-sub__items { width: 100%; border-collapse: collapse; margin: 0; }
.spis-sub__items tr:not(:last-child) td { border-bottom: 1px solid #eef2f7; }
.spis-sub__items td { padding: 4px 12px; vertical-align: middle; }
.spis-item__code { width: 70px; }
.spis-item__code code {
	font-family: 'SF Mono', Menlo, monospace; font-size: 11px;
	background: #f1f5f9; padding: 1px 6px; border-radius: 3px; color: #334155;
}
.spis-item__name { }
/* Zarovnáno vpravo — badge zdroje (interní/klient) je vždy u pravé hrany,
   případný zámek 🔒 vlevo od něj. Řádky se pak zarovnají svisle: badge sedí
   na stejné pozici bez ohledu na to, jestli je před ním zámek nebo ne. */
.spis-item__source { width: 90px; text-align: right; white-space: nowrap; }
.spis-item__source .lock-icon,
.spis-item__source .egrid-badge { display: inline-block; vertical-align: middle; }
.spis-item__scope { width: 220px; }
.spis-item__scope .badge { margin-right: 3px; }
.spis-item__status { width: 150px; white-space: nowrap; }
.spis-item__status .badge { white-space: nowrap; }
.spis-item__due { width: 100px; white-space: nowrap; font-size: 12px; color: #334155; }
.spis-item__due--overdue { color: #b91c1c; font-weight: 600; }
.spis-item__due--editable { cursor: pointer; border-bottom: 1px dashed transparent; }
.spis-item__due--editable:hover { border-bottom-color: #94a3b8; }
.spis-item__due-input { width: 130px; font-size: 12px; padding: 2px 4px; border: 1px solid var(--c-primary); border-radius: 3px; }
.spis-item__due-icon { opacity: 0.35; font-size: 14px; }
.spis-item__due--editable:hover .spis-item__due-icon { opacity: 0.75; }
.spis-item__comment {
	margin-top: 4px; padding: 4px 8px;
	background: #fef2f2; color: #7f1d1d; font-size: 12px; line-height: 1.4;
	border-left: 3px solid #dc2626; border-radius: 2px;
}
.spis-item__actions { width: 200px; text-align: right; white-space: nowrap; }

/* Spis zakázky — dialogy pro náhled PDF a editor interního dokumentu.
   <dialog> HTML5 element: modální backdrop řeší prohlížeč, iframe zobrazí obsah. */
.spis-preview, .spis-editor {
	padding: 0; border: 0; border-radius: var(--radius);
	width: min(95vw, 1100px); height: min(92vh, 900px);
	box-shadow: 0 10px 40px rgba(15, 23, 42, .3);
}
/* Wide varianta — pro strukturované dotazníky (201.5a, 201.6a/b, 202.3a, 204.1)
   potřebujeme skoro celou stránku (100vw × 100vh) a plnou šířku obsahu. */
.spis-editor--wide { width: 99vw; height: 98vh; max-width: none; max-height: none; }
/* Inline lock modal (bez iframe) — pouze potvrzovací dialog. Height se
   nastaví podle obsahu, nemá zbytečné prázdno pod tlačítky. */
.spis-lock {
	padding: 24px 28px; border: 0; border-radius: var(--radius);
	width: min(90vw, 440px);
	box-shadow: 0 10px 40px rgba(15, 23, 42, .3);
	text-align: center;
}
.spis-lock::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.spis-lock__title { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.spis-lock__doc { margin: 0 0 12px; color: var(--c-muted); font-size: 13px; }
.spis-lock__hint { margin: 0 0 20px; font-size: 14px; line-height: 1.5; }
.spis-lock__actions { display: flex; justify-content: center; gap: 8px; }
.spis-preview::backdrop, .spis-editor::backdrop {
	background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px);
}
.spis-preview__header {
	display: flex; justify-content: space-between; align-items: center;
	padding: 8px 14px; border-bottom: 1px solid var(--c-border);
	background: #f8fafc;
}
.spis-preview__title { font-weight: 500; font-size: 14px; }
.spis-preview__frame {
	width: 100%; height: calc(100% - 46px); border: 0; display: block;
}
/* Editor už nemá externí hlavičku — chrome je uvnitř iframe (editor-head). */
.spis-editor__frame {
	width: 100%; height: 100%; border: 0; display: block;
}

/* Interní editor — Quill mount pro editor spisu */
textarea.internal-editor { width: 100%; min-height: 400px; font-family: monospace; font-size: 13px; }
.internal-editor__quill { background: #fff; }
.internal-editor__quill .ql-editor { min-height: 480px; font-size: 14px; line-height: 1.6; }
.internal-editor__wrap { max-width: 900px; margin: 0 auto; }
.internal-editor__title { display: flex; gap: 10px; align-items: center; font-size: 16px; }

/* Sjednocená hlavička editorů v sekci spisu (fillInternal, editInternal). */
.editor-head {
	display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
	gap: 12px 16px; padding-bottom: 12px; margin-bottom: 16px;
	border-bottom: 1px solid var(--c-border);
}
.editor-head__main { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.editor-head__ref code {
	font-family: 'SF Mono', Menlo, monospace; font-size: 12px;
	background: #f1f5f9; padding: 3px 8px; border-radius: 3px; color: #334155;
	font-weight: 600;
}
.editor-head__title { margin: 0; font-size: 18px; font-weight: 600; color: #1a2a44; line-height: 1.3; }
.editor-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.editor-head__saved { color: var(--c-muted); }
.editor-head__saved--stale { color: #a25200; text-decoration: line-through; }
.editor-head__dirty { color: #b3251b; font-weight: 600; }
.editor-head__due { color: #334155; }
.editor-head__due--overdue { color: #b91c1c; font-weight: 600; }
.online-preview { max-width: 900px; margin: 0 auto; }
.online-preview__title { display: flex; gap: 10px; align-items: center; font-size: 16px; margin-bottom: 12px; }
.online-preview__body { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px 20px; background: #fafbfc; }
/* Vyplněný online formulář v detailu souborů od klienta. */
.cfiles-onlineform { margin: 10px 0; }
.cfiles-onlineform > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.cfiles-onlineform .online-preview__body { overflow-x: auto; }
.online-preview__body h2 { margin-top: 0; }

/* Interní online formulář — memo layout (100.1 a další strukturované formuláře). */
.memo-form { color: #222; }
.memo-form__head { border-bottom: 2px solid var(--c-border); padding-bottom: 12px; margin-bottom: 20px; }
.memo-form__title { margin: 0 0 10px; font-size: 20px; }
.memo-form__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 24px; margin: 0; font-size: 13px; }
.memo-form__meta > div { display: flex; gap: 6px; }
.memo-form__meta dt { color: var(--c-muted); font-weight: 500; }
.memo-form__meta dt::after { content: ':'; }
.memo-form__meta dd { margin: 0; font-weight: 600; }

.memo-form__intro { margin-bottom: 20px; font-size: 14px; line-height: 1.55; }
.memo-form__intro p { margin: 0; }

.memo-form__section { margin-bottom: 24px; }
.memo-form__section-title { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: #1a2a44; }
.memo-form__help { margin: -4px 0 12px; color: var(--c-muted); font-size: 13px; }

.memo-form__choice { display: flex; flex-wrap: wrap; gap: 8px; }
.memo-form__radio {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 8px 14px; border: 1px solid var(--c-border); border-radius: var(--radius);
	background: #fff; cursor: pointer; font-size: 14px; user-select: none;
	transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.memo-form__radio:hover { background: #f4f7fb; border-color: #b7c3d6; }
.memo-form__radio:has(input:checked) { background: #eaf1ff; border-color: #4d7df0; box-shadow: inset 0 0 0 1px #4d7df0; font-weight: 600; }
.memo-form__radio input { margin: 0; }

.memo-form__table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.memo-form__table thead th {
	background: #f4f7fb; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase;
	letter-spacing: .04em; color: var(--c-muted); padding: 10px 12px; border-bottom: 1px solid var(--c-border);
}
.memo-form__table tbody tr { border-bottom: 1px solid #eef2f7; transition: background .12s ease; }
.memo-form__table tbody tr:hover { background: #eaf1ff; }
.memo-form__table tbody tr:last-child { border-bottom: none; }
.memo-form__table td { padding: 10px 12px; vertical-align: middle; }
.memo-form__col-num { width: 36px; color: var(--c-muted); text-align: center; font-variant-numeric: tabular-nums; }
.memo-form__col-q { line-height: 1.45; }
.memo-form__col-ans { width: 100px; white-space: nowrap; text-align: right; }
.memo-form__ans-group { display: inline-flex; }
.memo-form__col-tools { width: 32px; text-align: center; }
.memo-form__row-remove {
	border: 0; background: none; cursor: pointer; color: #d64545; font-size: 15px;
	padding: 2px 5px; border-radius: 4px; opacity: .55;
}
.memo-form__row-remove:hover { opacity: 1; background: #fef2f2; }
.memo-form__repeat-actions { margin: 8px 0 4px; }

/* Soupisy konfirmací (407.2a, 408.2a, 410.2a) — číselné sloupce zarovnané
   na desetinnou čárku, aby šly částky porovnat pohledem. */
.memo-form__col-acct { width: 70px; }
.memo-form__col-money { width: 110px; text-align: right; }
.memo-form__col-money input { text-align: right; font-variant-numeric: tabular-nums; }
.memo-form__col-unit { font-weight: 400; text-transform: none; letter-spacing: 0; }
.memo-form [data-rep-sum], .memo-form [data-rep-ratio] {
	background: #f4f7fb; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
}

/* Survey formulář 201.5a v iframe wide dialogu — obsah zabírá plnou šířku,
   nemá max-width 900px jako klasický fill-internal. */
body.bare .memo-form--survey { max-width: none; margin: 0; padding: 8px 16px; }
body.bare .internal-editor__wrap > .memo-form--survey { max-width: none; }

/* Klientská status karta u dotazníku 201.5a. */
.client-survey-status { padding: 12px 16px; margin-bottom: 16px; }
.client-survey-status__badge { margin-bottom: 8px; }
.client-survey-status__return {
	margin-top: 8px; padding: 12px 14px; border-left: 4px solid #e14b3f;
	background: #fdecea; border-radius: 4px;
}
.client-survey-status__return blockquote { margin: 6px 0; font-style: italic; color: #b3251b; }

/* Varianta pro 201.6 INFO list: strukturovaná pole s předvyplněnými hodnotami
   z ARES. Prefill banner nad formulářem + grid layout pro pole + kompaktnější
   tabulky pro opakující se sekce (akcionáři, zákazníci …). */
.memo-form__prefill {
	background: #e8f5e9; border-left: 4px solid #43a047; color: #1b5e20;
	padding: 10px 14px; margin: 0 0 20px; border-radius: 4px; font-size: 13px; line-height: 1.5;
}
.memo-form__prefill em { color: #2e7d32; }
/* Žluté upozornění uvnitř formuláře — použito např. u sekce 3 v 201.6b
   pro varování, že ARES seznam zřízených organizací je jen heuristika. */
.memo-form__warn {
	background: #fff8e1; border-left: 4px solid #f2b90b; color: #6b4a00;
	padding: 10px 14px; margin: 0 0 12px; border-radius: 4px; font-size: 13px; line-height: 1.5;
}
.memo-form__warn em { color: #8a5a00; font-style: normal; font-weight: 600; }
/* Modrý informační box — použito u 901.1 (deník ještě není nahrán) a u 411.4 (chybí předvaha). */
.memo-form__info {
	background: #e8f0fe; border-left: 4px solid #4285f4; color: #1a3a6b;
	padding: 10px 14px; margin: 0 0 12px; border-radius: 4px; font-size: 13px; line-height: 1.5;
}
/* Zelené potvrzení — použito u 901.1 (deník je podvojný, předvaha sedí). */
.memo-form__ok {
	background: #e6f4ea; border-left: 4px solid #34a853; color: #1e7c37;
	padding: 10px 14px; margin: 0 0 12px; border-radius: 4px; font-size: 13px; line-height: 1.5;
}
/* Tabulka obratové předvahy (901.1) — číselné sloupce doprava, záporné červeně. */
.tb-form__table { width: 100%; }
.tb-form__col-code { width: 72px; font-variant-numeric: tabular-nums; }
.tb-form__col-name { min-width: 180px; }
.tb-form__col-class { min-width: 140px; color: var(--c-muted); font-size: 12px; }
.tb-form__col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; width: 140px; }
.tb-form__num--negative { color: #b3251b; }
.tb-form__totals td { border-top: 2px solid var(--c-border); background: var(--c-accent); }
.tb-form__diff-row { background: #fff8e1; }
.tb-form__table--diff .tb-form__col-num { width: 160px; }
/* Sloupce v repeateru zakázek — numerické vstupy doprava zarovnané. */
.vz-form__col-num { text-align: right; }
.memo-form__subtitle { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: #1a2a44; }
.memo-form__grid {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px 16px; margin-bottom: 10px;
}
.memo-form__field { display: flex; flex-direction: column; gap: 4px; }
.memo-form__field > span { font-size: 12px; color: var(--c-muted); font-weight: 500; }
.memo-form__field--wide { grid-column: 1 / -1; }
.memo-form__field input[type=text],
.memo-form__field input[type=date],
.memo-form__field textarea {
	padding: 6px 8px; border: 1px solid var(--c-border); border-radius: 4px;
	font-family: inherit; font-size: 14px; background: #fff;
}
.memo-form__field input[type=text]:focus,
.memo-form__field input[type=date]:focus,
.memo-form__field textarea:focus { border-color: var(--c-primary); outline: 2px solid #dbe6ff; }
.memo-form__field textarea { resize: vertical; min-height: 44px; }
.memo-form__field .memo-form__ans-group { align-self: flex-start; margin-top: 2px; }
/* Číslované kroky a výčty ve formuláři (postup pro klienta u 407.2). */
.memo-form__steps, .memo-form__list { margin: 0 0 10px; padding-left: 22px; font-size: 14px; line-height: 1.6; }
.memo-form__steps li, .memo-form__list li { margin-bottom: 6px; }
/* Inputy uvnitř evidenčních tabulek (407.2 peněžní ústavy). */
.memo-form__table td input[type=text],
.memo-form__table td input[type=date],
.memo-form__table td textarea {
	width: 100%; box-sizing: border-box;
	padding: 5px 7px; border: 1px solid var(--c-border); border-radius: 3px;
	font-family: inherit; font-size: 13px; background: #fff;
}
.memo-form__table td input[type=text]:focus,
.memo-form__table td input[type=date]:focus,
.memo-form__table td textarea:focus { border-color: var(--c-primary); outline: 2px solid #dbe6ff; }
/* Kompaktní tabulka „opakujících se řádků" (akcionáři, zákazníci, …). */
.memo-form__table--rows td { padding: 4px 6px; }
.memo-form__table--rows td input[type=text] {
	width: 100%; box-sizing: border-box;
	padding: 4px 6px; border: 1px solid var(--c-border); border-radius: 3px;
	font-family: inherit; font-size: 13px; background: #fff;
}
.memo-form__table--rows td input[type=text]:focus { border-color: var(--c-primary); outline: 2px solid #dbe6ff; }
.memo-form__table--rows tbody tr:hover { background: transparent; }

/* Repeater 201.6 INFO list — tlačítko „+ přidat řádek", akce mazání. */
.info-form__table { table-layout: auto; }
.info-form__col-num { text-align: center; width: 36px; color: var(--c-muted); }
.info-form__col-actions { width: 32px; text-align: center; }
.info-form__remove {
	background: transparent; border: 0; color: #b91c1c; cursor: pointer;
	font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 3px;
	opacity: 0.4; transition: opacity .12s;
}
.info-form__remove:hover { opacity: 1; background: #fef2f2; }
.info-form__toolbar { margin: 8px 0 16px; text-align: right; }
.info-form__nace-code { font-family: 'SF Mono', Menlo, monospace; }

/* Tiskopis 201.6 v klientské sekci (.eprofile). Pole, jehož hodnota se liší od
   obchodního rejstříku, je žlutě podbarvené a nese hlášku s hodnotou z ARES. */
.eprofile__bar {
	display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
	margin-bottom: 16px;
}
.eprofile__bar p { margin: 0; }
.eprofile__actions { margin-top: 20px; text-align: right; }
.eprofile__cell { position: relative; }
.eprofile .is-diff input[type=text],
.eprofile .is-diff textarea { background: #fffbeb; border-color: #f59e0b; }
.eprofile__ares {
	display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
	margin-top: 4px; font-size: 12px; color: #92400e;
}
.eprofile__ares-warn { color: #d97706; font-size: 13px; }
.eprofile__ares-copy {
	background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; cursor: pointer;
	font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.eprofile__ares-copy:hover { background: #fde68a; }

/* Historie odeslání — datum kola a textový výpis, co klient změnil. */
.eprofile__history { margin-top: 24px; border-top: 1px solid var(--c-border); padding-top: 16px; }
.eprofile__revision { padding: 10px 0; border-bottom: 1px solid #eef2f7; }
.eprofile__revision:last-child { border-bottom: none; }
.eprofile__revision-head { display: flex; align-items: baseline; gap: 8px; }
.eprofile__changes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.eprofile__changes li { margin-bottom: 2px; }
.eprofile__changes del { color: #b91c1c; text-decoration: line-through; }
.eprofile__changes ins { color: #15803d; text-decoration: none; }
.eprofile__change-label { color: var(--c-muted); }
.eprofile__change-label::after { content: ':'; }

/* Rozpisy zásob vlastní výroby (405.2, 405.3) — číselné sloupce a dopočtené
   buňky. Dopočet je readonly input, ne text v buňce, aby výsledek prošel
   submitem do snapshotu. */
.sv__table th { text-align: left; }
.sv__col-group { text-align: center !important; border-left: 2px solid var(--c-border); }
.sv__col-num { text-align: right !important; width: 84px; }
.sv__col-unit { width: 56px; }
.sv__table td input.sv__num { text-align: right; font-variant-numeric: tabular-nums; }
.sv__table td input.sv__unit { text-align: center; }
.sv__table td input.sv__calc {
	background: #f6f7f9; color: var(--c-muted); border-style: dashed; cursor: default;
}
.sv__total td { border-top: 2px solid var(--c-border); background: #fafbfc; }
.sv__total td input.sv__calc { background: #fff; color: inherit; font-weight: 600; }
.sv__na { text-align: center; color: var(--c-muted); }

/* Varianta pro survey (201.5a): kompaktnější řádek, textareas pro dva
   komentáře (ÚJ + odborník). Použije `.memo-form__table--survey`. */
.memo-form__table--survey td { padding: 6px 8px; vertical-align: top; }
.memo-form__table--survey .memo-form__col-comment { width: 25%; min-width: 160px; }
.memo-form__table--survey .memo-form__col-comment textarea {
	width: 100%; min-height: 32px; padding: 4px 6px;
	border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 13px; line-height: 1.4; resize: vertical;
}
.memo-form__col-q--sub { padding-left: 24px; color: var(--c-muted); font-style: italic; }
.memo-form__q--sub { background: #fafbfc; }
.memo-form__q--sub:hover { background: #f0f4fa; }

/* Štítek povinného pole ze sady prvků (@ui.latte, blok reqBadge). Vzhled prvku
   stojí tady, ne v client.css: prvek se vyvolává i na auditorských obrazovkách,
   kde se client.css nenačítá, a tam by zůstal neviditelný. Umístění vedle
   vstupu řeší rozvržení konkrétního formuláře. */
.field__req {
	flex: 0 0 auto;
	width: 80px; height: 25px;
	background: url(required-red.svg) center/contain no-repeat;
}
.field--done .field__req { background-image: url(required-gray.svg); }

.memo-form__ans {
	display: inline-flex; align-items: center; justify-content: center; padding: 2px 10px;
	border: 1px solid var(--c-border); background: #fff; cursor: pointer;
	font-size: 12px; line-height: 1.5; user-select: none; min-width: 36px;
	transition: background .12s ease, border-color .12s ease, color .12s ease;
	position: relative;
}
.memo-form__ans + .memo-form__ans { margin-left: -1px; }
.memo-form__ans--yes { border-radius: 4px 0 0 4px; }
.memo-form__ans--no { border-radius: 0 4px 4px 0; }
.memo-form__ans:hover { z-index: 2; }
.memo-form__ans--yes:hover { background: #f3faf5; border-color: #86c79a; color: #1e7c37; }
.memo-form__ans--no:hover { background: #fdf5f4; border-color: #eb9a92; color: #b3251b; }
.memo-form__ans input { position: absolute; opacity: 0; pointer-events: none; }
.memo-form__ans--yes:has(input:checked) { background: #e6f4ea; border-color: #34a853; color: #1e7c37; font-weight: 600; z-index: 1; }
.memo-form__ans--no:has(input:checked) { background: #fdecea; border-color: #e14b3f; color: #b3251b; font-weight: 600; z-index: 1; }

/* Jemné zvýraznění celého řádku podle aktuální odpovědi. */
.memo-form__q--ano { background: #fbfdfb; }
.memo-form__q--ne { background: #fdfbfb; }
.memo-form__q--ano:hover { background: #f2faf4; }
.memo-form__q--ne:hover { background: #fcf3f2; }
.memo-form__q--0 { background: #fbfbfd; }
.memo-form__q--nk { background: #fbfbfb; }
.memo-form__q--0:hover { background: #eef1fb; }
.memo-form__q--nk:hover { background: #f3f3f3; }

/* 4-tlačítková varianta A/N/0/NK (VKS 204.1) — přebíjí border-radius pro
   krajní tlačítka a přidá stavy pro 0 (šedomodré) a NK (šedé). */
.memo-form__ans-group--vks .memo-form__ans--yes { border-radius: 4px 0 0 4px; }
.memo-form__ans-group--vks .memo-form__ans--no { border-radius: 0; }
.memo-form__ans-group--vks .memo-form__ans--neutral { border-radius: 0; }
.memo-form__ans-group--vks .memo-form__ans--nk { border-radius: 0 4px 4px 0; }
.memo-form__ans--neutral:hover { background: #eef1fb; border-color: #93a7db; color: #1e3a70; }
.memo-form__ans--neutral:has(input:checked) { background: #dbe6ff; border-color: #4d7df0; color: #1e3a70; font-weight: 600; z-index: 1; }
.memo-form__ans--nk:hover { background: #f2f2f2; border-color: #b3b3b3; color: #444; }
.memo-form__ans--nk:has(input:checked) { background: #e2e2e2; border-color: #888; color: #333; font-weight: 600; z-index: 1; }

/* Volba mezi rovnocennými variantami (AML: opsat doklad × nahrát fotografii).
   Není to ano/ne, proto se přebije zelená/červená za neutrální modrou. */
.memo-form__ans-group--mode .memo-form__ans { padding: 5px 14px; font-size: 13px; }
.memo-form__ans-group--mode .memo-form__ans:hover { background: #eef1fb; border-color: #93a7db; color: #1e3a70; }
.memo-form__ans-group--mode .memo-form__ans:has(input:checked) {
	background: #dbe6ff; border-color: #4d7df0; color: #1e3a70; font-weight: 600; z-index: 1;
}

/* Podle volby se ukáže jen jedna cesta — buď pole k přepisu, nebo nahrání fotografie. */
.kyc-form:has(input[name=entry_mode][value=photo]:checked) .kyc-form__manual,
.kyc-form:has(input[name=entry_mode][value=manual]:checked) .kyc-form__photo { display: none; }
/* Doklad bez zadní strany (pas) — pole pro její nahrání nemá smysl ukazovat. */
.kyc-form:has(input[name=id_photo_back_side][value=absent]:checked) .kyc-form__back-upload { display: none; }

/* === VKS 204.1 — barevné rozlišení sekcí ===
   Každá oblast má vlastní tón levého pruhu + hlavičky. Cyklus 6 barev
   (A modrá, B fialová, C zelená, D oranžová, E červená, F tyrkysová). */
/* Sekce má levý barevný pruh (6 px), který začíná v levém horním rohu a končí
   v levém dolním. Tabulka i header sedí těsně za pruhem — žádný bílý pruh mezi
   barvou a obsahem. Toho dosáhneme border-left u sekce (namísto ::before), aby
   se tabulka/header přirozeně přišpendlily k okraji. */
.vks-section {
	position: relative;
	border: 1px solid var(--c-border);
	border-left: 6px solid transparent;
	border-radius: var(--radius);
	background: #fff; box-shadow: var(--shadow);
	margin-bottom: 20px; overflow: hidden;
}
.vks-section__header {
	display: flex; align-items: baseline; gap: 12px;
	padding: 12px 20px;
	border-bottom: 1px solid var(--c-border);
}
.vks-section__code {
	min-width: 40px; font-family: 'SF Mono', Menlo, monospace;
	font-size: 13px; font-weight: 600; opacity: 0.75;
}
.vks-section__title { margin: 0; font-size: 15px; font-weight: 600; }
.vks-section__table {
	margin: 0; width: 100%; table-layout: auto;
}
.vks-section__table td, .vks-section__table th { padding: 8px 12px; }

.vks-section--A { border-left-color: #4d7df0; } /* modrá */
.vks-section--A .vks-section__header { background: #eaf1ff; color: #1e3a70; }
.vks-section--B { border-left-color: #7c3aed; } /* fialová */
.vks-section--B .vks-section__header { background: #f3ecff; color: #4c1d95; }
.vks-section--C { border-left-color: #2f9e44; } /* zelená */
.vks-section--C .vks-section__header { background: #e6f4e8; color: #1e4d16; }
.vks-section--D { border-left-color: #f2b90b; } /* oranžová */
.vks-section--D .vks-section__header { background: #fef7e0; color: #7a4d00; }
.vks-section--E { border-left-color: #dc2626; } /* červená */
.vks-section--E .vks-section__header { background: #fef2f2; color: #7f1d1d; }
.vks-section--F { border-left-color: #0d9488; } /* tyrkysová */
.vks-section--F .vks-section__header { background: #ecfeff; color: #134e4a; }

/* Podnadpis skupiny (např. „B. Dodávky") — bez A/N tlačítek, tmavší pozadí. */
.vks-row-header td { padding: 10px 12px; background: rgba(0, 0, 0, .03); color: #1a2a44; }
.vks-row-header td strong { font-size: 13px; }

/* Závěrečné vyhodnocení VKS — matice oblastí × míra spolehlivosti + rozhodnutí. */
.vks-eval__table { width: 100%; border-collapse: collapse; }
.vks-eval__table thead th {
	background: #f4f7fb; padding: 8px 10px; font-size: 12px; font-weight: 600;
	text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted);
	border-bottom: 1px solid var(--c-border); text-align: center; vertical-align: middle;
}
.vks-eval__table thead .vks-eval__vks-group { text-transform: none; letter-spacing: 0; }
.vks-eval__table tbody td { padding: 10px; border-bottom: 1px solid #eef2f7; }
.vks-eval__table tbody tr:last-child td { border-bottom: none; }
.vks-eval__area { text-align: left; min-width: 200px; }
.vks-eval__opt { text-align: center; width: 15%; cursor: pointer; }
.vks-eval__opt label { display: block; padding: 6px; border-radius: 4px; cursor: pointer; transition: background .12s; }
.vks-eval__opt label:hover { background: rgba(0,0,0,.04); }
.vks-eval__opt input[type=radio] { transform: scale(1.3); accent-color: var(--c-primary); }
.vks-eval__opt--good th { color: #1e7c37; }
.vks-eval__opt--good input:checked + span,
.vks-eval__opt--good label:has(input:checked) { background: #e6f4ea; }
.vks-eval__opt--avg th { color: #7a4d00; }
.vks-eval__opt--avg label:has(input:checked) { background: #fef7e0; }
.vks-eval__opt--bad th { color: #b3251b; }
.vks-eval__opt--bad label:has(input:checked) { background: #fdecea; }
.vks-eval__decision { text-align: center; width: 130px; }
.vks-eval__decision .memo-form__ans-group { justify-content: center; }
.vks-eval__row:hover { background: #fafbfd; }

/* Wide dialog (204.1 VKS): plná šířka bez bočních paddingů — sekce a matice
   využijí celý viewport. */
body.bare--wide .bare__content { padding: 12px 16px; max-width: none; }
body.bare--wide .memo-form { max-width: none; }
body.bare--wide .memo-form--vks .memo-form__section { padding: 0; }

/* ============================================================================
   PRŮVODCE „Poznání klienta" (KAČR 1-140) — .uw-* třídy
   Vzdělávací wizard pro juniorního asistenta. 7 stránek × 2-3 body.
   Grafika: každý bod má barevný „pás", boxy typu Proč / Jak / Otázky /
   Příklady / Rizika / Vzor jsou vizuálně odlišené.
   ============================================================================ */
.uw-wrap { max-width: 1150px; margin: 0 auto; padding: 0 12px; }

.uw-header {
	background: linear-gradient(135deg, #eef4ff 0%, #f6ecff 100%);
	border-radius: 12px; padding: 20px 24px; margin-bottom: 20px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.uw-header__nav { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 12px; }
.uw-header__title { margin: 0 0 8px; font-size: 26px; color: #1a2a44; }
.uw-header__meta { font-size: 14px; color: #465370; line-height: 1.5; }
.uw-header__ico { margin-left: 4px; }

.uw-progress { margin-top: 14px; }
.uw-progress__bar { height: 8px; background: rgba(255,255,255,.7); border-radius: 4px; overflow: hidden; }
.uw-progress__fill {
	height: 100%;
	background: linear-gradient(90deg, #4d7df0, #7c3aed);
	transition: width .3s ease;
}
.uw-progress__text { margin-top: 6px; font-size: 12px; color: #465370; }

/* Kroková navigace: horizontální flex s wrapem, klikatelné pilulky. */
.uw-steps {
	display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px;
	padding: 12px; background: #f7f9fc; border-radius: 8px;
}
.uw-step {
	display: flex; align-items: center; gap: 6px;
	padding: 6px 12px; border-radius: 20px;
	background: #fff; color: #465370; text-decoration: none;
	border: 1px solid var(--c-border); font-size: 12px;
	transition: all .15s ease;
}
.uw-step:hover { border-color: #4d7df0; color: #1e3a70; }
.uw-step__num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 22px; height: 22px; border-radius: 50%;
	background: #e5e7eb; color: #374151; font-weight: 600; font-size: 11px;
}
.uw-step--active { background: #4d7df0; color: #fff; border-color: #4d7df0; }
.uw-step--active .uw-step__num { background: rgba(255,255,255,.25); color: #fff; }

.uw-page-title {
	font-size: 20px; color: #1a2a44; margin: 24px 0 16px;
	padding-bottom: 10px; border-bottom: 2px solid #e5e7eb;
}

/* Bod (article) — barevný levý pruh, header s číslem, boxy uvnitř */
.uw-point {
	background: #fff; border-radius: 10px; overflow: hidden;
	margin-bottom: 24px; box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
	border: 1px solid #e5e7eb; border-left: 5px solid #4d7df0;
}
.uw-point--0 { border-left-color: #7c3aed; }
.uw-point--1 { border-left-color: #4d7df0; }
.uw-point--2 { border-left-color: #2f9e44; }
.uw-point--3 { border-left-color: #f2b90b; }
.uw-point--4 { border-left-color: #dc2626; }
.uw-point--5 { border-left-color: #0d9488; }

.uw-point__header {
	display: flex; align-items: center; gap: 12px;
	padding: 14px 20px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
}
.uw-point__num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border-radius: 50%;
	background: #1a2a44; color: #fff; font-weight: 700; font-size: 15px;
	flex-shrink: 0;
}
.uw-point__num--0 { background: #7c3aed; }
.uw-point__num--1 { background: #4d7df0; }
.uw-point__num--2 { background: #2f9e44; }
.uw-point__num--3 { background: #f2b90b; color: #7a4d00; }
.uw-point__num--4 { background: #dc2626; }
.uw-point__num--5 { background: #0d9488; }
.uw-point__title { margin: 0; font-size: 17px; color: #1a2a44; flex: 1; }
.uw-point__isa {
	font-size: 11px; color: #6b7280; background: #fff;
	padding: 4px 10px; border-radius: 4px; border: 1px solid #e5e7eb;
	line-height: 1.4; max-width: 45%;
}

/* Boxy uvnitř bodu: barevně odlišené podle typu */
.uw-box { padding: 14px 20px; border-top: 1px solid #f3f4f6; }
.uw-box:first-of-type { border-top: none; }
.uw-box__label {
	font-size: 12px; font-weight: 600; text-transform: uppercase;
	letter-spacing: .04em; margin-bottom: 8px;
}
.uw-box__body { line-height: 1.55; color: #1f2937; }

.uw-box--why { background: linear-gradient(90deg, #fef3c7 0%, transparent 60%); }
.uw-box--why .uw-box__label { color: #92400e; }

.uw-box--howto { background: linear-gradient(90deg, #dbeafe 0%, transparent 60%); }
.uw-box--howto .uw-box__label { color: #1e40af; }

.uw-box--questions { background: linear-gradient(90deg, #ede9fe 0%, transparent 60%); }
.uw-box--questions .uw-box__label { color: #5b21b6; }

.uw-box--examples { background: linear-gradient(90deg, #d1fae5 0%, transparent 60%); }
.uw-box--examples .uw-box__label { color: #065f46; }

.uw-box--risks { background: linear-gradient(90deg, #fee2e2 0%, transparent 60%); }
.uw-box--risks .uw-box__label { color: #991b1b; }

.uw-box--sample { background: linear-gradient(90deg, #f3f4f6 0%, transparent 60%); }
.uw-box--sample .uw-box__label { color: #374151; }

.uw-list { margin: 0; padding-left: 22px; line-height: 1.6; }
.uw-list li { margin-bottom: 4px; }

.uw-risks { width: 100%; border-collapse: collapse; margin-top: 6px; }
.uw-risks thead th {
	background: transparent; text-align: left; padding: 6px 8px;
	font-size: 11px; color: #7c2d12; font-weight: 600;
	text-transform: uppercase; letter-spacing: .04em;
	border-bottom: 1px solid #fecaca;
}
.uw-risks tbody td { padding: 8px; border-bottom: 1px solid #fee2e2; vertical-align: top; }
.uw-risks tbody tr:last-child td { border-bottom: none; }
.uw-risks tbody td:first-child { font-weight: 500; color: #7f1d1d; width: 40%; }

.uw-sample {
	margin: 0; padding: 12px 14px; background: #fff;
	border: 1px solid #e5e7eb; border-radius: 6px;
	font-family: 'SF Mono', Menlo, monospace; font-size: 13px;
	white-space: pre-wrap; word-wrap: break-word;
	color: #1f2937;
}

/* Otázky uvnitř bodu */
.uw-questions { display: flex; flex-direction: column; gap: 14px; }
.uw-q {
	padding: 12px 14px; background: #fff;
	border-radius: 6px; border: 1px solid #e5e7eb;
}
.uw-q__label { display: block; font-weight: 500; color: #1f2937; margin-bottom: 6px; }
.uw-q__hint { margin: 4px 0 8px; font-size: 12px; color: #6b7280; font-style: italic; }

.uw-input, .uw-textarea, .uw-select {
	width: 100%; padding: 8px 10px;
	border: 1px solid #d1d5db; border-radius: 4px;
	font-family: inherit; font-size: 14px; background: #fff;
	box-sizing: border-box;
}
.uw-input:focus, .uw-textarea:focus, .uw-select:focus {
	outline: 2px solid #dbe6ff; border-color: var(--c-primary);
}
.uw-textarea { resize: vertical; min-height: 80px; font-family: inherit; }

/* A/N/Nevím pilulky */
.uw-yesno { display: inline-flex; gap: 0; }
.uw-yesno__opt {
	padding: 6px 16px; border: 1px solid #d1d5db;
	background: #fff; cursor: pointer; font-size: 13px;
	user-select: none; transition: all .12s ease;
	position: relative;
}
.uw-yesno__opt input { position: absolute; opacity: 0; pointer-events: none; }
.uw-yesno__opt:first-child { border-radius: 4px 0 0 4px; }
.uw-yesno__opt:last-child { border-radius: 0 4px 4px 0; }
.uw-yesno__opt + .uw-yesno__opt { margin-left: -1px; }
.uw-yesno__opt--yes:hover { background: #d1fae5; border-color: #86efac; color: #065f46; z-index: 1; }
.uw-yesno__opt--yes:has(input:checked) { background: #a7f3d0; border-color: #10b981; color: #065f46; font-weight: 600; z-index: 2; }
.uw-yesno__opt--no:hover { background: #fee2e2; border-color: #fca5a5; color: #991b1b; z-index: 1; }
.uw-yesno__opt--no:has(input:checked) { background: #fecaca; border-color: #ef4444; color: #991b1b; font-weight: 600; z-index: 2; }
.uw-yesno__opt--unknown:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; z-index: 1; }
.uw-yesno__opt--unknown:has(input:checked) { background: #e5e7eb; border-color: #6b7280; color: #374151; font-weight: 600; z-index: 2; }

/* Multi-choice check */
.uw-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.uw-multi__opt {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 20px;
	background: #fff; cursor: pointer; font-size: 13px;
	transition: all .12s ease;
}
.uw-multi__opt:hover { background: #eef4ff; border-color: #93c5fd; }
.uw-multi__opt:has(input:checked) { background: #dbeafe; border-color: #4d7df0; color: #1e3a70; font-weight: 500; }
.uw-multi__opt input { margin: 0; }

/* Návrh z ARES — kliknutelné doplnění */
.uw-suggestion {
	margin-top: 10px; padding: 10px 12px;
	background: linear-gradient(90deg, #fff7ed 0%, #fff 100%);
	border-left: 3px solid #f59e0b; border-radius: 4px;
}
.uw-suggestion__label { font-size: 12px; color: #92400e; font-weight: 500; margin-bottom: 4px; }
.uw-suggestion__text {
	margin: 4px 0; padding: 6px 8px; background: #fff;
	border: 1px solid #fde68a; border-radius: 4px;
	font-size: 13px; line-height: 1.4; white-space: pre-wrap;
	max-height: 200px; overflow-y: auto;
}
.uw-suggestion__use {
	background: #f59e0b; color: #fff; border: 0;
	padding: 5px 12px; border-radius: 4px; cursor: pointer;
	font-size: 12px; font-weight: 500;
}
.uw-suggestion__use:hover { background: #d97706; }
.uw-suggestion__use:disabled { background: #10b981; cursor: default; }

.uw-actions {
	display: flex; justify-content: space-between; gap: 12px;
	margin: 24px 0; padding: 16px; background: #f9fafb; border-radius: 8px;
	flex-wrap: wrap;
}
.uw-actions .btn { margin-left: 0; }
.uw-actions form.inline-form { display: inline; }

/* Souhrn */
.uw-summary-card {
	background: #fff; border-radius: 10px; padding: 20px;
	margin-bottom: 20px; box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
	border: 1px solid #e5e7eb;
}
.uw-summary-card--rec {
	border-left: 5px solid #7c3aed;
	background: linear-gradient(90deg, #f3ecff 0%, #fff 40%);
}
.uw-summary-card__title { margin: 0 0 12px; font-size: 18px; color: #1a2a44; }
.uw-summary-page-title {
	margin: 20px 0 10px; font-size: 14px; color: #4b5563;
	padding-bottom: 6px; border-bottom: 1px solid #e5e7eb;
}
.uw-rec-list { list-style: none; padding: 0; margin: 0; }
.uw-rec {
	display: flex; gap: 12px; padding: 12px;
	background: #fff; border-radius: 6px; margin-bottom: 8px;
	border: 1px solid #e5e7eb;
}
.uw-rec__badge {
	background: #7c3aed; color: #fff; padding: 4px 10px;
	border-radius: 4px; font-size: 12px; font-weight: 600;
	flex-shrink: 0; height: fit-content;
}
.uw-rec__body { flex: 1; }
.uw-rec__action { margin-bottom: 4px; color: #1f2937; }
.uw-rec__reason { line-height: 1.4; }

.uw-summary-point {
	background: #f9fafb; border-radius: 6px; padding: 10px 14px;
	margin-bottom: 8px; border: 1px solid #e5e7eb;
}
.uw-summary-point__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.uw-summary-answers { margin: 0; padding: 0; }
.uw-summary-answer { display: flex; gap: 10px; padding: 4px 0; border-top: 1px dashed #e5e7eb; }
.uw-summary-answer:first-child { border-top: none; }
.uw-summary-answer dt { flex: 1; color: #6b7280; font-size: 13px; }
.uw-summary-answer dd { flex: 1; margin: 0; font-weight: 500; color: #1f2937; font-size: 13px; }

/* ---- Dvousloupcový layout: otázky vlevo, zpráva do spisu vpravo ---- */
.uw-wrap--wide { max-width: 1600px; }
.uw-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.uw-split__left { border-right: 1px solid #e5e7eb; }
.uw-split__right { background: #fafbfd; }
@media (max-width: 1200px) { .uw-split { grid-template-columns: 1fr; } .uw-split__left { border-right: 0; border-bottom: 1px solid #e5e7eb; } }

/* Zpráva do spisu — pravý sloupec */
.uw-report {
	padding: 16px 20px;
	font-size: 14px; line-height: 1.7; color: #1f2937;
}
.uw-report__header {
	display: flex; align-items: baseline; gap: 10px;
	margin: -16px -20px 14px; padding: 10px 20px;
	background: #f3f4f6; border-bottom: 1px solid #e5e7eb;
	position: sticky; top: 0; z-index: 5;
}
.uw-report__label { font-weight: 600; color: #1a2a44; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.uw-report__sub { color: #6b7280; font-size: 12px; }
.uw-report__body { white-space: normal; }
.uw-report__body p { margin: 0 0 10px; }
.uw-report__body strong { color: #1a2a44; }

/* Placeholder z odpovědi — dynamický (mění se s formulářem) */
.uw-report__answer {
	background: #eef4ff; color: #1e3a70;
	padding: 1px 6px; border-radius: 3px;
	border: 1px dashed #bfdbfe; font-weight: 500;
	transition: all .15s ease;
}
.uw-report__answer--empty { background: #fef3c7; border-color: #fde68a; color: #92400e; font-style: italic; }

/* Placeholder z ARES — statická hodnota z veřejného rejstříku */
.uw-report__ares {
	background: linear-gradient(180deg, #f0fdf4 0%, #d1fae5 100%);
	color: #065f46; padding: 1px 6px; border-radius: 3px;
	border: 1px solid #a7f3d0; font-weight: 500;
	white-space: pre-wrap;
}
.uw-report__ares--empty { background: #fef3c7; border-color: #fde68a; color: #92400e; font-style: italic; }

/* Volný editovatelný blok — auditor sem přímo píše */
.uw-report__editor {
	display: inline-block; min-width: 200px;
	background: #fff7ed; color: #7c2d12;
	padding: 4px 10px; border-radius: 4px;
	border: 1px dashed #fdba74;
	transition: all .15s ease; outline: none;
	white-space: pre-wrap;
}
.uw-report__editor:hover { border-color: #fb923c; background: #ffedd5; }
.uw-report__editor:focus {
	background: #fff; border-color: #f97316; border-style: solid;
	box-shadow: 0 0 0 3px rgba(249, 115, 22, .15);
	color: #1f2937;
}
.uw-report__editor--empty::before {
	content: '✏ ' attr(data-empty-placeholder);
	color: #9a3412; font-style: italic;
}
.uw-report__editor--empty:focus::before { content: none; }

/* If-then/else — zobrazený je vždy jeden ze span'ů; JS je při načtení
   správně přepne. Do doby, než JS proběhne, oba text ukazuje (aby se
   nezacyklilo prázdno). */
.uw-report__if { display: contents; }
.uw-report__if-then, .uw-report__if-else { display: inline; }

.memo-form__note {
	width: 100%; min-height: 90px; padding: 10px 12px; border: 1px solid var(--c-border);
	border-radius: var(--radius); font-family: inherit; font-size: 14px; line-height: 1.5;
	transition: border-color .12s ease, box-shadow .12s ease;
}
.memo-form__note:hover { border-color: #b7c3d6; }
.memo-form__note:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }

.memo-form__foot { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--c-border); color: var(--c-muted); font-size: 12px; line-height: 1.6; }
.memo-form__foot--signature { color: var(--c-text); font-size: 13px; }
.memo-form__foot--signature > div:nth-child(2) { font-weight: 600; }
.memo-form__sign-note { margin-top: 6px; color: var(--c-muted); font-size: 12px; font-style: italic; }
.memo-form__sign-note--pending {
	margin-top: 0; padding: 10px 12px; border-left: 3px solid #e0a800;
	background: #fff8e6; color: #7a5b00; font-style: normal;
}
.memo-form__input {
	padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; min-width: 220px;
	transition: border-color .12s ease, box-shadow .12s ease;
}
.memo-form__input:hover { border-color: #b7c3d6; }
.memo-form__input:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }
.memo-form__inline { display: flex; flex-wrap: wrap; gap: 8px; }

/* Action bar pro editor interního formuláře (100.1a/b): dropdown stavu + tlačítka akcí. */
.form-actionbar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
	padding: 10px 12px; margin: 12px 0 4px;
	background: #f4f7fb; border: 1px solid var(--c-border); border-radius: var(--radius);
}
.form-actionbar__state { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.form-actionbar__state label { font-size: 12px; color: var(--c-muted); font-weight: 500; }
.form-actionbar__state select {
	padding: 5px 8px; border: 1px solid var(--c-border); border-radius: var(--radius);
	background: #fff; font-family: inherit; font-size: 13px; cursor: pointer;
}
.form-actionbar__action, .form-actionbar__upload { display: inline-flex; margin: 0; }
.form-actionbar__upload .btn { position: relative; overflow: hidden; }

/* 407.2a — účty z registru plátců DPH nad formulářem soupisu konfirmací. */
.vat-accounts { margin-bottom: 12px; }
.vat-accounts__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.vat-accounts__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.vat-accounts table.data { margin-bottom: 8px; }

/* Dynamické badge barvy podle workflow.color (viz WorkflowService). */
.badge--state-gray   { background: #e6e7ec; color: #4a4c56; }
.badge--state-blue   { background: #e0ebff; color: #1a4bcc; }
.badge--state-green  { background: #d8f0e0; color: #1e7c37; }
.badge--state-red    { background: #fdd6d1; color: #b3251b; }
.badge--state-orange { background: #ffe2c4; color: #a25200; }

/* Historie komunikace — rozbalovací sekce v editoru formuláře. */
.form-history {
	margin-top: 18px; padding: 12px 14px;
	border: 1px solid var(--c-border); border-radius: var(--radius); background: #fafbfc;
}
.form-history summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--c-muted); }
.form-history summary:hover { color: #1a2a44; }
.form-history h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.form-history__table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.form-history__table th, .form-history__table td { padding: 6px 10px; border-bottom: 1px solid #eef2f7; text-align: left; }
.form-history__table th { background: #f4f7fb; font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--c-muted); }
.form-history__table tbody tr:last-child td { border-bottom: none; }
.form-history__link { max-width: 320px; }
.form-history__link a {
	display: inline-block; max-width: calc(100% - 32px); overflow: hidden;
	text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
	font-family: 'SF Mono', Menlo, monospace; font-size: 12px;
}
.form-history__link .btn { margin-left: 4px; padding: 2px 6px; }

/* Public dotazník předchozího auditora (samostatný layout, mimo hlavní aplikaci). */
body.public-survey { background: #f2f4f8; margin: 0; font-family: inherit; }
.public-survey__frame { max-width: 780px; margin: 0 auto; padding: 24px 20px 40px; }
.public-survey__brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.public-survey__brand strong { font-size: 18px; color: #1a2a44; }
.public-survey__subbrand { font-size: 12px; color: var(--c-muted); }
.public-survey__card {
	background: #fff; padding: 28px 32px; border-radius: 8px;
	box-shadow: 0 2px 12px rgba(15,23,42,.06); border: 1px solid var(--c-border);
}
.public-survey__card h1 { margin: 0 0 12px; font-size: 22px; }
.public-survey__meta { color: var(--c-muted); font-size: 14px; margin-bottom: 20px; }
.public-survey__field { margin-bottom: 16px; }
.public-survey__field label { display: block; margin-bottom: 6px; font-size: 14px; line-height: 1.4; }
.public-survey__field textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical;
}
.public-survey__field textarea:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }
.public-survey__field input {
	width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; line-height: 1.5;
}
.public-survey__field input:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }
.public-survey__actions { margin-top: 20px; text-align: right; }
.public-survey__card--gate { text-align: center; }
.public-survey__foot { margin-top: 20px; font-size: 12px; color: var(--c-muted); text-align: center; }

/* Readonly (náhled) — schovat cursor:pointer, disable hover pulsy. */
.memo-form :where(input[disabled], input[readonly]) ~ * { cursor: default; }
.memo-form .memo-form__radio:has(input[disabled]),
.memo-form .memo-form__ans:has(input[disabled]) { cursor: default; }

/* Bare layout — pro obsah načítaný v iframe modálních dialogů (editor spisu). */
body.bare { background: #fff; margin: 0; }
.bare__content { padding: 16px 20px; }
body.bare--wide .bare__content { padding: 12px 16px; }

/* Users administrace — filter row a grid. */
.users-filter { padding: 12px 16px; }
.users-filter__row {
	display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
}
.users-filter__field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.users-filter__field span { color: var(--c-muted); font-weight: 500; }
.users-filter__field input, .users-filter__field select {
	padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; min-width: 180px;
}
.users-filter__actions { display: flex; gap: 8px; margin-left: auto; }

/* Chybové hlášky formulářů — souhrn nad polem, aby uživatel nepřehlédl důvod
   selhání submitu. Používá se v `<ul class="errors">` v Latte šablonách. */
.errors {
	margin: 0 0 16px; padding: 12px 16px 12px 40px;
	background: #fdecea; border-left: 4px solid #e14b3f; border-radius: 4px;
	color: #b3251b; font-size: 14px; line-height: 1.5;
	list-style: none; position: relative;
}
.errors::before {
	content: "⚠"; position: absolute; left: 14px; top: 10px;
	font-size: 18px; line-height: 1;
}
.errors li { margin: 2px 0; }
.errors li + li { border-top: 1px solid rgba(225, 75, 63, .25); padding-top: 6px; margin-top: 6px; }

.users-table tbody tr { border-bottom: 1px solid #eef2f7; }
.users-table__row--deactivated { opacity: .55; }
.users-table__row--deactivated:hover { opacity: 1; }
.inline-form { display: inline; margin-left: 4px; }
/* Editor v iframe modálu: editor-head je fixní hlavička napříč šířkou dialogu. */
body.bare .internal-editor__wrap { max-width: none; }
body.bare .editor-head {
	position: sticky; top: 0; z-index: 5;
	background: #fff; padding: 12px 24px;
	margin: -16px -20px 16px; border-bottom: 1px solid var(--c-border);
	box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
body.bare .editor-head__close { margin-left: 8px; }
body.bare .internal-editor__wrap > *:not(.editor-head) { max-width: 900px; margin-left: auto; margin-right: auto; }
/* Ve versions modalu potřebuje tabulka verzí plnou šířku dialogu, ať se
   badge stavu, historie posouzení a akce nelámou. */
body.bare .internal-editor__wrap > .versions-table { max-width: none; }
/* Wide bare (201.5a survey) — všechny přímé potomky wrapu využijí plnou
   šířku dialogu; jinak by je předchozí pravidlo omezilo na 900px. Survey
   tabulka má 5 sloupců (# / otázka / A/N / Komentář ÚJ / Komentář odborníka)
   a potřebuje víc místa. */
body.bare--wide .internal-editor__wrap > *:not(.editor-head) { max-width: none; }

/* Versions modal — přehled verzí klientského dokumentu + schvalování. */
.versions-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.versions-table thead th {
	background: #f4f7fb; text-align: left; font-weight: 600; font-size: 11px;
	text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted);
	padding: 8px 10px; border-bottom: 1px solid var(--c-border);
}
.versions-table td { padding: 10px; vertical-align: top; border-bottom: 1px solid #eef2f7; }
.versions-table tbody tr:last-child td { border-bottom: none; }
.versions-table__ver { font-weight: 600; white-space: nowrap; }
.versions-table__ver .badge { margin-left: 6px; font-size: 10px; }
.versions-table__row--approved { background: #f7fdf9; }
.versions-table__row--returned { background: #fdf7f6; }
.versions-table__reviews { list-style: none; padding: 0; margin: 0; }
.versions-table__reviews li { margin-bottom: 6px; font-size: 12px; }
.versions-table__reviews li:last-child { margin-bottom: 0; }
.versions-table__comment { color: var(--c-muted); font-style: italic; margin-top: 2px; }
.versions-table__actions { white-space: nowrap; display: flex; gap: 6px; flex-direction: column; align-items: stretch; min-width: 110px; }
.versions-table__actions .versions-form { margin: 0; }
.versions-table__actions .btn { width: 100%; white-space: nowrap; }
.btn--success { background: #34a853; color: #fff; border-color: #2d9146; }
.btn--success:hover { background: #2d9146; }
.btn--success[disabled] { opacity: .5; cursor: not-allowed; }
.btn--danger { background: #e14b3f; color: #fff; border-color: #c73f34; }
.btn--danger:hover { background: #c73f34; }
.btn--danger[disabled] { opacity: .5; cursor: not-allowed; }

/* SendCaseNotification modal — výběr šablony + preview. */
.send-case-form__select { width: 100%; max-width: 520px; padding: 6px 8px; }
.send-case-form__preview {
	margin-top: 16px; padding: 14px 18px;
	background: #fafbfc; border: 1px solid var(--c-border); border-radius: var(--radius);
	max-height: 400px; overflow-y: auto;
}
.send-case-form__preview-subject { margin-bottom: 8px; font-size: 13px; }
.send-case-form__preview-body { font-size: 13px; line-height: 1.5; }
.send-case-form__preview-body p { margin: 0 0 8px; }

/* Klient detail — komentář auditora u odevzdání. */
.submission__review {
	margin-top: 8px; padding: 8px 12px; border-radius: 6px;
	font-size: 13px; line-height: 1.45;
}
.submission__review--approved { background: #e6f4ea; color: #1e7c37; border-left: 3px solid #34a853; }
.submission__review--returned { background: #fdecea; color: #b3251b; border-left: 3px solid #e14b3f; }
.submission__comment { margin-top: 4px; font-style: italic; }

/* ===== Modální dialog „Upravit zakázku" ===== */
.edialog { padding: 0; border: 0; border-radius: var(--radius); width: min(95vw, 520px); box-shadow: 0 10px 40px rgba(15,23,42,.3); }
.edialog::backdrop { background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.edialog__form { display: flex; flex-direction: column; }
.edialog__header {
	display: flex; justify-content: space-between; align-items: center;
	padding: 12px 16px; border-bottom: 1px solid var(--c-border); background: #f8fafc;
}
.edialog__title { font-weight: 600; font-size: 14px; }
.edialog__body { padding: 14px 16px; display: grid; gap: 10px; }
.edialog__row { display: flex; flex-direction: column; gap: 4px; }
.edialog__row label { font-size: 12px; color: var(--c-muted); font-weight: 500; }
.edialog__row input, .edialog__row select, .edialog__row textarea {
	padding: 6px 8px; border: 1px solid var(--c-border); border-radius: 4px;
	font: inherit; font-size: 13px;
}
.edialog__error { padding: 0 16px; color: var(--c-danger); font-size: 12px; min-height: 16px; }
.edialog__footer {
	display: flex; gap: 8px; justify-content: flex-end;
	padding: 10px 16px 14px; border-top: 1px solid var(--c-border);
}
/* Klik na badge kategorie v gridu zakázek otevírá edit modal */
.egrid__cell[data-field="category"] .egrid-badge { cursor: pointer; }
.egrid__cell[data-field="category"] .egrid-badge:hover { filter: brightness(0.94); }

/* ---- Průvodce: layout s pravým panelem externích zdrojů ---- */
/* :has() ruší 1200px strop .layout — stránka průvodce jede přes celou šířku okna */
main.layout:has(.uw-layout) { max-width: none; }
.uw-layout { display: flex; align-items: flex-start; gap: 20px; }
.uw-layout__main { flex: 1 1 0; min-width: 0; }
.uw-layout__main.uw-wrap { margin: 0; max-width: none; }
.uw-layout__side {
	flex: 0 1 28%; min-width: 340px;
	position: sticky; top: 12px;
	max-height: calc(100vh - 24px); overflow: auto;
}
@media (max-width: 1500px) {
	.uw-layout { flex-wrap: wrap; }
	.uw-layout__side { position: static; max-height: none; min-width: 0; flex: 1 1 100%; }
}

.uw-ext { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
.uw-ext__header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.uw-ext__title { font-weight: 600; color: #1a2a44; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.uw-ext__sub { color: #6b7280; font-size: 12px; }
.uw-ext__buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.uw-ext__source { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.uw-ext__ctl { display: inline-flex; align-items: center; gap: 4px; color: #6b7280; font-size: 12px; }
.uw-ext__select { font-size: 12px; padding: 2px 4px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #1f2937; }
.uw-ext__empty, .uw-ext__loading { color: #6b7280; font-size: 13px; margin: 6px 0; }
.uw-ext__error { color: #b91c1c; font-size: 13px; margin: 6px 0; }
.uw-ext__note { color: #6b7280; font-size: 12px; margin: 4px 0 6px; }

.uw-ext__block { margin-bottom: 10px; border: 1px solid #eef0f3; border-radius: 6px; padding: 4px 8px; }
.uw-ext__block summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #1f2937; padding: 4px 0; }
.uw-ext__block summary:hover { color: #1a2a44; }

.uw-ext-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.uw-ext-table th {
	background: #f3f4f6; color: #374151; text-align: left;
	padding: 4px 6px; border: 1px solid #e5e7eb;
	position: sticky; top: 0;
}
.uw-ext-table td { padding: 3px 6px; border: 1px solid #eef0f3; vertical-align: top; color: #1f2937; }
.uw-ext-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uw-ext-table tbody tr:nth-child(even) td { background: #fafbfd; }
.uw-ext-table a { color: #1e3a70; }

/* Srovnávací tabulka meziročního vývoje výkazů */
.uw-cmp__bar {
	display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
	flex-wrap: wrap; margin: 2px 0 10px; font-size: 12px;
}
.uw-cmp__filter { color: #1f2937; cursor: pointer; user-select: none; }
.uw-cmp__legend { color: #6b7280; font-size: 11px; }
.uw-cmp__table td.uw-cmp__name { max-width: 260px; overflow-wrap: break-word; }
.uw-cmp__code { color: #9ca3af; font-size: 11px; }
.uw-cmp__su { color: #6b7280; font-size: 11px; font-variant-numeric: tabular-nums; }
.uw-cmp__warn { color: var(--c-warning); }
.uw-cmp__row--agg td { font-weight: 600; }
.uw-cmp__row--mid td { background: #fff8e1 !important; }
.uw-cmp__row--high td { background: #fdeaea !important; }
.uw-cmp__row--high td.uw-cmp__pct { color: var(--c-danger); font-weight: 600; }
.uw-cmp__row--risk td:first-child { box-shadow: inset 3px 0 0 var(--c-warning); }

/* ===== Hromadné nahrání podkladů klientem (bulk-upload.js) ===== */
dialog.bulk {
	border: 0; border-radius: var(--radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
	padding: 22px 24px; width: 820px; max-width: calc(100vw - 32px);
	max-height: calc(100vh - 64px);
}
dialog.bulk::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.bulk__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.bulk__title { font-size: 16px; font-weight: 600; margin: 0 0 2px; }
.bulk__phase[hidden] { display: none; }
.bulk__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.bulk__table { width: 100%; margin-top: 10px; }
.bulk__table td { vertical-align: middle; }

.bulk-row__flag { width: 28px; text-align: center; font-size: 15px; }
.bulk-row__file { width: 45%; word-break: break-word; }
.bulk-row__select { width: 100%; padding: 5px 8px; border: 1px solid var(--c-border); border-radius: var(--radius); font: inherit; }
/* Nejisté přiřazení — klient si má řádku všimnout a zkontrolovat ji. */
.bulk-row--check td { background: #fff8e1; }
.bulk-row--check td:first-child { box-shadow: inset 3px 0 0 var(--c-warning); }
.bulk-row--done td { background: #f4fbf7; }
.bulk-row--error td { background: #fdeaea; }
.bulk-row--error .bulk-row__file .muted { color: var(--c-danger); }

/* Detail šablony spisu — editace metadat i verze na jedné stránce. */
.tpl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.tpl-head__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }

.tpl-form__group + .tpl-form__group { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eef2f7; }
.tpl-form__legend {
	margin: 0 0 12px; font-size: 11px; font-weight: 700; text-transform: uppercase;
	letter-spacing: .06em; color: var(--c-muted);
}
.tpl-form__cols { display: grid; gap: 0 16px; }
.tpl-form__cols--3 { grid-template-columns: 1fr 1fr 1fr; }
.tpl-form__cols--1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 760px) { .tpl-form__cols { grid-template-columns: 1fr; } }

/* Badge „online formulář" je tlačítko — typografii bere z .egrid-badge,
   jen font-family musí přebít UA styl tlačítka. */
.tpl-preview-btn { font-family: inherit; border: 0; cursor: pointer; background: #ede9fe; color: #5b21b6; }
.tpl-preview-btn:hover { filter: brightness(.94); }

/* ============================================================================
   207.1 HLADINA VÝZNAMNOSTI — .mat-* třídy
   Výpočet významnosti z kritéria a procenta, obousměrná vazba procento ⇄ částka
   u prováděcí hladiny a hranice nepodstatných nesprávností řídí materiality.js.
   ============================================================================ */

.mat__col-pick { width: 60px; text-align: center; }
.mat__col-hint { width: 90px; color: var(--c-muted); white-space: nowrap; }
.mat__num { text-align: right; font-variant-numeric: tabular-nums; }
.mat__num input[type=text] { text-align: right; font-variant-numeric: tabular-nums; }
.mat__num--out { font-weight: 600; color: #1a2a44; }

.mat__result { margin: 14px 0 4px; }
.mat__result label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; font-size: 14px; max-width: 520px; }
.mat__result label > span { font-weight: 600; }
.mat__result label > small { grid-column: 1 / -1; order: 3; color: var(--c-muted); font-size: 12px; }

.mat__levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.mat__levels label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.mat__levels label > span { font-weight: 600; }

.mat__result input[type=text],
.mat__levels input[type=text] {
	width: 150px; padding: 7px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums;
}
.mat__result input[type=text]:focus,
.mat__levels input[type=text]:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }

.mat__reason { display: block; margin-top: 14px; font-size: 14px; }
.mat__reason > span { display: block; margin-bottom: 4px; font-weight: 600; }

/* 303.1 hladiny přebírá z 207.1, proto jsou tam jen ke čtení. */
.inv__mat-source { margin-top: 8px; font-size: 13px; color: var(--c-muted); }
.inv__mat-input[readonly] { background: #f4f6fa; color: #1a2a44; }

/* ============================================================================
   303.1 ROZBOR INVENTURNÍCH ZŮSTATKŮ — .inv-* třídy
   Tabulka účtů z obratové předvahy po účtových třídách. Záložky, skrývání
   nulových řádků a zvýraznění proti materialitě řídí inventory-analysis.js.
   ============================================================================ */

.inv__empty { padding: 16px 18px; border: 1px dashed var(--c-border); border-radius: var(--radius); background: #fbfcfe; font-size: 14px; line-height: 1.55; }
.inv__empty p { margin: 0; }

.inv__mat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 24px; }
.inv__mat-grid label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; font-size: 14px; }
.inv__mat-grid label > span { font-weight: 600; }
.inv__mat-grid label > small { grid-column: 1 / -1; order: 3; color: var(--c-muted); font-size: 12px; }
.inv__mat-input {
	width: 150px; padding: 7px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
	font-family: inherit; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums;
}
.inv__mat-input:focus { outline: none; border-color: #4d7df0; box-shadow: 0 0 0 3px rgba(77,125,240,.15); }

/* Lišta zůstává nahoře — auditor scrolluje stovkami účtů a musí se umět
   přepnout do jiné třídy, aniž by jel zpátky. */
.inv__toolbar {
	position: sticky; top: 0; z-index: 3;
	display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
	padding: 10px 0; margin-bottom: 12px; background: #fff; border-bottom: 1px solid var(--c-border);
}
.inv__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.inv__tab {
	position: relative;
	display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
	padding: 6px 30px 6px 12px; border: 1px solid var(--c-border); border-radius: var(--radius);
	background: #fff; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
	color: #1a2a44; text-align: left; transition: background .12s ease, border-color .12s ease;
}
.inv__tab:hover { background: #f4f7fc; }
.inv__tab.is-active { background: #1a2a44; border-color: #1a2a44; color: #fff; }
.inv__tab small { font-weight: 400; font-size: 11px; opacity: .75; }
/* Počet zobrazených řádků ve třídě — JS ho přepočítává podle filtru nulových. */
.inv__tab-count { position: absolute; top: 5px; right: 8px; font-size: 10px; font-weight: 700; opacity: .6; }

.inv__filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.inv__filter em { color: var(--c-muted); font-style: normal; }

.inv__panel { display: none; }
.inv__panel.is-active { display: block; }

.inv__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv__table th, .inv__table td { padding: 5px 8px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.inv__table thead th {
	position: sticky; top: 52px; z-index: 2;
	background: #f4f7fc; text-align: left; font-weight: 600; color: #1a2a44; white-space: nowrap;
}
.inv__table tfoot td { border-top: 2px solid var(--c-border); border-bottom: 0; font-weight: 700; background: #fbfcfe; }
.inv__num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv__num--closing { font-weight: 600; }
.inv__col-code { white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv__col-name { min-width: 220px; }
.inv__col-input { width: 15%; min-width: 130px; }
.inv__col-input input {
	width: 100%; padding: 4px 7px; border: 1px solid transparent; border-radius: 4px;
	background: #f7f9fc; font-family: inherit; font-size: 13px;
}
.inv__col-input input:hover { border-color: var(--c-border); }
.inv__col-input input:focus { outline: none; background: #fff; border-color: #4d7df0; box-shadow: 0 0 0 2px rgba(77,125,240,.15); }

/* Zvýraznění proti hladinám: nad prováděcí materialitou se účet testuje,
   nad zaznamenávací se aspoň sleduje. */
.inv__row--significant { background: #fff5f5; }
.inv__row--significant .inv__col-code { box-shadow: inset 3px 0 0 #d64545; }
.inv__row--recordable { background: #fffaf0; }
.inv__row--recordable .inv__col-code { box-shadow: inset 3px 0 0 #d69e2e; }
.inv__row:hover { background: #eef3fb; }

/* ---- 303.3 Záznam o fyzické účasti na inventuře zásob ------------------- */
.invrec__qa td { padding: 6px 10px; vertical-align: middle; }
.invrec__qa tbody tr:hover { background: transparent; }
.invrec__col-note { width: 32%; min-width: 180px; }
.invrec__col-note input, .invrec__sample input {
	width: 100%; padding: 4px 7px; border: 1px solid transparent; border-radius: 4px;
	background: #f7f9fc; font-family: inherit; font-size: 13px;
}
.invrec__col-note input:hover, .invrec__sample input:hover { border-color: var(--c-border); }
.invrec__col-note input:focus, .invrec__sample input:focus {
	outline: none; background: #fff; border-color: #4d7df0; box-shadow: 0 0 0 2px rgba(77,125,240,.15);
}

.invrec__rating { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.invrec__rating-label { font-size: 13px; color: var(--c-muted); }
.invrec__rating-opt { min-width: 96px; }

/* Rozcestník lokalit — jeden blok je delší než obrazovka. */
.invrec__bar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin: 10px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--c-border);
}
.invrec__chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.invrec__chip {
	max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	padding: 3px 10px; border: 1px solid var(--c-border); border-radius: 999px;
	background: #f7f9fc; color: var(--c-text); font: inherit; font-size: 12px; cursor: pointer;
}
.invrec__chip:hover { background: #eef3fd; border-color: #93a7db; }

/* Lokalita je <details>, aby šel dlouhý formulář s n pobočkami sbalit bez JS. */
.invrec__lok { border: 1px solid var(--c-border); border-radius: 8px; margin-bottom: 12px; background: #fff; }
.invrec__lok[open] { box-shadow: 0 1px 3px rgba(20,35,60,.06); }
.invrec__lok-head {
	display: flex; align-items: center; gap: 10px; padding: 10px 14px;
	cursor: pointer; list-style: none; background: #f4f7fc; border-radius: 7px;
}
.invrec__lok[open] .invrec__lok-head { border-bottom: 1px solid var(--c-border); border-radius: 7px 7px 0 0; }
.invrec__lok-head::-webkit-details-marker { display: none; }
.invrec__lok-head::before { content: '▸'; color: var(--c-muted); font-size: 12px; }
.invrec__lok[open] .invrec__lok-head::before { content: '▾'; }
.invrec__lok-num { font-weight: 600; font-size: 13px; color: #1a2a44; white-space: nowrap; }
.invrec__lok-title { flex: 1; font-size: 13px; color: var(--c-muted); }
.invrec__lok-remove {
	border: 0; background: none; cursor: pointer; color: #d64545; font-size: 14px;
	padding: 2px 6px; border-radius: 4px; opacity: .6;
}
.invrec__lok-remove:hover { opacity: 1; background: #fef2f2; }
.invrec__lok-body { padding: 14px; }

.invrec__sub-title { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: #1a2a44; }
.invrec__sample td { padding: 4px 6px; }
.invrec__sample tbody tr:hover { background: transparent; }
.invrec__col-narrow { width: 92px; }
.invrec__col-actions { width: 32px; text-align: center; }
.invrec__row-remove {
	border: 0; background: none; cursor: pointer; color: #d64545; font-size: 13px;
	padding: 2px 5px; border-radius: 4px; opacity: .55;
}
.invrec__row-remove:hover { opacity: 1; background: #fef2f2; }
.invrec__toolbar { margin: 8px 0 4px; text-align: right; }

.invrec__declaration {
	margin: 0 0 12px; padding: 12px 14px; border-left: 3px solid var(--c-border);
	background: #f8fafc; font-size: 13px; line-height: 1.6; color: #3d4a5c;
}
.invrec__confirm { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 12px; }

/* === 303.4 Test kompletnosti inventurní dokumentace === */
.invdoc__table { table-layout: auto; }
.invdoc__col-expect {
	width: 48px; text-align: center; color: var(--c-muted);
	font-family: 'SF Mono', Menlo, monospace; font-size: 12px;
}
.invdoc__col-ans { width: 128px; }

/* === Kontrolní seznamy s bezpříznakovou odpovědí (303.4, 305.1) ===
   Odpověď se liší od té, kterou vzor uvádí jako bezpříznakovou → zjištění.
   Podbarvení řídí `:has()`, aby naskočilo hned při kliknutí, ne až po uložení.
   Řádek se tu nebarví podle odpovědi jako v 100.2 — tyhle seznamy jsou psané
   jako výčet závad („Chybějící dokumenty"), takže „ano" je špatná zpráva
   a zelené pozadí by matlo.

   `X` (netýká se) je odchylka taky: u otázky typu „byl vydán vnitřní předpis"
   není co nevztáhnout, a i kdyby ano, patří k tomu vysvětlení v komentáři.

   Pro `--expect-x` naopak pravidlo záměrně chybí — očekávání je tam podmíněné
   předchozí otázkou („Bylo toto zjištění zaúčtováno?" se ptá jen když se něco
   zjistilo), takže „ano" je správná odpověď a podbarvit ji by bylo matoucí. */
.memo-form__q--expect-ano:has(.memo-form__ans--no input:checked),
.memo-form__q--expect-ano:has(.memo-form__ans--nk input:checked),
.memo-form__q--expect-ne:has(.memo-form__ans--yes input:checked),
.memo-form__q--expect-ne:has(.memo-form__ans--nk input:checked) {
	background: #fff8ec; box-shadow: inset 3px 0 0 #f2b90b;
}
.memo-form__q--expect-ano:has(.memo-form__ans--no input:checked):hover,
.memo-form__q--expect-ano:has(.memo-form__ans--nk input:checked):hover,
.memo-form__q--expect-ne:has(.memo-form__ans--yes input:checked):hover,
.memo-form__q--expect-ne:has(.memo-form__ans--nk input:checked):hover {
	background: #fdf0d8;
}

/* ============================================================================
   FLAT spis — souvislý dokument zakázky podle wordového vzoru KAČR 905.8.
   Záměrně vypadá jako dokument, ne jako aplikace: bílý list, patkové nadpisy
   sekcí, tabulky bez zebra pruhů. Editovatelné je skoro všechno, proto se
   editovatelnost nesignalizuje rámečky — jen decentním hoverem a tužkou.
   ============================================================================ */
.flatdoc-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 8px; }
.flatdoc-head__title { margin: 0 0 4px; }
.flatdoc-head__meta { margin: 0; }
.flatdoc-head__actions { display: flex; align-items: center; gap: 8px; }
.flatdoc-head__actions form { margin: 0; }
.flatdoc-hint { color: #64748b; font-size: 13px; margin: 0 0 16px; }
.flatdoc-hint kbd {
	background: #f1f5f9; border: 1px solid #cbd5e1; border-bottom-width: 2px;
	border-radius: 4px; padding: 0 4px; font-size: 11px; font-family: inherit;
}

/* Strop .layout (1200 px) je pro spis těsný — tabulky vzoru a vložené editory
   formulářů potřebují víc místa než běžná obrazovka aplikace. */
main.layout:has(.flatdoc) { max-width: 1460px; }
.flatdoc {
	background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
	padding: 40px 56px 56px; max-width: 1410px; line-height: 1.6; color: #1f2937;
}
.flatdoc__doctitle { text-align: center; font-size: 26px; letter-spacing: .04em; margin: 0 0 32px; }
.flatdoc__section { margin-bottom: 22px; }
.flatdoc__heading { font-size: 17px; margin: 0 0 8px; }
/* Kapitola (level 1) uvozuje blok sekcí — víc vzduchu nad ní a linka pod. */
.flatdoc__section--l1 { margin-top: 34px; }
.flatdoc__section--l1 .flatdoc__heading {
	font-size: 20px; border-bottom: 2px solid #1f3864; padding-bottom: 4px; color: #1f3864;
}
.flatdoc__section--l3 .flatdoc__heading { font-size: 15px; color: #334155; }
.flatdoc__number { color: #1f3864; margin-right: 4px; }
.flatdoc__text { margin: 0 0 12px; }
.flatdoc__text p { margin: 0 0 8px; }
.flatdoc__text ul, .flatdoc__text ol { margin: 0 0 8px; padding-left: 22px; }

/* Stránky spisu — kapitoly 1.–10. Jedna stránka = jedna kapitola. */
.flatdoc-pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.flatdoc-pages__item {
	display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px;
	border: 1px solid #dbe3ee; border-radius: 999px; background: #fff;
	color: #334155; text-decoration: none; font-size: 13px;
}
.flatdoc-pages__item:hover { border-color: #1f3864; color: #1f3864; }
.flatdoc-pages__item--active { background: #1f3864; border-color: #1f3864; color: #fff; }
.flatdoc-pages__num { font-weight: 600; }
.flatdoc-pages__item--active .flatdoc-pages__num { color: #fff; }

/* Podsekce x.x i s potomky x.x.x — zelený pruh vlevo, když je auditor
   označí za hotovou. */
.flatdoc__group { position: relative; padding-left: 14px; margin-left: -14px; }
.flatdoc__group--complete { border-left: 3px solid #0f9d58; background: #f6fdf9; }
.flatdoc__done {
	position: absolute; top: 2px; right: 0; z-index: 1;
	border: 1px solid #dbe3ee; border-radius: 999px; background: #fff;
	color: #94a3b8; font-size: 12px; padding: 2px 10px; cursor: pointer;
	opacity: 0; transition: opacity .12s;
}
.flatdoc__group:hover .flatdoc__done, .flatdoc__done--on { opacity: 1; }
.flatdoc__done--on { border-color: #0f9d58; background: #e9f7ef; color: #0f6b3f; }

.flatdoc__tablewrap { position: relative; }
.flatdoc__table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.flatdoc__table th, .flatdoc__table td {
	border: 1px solid #cbd5e1; padding: 6px 8px; text-align: left; vertical-align: top;
}
.flatdoc__table th { background: #eef2f7; font-weight: 600; }

/* Přidání a odebrání řádku — jedno ovládání na tabulku, jezdí k řádku pod
   kurzorem. Sedí v levém okraji stránky, aby nezasahovalo do buněk. */
.flatdoc__rowctl {
	position: absolute; left: -38px; display: none; flex-direction: column;
	justify-content: center; gap: 2px;
}
.flatdoc__rowctl--on { display: flex; }
.flatdoc__rowbtn {
	border: 1px solid #dbe3ee; border-radius: 4px; background: #fff; cursor: pointer;
	width: 18px; height: 18px; line-height: 1; padding: 0; font-size: 11px; color: #64748b;
}
.flatdoc__rowbtn:hover { border-color: #1f3864; color: #1f3864; }
.flatdoc__rowbtn--del:hover { border-color: #c0392b; color: #c0392b; }

/* Editace — světle žluté pozadí jako u rozpracovaného papíru. */
[data-flat-edit] { position: relative; border-radius: 4px; transition: background .12s; }
[data-flat-edit]:hover { background: #f8fafc; }
.flatdoc--editing, .flatdoc--editing:hover {
	background: #fffbe0; outline: 2px solid #f2c94c; outline-offset: 2px;
}
.flatdoc--saving { opacity: .6; }
.flatdoc--saved { background: #e9f7ef; }
.flatdoc__pencil {
	border: 0; background: none; cursor: pointer; padding: 0 4px;
	color: #94a3b8; font-size: 13px; opacity: 0; transition: opacity .12s;
}
[data-flat-edit]:hover .flatdoc__pencil { opacity: 1; }
.flatdoc__pencil:hover { color: #1f3864; }

/* Odkaz na dokument ve spisu — sbalený jen kód, název a stav. */
.flatref {
	border: 1px solid #dbe3ee; border-left: 3px solid #1f3864; border-radius: 6px;
	background: #f9fbfd; margin: 0 0 12px;
}
.flatref--client { border-left-color: #0f9d58; }
.flatref__summary {
	display: flex; align-items: center; gap: 10px; padding: 8px 12px;
	cursor: pointer; list-style: none; font-size: 13px;
}
.flatref__summary::-webkit-details-marker { display: none; }
.flatref__summary::before { content: '▸'; color: #94a3b8; }
.flatref[open] > .flatref__summary::before { content: '▾'; }
.flatref__code {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	background: #1f3864; color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 12px;
}
.flatref__name { flex: 1; font-weight: 500; }
.flatref__body { padding: 0 12px 12px; }
.flatref__note { color: #64748b; font-size: 13px; margin: 0 0 8px; }
.flatref__frame { width: 100%; height: 70vh; border: 1px solid #dbe3ee; border-radius: 4px; background: #fff; }
.flatref__files { margin: 0; padding-left: 18px; font-size: 13px; }
.flatref__preview { margin-left: 8px; color: #64748b; }

/* ----------------------------------------------------------------------------
   Editor vzoru FLAT spisu — tentýž dokument, navíc s ovládáním struktury.
   Ovládací prvky se drží v okrajích a vylézají až na hover, aby vzor pořád
   vypadal jako dokument a ne jako administrace.
   ---------------------------------------------------------------------------- */
.flattpl-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.flattpl-cats__item {
	display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 14px;
	border: 1px solid #dbe3ee; border-radius: 8px; background: #fff;
	color: #334155; text-decoration: none; font-size: 13px; max-width: 320px;
}
.flattpl-cats__item:hover { border-color: #1f3864; }
.flattpl-cats__item--active { border-color: #1f3864; box-shadow: inset 0 0 0 1px #1f3864; }
.flattpl-cats__code { font-weight: 700; color: #1f3864; }
.flattpl-cats__name { color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flattpl-sec { display: flex; align-items: start; gap: 12px; }
.flattpl-sec .flatdoc__heading { flex: 1; min-width: 0; }
/* Číslo sekce bývá prázdné — bez náhrady by nebylo do čeho dvojkliknout. */
.flatdoc--tpl .flatdoc__number:empty::after { content: 'č.'; color: #cbd5e1; }

.flattpl-ctl { display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity .12s; }
.flattpl-sec:hover .flattpl-ctl, .flattpl-block:hover .flattpl-ctl, .flattpl-ctl:focus-within { opacity: 1; }
.flattpl-ctl--block { position: absolute; top: 2px; right: 0; z-index: 1; background: #fff; }
.flattpl-level {
	border: 1px solid #dbe3ee; border-radius: 4px; background: #fff;
	color: #64748b; font-size: 11px; padding: 1px 4px;
}
.flattpl-btn {
	border: 1px solid #dbe3ee; border-radius: 4px; background: #fff; cursor: pointer;
	width: 20px; height: 20px; line-height: 1; padding: 0; font-size: 11px; color: #64748b;
}
.flattpl-btn:hover { border-color: #1f3864; color: #1f3864; }
.flattpl-btn--del:hover { border-color: #c0392b; color: #c0392b; }

.flattpl-block { position: relative; padding-right: 76px; }
.flattpl-add { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; opacity: 0; transition: opacity .12s; }
.flatdoc__section:hover .flattpl-add, .flattpl-add:focus-within { opacity: 1; }
.flattpl-add__btn {
	border: 1px dashed #cbd5e1; border-radius: 999px; background: #fff; cursor: pointer;
	color: #64748b; font-size: 11px; padding: 2px 10px;
}
.flattpl-add__btn:hover { border-style: solid; border-color: #1f3864; color: #1f3864; }
.flattpl-add__sep { flex: 1; border-top: 1px dotted #e2e8f0; }

.flattpl-colctl { display: flex; gap: 0; margin-bottom: 2px; }
.flattpl-colctl button { flex: 1; opacity: 0; transition: opacity .12s; }
.flatdoc__tablewrap:hover .flattpl-colctl button { opacity: 1; }
.flattpl-head { display: block; color: #94a3b8; font-size: 11px; margin: -8px 0 14px; }

/* Odkaz ve vzoru drží jen kód — název se dohledává v knihovně šablon, takže
   neznámý kód je normální stav rozdělané metodiky, ne chyba. */
.flatref--tpl .flatref__summary { cursor: default; }
.flatref--tpl .flatref__summary::before { content: none; }
.flatref--unknown { border-left-color: #e0a800; background: #fffdf5; }
.flatref__input {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
	width: 90px; border: 1px solid #cbd5e1; border-radius: 4px; padding: 2px 6px;
}
.flatref__warn { color: #92400e; }

@media (max-width: 720px) {
	.flatdoc { padding: 24px 18px 32px; }
	.flatdoc-head { flex-direction: column; }
	.flattpl-block { padding-right: 0; }
}

/* --- Nápověda ------------------------------------------------------------ */
.help-toc { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.help-toc__item {
	display: block; padding: 16px 18px;
	background: var(--c-surface); border: 1px solid var(--c-border);
	border-radius: var(--radius); box-shadow: var(--shadow);
}
.help-toc__item:hover { border-color: var(--c-primary); text-decoration: none; }
.help-toc__title { display: block; font-weight: 600; margin-bottom: 4px; }
.help-toc__perex { display: block; font-size: 13px; color: var(--c-muted); }

/* Souvislý text se čte jinak než tabulky a formuláře ve zbytku aplikace —
   proto širší řádkování a omezená šířka řádku. */
.help-article { max-width: 760px; line-height: 1.65; padding: 24px 28px 28px; }
.help-article > :first-child { margin-top: 0; }
.help-article h2 { font-size: 17px; margin: 28px 0 10px; padding-top: 20px; border-top: 1px solid var(--c-border); }
.help-article h3 { font-size: 14px; margin: 20px 0 8px; }
.help-article ul, .help-article ol { padding-left: 22px; margin: 10px 0; }
.help-article li { margin-bottom: 6px; }
.help-article code { background: var(--c-accent); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.help-fields { margin: 12px 0; }
.help-fields dt { font-weight: 600; margin-top: 12px; }
.help-fields dd { margin: 2px 0 0; padding-left: 14px; border-left: 2px solid var(--c-border); color: var(--c-text); }

.help-table { margin: 12px 0; }
.help-table td { vertical-align: top; }

.help-note {
	margin: 18px 0; padding: 12px 16px;
	background: var(--c-accent); border-left: 3px solid var(--c-primary);
	border-radius: 0 var(--radius) var(--radius) 0;
}
.help-note--warning { background: #fff8ec; border-left-color: var(--c-warning); }
.help-note > :first-child { margin-top: 0; }
.help-note > :last-child { margin-bottom: 0; }
.help-note__label { font-weight: 600; margin-bottom: 6px; }

.help-mail {
	background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
	padding: 12px 14px; margin: 10px 0; font-size: 13px;
}

/* Ověření parcel v katastru nemovitostí (402.4) */
.katastr-form__grid { display: grid; grid-template-columns: 210px 1fr 250px auto; gap: 0 14px; align-items: start; }
.katastr-form__grid .form-row { margin-bottom: 0; }
.katastr-form__submit { align-self: start; padding-top: 22px; }
.katastr-lookup__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.katastr-lookup__head form { margin: 0; }
@media (max-width: 900px) {
	.katastr-form__grid { grid-template-columns: 1fr; gap: 0; }
	.katastr-form__grid .form-row { margin-bottom: 12px; }
	.katastr-form__submit { padding-top: 0; }
}

/* ----------------------------------------------------------------------------
   Soubory od klienta (Auditor:ClientFiles) — zrcadlo klientského rozcestníku
   ---------------------------------------------------------------------------- */
.cfiles-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.cfiles-head__title { margin: 0; font-size: 22px; }
.cfiles-head__code { color: var(--c-muted); font-weight: 500; margin-right: 6px; }
.cfiles-head__note { margin: 4px 0 0; max-width: 70ch; }

.cfiles-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cfiles-chip {
	background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 999px;
	padding: 4px 12px; font-size: 13px; color: var(--c-muted);
}
.cfiles-chip strong { color: var(--c-text); margin-left: 2px; }
.cfiles-chip--review { background: #fff3cd; border-color: #f2e0a8; color: #856404; }
.cfiles-chip--review strong { color: #856404; }
.cfiles-chip--awaited { background: #f1f3f6; }
.cfiles-chip--returned { background: #f8d7da; border-color: #f0bfc4; color: #721c24; }
.cfiles-chip--returned strong { color: #721c24; }
.cfiles-chip--approved { background: #d4edda; border-color: #b8dcc3; color: #155724; }
.cfiles-chip--approved strong { color: #155724; }
.cfiles-chip--overdue { background: #fdd6d1; border-color: #f3b7b0; color: #b3251b; }
.cfiles-chip--overdue strong { color: #b3251b; }

.cfiles-bulk {
	display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
	padding: 0 0 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 4px;
}
.cfiles-bulk__all { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cfiles-bulk [data-cfiles-count] { margin-right: auto; }

/* Popisek pole — .field__label je definovaný jen v client.css, na auditorských
   obrazovkách by se nevykreslil. */
.cfiles-label { display: block; color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

.cfiles-tablewrap { overflow-x: auto; }
.cfiles-table__check { width: 2.5em; text-align: center; }
.cfiles-table__code { width: 5em; color: var(--c-muted); white-space: nowrap; }
.cfiles-table__due { width: 8em; white-space: nowrap; }
.cfiles-table__status { width: 11em; }
.cfiles-table__change { width: 13em; }
.cfiles-table__actions { width: 9em; white-space: nowrap; text-align: right; }
.cfiles-table__actions .btn { margin-left: 4px; }
.cfiles-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cfiles-row--overdue { background: #fff8f7; }
.cfiles-due--overdue { color: var(--c-danger); font-weight: 600; }
.cfiles-comment { margin-top: 4px; font-size: 13px; color: #721c24; }
.cfiles-author { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cfiles-mirror__grid {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--c-border);
}
.cfiles-mirror__desc { padding: 12px 0; border-bottom: 1px solid var(--c-border); }
.cfiles-mirror__desc p { margin: 4px 0 0; white-space: pre-line; }
.cfiles-mirror__files { padding-top: 12px; }
.cfiles-filelist { list-style: none; margin: 6px 0; padding: 0; }
.cfiles-filelist li { padding: 3px 0; }

.cfiles-section { font-size: 17px; margin: 20px 0 8px; }
.cfiles-entry { padding: 14px 0; border-bottom: 1px solid var(--c-border); }
.cfiles-entry:last-child { border-bottom: 0; }
.cfiles-entry__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cfiles-entry__declaration { margin-top: 6px; color: #a25200; }
.cfiles-entry__note { margin-top: 6px; font-style: italic; color: var(--c-muted); }
.cfiles-entry__reviews { margin-top: 8px; }
.cfiles-entry--inactive .cfiles-entry__head a,
.cfiles-entry--inactive .cfiles-entry__head .muted { opacity: 0.55; text-decoration: line-through; }
.cfiles-entry--inactive .cfiles-entry__head .perm-item__tag { opacity: 1; text-decoration: none; }
.cfiles-review { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cfiles-review__comment { flex-basis: 100%; color: var(--c-text); font-size: 13px; }

/* Starší verze se posuzují výjimečně — formulář je schovaný, ať historie zůstane čitelná. */
.cfiles-older { margin-top: 8px; }
.cfiles-older > summary { cursor: pointer; color: var(--c-primary); font-size: 13px; width: max-content; }
.cfiles-older[open] > summary { margin-bottom: 4px; }

.cfiles-feedback { margin-top: 10px; background: var(--c-accent); border-radius: var(--radius); padding: 10px 12px; }
.cfiles-feedback__text { width: 100%; margin: 4px 0 8px; font: inherit; padding: 6px 8px;
	border: 1px solid var(--c-border); border-radius: var(--radius); resize: vertical; }
.cfiles-feedback__actions { display: flex; gap: 8px; }

@media (max-width: 900px) {
	.cfiles-table__change, .cfiles-table__code { display: none; }
	.cfiles-head { flex-direction: column; }
}

/* ===== Strom oprávnění (Nastavení aplikace → Oprávnění) ===== */
.permtree__intro { color: var(--c-muted); max-width: 720px; margin: 0 0 16px; }
.permtree__group { margin: 0 0 4px; font-size: 16px; }
.permtree { width: 100%; }
.permtree__col { width: 120px; text-align: center !important; }
.permtree__cell { text-align: center; }
.permtree__name { background: transparent !important; text-transform: none !important;
	font-size: 14px !important; color: var(--c-text) !important; letter-spacing: normal !important; font-weight: 500; }
.permtree__name .form-help { display: block; font-weight: normal; }

.permtree__toggle { width: 30px; height: 30px; padding: 0; border-radius: 8px; cursor: pointer;
	font-size: 16px; line-height: 1; border: 1px solid transparent; background: transparent;
	transition: background-color .12s, border-color .12s; }
.permtree__toggle.is-on { color: #15803d; background: #dcfce7; border-color: #bbf7d0; }
.permtree__toggle.is-off { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.permtree__toggle:not(:disabled):hover { border-color: currentColor; }
.permtree__toggle:disabled { cursor: not-allowed; opacity: .45; }

/* ===== Lišta impersonifikace (Prohlížíš jako … · Ukončit) ===== */
.impersonation-bar {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	padding: 8px 20px; background: #fef3c7; color: #78350f;
	border-bottom: 1px solid #fcd34d; font-size: 14px;
}
.impersonation-bar strong { color: #78350f; }
.impersonation-bar .btn { border-color: #d97706; color: #78350f; }

/* ===== Stálá složka klienta ===== */
.perm-chapter { border-top: 1px solid var(--c-border); }
.perm-chapter:first-of-type { border-top: 0; }
.perm-chapter__summary { display: grid; grid-template-columns: 60px 1fr auto; align-items: center;
	gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none;
	transition: background-color .12s; }
.perm-chapter__summary::-webkit-details-marker { display: none; }
.perm-chapter__summary:hover { background: #faf7f0; }
.perm-chapter__summary::before { content: '▸'; position: absolute; margin-left: -20px;
	color: var(--c-muted); font-size: 10px; transition: transform .15s; }
.perm-chapter[open] > .perm-chapter__summary::before { transform: rotate(90deg); }
.perm-chapter__code { font-weight: 700; color: var(--c-muted); font-size: 13px; padding-left: 8px; }
.perm-chapter__name { font-weight: 500; color: var(--c-text); }
.perm-chapter__badges { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.perm-chapter__body { padding: 0 16px 18px 82px; }
.perm-chapter__desc { margin: 0 0 12px; }
.perm-chapter__actions { margin-top: 14px; }
.perm-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
	border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.perm-badge--active { background: #dcfce7; color: #166534; }
.perm-badge--muted { background: #f3f4f6; color: var(--c-muted); }
.perm-badge--empty { background: transparent; color: var(--c-muted); padding: 3px 12px; }
.perm-empty { color: var(--c-muted); font-size: 13px; padding: 6px 0; }
.perm-list { list-style: none; padding: 0; margin: 0;
	border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.perm-item { display: flex; justify-content: space-between; align-items: center; gap: 16px;
	padding: 10px 0; border-bottom: 1px dashed var(--c-border); }
.perm-item:last-child { border-bottom: 0; }
.perm-item--inactive { opacity: 0.55; }
.perm-item__name { font-weight: 500; margin: 0 0 2px; }
.perm-item__name a { color: var(--c-text); text-decoration: none; }
.perm-item__name a:hover { text-decoration: underline; }
.perm-item__meta { font-size: 12px; }
.perm-item__tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 4px;
	background: #fef3c7; color: #78350f; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.perm-item__actions { display: flex; gap: 6px; flex-shrink: 0; }
/* Řádek nahraných souborů v detailu požadavku, když je odevzdání neaktuální. */
.perm-file-row--inactive td { opacity: 0.55; }
.perm-file-row--inactive td:first-child { text-decoration: line-through; text-decoration-color: rgba(120,53,15,0.5); }
.perm-file-row--inactive .perm-item__tag { opacity: 1; text-decoration: none; margin-left: 8px; }

/* Náhled odeslaného e-mailu v logu — rámeček odlišující tělo od zbytku stránky. */
.email-preview { border: 1px solid var(--c-border); border-radius: 8px; padding: 16px 20px;
	background: #fff; max-width: 720px; }
.email-preview img { max-width: 100%; height: auto; }


/* ─── Nápověda auditora: obrázky s legendou (stejný jazyk jako klientská nápověda) ─── */
.help-figure {
	margin: 20px 0 28px;
	background: #fbfaf6; border: 1px solid var(--c-border);
	border-radius: 12px; padding: 20px;
}
.help-figure__svg {
	width: 100%; height: auto; display: block;
	background: #fff; border-radius: 8px; border: 1px solid var(--c-border);
	padding: 8px; box-sizing: border-box;
}
.help-legend {
	margin: 18px 0 0; padding: 0; list-style: none; counter-reset: hlg;
	font-size: 14px; column-count: 2; column-gap: 28px;
}
.help-legend li {
	counter-increment: hlg; position: relative; padding: 8px 0 8px 34px;
	border-top: 1px solid var(--c-border); line-height: 1.55;
	break-inside: avoid; -webkit-column-break-inside: avoid;
}
.help-legend li:first-child { border-top: 0; }
.help-legend li::before {
	content: counter(hlg);
	position: absolute; left: 0; top: 8px;
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; border-radius: 50%;
	background: var(--c-primary); color: #fff; font-weight: 800; font-size: 13px;
}
.help-callout {
	margin: 18px 0; padding: 14px 16px; border-left: 3px solid var(--c-primary);
	background: var(--c-accent); border-radius: 6px; font-size: 15px;
}
@media (max-width: 900px) { .help-legend { column-count: 1; } }

/* ─── Zpřístupnění podkladů: výběr dokumentů ─── */
.rpick { margin-top: 8px; }
.rpick__toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.rpick__chapter { margin: 14px 0 6px; font-weight: 700; font-size: 13px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; }
.rpick__sub { margin: 8px 0 4px 6px; font-weight: 600; font-size: 13px; }
.rpick__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px 16px; margin: 0 0 4px 6px; }
.rpick__item { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; font-size: 13px; }
.rpick__item:hover { background: var(--c-accent); }
.rpick__item input { width: auto; margin: 0; }
.rpick__code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--c-muted); min-width: 52px; }
.rpick__rule { margin-left: auto; font-size: 12px; color: var(--c-muted); white-space: nowrap; }
.rpick__manual { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.rpick__manual input { width: auto; padding: 2px 6px; font-size: 12px; }
.rpick__item--manual .rpick__rule { color: var(--c-warning); }
.rdue-modes { display: grid; gap: 8px; margin: 6px 0 10px; }
.rdue-modes label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.rdue-modes input { width: auto; margin-top: 3px; }
.rdue-modes__hint { color: var(--c-muted); font-size: 12px; }
.rel-anchor--missing { color: var(--c-danger); font-weight: 600; }
.rel-planned, .rel-released { font-variant-numeric: tabular-nums; }
.rel-torelease { color: var(--c-primary); font-variant-numeric: tabular-nums; }
.rel-tohide { color: var(--c-warning); font-variant-numeric: tabular-nums; }
.rel-warning { margin: 10px 0 0; color: var(--c-danger); }

/* ─── Matice podkladů (zakázka × dokument) ─── */
/* Full-bleed stejně jako .egrid-wrap: stránka je širší než 1200px layout,
   na úzkém okně se výraz zredukuje na nulový posun. */
.rmx-page { width: calc(100vw - 48px); margin-left: calc(50% - 50vw + 24px); }
.rmx-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.rmx-toolbar__group { display: flex; gap: 4px; align-items: center; }
.rmx-wrap { overflow: auto; max-height: calc(100vh - 240px); border: 1px solid var(--c-border); border-radius: 8px; background: #fff; }
.rmx { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.rmx th, .rmx td { border-bottom: 1px solid var(--c-border); border-right: 1px solid #eef1f4; padding: 3px 5px; white-space: nowrap; }
.rmx thead th { position: sticky; top: 0; z-index: 3; background: var(--c-accent); font-weight: 600; text-align: left; vertical-align: bottom; }
.rmx thead tr.rmx__chapters th { top: 0; font-size: 11px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; text-align: center; border-right: 1px solid var(--c-border); }
.rmx thead tr.rmx__docs th { top: 24px; }
.rmx__doc { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 150px; height: 150px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; text-align: left; }
.rmx__doc-code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--c-muted); }
.rmx__colcheck { text-align: center !important; }
.rmx__colcheck input, .rmx__rowcheck input { width: auto; margin: 0; }
.rmx__sticky { position: sticky; left: 0; z-index: 2; background: #fff; }
.rmx__sticky--check { left: 0; min-width: 34px; max-width: 34px; text-align: center; }
.rmx__sticky--client { left: 34px; min-width: 200px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rmx__sticky--anchor { left: 234px; min-width: 96px; max-width: 96px; color: var(--c-muted); }
.rmx thead .rmx__sticky { z-index: 5; background: var(--c-accent); }
.rmx__cell { text-align: center; min-width: 78px; cursor: default; }
.rmx__cell .badge { display: block; font-size: 10px; padding: 1px 4px; margin: 0 auto 1px; max-width: 74px; }
.rmx__due { display: block; font-size: 10px; color: var(--c-muted); line-height: 1.2; }
.rmx__due--overdue { color: var(--c-danger); font-weight: 600; }
.rmx__due--manual::after { content: ' ✎'; }
.rmx__due--missing { color: var(--c-warning); }
.rmx tr.rmx__row--blocked td { background: #fafafa; color: var(--c-muted); }
.rmx tr.rmx__row--selected td { background: #f5f8ff; }
.rmx tr.rmx__row--selected td.rmx__sticky { background: #eef3ff; }
.rmx td.rmx__cell--colsel { background: #f5f8ff; }
.rmx__legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; color: var(--c-muted); margin: 8px 0 0; }
.rmx__legend .badge { font-size: 10px; padding: 1px 5px; }
.rmx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .rmx-actions { grid-template-columns: 1fr; } }

/* Zaškrtávátka v mřížce — čitelnější než <select multiple>, kde se víc položek
   vybírá klávesou Ctrl a na dotyku to nejde vůbec. */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; margin: 2px 0 0; }
.checkbox-grid__item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.checkbox-grid__item:hover { background: var(--c-accent); }
.checkbox-grid__item input { width: auto; height: auto; margin: 0; }

/* ─── Hromadné pozvánky: výběr kontaktních osob ─── */
.ipick-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.ipick-toolbar input[type="search"] { margin: 0; }
/* Široká tabulka nesmí roztáhnout stránku — posouvá se sama uvnitř obalu. */
.table-scroll { overflow-x: auto; }

/* Klientský přehled požadavků: samostatný sloupec s termínem a modrá ikonka upřesnění od auditora. */
.doc-row.doc-row--req { grid-template-columns: 78px minmax(260px, 1fr) 110px 160px 128px 126px; }
.doc-row--req .doc-due { font-size: 13px; white-space: nowrap; }
.doc-row--req .doc-howto { color: var(--c-muted); }
.info-dot {
	display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px;
	border-radius: 50%; background: #2563eb; color: #fff; font-size: 11px; font-weight: 700; /* stejná modrá jako .cfiles-noteinfo u auditora */
	font-style: italic; font-family: Georgia, serif; line-height: 1; vertical-align: middle; cursor: help;
}
@media (max-width: 1100px) {
	.doc-row.doc-row--req { grid-template-columns: 70px minmax(230px, 1fr) 100px 145px 122px 116px; }
}
@media (max-width: 760px) {
	.doc-row.doc-row--req { grid-template-columns: 62px 1fr auto; }
	.doc-row--req .doc-due { grid-column: 2; }
}

/* ─── Soubory od klienta: termín v seznamu, upřesnění, ikonka i ─── */
.nowrap { white-space: nowrap; }
.cfiles-dueform { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; }
/* Pole i tlačítka v jednom řádku — jinak by buňka termínu zdvojnásobila výšku každého řádku tabulky. */
.cfiles-dueform input[type="date"] { margin: 0; width: auto; min-width: 0; padding: 3px 6px; font-size: 13px; }
.cfiles-filelist--compact { margin: 4px 0 0; font-size: 12px; }
.cfiles-filelist--compact li { padding: 1px 0; }
.cfiles-noteinfo { display: inline-block; width: 16px; height: 16px; line-height: 16px; border-radius: 50%; background: #2563eb; color: #fff; font-size: 11px; font-weight: 700; font-style: italic; text-align: center; cursor: help; vertical-align: middle; }
.cfiles-mirror__note { margin-top: 12px; }
.cfiles-mirror__note textarea { width: 100%; margin: 4px 0; }

/* Zaškrtávací políčko u nepovinného dokumentu (klient: „tento dokument se nás netýká"). */
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; }
