/* ============================================================
   Magic Hub — design system (single source of truth)
   Ported from Claude Design handoff (design-shopito).
   Inspirováno Raqeto DS (slate neutrály, 1px bordery, pill badge,
   jemné stíny, Lucide ikony) s vlastní iris/indigo identitou.

   Toto je JEDINÝ zdroj pravdy pro vzhled celé aplikace.
   Každá nová obrazovka má stavět na těchto tokenech a třídách.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* radii */
  --r-sm: 5px;
  --r:    8px;
  --r-lg: 12px;
  --r-full: 999px;

  /* type scale */
  --fs-xs:   11.5px;
  --fs-sm:   13px;
  --fs-base: 14px;
  --fs-md:   15px;
  --fs-lg:   17px;
  --fs-xl:   21px;
  --fs-2xl:  27px;
  --fs-3xl:  34px;

  --font-ui:  "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:"Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* row metrics — overridden by density */
  --row-py: 9px;
  --cell-fs: 13px;
  --thumb: 34px;

  /* spacing scale (4px grid) — JEDINÉ povolené hodnoty mezer.
     Inline `margin-top:16px` / `1rem` / `.6rem` se nepíše — použij
     layout primitiva (.page, .stack, .row, .grid) nebo tyhle tokeny. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* layout metrics — odvozené ze spacing škály */
  --page-pt: var(--sp-6);        /* 24 */
  --page-px: 28px;
  --page-pb: 64px;
  --page-max: 1320px;
  --page-max-narrow: 880px;
  --gap-section: var(--sp-5);    /* mezi bloky stránky: hlavička, karty, gridy */
  --gap-grid: var(--sp-4);       /* mezi kartami v gridu */
  --gap-stack: var(--sp-3);      /* mezi prvky uvnitř karty */
  --card-py: 18px;
  --card-px: var(--sp-5);        /* 20 */
}

/* ---------------- LIGHT (default) ---------------- */
:root,
[data-theme="light"] {
  --bg:        #f4f5f8;
  --surface:   #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f7;
  --border:    #e4e7ee;
  --border-2:  #eef0f5;
  --text:      #1c2230;
  --text-2:    #596070;   /* dřív #59607094 — alfa srážela kontrast na 2.5:1 */
  --muted:     #6b7280;
  --muted-2:   #9aa1ad;

  --accent:        #574fe6;
  --accent-hover:  #463bd6;
  --accent-soft:   #eeeefe;
  --accent-text:   #4b41d8;
  --on-accent:     #ffffff;

  --flow:      #16a34a;   /* emerald — pozitivní / hotovo */
  --flow-soft: #e6f6ec;
  --flow-text: #157f3c;

  --warn:      #d97706;
  --warn-soft: #fdf2e1;
  --warn-text: #a35c08;

  --danger:      #dc2626;
  --danger-soft: #fdecec;
  --danger-text: #c01f1f;

  --info:      #2563eb;
  --info-soft: #e9f0fe;
  --info-text: #1d52cf;

  --shadow-sm: 0 1px 2px rgba(20,28,54,.05);
  --shadow-md: 0 4px 14px -4px rgba(20,28,54,.12), 0 1px 3px rgba(20,28,54,.05);
  --shadow-lg: 0 18px 48px -16px rgba(20,28,54,.28);
  --shadow-glow: 0 0 0 1px var(--accent-soft), 0 8px 26px -10px rgba(87,79,230,.35);

  color-scheme: light;
}

/* ---------------- DARK ---------------- */
[data-theme="dark"] {
  --bg:        #0d1018;
  --surface:   #161a24;
  --surface-2: #1b202c;
  --surface-3: #222836;
  --border:    #2a3140;
  --border-2:  #232a37;
  --text:      #e8eaf0;
  --text-2:    #aab2c2;
  --muted:     #8d96a8;
  --muted-2:   #6b7384;

  --accent:        #8079ff;
  --accent-hover:  #948dff;
  --accent-soft:   #221f3d;
  --accent-text:   #a39dff;
  --on-accent:     #14121f;

  --flow:      #4ade80;
  --flow-soft: #16271d;
  --flow-text: #6ee79b;

  --warn:      #fbbf24;
  --warn-soft: #2c2310;
  --warn-text: #f6c75a;

  --danger:      #f87171;
  --danger-soft: #2c1717;
  --danger-text: #fb9b9b;

  --info:      #60a5fa;
  --info-soft: #142235;
  --info-text: #8cc0fb;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px -6px rgba(0,0,0,.55), 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.7);
  --shadow-glow: 0 0 0 1px var(--accent-soft), 0 10px 30px -12px rgba(128,121,255,.5);

  color-scheme: dark;
}

/* ---------------- density ---------------- */
[data-density="compact"] { --row-py: 5px;  --cell-fs: 12.5px; --thumb: 28px; }
[data-density="cozy"]    { --row-py: 14px; --cell-fs: 13.5px; --thumb: 40px; }

/* legacy aliases — staré šablony čtou tyto názvy */
:root {
  --panel: var(--surface);
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --tab-active-bg: var(--accent-soft);
  --text-muted: var(--muted);
}

* , *::before, *::after { box-sizing: border-box; }

/* `hidden` musí skrývat VŽDY — globálně, protože je to reset, ne komponenta.
   UA stylesheet dává `[hidden] { display: none }`, jenže jakákoli AUTORSKÁ
   `display` deklarace ho přebije: rozhoduje origin (autor > UA), ne
   specificita. Proto se `hidden` tiše rozbije na všem, co má vlastní
   `display` — `.field` (flex), `.btn` (inline-flex) — a atribut pak nemá
   žádný vizuální efekt, jen zmizí z accessibility stromu.
   Scoped resety (`.modal-backdrop[hidden]`, `.cookie-banner[hidden]`,
   `.ff-tenants[hidden]`, `[data-when][hidden]`) jsou tímhle redundantní,
   ne protichůdné — mají stejnou hodnotu. Necháváme je být.
   Chceš-li prvek s `hidden` přesto zobrazit, atribut odeber (`el.hidden =
   false`), nepřebíjej ho v CSS. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--accent-text); }

a { color: var(--accent-text); }

/* numeric / code helper */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }

/* scrollbar */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* =================================================================
   APP SHELL
   ================================================================= */
.shell { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  text-decoration: none;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--on-accent); flex-shrink: 0;
  box-shadow: 0 2px 6px -1px rgba(87,79,230,.5);
  font-weight: 800;
}
[data-theme="dark"] .brand-mark { box-shadow: none; }
.brand-name {
  font-weight: 700; font-size: var(--fs-md); letter-spacing: -0.02em;
  color: var(--text); line-height: 1;
}
.brand-name b { color: var(--accent-text); font-weight: 700; }
.brand-sub { font-size: var(--fs-xs); color: var(--muted-2); letter-spacing: .04em; text-transform: uppercase; margin-top: 3px; }

.tenant {
  margin: 0 12px 6px; padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.tenant-name { font-weight: 600; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; color: var(--text); }
.tenant-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.tenant-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--flow); box-shadow: 0 0 0 3px var(--flow-soft); flex-shrink: 0; }
.tenant-bal { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.tenant-bal b { color: var(--text); font-family: var(--font-mono); }
.tenant-switch { font-size: var(--fs-xs); color: var(--accent-text); display: inline-flex; align-items: center; gap: 3px; margin-top: 7px; cursor: pointer; text-decoration: none; }
.tenant-switch:hover { text-decoration: underline; }

/* God mód — superadmin nevázaný na žádný tenant. Fialový (accent) blok, ať je
   na první pohled jasné, že jsi „nade vším" (vs. žlutý acting banner). */
.god-tenant { background: var(--accent-soft); border-color: transparent; display: flex; flex-direction: column; }
.god-badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; color: var(--accent-text); }
.god-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
/* Výrazná cesta ven z tenanta zpět do god módu (v tenant boxu). */
.tenant-switch.god-exit { font-weight: 700; color: var(--accent-text); }

.navgroup { padding: 8px 12px 4px; }
.navgroup-h {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted-2); font-weight: 600; margin: 6px 8px 5px;
}
.navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500;
  transition: background .12s, color .12s;
  border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.navitem .icon, .navitem svg { color: var(--muted); flex-shrink: 0; transition: color .12s; }
.navitem > span:not(.off-tag):not(.count) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navitem > span.off-tag, .navitem > span.count { flex: 0 0 auto; white-space: nowrap; }
.navitem:hover { background: var(--surface-3); color: var(--text); }
.navitem:hover .icon, .navitem:hover svg { color: var(--text); }
.navitem.active, .navitem.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.navitem.active .icon, .navitem.is-active .icon,
.navitem.active svg, .navitem.is-active svg { color: var(--accent-text); }
.navitem .count { margin-left: auto; font-size: var(--fs-xs); color: var(--muted-2); font-variant-numeric: tabular-nums; }
.navitem.active .count, .navitem.is-active .count { color: var(--accent-text); }
.navitem .off-tag {
  margin-left: auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted-2); background: var(--surface-3); padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.navitem.disabled, .navitem.is-disabled { color: var(--muted-2); }
.navitem.disabled .icon, .navitem.is-disabled .icon,
.navitem.disabled svg, .navitem.is-disabled svg { color: var(--muted-2); }

.shop-row { display: flex; align-items: center; gap: 8px; }
.shop-row .shop-name, .navitem .shop-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navitem.new { color: var(--accent-text); }
.navitem.new .icon, .navitem.new svg { color: var(--accent-text); }

.sb-spacer { flex: 1; }
.sb-promo {
  display: flex; flex-direction: column; gap: 5px;
  margin: 0 12px 12px; padding: 14px;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--accent), var(--accent-hover));
  color: #fff; text-decoration: none;
}
.sb-promo-img {
  width: 100%; max-height: 84px; object-fit: cover;
  border-radius: var(--r-sm); margin-bottom: 8px;
}
.sb-promo-badge {
  align-self: flex-start; font-size: 9.5px; font-weight: 700; letter-spacing: .09em;
  background: rgba(255,255,255,.2); padding: 3px 8px; border-radius: var(--r-full);
}
.sb-promo-title { font-size: var(--fs-base); font-weight: 700; line-height: 1.25; margin-top: 4px; }
.sb-promo-text { font-size: var(--fs-xs); line-height: 1.45; color: rgba(255,255,255,.85); }
.sb-promo-cta {
  margin-top: 8px; font-size: var(--fs-sm); font-weight: 600;
  background: #fff; color: var(--accent-text); text-align: center;
  padding: 8px; border-radius: var(--r);
}
.sb-promo:hover .sb-promo-cta { background: var(--accent-soft); }
.sb-foot {
  border-top: 1px solid var(--border); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 99px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--flow));
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: var(--fs-sm);
  text-transform: uppercase;
}
.sb-foot-link {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  color: inherit; text-decoration: none; border-radius: 6px; padding: 3px; margin: -3px;
}
.sb-foot-link:hover { background: var(--surface-3); }
.sb-foot .who { font-size: var(--fs-sm); font-weight: 500; line-height: 1.2; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .role { font-size: var(--fs-xs); color: var(--muted-2); }
.sb-foot .who-wrap { min-width: 0; }
.sb-foot .logout { margin-left: auto; color: var(--muted); display: grid; place-items: center; padding: 5px; border-radius: 6px; text-decoration: none; }
.sb-foot .logout:hover { background: var(--surface-3); color: var(--text); }

/* ---- main column ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .here { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .icon, .crumbs svg { color: var(--muted-2); }
.topbar-spacer { flex: 1; }
.topsearch {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: var(--r); padding: 6px 11px; width: 230px;
  color: var(--muted); transition: border-color .12s, background .12s;
}
.topsearch:focus-within { border-color: var(--accent); background: var(--surface); }
.topsearch input { border: none; background: none; outline: none; font: inherit; font-size: var(--fs-sm); color: var(--text); width: 100%; }
.topsearch .kbd { font-size: 10.5px; color: var(--muted-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-family: var(--font-mono); }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer;
  position: relative; transition: background .12s, color .12s, border-color .12s; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.nav-toggle { display: none; }  /* hamburger jen < 720px, viz responsive */
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 99px; background: var(--danger); border: 1.5px solid var(--surface); }

/* density toggle in topbar */
.density-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.density-seg button {
  border: none; background: var(--surface); color: var(--muted); cursor: pointer;
  font: inherit; font-size: var(--fs-xs); padding: 6px 9px; display: grid; place-items: center;
}
.density-seg button + button { border-left: 1px solid var(--border); }
.density-seg button.on { background: var(--accent-soft); color: var(--accent-text); }

/* =================================================================
   PAGE LAYOUT — jedna anatomie pro každou obrazovku
   .page            obal obsahu; svislý stack s mezerou --gap-section
     .page-head     hlavička: .page-title (+ .page-sub) vlevo, .page-actions vpravo
     …              karty / gridy / tabulky — mezery řeší gap, NE margin
   Stránka je vždy zarovnaná VLEVO (titulek je na každé obrazovce na
   stejném místě). Šířka: výchozí --page-max, `.page.narrow` pro
   formuláře a texty, `.page.wide` pro velké tabulky a editory.
   ================================================================= */
.page {
  display: flex; flex-direction: column; gap: var(--gap-section);
  padding: var(--page-pt) var(--page-px) var(--page-pb);
  max-width: var(--page-max); width: 100%; margin: 0;
  min-width: 0;
}
.page.narrow { max-width: var(--page-max-narrow); }
.page.wide   { max-width: none; }
/* Přímé děti stránky nenesou vlastní svislé okraje — mezery dává `gap`.
   :where() = nulová specificita, takže vědomá výjimka (třída) pořád vyhraje. */
:where(.page, .stack, .stack-sm, .stack-lg) > * { margin-block: 0; }
/* Formulář obalující karty se chová jako stránka (jinak by se karty slepily). */
.page > form:has(> .card, > section, > .grid, > .settings-grid, > .panel) {
  display: flex; flex-direction: column; gap: var(--gap-section);
}

.page-head {
  display: flex; align-items: center; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap;
  min-height: 36px;
}
.page-head-text { min-width: 0; flex: 1 1 auto; }
.page-title {
  font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em;
  margin: 0; line-height: 1.2; color: var(--text);
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
.page-sub { color: var(--muted); font-size: var(--fs-sm); margin: var(--sp-1) 0 0; line-height: 1.5; }
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-left: auto; }
.page-head .grow { flex: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
  letter-spacing: .04em; text-transform: uppercase; margin: 0 0 var(--sp-1);
}

/* Nadpis skupiny karet uvnitř stránky (mezi kartami, ne v kartě). */
.section-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.section-title { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.section-head .section-actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* =================================================================
   LAYOUT PRIMITIVA — místo inline `display:flex;gap:…`
   ================================================================= */
.stack    { display: flex; flex-direction: column; gap: var(--gap-stack); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--gap-section); }
.row      { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-lg   { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.row-top  { align-items: flex-start; }
.row-between { justify-content: space-between; }
.row-end  { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.push-right { margin-left: auto; }

/* Gridy karet: auto-fit, zalomí se samy — žádné ruční media queries. */
.grid    { display: grid; gap: var(--gap-grid); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.grid-sm { display: grid; gap: var(--gap-grid); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-3  { display: grid; gap: var(--gap-grid); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.grid-4  { display: grid; gap: var(--gap-grid); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }

/* Drobné utility — typografie a zarovnání */
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break-all { word-break: break-all; }
.w-full { width: 100%; }
.w-auto { width: auto; }
.text-danger { color: var(--danger-text); }
.text-flow { color: var(--flow-text); }
.text-warn { color: var(--warn-text); }
.list-reset { list-style: none; margin: 0; padding: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* =================================================================
   PRIMITIVES
   ================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 13px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn .icon, .btn svg { color: var(--muted); }
.btn:hover .icon, .btn:hover svg { color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(87,79,230,.25); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary .icon, .btn.primary:hover .icon, .btn.primary svg, .btn.primary:hover svg { color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger-text); border-color: var(--border); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn.sm { padding: 5px 9px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.5;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.flow   { background: var(--flow-soft);   color: var(--flow-text); }
.badge.warn   { background: var(--warn-soft);   color: var(--warn-text); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); }
.badge.info   { background: var(--info-soft);   color: var(--info-text); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
/* Karta: `.card.pad` (text/formulář) NEBO `.card` + `.card-head` + obsah
   (`.card-body` / `table.dt`) + volitelně `.card-foot`. */
.card.pad, .pad, .card-body { padding: var(--card-py) var(--card-px); }
.card { min-width: 0; }
.card-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 14px var(--card-px); border-bottom: 1px solid var(--border-2); }
.card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.card-head .grow { flex: 1; }
.card-head .card-actions, .card-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--card-px); border-top: 1px solid var(--border-2); }
/* Titulek karty bez akcí (uvnitř `.card.pad`). */
.card-title { margin: 0 0 var(--sp-3); font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--sp-2); }
/* Uvnitř karty první/poslední prvek nepřidává okraj navíc k paddingu. */
:where(.card.pad, .card-body, .panel) > :first-child { margin-top: 0; }
:where(.card.pad, .card-body, .panel) > :last-child { margin-bottom: 0; }
/* Tabulka přímo v kartě: bez vlastního rámečku, rohy sedí do karty.
   (Žádné overflow na .card — ořízlo by dropdowny a našeptávače.) */
.card > .tablewrap { border: none; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card > table.dt:first-child thead th:first-child { border-top-left-radius: var(--r-lg); }
.card > table.dt:first-child thead th:last-child { border-top-right-radius: var(--r-lg); }
.card > table.dt:last-child tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.card > table.dt:last-child tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }
.seeall { font-size: var(--fs-xs); color: var(--accent-text); text-decoration: none; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.seeall:hover { text-decoration: underline; }

/* avatar / iniciálová dlaždice (projekt, doplněk) — used v backend workspace */
.se-tile {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.se-tile.lg { width: 46px; height: 46px; border-radius: 11px; font-size: 18px; }
.se-tile.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.se-tile.neutral { background: var(--surface-3); color: var(--muted); font-family: var(--font-mono); }

/* form bits */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.field > span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }  /* legacy: <span> label */
.input, .select, textarea.input,
.field input, .field select, .field textarea {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--muted-2); }
textarea.input { resize: vertical; line-height: 1.6; }
/* Read-only code/snippet pole (curl, snippety) — generické primitivum.
   Dřív jen `.dash .codearea` v dashboard.css, ale dashboard stránky nemají
   `.dash` wrapper → pole zůstávala nestylovaná. Tady globálně. */
.codearea {
  width: 100%; font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 12px; line-height: 1.5; resize: vertical;
}
.codearea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select, .field select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 30px;
}
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* stacked form fields + actions row */
.field + .field { margin-top: 14px; }
/* V gridu / stacku dává mezeru `gap` — margin by pole rozhodil. */
:is(.row2, .row3, .grid, .grid-sm, .grid-2c, .settings-grid, .field-grid, .stack, .stack-sm, .stack-lg) > .field + .field { margin-top: 0; }
/* Pole formuláře vedle sebe, zalomí se samy. */
.field-grid { display: grid; gap: var(--sp-3) var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
/* Podnadpis skupiny polí uvnitř karty. */
.form-subhead { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field-error { font-size: var(--fs-xs); color: var(--danger-text); font-weight: 500; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* flash messages (see CLAUDE.md — .messages / .message {{ tags }}) */
.messages { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.page > .messages { margin-bottom: 0; }
.message {
  padding: 10px 14px; border-radius: var(--r); font-size: var(--fs-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.message.success { background: var(--flow-soft); color: var(--flow-text); border-color: var(--flow-soft); }
.message.warning { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-soft); }
.message.error, .message.danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-soft); }

/* pill toggle group (filter chips) */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 12px; border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .12s; text-decoration: none;
}
.chip:hover { color: var(--text); border-color: var(--muted-2); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.chip .x { color: var(--accent-text); display: grid; place-items: center; }

/* =================================================================
   TABLE
   ================================================================= */
.tablewrap { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
table.dt { width: 100%; border-collapse: collapse; font-size: var(--cell-fs); }
table.dt thead th {
  text-align: left; padding: 10px 14px; background: var(--surface-2);
  font-size: var(--fs-xs); font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.dt thead th.sortable { cursor: pointer; }
table.dt thead th .arr { color: var(--accent-text); margin-left: 3px; }
table.dt tbody td { padding: var(--row-py) 14px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.dt tbody tr:last-child td { border-bottom: none; }
table.dt tbody tr { transition: background .1s; }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt tbody tr.sel { background: var(--accent-soft); }
table.dt tbody tr.sel:hover { background: var(--accent-soft); }
table.dt .pname { color: var(--text); text-decoration: none; font-weight: 500; }
table.dt .pname:hover { color: var(--accent-text); }
.thumb {
  width: var(--thumb); height: var(--thumb); border-radius: var(--r-sm); object-fit: cover;
  background: var(--surface-3); border: 1px solid var(--border-2); flex-shrink: 0;
}
.thumb.ph { display: grid; place-items: center; color: var(--muted-2); }
.code { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.col-check { width: 38px; }
.col-thumb { width: 50px; }
.tick { color: var(--flow-text); }
.cross { color: var(--muted-2); }

/* bulk bar */
.bulkbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r); margin-bottom: 14px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.bulkbar .sel-count { font-weight: 600; font-size: var(--fs-sm); color: var(--accent-text); }
.bulkbar .grow { flex: 1; }
.bulkbar .btn { background: var(--surface); }

/* pagination */
.pager { display: flex; align-items: center; gap: 14px; justify-content: center; padding: 16px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.pager .pg { display: flex; gap: 4px; }
.pgbtn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: var(--fs-sm); display: inline-flex; align-items: center; justify-content: center; gap: 4px; text-decoration: none; }
.pgbtn:hover { background: var(--surface-3); }
.pgbtn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pgbtn:disabled { opacity: .4; cursor: not-allowed; }

/* =================================================================
   KPI + dashboard
   ================================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi.glow { box-shadow: var(--shadow-glow); border-color: transparent; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.kpi.glow .kpi-ico { background: var(--accent); color: var(--on-accent); }
.kpi-val { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: var(--fs-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.kpi-delta.up { color: var(--flow-text); }
.kpi-delta.down { color: var(--danger-text); }
.kpi-foot { font-size: var(--fs-xs); color: var(--muted-2); margin-top: 1px; }

/* Card-picker grid — vizuální karta = volba typu/šablony/umístění (mirror
   `templates/banners/list.html` `.banner-preset-grid`/`.banner-preset`,
   zobecněno pro cross-app reuse: upsell "Vyberte typ nabídky", banner
   umístění grid, gift šablona picker — viz upsell UI rebuild plán). */
.card-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card-picker {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  text-align: left; text-decoration: none; color: inherit;
  transition: border-color .1s, background .1s;
}
.card-picker:hover { border-color: var(--accent); background: var(--accent-soft); }
.card-picker-mock {
  width: 100%; height: 90px; background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); display: grid; place-items: center; color: var(--muted-2);
}
.card-picker-title { font-weight: 600; font-size: var(--fs-md); }
.card-picker-badge { font-size: var(--fs-xs); color: var(--muted); }
.card-picker-desc { font-size: var(--fs-sm); color: var(--muted); }
.card-picker-tip { font-size: var(--fs-xs); background: var(--flow-soft); color: var(--flow-text); padding: 6px 10px; border-radius: var(--r-sm); }

/* Modal — sdílená komponenta (cross-app reuse: zatím upsell product-picker,
   viz `static/upsell/picker.js`). Fixed backdrop + centrovaný panel, zavírá
   se klikem na backdrop / Escape / křížkem. Bez animační knihovny — jen CSS
   transition. Skrytý přes `hidden` atribut (žádné `display:none` v CSS, ať
   zůstane přístupný). */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  width: 100%; max-width: 640px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.modal-head { display: flex; align-items: center; gap: .6rem; padding: 14px 18px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { margin: 0; font-size: var(--fs-md); }
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 14px 18px; overflow: auto; }
.modal-foot { display: flex; gap: .5rem; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border-2); }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-2c { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* activity list */
.act { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-2); }
.act:last-child { border-bottom: none; }
.act-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--muted); }
.act-ico.flow { background: var(--flow-soft); color: var(--flow-text); }
.act-ico.accent { background: var(--accent-soft); color: var(--accent-text); }
.act-ico.warn { background: var(--warn-soft); color: var(--warn-text); }
.act-ico.info { background: var(--info-soft); color: var(--info-text); }
.act-body { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.act-body b { font-weight: 600; }
.act-time { font-size: var(--fs-xs); color: var(--muted-2); margin-top: 2px; }

/* progress */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar > span.flow { background: var(--flow); }

/* quick action tiles */
.qa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qa { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); transition: border-color .12s, background .12s; min-width: 0; }
.qa:hover { border-color: var(--accent); background: var(--surface-2); }
.qa-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.qa > div { min-width: 0; }
.qa-t { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-d { font-size: var(--fs-xs); color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =================================================================
   FORM detail (product)
   ================================================================= */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.formsec { margin-bottom: 18px; }
.formsec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.formsec-h h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.formsec-h .num-badge { width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.helptext { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); }
.ai-hint { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--accent-text); cursor: pointer; }
.ai-hint:hover { text-decoration: underline; }

.gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.gimg { width: 78px; height: 78px; border-radius: var(--r); object-fit: cover; border: 1px solid var(--border); background: var(--surface-3); position: relative; }
.gimg.primary { box-shadow: 0 0 0 2px var(--accent); }
.gimg.add { display: grid; place-items: center; color: var(--muted-2); cursor: pointer; border-style: dashed; }
.gimg.add:hover { color: var(--accent-text); border-color: var(--accent); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: var(--fs-sm); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); white-space: nowrap; }
.kv .v { font-weight: 500; text-align: right; white-space: nowrap; }

/* banners grid */
.banner-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.bcard-img { aspect-ratio: 16/7; background: var(--surface-3); position: relative; display: grid; place-items: center; color: var(--muted-2); overflow:hidden;}
.bcard-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bcard-img .gradient { position: absolute; inset: 0; }
.bcard-meta { padding: 13px 15px; }
.bcard-t { font-weight: 600; font-size: var(--fs-sm); }
.bcard-d { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.bcard-foot { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-top: 1px solid var(--border-2); }

/* feeds */
.feed-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border-2); }
.feed-row:last-child { border-bottom: none; }
.feed-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.feed-ico.in { background: var(--info-soft); color: var(--info-text); }
.feed-ico.out { background: var(--flow-soft); color: var(--flow-text); }
.feed-name { font-weight: 600; font-size: var(--fs-sm); }
.feed-url { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; word-break: break-all; }

/* reservations */
.res-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.res-row:last-child { border-bottom: none; }
.res-date { text-align: center; background: var(--surface-3); border-radius: var(--r); padding: 6px 0; }
.res-date .d { font-size: var(--fs-lg); font-weight: 700; line-height: 1; }
.res-date .m { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin-top: 2px; }

/* empty */
.empty { display: grid; place-items: center; padding: 60px 20px; text-align: center; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-3); color: var(--muted-2); display: grid; place-items: center; margin: 0 auto 14px; }

/* =================================================================
   LEGACY Django chrome — restyled na nové tokeny
   (appbar/subheader/tabs/placeholder/impersonate/footer)
   ================================================================= */
.appbar {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.appbar:empty { display: none; }
.appbar-row { display: flex; align-items: center; gap: 16px; padding: 8px 16px; }
.appbar-spacer { flex: 1; }
/* LEGACY: `.appbar` UVNITŘ `.page` byla hlavička stránky. Vypadá teď přesně
   jako `.page-head` — nové šablony píšou rovnou `.page-head`. `.appbar` mimo
   `.page` (blok subheader) zůstává nástrojovou lištou. */
.page > .appbar, .page > form > .appbar { background: none; backdrop-filter: none; border: 0; }
.page > .appbar > .appbar-row, .page > form > .appbar > .appbar-row {
  padding: 0; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; min-height: 36px;
}
.page > .appbar > .appbar-row > :is(h1, h2),
.page > form > .appbar > .appbar-row > :is(h1, h2) {
  font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.2;
}

.subheader {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap;
}

/* ── Inline form (badge + button on one row, e.g. subheader toggles) ── */
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ── Dropdown component (subheader menus, reusable) ─────────────────── */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: var(--r-sm); color: var(--text); text-decoration: none;
  white-space: nowrap; font-size: var(--fs-sm); transition: background .1s;
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item .icon { color: var(--muted); }
button.dropdown-item {
  width: 100%; border: none; background: none; font: inherit; text-align: left; cursor: pointer;
}
button.dropdown-item:disabled { opacity: .45; cursor: not-allowed; }
button.dropdown-item:disabled:hover { background: none; }
.dropdown-sep { height: 1px; background: var(--border-2); margin: 4px 2px; }
.dropdown-caret { transition: transform .12s; }
.dropdown.open .dropdown-caret { transform: rotate(180deg); }

.tabs { display: flex; gap: 2px; }
.tab {
  padding: 7px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500;
  color: var(--muted); text-decoration: none; white-space: nowrap; transition: background .1s, color .1s;
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* Toggle switch (bool pole) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  flex: none; width: 40px; height: 22px; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  transition: background .15s, border-color .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--shadow-glow); }

/* Color picker jako čtvereček (swatch), ne default tenká čára */
input[type="color"] {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-2);
  border-radius: 10px; background: none; cursor: pointer; flex: 0 0 auto;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 7px; }
input[type="color"]:hover { border-color: var(--accent); }

.tier-toggle { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.tier-toggle select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r); font: inherit; background: var(--surface); color: var(--text); }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.user-chip a { color: var(--accent-text); text-decoration: none; }
.user-chip a:hover { text-decoration: underline; }

/* impersonate bar */
.impersonate-bar {
  background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 12px, color-mix(in srgb, var(--warn-soft) 70%, var(--warn)) 12px, color-mix(in srgb, var(--warn-soft) 70%, var(--warn)) 24px);
  color: var(--warn-text); padding: .4rem .9rem;
  display: flex; align-items: center; gap: .6rem;
  font-size: var(--fs-sm); font-weight: 500;
  border-bottom: 1px solid var(--warn);
}
.impersonate-bar .impersonate-stop {
  color: var(--warn-text); background: var(--surface);
  padding: .2rem .55rem; border-radius: var(--r-sm); text-decoration: none;
  display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--warn);
  /* je to <button> uvnitř POST formu (impersonate stop nesmí jít přes GET) */
  font: inherit; cursor: pointer; line-height: inherit;
}
.impersonate-bar .impersonate-stop:hover { background: var(--surface-3); }
/* přepínač tenant/uživatel v liště — menu zarovnané doprava, výsledky scrollují */
.impersonate-bar .switcher-menu { left: auto; right: 0; width: 340px; max-width: calc(100vw - 32px); padding: var(--sp-2); }
.dropdown.open .switcher-menu { display: flex; flex-direction: column; gap: var(--sp-2); }
.switcher-results { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.switcher-item { flex-direction: column; align-items: flex-start; gap: 0; white-space: normal; text-align: left; width: 100%; }
.switcher-sub, .switcher-note { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.switcher-note { padding: 7px 10px; }

/* placeholder pages */
.appmain { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.placeholder { flex: 1; display: grid; place-items: center; padding: 48px; }
.placeholder-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 40px 48px; max-width: 640px; text-align: center;
}
.placeholder-card h1 { margin: 0 0 8px; font-size: var(--fs-xl); }
.placeholder-card .icon { color: var(--muted-2); margin-bottom: 12px; }
.placeholder-card p { color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.placeholder-card .badge-soon {
  display: inline-block; padding: 2px 10px; background: var(--warn-soft); color: var(--warn-text);
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600; margin-top: 8px;
}
.placeholder-card ul { text-align: left; margin: 16px auto 0; max-width: 480px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }

/* footer */
.appfoot {
  margin-top: 2rem; padding: .9rem 1.4rem; border-top: 1px solid var(--border);
  background: var(--surface-2); display: flex; align-items: center; justify-content: flex-end;
  gap: 1rem; font-size: var(--fs-xs); color: var(--muted);
}
.appfoot a { color: var(--muted); text-decoration: none; }
.appfoot .lang-switch { display: inline-flex; gap: var(--sp-1); align-items: center; margin: 0 0 0 auto; }
.appfoot .lang-switch select { font: inherit; font-size: var(--fs-xs); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px var(--sp-1); }
.brand.brand-inline { padding: 0; }
/* navigace veřejného portálu v liště nepřihlášeného návštěvníka */
.portal-nav { display: flex; gap: var(--sp-5); margin-left: var(--sp-6); }
.portal-nav a { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
.portal-nav a:hover { color: var(--text); }
@media (max-width: 720px) { .portal-nav { display: none; } }
@media (max-width: 480px) { .portal-signup { display: none; } }

/* cookie lišta */
.cookie-banner {
  position: fixed; left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); z-index: 9999;
  display: flex; gap: var(--sp-4); align-items: center; justify-content: space-between;
  flex-wrap: wrap; max-width: 720px; margin: 0 auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
}
.appfoot a:hover { color: var(--text); text-decoration: underline; }

/* ── Lucide-style monochromatic icons ─────────────────────────────── */
.icon { display: inline-block; vertical-align: -2px; flex-shrink: 0; stroke: currentColor; }
.icon-missing { display: inline-block; padding: 0 4px; font-size: 10px; color: var(--danger-text); background: var(--danger-soft); border-radius: 2px; font-family: var(--font-mono); }
button .icon:only-child, a .icon:only-child { margin-right: 0; }

/* =================================================================
   responsive
   ================================================================= */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
  .banner-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  /* sidebar = off-canvas drawer, otevírá .nav-toggle (JS v base.html) */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: auto; max-width: 85vw;
    z-index: 60;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    box-shadow: var(--shadow-lg);
  }
  html.nav-open .sidebar { transform: translateX(0); visibility: visible; transition: transform .2s ease; }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 55;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .nav-toggle { display: grid; }
  .kpi-grid, .banner-grid, .grid-2c, .row2, .row3 { grid-template-columns: 1fr; }
  .topsearch { display: none; }
  .dropdown-menu { left: auto; right: 0; }
}

/* chip-picker suggest dropdown (Nastavení ceníků) */
.chip-picker { position: relative; }
.chip-suggest { position: absolute; z-index: 30; left: 0; right: 0; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 260px; overflow: auto; }
.chip-suggest-item { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.chip-suggest-item:hover { background: var(--surface-3); }
.chip-suggest-item.is-active { background: var(--surface-3); }
/* Našeptávač skladového kódu (static/warehouse/code_picker.js) */
.code-picker { display: inline-block; }
.code-picker.is-block { display: block; }
.chip-suggest.code-picker-pop { position: fixed; right: auto; margin-top: 0; width: max-content;
  max-width: min(520px, calc(100vw - 32px)); z-index: 60; }

/* =================================================================
   Nastavení e-shopu — shell s levou kotvící navigací
   (templates/product_editor/settings_base.html)
   Obsah si `.page` řeší každá podřízená šablona sama, proto má
   `.settings-nav` vlastní padding a `.settings-body` žádný.
   ================================================================= */
.settings-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  align-items: start;
}
.settings-nav {
  position: sticky; top: 60px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 24px 8px 40px 22px;
  max-height: calc(100vh - 70px); overflow-y: auto;
  z-index: 5;
}
.settings-back {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; margin-bottom: 8px;
  color: var(--muted); text-decoration: none;
  font-size: var(--fs-xs); font-weight: 600;
  white-space: nowrap; overflow: hidden;
}
.settings-back span { overflow: hidden; text-overflow: ellipsis; }
.settings-back:hover { color: var(--text); }
.settings-navgroup { padding: 6px 0 2px; }
.settings-navgroup-h {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted-2); font-weight: 600; margin: 4px 10px 4px;
}
.settings-navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none;
  font-size: 12.5px; font-weight: 500; line-height: 1.25;
}
.settings-navitem span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-navitem:hover { background: var(--surface-2); color: var(--text); }
.settings-navitem.is-active {
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}
.settings-navitem-out { margin-left: auto; opacity: .5; flex: none; }
/* Jednotný layout stránek nastavení — viz CLAUDE.md „UI / Design system".
   Obsah je VŽDY `<div class="page">`, zarovnaný vlevo, bez vlastního
   `max-width` — vyplní celý sloupec vedle navigace. Čitelnost neřeší
   stropová šířka stránky, ale `.settings-grid` uvnitř (viz níž).
   `margin: 0 auto` by obsah od navigace odlepil doprava, proto se ruší. */
.settings-body > .page { margin-left: 0; max-width: none; }

/* Dva sloupce tam, kde je místo. Karty se samy zalomí pod sebe, jakmile
   by byly užší než 420px — žádné ruční breakpointy po šablonách.
   Karta, která má zabrat celou šířku (tabulka, dlouhý formulář),
   dostane `.settings-grid-wide`. */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: var(--gap-grid);
  align-items: start;
}
.settings-grid-wide { grid-column: 1 / -1; }

/* `.card-head` nosí vlastní padding pro karty BEZ `.pad`. V `.card.pad`
   by se sčítal s paddingem karty — tady se ruší (všude, ne jen v nastavení),
   aby šablony nepsaly inline `style="padding:0 0 12px"`. Titulek bez akcí
   v `.card.pad` je `.card-title`; `.card-head` jen když má titulek i tlačítka. */
.card.pad > .card-head { padding: 0 0 var(--sp-3); border-bottom: 0; }

@media (max-width: 1000px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    position: static; max-height: none; overflow: visible;
    flex-direction: row; flex-wrap: wrap; gap: 4px;
    padding: 16px 26px 0;
  }
  .settings-nav .settings-navgroup { display: contents; }
  .settings-nav .settings-navgroup-h { display: none; }
  .settings-navitem { background: var(--surface-2); }
}

/* ============================================================
   Warehouse — Zveřejňování skladu (`warehouse:stock_disclosure`)
   ============================================================ */

/* Rádio v tri-state ovladačích (režim / pravidlo kategorie / pravidlo
   produktu). `.field > label.radio` v upsell/editor.css je scoped na
   `.field` — tady je potřeba stejný vzhled i mimo něj. */
.radio {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 400; color: var(--text); font-size: var(--fs-sm);
  cursor: pointer;
}
.radio input[type="radio"] { width: auto; accent-color: var(--accent); }

/* Malý nadpis uvnitř `.card.pad` (karta s textem/formulářem) —
   `.card-head h3` je jen pro karty s tabulkou. */
.card-title-sm { margin: 0 0 var(--sp-3); font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }

/* Řádkový formulář (hledání, filtr) — vlastní gap, `.inline-form` má menší. */
.form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }

/* Forma zabalená kolem jednoho tlačítka v akčním sloupci tabulky, aby dvě
   sousední `<form>` nezalomily řádek. */
.form-inline { display: inline-block; }

/* Sloupec rádií v kartě „Režim". */
.radio-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

/* Úzké pole pod popiskem (strop), mimo `.field` grid layout. */
.field-narrow { display: block; max-width: 260px; }

/* Krátká nápověda pod polem / popisek karty. */
.hint { margin: 4px 0 12px; }

/* Zruší defaultní odsazení odstavce — poslední prvek karty, kde `.hint`
   (margin dole) není žádoucí. */
.m0 { margin: 0; }

/* Popisek pod `.card-head`, ale mimo `.pad` (karta s tabulkou dole). */
.card-note { padding: 0 18px 12px; margin: 0; color: var(--muted); font-size: var(--fs-sm); }

/* Zúžené textové pole (vyhledávání). */
.input-search { max-width: 320px; }

/* Strom kategorií — vnořené `<ul>` se odsadí samy podle hloubky zanoření,
   bez nutnosti počítat `depth` v kontextu šablony. */
.disclosure-tree { list-style: none; margin: 0; padding-left: 0; }
.disclosure-tree .disclosure-tree { padding-left: 1.2rem; margin-top: .3rem; }
.disclosure-node { margin: .3rem 0; padding: .4rem .6rem; border-left: 2px solid var(--border); }
.disclosure-node-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.disclosure-children { margin-top: .3rem; }
.disclosure-children > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); }

/* Tri-state formulář uzlu stromu i jednoproduktového ovladače na detailu produktu. */
.disclosure-state-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: .4rem; }

/* =================================================================
   UTILITY OVERRIDES — až na konci, ať vyhrají nad komponentami
   se stejnou specificitou (.input { width:100% } apod.)
   ================================================================= */
.w-auto { width: auto; }
.w-full { width: 100%; }
.m0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.tabs-wrap { flex-wrap: wrap; }
.row-bottom { align-items: flex-end; }
.row-center { justify-content: center; }
.text-emph { color: var(--text); }
table.dt thead th.text-right, table.dt thead th.num { text-align: right; }
table.dt thead th.text-center { text-align: center; }
table.dt tfoot td { padding: var(--row-py) 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-weight: 600; }
/* `.field > span` je legacy label — nápověda a chyba uvnitř pole si drží svůj vzhled. */
.field > span.field-error { color: var(--danger-text); font-weight: 500; }
.field > span.helptext { color: var(--muted); font-weight: 400; }
.row-nowrap { flex-wrap: nowrap; }
.fieldset-reset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; padding: 0; accent-color: var(--accent); }
:is(.stack, .stack-sm, .stack-lg) > :is(.card-title, .card-title-sm) { margin-bottom: 0; }
table.dt td.num { text-align: right; }
.tab { display: inline-flex; align-items: center; gap: 6px; }
.tablewrap.scroll-x { overflow-x: auto; }
.input-w-sm { width: 140px; max-width: 100%; }
.input-w-md { width: 280px; max-width: 100%; }
.summary-btn { list-style: none; cursor: pointer; }
.summary-btn::-webkit-details-marker { display: none; }
.row-top { align-items: flex-start; }
.fw-400 { font-weight: 400; }
.text-lg { font-size: var(--fs-lg); }
.checkbox.row-top { align-items: flex-start; }
.checkbox.row-top input { margin-top: 2px; }
:is(.stack, .stack-sm, .stack-lg) > .btn { align-self: flex-start; }
.page > form > .form-actions { margin-top: 0; }
.stack-xs { display: flex; flex-direction: column; gap: var(--sp-1); }
.card-sub { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.input.mono, .select.mono { font-family: var(--font-mono); }
.input.muted { color: var(--muted); }
:is(.card.pad, .card-body) > form + form { margin-top: var(--sp-3); }
