﻿/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-lg); border: 1px solid transparent;
  font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn svg { font-size: 16px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--on-primary); }
:root[data-theme="light"] .btn-primary:hover:not(:disabled) { color: #fff; }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-danger { background: transparent; border-color: var(--danger-bg); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger-bg); color: #fff; }
:root[data-theme="light"] .btn-danger-solid { background: #b91c1c; }
.btn-warn { background: var(--warn); color: #3a0b00; }
.btn-lg { padding: 10px 16px; font-size: 14px; }
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* ---------- štítky ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--r);
  font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.b-open { background: var(--st-open-bg); color: var(--st-open-fg); }
.b-done { background: var(--st-done-bg); color: var(--st-done-fg); }
.b-closed { background: var(--st-closed-bg); color: var(--st-closed-fg); }
.b-destroyed { background: var(--st-destroyed-bg); color: var(--st-destroyed-fg); }
.b-warn { background: var(--warn-bg); color: var(--warn-fg); }
.b-danger { background: var(--danger-bg); color: #fff; }
:root[data-theme="light"] .b-danger { background: #b91c1c; }
.b-ok { background: var(--st-done-bg); color: var(--st-done-fg); }
.b-info { background: var(--st-open-bg); color: var(--st-open-fg); }
.b-primary { background: var(--primary); color: var(--on-primary); }
.b-primary::before { display: none; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600; }
.chip.regime { font-variant-numeric: tabular-nums; background: var(--surface-3); color: var(--text); }
.regime-A { background: rgba(20, 184, 166, 0.18); color: var(--link); }
.regime-S { background: var(--surface-3); color: var(--text); }
.regime-V { background: #5a2a1c; color: #ffb59e; }
:root[data-theme="light"] .regime-A { color: #0f766e; }
:root[data-theme="light"] .regime-V { background: #ffedd5; color: #9a3412; }

/* ---------- karty ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.card-pad { padding: var(--sp-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); flex-wrap: wrap; padding: var(--sp-lg); background: var(--surface-2); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: var(--sp-sm); font-size: 16px; line-height: 24px; font-weight: 600; }
.card-head h2 svg, .card-head h3 svg { color: var(--link); font-size: 20px; }
.kpi { padding: var(--sp-lg); display: flex; justify-content: space-between; align-items: center; gap: var(--sp-md); }
.kpi:hover { background: var(--surface-2); }
.kpi .lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; }
.kpi .val { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 13px; }
.ring { width: 56px; height: 56px; transform: rotate(-90deg); flex: none; }
.tile { background: var(--bg); border-radius: var(--r-lg); padding: var(--sp-md); min-width: 0; }
.tile .k { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 4px; }
.tile .v { font-size: 14px; word-break: break-word; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-sm); }

/* ---------- tabulky ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; text-align: left; }
.tbl th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--text-2);
  font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 10px var(--sp-md); white-space: nowrap; z-index: 1;
}
.tbl th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-transform: inherit; letter-spacing: inherit; }
.tbl th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tbl td { padding: 10px var(--sp-md); border-top: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.sel { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .id { color: var(--link); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .w-chk { width: 36px; }
.tbl-empty { padding: 36px var(--sp-lg); text-align: center; color: var(--text-2); }
.tbl-empty svg { font-size: 28px; opacity: 0.6; display: block; margin: 0 auto 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-md); padding: var(--sp-md) var(--sp-lg); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.pager .pg { display: flex; gap: 4px; }
.pager button { background: var(--surface-2); border: 0; padding: 4px 10px; border-radius: var(--r); font-size: 12px; font-weight: 500; }
.pager button[aria-current="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- formuláře ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .req { color: var(--warn-fg); }
.field .help { font-size: 12px; color: var(--text-2); }
.field .err { font-size: 12px; color: var(--danger); display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r); padding: 8px 12px; font-size: 14px; line-height: 20px; min-width: 0;
}
.textarea { resize: vertical; min-height: 84px; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.55; cursor: not-allowed; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-2); font-size: 16px; pointer-events: none; }
.input-icon > .input { padding-left: 34px; }
.input-icon > .icon-btn-in { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-md); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.seg { display: inline-flex; background: var(--bg); padding: 2px; border-radius: var(--r-lg); gap: 2px; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; padding: 4px 10px; border-radius: var(--r); font-size: 12px; font-weight: 500; color: var(--text-2); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-md); align-items: flex-end; padding: var(--sp-lg); }
.filters .field { flex: 1 1 180px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-sm); }
.radio-card { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-lg); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-card svg { font-size: 20px; color: var(--link); }
.radio-card .t { font-weight: 600; }
.radio-card .d { font-size: 12px; color: var(--text-2); }
.radio-card input { margin-left: auto; }

/* ---------- záložky ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 4px 4px 0; }
.tabs button { background: transparent; border: 0; padding: 8px 12px; font-size: 12px; font-weight: 500; color: var(--text-2); border-radius: var(--r) var(--r) 0 0; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--link); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
.tabs .count { background: var(--warn); color: #3a0b00; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.tab-panel { padding: var(--sp-lg); }

/* ---------- upozornění ---------- */
.banner { display: flex; gap: var(--sp-md); align-items: flex-start; padding: var(--sp-md) var(--sp-lg); border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.banner > svg { font-size: 18px; margin-top: 1px; }
.banner .t { font-weight: 600; }
.banner.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn-fg); }
.banner.danger { background: var(--danger-soft); border-color: var(--danger-bg); color: var(--danger); }
.banner.info { background: color-mix(in srgb, var(--info) 12%, var(--surface)); border-color: transparent; color: var(--text); }
.banner.info > svg { color: var(--info); }
.banner .grow { flex: 1; min-width: 0; }
.banner .sub { color: var(--text); font-weight: 400; opacity: 0.85; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--warn-fg); padding: 8px 12px; background: var(--bg); border-radius: var(--r-lg); border: 1px solid var(--border); }
.note svg { margin-top: 2px; }

/* ---------- dialog ---------- */
dialog.modal {
  padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); color: var(--text);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-overlay);
}
dialog.modal.wide { width: min(960px, calc(100vw - 32px)); }
dialog.modal.narrow { width: min(460px, calc(100vw - 32px)); }
dialog.modal.detail { width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.modal.detail .modal-body { padding: 0; gap: 0; background: var(--surface); }
.detail-pad { padding: var(--sp-lg); }
dialog.modal::backdrop { background: var(--scrim); }
dialog.modal[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); padding: var(--sp-lg); border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; line-height: 24px; font-weight: 600; }
.modal-body { padding: var(--sp-lg); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-md); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-sm); padding: var(--sp-md) var(--sp-lg); border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- toast ---------- */
.toasts { position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit; z-index: 400; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-overlay); font-size: 13px; animation: toast-in 0.18s ease-out; }
.toast svg { font-size: 18px; margin-top: 1px; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--danger); }
.toast.warn svg { color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- paleta rychlého hledání ---------- */
dialog.palette { padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface-2); color: var(--text); width: min(620px, calc(100vw - 32px)); margin-top: 12vh; box-shadow: var(--shadow-overlay); }
dialog.palette::backdrop { background: var(--scrim); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; background: transparent; border: 0; outline: none; font-size: 15px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; list-style: none; margin: 0; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-lg); cursor: pointer; font-size: 13px; }
.palette-list li[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.palette-list li[aria-selected="true"] .muted { color: inherit; opacity: 0.8; }
.palette-list .grp { cursor: default; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; padding: 8px 10px 2px; }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); }

/* ---------- ostatní prvky ---------- */
.stepper { display: grid; grid-template-columns: repeat(9, minmax(96px, 1fr)); gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.step { background: var(--bg); border-radius: var(--r-lg); padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); min-width: 0; }
.step .n { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.step .t { color: var(--text); line-height: 16px; }
.step.done .n svg { color: var(--ok); }
.step.active { background: var(--primary); color: var(--on-primary); }
.step.active .t { color: var(--on-primary); font-weight: 600; }

.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.tree-item { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; border: 0; text-align: left; padding: 7px 10px; border-radius: var(--r-lg); font-size: 13px; color: var(--text); }
.tree-item:hover { background: var(--surface-2); }
.tree-item[aria-selected="true"] { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--primary); }
.tree-item .code { color: var(--link); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 42px; }
.tree-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.parent { font-weight: 500; }
.tree-item .caret { transition: transform 0.12s; color: var(--text-2); }
.tree-item[aria-expanded="false"] .caret { transform: rotate(-90deg); }
.tree-item.inactive { opacity: 0.6; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; border: 2px dashed var(--border); border-radius: var(--r-lg); background: var(--bg); cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--bg)); }
.dropzone svg { font-size: 36px; color: var(--link); }
.file-row { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md); background: var(--bg); border-radius: var(--r-lg); }
.file-row > svg { font-size: 22px; color: var(--link); }
.file-row .grow { flex: 1; min-width: 0; }

.list-card { display: flex; flex-direction: column; gap: var(--sp-sm); padding: var(--sp-md); }
.item-card { display: block; width: 100%; text-align: left; background: var(--bg); border: 0; border-radius: var(--r-lg); padding: var(--sp-md); color: inherit; }
.item-card:hover { background: var(--surface-2); text-decoration: none; }
.item-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.item-card .go { margin-top: 6px; display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.timeline li { display: grid; grid-template-columns: 138px 1fr; gap: var(--sp-md); padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline time { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

.avatar-sm { width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.person-card { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md); background: var(--surface-2); border-radius: var(--r-lg); }
.person-card .grow { flex: 1; min-width: 0; }
.typeahead { position: relative; }
.typeahead-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-overlay); max-height: 280px; overflow-y: auto; list-style: none; margin: 0; padding: 4px; }
.typeahead-list li { padding: 8px 10px; border-radius: var(--r); cursor: pointer; font-size: 13px; }
.typeahead-list li[aria-selected="true"], .typeahead-list li:hover { background: var(--surface-3); }

.cond { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.6fr) minmax(200px, 1.6fr) auto; gap: var(--sp-md); align-items: end; background: var(--bg); border-radius: var(--r-lg); padding: var(--sp-md); }
.cond-group { border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-sm); display: flex; flex-direction: column; gap: var(--sp-sm); }
.joiner { display: flex; align-items: center; gap: var(--sp-md); padding-left: 12px; font-size: 12px; color: var(--text-2); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.bars span { width: 8px; background: var(--primary); border-radius: 1px; opacity: 0.85; }

.donut { width: 96px; height: 96px; flex: none; }
.sparkline { width: 110px; height: 32px; color: var(--link); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px var(--sp-md); font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-word; }
.prog { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.prog > span { display: block; height: 100%; background: var(--primary); }
.empty { padding: 24px; text-align: center; color: var(--text-2); }
.hash { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); word-break: break-all; }

@media (max-width: 767px) {
  .cond { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; }
}

/* Upozornění na demonstrační verzi */
.demo-notice { margin-bottom: var(--sp-lg); align-items: center; flex-wrap: wrap; }
.demo-notice .sub { margin: 4px 0 0; line-height: 1.5; }
.demo-notice .t { font-size: 14px; }
.demo-notice-ok { flex: none; align-self: center; }
@media (max-width: 720px) { .demo-notice-ok { width: 100%; } }



/* Skartační řízení: stav Chyba, přechodové stavy */
.step.has-error { background: var(--danger); color: #fff; }
.step.has-error .t, .step.has-error .muted { color: #fff; }
.step .t .muted { font-size: 11px; font-weight: 400; }
.step.active .t .muted { color: var(--on-primary); opacity: .85; }



/* klíčová slova */
.kw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.kw-row .label-sm { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.chip.kw { gap: 4px; padding: 3px 4px 3px 10px; font-weight: 500; font-size: 12px; background: var(--surface-3); color: var(--text); }
.chip.kw:not(:has(button)) { padding-right: 10px; }
.chip.kw .kw-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.chip.kw .kw-x:hover { background: color-mix(in srgb, var(--danger, #c0392b) 20%, transparent); }
.chip.kw .kw-x svg { width: 12px; height: 12px; }
.kw-add { display: inline-flex; align-items: center; gap: 6px; }
.kw-input { width: 200px; min-height: 30px; padding-top: 3px; padding-bottom: 3px; }
