/* Intranet – styl. Vychází z AAFM (proměnné, tabulky, karty); pod 700 px se tabulky .resp mění na karty. */
:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --brand: #1c2a3a; --gold: #b8913a;
  --accent: #0f5c8c; --accent-soft: #e5f0f7; --warn: #a15c00; --warn-soft: #fff4e0;
  --bad: #a3221b; --bad-soft: #fdecea; --ok: #1d6b3a; --ok-soft: #e6f4ea;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Calibri, Carlito, "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .8rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; font-weight: 600; }
.card h2:first-child, .card > h2 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }

/* ---------- Hlavička a menu ---------- */
header.top { background: var(--brand); color: #fff; padding: .5rem 1rem; border-bottom: 3px solid var(--gold); }
.top-in { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .4rem 1.2rem; }
header.top a { color: #fff; }
.brand { font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
.brand:hover { text-decoration: none; color: #f1dca8; }
nav.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; justify-content: center; }
nav.mainnav a { padding: .35rem .8rem; border-radius: 4px; opacity: .85; }
nav.mainnav a.on, nav.mainnav a:hover { background: rgba(255,255,255,.14); opacity: 1; text-decoration: none; }
nav.mainnav a.on { font-weight: 600; box-shadow: inset 0 -2px 0 var(--gold); }
.user { font-size: .9rem; display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; line-height: 1.2; white-space: nowrap; }
.user a.logout { font-size: .8rem; opacity: .7; }
nav.subnav { background: var(--panel); border-bottom: 1px solid var(--line); }
.subnav-in { max-width: 1280px; margin: 0 auto; padding: 0 1rem; display: flex; gap: .1rem; flex-wrap: wrap; justify-content: center; }
nav.subnav a { padding: .55rem .85rem; color: var(--ink); opacity: .8; border-bottom: 3px solid transparent; margin-bottom: -1px; }
nav.subnav a:hover { opacity: 1; text-decoration: none; border-bottom-color: var(--line); }
nav.subnav a.on { opacity: 1; font-weight: 600; color: var(--brand); border-bottom-color: var(--gold); }
@media (max-width: 760px) {
  .top-in { grid-template-columns: 1fr auto; }
  nav.mainnav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}

main { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* ---------- Bloky ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.2rem; }
.card.narrow { max-width: 400px; margin: 3rem auto; display: grid; gap: .8rem; }
.card.private { border-left: 3px solid var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.head-row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .8rem; }
.head-row h1 { margin: 0; }
.stack-wide { display: grid; gap: 1rem; max-width: 900px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .1rem; color: var(--ink); }
a.tile:hover { text-decoration: none; border-color: var(--gold); }
.tile .label { color: var(--muted); font-size: .9rem; }
.tile .value { font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: .85rem; }

/* ---------- Hlášky ---------- */
.flash { background: var(--ok-soft); color: var(--ok); padding: .55rem .8rem; border-radius: 4px; margin: 0 0 1rem; }
.alert { background: var(--bad-soft); color: var(--bad); padding: .55rem .8rem; border-radius: 4px; margin: 0; }
.notice { background: var(--accent-soft); color: var(--accent); padding: .55rem .8rem; border-radius: 4px; margin: 0; }
.udrzba { background: var(--bad); color: #fff; padding: .6rem .9rem; border-radius: 4px; font-weight: 600; margin: 0 0 1rem; }
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 3px; font-size: .8rem; background: #eef1f5; color: #3b4352; white-space: nowrap; vertical-align: middle; font-weight: 400; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

/* ---------- Formuláře ---------- */
label { display: grid; gap: .25rem; font-size: .92rem; color: var(--muted); }
input, select, textarea, button { font: inherit; }
input, select, textarea { padding: .5rem .6rem; border: 1px solid #c9ced6; border-radius: 4px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button, .btn { padding: .55rem 1.1rem; border: 0; border-radius: 4px; background: var(--accent); color: #fff; cursor: pointer; display: inline-block; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
button.light, .btn.light { background: var(--accent-soft); color: var(--accent); }
button.danger, .btn.danger { background: var(--bad); }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); }
label.inl { display: flex; gap: .4rem; align-items: center; }
label.inl input { width: auto; }
label.row-label { display: flex; gap: 1rem; align-items: center; justify-content: space-between; color: var(--ink); max-width: 30rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1rem; align-items: end; }
.form-grid .wide, .form-grid h2 { grid-column: 1 / -1; }
.form-grid h2 { margin: .6rem 0 0; font-size: 1.05rem; color: var(--brand); border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.form-grid h2:first-of-type { margin-top: 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem .7rem; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
fieldset legend { font-size: .9rem; color: var(--muted); padding: 0 .3rem; }
.actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Tabulky ---------- */
.toolbar { display: flex; gap: .6rem .8rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar .filter { flex: 1; min-width: 200px; max-width: 420px; }
.toolbar select, .toolbar input[type=search]:not(.filter) { width: auto; }
.toolbar .count { color: var(--muted); font-size: .9rem; }
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .45rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; font-size: .88rem; color: #3b4352; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: ' ↕'; opacity: .3; font-size: .8em; }
th.asc::after { content: ' ↑'; opacity: .8; }
th.desc::after { content: ' ↓'; opacity: .8; }
tbody tr:hover { background: #f7fafc; }
tbody tr:last-child td { border-bottom: 0; }
tr.vacant td { color: var(--muted); }
@media (max-width: 700px) {
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  table.resp td { border: 0; padding: .1rem .8rem; text-align: left; }
  table.resp td:empty { display: none; }
  table.resp td[data-l]:not(:first-child)::before { content: attr(data-l) ': '; color: var(--muted); font-size: .85rem; }
  table.resp td:first-child { font-size: 1.05rem; padding-bottom: .2rem; }
  dl.props { grid-template-columns: 1fr; gap: 0; }
  dl.props dd { margin-bottom: .45rem; }
  main { padding: 1rem .75rem 3rem; }
  .card { padding: .9rem; }
}
