/* ==========================================================================
   WOOD OS — design system
   Vizuální jazyk podle BACCHUS CRM: „glass“ — průsvitné matné plochy nad
   jemným gradientem, pilulkové karty, kulatá ikonová tlačítka, šrafované pruhy.
   Akcent = #019471 (smaragdově tyrkysová). Světlý režim výchozí, tmavý přes
   [data-theme="dark"] nebo systémové nastavení.
   Pozn.: proměnné --oak* zůstaly kvůli kompatibilitě se šablonami ve views-*.js,
   dnes nesou akcentovou barvu.
   ========================================================================== */

:root {
  /* akcent */
  --accent:      #019471;
  --accent-2:    #14b38c;
  --accent-ink:  #01684f;
  --accent-soft: rgba(1,148,113,.12);
  --accent-line: rgba(1,148,113,.34);
  --hero: linear-gradient(135deg, rgba(10,176,136,.96), rgba(1,98,75,.96));

  /* pozadí a sklo */
  --bg:        #eef1f0;
  --bg-grad:
    radial-gradient(900px 600px at 8% -10%, rgba(1,148,113,.11), transparent 60%),
    radial-gradient(800px 700px at 100% 0%, rgba(222,204,160,.22), transparent 60%),
    radial-gradient(900px 700px at 60% 110%, rgba(1,148,113,.07), transparent 60%),
    linear-gradient(180deg, #f5f7f6, #edf0ef);
  --panel:     rgba(255,255,255,.52);
  --card:      rgba(255,255,255,.72);
  --white:     rgba(255,255,255,.92);
  --solid:     #f8faf9;
  --glass-border: rgba(255,255,255,.8);
  --blur: blur(20px) saturate(1.5);
  --dark:      #15201d;
  --dark-2:    #2c3a36;

  /* text */
  --ink:    #121a18;
  --ink-2:  #48564f;
  --muted:  #7f8c87;
  --muted-2:#a3aeaa;
  --line:   rgba(16,40,32,.07);
  --line-2: rgba(16,40,32,.12);
  --line-3: rgba(16,40,32,.22);

  /* stavy */
  --ok:     #2f9e4f;   --ok-dim:     rgba(47,158,79,.14);    --ok-ink:     #1d6e35;
  --warn:   #d99206;   --warn-dim:   rgba(227,160,8,.17);    --warn-ink:   #8a5a00;
  --danger: #e0483e;   --danger-dim: rgba(224,72,62,.13);    --danger-ink: #b3261e;
  --info:   #3b7be0;   --info-dim:   rgba(59,123,224,.13);   --info-ink:   #1f56ad;
  --violet: #8b5cf6;   --violet-dim: rgba(139,92,246,.13);   --violet-ink: #6233c9;

  /* skóre */
  --s-extreme:  #1f9d55;
  --s-strong:   #6aa312;
  --s-relevant: #c99a00;
  --s-maybe:    #e07a1f;
  --s-low:      #8a938f;

  /* kompatibilita se staršími šablonami */
  --oak: var(--accent); --oak-2: var(--accent-ink); --oak-dim: var(--accent-soft); --oak-line: var(--accent-line);
  --text: var(--ink); --text-2: var(--ink-2);
  --surface: var(--card); --surface-2: var(--white); --surface-3: rgba(16,40,32,.06); --bg-1: rgba(255,255,255,.5);

  --shadow:    0 1px 0 rgba(255,255,255,.95) inset, 0 0 0 1px var(--glass-border) inset, 0 18px 40px -20px rgba(16,52,42,.20);
  --shadow-sm: 0 1px 0 rgba(255,255,255,.95) inset, 0 0 0 1px var(--glass-border) inset, 0 6px 18px -10px rgba(16,52,42,.18);
  --shadow-pop: 0 0 0 1px var(--glass-border) inset, 0 30px 60px -20px rgba(0,0,0,.35);
  --sh-lg: var(--shadow-pop);
  --hatch-accent: repeating-linear-gradient(-55deg, var(--accent) 0 3px, transparent 3px 8px);
  --hatch-gray:   repeating-linear-gradient(-55deg, rgba(90,110,104,.18) 0 3px, transparent 3px 8px);

  --r-xs: 8px; --r-sm: 14px; --r-md: 18px; --r-lg: 26px; --r-xl: 34px;
  --t: 180ms cubic-bezier(.2,.8,.2,1);
  --font: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidebar-w: 248px;
  color-scheme: light;
}

/* tmavý režim — ručně přepnutý */
:root[data-theme="dark"] {
  --accent: #19b48c; --accent-2: #3fd0a8; --accent-ink: #7fe6c9;
  --accent-soft: rgba(25,180,140,.20); --accent-line: rgba(25,180,140,.42);
  --hero: linear-gradient(135deg, rgba(14,160,124,.88), rgba(1,70,54,.88));
  --bg: #0c1311;
  --bg-grad:
    radial-gradient(900px 600px at 8% -10%, rgba(1,148,113,.32), transparent 60%),
    radial-gradient(800px 700px at 100% 0%, rgba(214,190,130,.10), transparent 60%),
    radial-gradient(900px 700px at 60% 110%, rgba(1,148,113,.20), transparent 60%),
    linear-gradient(180deg, #0f1715, #0a0f0e);
  --panel: rgba(255,255,255,.045); --card: rgba(255,255,255,.065); --white: rgba(255,255,255,.10);
  --solid: #18211f; --glass-border: rgba(255,255,255,.09);
  --dark: #e8f0ed; --dark-2: #c8d4d0;
  --ink: #eef3f1; --ink-2: #bccac5; --muted: #84928d; --muted-2: #5f6c68;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.13); --line-3: rgba(255,255,255,.2);
  --ok: #3cc56b; --ok-dim: rgba(60,197,107,.16); --ok-ink: #84e2a5;
  --warn-dim: rgba(227,160,8,.18); --warn-ink: #f3c969;
  --danger-dim: rgba(224,72,62,.2); --danger-ink: #f6a49d;
  --info: #6ea0f5; --info-dim: rgba(110,160,245,.18); --info-ink: #a9c6fa;
  --violet-dim: rgba(139,92,246,.2); --violet-ink: #c3adfb;
  --s-extreme: #4fd283; --s-strong: #a3d63c; --s-relevant: #f0c53a; --s-maybe: #f59a4a; --s-low: #7d8783;
  --surface-3: rgba(255,255,255,.06); --bg-1: rgba(0,0,0,.18);
  --shadow:    0 1px 0 rgba(255,255,255,.06) inset, 0 0 0 1px var(--glass-border) inset, 0 18px 40px -18px rgba(0,0,0,.7);
  --shadow-sm: 0 1px 0 rgba(255,255,255,.06) inset, 0 0 0 1px var(--glass-border) inset, 0 6px 18px -8px rgba(0,0,0,.7);
  --hatch-gray: repeating-linear-gradient(-55deg, rgba(255,255,255,.12) 0 3px, transparent 3px 8px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Musí být takhle natvrdo: prvky jako #app nebo .login mají vlastní display,
   který by jinak přebil HTML atribut hidden a překryv by nezmizel. */
[hidden] { display: none !important; }
html { margin: 0; min-height: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--ink); background: transparent;
  -webkit-font-smoothing: antialiased;
}
/* gradient jako pevná vrstva přes celý viewport — při scrollu se neořízne */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--bg-grad); pointer-events: none; }
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(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--line-3); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }

/* ================= layout ================= */
#app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .28s cubic-bezier(.2,.8,.2,1); }
#app.rail-collapsed { grid-template-columns: 92px minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; padding: 20px 14px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 4px 16px; }
/* Logo z webu bohemicarustica.com — celé v rozbaleném menu, jen kruh ve sbaleném */
.brand__mark { display: none; width: 44px; height: 44px; flex-shrink: 0; color: var(--ink); }
.brand__mark svg { width: 44px; height: 44px; display: block; }
.brand__text { flex: 1; }
.brand__logo { display: block; width: 100%; height: auto; max-height: 72px; color: var(--ink); }
.brand__text { min-width: 0; line-height: 1.1; white-space: nowrap; }
.brand__name { font-weight: 600; letter-spacing: .08em; font-size: 16px; }
.brand__sub { font-size: 11px; color: var(--muted); letter-spacing: .04em; margin-top: 3px; }
.sidebar .sidebar__close { display: none; margin-left: auto; }

.nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding: 2px 2px 18px;
  /* jemné ztmavení dole napoví, že menu pokračuje */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
}
.nav::-webkit-scrollbar { display: none; }
.nav__label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; padding: 12px 14px 5px; white-space: nowrap;
}
.nav__item {
  display: flex; align-items: center; gap: 11px; height: 38px;
  padding: 0 14px; border-radius: 999px; margin-bottom: 2px;
  color: var(--ink-2); font-weight: 400; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; position: relative;
  transition: background var(--t), color var(--t), transform var(--t);
}
.nav__item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav__item:hover { background: rgba(1,148,113,.08); color: var(--ink); }
:root[data-theme="dark"] .nav__item:hover { background: rgba(255,255,255,.07); }
.nav__item.is-active {
  background: var(--hero); color: #fff; font-weight: 500;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 24px -10px rgba(1,148,113,.75);
}
.nav__item.is-active svg { opacity: 1; }
.nav__item.is-active .badge { background: rgba(255,255,255,.25); color: #fff; }
.nav__lbl { overflow: hidden; text-overflow: ellipsis; }

.badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600; min-width: 20px; text-align: center;
  background: var(--white); color: var(--ink-2); box-shadow: var(--shadow-sm);
  padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums;
}
.badge--oak  { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.badge--ok   { background: var(--ok-dim); color: var(--ok-ink); box-shadow: none; }
.badge--live { background: var(--danger); color: #fff; box-shadow: none; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.sidebar__foot { padding-top: 10px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.rail-toggle { align-self: flex-start; }
.rail-toggle svg { transition: transform .28s; }
.user {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px;
  border-radius: 999px; cursor: pointer; background: var(--card); box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: transform var(--t);
}
.user:hover { transform: translateY(-1px); }
.user__avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--dark); color: var(--solid);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.user__name { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user__role { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* sbalený rail — jen ikony (desktop) */
@media (min-width: 981px) {
  #app.rail-collapsed .sidebar { padding: 20px 0 14px; align-items: center; }
  #app.rail-collapsed .brand { padding: 0 0 16px; }
  #app.rail-collapsed .brand__mark { display: block; }
  #app.rail-collapsed .brand__text,
  #app.rail-collapsed .nav__lbl,
  #app.rail-collapsed .user > :not(.user__avatar) { display: none; }
  #app.rail-collapsed .nav { width: 100%; display: flex; flex-direction: column; align-items: center; }
  #app.rail-collapsed .nav__label { font-size: 0; padding: 0; width: 24px; height: 1px; background: var(--line); margin: 9px 0; }
  #app.rail-collapsed .nav__item { width: 44px; padding: 0; justify-content: center; }
  #app.rail-collapsed .nav__item .badge { position: absolute; top: -2px; right: -4px; margin: 0; padding: 0 5px; min-width: 17px; font-size: 9.5px; line-height: 16px; }
  #app.rail-collapsed .nav__item .badge--oak { display: none; }
  #app.rail-collapsed .sidebar__foot { align-items: center; }
  #app.rail-collapsed .user { padding: 4px; }
  #app.rail-collapsed .rail-toggle { align-self: center; }
  #app.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }
}

/* ================= topbar ================= */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 28px 10px;
}
.topbar::before {
  /* jemné rozmazání obsahu pod lištou, bez tvrdé hrany */
  content: ''; position: absolute; inset: 0 0 -16px; z-index: -1; pointer-events: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
}
.topbar .topbar__menu { display: none; }
.search {
  flex: 1; min-width: 0; max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 8px 6px 20px; border-radius: 999px;
  background: var(--white); box-shadow: var(--shadow);
  transition: box-shadow var(--t);
}
.search:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--accent-line); }
.search svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font-size: 14.5px; }
.search input::placeholder { color: var(--muted); }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500;
  background: transparent; border: 1px solid var(--line-2);
  border-radius: 999px; padding: 3px 9px; color: var(--muted);
}
.search kbd { margin-right: 6px; }
.topbar__right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex-shrink: 0;
  border-radius: 50%; color: var(--ink); position: relative;
  background: var(--white); box-shadow: var(--shadow-sm);
  transition: transform var(--t), background var(--t);
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot {
  position: absolute; top: 10px; right: 11px; width: 8px; height: 8px;
  border-radius: 99px; background: var(--danger); box-shadow: 0 0 0 2px var(--solid);
}
.icon-btn--flat { background: transparent; box-shadow: none; width: 36px; height: 36px; color: var(--muted); }
.icon-btn--flat:hover { background: var(--accent-soft); color: var(--ink); transform: none; }
.modal__head .icon-btn, .drawer__head .icon-btn { width: 38px; height: 38px; }

/* ================= buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform var(--t), background var(--t), box-shadow var(--t), color var(--t);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px -12px rgba(1,148,113,.9);
}
.btn--primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 14px 26px -12px rgba(1,148,113,.95); }
.btn--outline { background: var(--white); }
.btn--ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--ink); transform: none; }
.btn--danger { background: var(--danger-dim); color: var(--danger-ink); box-shadow: none; }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--ok { background: var(--ok-dim); color: var(--ok-ink); box-shadow: none; }
.btn--ok:hover { background: var(--ok); color: #fff; }
.btn--dark { background: var(--dark); color: var(--solid); box-shadow: none; }
.btn--sm { height: 32px; padding: 0 13px; font-size: 12.5px; gap: 6px; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--lg { height: 50px; padding: 0 24px; font-size: 15px; }
.btn--icon { width: 40px; padding: 0; }
.btn--sm.btn--icon { width: 32px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 15px; height: 15px; border-radius: 99px;
  border: 2px solid var(--ink); border-top-color: transparent; animation: spin .7s linear infinite;
}
.btn--primary.is-loading::after, .btn--dark.is-loading::after { border-color: #fff; border-top-color: transparent; }
.icon-btn.is-loading svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= page chrome ================= */
.route { padding: 18px 28px 80px; max-width: 1600px; width: 100%; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-head h1 { margin: 0; font-size: 44px; line-height: 1.02; font-weight: 500; letter-spacing: -.025em; }
.page-head__title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head__sub { color: var(--muted); font-size: 13.5px; margin-top: 10px; max-width: 760px; }
.page-head__sub b { color: var(--ink-2); font-weight: 500; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-head__count {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 99px; background: var(--dark); color: var(--solid);
  font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums;
}

.tabs {
  display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 18px; max-width: 100%;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; font-size: 13px; font-weight: 400; color: var(--ink-2);
  border-radius: 999px; white-space: nowrap; transition: background var(--t), color var(--t);
}
.tab:hover { color: var(--ink); background: var(--accent-soft); }
.tab.is-active { background: var(--dark); color: var(--solid); font-weight: 500; }
.tab .badge { margin-left: 6px; box-shadow: none; }
.tab.is-active .badge { background: rgba(255,255,255,.2); color: inherit; }

/* ================= cards ================= */
.card {
  background: var(--panel); border-radius: var(--r-xl);
  box-shadow: var(--shadow); min-width: 0; overflow: hidden;
}
.card + .card { margin-top: 18px; }
.grid > .card + .card { margin-top: 0; }
.card__head {
  padding: 18px 22px 4px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card__head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.card__head .spacer { flex: 1; }
.card__body { padding: 14px 22px 20px; }
.card__body--flush { padding: 6px 12px 12px; }
.card--glow { box-shadow: var(--shadow), 0 0 0 2px var(--accent-line); }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.grid--sidebar { grid-template-columns: minmax(0,1fr) 360px; align-items: start; }
.grid--main { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); align-items: start; }

/* ================= KPI ================= */
.kpi {
  background: var(--card); border-radius: 24px; padding: 16px 18px 14px;
  box-shadow: var(--shadow-sm); min-width: 0;
  display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden;
  transition: transform var(--t);
}
.kpi--click { cursor: pointer; }
.kpi--click::after {
  content: ''; position: absolute; right: 16px; bottom: 16px; width: 9px; height: 9px;
  border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg); opacity: .35; transition: opacity var(--t), transform var(--t);
}
.kpi--click:hover { transform: translateY(-2px); }
.kpi--click:hover::after { opacity: .8; transform: translateX(2px) rotate(-45deg); }
.kpi__label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.kpi__label svg { width: 14px; height: 14px; color: var(--accent); }
.kpi__value { font-size: 30px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 6px; }
.kpi__sub { font-size: 12px; color: var(--muted); padding-right: 18px; }
.kpi__delta { font-size: 12px; font-weight: 500; }
.kpi__delta.up { color: var(--ok); } .kpi__delta.down { color: var(--danger); }
.kpi--hero {
  background: var(--hero); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 0 0 1px rgba(255,255,255,.12) inset, 0 24px 50px -22px rgba(1,148,113,.75);
}
.kpi--hero::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,.22), transparent 45%);
}
.kpi--hero .kpi__label, .kpi--hero .kpi__sub, .kpi--hero .kpi__label svg { color: rgba(255,255,255,.88); }
.kpi__spark { position: absolute; right: 0; bottom: 0; left: 0; height: 34px; opacity: .5; }

/* ================= tables — řádky jako pilulky ================= */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 12px; padding: 6px 14px 2px; white-space: nowrap;
}
table.tbl td { padding: 11px 14px; vertical-align: middle; background: var(--card); transition: background var(--t); }
table.tbl td:first-child { border-radius: 18px 0 0 18px; }
table.tbl td:last-child { border-radius: 0 18px 18px 0; }
table.tbl td:only-child { border-radius: 18px; }
table.tbl tbody tr:hover td { background: var(--white); }
table.tbl tr.is-clickable { cursor: pointer; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.small { overflow-wrap: anywhere; }
table.tbl td .tag { margin: 1px 0; }
table.tbl .actions { text-align: right; white-space: nowrap; }
table.tbl td.tight { padding-top: 6px; padding-bottom: 6px; }
table.tbl input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.row-title { font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.empty { padding: 50px 24px; text-align: center; color: var(--muted); }
.empty__icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--white); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--accent);
}
.empty__icon svg { width: 22px; height: 22px; }
.empty h4 { margin: 0 0 6px; color: var(--ink); font-size: 17px; font-weight: 500; }
.empty p { margin: 0 auto 18px; max-width: 420px; font-size: 13.5px; }

/* ================= chips / tags ================= */
.chip {
  height: 34px; padding: 0 16px; border-radius: 99px; font-size: 13px; font-weight: 400;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--glass-border); background: rgba(255,255,255,.3); color: var(--ink-2);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: background var(--t), color var(--t), border-color var(--t); cursor: pointer; white-space: nowrap;
}
:root[data-theme="dark"] .chip { background: rgba(255,255,255,.05); }
.chip:hover { background: var(--card); color: var(--ink); }
.chip.is-active { background: var(--dark); border-color: var(--dark); color: var(--solid); font-weight: 500; }
.chip__count { opacity: .6; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--white); color: var(--ink-2); box-shadow: var(--shadow-sm); white-space: nowrap;
}
.tag--oak    { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.tag--ok     { background: var(--ok-dim); color: var(--ok-ink); box-shadow: none; }
.tag--warn   { background: var(--warn-dim); color: var(--warn-ink); box-shadow: none; }
.tag--danger { background: var(--danger-dim); color: var(--danger-ink); box-shadow: none; }
.tag--info   { background: var(--info-dim); color: var(--info-ink); box-shadow: none; }
.tag--violet { background: var(--violet-dim); color: var(--violet-ink); box-shadow: none; }
.tag--ghost  { background: transparent; box-shadow: none; border: 1.2px solid var(--line-2); color: var(--muted); }
.tag--dark   { background: var(--dark); color: var(--solid); box-shadow: none; }

.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); display: inline-block; flex-shrink: 0; }
.dot--ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.dot--warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.dot--danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }

/* ================= score ================= */
.score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 26px; padding: 0 9px; border-radius: 999px;
  font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums;
}
.score--extreme  { background: rgba(31,157,85,.15); color: var(--s-extreme); }
.score--strong   { background: rgba(106,163,18,.15); color: var(--s-strong); }
.score--relevant { background: rgba(201,154,0,.16); color: var(--s-relevant); }
.score--maybe    { background: rgba(224,122,31,.15); color: var(--s-maybe); }
.score--low      { background: rgba(120,130,126,.15); color: var(--s-low); }

.ring { position: relative; width: 78px; height: 78px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring__bg { stroke: var(--line-2); }
.ring__val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 700ms cubic-bezier(.2,.8,.2,1); }
.ring__txt {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}

/* šrafovaná dráha jako v referenci */
.meter { height: 9px; border-radius: 99px; background: var(--hatch-gray); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width 600ms cubic-bezier(.2,.8,.2,1); }
.meter__fill.ok { background: var(--ok); }
.meter__fill.warn { background: var(--warn); }
.meter__fill.danger { background: var(--danger); }

/* ================= avatar / thumb ================= */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--white); border: 2.5px solid var(--white); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
  color: var(--ink-2); overflow: hidden;
}
.avatar--sm { width: 28px; height: 28px; font-size: 10.5px; border-width: 2px; }
.avatar--lg { width: 58px; height: 58px; font-size: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.flag { font-size: 14px; line-height: 1; }

/* ================= forms ================= */
.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 6px; }
.form__row--2 { grid-template-columns: 1fr 1fr; gap: 14px; }
.form__row--3 { grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form__label {
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.form__label .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.form__input, .form__select, .form__textarea {
  width: 100%; padding: 11px 16px; font-size: 13.5px;
  background: var(--white); color: var(--ink);
  border: 0; border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--line-2);
  outline: none; transition: box-shadow var(--t), background var(--t);
}
.form__input::placeholder, .form__textarea::placeholder { color: var(--muted-2); }
.form__input:focus, .form__select:focus, .form__textarea:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.form__textarea { resize: vertical; min-height: 90px; font-family: inherit; line-height: 1.55; border-radius: 20px; }
.form__select {
  appearance: none; padding-right: 36px; cursor: pointer;
  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='%237f8c87' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 11px;
}
.form__select option { background: var(--solid); color: var(--ink); }
.form__hint { font-size: 12px; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  width: 42px; height: 24px; border-radius: 99px; background: var(--line-2);
  position: relative; transition: background var(--t); flex-shrink: 0;
}
.switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 99px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform var(--t);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.toolbar__search {
  flex: 1; min-width: 210px; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px; background: var(--white); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.toolbar__search:focus-within { box-shadow: var(--shadow-sm), 0 0 0 2px var(--accent-line); }
.toolbar__search svg { width: 15px; height: 15px; color: var(--muted); }
.toolbar__search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13.5px; }
.toolbar .form__select { width: auto; min-width: 130px; height: 44px; padding: 0 36px 0 16px; font-size: 13px; border-radius: 999px; box-shadow: var(--shadow-sm); }

/* ================= modal / drawer ================= */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal__bd { position: absolute; inset: 0; background: rgba(8,20,16,.28); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade 160ms ease; }
.modal__panel {
  position: relative; width: min(700px, 100%); max-height: calc(100vh - 48px);
  background: rgba(247,249,248,.9); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border-radius: var(--r-xl); box-shadow: 0 0 0 1px var(--glass-border) inset, 0 40px 90px -30px rgba(0,0,0,.55);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop 260ms cubic-bezier(.2,.9,.25,1.1);
}
:root[data-theme="dark"] .modal__panel { background: rgba(20,30,27,.9); }
.modal__panel--lg { width: min(960px, 100%); }
.modal__panel--xl { width: min(1240px, 100%); }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 10px; }
.modal__head h3 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.modal__body { padding: 10px 24px 22px; overflow-y: auto; flex: 1; }
.modal__foot {
  padding: 4px 24px 22px;
  display: flex; justify-content: flex-end; gap: 10px; align-items: center; flex-wrap: wrap;
}
.modal__foot .left { margin-right: auto; display: flex; gap: 8px; align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }

.drawer { position: fixed; inset: 0; z-index: 110; }
.drawer[hidden] { display: none; }
.drawer__bd { position: absolute; inset: 0; background: rgba(8,20,16,.24); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 160ms ease; }
.drawer__panel {
  position: absolute; right: 10px; top: 10px; bottom: 10px; width: min(940px, calc(100% - 20px));
  background: rgba(246,248,247,.93); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border-radius: var(--r-xl); box-shadow: 0 0 0 1px var(--glass-border) inset, 0 40px 90px -30px rgba(0,0,0,.45);
  display: flex; flex-direction: column; overflow: hidden; animation: slidein 280ms cubic-bezier(.2,.9,.3,1);
}
:root[data-theme="dark"] .drawer__panel { background: rgba(18,27,24,.92); }
@keyframes slidein { from { transform: translateX(28px); opacity: .3; } }
.drawer__head { padding: 22px 24px 14px; display: flex; gap: 14px; align-items: flex-start; }
.drawer__body { flex: 1; overflow-y: auto; padding: 6px 24px 60px; }
.drawer__foot { padding: 12px 24px 16px; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* ================= toast ================= */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--dark); color: var(--solid); padding: 12px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.45); display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 440px; pointer-events: auto;
  animation: pop 250ms cubic-bezier(.2,.9,.25,1.1); transition: opacity .3s, transform .3s;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast--ok   { background: var(--ok); color: #fff; }
.toast--err  { background: var(--danger); color: #fff; }

/* ================= command palette ================= */
.cmdk { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 12vh; }
.cmdk[hidden] { display: none; }
.cmdk__bd { position: absolute; inset: 0; background: rgba(8,20,16,.42); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cmdk__panel {
  position: relative; width: min(640px, 92%);
  background: rgba(246,249,248,.9); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border-radius: 28px; box-shadow: var(--shadow-pop); overflow: hidden;
  animation: pop 220ms cubic-bezier(.2,.9,.25,1.1);
}
:root[data-theme="dark"] .cmdk__panel { background: rgba(22,32,29,.92); }
.cmdk__search { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.cmdk__search svg { width: 18px; height: 18px; color: var(--accent); }
.cmdk__search input { flex: 1; border: 0; outline: none; background: none; font-size: 16px; }
.cmdk__list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk__group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; padding: 10px 14px 4px; }
.cmdk__item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; cursor: pointer; }
.cmdk__item svg { width: 16px; height: 16px; color: var(--muted); }
.cmdk__item:hover, .cmdk__item.is-active { background: var(--accent-soft); }
.cmdk__item:hover svg, .cmdk__item.is-active svg { color: var(--accent); }
.cmdk__item .t { flex: 1; font-size: 14px; }
.cmdk__item .s { font-size: 12px; color: var(--muted); }

/* ================= brain / chat ================= */
.brain { display: grid; grid-template-columns: 1fr; height: calc(100vh - 80px); }
.brain__log {
  flex: 1; overflow-y: auto; padding: 18px 0 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.brain__inner { width: min(860px, 100%); margin: 0 auto; padding: 0 22px; }
.msg { display: flex; gap: 13px; }
.msg__avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
}
.msg--user { flex-direction: row-reverse; }
.msg--user .msg__avatar { background: var(--dark); color: var(--solid); }
.msg--ai .msg__avatar { background: var(--hero); color: #fff; box-shadow: 0 8px 18px -8px rgba(1,148,113,.7); }
.msg__body { flex: 1; min-width: 0; padding-top: 5px; font-size: 14.5px; line-height: 1.65; }
.msg__body p { margin: 0 0 10px; }
.msg__body p:last-child { margin-bottom: 0; }
.msg__body ul, .msg__body ol { margin: 0 0 10px; padding-left: 20px; }
.msg__body li { margin-bottom: 4px; }
.msg__body h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.msg__body code { font-family: var(--mono); font-size: 12.5px; background: var(--white); padding: 1px 6px; border-radius: 6px; }
.msg__body pre { background: var(--white); border-radius: 16px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; }
.msg__body table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 12px; }
.msg__body th, .msg__body td { border-bottom: 1px solid var(--line-2); padding: 7px 10px; text-align: left; }
.msg__body th { font-weight: 500; color: var(--muted); }
.msg__body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.msg--user .msg__body {
  background: var(--white); box-shadow: var(--shadow-sm);
  border-radius: 22px 22px 6px 22px; padding: 11px 16px; flex: 0 1 auto; max-width: 80%;
}
.msg.is-streaming .msg__body::after {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); animation: pulse 1s infinite; margin-left: 4px;
}
.tool-call {
  display: inline-flex; align-items: center; gap: 8px; margin: 3px 6px 3px 0;
  padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent-ink);
}
.tool-call svg { width: 12px; height: 12px; color: var(--accent); }
.tool-call.is-running svg { animation: spin 1.2s linear infinite; }
.tool-call.is-err { background: var(--danger-dim); color: var(--danger-ink); }
.tool-call.is-err svg { color: var(--danger); }
.brain__composer { padding: 10px 0 18px; }
.composer {
  width: min(860px, 100%); margin: 0 auto; padding: 0 22px;
  display: flex; gap: 10px; align-items: flex-end;
}
.composer__box {
  flex: 1; background: var(--white); box-shadow: var(--shadow);
  border-radius: 28px; padding: 14px 20px; transition: box-shadow var(--t);
}
.composer__box:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--accent-line); }
.composer textarea {
  width: 100%; border: 0; background: none; outline: none; resize: none;
  font-size: 14.5px; line-height: 1.55; max-height: 200px; min-height: 22px;
}
.composer .btn { height: 52px; min-width: 52px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.suggest button {
  text-align: left; padding: 8px 15px; border-radius: 99px; font-size: 13px;
  background: rgba(255,255,255,.3); border: 1.5px solid var(--glass-border); color: var(--ink-2);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: background var(--t), color var(--t);
}
:root[data-theme="dark"] .suggest button { background: rgba(255,255,255,.05); }
.suggest button:hover { background: var(--card); color: var(--ink); }

/* ================= pipeline kanban ================= */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban__col {
  min-width: 260px; width: 260px; flex-shrink: 0;
  background: var(--panel); border-radius: 30px; box-shadow: var(--shadow); padding: 8px;
}
.kanban__head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.kanban__head .badge { box-shadow: none; background: var(--dark); color: var(--solid); }
.kanban__body {
  border-radius: 22px; padding: 2px; display: flex; flex-direction: column; gap: 8px;
  min-height: 120px; max-height: 64vh; overflow-y: auto;
  transition: background var(--t), box-shadow var(--t);
}
.kcard {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow-sm);
  padding: 12px 14px; cursor: grab;
  transition: transform var(--t), opacity var(--t), box-shadow var(--t);
  touch-action: manipulation; user-select: none;
}
.kcard:hover { transform: translateY(-2px); background: var(--white); }
.kcard:active { cursor: grabbing; }
.kanban__body.is-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-line); }
.kanban__empty {
  border: 1.5px dashed var(--line-2); border-radius: 18px;
  padding: 14px; text-align: center; font-size: 12px; color: var(--muted);
  display: none;
}
.kanban__body.is-empty .kanban__empty,
.kanban__body:not(:has(.kcard)) .kanban__empty { display: block; }
.kanban__body.is-over .kanban__empty { border-color: var(--accent); color: var(--accent-ink); }
.kcard.is-dragging { opacity: .35; transform: none; }
.kcard.is-moving { box-shadow: var(--shadow-sm), 0 0 0 2px var(--accent); }
.kcard--ghost {
  position: fixed; z-index: 400; pointer-events: none; opacity: .97; background: var(--solid);
  box-shadow: 0 22px 44px -14px rgba(0,0,0,.4); transform: rotate(2.5deg) scale(1.03);
}
.kanban__col--side { background: transparent; box-shadow: none; }
.kanban__col--side .kanban__body { min-height: 84px; background: var(--hatch-gray); }
.kanban__col--side .kanban__empty { background: var(--white); border-color: transparent; }
.kanban--compact .kanban__col { width: 200px; min-width: 200px; }
.kanban--compact .kcard { padding: 8px 10px; border-radius: 16px; }
.kanban--compact .kcard__title { font-size: 12px; }
.kanban--compact .kcard__meta { font-size: 10.5px; }
.kcard__title { font-weight: 500; font-size: 13.5px; line-height: 1.3; margin-bottom: 6px; }
.kcard__meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }

/* ================= funnel / bars ================= */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel__row { display: grid; grid-template-columns: 118px 1fr 62px; align-items: center; gap: 12px; font-size: 13px; }
.funnel__bar { height: 26px; border-radius: 999px; background: var(--hatch-gray); overflow: hidden; position: relative; }
.funnel__fill {
  height: 100%; border-radius: 999px;
  background: var(--hatch-accent); box-shadow: inset 0 0 0 1.5px var(--accent);
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}
.funnel__row:first-child .funnel__fill { background: var(--accent); }
.funnel__label { color: var(--ink-2); }
.funnel__val { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 60px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar-row .meter { height: 12px; }

.chart { width: 100%; height: 190px; }
.chart path.line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart path.line-2 { stroke: var(--info); }
.chart path.area { fill: url(#gOak); stroke: none; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 5; }
.chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }

/* ================= timeline / feed ================= */
.feed { display: flex; flex-direction: column; gap: 6px; }
.feed__row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; font-size: 13px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.feed__icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--white); display: grid; place-items: center; color: var(--muted);
}
.feed__icon svg { width: 14px; height: 14px; }
.feed__icon.ok { color: var(--ok); background: var(--ok-dim); }
.feed__icon.oak { color: var(--accent); background: var(--accent-soft); }
.feed__icon.info { color: var(--info); background: var(--info-dim); }
.feed__icon.danger { color: var(--danger); background: var(--danger-dim); }
.feed__text { flex: 1; min-width: 0; }
.feed__time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.facts { display: grid; gap: 10px; font-size: 13.5px; }
.fact { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.fact__k { color: var(--muted); font-size: 12.5px; }
.fact__v { font-weight: 500; text-align: right; }
.fact__v.muted { color: var(--muted); font-weight: 400; }

.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed var(--line-2); }
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: var(--muted); }
.stat-row .v { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ================= alerts ================= */
.alert {
  display: flex; gap: 10px; padding: 12px 16px; border-radius: 20px;
  font-size: 13px; line-height: 1.55; margin-bottom: 16px; align-items: flex-start; color: var(--ink);
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert--info   { background: var(--info-dim); }    .alert--info svg   { color: var(--info); }
.alert--warn   { background: var(--warn-dim); }    .alert--warn svg   { color: var(--warn); }
.alert--danger { background: var(--danger-dim); }  .alert--danger svg { color: var(--danger); }
.alert--ok     { background: var(--ok-dim); }      .alert--ok svg     { color: var(--ok); }
.alert--oak    { background: var(--accent-soft); align-items: center; } .alert--oak svg { color: var(--accent); }
.alert a { text-decoration: underline; text-underline-offset: 2px; }

/* ================= AI brief — hero karta ================= */
.brief {
  position: relative; overflow: hidden;
  background: var(--hero); color: #fff; border-radius: var(--r-xl); padding: 24px 26px;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 0 0 1px rgba(255,255,255,.12) inset, 0 24px 50px -22px rgba(1,148,113,.75);
}
.brief::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,.22), transparent 45%);
}
.brief > * { position: relative; z-index: 1; }
.brief__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.brief__head h3 { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: .02em; opacity: .9; }
.brief__head .muted { color: rgba(255,255,255,.75); }
.brief__head .btn--ghost { color: #fff; }
.brief__head .btn--ghost:hover { background: rgba(255,255,255,.18); }
.brief__headline { font-size: 22px; line-height: 1.3; margin-bottom: 16px; font-weight: 500; letter-spacing: -.01em; max-width: 900px; }
.brief__items { display: grid; gap: 8px; margin-bottom: 16px; }
.brief__item { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: rgba(255,255,255,.92); }
.brief__item svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; opacity: .8; }
.brief__rec {
  background: rgba(255,255,255,.16); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 12px 16px; border-radius: 20px; font-size: 13.5px; line-height: 1.6;
}
.brief .chip { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.28); color: #fff; }
.brief .chip:hover { background: rgba(255,255,255,.3); }

/* ================= misc ================= */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-4{margin-bottom:4px}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.gap-4{gap:4px}.gap-6{gap:6px}.gap-8{gap:8px}.gap-12{gap:12px}.gap-16{gap:16px}
.hidden { display: none !important; }

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--white) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 24px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-line { height: 12px; margin-bottom: 8px; border-radius: 99px; }

.code {
  background: var(--white); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line);
  padding: 12px 14px; font-family: var(--mono); font-size: 12px;
  color: var(--ink-2); overflow-x: auto; line-height: 1.65; white-space: pre-wrap; word-break: break-all;
}
.mailbox {
  background: #fffefd; color: #1b1f1e; border-radius: 22px; box-shadow: var(--shadow-sm);
  padding: 18px 22px; font-size: 14px; line-height: 1.7; white-space: pre-wrap;
  font-family: Georgia, 'Times New Roman', serif;
}
:root[data-theme="dark"] .mailbox { background: #1d2724; color: #e6eeeb; }

/* jemný nástup obsahu při přepnutí obrazovky */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.route > * { animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }
.route > *:nth-child(2) { animation-delay: .04s; }
.route > *:nth-child(3) { animation-delay: .08s; }
.route > *:nth-child(4) { animation-delay: .12s; }
.route > *:nth-child(n+5) { animation-delay: .16s; }

/* login */
.login { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px; }
.login__card {
  width: min(400px, 100%); background: var(--panel); border-radius: var(--r-xl); padding: 36px 32px 30px;
  box-shadow: var(--shadow); text-align: center;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); animation: pop .4s cubic-bezier(.2,.9,.25,1.1);
}
.login__logo { margin: 0 auto 10px !important; color: var(--ink); line-height: 0; }
.login__logo svg { width: 230px; max-width: 100%; height: auto; }
.login h1 { font-size: 30px; font-weight: 500; margin: 0 0 4px; letter-spacing: .06em; }
.login p { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.login .form__input { border-radius: 999px; height: 50px; text-align: center; }
.login__help { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.login__help a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

/* mapa */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.map-cell {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-sm);
  padding: 12px 14px 14px; cursor: pointer; transition: transform var(--t), background var(--t); position: relative; overflow: hidden;
}
.map-cell:hover { transform: translateY(-2px); background: var(--white); }
.map-cell__bar { position: absolute; left: 14px; bottom: 8px; height: 4px; border-radius: 99px; background: var(--accent); max-width: calc(100% - 28px); }
.map-cell__name { font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.map-cell__n { font-size: 22px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 3px; }
.map-cell__sub { font-size: 11.5px; color: var(--muted); }

/* ================= glass vrstva ================= */
.card, .kpi, .btn, .icon-btn, .search, .tabs, .toolbar__search, .kanban__col, .kcard, .feed__row, .map-cell, .tag, .badge, .composer__box {
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}

/* ================= responsive ================= */
@media (max-width: 1280px) {
  .grid--5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid--sidebar, .grid--main { grid-template-columns: minmax(0,1fr); }
  .page-head h1 { font-size: 38px; }
}
@media (max-width: 980px) {
  #app, #app.rail-collapsed { grid-template-columns: minmax(0,1fr); }
  .sidebar {
    position: fixed; left: 10px; top: 10px; bottom: 10px; height: auto; z-index: 90;
    width: 270px; max-width: calc(100vw - 20px); transform: translateX(calc(-100% - 20px));
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
    background: rgba(240,245,243,.9); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
    border-radius: var(--r-xl); box-shadow: var(--shadow-pop);
  }
  :root[data-theme="dark"] .sidebar { background: rgba(18,27,24,.94); }
  .sidebar.is-open { transform: none; }
  .sidebar .sidebar__close { display: inline-grid; }
  .rail-toggle { display: none; }
  .topbar .topbar__menu { display: inline-grid; }
  .sidebar-bd { position: fixed; inset: 0; background: rgba(8,20,16,.4); z-index: 89; backdrop-filter: blur(3px); }
  .sidebar-bd[hidden] { display: none; }
  .route { padding: 12px 16px 70px; }
  .topbar { padding: 12px 16px 8px; gap: 8px; }
  .search { min-height: 46px; }
  .grid--3, .grid--4, .grid--5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid--2 { grid-template-columns: minmax(0,1fr); }
  .modal { padding: 0; place-items: end stretch; }
  .modal__panel, .modal__panel--lg, .modal__panel--xl { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 28px 28px 0 0; }
  .drawer__panel { right: 0; top: 0; bottom: 0; width: 100%; border-radius: 0; }
  .page-head h1 { font-size: 32px; }
}
@media (max-width: 620px) {
  .grid--3, .grid--5 { grid-template-columns: minmax(0,1fr); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .kpi { padding: 13px 14px 12px; border-radius: 20px; }
  .kpi__label { font-size: 11.5px; }
  .kpi__sub { font-size: 11px; }
  .brief__headline { font-size: 18px; }
  .search { padding-left: 14px; }
  .page-head h1 { font-size: 28px; }
  .kpi__value { font-size: 24px; }
  .search kbd, .topbar__right .hide-m { display: none; }
  .search input { font-size: 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .form__row--2, .form__row--3 { grid-template-columns: 1fr; }
  table.tbl { min-width: 620px; }
  .funnel__row { grid-template-columns: 92px 1fr 48px; }
  .bar-row { grid-template-columns: 100px 1fr 48px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { border-radius: 22px; }
  .card__head { padding: 16px 16px 4px; }
  .card__body { padding: 12px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .toasts { display: none !important; }
  #app { display: block; }
  body::before { display: none; }
}
