/* Riano superadmin: vzhled podle E713 superadminu, bez frameworku a bez CDN.
   Světlé pozadí, břidlicový text, modrá primární, stav vždy barvou i textem.
   Mezery 4/8/12/16/24/32, radius 10, tabulární číslice v datech. */

:root {
	--bg: #f8fafc;
	--surface: #ffffff;
	--surface-2: #f1f5f9;
	--text: #1e293b;
	--text-strong: #0f172a;
	--muted: #64748b;
	--border: #e2e8f0;
	--border-strong: #cbd5e1;
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--primary-soft: #dbeafe;
	--ok: #16a34a;
	--ok-soft: #dcfce7;
	--warn: #d97706;
	--warn-soft: #fef3c7;
	--danger: #dc2626;
	--danger-soft: #fee2e2;
	--info: #0284c7;
	--info-soft: #e0f2fe;
	--radius: 10px;
	--radius-sm: 6px;
	--shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
	--shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
	--side-w: 232px;
	--sub-w: 216px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--t: 160ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body.sa { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; }
h1, h2, h3 { margin: 0; color: var(--text-strong); line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; margin-top: 4px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
.small { font-size: .875rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; overflow-wrap: anywhere; }
.strong { font-weight: 600; color: var(--text-strong); }
.text-danger { color: #b91c1c; }
.text-warn { color: #b45309; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.ico { flex: 0 0 auto; vertical-align: middle; }

/* ---------- Layout ---------- */
.sa-side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; z-index: 30; transition: transform var(--t); overflow-y: auto; }
.sa-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: var(--text-strong); }
.sa-brand:hover { text-decoration: none; }
.sa-brand__mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; flex: 0 0 auto; }
.sa-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.sa-brand__text small { font-size: .78rem; }
.sa-brand__logo { display: block; width: 120px; height: auto; margin-bottom: 4px; }
.login__brand .sa-brand__logo { width: 140px; margin-bottom: 8px; }
.sa-brand__env { margin-left: auto; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #b45309; background: var(--warn-soft); padding: 2px 6px; border-radius: 999px; }
.sa-nav { display: flex; flex-direction: column; gap: 2px; }
.sa-nav__item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 42px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; transition: background var(--t), color var(--t); }
.sa-nav__item:hover { background: var(--surface-2); text-decoration: none; }
.sa-nav__item.is-active { background: var(--primary-soft); color: var(--primary-hover); }
.sa-nav__item .ico { color: var(--muted); }
.sa-nav__item.is-active .ico { color: var(--primary); }
.sa-nav__item--muted { color: var(--muted); }
.sa-nav__group { display: block; margin: 14px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sa-side__foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.sa-me { display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px; }
.sa-me__avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--text-strong); font-weight: 600; flex: 0 0 auto; }
.sa-me__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sa-me__text strong, .sa-me__text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sa-main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.sa-top { display: flex; align-items: center; gap: 16px; padding: 20px 32px 12px; flex-wrap: wrap; }
.sa-top .sa-top__menu { display: none; }
.sa-top__title { min-width: 220px; flex: 1 1 auto; }
.sa-top__title .muted { display: block; margin-top: 2px; }
.sa-top__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sa-content { padding: 8px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.sa-flash { padding: 0 32px 8px; display: flex; flex-direction: column; gap: 8px; }
.sa-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 25; }

.sa-sub { position: fixed; top: 0; bottom: 0; left: var(--side-w); width: var(--sub-w); z-index: 22; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; padding: 22px 10px 24px; background: var(--surface-2); border-right: 1px solid var(--border); }
.sa--sub .sa-main { margin-left: calc(var(--side-w) + var(--sub-w)); }
.sa-sub__title { padding: 4px 10px 14px; font-size: 1.05rem; font-weight: 700; color: var(--text-strong); }
.sa-sub__group { display: block; margin: 14px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sa-sub__item { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: .94rem; font-weight: 500; transition: background var(--t), color var(--t); }
.sa-sub__item:hover { background: rgba(15, 23, 42, .05); text-decoration: none; }
.sa-sub__item .ico { color: var(--muted); }
.sa-sub__item.is-active { background: var(--surface); color: var(--primary-hover); box-shadow: var(--shadow); }
.sa-sub__item.is-active .ico { color: var(--primary); }
.sa-sub__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-sub__count { flex: 0 0 auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--border); color: var(--muted); font-size: .78rem; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.sa-sub__count--danger { background: var(--danger-soft); color: #b91c1c; }
.sa-sub__count--warn { background: var(--warn-soft); color: #b45309; }

/* ---------- Karty, mřížky ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
a.card { color: inherit; display: block; }
a.card:hover { text-decoration: none; border-color: var(--border-strong); }
.card--highlight { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card__head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__head h2 { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; }
.card__body { padding: 18px 20px; }
.card__foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card__foot:empty { display: none; }
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: stretch; }
.card.kpi { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--border); }
.kpi__label { color: var(--muted); font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__hint { font-size: .85rem; color: var(--muted); }
.grid--kpi5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid--kpi5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid--kpi5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi--ok { border-left-color: var(--ok); }
.kpi--warn { border-left-color: var(--warn); }
.kpi--warn .kpi__value { color: var(--warn); }
.kpi--danger { border-left-color: var(--danger); background: #fffafa; }
.kpi--danger .kpi__value { color: var(--danger); }
.kpi--muted { border-left-color: var(--border-strong); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--text-strong); min-width: 0; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stats > div { flex: 1 1 110px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; }
.stats > div.is-danger { background: var(--danger-soft); }
.stats > div.is-warn { background: var(--warn-soft); }
.stats__n { font-size: 1.3rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stats__l { font-size: .82rem; color: var(--muted); }
.list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 6px 16px; }
.checklist li { display: flex; align-items: baseline; gap: 6px; font-size: .92rem; }
.checklist li.is-ok .ico { color: var(--ok); }
.checklist li.is-danger { color: #b91c1c; }
.checklist li.is-danger .ico { color: var(--danger); }
.checklist li.is-muted { color: var(--muted); }
details summary { cursor: pointer; color: var(--primary); font-weight: 500; margin-bottom: 8px; }
.help { border-top: 1px solid var(--border); padding-top: 14px; }
.help ol { margin: 8px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Tabulky ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .inline-form, .table .actions .btn { margin-left: 4px; }
.table tr.is-muted td { opacity: .6; }
.table a.strong { color: var(--text-strong); }
.table a.strong:hover { color: var(--primary); }
.table--compact th, .table--compact td { padding: 7px 10px; font-size: .88rem; }
.cell-sub { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.pre-cell { max-width: 520px; word-break: break-word; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* ---------- Štítky ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.3; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge--ok { background: var(--ok-soft); color: #15803d; }
.badge--warn { background: var(--warn-soft); color: #b45309; }
.badge--danger { background: var(--danger-soft); color: #b91c1c; }
.badge--info { background: var(--info-soft); color: #0369a1; }
.badge--primary { background: var(--primary-soft); color: var(--primary-hover); }
.badge--plain::before, .badge--muted::before { display: none; }

/* ---------- Tlačítka ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface); color: var(--text-strong); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; transition: background var(--t), border-color var(--t), color var(--t); touch-action: manipulation; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--secondary { border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text-strong); }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: .875rem; }
.btn--block { width: 100%; }

/* ---------- Formuláře ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 500; color: var(--text-strong); font-size: .92rem; }
.field label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
body.sa input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), body.sa select, body.sa textarea {
	font: inherit; color: var(--text-strong); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
	min-height: 40px; padding: 8px 12px; width: 100%; max-width: 100%; transition: border-color var(--t), box-shadow var(--t);
}
body.sa input:focus, body.sa select:focus, body.sa textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
body.sa input[readonly] { background: var(--surface-2); font-family: var(--mono); font-size: .85rem; }
.input--code { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .2em; text-align: center; }
.field__pw { position: relative; }
.field__pw input { padding-right: 48px; }
.field__pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 32px; padding: 4px 8px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 240px; width: auto; }
.toolbar select { width: auto; flex: 0 1 220px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1 1 auto; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg__item { padding: 8px 12px; color: var(--text); font-size: .9rem; border-right: 1px solid var(--border-strong); background: var(--surface); }
.seg__item:last-child { border-right: 0; }
.seg__item:hover { background: var(--surface-2); text-decoration: none; }
.seg__item.is-active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.pager { justify-content: flex-end; }
.pager .muted { margin-right: auto; }

/* ---------- Zprávy ---------- */
.toast, .alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.toast .ico, .alert .ico { margin-top: 2px; }
.toast span, .alert span { flex: 1 1 auto; }
.toast--ok, .alert--ok { background: var(--ok-soft); border-color: #bbf7d0; color: #166534; }
.toast--warn, .alert--warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.toast--danger, .alert--danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.toast--info, .alert--info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }
.alert--link:hover { text-decoration: none; filter: brightness(.98); }
.toast__close { background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; display: inline-flex; border-radius: 4px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 24px; color: var(--muted); }
.empty .ico { color: var(--border-strong); }
.empty h2 { color: var(--text-strong); }

/* ---------- Kód, logy ---------- */
.pre, .code { margin: 0; padding: 12px 14px; background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); font-family: var(--mono); font-size: .82rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 520px; overflow: auto; }
.pre--danger { background: var(--danger-soft); color: #7f1d1d; }
.pre--log { border-radius: var(--radius); max-height: 75vh; }
.code { white-space: pre; }
.code__line { display: block; }
.code__line.is-hit { background: rgba(220, 38, 38, .35); }
.code__n { display: inline-block; width: 44px; color: #64748b; user-select: none; }
.frame { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* ---------- Přihlášení ---------- */
.sa--login { display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.login__card { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login__brand { display: flex; align-items: center; gap: 12px; }
.login__brand strong { display: block; font-size: 1.1rem; color: var(--text-strong); }
.login__brand small { display: block; }
.login__title { font-size: 1.3rem; }
.login__foot { text-align: center; color: var(--muted); font-size: .85rem; margin: 0; }
.login__back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.login__back:hover { color: var(--text-strong); }
.h-sub { margin-top: 8px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.qr { display: flex; justify-content: center; }
.qr svg { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.secret { text-align: center; }
.secret code { font-size: 1rem; letter-spacing: .08em; }
.codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.codes code { display: block; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); text-align: center; font-size: 1rem; }

/* ---------- Mobil ---------- */
@media (max-width: 960px) {
	.sa-side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
	.sa-side.is-open { transform: none; }
	.sa-main, .sa--sub .sa-main { margin-left: 0; }
	.sa-sub { position: static; width: auto; flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
	.sa--sub { display: flex; flex-direction: column; }
	.sa--sub .sa-sub { order: 2; }
	.sa--sub .sa-main { order: 3; }
	.sa-sub__title, .sa-sub__group { display: none; }
	.sa-sub__item { flex: 0 0 auto; }
	.sa-sub__label { overflow: visible; }
	.sa-top { padding: 14px 16px 8px; }
	.sa-top .sa-top__menu { display: inline-flex; }
	.sa-content, .sa-flash { padding-left: 16px; padding-right: 16px; }
	h1 { font-size: 1.3rem; }
	.card__body { padding: 16px; }
	.grid--2 { grid-template-columns: 1fr; }
	.dl { grid-template-columns: 1fr; gap: 2px 0; }
	.dl dt { margin-top: 8px; }
	.copy { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none; animation: none; }
}
