/* Dílna — komponenty: tlačítka, pole, čipy, avatary, modál, toast, popover, kalendář, našeptávač, drop zóna, skeleton, prázdný stav. */

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r);
  font-weight: 550; font-size: 13.5px; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  -webkit-tap-highlight-color: transparent; user-select: none; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.pri { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.pri:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.lg { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn.icon { padding: 0; width: 36px; }
.btn.icon.sm { width: 30px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r); border: 0; background: transparent; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast); position: relative; flex: none; -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--accent); }

/* ---------- pole ---------- */
.inp, .sel, textarea.inp {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast); font-size: 14px;
}
.inp:hover { border-color: var(--border-strong); }
.inp:focus, .sel:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
textarea.inp { resize: vertical; min-height: 90px; line-height: 1.55; }
.inp::placeholder { color: var(--muted); opacity: .85; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid .full { grid-column: 1 / -1; }
.inp-icon { position: relative; }
.inp-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.inp-icon > .inp { padding-left: 36px; }
.inp-suffix { display: flex; align-items: stretch; }
.inp-suffix .inp { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.inp-suffix span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--surface-2); color: var(--muted); font-size: 13px; }

/* zaškrtávátko úkolu (kruh) */
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center;
  flex: none; cursor: pointer; transition: all var(--t-fast); padding: 0; color: transparent; position: relative;
}
.check::before { content: ""; position: absolute; inset: -11px; } /* dotykový cíl 44 px */
.check svg { width: 13px; height: 13px; }
.check:hover { border-color: var(--success); color: var(--success); }
.check.on { background: var(--success); border-color: var(--success); color: #fff; }
.check.sq { border-radius: 6px; width: 20px; height: 20px; }
.check[disabled] { cursor: default; opacity: .6; }

/* přepínač */
.switch { position: relative; width: 40px; height: 24px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background var(--t); cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform var(--t) var(--ease); }
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* segmentový přepínač */
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 0 12px; min-height: 30px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button svg { width: 16px; height: 16px; }
.seg .cnt { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface-3); padding: 0 6px; border-radius: 99px; }
.seg button.on .cnt { background: var(--primary-soft); color: var(--primary); }

/* ---------- čipy, štítky, odznaky ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 550; color: var(--text-2); white-space: nowrap; transition: all var(--t-fast); -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 45%, transparent); color: var(--primary); }
.chip svg { width: 15px; height: 15px; }
.chip .cnt { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.chip.on .cnt { color: var(--primary); }
.chip .x { margin-right: -4px; opacity: .7; }
.chip .dot, .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }

.label {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c, #64748b) 14%, transparent); color: color-mix(in srgb, var(--c, #64748b) 82%, var(--text));
}
:root[data-theme="dark"] .label { background: color-mix(in srgb, var(--c, #64748b) 26%, transparent); color: color-mix(in srgb, var(--c, #64748b) 55%, #fff); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.pri { background: var(--primary-soft); color: var(--primary); }

/* termín */
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 550; color: var(--muted); white-space: nowrap; }
.due svg { width: 14px; height: 14px; }
.due.over { color: var(--danger); }
.due.today { color: var(--warning); }
.due.soon { color: var(--text-2); }
.due.wait { color: var(--muted); font-style: italic; }
/* #61: due date in a list row is a button (quick change); an empty one shows just a calendar on hover */
.due-btn { display: inline-flex; align-items: center; background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; }
.due-btn:hover, .due-btn:focus-visible { background: var(--primary-soft); }
.due-btn.empty svg { width: 14px; height: 14px; }
@media (hover: hover) { .due-btn.empty { opacity: 0; } .trow:hover .due-btn.empty, .due-btn.empty:focus-visible { opacity: 1; } }

/* priorita */
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.prio svg { width: 15px; height: 15px; }
.prio.urgent { color: var(--danger); } .prio.high { color: var(--warning); } .prio.normal { color: var(--muted); } .prio.low { color: var(--muted); opacity: .75; }

/* avatar */
.av {
  --s: 28px; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--c, #64748b); color: #fff; font-size: calc(var(--s) * .38); font-weight: 700; letter-spacing: .02em; user-select: none;
  box-shadow: 0 0 0 2px var(--surface);
}
.av.sm { --s: 22px; } .av.lg { --s: 40px; } .av.xl { --s: 56px; }
.av.none { background: var(--surface-2); color: var(--muted); border: 1.5px dashed var(--border-strong); box-shadow: none; }
.av.none svg { width: 55%; height: 55%; }
.avs { display: inline-flex; }
.avs .av + .av { margin-left: -5px; }
.avs .more { background: var(--surface-3); color: var(--text-2); }

/* průběh */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width var(--t) var(--ease); }
.progress.over > i { background: var(--danger); }
.progress.warn > i { background: var(--warning); }

/* karta */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card.pad { padding: var(--sp-4); }
.card-h { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }

/* záložky */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 42px; font-weight: 550; font-size: 13.5px; color: var(--muted);
  border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important;
}
.tabs a svg, .tabs button svg { width: 17px; height: 17px; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .cnt { font-size: 11.5px; background: var(--surface-2); padding: 0 6px; border-radius: 99px; color: var(--muted); }

/* ---------- modál ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: grid; place-items: center; padding: 0;
  animation: fadeIn var(--t) var(--ease);
}
.modal {
  width: 80vw; height: 80vh; max-width: 1400px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; animation: popIn var(--t) var(--ease); border: 1px solid var(--border);
}
.modal.auto { height: auto; max-height: 80vh; }
.modal.dialog { width: min(460px, calc(100vw - 32px)); height: auto; max-height: 80vh; border-radius: var(--r-lg); }
.modal-h { display: flex; align-items: center; gap: var(--sp-2); padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--border); flex: none; min-height: 60px; }
.modal-h h2 { font-size: 17px; flex: 1; min-width: 0; }
.modal-b { flex: 1; overflow: auto; padding: 20px 22px; overscroll-behavior: contain; }
.modal-f { display: flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); flex: none; background: var(--surface); flex-wrap: wrap; }
.modal.dialog .modal-b { padding: 18px 22px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes slideUp { from { transform: translateY(100%); } }
body.no-scroll { overflow: hidden; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; min-height: 46px; border-radius: var(--r);
  background: #1d2529; color: #f2f6f7; box-shadow: var(--shadow-lg); font-weight: 500; animation: toastIn var(--t) var(--ease); max-width: 100%;
}
:root[data-theme="dark"] .toast { background: #e8eef0; color: #13191c; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.err svg { color: #f87171; } .toast.ok svg { color: #4ade80; }
:root[data-theme="dark"] .toast.err svg { color: var(--danger); } :root[data-theme="dark"] .toast.ok svg { color: #15803d; }
.toast .t-msg { flex: 1; min-width: 0; }
.toast button { border: 0; background: rgba(255, 255, 255, .12); color: inherit; font-weight: 650; padding: 0 12px; min-height: 32px; border-radius: 7px; }
:root[data-theme="dark"] .toast button { background: rgba(0, 0, 0, .08); }
.toast button:hover { background: rgba(255, 255, 255, .22); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all var(--t) var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- popover a menu ---------- */
.pop {
  position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  min-width: 220px; max-width: min(380px, calc(100vw - 16px)); max-height: min(440px, calc(100vh - 24px)); overflow: auto; animation: fadeIn var(--t-fast);
  overscroll-behavior: contain;
}
.pop-h { padding: 10px 12px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pop-search { padding: 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.pop-search .inp { min-height: 36px; }
.menu { padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; background: none; border-radius: 8px;
  text-align: left; font-size: 13.5px; color: var(--text); text-decoration: none !important;
}
.menu-item:hover, .menu-item.act { background: var(--surface-2); }
.menu-item svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-item .sub { margin-left: auto; color: var(--muted); font-size: 12px; }
.menu-item .tick { margin-left: auto; color: var(--primary); }
.menu-item.on { font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.sheet-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 199; animation: fadeIn var(--t); }
.pop.sheet {
  left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; width: 100%; max-height: 80vh; border-radius: var(--r-xl) var(--r-xl) 0 0;
  animation: slideUp var(--t) var(--ease); padding-bottom: env(safe-area-inset-bottom);
}
.pop.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 8px auto 2px; }
.pop.sheet .menu-item { min-height: 48px; font-size: 15px; }

/* ---------- našeptávač ---------- */
.suggest { position: relative; }
.suggest-list { padding: 6px; }
.sg-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.sg-item.act { background: var(--primary-soft); }
.sg-item .sg-main { flex: 1; min-width: 0; }
.sg-item .sg-sub { font-size: 12px; color: var(--muted); }
.sg-item > .tick { flex: none; margin-left: auto; color: var(--primary); }
.sg-item.on .sg-main { font-weight: 600; } /* chosen rows in a multi-select picker read as chosen at a glance */
.sg-item > .tick svg { width: 17px; height: 17px; } /* bez rozměru se svg (max-width: 100 %) smrštilo na 0 px a fajfka u vybraného nebyla vidět */
.sg-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sg-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- výběr data ---------- */
.dp { padding: 12px; width: 300px; max-width: 100%; }
.dp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dp-quick .chip { min-height: 30px; font-size: 12.5px; padding: 0 10px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-head b { font-size: 14px; text-transform: capitalize; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-grid .dow { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; padding: 4px 0; }
.dp-grid button { aspect-ratio: 1; border: 0; background: none; border-radius: 8px; font-size: 13px; min-height: 36px; color: var(--text); position: relative; }
.dp-grid button:hover { background: var(--surface-2); }
.dp-grid button.out { color: var(--muted); opacity: .55; }
.dp-grid button.today { font-weight: 700; color: var(--primary); }
.dp-grid button.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary); }
.dp-grid button.in { background: var(--primary-soft); border-radius: 0; }
.dp-grid button.sel { background: var(--primary); color: var(--primary-text); border-radius: 8px; }
.dp-grid button.we { color: var(--muted); }
.dp-mode { margin-bottom: 10px; }
.dp-foot { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.dp-foot .inp { min-height: 34px; font-size: 13px; }
.date-btn { justify-content: flex-start; }

/* ---------- drop zóna ---------- */
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 18px; text-align: center; color: var(--muted); cursor: pointer;
  transition: all var(--t-fast); background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.drop svg { width: 26px; height: 26px; color: var(--primary); }
.drop b { color: var(--text); font-weight: 600; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); color: var(--text-2); }
.drop.compact { padding: 10px; flex-direction: row; justify-content: center; font-size: 13px; }
.drop.compact svg { width: 18px; height: 18px; }
.upl { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.upl-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.upl-item .progress { flex: 1; }

/* soubory */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; position: relative; min-width: 0; }
.file .thumb { aspect-ratio: 16 / 10; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; cursor: pointer; border: 0; padding: 0; width: 100%; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb svg { width: 30px; height: 30px; }
.file .meta { padding: 7px 9px; min-width: 0; }
.file .meta .ellipsis { font-size: 12.5px; font-weight: 550; }
.file .acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast); }
.file:hover .acts, .file:focus-within .acts { opacity: 1; }
.file .acts .icon-btn { background: var(--surface); box-shadow: var(--shadow-sm); width: 32px; height: 32px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; background: var(--surface); color: var(--text); }
.file-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }
.file-chip svg { width: 16px; height: 16px; color: var(--muted); }

/* náhled obrázku */
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(5, 8, 10, .9); display: grid; place-items: center; animation: fadeIn var(--t); }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: var(--r); box-shadow: var(--shadow-lg); background: #fff; }
.lightbox .lb-bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; color: #fff; }
.lightbox .lb-bar .icon-btn { color: #fff; }
.lightbox .lb-bar .icon-btn:hover { background: rgba(255, 255, 255, .14); }

/* ---------- skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-hi) 37%, var(--skeleton) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sk-circle { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.sk-card { height: 168px; border-radius: var(--r-lg); }

/* ---------- prázdný stav ---------- */
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty .em-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 6px; }
.empty .em-ic svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 420px; margin: 0 0 6px; }
.empty.sm { padding: 20px 12px; }
.empty.sm .em-ic { width: 40px; height: 40px; border-radius: 12px; }
.empty.sm .em-ic svg { width: 20px; height: 20px; }
.error-box { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); color: var(--text); padding: 16px; border-radius: var(--r-lg); display: flex; gap: 12px; align-items: flex-start; }
.error-box svg { width: 22px; height: 22px; color: var(--danger); flex: none; }

/* markdown */
.md { line-height: 1.6; word-wrap: break-word; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; } .md h1 { font-size: 19px; } .md h2 { font-size: 16.5px; } .md h3 { font-size: 15px; }
.md ul, .md ol { padding-left: 22px; margin: 6px 0 10px; }
.md li.task { list-style: none; margin-left: -20px; display: flex; gap: 6px; align-items: baseline; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--primary); color: var(--text-2); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.md pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--r); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 8px 0; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md .mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); padding: 0 4px; border-radius: 5px; }

/* tooltip přes title stačí; vlastní nápověda */
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; cursor: help; }

/* drag & drop (SortableJS) */
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow); }
.sortable-drag { box-shadow: var(--shadow-lg) !important; transform: rotate(1deg); }
.drag-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 22px; height: 30px; flex: none; opacity: 0; transition: opacity var(--t-fast); touch-action: none; }
.drag-handle svg { width: 16px; height: 16px; }
*:hover > .drag-handle, .drag-handle:focus-visible { opacity: 1; }
.no-drag .drag-handle { display: none; }

@media (max-width: 640px) {
  .overlay { place-items: stretch; }
  .modal { width: 100vw; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .modal.auto { height: 100%; max-height: none; }
  .modal.dialog { width: calc(100vw - 24px); height: auto; border-radius: var(--r-lg); align-self: center; justify-self: center; }
  .modal-h { padding: 10px 10px 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .modal-b { padding: 16px; }
  .modal-f { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; min-height: 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .inp, .sel, textarea.inp { font-size: 16px; min-height: 44px; } /* bez zoomu na iOS */
  .btn { min-height: 40px; }
  .chip { min-height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm { width: 36px; height: 36px; }
  .toasts { bottom: calc(var(--bottomnav-h) + 12px + env(safe-area-inset-bottom)); }
  .drag-handle { display: none; }
  .file .acts { opacity: 1; }
}
