/* Společný vzhled aplikací DEI (ERP a B2B). Firemní styl: Bricolage Grotesque + Figtree, inkoust #231F20, oranžová, mlha. */
@import url("fonts.css");

:root {
  --bg: #F3F2EE; --surface: #FFFFFF; --sunk: #EAE8E2; --line: #E2E0DA; --line-strong: #CFCBC2;
  --text: #231F20; --muted: #5E5955;
  --accent: #C2410C; --accent-hover: #9A3412; --accent-soft: #FDEBE2; --drop: #F2622B;
  --ok: #1F7A43; --ok-soft: #E4F2E8; --warn: #8A5A00; --warn-soft: #FDF1D3; --bad: #B42318; --bad-soft: #FDE8E6; --info: #1D4E89; --info-soft: #E3ECF7;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(35,31,32,.05), 0 6px 18px rgba(35,31,32,.06);
  --head: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side: 232px; --top: 64px; --tabbar: 68px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--font); }
h1, h2, h3 { font-family: var(--head); letter-spacing: -.015em; line-height: 1.2; margin: 0; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- rám aplikace ---------- */
.demo-bar { background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; text-align: center; padding: 6px 12px; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.logo svg { height: 30px; width: auto; display: block; }
.logo b { font: 700 18px/1 var(--head); }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input { width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-results { position: absolute; left: 0; right: 0; top: 50px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; padding: 6px; margin: 0; list-style: none; }
.search-results li a { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search-results li a:hover, .search-results li a[aria-selected="true"] { background: var(--accent-soft); }
.search-results small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; flex: none; }
.user select { height: 40px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 10px; background: var(--surface); }

.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); padding: 18px 12px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.side a, .tabbar a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; min-height: 48px; }
.side a svg, .tabbar a svg { width: 22px; height: 22px; flex: none; }
.side a:hover { background: var(--bg); }
.side a[aria-current="page"], .tabbar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side .count, .tabbar .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side .side-foot { margin-top: auto; font-size: 14px; color: var(--muted); padding: 0 12px; }
main { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
.tabbar { display: none; }

/* ---------- hlavička stránky ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 240px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumbs { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ---------- tlačítka ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 0 12px; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; }
.btn-new { flex: none; }

/* ---------- úkoly „Dnes“ ---------- */
.tasks { display: grid; gap: 12px; margin: 0 0 28px; padding: 0; list-style: none; }
.task { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-strong); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.task.bad { border-left-color: var(--bad); } .task.warn { border-left-color: var(--warn); } .task.ok { border-left-color: var(--ok); } .task.info { border-left-color: var(--info); }
.task .tx { flex: 1; min-width: 0; }
.task .tx b { display: block; font-size: 18px; }
.task .tx span { color: var(--muted); font-size: 15px; }
.task .when { font-size: 14px; color: var(--muted); white-space: nowrap; }
.done-all { background: var(--ok-soft); color: var(--ok); border-radius: var(--r); padding: 18px; font-weight: 700; }

/* ---------- dlaždice „Co chcete udělat?“ ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 28px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-height: 112px; cursor: pointer; text-align: left; }
.tile:hover { border-color: var(--accent); }
.tile svg { width: 28px; height: 28px; color: var(--accent); }
.tile b { font-size: 18px; }
.tile span { color: var(--muted); font-size: 15px; }

/* ---------- karty a čísla ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 18px; }
.card > .ch { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > .ch h2 { flex: 1; font-size: 19px; }
.card > .cb { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .l { color: var(--muted); font-size: 15px; }
.stat .v { display: block; font: 700 32px/1.15 var(--head); margin: 4px 0; }
.stat .d { font-size: 15px; color: var(--muted); }
.hint { color: var(--muted); font-size: 15px; }
.note { background: var(--info-soft); color: var(--info); border-radius: var(--r-sm); padding: 12px 14px; font-size: 15px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- semafor a stavy ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-warn { background: var(--warn-soft); color: var(--warn); }
.st-bad { background: var(--bad-soft); color: var(--bad); }
.st-info { background: var(--info-soft); color: var(--info); }
.st-mute { background: var(--sunk); color: var(--muted); }
.meter { height: 8px; background: var(--sunk); border-radius: 999px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.meter.warn i { background: #D08A00; } .meter.bad i { background: var(--bad); }

/* ---------- seznamy (tabulka na počítači, karty v mobilu) ---------- */
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 14px; font-weight: 700; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list th.num { text-align: right; }
.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 16px; vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tr.go { cursor: pointer; }
.list tr.go:hover td { background: #FAF9F6; }
.list td.main b { display: block; }
.list td.main span { color: var(--muted); font-size: 14px; }
.list .chev { width: 32px; color: var(--muted); }

/* rozbalovací řádek */
.more { background: var(--bg); }
.more td { padding: 12px 16px 18px; }

/* ---------- formuláře a průvodci ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field .lab { font-weight: 700; }
.field .hint { margin-top: -2px; }
.in, select.in, textarea.in { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
textarea.in { min-height: 96px; }
.in:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; min-height: 64px; }
.choice[aria-pressed="true"], .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice b { font-size: 17px; } .choice span { color: var(--muted); font-size: 14px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.steps { display: flex; gap: 8px; list-style: none; margin: 0 0 20px; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); font-size: 15px; }
.steps li::before { content: attr(data-n); width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-weight: 700; }
.steps li[aria-current="step"] { color: var(--text); }
.steps li[aria-current="step"]::before { background: var(--accent); color: #fff; }
.steps li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.steps li + li { padding-left: 8px; border-left: 1px solid var(--line); }
.wizard-foot { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; font-weight: 700; cursor: pointer; }
.stepper input { width: 64px; height: 44px; border: 0; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper button:hover { background: var(--bg); }

/* ---------- vysouvací panel (sheet) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(35,31,32,.38); z-index: 60; display: flex; justify-content: flex-end; }
.sheet { width: min(560px, 100%); height: 100%; background: var(--surface); overflow: auto; display: flex; flex-direction: column; }
.sheet > .sh { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet > .sh h2 { flex: 1; }
.sheet > .sb { padding: 20px 22px; flex: 1; }
.sheet > .sf { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 20px; }

/* nabídka „+ Nový“ */
.newmenu { display: grid; gap: 10px; }
.newmenu button { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; min-height: 64px; }
.newmenu button:hover { border-color: var(--accent); background: var(--accent-soft); }
.newmenu svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.newmenu b { display: block; font-size: 17px; } .newmenu span { color: var(--muted); font-size: 14px; }

/* ---------- toast s Vrátit ---------- */
.toast { min-width: min(360px, calc(100% - 32px)); position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140%); background: var(--text); color: #fff; padding: 12px 12px 12px 18px; border-radius: 14px; display: flex; align-items: center; gap: 14px; z-index: 80; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.25); transition: transform .25s ease; font-weight: 600; }
.toast.on { transform: translateX(-50%) translateY(0); }
.toast button { background: #fff; color: var(--text); border: 0; border-radius: 999px; min-height: 40px; padding: 0 16px; font-weight: 700; cursor: pointer; }
.toast button[hidden] { display: none; }

/* ---------- prázdné stavy, nápověda, průvodce ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.help { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; vertical-align: middle; margin-left: 4px; }
.tour { position: fixed; inset: 0; z-index: 90; background: rgba(35,31,32,.5); display: grid; place-items: center; padding: 16px; }
.tour .box { background: var(--surface); border-radius: 18px; padding: 26px; max-width: 460px; width: 100%; }
.tour .box p { color: var(--muted); }
.tour .dots { display: flex; gap: 6px; margin: 14px 0; }
.tour .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tour .dots i.on { background: var(--accent); }

/* ---------- mobil ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  .top { padding: 0 12px; gap: 8px; height: 60px; }
  .logo b { display: none; }
  .user { display: none; }
  .btn-new { padding: 0 14px; min-height: 44px; }
  .btn-new .lbl { display: none; }
  .layout { display: block; }
  .side { display: none; }
  main { padding: 18px 16px calc(var(--tabbar) + 32px); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); height: var(--tabbar); padding: 4px 4px env(safe-area-inset-bottom); }
  .tabbar a { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 2px; font-size: 12px; min-height: 56px; position: relative; text-align: center; }
  .tabbar .count { position: absolute; top: 2px; right: 50%; transform: translateX(24px); margin: 0; font-size: 11px; padding: 0 6px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .task { flex-wrap: wrap; }
  .task .btn { width: 100%; }
  .page-head .btn { width: 100%; }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .list td { border: 0; padding: 4px 16px; text-align: left; }
  .list td.num { text-align: left; }
  .list td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 14px; }
  .list .chev { display: none; }
  .sheet { width: 100%; }
  .toast { bottom: calc(var(--tabbar) + 12px); }
  .wizard-foot .btn { flex: 1; }
}
@media print { .top, .side, .tabbar, .demo-bar, .toast { display: none !important; } .layout { display: block; } main { padding: 0; } }

/* skrytý toast nesmí překrývat spodní lištu ani otevřený panel */
.toast:not(.on) { visibility: hidden; pointer-events: none; }
body:has(.sheet-bg) .toast { z-index: 50; }
