/* ====== GOODIE design system ====== */
/* Barvy GOODIE – stejné jako GOODIE Chat, Economiq a Good Karma Hub: tmavý
 * hnědočerný rám (hlavička a menu), teplá světlá plocha a žlutá jako jediná
 * výrazná barva. Na žluté je text vždy tmavý. Názvy --lime* zůstaly kvůli
 * stávajícím stylům – nesou teď žlutou značky. */
:root {
  --lime: #f5b400;
  --lime-600: #e6a800;
  --lime-50: #fdf1cc;
  --lime-100: #fbe39a;
  --brand-ink: #1f1a17;
  --brand-strong: #8a5a00;
  --ink: #1f1a17;
  --ink-2: #332a26;
  --ink-3: #4a403a;
  --muted: #6e645e;
  --muted-2: #9a8f88;
  --bg: #ffffff;
  --bg-1: #faf8f6;
  --bg-2: #f3efeb;
  --canvas: #f6f3f0;
  --line: #ebe5e0;
  --line-2: #e2dbd5;
  --line-3: #dad2cb;
  --link: #1264a3;
  --link-soft: #d9e9f7;
  --danger: #b73a26;
  --warn: #d19900;
  --info: #1264a3;
  --ok: #16835c;
  /* tmavý rám */
  --frame: #1f1a17;
  --chrome: #2d2521;
  --chrome-field: #3f3531;
  --chrome-hover: rgba(255,255,255,.08);
  --chrome-active: rgba(255,255,255,.14);
  --chrome-line: rgba(255,255,255,.1);
  --chrome-text: #f4efeb;
  --chrome-muted: #c7bcb5;
  --sheet-line: rgba(255,255,255,.72);
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(31,26,23,.04);
  --shadow-md: 0 4px 14px -4px rgba(31,26,23,.08), 0 2px 6px -2px rgba(31,26,23,.05);
  --shadow-lg: 0 18px 48px rgba(31,26,23,.26), 0 3px 10px rgba(31,26,23,.12);
  --t: 200ms cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--lime); color: var(--ink); }

/* ====== layout ====== */
#app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fdfdfd;
  display: flex; flex-direction: column;
  padding: 22px 14px;
}
.brand {
  padding: 8px 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand__logo {
  height: 28px; width: auto;
  filter: none;
}
.sidebar__close { display: none; }
.sidebar__backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13, 17, 23, .35);
  backdrop-filter: blur(2px);
  z-index: 49;
  animation: fadein 200ms ease;
}
.sidebar__backdrop.is-open { display: block; }
.nav { flex: 1; overflow-y: auto; padding-right: 4px; }
.nav__group { margin-bottom: 18px; }
.nav__label {
  text-transform: uppercase;
  font-size: 11px; letter-spacing: .08em;
  color: var(--muted-2);
  padding: 0 12px 8px;
  font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 2px;
  transition: background var(--t), color var(--t), transform var(--t);
  cursor: pointer;
  position: relative;
}
.nav__item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav__item:hover { background: var(--bg-2); color: var(--ink); }
.nav__item.is-active {
  background: var(--ink);
  color: #fff;
}
.nav__item.is-active svg { opacity: 1; }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 2px 2px 0;
  background: var(--lime);
}
.badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg-2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nav__item.is-active .badge { background: rgba(255,255,255,.12); color: #fff; }
.badge--new:not(:empty) { background: var(--lime); color: var(--ink); }
.badge--pulse:not(:empty) { animation: badgePulse 1.6s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,180,0,.6); }
  50% { box-shadow: 0 0 0 6px rgba(245,180,0,0); }
}

/* Unchecked-import marker on rows + cells */
.is-unchecked { background: rgba(225,29,72,.04); }
.is-unchecked td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.unchecked-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(225,29,72,.08); color: var(--danger);
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}

/* Order card collapsed/expanded chrome */
.order-card__head { gap: 12px; }
.order-card__head .icon-btn { color: var(--muted); }
.attachment__icon img { display: block; }
.sidebar__foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user__avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lime), var(--lime-600));
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.user__name { font-weight: 600; font-size: 13px; }
.user__role { font-size: 12px; color: var(--muted); }

/* ====== top bar ====== */
.main {
  min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(160%) blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar__menu { display: none; }
.search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  transition: border-color var(--t), background var(--t);
  max-width: 640px;
}
.search:focus-within { border-color: var(--ink); background: #fff; }
.search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search kbd, .cmdk__search kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--muted);
}
.topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  position: relative;
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--lime); box-shadow: 0 0 0 2px #fff;
}

/* ====== buttons ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-sm);
  font-weight: 600; font-size: 13px;
  transition: transform var(--t), box-shadow var(--t), background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--lime); color: var(--ink); }
.btn--primary:hover { background: var(--lime-600); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn--outline { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.btn--outline:hover { border-color: var(--ink); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn--danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn--danger:hover { background: #fee2e2; }
.btn--icon { padding: 0; width: 38px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ====== route container ====== */
.route { padding: 28px 28px 60px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head__title { display: flex; align-items: center; gap: 16px; }
.page-head h1 {
  margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 700;
}
.page-head__sub { color: var(--muted); margin-top: 4px; font-size: 14px; max-width: 720px; }
.page-head__count {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--lime-50); color: #8a5a00;
  font-weight: 700; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== toolbar ====== */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.toolbar__search {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.toolbar__search:focus-within { border-color: var(--ink); }
.toolbar__search svg { width: 14px; height: 14px; color: var(--muted); }
.toolbar__search input { border: 0; background: none; outline: none; flex: 1; }
.chip {
  height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: #fff;
  color: var(--ink-3);
  transition: all var(--t);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip__count { opacity: .6; font-variant-numeric: tabular-nums; }

/* ====== card / table ====== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card__head h3 { margin: 0; font-size: 15px; }
.card__body { padding: 18px; }

table.tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.tbl th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 12px 16px; background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
table.tbl td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tr.is-clickable:hover td { background: var(--bg-1); cursor: pointer; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .actions { text-align: right; white-space: nowrap; }
.tbl-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.tbl-empty h4 { margin: 0 0 8px; color: var(--ink); }

/* ====== tags / status ====== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-2); color: var(--ink-3);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag--lime { background: var(--lime-50); color: #8a5a00; border-color: #fbe39a; }
.tag--ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag--warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tag--danger { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.tag--blue { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.tag--phase { background: #111; color: var(--lime); border-color: #111; padding: 2px 7px; font-family: 'JetBrains Mono', monospace; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(225,29,72,.15); }

.stars { display: inline-flex; gap: 2px; color: #d4d4d4; }
.stars .on { color: #f59e0b; }
.stars svg { width: 14px; height: 14px; }

/* ====== thumb ====== */
.thumb {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--lime-50), #fff);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.thumb--lg { width: 60px; height: 60px; }
.thumb__init {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: 13px;
  color: var(--ink-3);
  letter-spacing: -.02em;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ====== form ====== */
.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 6px; }
.form__row--2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.form__row--3 { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form__label {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between;
}
.form__label .hint { font-weight: 500; color: var(--muted); font-size: 11px; }
.form__input, .form__select, .form__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #fff;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  font-size: 13px;
  color: var(--ink);
}
.form__input:focus, .form__select:focus, .form__textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(245,180,0,.18);
}
.form__textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}
.form__hint { font-size: 12px; color: var(--muted); }
.form__error { font-size: 12px; color: var(--danger); }

.tagger {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #fff;
  min-height: 42px;
}
.tagger input {
  flex: 1; min-width: 100px;
  border: 0; outline: none; padding: 4px;
  font-size: 13px; background: none;
}
.tagger .tag {
  cursor: default; padding-right: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.tagger .tag button {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: var(--muted);
}
.tagger .tag button:hover { color: var(--danger); background: #fff; }

.dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-1);
  transition: all var(--t);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--lime); background: var(--lime-50); color: var(--ink-3); }
.dropzone__icon { width: 28px; height: 28px; margin: 0 auto 8px; opacity: .6; }
.attachments { display: grid; gap: 6px; margin-top: 10px; }
.attachment {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 12px;
}
.attachment__icon { width: 28px; height: 28px; border-radius: 6px; background: var(--lime-50); display: grid; place-items: center; }
.attachment__name { flex: 1; font-weight: 500; }
.attachment__size { color: var(--muted); }
.attachment button { color: var(--muted); padding: 4px; }
.attachment button:hover { color: var(--danger); }

/* ====== modal ====== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 32px;
  animation: fadein 200ms ease;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(13,17,23,.45);
  backdrop-filter: blur(6px);
}
.modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop 240ms cubic-bezier(.22,1.2,.36,1);
}
.modal__panel--lg { width: min(960px, 100%); }
.modal__panel--xl { width: min(1200px, 100%); }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal__head h3 { margin: 0; font-size: 17px; }
.modal__body { padding: 22px; overflow-y: auto; flex: 1; }
.modal__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-1);
}
.modal__foot__left { display: flex; gap: 8px; }
.modal__foot__right { display: flex; gap: 8px; margin-left: auto; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ====== toast ====== */
.toasts {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 220px;
  animation: slidein 240ms cubic-bezier(.22,1.2,.36,1);
  pointer-events: auto;
}
.toast--ok { border-left: 3px solid var(--lime); }
.toast--err { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--info); }
.toast svg { width: 16px; height: 16px; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ====== command palette ====== */
.cmdk {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: start center;
  padding-top: 12vh;
}
.cmdk[hidden] { display: none; }
.cmdk__bd { position: absolute; inset: 0; background: rgba(13,17,23,.4); backdrop-filter: blur(6px); }
.cmdk__panel {
  position: relative;
  width: min(640px, 92%);
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 200ms cubic-bezier(.22,1.2,.36,1);
}
.cmdk__search {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cmdk__search svg { width: 18px; height: 18px; color: var(--muted); }
.cmdk__search input {
  flex: 1; border: 0; outline: none; font-size: 16px; background: none;
}
.cmdk__list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk__group { padding: 4px; }
.cmdk__group__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  padding: 8px 10px 4px;
}
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
}
.cmdk__item:hover, .cmdk__item.is-active { background: var(--bg-2); }
.cmdk__item .thumb { width: 30px; height: 30px; }
.cmdk__item__title { font-weight: 500; flex: 1; }
.cmdk__item__sub { color: var(--muted); font-size: 12px; }
.cmdk__empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ====== dashboard ====== */
.dash-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr);
}
.dash-grid--3 { grid-template-columns: repeat(3, 1fr); }
.dash-grid--2 { grid-template-columns: repeat(2, 1fr); }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 12px; color: var(--muted); }
.kpi__delta { font-size: 12px; font-weight: 600; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--danger); }
.kpi--lime { background: var(--lime); }
.kpi--lime .kpi__label { color: rgba(13,17,23,.6); }
.kpi--lime .kpi__value { color: var(--ink); }
.kpi--dark { background: var(--ink); color: #fff; }
.kpi--dark .kpi__label { color: rgba(255,255,255,.5); }
.kpi--dark .kpi__value { color: #fff; }

.spark {
  width: 100%; height: 36px; margin-top: 4px;
}
.spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ====== recipe ====== */
.recipe {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) { .recipe { grid-template-columns: 1fr; } }
.recipe-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.recipe-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.recipe-table td { padding: 6px 12px; border-bottom: 1px solid var(--line); }
.recipe-row { transition: background var(--t); }
.recipe-row:hover { background: var(--bg-1); }
.recipe-row .grip {
  cursor: grab; color: var(--muted-2); width: 16px;
  display: inline-grid; place-items: center;
}
.recipe-row.dragging { opacity: .35; }
.recipe-row.over { box-shadow: inset 0 2px 0 0 var(--lime); }
.recipe-phase td {
  background: #111;
  color: var(--lime);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 8px;
}
.recipe-phase td .grip { color: rgba(255,255,255,.4); }
.recipe-total td {
  background: var(--lime-50);
  font-weight: 700; color: #8a5a00;
  border-top: 2px solid var(--lime);
}
.recipe-total td.error { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }

.steps { padding-left: 22px; counter-reset: step; }
.steps li {
  list-style: none; position: relative;
  padding: 12px 14px 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: -14px; top: 14px;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
}
.steps li.is-checkpoint {
  background: #fff8e1; border-color: #fde68a;
}
.steps li.is-checkpoint::before {
  background: var(--warn);
}
.step-actions { display: flex; gap: 4px; }

/* ====== calendar ====== */
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.cal__head {
  background: var(--bg-1);
  padding: 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; color: var(--muted); text-align: center;
}
.cal__day {
  background: #fff;
  padding: 10px;
  min-height: 110px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: background var(--t);
}
.cal__day:hover { background: var(--bg-1); }
.cal__day--out { background: var(--bg-2); color: var(--muted); }
.cal__day--today .cal__date {
  background: var(--ink); color: #fff;
  width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.cal__date { font-size: 13px; font-weight: 600; }
.cal__event {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--lime-50);
  color: #8a5a00;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid var(--lime);
  cursor: pointer;
  transition: transform var(--t);
}
.cal__event:hover { transform: translateX(2px); }
.cal-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.cal-toolbar__title { font-size: 18px; font-weight: 700; min-width: 200px; }

/* ====== detail / right rail ====== */
.detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}
@media (max-width: 1000px) { .detail { grid-template-columns: 1fr; } }
.detail__rail {
  display: flex; flex-direction: column; gap: 16px;
}
.fact-list { display: grid; gap: 10px; font-size: 13px; }
.fact { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.fact__k { color: var(--muted); font-size: 12px; }
.fact__v { font-weight: 600; text-align: right; }
.fact__v.muted { color: var(--muted); font-weight: 400; }

.history { display: grid; gap: 6px; }
.history__row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  padding: 8px 0; font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.history__row:last-child { border: 0; }
.history__date { color: var(--muted); font-size: 12px; }
.history__price { font-weight: 700; font-variant-numeric: tabular-nums; }
.history__delta { font-size: 11px; font-weight: 600; }

/* ====== protocol print ====== */
.protocol {
  background: #fff;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.protocol__head {
  display: grid; grid-template-columns: 1fr auto;
  gap: 14px; padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 20px;
}
.protocol__head h2 { margin: 0; font-size: 22px; }
.protocol__meta {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px;
}
.protocol__meta dt { color: var(--muted); }
.protocol__meta dd { margin: 0; font-weight: 600; }
.protocol-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.protocol-table th, .protocol-table td {
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
.protocol-table th { background: var(--bg-1); font-weight: 600; }
.protocol-table .empty { height: 32px; }
.protocol h4 { margin: 22px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

@media print {
  body * { visibility: hidden; }
  .protocol, .protocol * { visibility: visible; }
  .protocol { position: absolute; left: 0; top: 0; width: 100%; border: 0; padding: 0; }
  @page { size: A4 landscape; margin: 12mm; }
  .no-print { display: none !important; }
}

/* ====== misc ====== */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert--warn { background: #fef3c7; color: #92400e; border-left: 3px solid var(--warn); }
.alert--info { background: #dbeafe; color: #1e3a8a; border-left: 3px solid var(--info); }
.alert--ok { background: var(--lime-50); color: #8a5a00; border-left: 3px solid var(--lime); }
.alert--danger { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--danger); }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.bold { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', monospace; }

.combobox { position: relative; }
.combobox__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 5;
  max-height: 240px; overflow-y: auto;
}
/* Portal variant: rendered into <body> with fixed positioning so it never
   gets clipped by overflow:hidden cards or scrolling modal bodies. */
.combobox__list--portal {
  position: fixed; left: 0; top: 0; right: auto;
  z-index: 250;
  overflow-y: auto;
}
.combobox__opt {
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13px;
  min-height: 38px;
}
.combobox__opt:hover, .combobox__opt.is-active { background: var(--bg-2); }
.combobox__opt--new { color: var(--info); font-weight: 600; }

/* ====== segmented control ====== */
.seg {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.seg__btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 6px;
  white-space: nowrap;
  transition: background var(--t), color var(--t);
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--ink); color: #fff; }

/* ====== prep / orders item rows ====== */
.prep-items td { vertical-align: middle; }
.prep-item--child td:first-child {
  position: relative;
  padding-left: 28px;
}
.prep-item--child td:first-child::before {
  content: "";
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  border-left: 2px dotted var(--line-3);
}
.prep-item--child td { background: var(--bg-1); }
.prep-item--converted td { opacity: .55; text-decoration: line-through; }
.prep-item--converted .tag { text-decoration: none; opacity: 1; }

/* ====== prep / orders log ====== */
.prep-log {
  display: grid; gap: 8px;
  font-size: 13px;
  max-height: 260px; overflow-y: auto;
}
.prep-log__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 8px 12px;
  background: var(--bg-1);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--lime);
}
.prep-log__date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.prep-log__text { color: var(--ink-3); }

/* ====== bulk-action bar ====== */
.bulk-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  display: flex; align-items: center; gap: 14px;
  font-size: 13px;
  animation: slidein 220ms cubic-bezier(.22,1.2,.36,1);
}
.bulk-bar select { color: var(--ink); height: 30px; padding: 0 10px; font-size: 12px; }
.bulk-bar .btn--ghost { color: rgba(255,255,255,.8); }
.bulk-bar .btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ====== order card ====== */
.order-card .card__head { cursor: pointer; transition: background var(--t); }
.order-card .card__head:hover { background: var(--bg-1); }

/* ====== responsive ====== */

/* Tablet — under 900px */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 50; width: 280px; max-width: 86vw;
    transform: translateX(-100%);
    transition: transform var(--t);
    overflow-y: auto;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }

  .topbar { padding: 12px 16px; gap: 10px; }
  .route { padding: 18px 16px 60px; }
  .search { max-width: none; }
  .search kbd { display: none; }

  .page-head { margin-bottom: 18px; gap: 12px; }
  .page-head h1 { font-size: 22px; }
  .toolbar { padding: 10px; gap: 8px; }

  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dash-grid--3 { grid-template-columns: 1fr; }
  .dash-grid--2 { grid-template-columns: 1fr; }

  .form__row--2, .form__row--3 { grid-template-columns: 1fr; }

  /* tables horizontally scroll inside their card so all columns stay readable */
  .card { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 640px; }

  /* modal goes near full-screen */
  .modal { padding: 0; }
  .modal__panel,
  .modal__panel--lg,
  .modal__panel--xl {
    width: 100%; max-width: 100%;
    height: 100vh; max-height: 100vh;
    border-radius: 0;
  }
  .modal__head { padding: 14px 16px; }
  .modal__head h3 { font-size: 15px; }
  .modal__body { padding: 16px; }
  .modal__foot { padding: 12px 16px; flex-wrap: wrap-reverse; gap: 8px; }
  .modal__foot__left, .modal__foot__right { width: 100%; gap: 8px; }
  .modal__foot__right { justify-content: flex-end; margin-left: 0; }
  .modal__foot__right .btn { flex: 1; min-width: 0; }

  /* command palette padding */
  .cmdk { padding-top: 6vh; }
  .cmdk__panel { width: 95%; }
}

/* Phone — under 640px */
@media (max-width: 640px) {
  .route { padding: 14px 12px 56px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar__right .btn { display: none; }
  .search { padding: 8px 12px; }
  .search input { font-size: 16px; /* prevents iOS zoom */ }

  .page-head { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
  .page-head__title h1 { font-size: 20px; }
  .page-head__sub { font-size: 13px; }
  .page-head__actions { gap: 6px; }
  .page-head__actions .btn { flex: 1; justify-content: center; }

  .toolbar { border-radius: var(--r-sm); padding: 8px; }
  .toolbar__search { flex-basis: 100%; min-width: 0; }
  .chip { font-size: 11px; padding: 0 10px; height: 28px; }

  .dash-grid { grid-template-columns: 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 22px; }

  /* forms */
  .form { gap: 12px; }
  .form__input, .form__select, .form__textarea { font-size: 16px; padding: 11px 12px; }
  .form__row--2, .form__row--3 { grid-template-columns: 1fr; gap: 10px; }

  /* details / recipe column stacking */
  .detail { grid-template-columns: 1fr; gap: 12px; }
  .recipe { grid-template-columns: 1fr; }

  /* cards */
  .card__head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card__head h3 { font-size: 14px; }
  .card__body { padding: 14px; }

  /* recipe table — stay readable */
  .recipe-table { font-size: 12px; }
  .recipe-table th, .recipe-table td { padding: 6px 8px; }
  /* horizontal scroll for recipe table on tiny screens */
  .card__body { overflow-x: auto; }

  /* tables tighter */
  table.tbl th, table.tbl td { padding: 10px 12px; font-size: 12px; }

  /* tap-friendly */
  .btn { height: 42px; padding: 0 16px; font-size: 13px; }
  .btn--sm { height: 32px; padding: 0 12px; }
  .icon-btn { width: 40px; height: 40px; }

  /* combobox dropdown clamp to viewport (overrides inline JS positioning) */
  .combobox__list--portal {
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
  }

  /* toasts span full width */
  .toasts { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; }

  /* bulk action bar */
  .bulk-bar {
    bottom: 12px; left: 12px; right: 12px; transform: none;
    border-radius: var(--r-md); flex-wrap: wrap; padding: 10px 14px;
  }

  /* calendar */
  .cal__day { min-height: 68px; padding: 6px 4px; gap: 3px; }
  .cal__date { font-size: 11px; }
  .cal__event { font-size: 10px; padding: 2px 4px; border-left-width: 2px; }
  .cal__head { padding: 8px 4px; font-size: 10px; }
  .cal-toolbar { flex-wrap: wrap; gap: 8px; }
  .cal-toolbar__title { min-width: 0; font-size: 16px; flex: 1; }

  /* protocol print */
  .protocol__head { grid-template-columns: 1fr; }
  .protocol { padding: 16px; }

  /* prep log compact */
  .prep-log__row { grid-template-columns: 1fr; gap: 4px; padding: 8px 10px; }

  /* history rows */
  .history__row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .history__delta { grid-column: 2; text-align: right; }

  /* attachment item layout */
  .attachment { padding: 10px; }
  .attachment__name { font-size: 13px; word-break: break-word; }

  /* segmented control — wrap */
  .seg { flex-wrap: wrap; }
  .seg__btn { padding: 8px 10px; }

  /* hide global ⌘K hint indicator on mobile */
  .search kbd { display: none; }
}

/* Very tiny phones */
@media (max-width: 380px) {
  .page-head h1 { font-size: 18px; }
  .kpi__value { font-size: 20px; }
  .route { padding: 12px 10px 50px; }
  .topbar { padding: 8px 10px; }
  .modal__foot { flex-direction: column-reverse; }
  .modal__foot__right .btn { width: 100%; }
}

/* ── Nápověda „i" s tooltipem (rozdíly mezi exporty) ─────────────────── */
.tip { position: relative; display: inline-flex; vertical-align: middle; }
.tip__ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line-3); background: var(--bg-1);
  color: var(--muted); font-size: 11px; font-weight: 700; font-style: normal;
  line-height: 1; cursor: help; user-select: none; transition: all var(--t);
  font-family: Georgia, 'Times New Roman', serif;
}
.tip:hover .tip__ico, .tip:focus-within .tip__ico {
  border-color: var(--line-3); background: #fff; color: var(--ink);
}
.tip__box {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  width: 360px; max-width: 78vw; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  font-size: 12px; line-height: 1.5; color: var(--ink-2); font-weight: 400;
  text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--t), transform var(--t), visibility var(--t);
  pointer-events: none;
}
.tip:hover .tip__box, .tip:focus-within .tip__box {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.tip__box b { color: var(--ink); font-weight: 600; }
.tip__box p { margin: 0 0 8px; }
.tip__box p:last-child { margin-bottom: 0; }
.tip__box .tip__foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }

/* ====== přihlášení, účty, log změn ====== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg-2); }
.auth[hidden] { display: none; }
.auth__card {
  width: min(420px, 100%); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 32px 28px;
}
.auth__logo { height: 26px; margin-bottom: 22px; }
.auth__card h1 { margin: 0 0 6px; font-size: 22px; }
.auth__card > p { margin: 0; }
.auth__card .form { margin-top: 18px; display: grid; gap: 14px; }
.auth__card .alert { margin-top: 14px; }
.auth__card code { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.auth__submit { width: 100%; justify-content: center; margin-top: 4px; }
.auth__foot { margin: 18px 0 0 !important; font-size: 12px; }

.user__text { min-width: 0; flex: 1; }
.user__name, .user__role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user__actions { display: flex; gap: 2px; margin-left: auto; }
.user__actions .icon-btn { width: 30px; height: 30px; }
.user__actions .icon-btn svg { width: 16px; height: 16px; }

.ro-banner { margin: 20px 28px -8px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.users-body { padding: 0; }
.users-table td { vertical-align: top; }
.users-access .tag { margin: 0 4px 4px 0; display: inline-block; }
.users-actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 6px 0 0 -8px; }
.users-table td:first-child { min-width: 220px; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.perm-table td { padding: 6px 10px; vertical-align: middle; }
.seg--sm .seg__btn { padding: 4px 10px; font-size: 12px; }
.invite-link { display: flex; gap: 8px; margin: 12px 0; }
.invite-link .form__input { flex: 1; min-width: 0; font-size: 12px; }
.audit-toolbar .form__input, .audit-toolbar .form__select { width: auto; min-width: 140px; }
.audit-table td { vertical-align: top; }
.audit-details { font-size: 12px; margin-top: 4px; color: var(--ink-3); display: grid; gap: 2px; }

/* Jen čtení: bez třídy w-<modul> na <body> (= bez práva zápisu) se tlačítka zápisu
 * schovají – i v modálech. Server zápis bez práva odmítne tak jako tak. */
body:not(.w-questions) :is([data-qkb], [data-qdel], #qClearBtn),
body:not(.w-reklamace) :is([data-cstatus], [data-cnote], [data-cdel]),
body:not(.w-exporty) :is([data-del-import], #importDrop),
body:not(.w-konverzace) :is([data-conv-del], #convSaveSettings),
body:not(.w-topics):not(.w-topics_other) [data-ctx-open],
body:not(.w-persona) :is(#savePersonaBtn, #resetPersonaBtn),
body:not(.w-vychova) :is(#addRuleBtn, [data-tpl], [data-toggle-rule], [data-edit-rule], [data-del-rule]),
body:not(.w-intents) :is(#addIntentBtn, #toggleIntentsBtn, [data-toggle-intent], [data-edit-intent], [data-del-intent]),
body:not(.w-knowledge) :is(#addTextBtn, [data-del-doc], #feedDeleteBtn, #docDrop, #feedDrop, #feedUrl, #feedUrlBtn),
body:not(.w-settings) #saveSettingsBtn,
#route[data-readonly="1"]:is([data-module="topics"], [data-module="topics_other"]) :is(#addTopicBtn, [data-toggle-topic], [data-edit-topic], [data-del-topic]) {
  display: none !important;
}
body:not(.w-persona) #route[data-module="persona"] :is(input, textarea, select, [data-tone]),
body:not(.w-settings) #route[data-module="settings"] :is(input, select, [data-pick-model], [data-cache], [data-ttl], [data-router]),
body:not(.w-konverzace) #route[data-module="konverzace"] :is([data-convlog], #convRetention),
body:not(.w-knowledge) #route[data-module="knowledge"] [data-doc-lang] {
  pointer-events: none; opacity: .7;
}

/* =====================================================================
 * Rám GOODIE (jako GOODIE Chat, Economiq, Good Karma Hub):
 * hlavička a menu tvoří jeden tmavý rám, obsah leží na zaobleném světlém
 * listu a roluje se jen uvnitř něj.
 * ===================================================================== */
body { background: var(--frame); }
#app {
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 58px minmax(0, 1fr);
  grid-template-areas: "head head" "side main";
  height: 100vh; min-height: 0;
  background: var(--frame);
}

/* hlavička */
.topbar.frame-head {
  grid-area: head;
  position: static;
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px 0 16px;
  background: transparent; border: 0; backdrop-filter: none;
  color: var(--chrome-text);
}
.frame-head .brand { display: flex; align-items: center; gap: 10px; padding: 0; width: 216px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--lime); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__name { font-weight: 800; font-size: 16px; letter-spacing: -.015em; color: var(--chrome-text); white-space: nowrap; }
.brand__sub { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lime); white-space: nowrap; }
.frame-head .search {
  max-width: 560px; margin: 0 auto;
  padding: 7px 14px; border-radius: 999px;
  background: var(--chrome-field); border: 1px solid transparent;
}
.frame-head .search svg,
.frame-head .search input::placeholder { color: var(--chrome-muted); }
.frame-head .search input { color: var(--chrome-text); }
.frame-head .search kbd { background: var(--chrome-hover); border-color: var(--chrome-line); color: var(--chrome-muted); }
.frame-head .search:focus-within { background: #fff; box-shadow: 0 0 0 3px rgba(245,180,0,.35); }
.frame-head .search:focus-within input { color: var(--ink); }
.frame-head .search:focus-within svg { color: var(--muted); }
.frame-head .topbar__right { margin-left: 0; }
.frame-head .topbar__menu { display: none; }   /* menu je vidět vždy, tlačítko jen na mobilu */
.frame-head .pill { background: var(--chrome-field); color: var(--chrome-text); border-color: transparent; }
.frame-head .btn--outline { background: transparent; color: var(--chrome-text); border-color: rgba(255,255,255,.22); }
.frame-head .btn--outline:hover { background: var(--chrome-hover); border-color: rgba(255,255,255,.4); }
.frame-head .icon-btn,
.sidebar .icon-btn { color: var(--chrome-muted); }
.frame-head .icon-btn:hover,
.sidebar .icon-btn:hover { background: var(--chrome-hover); color: var(--chrome-text); }

/* menu */
.sidebar {
  grid-area: side;
  position: static; height: auto; min-height: 0; align-self: stretch;
  background: transparent; border: 0;
  padding: 4px 10px 10px;
  color: var(--chrome-text);
}
.sidebar__top { display: none; }
.nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; padding-right: 0; }
.nav__group { margin-bottom: 14px; }
.nav__label { color: var(--chrome-muted); opacity: .7; font-size: 10.5px; padding: 0 10px 6px; }
.nav__item {
  color: var(--chrome-muted);
  padding: 7px 10px; gap: 10px;
  border-radius: 10px; font-size: 13.5px; margin-bottom: 1px;
}
.nav__item svg { width: 17px; height: 17px; }
.nav__item:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.nav__item.is-active { background: var(--lime); color: var(--brand-ink); font-weight: 600; }
.nav__item.is-active::before { display: none; }
.nav .badge { background: var(--chrome-active); color: var(--chrome-text); }
.nav__item.is-active .badge { background: rgba(31,26,23,.14); color: var(--brand-ink); }
.nav .badge--new:not(:empty) { background: var(--lime); color: var(--brand-ink); }
.nav__item.is-active .badge--new:not(:empty) { background: var(--brand-ink); color: var(--lime); }
.sidebar__foot { border-top: 1px solid var(--chrome-line); padding-top: 8px; }
.user__avatar { background: var(--lime); color: var(--brand-ink); }
.user__name { color: var(--chrome-text); }
.user__role { color: var(--chrome-muted); }

/* list s obsahem */
.main {
  grid-area: main;
  min-height: 0; overflow-y: auto;
  margin: 0 8px 8px 0;
  background: var(--canvas);
  border: 1px solid var(--sheet-line);
  border-radius: 22px;
  scrollbar-width: thin;
}
.route { padding: 26px 28px 60px; max-width: 1600px; margin: 0 auto; }
.ro-banner { max-width: 1544px; margin: 20px auto -6px; width: calc(100% - 56px); }

/* ---------- komponenty: pilulková tlačítka, karty s linkou místo stínu ---------- */
.btn { height: 34px; padding: 0 14px; border-radius: 999px; font-weight: 600; }
.btn--sm { height: 28px; padding: 0 11px; }
.btn--icon { width: 34px; padding: 0; }
.btn--primary { background: var(--lime); color: var(--brand-ink); }
.btn--primary:hover { background: var(--lime-600); transform: none; box-shadow: none; }
.btn--outline { background: #fff; border-color: var(--line-3); }
.btn--outline:hover { border-color: var(--muted-2); background: var(--bg-1); }
.btn--ghost:hover { background: var(--bg-2); }
.btn--danger { border-color: #f6c7bd; color: var(--danger); }
.btn--danger:hover { background: #fdf3f1; }
.card { border-radius: 16px; border: 1px solid var(--line); box-shadow: none; background: #fff; }
.card__head { border-bottom-color: var(--line); }
.toolbar { border-radius: 16px; background: #fff; }
.kpi { border-radius: 18px; box-shadow: none; }
.alert { border-radius: 12px; }
.form__input, .form__select, .form__textarea { border-radius: 10px; border-color: var(--line-3); background: #fff; }
.form__input:focus, .form__select:focus, .form__textarea:focus {
  border-color: var(--link); box-shadow: 0 0 0 3px var(--link-soft);
}
input[type=range], input[type=checkbox], input[type=radio] { accent-color: var(--lime-600); }
.seg { border-radius: 999px; }
.seg__btn { border-radius: 999px; }
.tag { border-radius: 999px; }
.modal__panel { border-radius: 20px; }
.page-head h1 { letter-spacing: -.02em; }

/* přihlášení na tmavém rámu */
.auth { background: var(--frame); }
.auth__card { border-color: transparent; box-shadow: var(--shadow-lg); border-radius: 22px; }

/* úzké okno: menu vyjíždí zleva, list sahá skoro ke krajům */
@media (max-width: 900px) {
  #app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
    grid-template-areas: "head" "main";
  }
  .topbar.frame-head { padding: 0 10px; gap: 8px; }
  .frame-head .topbar__menu { display: grid; }
  .frame-head .brand { width: auto; }
  .frame-head .brand__sub { display: none; }
  .frame-head .search { margin: 0; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
    background: var(--chrome); padding: 10px;
  }
  .sidebar__top { display: flex; justify-content: flex-end; padding: 0 0 6px; }
  .main { margin: 0 6px 6px; border-radius: 16px; }
  .route { padding: 18px 16px 60px; }
  .ro-banner { width: calc(100% - 32px); margin-top: 14px; }
}
@media (max-width: 640px) {
  .frame-head .brand__text { display: none; }
  .frame-head .pill,
  .frame-head #goToPlaygroundBtn { display: none !important; }   /* Playground je v menu */
  .frame-head .search { flex: 1; min-width: 0; }
}

/* ====== Vývoj: tlačítko vpravo nahoře, panel, kreslení do snímku (vyvoj.js, převzato z GOODIE Gap) ====== */
.vn-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--chrome-line); background: var(--chrome-field);
  color: var(--chrome-text); font-size: 12px; font-weight: 600; position: relative; transition: background var(--t);
}
.vn-btn:hover { background: var(--chrome-hover); }
.vn-btn.is-open { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.vn-btn__count {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--lime); color: var(--ink);
  font-size: 10.5px; line-height: 17px; text-align: center;
}
.vn-btn.is-open .vn-btn__count { background: var(--ink); color: #fff; }

.vn-pop {
  position: fixed; z-index: 120; width: 27rem; max-width: calc(100vw - 16px);
  max-height: calc(100vh - 70px); overflow-y: auto;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(31,26,23,.2);
}
.vn-pop[hidden] { display: none; }
.vn-pop.is-drop { outline: 2px dashed var(--lime); outline-offset: -6px; }
.vn-pop__head { display: flex; align-items: center; gap: 6px; padding: 12px 14px 0; font-size: 14px; }
.vn-x { width: 28px; height: 28px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); }
.vn-x:hover { background: var(--bg-2); color: var(--ink); }
.vn-pop__body { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.vn-label { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 2px; }
.vn-text { resize: vertical; min-height: 88px; }
.vn-muted { color: var(--muted); font-size: 12px; }
.vn-trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vn-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 62px; padding: 8px 6px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff;
  font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.2;
}
.vn-tile:hover { background: var(--bg-1); border-color: var(--line-3); }
.vn-tile--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.vn-tile--dark:hover { background: var(--ink-2); border-color: var(--ink-2); }
.vn-att { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-1); }
.vn-att__img { flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.vn-att__img img { width: 92px; height: 60px; object-fit: cover; object-position: top left; }
.vn-att__img:hover { outline: 2px solid var(--lime); }
.vn-att__meta { flex: 1; min-width: 0; }
.vn-att__actions { display: flex; flex-direction: column; gap: 4px; }
.vn-ok { color: var(--ok); font-weight: 600; font-size: 12px; }
.vn-btn-dark { background: var(--ink); color: #fff; }
.vn-btn-dark:hover { background: var(--ink-2); }
.vn-btn-dark svg { width: 14px; height: 14px; }
.vn-check { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.vn-check span:first-of-type { flex-shrink: 0; }
.vn-send { width: 100%; justify-content: center; }
.vn-send:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.vn-hint { font-size: 11px; color: var(--muted-2); text-align: center; margin-top: -2px; }
.vn-list { border-top: 1px solid var(--line); background: var(--bg-1); border-radius: 0 0 var(--r-md) var(--r-md); }
.vn-list summary { display: flex; align-items: center; gap: 6px; padding: 9px 14px; cursor: pointer; font-size: 12px; font-weight: 600; list-style: none; }
.vn-list summary::-webkit-details-marker { display: none; }
.vn-list summary::before { content: '▸'; color: var(--muted); }
.vn-list[open] summary::before { content: '▾'; }
.vn-pill { background: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.vn-list__items { max-height: 240px; overflow-y: auto; padding: 0 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.vn-note { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.vn-note.is-done { background: #eefaf4; }
.vn-note p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vn-note__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 11px; color: var(--muted); }
.vn-note__meta b { color: var(--ink-3); }
.vn-done { background: #eefaf4; color: #16835c; border-radius: 999px; padding: 0 6px; }
.vn-note__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; font-size: 11.5px; }
.vn-link { color: var(--link); font-size: 11.5px; font-weight: 500; }
.vn-link:hover { text-decoration: underline; }

/* okno Všechny záznamy */
.vn-filter { display: flex; gap: 6px; margin-bottom: 12px; }
.vn-all { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vn-all__row { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.vn-all__row.is-done { opacity: .72; }
.vn-all__thumb { flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.vn-all__thumb img { width: 144px; height: 90px; object-fit: cover; object-position: top left; }
.vn-all__thumb:hover { outline: 2px solid var(--lime); }
.vn-all__main { flex: 1; min-width: 0; }
.vn-all__main p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.vn-all__actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.vn-danger { color: var(--danger); }
.vn-big { background: var(--bg-2); border-radius: 12px; overflow: auto; max-height: 72vh; }
.vn-big img { max-width: 100%; margin: 0 auto; }
.vn-big__text { white-space: pre-wrap; margin: 12px 0 4px; }

/* editor kresby — přes celé okno, nad modály */
.vn-ed { position: fixed; inset: 0; z-index: 190; display: flex; flex-direction: column; background: rgba(29,25,23,.94); }
.vn-ed__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--frame); border-bottom: 1px solid var(--chrome-line); color: var(--chrome-text);
}
.vn-ed__group { display: flex; align-items: center; gap: 3px; padding: 3px; border-radius: 12px; background: var(--chrome-field); }
.vn-ed__tool, .vn-ed__w { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--chrome-text); }
.vn-ed__tool:hover:not(:disabled), .vn-ed__w:hover { background: var(--chrome-hover); }
.vn-ed__tool.is-active, .vn-ed__w.is-active { background: var(--lime); color: var(--ink); }
.vn-ed__tool:disabled { opacity: .35; cursor: default; }
.vn-ed__w i { display: block; width: var(--s); height: var(--s); border-radius: 50%; background: currentColor; }
.vn-ed__color { width: 26px; height: 26px; margin: 4px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.vn-ed__color.is-active { box-shadow: 0 0 0 2px var(--frame), 0 0 0 4px var(--lime); }
.vn-ed__end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.vn-ed__hint { font-size: 12px; color: var(--chrome-muted); }
.vn-ed__cancel { color: var(--chrome-text); }
.vn-ed__cancel:hover { background: var(--chrome-hover); color: #fff; }
.vn-ed__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
.vn-ed__wrap { position: relative; line-height: 0; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.vn-ed__wrap canvas { display: block; touch-action: none; background: #fff; }
.vn-ed__text {
  position: absolute; min-width: 120px; padding: 0 2px; margin: 0; border: 1px dashed rgba(255,255,255,.8);
  background: rgba(0,0,0,.25); outline: none; resize: none; overflow: hidden; font-weight: 600; line-height: 1.2;
  font-family: Inter, -apple-system, sans-serif; white-space: pre;
}
@media (max-width: 720px) {
  .vn-btn span:not(.vn-btn__count) { display: none; }
  .vn-ed__hint { display: none; }
  .vn-all__row { flex-wrap: wrap; }
}
.vn-info {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-2); color: var(--muted); font-size: 10px; font-weight: 700; font-style: normal; cursor: help;
}
.vn-link { background: none; border: 0; padding: 0; cursor: pointer; }
.frame-head .vn-btn { flex-shrink: 0; }

/* ====== Testovací chat (beta): přepínač Ostrá | Beta, červená testovací administrace ====== */
.chan { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--chrome-field); flex-shrink: 0; }
.chan__opt { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--chrome-muted); white-space: nowrap; }
.chan__opt:hover { color: var(--chrome-text); background: var(--chrome-hover); }
.chan__opt--live.is-on { background: #f5b400; color: #1f1a17; }
.chan__opt--beta.is-on { background: #e11d48; color: #fff; }
.chan__opt.is-on { cursor: default; }

/* Celá testovací administrace je červená, ať je na první pohled jasné, kde jsi. */
body.is-beta {
  --lime: #f43f5e;
  --lime-600: #e11d48;
  --lime-50: #ffe4e6;
  --lime-100: #fecdd3;
  --brand-strong: #9f1239;
  --frame: #4a0d1a;
  --chrome: #5c1121;
  --chrome-field: #751731;
  --canvas: #fff6f7;
  --sheet-line: rgba(255,228,230,.8);
}
body.is-beta .brand__sub { color: #fecdd3; }
body.is-beta .alert--ok { color: #9f1239; }

.tag--beta { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.beta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.beta-grid .card { min-width: 0; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-row .btn svg, .page-head__actions .btn svg { width: 14px; height: 14px; }
.inline-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.beta-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) auto; gap: 8px; margin-bottom: 14px; }
.beta-pull { display: grid; gap: 8px; margin: 12px 0 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.beta-howto ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }

/* Návod v hlavičce (jak spustit betu) */
.frame-head .guide-btn { flex-shrink: 0; }
.modal__panel--guide { width: min(640px, 100%); }
.guide { display: grid; gap: 18px; }
.guide-sec__h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.guide-key { margin: 0 0 6px; }
.guide-key .form__input { font-size: 15px; letter-spacing: .04em; }
.guide-status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.guide-steps, .guide-tips { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }
.guide-tips { gap: 4px; font-size: 12.5px; }
@media (max-width: 900px) {
  .beta-grid, .beta-add { grid-template-columns: minmax(0, 1fr); }
  .chan__opt { padding: 4px 9px; }
}
@media (max-width: 640px) {
  .frame-head .guide-btn { display: inline-flex; padding: 0 9px; }   /* ostatní tlačítka hlavičky se na mobilu schovají */
  .guide-btn__label { display: none; }
  .frame-head .search input { min-width: 0; width: 100%; }   /* úzké hledání nepřeteče přes tlačítka */
}
