/* Wakanda administrace – vzhled „A · Čistý“ (tokeny a písmo ve /static/css/tokens.css). */
@import url("/static/css/tokens.css");

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;
  font-feature-settings:"cv11","ss01";transition:background-color var(--dur),color var(--dur)}
a{color:var(--text);text-decoration:none}
a:hover{color:var(--accent-text)}
:focus-visible{outline:none;box-shadow:var(--focus);border-radius:var(--radius-sm)}
::selection{background:var(--accent-soft);color:var(--text)}
[hidden]{display:none!important}

h1{font-size:28px;font-weight:650;letter-spacing:-.03em;line-height:1.15;margin:4px 0 0}
h2{font-size:15px;font-weight:600;letter-spacing:-.01em;margin:0}
h3{font-size:15px;font-weight:600;margin:0}
.muted{color:var(--muted)}
.small{font-size:12px}
.err{color:var(--danger)}
.mono{font-family:var(--mono);font-size:13px;letter-spacing:.04em}
.num,td.num,.card .v{font-variant-numeric:tabular-nums}
.grow{flex:1}
.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.row.meta{margin-bottom:16px}
.empty{padding:28px 16px;text-align:center;color:var(--muted);background:var(--surface2);border-radius:var(--radius-sm)}
.subhead{margin:24px 0 12px}

/* ── kostra ─────────────────────────────────────────────── */
.layout{display:grid;grid-template-columns:240px minmax(0,1fr);min-height:100vh}
.topbar{display:none}
nav{background:var(--surface);border-right:1px solid var(--border);padding:16px 12px;display:flex;flex-direction:column;gap:2px;position:sticky;top:0;height:100vh;overflow-y:auto}
nav .brand{display:flex;align-items:center;gap:10px;padding:6px 10px 18px}
nav .brand b{font-size:15px;font-weight:650;letter-spacing:-.02em}
nav .brand small{display:block;font-size:11px;color:var(--muted);font-weight:500}
.mark{width:28px;height:28px;border-radius:8px;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;font-weight:700;font-size:14px;flex:none}
nav a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);color:var(--muted);font-weight:500;white-space:nowrap;transition:background-color var(--dur),color var(--dur)}
nav a svg{width:17px;height:17px;flex:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
nav a:hover{background:var(--surface2);color:var(--text)}
nav a.on{background:var(--surface2);color:var(--text);font-weight:600}
nav .me{margin-top:auto;padding:12px 10px 4px;border-top:1px solid var(--border);font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:8px}
nav .me .who{color:var(--text);font-weight:500;overflow:hidden;text-overflow:ellipsis}
nav .me .row{justify-content:space-between;flex-wrap:nowrap}
nav .me select{height:30px;font-size:12px;padding:0 8px}
.scrim{display:none}
main{padding:28px 32px 120px;max-width:1360px;width:100%;min-width:0}
.pagehead{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:20px}
.pagehead .sub{margin:6px 0 0;color:var(--muted)}
.crumb{font-size:13px;font-weight:500;color:var(--muted)}
.crumb.back:hover{color:var(--text)}

/* ── karty a panely ─────────────────────────────────────── */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:12px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px;min-width:0}
.card .k{font-size:12px;font-weight:500;color:var(--muted)}
.card .v{font-size:26px;font-weight:600;letter-spacing:-.025em;margin-top:6px;line-height:1.2;overflow-wrap:anywhere}
.card .v.small{font-size:16px}
.card .d{font-size:12px;color:var(--muted);margin-top:4px}
.card.acc{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.card.acc .k,.card.acc .d{color:var(--accent-ink);opacity:.85}
.panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px;margin-bottom:12px;min-width:0}
.panel .hd{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.panel .hd .muted{font-size:13px}
.two{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:12px;align-items:start}
.two.even{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.toolbar input,.toolbar select{flex:1;min-width:180px}
.toolbar.big input{height:44px;font-size:15px}
.toolbar.big button{height:44px}
dl.facts{display:grid;grid-template-columns:auto 1fr;gap:6px 16px;margin:16px 0 0;font-size:13px}
dl.facts dt{color:var(--muted)}
dl.facts dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}
dl.facts.big{font-size:14px;max-width:520px;gap:10px 24px;padding:16px 0 0}

/* ── tabulky ────────────────────────────────────────────── */
.tablewrap{overflow-x:auto;margin:0 -4px;padding:0 4px}
table{width:100%;border-collapse:collapse}
th{text-align:left;padding:4px 12px 10px;border-bottom:1px solid var(--border);font-size:12px;font-weight:500;color:var(--muted);white-space:nowrap}
td{padding:12px;border-bottom:1px solid var(--border);vertical-align:middle;white-space:nowrap}
tbody tr:last-child td{border-bottom:0}
td.wrap{white-space:normal;min-width:160px}
td.num,th.num{text-align:right}
tr.click{cursor:pointer}
tr.click td{transition:background-color var(--dur)}
tr.click:hover td,tr.click:focus-visible td{background:var(--surface2)}
tr.click:focus-visible{outline:none}

/* ── stavy ──────────────────────────────────────────────── */
.badge{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:var(--radius-pill);font-size:12px;font-weight:500;background:var(--surface2);color:var(--muted);white-space:nowrap}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.badge.good{background:var(--ok-soft);color:var(--ok)}
.badge.warn{background:var(--warn-soft);color:var(--warn)}
.badge.bad{background:var(--danger-soft);color:var(--danger)}
.badge.live{background:var(--accent-soft);color:var(--accent-text)}
.badge.live::before{box-shadow:0 0 0 3px color-mix(in srgb,currentColor 25%,transparent)}

/* ── tlačítka a vstupy ──────────────────────────────────── */
button,.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;font:inherit;font-weight:500;font-size:13px;height:36px;padding:0 14px;
  border-radius:var(--radius-sm);border:1px solid var(--border-strong);background:var(--surface);color:var(--text);cursor:pointer;text-decoration:none;white-space:nowrap;
  transition:background-color var(--dur),border-color var(--dur),color var(--dur)}
button:hover,.btn:hover{background:var(--surface2);color:var(--text)}
button:active,.btn:active{transform:translateY(1px)}
button:disabled{opacity:.55;cursor:wait}
button svg,.btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
button.primary,.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
button.primary:hover,.btn.primary:hover{background:var(--accent-hover);border-color:var(--accent-hover);color:var(--accent-ink)}
button.danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 40%,transparent)}
button.danger:hover{background:var(--danger-soft)}
.danger-fill{background:var(--danger);border-color:var(--danger);color:#fff}
.danger-fill:hover{background:var(--danger);color:#fff;filter:brightness(1.1)}
button.icon{width:32px;height:32px;padding:0;border-color:transparent;background:transparent;color:var(--muted)}
button.icon:hover{background:var(--surface2);color:var(--text)}
button.icon.danger:hover{background:var(--danger-soft);color:var(--danger)}
button.linklike{border:0;background:none;height:auto;padding:0;font-weight:600;color:var(--text)}
button.linklike:hover{background:none;color:var(--accent-text)}
input,select,textarea{font:inherit;font-size:14px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);border-radius:var(--radius-sm);
  padding:0 12px;height:40px;width:100%;min-width:0;transition:border-color var(--dur),box-shadow var(--dur)}
select{padding-right:8px}
textarea{height:auto;padding:10px 12px;line-height:1.5;resize:vertical}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent);box-shadow:var(--focus)}
input[type=checkbox]{height:16px;width:16px;accent-color:var(--accent);flex:none;margin:0}
input[type=color]{width:44px;height:40px;padding:3px;cursor:pointer}

/* ── formuláře ──────────────────────────────────────────── */
.fgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 18px}
.f{display:flex;flex-direction:column;gap:6px;min-width:0}
.f.full{grid-column:1/-1}
.flabel{font-size:13px;font-weight:500;color:var(--text)}
.req{color:var(--danger);font-style:normal;margin-left:3px}
.hint{font-size:12px;color:var(--muted);line-height:1.4}
.ferr{font-size:12px;color:var(--danger);min-height:0}
.ferr:empty{display:none}
.f.invalid input,.f.invalid select,.f.invalid textarea,.f.invalid .chips{border-color:var(--danger)}
.affix{display:flex;align-items:stretch}
.affix input{border-top-right-radius:0;border-bottom-right-radius:0}
.affix span{display:grid;place-items:center;padding:0 12px;border:1px solid var(--border-strong);border-left:0;border-radius:0 var(--radius-sm) var(--radius-sm) 0;background:var(--surface2);color:var(--muted);font-size:13px;white-space:nowrap}
.affix.pre input{border-radius:0 var(--radius-sm) var(--radius-sm) 0}
.affix.pre span{border:1px solid var(--border-strong);border-right:0;border-radius:var(--radius-sm) 0 0 var(--radius-sm)}
.color{display:flex;gap:8px}
.color input[type=text]{max-width:120px}
.seg{display:inline-flex;flex-wrap:wrap;background:var(--surface2);border-radius:var(--radius-sm);padding:3px;gap:2px;align-self:flex-start;max-width:100%}
.seg button{height:32px;border:0;background:transparent;color:var(--muted);padding:0 12px}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.08),0 0 0 1px var(--border)}
.switch{display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-size:14px;font-weight:500;align-self:flex-start}
.switch input{position:absolute;opacity:0;width:1px;height:1px}
.switch .track{width:36px;height:20px;border-radius:999px;background:var(--surface3);position:relative;flex:none;transition:background-color var(--dur)}
.switch .track::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform var(--dur) var(--ease)}
.switch input:checked+.track{background:var(--accent)}
.switch input:checked+.track::after{transform:translateX(16px)}
.switch input:focus-visible+.track{box-shadow:var(--focus)}
.optional-body{margin-top:14px;padding:16px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg)}
.checklist{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;max-height:300px;overflow-y:auto}
.check-row,.grant-row{display:flex;align-items:center;gap:12px;padding:10px 14px;border-bottom:1px solid var(--border);cursor:pointer;font-size:14px}
.check-row:last-child,.grant-row:last-child{border-bottom:0}
.check-row:hover,.grant-row:hover{background:var(--surface2)}
.check-row small,.grant-row small{display:block;color:var(--muted);font-size:12px}
.grant-row{cursor:default}
.grant-row>span{flex:1;min-width:0}
.chip-check{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border:1px solid var(--border-strong);border-radius:999px;font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap}
.chip-check:has(input:checked){background:var(--accent-soft);border-color:transparent;color:var(--accent-text)}
.chips{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:40px;padding:4px 6px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--surface);cursor:text}
.chips:focus-within{border-color:var(--accent);box-shadow:var(--focus)}
.chips input{border:0;box-shadow:none!important;height:30px;flex:1;min-width:120px;padding:0 6px;background:transparent}
.chips-list{display:contents}
.chip{display:inline-flex;align-items:center;gap:2px;padding:0 2px 0 10px;height:28px;border-radius:999px;background:var(--surface2);font-size:13px;font-weight:500}
.chip button.icon{width:24px;height:24px}
.fsection{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px 22px;grid-column:1/-1}
.fsection>header{margin-bottom:16px}
.fsection>header p{margin:4px 0 0;color:var(--muted);font-size:13px}
.editor-main>.fgrid{grid-template-columns:1fr;gap:12px}

/* opakovatelné řádky a bloky */
.rep{display:flex;flex-direction:column;gap:8px}
.rep-item{border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg)}
.rep-item>.fgrid,.rep-body{padding:14px}
.rep-body>.fgrid{padding:0}
.rep-head{display:flex;align-items:center;gap:6px;padding:6px 6px 6px 12px;border-bottom:1px solid var(--border);min-height:44px}
.rep-item:has(.rep-body[hidden]) .rep-head{border-bottom:0}
.rep-num{font-size:12px;font-weight:600;color:var(--faint);font-variant-numeric:tabular-nums}
.rep-title{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;text-align:left}
.block-ico svg{width:16px;height:16px;stroke:var(--muted);fill:none;stroke-width:2;transition:transform var(--dur)}
.rep-item:has(.rep-body:not([hidden])) .block-ico svg{transform:rotate(90deg)}
button.add{margin-top:8px;border-style:dashed;color:var(--muted);width:100%}
button.add:hover{color:var(--text);border-color:var(--text)}
.block-menu{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px;margin-top:8px}
.block-menu button{height:auto;flex-direction:column;align-items:flex-start;gap:2px;padding:10px 12px;text-align:left;border-style:dashed}
.block-menu button small{color:var(--muted);font-weight:400;font-size:12px;white-space:normal}

/* stránkový editor */
.editor{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.editor.with-aside{grid-template-columns:minmax(0,1fr) minmax(320px,420px);align-items:start}
.preview{position:sticky;top:20px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px}
.preview .frame{border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;height:min(70vh,680px);margin-bottom:8px;background:var(--bg)}
.preview iframe{width:166%;height:166%;border:0;transform:scale(.6);transform-origin:0 0}
.savebar{position:fixed;left:240px;right:0;bottom:0;z-index:4;display:flex;align-items:center;gap:8px;padding:12px 32px;
  background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-top:1px solid var(--border)}
.savebar .err{font-size:13px}

/* ── boční panel a dialogy ──────────────────────────────── */
dialog{color:var(--text);background:var(--surface);border:1px solid var(--border);padding:0}
dialog::backdrop{background:var(--overlay);backdrop-filter:blur(2px)}
dialog.drawer{margin:0 0 0 auto;height:100dvh;max-height:100dvh;width:min(620px,100vw);max-width:100vw;border-radius:16px 0 0 16px;border-right:0;
  animation:slidein .22s var(--ease)}
dialog.drawer{overflow:hidden}
dialog.drawer>form{display:flex;flex-direction:column;height:100%}
dialog.drawer header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:20px 22px 16px;border-bottom:1px solid var(--border)}
dialog.drawer header h2{font-size:18px}
dialog.drawer header p{margin:2px 0 0;font-size:13px}
.drawer-body{flex:1;overflow-y:auto;padding:20px 22px}
dialog.drawer footer{display:flex;align-items:center;gap:8px;padding:14px 22px;border-top:1px solid var(--border)}
dialog.drawer footer .err{font-size:13px}
@keyframes slidein{from{transform:translateX(40px);opacity:0}}
dialog.modal{border-radius:16px;width:min(440px,calc(100vw - 32px));padding:24px;animation:pop .18s var(--ease)}
dialog.modal h2{font-size:18px;margin-bottom:8px}
dialog.modal p{margin:0 0 16px}
dialog.modal .check-row{border:1px solid var(--border);border-radius:var(--radius-sm);margin-bottom:16px}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@keyframes pop{from{transform:scale(.97);opacity:0}}
pre.codes{font-family:var(--mono);font-size:16px;letter-spacing:.1em;background:var(--surface2);padding:14px 16px;border-radius:var(--radius-sm);margin:0 0 16px;max-height:300px;overflow:auto;user-select:all}

/* podpora */
.codecards{display:flex;flex-direction:column;gap:10px}
.codecard{border:1px solid var(--border);border-radius:var(--radius-sm);padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.cc-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cc-head .mono{font-size:16px;font-weight:600;margin-right:4px}
.timeline{list-style:none;padding:0;margin:0;max-height:520px;overflow:auto}
.timeline li{padding:10px 0;border-bottom:1px solid var(--border);display:grid;grid-template-columns:110px minmax(0,1fr);gap:2px 12px;font-size:13px}
.timeline li:last-child{border-bottom:0}
.timeline b{font-weight:600}
.timeline .mono{grid-column:2;font-size:12px;color:var(--muted);overflow-wrap:anywhere;letter-spacing:0}

/* grafy */
.chart svg{display:block;width:100%;height:auto;overflow:visible}
.chart .axis{fill:var(--muted);font-size:11px}
.chart .gridline{stroke:var(--border);stroke-width:1}
.chart .bar{fill:var(--chart);transition:fill var(--dur)}
.chart g:last-of-type .bar,.chart g:hover .bar{fill:var(--accent)}
.chart .line{stroke:var(--accent);stroke-width:2;fill:none}
.chart .hit{fill:transparent}
.hbar{display:grid;grid-template-columns:84px minmax(0,1fr) 44px;gap:12px;align-items:center;margin:10px 0;font-size:13px}
.hbar .track{height:6px;background:var(--surface2);border-radius:var(--radius-pill);overflow:hidden}
.hbar .fill{height:6px;background:var(--chart);border-radius:var(--radius-pill);min-width:3px;transition:background-color var(--dur)}
.hbar:first-child .fill,.hbar:hover .fill{background:var(--accent)}
.hbar .num{text-align:right;font-weight:500}
.tip{position:fixed;pointer-events:none;background:var(--text);color:var(--bg);padding:6px 10px;border-radius:6px;font-size:12px;font-weight:500;z-index:30;white-space:nowrap}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:var(--text);color:var(--bg);padding:10px 16px;border-radius:var(--radius-sm);z-index:40;font-weight:500;
  box-shadow:0 8px 24px rgba(0,0,0,.18);transition:opacity .3s,transform .3s;max-width:calc(100vw - 32px)}
.toast.out{opacity:0;transform:translate(-50%,8px)}

/* přihlášení */
.login{max-width:380px;margin:12vh auto;background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:32px;display:flex;flex-direction:column;gap:14px}
.login .mark{width:40px;height:40px;border-radius:10px;font-size:18px}
.login h1{font-size:24px;margin:0}
.login>p{margin:-8px 0 4px;color:var(--muted)}
.login button{height:42px}

/* ── responzivita ───────────────────────────────────────── */
@media (max-width:1100px){
  .editor.with-aside{grid-template-columns:minmax(0,1fr)}
  .preview{position:static}
  .preview .frame{height:420px}
}
@media (max-width:860px){
  .layout{grid-template-columns:1fr}
  .topbar{display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:20;height:56px;padding:0 12px;background:var(--surface);border-bottom:1px solid var(--border)}
  .topbar b{font-size:15px;font-weight:600}
  .topbar button.icon{color:var(--text)}
  nav{position:fixed;inset:0 auto 0 0;width:min(280px,85vw);z-index:30;transform:translateX(-100%);transition:transform .22s var(--ease);height:100dvh;box-shadow:none}
  .navopen nav{transform:none;box-shadow:0 0 40px rgba(0,0,0,.25)}
  .navopen .scrim{display:block;position:fixed;inset:0;z-index:25;background:var(--overlay)}
  main{padding:20px 16px 120px}
  h1{font-size:24px}
  .pagehead{align-items:flex-start}
  .pagehead #actions{width:100%}
  .pagehead #actions>*{flex:1}
  .two,.two.even{grid-template-columns:1fr}
  .savebar{left:0;padding:12px 16px}
  .savebar .err{display:none}
  .savebar>*:not(.grow,.err){flex:1}
}
@media (max-width:640px){
  .fgrid{grid-template-columns:1fr}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .card{padding:14px}
  .card .v{font-size:20px}
  .panel{padding:14px}
  .fsection{padding:16px}
  /* tabulky jako karty */
  .rtable thead{display:none}
  .rtable,.rtable tbody,.rtable tr,.rtable td{display:block;width:100%}
  .rtable tr{border:1px solid var(--border);border-radius:var(--radius-sm);margin-bottom:8px;padding:6px 0}
  .rtable td{display:flex;justify-content:space-between;gap:12px;border:0;padding:6px 12px;white-space:normal;text-align:right}
  .rtable td::before{content:attr(data-label);color:var(--muted);font-size:12px;text-align:left;flex:none}
  .rtable td>.cv{min-width:0;overflow-wrap:anywhere}
  .rtable td.primary{font-size:15px;padding-top:8px;text-align:left}
  .rtable td.primary::before{display:none}
  .rtable td[data-label=""]::before{display:none}
  .rtable td:empty,.rtable td[data-label=""]:empty{display:none}
  .tablewrap{overflow:visible;margin:0;padding:0}
  dialog.drawer{border-radius:0;width:100vw;border:0}
  .grant-row{flex-wrap:wrap}
  .grant-row>span{flex-basis:100%}
  .timeline li{grid-template-columns:1fr}
  .timeline .mono{grid-column:1}
}
