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

/* BAZA design system v2 — сгенерировано из tokens.json + bundle.css. Подключать один раз в base.html */

:root, [data-theme="light"] {
  --surface-000: #ffffff;
  --surface-100: #f4f6f9;
  --surface-200: #e9edf2;
  --line: #dce2e9;
  --line-control: #7c8899;
  --ink: #0f1b2a;
  --ink-muted: #4a5868;
  --accent: #d23f0c;
  --accent-hover: #b3350a;
  --on-accent: #ffffff;
  --accent-soft: #fdebe3;
  --accent-text: #a3300a;
  --info: #1f5fd6;
  --info-soft: #e6efff;
  --info-text: #1a4fb3;
  --success: #0b7a50;
  --success-soft: #def5ea;
  --success-text: #07603e;
  --warning: #a65b00;
  --warning-soft: #fff1d6;
  --warning-text: #8a4b00;
  --danger: #c8243a;
  --danger-soft: #fde6e9;
  --danger-text: #a51c30;
  --sidebar-bg: #1b2a3a;
  --sidebar-item-active: #2a3c50;
  --sidebar-text: #b9c6d4;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #ff7a45;
  --shadow-card: 0 1px 2px rgba(15, 27, 42, 0.06), 0 2px 6px rgba(15, 27, 42, 0.05);
  --shadow-hover: 0 4px 14px rgba(15, 27, 42, 0.10);
  --shadow-pop: 0 16px 40px rgba(15, 27, 42, 0.18);
  --shadow-button: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(15, 27, 42, 0.18);
}
[data-theme="dark"] {
  --surface-000: #152030;
  --surface-100: #0d1520;
  --surface-200: #1d2a3b;
  --line: #2a3a4f;
  --line-control: #6d7d92;
  --ink: #eef2f7;
  --ink-muted: #9eacbd;
  --accent: #ff7a45;
  --accent-hover: #ff9466;
  --on-accent: #1a0c05;
  --accent-soft: #3a1f14;
  --accent-text: #ffa37d;
  --info: #6f9dff;
  --info-soft: #172a4d;
  --info-text: #9dbcff;
  --success: #3fcf8e;
  --success-soft: #10331f;
  --success-text: #6fe0a8;
  --warning: #f0a83a;
  --warning-soft: #3a2a10;
  --warning-text: #f6c26b;
  --danger: #ff6b7d;
  --danger-soft: #3d1820;
  --danger-text: #ff9aa7;
  --sidebar-bg: #09101a;
  --sidebar-item-active: #1a2636;
  --sidebar-text: #a5b3c3;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #ff7a45;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-button: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.5);
}
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --font-sans: Manrope, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
}

/* Базовые стили страницы */
html, body { margin: 0; background: var(--surface-100); }
body { font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
.bz-app { display: flex; min-height: 100vh; }
.bz-app > .bz-sidebar { position: sticky; top: 0; height: 100vh; flex: none; overflow-y: auto; }
.bz-main { flex: 1; min-width: 0; padding: var(--space-6); }
.bz-h1 { font-size: 26px; line-height: 32px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
a { color: var(--accent); }

/* BAZA v2 — компонентные стили. Все значения — через токены из tokens.css. */

.bz, .bz * { box-sizing: border-box; }
.bz {
  font-family: var(--font-sans);
  font-size: 14px; line-height: 20px; font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
.bz-page { background: var(--surface-100); padding: var(--space-5); }
.bz-muted { color: var(--ink-muted); }
.bz-mono { font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 600; }
.bz-label { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.bz-h2 { font-size: 17px; line-height: 24px; font-weight: 700; margin: 0; }
.bz-ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bz :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Button ---------- */
.bz-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 40px; padding: 0 18px;
  font: 700 14px/20px var(--font-sans);
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.bz-btn:active { transform: translateY(1px) scale(.98); }
.bz-btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-button); }
.bz-btn--primary:hover { background: var(--accent-hover); }
.bz-btn--secondary { background: var(--surface-000); color: var(--ink); border-color: var(--line-control); box-shadow: var(--shadow-card); }
.bz-btn--secondary:hover { border-color: var(--ink); }
.bz-btn--dark { background: var(--ink); color: var(--surface-000); }
.bz-btn--dark:hover { opacity: .9; }
.bz-btn--text { background: transparent; color: var(--accent); padding: 0 10px; }
.bz-btn--text:hover { background: var(--accent-soft); color: var(--accent-text); }
.bz-btn--danger { background: var(--danger-soft); color: var(--danger-text); }
.bz-btn--danger:hover { background: var(--danger); color: var(--surface-000); }
.bz-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.bz-btn--lg { height: 48px; padding: 0 24px; font-size: 15px; }
.bz-btn--icon { width: 40px; padding: 0; }
.bz-btn--icon.bz-btn--sm { width: 32px; }
.bz-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.bz-btn__count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--on-accent); color: var(--accent); font-size: 12px; line-height: 20px; font-weight: 800; }
.bz-btn--secondary .bz-btn__count { background: var(--accent); color: var(--on-accent); }
.bz-kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-sm); font: 600 11px/1 var(--font-mono); border: 1px solid currentColor; opacity: .7; }
.bz-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: bz-spin .7s linear infinite; }
@keyframes bz-spin { to { transform: rotate(360deg); } }
.bz-split { display: inline-flex; }
.bz-split > .bz-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bz-split > .bz-btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; width: 36px; padding: 0; border-left: 1px solid rgba(255,255,255,.35); }

/* ---------- Segmented ---------- */
.bz-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-200); border-radius: var(--radius-md); }
.bz-seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-muted); font: 700 13px/1 var(--font-sans); cursor: pointer; }
.bz-seg button:hover { color: var(--ink); }
.bz-seg button.is-active { background: var(--surface-000); color: var(--ink); box-shadow: var(--shadow-card); }

/* ---------- Input ---------- */
.bz-field { display: flex; flex-direction: column; gap: 6px; }
.bz-field__label { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink); }
.bz-field__hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.bz-input {
  height: 40px; padding: 0 var(--space-3); width: 100%;
  font: 600 14px/20px var(--font-sans); color: var(--ink);
  background: var(--surface-000);
  border: 1px solid var(--line-control); border-radius: var(--radius-md);
  transition: border-color .15s, box-shadow .15s;
}
.bz-input::placeholder { color: var(--ink-muted); font-weight: 500; }
.bz-input:hover { border-color: var(--ink-muted); }
.bz-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bz-input--num { width: 80px; text-align: center; font-weight: 800; }
.bz-input--error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.bz-field__error { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--danger); }
.bz-inputwrap { position: relative; display: flex; align-items: center; }
.bz-inputwrap > .bz-ico { position: absolute; left: 12px; color: var(--ink-muted); pointer-events: none; }
.bz-inputwrap > .bz-kbd { position: absolute; right: 10px; color: var(--ink-muted); }
.bz-inputwrap > .bz-input { padding-left: 38px; padding-right: 56px; }
.bz-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-control); border-radius: var(--radius-md); background: var(--surface-000); overflow: hidden; }
.bz-stepper button { width: 32px; height: 38px; border: 0; background: transparent; color: var(--ink); font: 800 16px/1 var(--font-sans); cursor: pointer; }
.bz-stepper button:hover { background: var(--surface-200); }
.bz-stepper input { width: 44px; height: 38px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: 800 14px/1 var(--font-sans); color: var(--ink); background: transparent; }

/* ---------- Badge ---------- */
.bz-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: 12px; line-height: 16px; font-weight: 700; white-space: nowrap;
}
.bz-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bz-badge--live::before { animation: bz-pulse 1.6s ease-out infinite; }
@keyframes bz-pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70%, 100% { box-shadow: 0 0 0 5px transparent; } }
.bz-badge--neutral { background: var(--surface-200); color: var(--ink-muted); }
.bz-badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.bz-badge--info { background: var(--info-soft); color: var(--info-text); }
.bz-badge--success { background: var(--success-soft); color: var(--success-text); }
.bz-badge--warning { background: var(--warning-soft); color: var(--warning-text); }
.bz-badge--danger { background: var(--danger-soft); color: var(--danger-text); }

/* ---------- Card / StatCard ---------- */
.bz-card { background: var(--surface-000); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.bz-card--hover { transition: box-shadow .2s, transform .2s; }
.bz-card--hover:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.bz-stat { padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bz-stat__top { display: flex; justify-content: space-between; align-items: center; }
.bz-stat__icon { width: 34px; height: 34px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); }
.bz-stat__value { font-size: 30px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em; }
.bz-stat__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-2); }
.bz-stat__meta { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.bz-delta { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 800; }
.bz-delta--up { background: var(--success-soft); color: var(--success-text); }
.bz-delta--down { background: var(--danger-soft); color: var(--danger-text); }
.bz-spark { width: 96px; height: 32px; flex: none; }
.bz-spark polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bz-spark .area { opacity: .14; stroke: none; }

/* ---------- Progress ---------- */
.bz-progress { height: 8px; border-radius: var(--radius-pill); background: var(--surface-200); overflow: hidden; }
.bz-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .4s; }
.bz-progress--warn > span { background: var(--warning); }
.bz-progress--danger > span { background: var(--danger); }

/* ---------- Table ---------- */
.bz-table-wrap { overflow: hidden; }
.bz-table-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bz-table { width: 100%; border-collapse: collapse; }
.bz-table th {
  position: sticky; top: 0; text-align: left; padding: 10px 14px;
  font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); background: var(--surface-100);
  border-bottom: 1px solid var(--line);
}
.bz-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.bz-table tbody tr { transition: background-color .12s; }
.bz-table tbody tr:hover td { background: var(--surface-100); }
.bz-table .num { text-align: right; }
.bz-table .center { text-align: center; }
.bz-table tfoot td { background: var(--surface-200); font-weight: 800; border-bottom: 0; }
.bz-table tr.is-selected td { background: var(--accent-soft); }
.bz-table tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.bz-thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--surface-200); border: 1px solid var(--line); display: block; object-fit: cover; }
.bz-need { display: inline-flex; min-width: 32px; height: 28px; padding: 0 8px; align-items: center; justify-content: center; border-radius: var(--radius-pill); font-weight: 800; }
.bz-need--zero { background: var(--success-soft); color: var(--success-text); }
.bz-need--pos { background: var(--danger-soft); color: var(--danger-text); }
.bz-rowactions { opacity: 0; transition: opacity .12s; }
.bz-table tr:hover .bz-rowactions { opacity: 1; }

/* ---------- Sidebar ---------- */
.bz-sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.bz-sidebar__logo { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text-active); font-weight: 800; font-size: 19px; letter-spacing: .04em; padding: 4px 10px 18px; }
.bz-sidebar__mark { width: 30px; height: 30px; border-radius: 9px; background: var(--sidebar-accent); color: var(--sidebar-bg); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; }
.bz-sidebar__search { display: flex; align-items: center; gap: 8px; height: 36px; margin: 0 2px 10px; padding: 0 10px; border-radius: var(--radius-md); background: var(--sidebar-item-active); color: var(--sidebar-text); font-size: 13px; }
.bz-sidebar__search .bz-kbd { margin-left: auto; }
.bz-sidebar__group { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sidebar-text); padding: 16px 12px 6px; }
.bz-nav { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius-md); color: var(--sidebar-text); text-decoration: none; font-weight: 600; transition: background-color .12s, color .12s; }
.bz-nav:hover { background: var(--sidebar-item-active); color: var(--sidebar-text-active); }
.bz-nav.is-active { background: var(--sidebar-item-active); color: var(--sidebar-text-active); }
.bz-nav.is-active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; background: var(--sidebar-accent); border-radius: 0 4px 4px 0; }
.bz-nav.is-active .bz-ico { color: var(--sidebar-accent); }
.bz-nav__count { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--sidebar-accent); color: var(--sidebar-bg); font-size: 12px; line-height: 22px; font-weight: 800; text-align: center; }
.bz-sidebar__user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-md); background: var(--sidebar-item-active); color: var(--sidebar-text-active); font-weight: 700; font-size: 13px; }
.bz-sidebar__user small { display: block; color: var(--sidebar-text); font-weight: 600; font-size: 12px; }

/* ---------- Avatar ---------- */
.bz-avatar { width: 26px; height: 26px; border-radius: var(--radius-pill); background: var(--info-soft); color: var(--info-text); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface-000); }
.bz-avatar--accent { background: var(--accent-soft); color: var(--accent-text); }
.bz-avatars { display: inline-flex; }
.bz-avatars .bz-avatar + .bz-avatar { margin-left: -8px; }

/* ---------- Kanban ---------- */
.bz-kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.bz-col { background: var(--surface-200); border-radius: var(--radius-lg); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.bz-col__head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 2px; font-weight: 800; }
.bz-col__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-control); }
.bz-col--progress .bz-col__dot { background: var(--warning); }
.bz-col--done .bz-col__dot { background: var(--success); }
.bz-col__count { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--surface-000); color: var(--ink-muted); font-size: 12px; line-height: 22px; text-align: center; }
.bz-task { background: var(--surface-000); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-card); cursor: grab; transition: box-shadow .2s, transform .2s; }
.bz-task:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.bz-task__title { font-weight: 700; }
.bz-task__foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); }
.bz-col__add { height: 36px; border: 1px dashed var(--line-control); border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); font: 700 13px/1 var(--font-sans); cursor: pointer; }
.bz-col__add:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Priority ---------- */
.bz-priority { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.bz-priority__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.bz-priority__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bz-priority__num { padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-100); }
.bz-priority__num b { display: block; font-size: 22px; line-height: 28px; font-weight: 800; }
.bz-priority__num--danger { background: var(--danger-soft); color: var(--danger-text); }
.bz-priority__num--success { background: var(--success-soft); color: var(--success-text); }
.bz-priority__num span { font-size: 12px; font-weight: 700; }
.bz-stack { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-200); gap: 2px; }
.bz-stack > span { display: block; height: 100%; }

/* ---------- Command palette ---------- */
.bz-cmd { width: 560px; max-width: 100%; background: var(--surface-000); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.bz-cmd__input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.bz-cmd__input input { flex: 1; border: 0; outline: 0; background: transparent; font: 600 15px/1 var(--font-sans); color: var(--ink); }
.bz-cmd__group { padding: 10px 16px 4px; }
.bz-cmd__item { display: flex; align-items: center; gap: 12px; margin: 0 8px; padding: 10px; border-radius: var(--radius-md); font-weight: 600; }
.bz-cmd__item .bz-kbd { margin-left: auto; color: var(--ink-muted); }
.bz-cmd__item.is-active { background: var(--accent-soft); color: var(--accent-text); }
.bz-cmd__foot { display: flex; gap: 16px; padding: 10px 16px; margin-top: 8px; border-top: 1px solid var(--line); background: var(--surface-100); font-size: 12px; font-weight: 600; color: var(--ink-muted); }

/* ---------- Toast ---------- */
.bz-toast { display: flex; align-items: flex-start; gap: 12px; width: 380px; max-width: 100%; padding: 14px 14px 14px 16px; background: var(--surface-000); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: bz-in .25s ease-out; }
@keyframes bz-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bz-toast__icon { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.bz-toast--success .bz-toast__icon { background: var(--success-soft); color: var(--success-text); }
.bz-toast--danger .bz-toast__icon { background: var(--danger-soft); color: var(--danger-text); }
.bz-toast__body { flex: 1; min-width: 0; }
.bz-toast__title { font-weight: 800; }
.bz-toast__text { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

/* ---------- Login ---------- */
.bz-login { width: 380px; padding: 36px; display: flex; flex-direction: column; gap: 18px; }
.bz-login__logo { display: flex; align-items: center; gap: 12px; font-size: 30px; line-height: 36px; font-weight: 800; letter-spacing: .02em; margin: 0; }
.bz-login__logo .bz-sidebar__mark { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; background: var(--accent); color: var(--on-accent); }
