/* =========================================================
   Administrace – jednoduchá a přehledná
   ========================================================= */
:root {
	--brand: #0e3a5b;
	--brand-2: #165a8c;
	--brand-soft: #e8f0f7;
	--accent: #ef8a23;
	--ink: #17232e;
	--muted: #6a7885;
	--line: #e3e8ed;
	--bg: #f3f6f9;
	--card: #fff;
	--ok: #1f8a4c;
	--warn: #b7791f;
	--err: #c0392b;
	--radius: 12px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; }
.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.22em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.intro { color: var(--muted); margin: 0 0 1.2rem; max-width: 760px; }
.empty { padding: 1.6rem; text-align: center; color: var(--muted); background: var(--bg); border-radius: 10px; margin: 0; }

/* ---------- Rozvržení ---------- */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #cfdbe6; display: flex; flex-direction: column; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; }
.side-logo { display: flex; gap: .7rem; align-items: center; color: #fff; padding: .3rem .5rem 1.4rem; }
.side-logo:hover { text-decoration: none; }
.side-logo small { display: block; color: #8fa9bf; font-size: .78rem; }
.logo-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #f6b04e); color: #fff; flex: none; }
.side-menu { display: grid; gap: .15rem; }
.side-menu a, .side-foot a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 9px; color: #cfdbe6; font-weight: 500; }
.side-menu a:hover, .side-foot a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.side-menu a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: .75rem; border-radius: 99px; padding: .05rem .5rem; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: .8rem; display: grid; gap: .1rem; font-size: .9rem; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem 2rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; min-height: 68px; }
.topbar-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar h1 { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-link { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); }
.back-link:hover { background: var(--bg); text-decoration: none; }
.topbar-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .4rem; cursor: pointer; color: var(--ink); }
.content { padding: 1.6rem 2rem 3rem; max-width: 1280px; }

/* ---------- Karty, mřížky ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.4rem; }
.card-flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 820px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card > h2 { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-wide-left { grid-template-columns: 1.6fr 1fr; }
.edit-layout { display: grid; gap: 1.4rem; }
.edit-layout > .card { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; color: var(--muted); display: flex; flex-direction: column; }
.stat:hover { border-color: var(--brand-2); text-decoration: none; }
.stat-n { font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-accent { background: var(--brand); color: #cfdbe6; border-color: var(--brand); }
.stat-accent .stat-n { color: #fff; }

.checklist { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: .5rem; }
.checklist li { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 9px; background: #fff6ea; }
.checklist li.ok { background: #eaf7ef; color: var(--muted); }
.checklist .btn { margin-left: auto; }
.check-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--warn); color: #fff; flex: none; }
.checklist li.ok .check-ico { background: var(--ok); }
.check-ico .icon { width: 15px; height: 15px; }
.tip { background: var(--brand-soft); border-radius: 10px; padding: 1rem 1.1rem; font-size: .9rem; }
.tip p { margin: .3rem 0 0; }

/* ---------- Tlačítka ---------- */
.btn { display: inline-flex; align-items: center; gap: .45em; padding: .58rem 1.05rem; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { text-decoration: none; }
.btn-sm { padding: .35rem .7rem; font-size: .83rem; }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { background: var(--brand); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.danger { color: var(--err) !important; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: .75rem; }
.icon-btn:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.icon-btn.danger:hover { background: #fdecea; }
.actions { display: flex; gap: .1rem; justify-content: flex-end; white-space: nowrap; }

/* ---------- Pilulky / stavy ---------- */
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill-new { background: #fff1de; color: #a3590a; }
.pill-progress { background: var(--brand-soft); color: var(--brand-2); }
.pill-done, .pill-ok { background: #e3f4ea; color: var(--ok); }
.pill-off { background: #f1f1f1; color: #999; }
.pill-warn { background: #fff1de; color: #a3590a; }

/* ---------- Seznamy kategorií / položek ---------- */
.cat-list, .item-list { display: grid; gap: .5rem; }
.cat-row, .item-row { display: flex; align-items: center; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.item-row { padding: .5rem .7rem; border-radius: 10px; }
.cat-row:hover, .item-row:hover { border-color: #c5d3df; }
.inactive { opacity: .55; }
.cat-ico, .item-thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; flex: none; overflow: hidden; }
.item-thumb { width: 40px; height: 40px; }
.cat-ico img, .item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cat-main, .item-main { flex: 1; min-width: 0; color: var(--ink); }
.cat-main:hover, .item-main:hover { text-decoration: none; color: var(--brand-2); }
.cat-main small, .item-main small { display: block; color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-meta { display: flex; gap: .4rem; }

.quick-add { background: var(--bg); border-radius: 10px; padding: .7rem; margin-bottom: 1rem; }
.quick-form { display: grid; grid-template-columns: 1.2fr 1.5fr auto; gap: .5rem; }
.quick-form input { padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.current-image { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.current-image img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Tabulka ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.row-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.card .table th:first-child, .card .table td:first-child { padding-left: 0; }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 1.2rem; }

.filters { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .25rem; background: var(--card); border: 1px solid var(--line); padding: .25rem; border-radius: 10px; }
.tabs a { padding: .4rem .9rem; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { background: var(--brand-2); color: #fff; }
.inline-filter select { padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff; }
.pager { display: flex; gap: .3rem; margin-top: 1rem; }
.pager a { padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.pager a.active { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }

.detail { display: grid; grid-template-columns: 140px 1fr; gap: .6rem 1rem; margin: 0; }
.detail dt { color: var(--muted); font-size: .88rem; }
.detail dd { margin: 0; word-break: break-word; }
.detail .message { background: var(--bg); padding: .8rem 1rem; border-radius: 9px; }

/* ---------- Formuláře ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem 1.1rem; }
.form-grid > * { grid-column: 1 / -1; }
.form-grid > .field.half { grid-column: span 2; }
.form-grid > .field.quarter { grid-column: span 1; }
.form-stack { display: grid; gap: 1rem; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 1.4rem 0 .6rem; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 700; font-size: 1.02rem; padding: 0 .6rem 0 0; }
.fieldset-help { color: var(--muted); font-size: .88rem; margin: -.2rem 0 1rem; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.field.required > label::after { content: " *"; color: var(--err); }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field input[type=number], .field input[type=file], .field select, .field textarea {
	width: 100%; padding: .6rem .8rem; border: 1px solid #d3dbe3; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(22, 90, 140, .13); }
.field textarea { resize: vertical; }
.field .help { display: block; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.field .error, .form-errors { display: block; color: var(--err); font-size: .85rem; font-weight: 600; margin-top: .25rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.check { display: flex !important; align-items: center; gap: .5rem; font-weight: 500 !important; cursor: pointer; margin: 0 !important; }
.check input, .field input[type=checkbox], .field input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand-2); }
.field-checkbox { align-self: end; padding-bottom: .55rem; }
.checks-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.checks-list .check { padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.checks-list .check:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }
.form-actions { display: flex; gap: .6rem; align-items: center; padding-top: .3rem; }

/* Oko u hesla */
.pw { position: relative; }
.pw input { padding-right: 2.8rem !important; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { background: var(--bg); color: var(--ink); }
.pw-hide { display: none; }
.pw.visible .pw-show { display: none; }
.pw.visible .pw-hide { display: inline; }
.pw-toggle span { line-height: 0; }

/* Výběr ikony */
.icon-picker > label { margin-bottom: .5rem; }
.icon-picker label:has(> input[type=radio]) { display: inline-flex; margin: 0 .3rem .3rem 0; cursor: pointer; font-weight: 500; }
.icon-picker input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.ip { display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 86px; padding: .6rem .3rem; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: #fff; color: var(--brand-2); }
.ip .icon { width: 26px; height: 26px; }
.ip small { font-size: .7rem; color: var(--muted); line-height: 1.2; }
.icon-picker input:checked + .ip { border-color: var(--brand-2); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-2); }
.icon-picker input:focus-visible + .ip { outline: 2px solid var(--accent); }

.radio-pills label:has(> input[type=radio]) { display: inline-flex; align-items: center; gap: .4rem; margin: 0 .4rem .4rem 0; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-weight: 500; }
.radio-pills label:has(> input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; background: #e3f4ea; color: #17643a; }
.flash-error { background: #fdecea; color: var(--err); }
.flash-info { background: var(--brand-soft); color: var(--brand-2); }

/* ---------- Přihlášení ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #0a2236); padding: 16px; }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.6rem; }
.login-logo strong { display: block; font-size: 1.1rem; }
.login-logo small { color: var(--muted); }
.login-box .btn-primary { width: 100%; justify-content: center; padding: .75rem; }
.login-box .form-actions { display: block; }
.login-back { display: inline-flex; gap: .4rem; align-items: center; margin-top: 1.2rem; font-size: .9rem; color: var(--muted); }

/* ---------- Mobil ---------- */
@media (max-width: 1000px) {
	.grid-2, .grid-wide-left { grid-template-columns: 1fr; }
	.stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
	.admin { grid-template-columns: 1fr; }
	.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
	.sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
	.menu-btn { display: inline-grid; place-items: center; }
	.topbar { padding: .8rem 16px; }
	.content { padding: 1.2rem 16px 2.5rem; }
	.form-grid > .field.half, .form-grid > .field.quarter { grid-column: 1 / -1; }
	.quick-form { grid-template-columns: 1fr; }
	.cat-meta { display: none; }
	.detail { grid-template-columns: 1fr; }
	.detail dt { margin-top: .4rem; }
}
