/* Fakturace – vzhled
   Grafit a bílá jako logo, modrá jako inkoust podpisu. */

:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --ink: #1E2228;
  --muted: #5B6270;
  --faint: #8A919D;
  --line: #DDE1E6;
  --line-strong: #C5CBD3;
  --accent: #2340A0;
  --accent-hover: #1A3184;
  --accent-tint: #E9EDF9;
  --ok: #2A7149;
  --ok-tint: #E6F2EA;
  --warn: #9A5210;
  --warn-tint: #FBF0E3;
  --danger: #A8261E;
  --danger-tint: #FBE9E7;
  --side: #1E2228;
  --side-ink: #E7E9EC;
  --side-muted: #9198A3;
  --radius: 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 28px; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-family: var(--sans); }
p { margin: 0 0 12px; }

/* ---------- Kostra ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side-brand { background: #fff; padding: 14px 16px; }
.side-brand img { display: block; width: 100%; height: auto; max-height: 72px; object-fit: contain; }
.side-brand-text { font-family: var(--serif); font-size: 20px; color: var(--ink); }

.year { padding: 18px 18px 14px; border-bottom: 1px solid #333943; }
.year label { display: block; font-size: 12px; color: var(--side-muted); margin-bottom: 2px; }
.year-row { display: flex; align-items: center; gap: 12px; }
.year select {
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  font: 600 38px/1.1 var(--serif);
  letter-spacing: 0.01em;
  padding: 0 22px 0 0;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--side-muted) 50%), linear-gradient(135deg, var(--side-muted) 50%, transparent 50%);
  background-position: right 6px center, right 0 center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.year select option { color: var(--ink); font-size: 16px; }
.year-note { font-size: 12px; color: #F2C48D; white-space: nowrap; }

.nav { display: flex; flex-direction: column; padding: 10px 10px; gap: 1px; flex: 1; }
.nav a, .nav-later {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--side-ink);
  text-decoration: none;
  font-size: 14.5px;
}
.nav a:hover { background: #2B3038; color: #fff; }
.nav a.is-active { background: #fff; color: var(--ink); }
.nav a.is-active .ico { color: var(--accent); }
.nav-later { color: #6E7581; cursor: default; }
.nav-group { font-size: 12px; color: var(--side-muted); padding: 16px 10px 4px; }
.side-user { border-top: 1px solid #333943; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-user-name { color: var(--side-ink); text-decoration: none; font-size: 14px; }
.side-user .linkish { color: var(--side-muted); }

.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 28px 36px 64px; max-width: 1240px; }

/* ---------- Záhlaví stránky ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Tlačítka a formuláře ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: 500 14.5px var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #E2B4B0; }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.btn-small { height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 22px 24px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 4px; }
.card .hint { margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.f { grid-column: span 12; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f-2 { grid-column: span 2; } .f-3 { grid-column: span 3; } .f-4 { grid-column: span 4; }
.f-5 { grid-column: span 5; } .f-6 { grid-column: span 6; } .f-7 { grid-column: span 7; } .f-8 { grid-column: span 8; } .f-9 { grid-column: span 9; }
label, .label { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: 15px var(--sans);
}
textarea { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-tint); outline-offset: 0; }
input[readonly] { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink); font-weight: 400; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.checks { display: flex; gap: 22px; flex-wrap: wrap; padding-top: 4px; }
.hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--danger); }
.has-error input, .has-error select { border-color: var(--danger); }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.section-title { grid-column: span 12; font: 600 14px var(--sans); color: var(--ink); padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Tabulky ---------- */

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap;
}
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: #F8F9FB; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list .row-link { color: var(--ink); text-decoration: none; font-weight: 500; }
table.list .row-link:hover { color: var(--accent); text-decoration: underline; }
.sub { display: block; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.tag { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag-accent { background: var(--accent-tint); color: var(--accent); border-color: #CCD5F1; }
.tag-ok { background: var(--ok-tint); color: var(--ok); border-color: #C7E1D0; }
.tag-warn { background: var(--warn-tint); color: var(--warn); border-color: #EFD5B5; }

.toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 340px; }
.toolbar .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.toolbar .seg a { padding: 7px 12px; font-size: 13.5px; color: var(--muted); text-decoration: none; border-left: 1px solid var(--line-strong); }
.toolbar .seg a:first-child { border-left: 0; }
.toolbar .seg a.is-on { background: var(--ink); color: #fff; }

.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }
.empty .btn { margin-top: 12px; }

/* ---------- Zprávy ---------- */

.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14.5px; border: 1px solid; }
.flash-ok { background: var(--ok-tint); border-color: #C7E1D0; color: #1F5737; }
.flash-error { background: var(--danger-tint); border-color: #EDC3BF; color: #7E1C16; }
.flash-info { background: var(--accent-tint); border-color: #CCD5F1; color: #1C2F73; }
.flash-warn { background: var(--warn-tint); border-color: #EFD5B5; color: #6F3B0B; }
.inline-msg { font-size: 13px; margin-top: 4px; }
.inline-msg.ok { color: var(--ok); } .inline-msg.err { color: var(--danger); }

/* ---------- Přehled ---------- */

.dash { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.stat { padding: 16px 24px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat b { display: block; font: 600 26px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.steps li:first-child { border-top: 0; }
.steps .dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; margin-top: 1px; display: grid; place-items: center; }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps li.done .dot::after { content: ""; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.steps li.done .step-text { color: var(--muted); }
.steps.roadmap li { display: block; color: var(--muted); padding: 9px 0; }
.roadmap li b { color: var(--ink); font-weight: 500; }

/* ---------- Nastavení ---------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14.5px; }
.tabs a.is-on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.image-slot { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.image-slot:first-of-type { border-top: 0; }
.image-preview { height: 110px; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: grid; place-items: center; background: #fff; padding: 8px; }
.image-preview img { max-width: 100%; max-height: 92px; object-fit: contain; }
.footer-preview { margin-top: 8px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); font-size: 11.5px; text-align: center; color: var(--muted); white-space: pre-line; background: #fff; }
.series-example { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Přihlášení ---------- */

.solo { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { max-width: 280px; width: 100%; height: auto; }
.login .card-pad { padding: 28px; }
.login h1 { font-size: 24px; margin-bottom: 18px; }
.login .f { margin-bottom: 14px; }
.login .btn-primary { width: 100%; height: 42px; margin-top: 6px; }
.login-foot { margin-top: 16px; text-align: center; font-size: 14px; }

/* ---------- Mobil ---------- */

@media (max-width: 980px) {
  .dash { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { display: block; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.side-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(20, 23, 28, .45); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.side-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 10;
    height: 54px; padding: 0 12px;
    background: var(--side); color: #fff;
  }
  .menu-btn { background: none; border: 0; color: #fff; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
  .menu-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
  .topbar-title { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-year { font: 600 18px var(--serif); color: var(--side-muted); }
  .content { padding: 18px 16px 48px; }
  h1 { font-size: 23px; }
  .f-2, .f-3, .f-4, .f-5, .f-6, .f-7, .f-8, .f-9 { grid-column: span 12; }
  .f-half-m { grid-column: span 6; }
  .card-pad { padding: 18px 16px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 22px; }
  .image-slot { grid-template-columns: 1fr; }
  table.list.stack thead { display: none; }
  table.list.stack, table.list.stack tbody, table.list.stack tr, table.list.stack td { display: block; width: 100%; }
  table.list.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.list.stack td { border: 0; padding: 2px 0; text-align: left; }
  table.list.stack td.num { text-align: left; }
  table.list.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .side, .scrim { transition: none; }
}

@media print {
  .side, .topbar, .actions, .toolbar { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
