/* Finance Bot dashboard styles — mobile-first */
:root {
  --bg: #F7F7FB;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #737391;
  --text-muted: #9999B5;
  --accent: #6B5CFF;
  --accent-2: #8E7FFF;
  --error: #E54848;
  --warning: #F0A02E;
  --shadow: 0 2px 12px rgba(20, 20, 50, 0.05);
  --radius: 20px;
  --radius-sm: 14px;
  /* Поверхности и границы — для тёмной темы переопределяются */
  --hover-bg: #F4F4FA;
  --active-bg: #EEECFC;
  --tag-bg: #F2F2F8;
  --divider: #EFEFF7;
  --border-soft: #F4F4FA;
  --border-mid: #E4E4EE;
  --border-dotted: #EBEBF5;
  --date-row-bg: #FAFAFE;
  --modal-overlay: rgba(20, 20, 50, 0.5);
}

[data-theme="dark"] {
  --bg: #0F0F18;
  --card: #1B1B2E;
  --text: #F2F2F8;
  --text-secondary: #B0B0CC;
  --text-muted: #7A7A95;
  --accent: #8E7FFF;
  --accent-2: #A89BFF;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --hover-bg: #25253D;
  --active-bg: #2E2E4A;
  --tag-bg: #2A2A40;
  --divider: #25253D;
  --border-soft: #25253D;
  --border-mid: #2E2E4A;
  --border-dotted: #2A2A40;
  --date-row-bg: #1F1F35;
  --modal-overlay: rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.field input {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
}
.btn-primary {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  background: linear-gradient(135deg, #6B5CFF 0%, #8E7FFF 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-top: 4px;
}
.btn-primary:hover  { opacity: 0.92; }
.btn-primary:active { opacity: 0.85; }

/* === Modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
@media (min-width: 520px) {
  .modal-backdrop { align-items: center; }
}
.modal-card {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 24px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease-out;
}
@media (min-width: 520px) {
  .modal-card { border-radius: var(--radius); }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0.5; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-header {
  margin-bottom: 16px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--tag-bg);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-tabs .tab {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.modal-tabs .tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.modal-tabs .tab span {
  display: block;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.modal-tabs .tab-credit input:checked ~ span {
  background: #E6F8EC;
  color: #2BAA52;
}
.modal-tabs .tab-debit input:checked ~ span {
  background: #FFE8E8;
  color: var(--error);
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.modal-actions button {
  flex: 1;
}
.btn-secondary {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  background: var(--tag-bg);
  color: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-secondary:hover { background: #E8E8F0; }

/* select в модалке правки категории */
.tx-info-select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.tx-info-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.tx-info-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
}

/* === Модалка с полной информацией о транзакции === */

.tx-info-card { padding: 22px 20px 20px; }
.tx-info-amount {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.tx-info-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.tx-info-section {
  margin-bottom: 14px;
}
.tx-info-section:last-of-type { margin-bottom: 8px; }
.tx-info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.tx-info-value {
  font-size: 15px;
  color: var(--text);
  word-wrap: break-word;
}
.tx-info-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.tx-info-purpose { line-height: 1.45; }
.tx-info-actions { justify-content: flex-end; }
.tx-info-actions .btn-primary {
  flex: 0 0 auto;
  padding: 10px 28px;
}

/* ============================================================= */
/* Fin_Brain v0.2 — Dark Terminal (новый дизайн)                  */
/* ============================================================= */
:root {
  --fb-bg: #FAFBFC;
  --fb-surface: #FFFFFF;
  --fb-surface-2: #F1F3F5;
  --fb-sidebar: #F2F4F6;
  --fb-text: #0A0B0E;
  --fb-muted: #6B7280;
  --fb-border: #E5E7EB;
  --fb-accent: #4D7C0F;
  --fb-accent-fg: #FFFFFF;
  --fb-income: #4D7C0F;
  --fb-expense: #DC2626;
  --fb-tag-neutral-bg: #EFF1F3; --fb-tag-neutral-fg: #475569;
  --fb-tag-signal-bg:  #E9FBD6; --fb-tag-signal-fg:  #3F6212;
  --fb-tag-alarm-bg:   #FEE2E2; --fb-tag-alarm-fg:   #DC2626;
  --fb-tag-warning-bg: #FEF3C7; --fb-tag-warning-fg: #A16207;
  --fb-tag-bank-bg:    #FEF3C7; --fb-tag-bank-fg:    #A16207;
  --fb-chart-1: #4D7C0F; --fb-chart-2: #2563EB; --fb-chart-3: #A16207; --fb-chart-4: #475569;
  --fb-radius-sm: 8px; --fb-radius: 10px; --fb-radius-lg: 14px;
  --fb-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fb-font-body: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fb-font-longform: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
[data-theme="dark"] {
  --fb-bg: #0A0B0E;
  --fb-surface: #14161C;
  --fb-surface-2: #1C1F27;
  --fb-sidebar: #0E1015;
  --fb-text: #F4F6FB;
  --fb-muted: #8A90A2;
  --fb-border: #232733;
  --fb-accent: #B6FF3C;
  --fb-accent-fg: #0A0B0E;
  --fb-income: #B6FF3C;
  --fb-expense: #FB5C5C;
  --fb-tag-neutral-bg: #1E2330; --fb-tag-neutral-fg: #9CA3AF;
  --fb-tag-signal-bg:  #1F3300; --fb-tag-signal-fg:  #B6FF3C;
  --fb-tag-alarm-bg:   #3B1518; --fb-tag-alarm-fg:   #FB5C5C;
  --fb-tag-warning-bg: #2A2207; --fb-tag-warning-fg: #FBBF24;
  --fb-tag-bank-bg:    #2A2207; --fb-tag-bank-fg:    #FBBF24;
  --fb-chart-1: #B6FF3C; --fb-chart-2: #6BA6FF; --fb-chart-3: #FBBF24; --fb-chart-4: #9CA3AF;
}

body {
  background: var(--fb-bg);
  color: var(--fb-text);
  font-family: var(--fb-font-body);
}
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: 0 0 auto; }

/* === App shell === */
.app { min-height: 100vh; }
.content { max-width: 520px; margin: 0 auto; padding: 20px 16px 100px; }
.sidebar { display: none; }

/* mobile bottom nav */
.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--fb-bg) 72%, transparent);
}
.mobile-nav-pill {
  display: flex; gap: 4px; width: 100%; max-width: 360px; height: 62px; padding: 4px;
  border-radius: 36px; background: var(--fb-surface); border: 1px solid var(--fb-border);
}
.mnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 26px; text-decoration: none; color: var(--fb-muted);
  font: 600 10px/1 var(--fb-font-body); letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
}
.mnav-active { background: var(--fb-accent); color: var(--fb-accent-fg); }

@media (min-width: 1024px) {
  .app { display: flex; align-items: flex-start; }
  .sidebar {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 264px; min-height: 100vh; position: sticky; top: 0; flex: 0 0 264px;
    background: var(--fb-sidebar); border-right: 1px solid var(--fb-border); padding: 20px;
  }
  .app-main { flex: 1; min-width: 0; }
  .content { max-width: 1140px; margin: 0 auto; padding: 36px; }
  .mobile-nav { display: none; }
}

/* === Sidebar === */
.sidebar-top { display: flex; flex-direction: column; gap: 24px; }
.sidebar-logo { display: flex; align-items: baseline; gap: 6px; padding: 4px 8px; }
.logo-word { font: 700 20px var(--fb-font-mono); color: var(--fb-text); }
.logo-ver { font: 400 10px var(--fb-font-body); color: var(--fb-muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px;
  border-radius: var(--fb-radius-sm); color: var(--fb-muted); text-decoration: none;
  font: 600 14px var(--fb-font-body); background: none; border: none; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--fb-surface-2); color: var(--fb-text); }
.nav-active { background: var(--fb-surface-2); color: var(--fb-text); }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; }
.sidebar-divider { height: 1px; background: var(--fb-border); margin-bottom: 4px; }
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline-block; }
[data-theme="dark"] .theme-icon-sun { display: inline-block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* === Page header (home) === */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.greet-block { display: none; }
.greet-name { font: 700 22px var(--fb-font-mono); color: var(--fb-text); }
.greet-sub { font: 400 13px var(--fb-font-longform); color: var(--fb-muted); margin-top: 2px; }
.head-logo { display: flex; align-items: baseline; gap: 6px; }
.head-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--fb-radius-sm); background: var(--fb-surface); border: 1px solid var(--fb-border);
  color: var(--fb-muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--fb-text); }
/* Плавающая кнопка темы (верх-право) для экранов без своей шапки. На десктопе
   тему даёт сайдбар → скрываем; модалки (z-index 100) её перекрывают. */
.topbar-theme {
  position: fixed; z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 14px); right: 16px;
}
@media (min-width: 1024px) {
  .greet-block { display: block; }
  .greet-name { font-size: 26px; }
  .head-logo { display: none; }
  .topbar-theme { display: none; }
}

/* === Balance card === */
.balance-card { background: var(--fb-accent); color: var(--fb-accent-fg); border-radius: var(--fb-radius-lg); padding: 20px; margin-bottom: 18px; }
.balance-label { font: 400 12px var(--fb-font-mono); color: var(--fb-accent-fg); opacity: .85; }
.balance-amount { font: 700 34px var(--fb-font-mono); color: var(--fb-accent-fg); margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.balance-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.balance-upd { font: 400 12px var(--fb-font-longform); color: var(--fb-accent-fg); opacity: .8; }
.btn-refresh-fb {
  display: inline-flex; align-items: center; gap: 6px; background: var(--fb-surface); color: var(--fb-text);
  border: none; border-radius: var(--fb-radius-sm); padding: 7px 12px; font: 600 12px var(--fb-font-body); cursor: pointer;
}
.btn-refresh-fb .ic { width: 14px; height: 14px; }
.btn-refresh-fb.htmx-request .ic { animation: spin .6s linear infinite; }
@media (min-width: 1024px) {
  .balance-card { padding: 28px; }
  .balance-label { font-size: 14px; }
  .balance-amount { font-size: 48px; margin: 8px 0 16px; }
}

/* === Donut card === */
.donut-card { background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-lg); padding: 18px; margin-bottom: 24px; }
.donut-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.donut-title { font: 700 15px var(--fb-font-body); color: var(--fb-text); }
.donut-date { font: 400 12px var(--fb-font-body); color: var(--fb-muted); }
.donut-body { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.donut-chart { width: 160px; height: 160px; flex: 0 0 auto; position: relative; }
.donut-svg { transform: rotate(-90deg); display: block; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center-num { font: 700 28px var(--fb-font-mono); color: var(--fb-text); line-height: 1; }
.donut-center-lbl { font: 400 11px var(--fb-font-body); color: var(--fb-muted); margin-top: 2px; }
.donut-legend { flex: 1; min-width: 200px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.legend-row + .legend-row { border-top: 1px solid var(--fb-border); }
.legend-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; font: 400 13px var(--fb-font-body); color: var(--fb-text); overflow: hidden; }
.legend-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend-val { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; flex: 0 0 auto; }
.legend-pct { font: 700 13px var(--fb-font-mono); color: var(--fb-text); }
.legend-sum { font: 400 12px var(--fb-font-mono); color: var(--fb-muted); }
@media (min-width: 1024px) {
  .donut-card { padding: 24px; }
  .donut-body { gap: 36px; flex-wrap: nowrap; }
  .donut-chart { width: 190px; height: 190px; }
  .donut-center-num { font-size: 34px; }
}

/* === Section title === */
.section-head { font: 700 12px var(--fb-font-body); color: var(--fb-muted); letter-spacing: 1.2px; margin: 0 0 14px 2px; }

/* === Venue grid + card === */
/* minmax(0, 1fr): трек не разрастается до min-content широких рядов (теги «смена
   открыта» + сумма nowrap) → грид не вылезает за контейнер и не делает страницу
   шире вьюпорта (иначе balance/donut выглядели уже, чем venue-карточки). */
.venue-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.venue-card { background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); padding: 16px; }
.venue-title { font: 700 17px var(--fb-font-mono); color: var(--fb-text); margin-bottom: 6px; }
.venue-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
a.venue-row { text-decoration: none; border-radius: 8px; margin: 0 -8px; padding: 6px 8px; -webkit-tap-highlight-color: transparent; }
a.venue-row:hover { background: var(--fb-surface-2); }
.venue-row-label { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.venue-row-name { font: 400 14px var(--fb-font-body); color: var(--fb-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.venue-row-name.muted { color: var(--fb-muted); }
.venue-row-val { display: flex; align-items: center; gap: 8px; white-space: nowrap; flex: 0 0 auto; }
.venue-amt { font: 600 15px var(--fb-font-mono); color: var(--fb-text); font-variant-numeric: tabular-nums; }
.venue-amt.income { color: var(--fb-income); }
.venue-amt.expense { color: var(--fb-expense); }
.venue-amt.error { color: var(--fb-expense); }
.venue-amt.dash { color: var(--fb-muted); font-weight: 400; }
.venue-arrow { font: 400 18px var(--fb-font-body); color: var(--fb-muted); line-height: 1; }
.venue-divider { height: 1px; background: var(--fb-border); margin: 6px 0; }

/* Таблица отчётов/прогонов в карточке заведения (Анализ конкурентов) */
.runs-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.runs-table { width: 100%; border-collapse: collapse; }
.runs-table th { text-align: left; font: 500 10px var(--fb-font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--fb-muted); padding: 4px 6px; border-bottom: 1px solid var(--fb-border); white-space: nowrap; }
.runs-table th:last-child, .runs-table td:last-child { text-align: right; }
.runs-table td { font: 400 13px var(--fb-font-body); color: var(--fb-text); padding: 7px 6px; border-bottom: 1px solid var(--fb-border); white-space: nowrap; vertical-align: middle; }
.runs-table tr:last-child td { border-bottom: none; }
.runs-table a.rt-date { color: var(--fb-text); text-decoration: none; }
.runs-table a.rt-date:hover { color: var(--fb-accent); }
.rt-na { color: var(--fb-muted); font: 400 12px var(--fb-font-mono); }

.venue-total-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.venue-total-label { font: 400 13px var(--fb-font-longform); color: var(--fb-muted); }
.venue-total-amt { font: 700 22px var(--fb-font-mono); color: var(--fb-text); font-variant-numeric: tabular-nums; }
.venue-total-amt.income { color: var(--fb-income); }
.venue-total-amt.expense { color: var(--fb-expense); }
.venue-add-row { padding: 6px 0 2px; }
.btn-add-op {
  display: inline-flex; align-items: center; background: none; border: 1px solid var(--fb-muted); color: var(--fb-muted);
  border-radius: var(--fb-radius-sm); padding: 5px 10px; font: 400 12px var(--fb-font-body); cursor: pointer;
}
.btn-add-op:hover { color: var(--fb-text); border-color: var(--fb-text); }
@media (min-width: 1024px) {
  .venue-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
  .venue-card { padding: 20px; }
}

/* === Tags (Dark Terminal) === */
.tag { display: inline-flex; align-items: center; border-radius: var(--fb-radius-sm); padding: 3px 9px; font: 600 11px var(--fb-font-body); white-space: nowrap; flex: 0 0 auto; }
.tag-neutral { background: var(--fb-tag-neutral-bg); color: var(--fb-tag-neutral-fg); }
.tag-signal  { background: var(--fb-tag-signal-bg);  color: var(--fb-tag-signal-fg); }
.tag-bank    { background: var(--fb-tag-bank-bg);    color: var(--fb-tag-bank-fg); }
.tag-warning { background: var(--fb-tag-warning-bg); color: var(--fb-tag-warning-fg); }
.tag-alarm   { background: var(--fb-tag-alarm-bg);   color: var(--fb-tag-alarm-fg); }

/* Индикатор прогона «Анализ конкурентов»: вращающаяся иконка (переиспользует @keyframes spin выше) */
.fb-spin { animation: spin 0.8s linear infinite; }
.tag .ic { width: 12px; height: 12px; margin-right: 4px; }

/* === Detail screens: назад / заголовок / header-карточка === */
.back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--fb-surface);
  border: 1px solid var(--fb-border); color: var(--fb-text); border-radius: var(--fb-radius-sm);
  padding: 8px 12px; font: 600 13px var(--fb-font-body); cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:hover { background: var(--fb-surface-2); }
.back-btn .ic { width: 16px; height: 16px; }
.back-spacer { flex: 1; }
.screen-title { font: 700 20px var(--fb-font-mono); color: var(--fb-text); margin: 0 0 16px; }

.detail-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--fb-surface-2); border: 1px solid var(--fb-accent); border-radius: var(--fb-radius-lg);
  padding: 22px; margin-bottom: 18px;
}
.detail-card.plain { background: var(--fb-surface); border-color: var(--fb-border); }
.comp-service-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; font-weight: 600; }
.comp-service-row form { margin: 0; text-align: right; }
.comp-service-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px; border: 0; border-radius: 8px; background: transparent; color: var(--fb-text); font: inherit; cursor: pointer; }
.comp-service-switch:hover { background: var(--fb-surface-2); }
.comp-service-switch:focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 4px; }
.comp-service-switch:disabled { opacity: .5; cursor: wait; }
.comp-switch-track { display: inline-flex; align-items: center; width: 44px; height: 26px; padding: 3px; border-radius: 13px; background: var(--fb-muted); }
.comp-switch-track::before { content: ''; width: 20px; height: 20px; border-radius: 50%; background: var(--fb-surface); }
.comp-service-switch[aria-checked="true"] .comp-switch-track { background: var(--fb-accent); }
.comp-service-switch[aria-checked="true"] .comp-switch-track::before { transform: translateX(18px); background: var(--fb-accent-fg); }
.comp-service-hint { flex-basis: 100%; margin: -8px 0 0; color: var(--fb-muted); font-size: 13px; }
.comp-service-error:not([hidden]) { display: block; max-width: 240px; color: var(--fb-expense); font-size: 13px; }
#comp-live .btn-primary-fb:disabled { opacity: .55; cursor: not-allowed; }
.detail-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail-name { font: 700 18px var(--fb-font-mono); color: var(--fb-text); }
.detail-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-acc { font: 400 12px var(--fb-font-mono); color: var(--fb-muted); }
.detail-amount { font: 700 32px var(--fb-font-mono); color: var(--fb-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-amount.income { color: var(--fb-income); }
.detail-amount.expense { color: var(--fb-expense); }
.detail-meta { font: 400 13px var(--fb-font-body); color: var(--fb-muted); margin: 0 0 12px 2px; }
@media (min-width: 1024px) { .detail-card { padding: 26px; } .detail-amount { font-size: 36px; } }

/* === Таблица (транзакции / расходы) === */
.fb-table-card { background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); overflow: hidden; }
.fb-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fb-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.fb-table thead th {
  background: var(--fb-surface-2); color: var(--fb-muted); font: 600 11px var(--fb-font-body);
  text-transform: uppercase; letter-spacing: 0.6px; text-align: left; padding: 12px 18px; white-space: nowrap;
}
.fb-table thead th:last-child { text-align: right; }
.fb-th-date td { background: var(--fb-bg); color: var(--fb-text); font: 700 13px var(--fb-font-mono); padding: 10px 18px; border-bottom: 2px solid var(--fb-accent); }
.fb-tr td { padding: 12px 18px; border-bottom: 1px solid var(--fb-border); font: 400 13px var(--fb-font-body); color: var(--fb-text); vertical-align: middle; }
.fb-tr:last-child td { border-bottom: none; }
.fb-tr.clickable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fb-tr.clickable:hover td { background: var(--fb-surface-2); }
.fb-td-time { color: var(--fb-muted); font-size: 12px; white-space: nowrap; width: 1%; }
.fb-td-party { color: var(--fb-text); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.fb-td-acct { color: var(--fb-muted); white-space: nowrap; }
.fb-td-desc { color: var(--fb-muted); font-family: var(--fb-font-longform); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.fb-td-cat { white-space: nowrap; }
.fb-td-amount { text-align: right; white-space: nowrap; font: 700 14px var(--fb-font-mono); font-variant-numeric: tabular-nums; color: var(--fb-text); }
.fb-td-amount.income, td.tx-credit { color: var(--fb-income); }
.fb-td-amount.expense, td.tx-debit { color: var(--fb-expense); }
/* No-href money anchors prevent WebKit detection; neutralize injected links too. */
.fb-money-text,
:is(.fb-transactions-table .fb-td-amount, .detail-amount, .tx-info-amount)
  a:is([x-apple-data-detectors], [href^="tel:" i], [href^="x-apple-data-detectors:" i]) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  font: inherit !important;
  text-decoration: none !important;
  pointer-events: none !important;
}
.fb-total-row td { background: var(--fb-surface-2); font: 700 14px var(--fb-font-mono); color: var(--fb-text); padding: 14px 18px; border: none; }
.fb-total-row td:last-child { text-align: right; }
.fb-empty { text-align: center; padding: 44px 0; color: var(--fb-muted); font: 400 14px var(--fb-font-body); }
/* На мобайле прячем колонку «Описание», чтобы сумма влезала без горизонтального скролла */
@media (max-width: 1023px) {
  .fb-td-desc, .th-desc { display: none; }
  .fb-transactions-table .tx-desktop-cell { display: none; }
  .fb-table { min-width: 0; }
  .fb-table thead th, .fb-tr td, .fb-th-date td, .fb-total-row td { padding-left: 12px; padding-right: 12px; }
  .fb-td-party { max-width: 120px; }
}
@media (max-width: 359px) {
  .fb-transactions-table thead th, .fb-transactions-table .fb-tr td,
  .fb-transactions-table .fb-th-date td, .fb-transactions-table .fb-total-row td {
    padding-left: 6px;
    padding-right: 6px;
  }
  .fb-transactions-table .fb-td-party { max-width: 80px; }
  .tx-account-card .detail-amount { font-size: 28px; }
}

/* === Пагинация === */
.fb-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 0 0; }
.fb-page-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--fb-surface); border: 1px solid var(--fb-border);
  color: var(--fb-text); border-radius: var(--fb-radius-sm); padding: 8px 14px; font: 600 13px var(--fb-font-body); text-decoration: none;
}
.fb-page-btn.next { background: var(--fb-accent); color: var(--fb-accent-fg); border-color: var(--fb-accent); }
.fb-page-btn:hover { opacity: .9; }
.fb-page-btn.disabled { color: var(--fb-muted); pointer-events: none; opacity: .45; background: var(--fb-surface); border-color: var(--fb-border); }
.fb-page-info { font: 700 13px var(--fb-font-mono); color: var(--fb-text); }

/* === Доходы: сетка карточек-дней === */
.day-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.day-card { background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); padding: 16px; }
.day-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.day-card-date { font: 700 14px var(--fb-font-mono); color: var(--fb-text); }
.day-card-total { font: 700 15px var(--fb-font-mono); font-variant-numeric: tabular-nums; }
.day-card-total.income { color: var(--fb-income); }
.day-card-total.expense { color: var(--fb-expense); }
.day-divider { height: 1px; background: var(--fb-border); margin: 8px 0 4px; }
.day-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; }
.day-row-name { font: 400 13px var(--fb-font-body); color: var(--fb-text); }
.day-row-name.muted { color: var(--fb-muted); }
.day-row-amt { font: 600 13px var(--fb-font-mono); color: var(--fb-text); font-variant-numeric: tabular-nums; }
@media (min-width: 1024px) { .day-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

/* === Расходы: секция по дню === */
.exp-day { margin-bottom: 18px; }
.exp-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
.exp-day-date { font: 700 14px var(--fb-font-mono); color: var(--fb-text); }
.exp-day-total { font: 700 15px var(--fb-font-mono); color: var(--fb-expense); font-variant-numeric: tabular-nums; }

/* === Конкуренты === */
.runbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn-primary-fb {
  display: inline-flex; align-items: center; gap: 8px; background: var(--fb-accent); color: var(--fb-accent-fg);
  border: none; border-radius: var(--fb-radius-sm); padding: 10px 16px; font: 700 13px var(--fb-font-body); cursor: pointer; text-decoration: none;
}
.btn-primary-fb .ic { width: 15px; height: 15px; }
.btn-ghost-fb {
  display: inline-flex; align-items: center; gap: 6px; background: var(--fb-surface); border: 1px solid var(--fb-border);
  color: var(--fb-text); border-radius: var(--fb-radius-sm); padding: 7px 12px; font: 600 12px var(--fb-font-body); cursor: pointer; text-decoration: none;
}
.btn-ghost-fb:hover { background: var(--fb-surface-2); }
.btn-ghost-fb .ic { width: 14px; height: 14px; }
.venue-seg { font: 400 12px var(--fb-font-longform); color: var(--fb-muted); padding: 2px 0 6px; }
.comp-count { font: 700 13px var(--fb-font-mono); color: var(--fb-text); }
.comp-badge-fb { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--fb-radius-sm); font: 700 11px var(--fb-font-mono); background: var(--fb-tag-signal-bg); color: var(--fb-tag-signal-fg); }

/* === Модалки и формы — переопределение под Dark Terminal === */
.modal-backdrop { background: rgba(0, 0, 0, .6); }
.modal-card { background: var(--fb-surface); box-shadow: 0 -8px 32px rgba(0,0,0,.4); }
@media (min-width: 520px) { .modal-card { box-shadow: 0 20px 60px rgba(0,0,0,.5); } }
.modal-title { font-family: var(--fb-font-mono); color: var(--fb-text); }
.modal-subtitle { color: var(--fb-muted); font-family: var(--fb-font-longform); }
.modal-tabs { background: var(--fb-surface-2); }
.modal-tabs .tab span { color: var(--fb-muted); font-family: var(--fb-font-body); }
.modal-tabs .tab-credit input:checked ~ span { background: var(--fb-tag-signal-bg); color: var(--fb-tag-signal-fg); }
.modal-tabs .tab-debit input:checked ~ span { background: var(--fb-tag-alarm-bg); color: var(--fb-tag-alarm-fg); }
.field span { color: var(--fb-text); font: 600 13px var(--fb-font-body); }
.field input, .tx-info-select {
  background: var(--fb-surface-2); border: 1px solid var(--fb-border); color: var(--fb-text);
  font-family: var(--fb-font-body); border-radius: var(--fb-radius-sm);
}
.field input:focus, .tx-info-select:focus { border-color: var(--fb-accent); background: var(--fb-surface-2); }
.btn-primary {
  background: var(--fb-accent); color: var(--fb-accent-fg); font-family: var(--fb-font-body);
  border-radius: var(--fb-radius-sm); font-weight: 700;
}
.btn-primary:hover { opacity: .92; }
.btn-secondary { background: var(--fb-surface-2); color: var(--fb-text); font-family: var(--fb-font-body); border-radius: var(--fb-radius-sm); }
.btn-secondary:hover { background: var(--fb-border); }
.tx-info-amount.tx-credit, td.tx-credit { color: var(--fb-income); }
.tx-info-amount.tx-debit, td.tx-debit { color: var(--fb-expense); }
.tx-info-label { color: var(--fb-muted); font-family: var(--fb-font-body); }
.tx-info-value { color: var(--fb-text); font-family: var(--fb-font-longform); }
.tx-info-mono { font-family: var(--fb-font-mono); }
.tx-info-date { color: var(--fb-muted); }
.tx-info-checkbox label { color: var(--fb-muted); font-family: var(--fb-font-longform); }

/* === Логин === */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card-fb {
  width: 100%; max-width: 420px; background: var(--fb-surface); border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-lg); padding: 36px; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.login-logo { display: flex; align-items: baseline; justify-content: center; gap: 7px; }
.login-logo .logo-word { font-size: 30px; }
.login-sub { text-align: center; font: 400 14px var(--fb-font-body); color: var(--fb-muted); }
.login-alert {
  display: flex; align-items: center; gap: 8px; background: var(--fb-tag-alarm-bg); color: var(--fb-tag-alarm-fg);
  border-radius: var(--fb-radius-sm); padding: 10px 12px; font: 600 13px var(--fb-font-body);
}
.login-alert .ic { width: 16px; height: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.login-field input {
  background: var(--fb-surface-2); border: 1px solid var(--fb-border); color: var(--fb-text);
  border-radius: var(--fb-radius-sm); padding: 12px 14px; font: 400 15px var(--fb-font-body);
}
.login-field input:focus { outline: none; border-color: var(--fb-accent); }
.login-btn {
  background: var(--fb-accent); color: var(--fb-accent-fg); border: none; border-radius: var(--fb-radius-sm);
  padding: 13px 16px; font: 700 15px var(--fb-font-body); cursor: pointer; width: 100%;
}
.login-btn:hover { opacity: .92; }

/* Логин / иные «голые» страницы без сайдбара и навбара */
.app-bare { display: block; }
.content-bare { max-width: none; margin: 0; padding: 0; }

/* ===== Настройки: бейдж навигации ===== */
.nav-item, .mnav-item { position: relative; }
.nav-badge {
  position: absolute; top: 4px; left: 24px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fb-tag-alarm-fg); color: #fff;
  border-radius: 999px; font: 700 10px var(--fb-font-mono); line-height: 1;
}
.mnav-item .nav-badge { top: 2px; left: 50%; transform: translateX(-50%); }

/* ===== Настройки: страница Банк API ===== */
a.venue-card { text-decoration: none; color: inherit; }
a.venue-card:hover { background: var(--fb-surface-2); }
.settings-tile-desc { margin: 6px 0 0; padding: 0 14px 12px; font: 400 12px var(--fb-font-longform); color: var(--fb-muted); }
.api-card.api-warning { border-color: var(--fb-tag-warning-fg); }
.api-card.api-expired { border-color: var(--fb-tag-alarm-fg); }
.api-plashka { display: flex; align-items: center; gap: 7px; margin: 8px 14px 0; padding: 8px 11px; border-radius: var(--fb-radius-sm); font: 600 12px var(--fb-font-body); }
.api-plashka .ic { width: 15px; height: 15px; flex: 0 0 auto; }
.api-plashka-warn { background: var(--fb-tag-warning-bg); color: var(--fb-tag-warning-fg); }
.tag-set-date { background: transparent; color: var(--fb-accent); border: 1px dashed var(--fb-accent); padding: 2px 8px; }
.api-group { font: 500 11px var(--fb-font-mono); color: var(--fb-muted); }
.api-exp { font: 600 13px var(--fb-font-mono); color: var(--fb-text); }
.api-form { margin: 4px 14px 0; border-top: 1px solid var(--fb-border); padding-top: 8px; }
.api-form > summary { cursor: pointer; font: 600 12px var(--fb-font-mono); color: var(--fb-accent); list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.api-form > summary::-webkit-details-marker { display: none; }
.api-form-body { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
.api-form-body label { display: flex; flex-direction: column; gap: 3px; font: 500 11px var(--fb-font-mono); color: var(--fb-muted); }
.api-form-body input { padding: 8px 10px; border: 1px solid var(--fb-border); border-radius: var(--fb-radius-sm); background: var(--fb-surface-2); color: var(--fb-text); font: 400 13px var(--fb-font-body); }
.flash { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--fb-radius-sm); font: 500 13px var(--fb-font-body); }
.flash-ok { background: var(--fb-tag-signal-bg); color: var(--fb-tag-signal-fg); }
.flash-err { background: var(--fb-tag-alarm-bg); color: var(--fb-tag-alarm-fg); }

/* ===== Вкладка «Доставка Яндекс» (План 3) ===== */
.yd-sub{font-size:12px;color:var(--fb-muted);margin:0 0 12px}
.yd-selector{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.yd-pill{font-size:12px;padding:6px 12px;border:1px solid var(--fb-border);border-radius:20px;color:var(--fb-muted);text-decoration:none}
.yd-pill.on{background:var(--fb-surface);color:var(--fb-text);border-color:var(--fb-accent)}
.yd-card{background:var(--fb-surface);border:1px solid var(--fb-border);border-radius:12px;margin:0 0 12px;padding:14px}
.yd-card-accent{border-color:var(--fb-accent)}
.yd-card-h{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;margin-bottom:10px}
.yd-card-h .ic{width:16px;height:16px}
.yd-spacer{flex:1}
.yd-tag{font-size:10.5px;padding:2px 8px;border-radius:6px;font-weight:600}
.yd-tag.ok,.yd-tag.confirmed,.yd-tag.new{background:color-mix(in srgb,var(--fb-accent) 16%,transparent);color:var(--fb-accent)}
.yd-tag.warn,.yd-tag.testing{background:color-mix(in srgb,var(--fb-tag-warning-fg) 16%,transparent);color:var(--fb-tag-warning-fg)}
.yd-tag.muted,.yd-tag.paused,.yd-tag.proposed,.yd-tag.rejected{background:var(--fb-border);color:var(--fb-muted)}
.yd-reco-move{font-size:16px;font-weight:600;margin-bottom:8px;color:var(--fb-text)}
.yd-reco-move .old{color:var(--fb-muted);text-decoration:line-through;font-weight:400}
.yd-reco-move .arrow,.yd-reco-move .hold-ok{color:var(--fb-accent)}
/* сворачиваемые карточки (details/summary): заголовок — summary, маркер скрыт */
.yd-collapse>summary{list-style:none;cursor:pointer;user-select:none}
.yd-collapse>summary::-webkit-details-marker{display:none}
.yd-collapse:not([open])>summary.yd-card-h{margin-bottom:0}
.yd-collapse-caret{width:14px;height:14px;color:var(--fb-muted);transition:transform .15s}
.yd-collapse[open] .yd-collapse-caret{transform:rotate(180deg)}
/* итоги по месяцам: 4 мини-барчарта + строки месяцев с дельтами */
.yd-monthly-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:10px}
.yd-mchart-t{font-size:11.5px;color:var(--fb-muted);margin-bottom:4px}
.yd-mchart-bars{display:flex;align-items:flex-end;gap:3px;height:70px}
.yd-mbar-wrap{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;height:100%;min-width:0}
.yd-mbar-val{font-size:9px;color:var(--fb-muted);white-space:nowrap}
.yd-mbar{width:100%;background:var(--fb-accent);opacity:.85;border-radius:2px 2px 0 0}
.yd-mbar.cur{opacity:.4;border:1px dashed var(--fb-accent);border-bottom:none}
.yd-mchart-x{display:flex;gap:3px;font-size:9.5px;color:var(--fb-muted)}
.yd-mchart-x span{flex:1;text-align:center}
.yd-month-sub{font-size:11.5px;color:var(--fb-muted);padding:2px 0 8px}
/* подзаголовок секции внутри карточки (блоки «Акции»/«Инструменты») */
.yd-card-sub{margin:8px 0 2px;padding-top:8px;border-top:1px dashed var(--fb-border);color:var(--fb-muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}
.yd-prose{font-family:var(--fb-font-longform,'Inter',sans-serif);font-size:13px;line-height:1.5;color:var(--fb-text)}
.yd-lever-line{display:flex;justify-content:space-between;gap:8px;padding:6px 0;border-top:1px dashed var(--fb-border);font-size:12px;color:var(--fb-muted)}
.yd-lever-line.slot{opacity:.5;font-style:italic}
.yd-lever-line .old{color:var(--fb-muted);text-decoration:line-through}
.yd-lever-line .arrow,.yd-lever-line .hold-ok{color:var(--fb-accent)}
.yd-period-tabs{display:flex;gap:6px;margin-bottom:6px}
.yd-closed-note{font-size:10.5px;color:var(--fb-muted);margin:-2px 0 6px;display:flex;align-items:center;gap:5px}
.yd-closed-note::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--fb-muted);flex:0 0 auto}
.yd-live-bar{display:flex;align-items:center;gap:8px;margin:8px 0 4px}
.yd-tag.live{font-size:11px;font-weight:600;color:var(--fb-accent);background:color-mix(in srgb,var(--fb-accent) 16%,transparent);border-radius:6px;padding:2px 8px}
.yd-live-asof{font-size:11px;color:var(--fb-muted)}
.yd-refresh{margin-left:auto;font:inherit;font-size:12px;cursor:pointer;border:1px solid var(--fb-border);background:var(--fb-surface);color:var(--fb-text);border-radius:6px;padding:3px 9px}
.yd-refresh:hover{border-color:var(--fb-accent);color:var(--fb-accent)}
.yd-ptab{font-size:11.5px;padding:5px 11px;border:1px solid var(--fb-border);border-radius:8px;color:var(--fb-muted);background:none;cursor:pointer}
.yd-ptab.on{background:var(--fb-surface);color:var(--fb-text);border-color:var(--fb-accent)}
.yd-picker{border:1px solid var(--fb-border);border-radius:10px;padding:10px;margin:8px 0 4px}
.yd-pick-h{display:flex;justify-content:space-between;align-items:center;font-size:11.5px;color:var(--fb-muted);margin-bottom:8px}
.yd-nav{background:none;border:none;color:var(--fb-text);cursor:pointer;font-size:14px}
.yd-cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.yd-cal-dow{font-size:9.5px;color:var(--fb-muted);text-align:center;padding:2px 0}
.yd-cal-d{font-size:11px;text-align:center;padding:5px 0;border-radius:6px;color:var(--fb-muted);text-decoration:none;display:block}
.yd-cal-d.today{background:var(--fb-accent);color:var(--fb-accent-fg);font-weight:700}
.yd-cal-d.past{color:var(--fb-text);cursor:pointer}
.yd-cal-d.past:hover{background:var(--fb-border)}
.yd-cal-d.nodata{color:var(--fb-border)}
.yd-pick-note{font-size:10px;color:var(--fb-muted);margin-top:8px}
.yd-bid-plan{color:var(--fb-muted);text-decoration:line-through}
.yd-venue-row{display:flex;justify-content:space-between;align-items:center;padding:7px 0;font-size:12.5px;border-top:1px solid var(--fb-border)}
.yd-kv{display:flex;justify-content:space-between;padding:5px 0;font-size:12.5px;border-top:1px solid var(--fb-border);align-items:center}
.yd-kv .k{color:var(--fb-muted);display:flex;align-items:center;gap:5px}
.yd-kv .v{font-weight:600}
.yd-delta{font-size:11px;margin-left:6px}
.yd-delta.dn{color:var(--fb-tag-alarm-fg)}
.yd-delta.up{color:var(--fb-accent)}
.yd-info{display:inline-flex;width:15px;height:15px;border-radius:50%;border:1px solid var(--fb-muted);color:var(--fb-muted);font-size:9px;align-items:center;justify-content:center;font-style:italic;cursor:pointer;background:none}
.yd-info.open{border-color:var(--fb-info,#58a6ff);color:var(--fb-info,#58a6ff)}
.yd-tip{display:none;margin:2px 0 6px;padding:8px 10px;background:color-mix(in srgb,var(--fb-info,#58a6ff) 8%,transparent);border-left:2px solid var(--fb-info,#58a6ff);border-radius:0 6px 6px 0;font-family:var(--fb-font-longform,'Inter',sans-serif);font-size:11.5px;line-height:1.45;color:var(--fb-text)}
.yd-tip.show{display:block}
.yd-stop-row{cursor:pointer;user-select:none}
.yd-stop-arrow{display:inline-block;font-size:9px;color:var(--fb-muted);transition:transform .15s}
.yd-stop-row.open .yd-stop-arrow{transform:rotate(90deg)}
.yd-stop-alarm{color:var(--fb-tag-alarm-fg)}
.yd-stop-warn{color:var(--fb-tag-warning-fg)}
.yd-stoplist{display:none;margin:2px 0 6px;padding:6px 10px;background:color-mix(in srgb,var(--fb-muted) 6%,transparent);border-left:2px solid var(--fb-border);border-radius:0 6px 6px 0;font-size:11.5px}
.yd-stoplist.show{display:block}
.yd-stop-item{display:flex;justify-content:space-between;gap:10px;padding:2px 0}
.yd-stop-item .n{color:var(--fb-text)}
.yd-stop-item.rm .n{color:var(--fb-muted);text-decoration:line-through}
.yd-stop-item .t{color:var(--fb-muted);white-space:nowrap}
.yd-stop-opt{font-size:9.5px;color:var(--fb-muted);border:1px solid var(--fb-border);border-radius:4px;padding:0 4px;vertical-align:1px}
.yd-stop-sep{margin:6px 0 2px;padding-top:6px;border-top:1px dashed var(--fb-border);color:var(--fb-muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}
.yd-stop-empty{color:var(--fb-muted);padding:2px 0}
.yd-stop-asof{margin-top:6px;color:var(--fb-muted);font-size:10.5px}
.yd-loop-item{padding:9px 0;border-top:1px solid var(--fb-border);font-size:12px}
.yd-loop-date{color:var(--fb-muted);font-size:11px;margin-bottom:3px}
.yd-loop-eff{color:var(--fb-text);margin-top:2px}
.yd-hyp{padding:9px 0;border-top:1px solid var(--fb-border)}
.yd-hyp-top{display:flex;gap:8px;align-items:center;margin-bottom:4px}
.yd-hyp-stmt{font-size:12.5px;color:var(--fb-text);font-family:var(--fb-font-longform,'Inter',sans-serif);line-height:1.4}
.yd-hyp-meta{font-size:11px;color:var(--fb-muted);margin-top:4px;display:flex;gap:14px}
.yd-hyp-meta .sup{color:var(--fb-accent)}
.yd-hyp-meta .ref{color:var(--fb-tag-alarm-fg)}
/* Блок 5: листаемый тренд маржи (геометрия — в static/js/yandex_trend.js) */
.yd-trend-wrap{display:flex;gap:6px;position:relative}
.yd-y-axis{flex:0 0 32px;display:flex;flex-direction:column;justify-content:space-between;
  height:130px;margin-top:34px;font-size:9px;color:var(--fb-muted);text-align:right}
.yd-trend-scroll{flex:1;min-width:0;overflow-x:auto;overflow-y:hidden;padding-top:34px;
  -webkit-overflow-scrolling:touch;touch-action:pan-x;scrollbar-width:none;cursor:grab}
.yd-trend-scroll::-webkit-scrollbar{display:none}
.yd-trend-scroll.drag{cursor:grabbing;user-select:none}
.yd-trend-inner{position:relative}                /* ширину (= totalW px) ставит JS */
.yd-chart{height:130px;width:100%;display:flex;align-items:flex-end;position:relative}
.yd-bar{height:100%;display:flex;flex-direction:column;justify-content:flex-end;
  position:relative;z-index:1;padding:0 2px}      /* ширину (= barW px) ставит JS */
.yd-seg-base{background:var(--fb-muted);border-radius:3px 3px 0 0;opacity:.5}
.yd-bar.has-delta .yd-seg-base{border-radius:0}
.yd-seg-up{background:var(--fb-accent);border-radius:3px 3px 0 0}
.yd-seg-down{border:1px dashed var(--fb-tag-alarm-fg);border-bottom:none;border-radius:3px 3px 0 0;
  background:repeating-linear-gradient(45deg,transparent,transparent 3px,
  color-mix(in srgb,var(--fb-tag-alarm-fg) 25%,transparent) 3px,
  color-mix(in srgb,var(--fb-tag-alarm-fg) 25%,transparent) 6px)}
.yd-bar.mark::after{content:'▲';position:absolute;top:-15px;left:50%;transform:translateX(-50%);
  font-size:9px;color:var(--fb-accent);z-index:3}
.yd-bar.sel .yd-seg-base{background:var(--fb-accent);opacity:1}
.yd-bar.sel .yd-seg-up{background:var(--fb-accent)}
.yd-bar.today::before{content:'';position:absolute;top:0;bottom:0;left:50%;width:1px;
  transform:translateX(-50%);background:var(--fb-muted);opacity:.35;z-index:0}
.yd-trend-svg{position:absolute;left:0;top:0;width:100%;height:130px;z-index:2;pointer-events:none}
.yd-chart-dow{position:absolute;top:-30px;left:0;width:100%;display:flex;z-index:1}  /* день недели над баром */
.yd-chart-dow span{flex:0 0 auto;text-align:center;font-size:8.5px;letter-spacing:-.3px;
  white-space:nowrap;overflow:hidden;color:var(--fb-text)}                          /* рабочий — обычный (чёрный) */
.yd-chart-dow span.off{color:var(--fb-tag-alarm-fg)}                                /* выходной/праздник — красный */
.yd-chart-x{display:flex;width:100%;margin-top:4px;color:var(--fb-muted)}
.yd-chart-x span{flex:0 0 auto;text-align:center;font-size:8.5px;letter-spacing:-.3px;
  font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden}  /* ширину ставит JS */
.yd-chart-x span.sel{color:var(--fb-accent);font-weight:700}
.yd-legend{font-size:10.5px;color:var(--fb-muted);margin-top:10px;line-height:1.8}
.yd-legend .sw{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:middle;margin:0 3px}
.yd-legend .sw.base{background:var(--fb-muted);opacity:.5}.yd-legend .sw.up{background:var(--fb-accent)}
.yd-legend .sw.down{border:1px dashed var(--fb-tag-alarm-fg)}
.yd-legend .sw.ln{width:16px;height:0;border-top:2px solid var(--fb-text)}
.yd-legend .sw.lnd{width:16px;height:0;border-top:2px dashed var(--fb-accent)}
/* Блок 5б: позиция в зоне → заказы */
.yd-zone-verdict{font-size:12.5px;margin-bottom:8px;color:var(--fb-text)}
.yd-zone-wrap{position:relative}
#yd-zone-svg{width:100%;height:110px;display:block}
.yd-zone-x{display:flex;justify-content:space-between;color:var(--fb-muted);font-size:8.5px;letter-spacing:-.3px;margin-top:4px}
.yd-legend .sw.lno{width:16px;height:0;border-top:2px solid var(--fb-accent)}
.yd-legend .sw.lnz{width:16px;height:0;border-top:2px dashed var(--fb-text)}
.yd-cat-item{font-size:11.5px;padding:6px 0;border-top:1px solid var(--fb-border);color:var(--fb-text)}
.yd-cat-badge{font-size:10px;margin-right:6px;color:var(--fb-accent)}
.yd-cat-badge.changed{color:var(--fb-tag-warning-fg)}.yd-cat-badge.removed{color:var(--fb-tag-alarm-fg)}
.yd-econ{border-top:1px solid var(--fb-border)}
.yd-econ-sum{display:flex;justify-content:space-between;align-items:center;padding:7px 0;font-size:12.5px;cursor:pointer;list-style:none}
.yd-econ-sum::-webkit-details-marker{display:none}
.yd-econ-sum .v{font-weight:600;display:flex;align-items:center;gap:4px}
.yd-econ-caret{width:13px;height:13px;color:var(--fb-muted);transition:transform .15s}
.yd-econ[open] .yd-econ-caret{transform:rotate(180deg)}
.yd-econ-agent{display:flex;justify-content:space-between;font-size:11.5px;color:var(--fb-muted);padding:4px 0 4px 12px}
.yd-empty{font-size:12px;color:var(--fb-muted);padding:8px 0;text-align:center}

/* ============================= AI-ассистент (план 1) ============================= */
.asst { display: flex; flex-direction: column; height: calc(100dvh - 40px); max-width: 900px; margin: 0 auto; }
.asst-head { display: flex; align-items: center; gap: 12px; padding: 8px 4px 12px; }
.asst-title { font-family: var(--fb-font-mono); font-size: 18px; margin: 0; flex: 0 0 auto; }
.asst-burger { display: none; }

/* счётчик контекста */
.asst-ctx { margin-left: auto; display: flex; align-items: center; gap: 8px; font-family: var(--fb-font-mono); font-size: 12px; color: var(--fb-muted); }
.asst-ctx-bar { width: 90px; height: 6px; background: var(--fb-surface-2); border-radius: 3px; overflow: hidden; }
.asst-ctx-fill { display: block; height: 100%; width: 0; background: var(--fb-accent); transition: width .3s ease; }
.asst-ctx-warn .asst-ctx-fill { background: #FFB020; }
.asst-ctx-danger .asst-ctx-fill { background: var(--fb-expense, #FF5C5C); }
.asst-ctx-danger .asst-ctx-label { color: var(--fb-expense, #FF5C5C); }

.asst-body { flex: 1; display: flex; gap: 16px; min-height: 0; }

/* drawer истории */
.asst-drawer { flex: 0 0 220px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.asst-new { width: 100%; justify-content: center; }
.asst-history { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.asst-hist-item { text-align: left; padding: 8px 10px; border-radius: var(--fb-radius, 8px); background: var(--fb-surface); color: var(--fb-text); border: 1px solid var(--fb-border); cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asst-hist-item:hover { background: var(--fb-surface-2); }
.asst-hist-empty { color: var(--fb-muted); font-size: 12px; padding: 8px 10px; }
.asst-hist-row { display: flex; align-items: stretch; gap: 4px; }
.asst-hist-row .asst-hist-item { flex: 1; min-width: 0; }
.asst-hist-del { display: flex; align-items: center; justify-content: center; padding: 0 8px;
  border-radius: var(--fb-radius, 8px); background: var(--fb-surface); color: var(--fb-muted);
  border: 1px solid var(--fb-border); cursor: pointer; flex: 0 0 auto; }
.asst-hist-del:hover { background: var(--fb-danger, #c0392b); color: #fff; border-color: var(--fb-danger, #c0392b); }
.asst-hist-del .ic { width: 15px; height: 15px; }
.asst-del-all { display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: var(--fb-radius, 8px);
  background: var(--fb-surface); color: var(--fb-danger, #c0392b); border: 1px solid var(--fb-border);
  cursor: pointer; font-size: 13px; }
.asst-del-all:hover { background: var(--fb-danger, #c0392b); color: #fff; border-color: var(--fb-danger, #c0392b); }
.asst-del-all .ic { width: 15px; height: 15px; }
.asst-drawer-backdrop { display: none; }

/* Бэклог функций ассистента */
.asst-bk-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-right: 8px;
  border-radius: 9px; background: var(--fb-accent, #4a8); color: #fff; font-size: 12px;
  font-weight: 600; text-align: center; }
.asst-bk-hint { color: var(--fb-muted); font-size: 13px; margin: 4px 0 14px; line-height: 1.5; }
.asst-bk-hint code { font-size: 12px; }
.asst-bk-empty { color: var(--fb-muted); font-size: 13px; padding: 14px; }
.asst-bk-list { display: flex; flex-direction: column; gap: 10px; }
.asst-bk-item { background: var(--fb-surface); border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius, 8px); padding: 12px 14px; }
.asst-bk-item.asst-bk-done, .asst-bk-item.asst-bk-dismissed { opacity: 0.6; }
.asst-bk-item.asst-bk-disabled { opacity: 0.6; }
.asst-bk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.asst-bk-title { font-weight: 600; font-size: 14px; }
.asst-bk-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.asst-bk-cost { font-family: var(--fb-mono, monospace); opacity: .85; margin-left: 2px; }
.asst-bk-status-new { background: var(--fb-accent, #4a8); color: #fff; }
.asst-bk-status-approved { background: var(--fb-tag-warning-bg); color: var(--fb-tag-warning-fg); }
.asst-bk-status-done { background: var(--fb-surface-2); color: var(--fb-muted); }
.asst-bk-status-dismissed { background: var(--fb-surface-2); color: var(--fb-muted); }
.asst-bk-status-active { background: var(--fb-accent, #4a8); color: #fff; }
.asst-bk-status-disabled { background: var(--fb-surface-2); color: var(--fb-muted); }
/* Статусы dev-пайплайна: заявкой управляет демон (in_progress/review) либо она сорвалась. */
.asst-bk-status-in_progress { background: var(--fb-tag-signal-bg); color: var(--fb-tag-signal-fg); }
/* «ФинБрейн думает»: мини-знак мозг×леджер у заявки в разработке — по контуру полушария
   бежит мысль, строки леджера проступают по очереди. currentColor — наследует цвет бейджа. */
.asst-bk-spin { vertical-align: -2px; margin-right: 5px; }
.asst-bk-spin-gyrus { stroke-dasharray: 7 21; animation: asst-bk-think 1.6s linear infinite; }
@keyframes asst-bk-think { to { stroke-dashoffset: -28; } }
.asst-bk-spin-row { opacity: .25; animation: asst-bk-row 1.6s ease-in-out infinite; }
.asst-bk-spin-row2 { animation-delay: .35s; }
.asst-bk-spin-row3 { animation-delay: .7s; }
@keyframes asst-bk-row { 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .asst-bk-spin-gyrus, .asst-bk-spin-row { animation: none; opacity: 1; }
}
.asst-bk-status-review      { background: var(--fb-tag-warning-bg); color: var(--fb-tag-warning-fg); }
.asst-bk-status-failed      { background: var(--fb-tag-alarm-bg); color: var(--fb-tag-alarm-fg); }
.asst-bk-rationale { font-size: 13px; margin-top: 6px; }
.asst-bk-q { font-size: 12px; color: var(--fb-muted); margin-top: 4px; font-style: italic; }
.asst-bk-meta { font-size: 11px; color: var(--fb-muted); margin-top: 6px; }
.asst-bk-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.asst-bk-actions form { margin: 0; }
.asst-bk-btn { padding: 5px 12px; border-radius: var(--fb-radius, 8px); background: var(--fb-surface-2);
  color: var(--fb-text); border: 1px solid var(--fb-border); cursor: pointer; font-size: 12px; }
.asst-bk-btn:hover { background: var(--fb-border); }
.asst-bk-btn-done { background: var(--fb-accent, #4a8); color: #fff; border-color: var(--fb-accent, #4a8); }
.asst-bk-btn-done:hover { filter: brightness(1.08); }

/* лента сообщений */
.asst-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.asst-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 12px; }
.asst-greeting { color: var(--fb-muted); font-size: 14px; text-align: center; margin: auto; max-width: 420px; }
.asst-msg { display: flex; }
.asst-msg-user { justify-content: flex-end; }
.asst-bubble { max-width: 80%; padding: 10px 14px; border-radius: var(--fb-radius, 12px); font-size: 14px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.asst-msg-user .asst-bubble { background: var(--fb-accent); color: #0A0B0E; }
.asst-msg-assistant .asst-bubble { background: var(--fb-surface); border: 1px solid var(--fb-border); color: var(--fb-text); }
.asst-bubble pre { background: var(--fb-surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; font-family: var(--fb-font-mono); font-size: 12px; }
.asst-bubble code { font-family: var(--fb-font-mono); font-size: 0.92em; }
.asst-bubble table { display: block; overflow-x: auto; max-width: 100%; }
/* индикатор активности агента: единый, со спиннером (план «фикс UI») */
.asst-msg-status { justify-content: flex-start; }
.asst-status { display: inline-flex; align-items: center; gap: 8px; color: var(--fb-muted);
  font-size: 12.5px; font-style: italic; padding: 2px 2px; }
.asst-status-dot { flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--fb-border); border-top-color: var(--fb-accent);
  animation: asst-spin .7s linear infinite; }
@keyframes asst-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .asst-status-dot { animation: none; } }
/* пустой ответ при восстановлении прерванного хода */
.asst-bubble-empty { color: var(--fb-muted); font-style: italic; }

/* инпут */
.asst-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 4px calc(10px + env(safe-area-inset-bottom)); }
.asst-text { flex: 1; resize: none; background: var(--fb-surface); color: var(--fb-text); border: 1px solid var(--fb-border); border-radius: var(--fb-radius, 12px); padding: 12px 14px; font-family: var(--fb-font-body); font-size: 15px; line-height: 1.4; max-height: 160px; }
.asst-text:focus { outline: none; border-color: var(--fb-accent); }
.asst-send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--fb-accent); color: #0A0B0E; display: flex; align-items: center; justify-content: center; }
.asst-send:disabled { opacity: .5; }

/* Вложения и артефакты ассистента (план 3a) */
.asst-attach { flex: 0 0 auto; }
.asst-attach-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 6px; }
.asst-attach-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 200px;
  padding: 4px 8px; border-radius: var(--fb-radius, 8px); background: var(--fb-surface-2);
  border: 1px solid var(--fb-border); font-size: 12px; font-family: var(--fb-font-mono); }
.asst-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-attach-x { border: none; background: none; color: var(--fb-muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0; }
.asst-attach-x:hover { color: var(--fb-expense, #FF5C5C); }
.asst-attachments, .asst-artifacts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.asst-attach-img, .asst-artifact-img { max-width: 100%; max-height: 320px; border-radius: 8px;
  border: 1px solid var(--fb-border); }
.asst-attach-file, .asst-artifact-file { display: inline-block; padding: 6px 10px;
  border-radius: var(--fb-radius, 8px); background: var(--fb-surface-2); border: 1px solid var(--fb-border);
  color: var(--fb-text); font-size: 13px; text-decoration: none; }
.asst-attach-file:hover, .asst-artifact-file:hover { border-color: var(--fb-accent); }

/* ---------- мобильная адаптация (≤768px) ---------- */
@media (max-width: 768px) {
  .asst { height: calc(100dvh - 64px); }
  .asst-burger { display: inline-flex; }
  .asst-ctx-bar { width: 60px; }
  .asst-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 78%; max-width: 300px; z-index: 50;
    background: var(--fb-bg); border-right: 1px solid var(--fb-border); padding: 16px;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .asst-drawer.open { transform: translateX(0); }
  .asst-drawer-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
  .asst-bubble { max-width: 92%; }
  .asst-send { width: 48px; height: 48px; }   /* тап-таргет */
}

/* ---------- AI-ассистент: голосовой ввод (план 2) ---------- */
.asst-mic { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--fb-surface); color: var(--fb-text); border: 1px solid var(--fb-border); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.asst-mic:hover { background: var(--fb-surface-2); }
.asst-mic:disabled { opacity: .5; cursor: default; }
.asst-mic.recording { background: var(--fb-expense, #FF5C5C); color: var(--fb-accent-fg, #0A0B0E); border-color: var(--fb-expense, #FF5C5C); animation: asst-mic-pulse 1.1s ease-in-out infinite; }
.asst-mic.busy { opacity: .6; }
/* rgba() не принимает CSS-переменную напрямую (нужен color-mix/новый rgb-синтаксис) —
   цвет пульсации захардкожен под --fb-expense. */
@keyframes asst-mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 92, 92, .55); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 92, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0); }
}
@media (max-width: 768px) {
  .asst-mic { width: 48px; height: 48px; }   /* тап-таргет */
}
@media (prefers-reduced-motion: reduce) {
  .asst-mic.recording { animation: none; }
}

/* ---------- AI-ассистент как фикс-высотный shell (фикс промотки в пустоту) ----------
   На ширинах с нижней навигацией страница НЕ должна скроллиться: лента (.asst-messages)
   скроллится внутри, всё остальное зафиксировано. Высота .asst = вьюпорт − верхний отступ
   .content − место под фиксированную нижнюю навигацию (пилюля 62px + отступы ≈ 86px + safe-area).
   .app-assistant убирает min-height:100vh (иначе body тянется на 100vh > видимого 100dvh → overscroll). */
@media (max-width: 1023px) {
  .app-assistant { min-height: 0; }
  .content-flush { padding-bottom: 0; }
  .asst { height: calc(100dvh - 20px - 92px - env(safe-area-inset-bottom)); }
}

/* ---------- AI-ассистент: запись голоса «как в WhatsApp» ---------- */
/* при записи прячем обычные контролы формы, показываем панель записи */
#asst-form.is-recording > .asst-attach,
#asst-form.is-recording > .asst-mic,
#asst-form.is-recording > .asst-text,
#asst-form.is-recording > .asst-send { display: none; }

.asst-rec { display: none; flex: 1; align-items: center; gap: 10px; min-width: 0; }
#asst-form.is-recording .asst-rec { display: flex; }

/* круглые кнопки панели */
.asst-rec-del, .asst-rec-pause, .asst-rec-send {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.asst-rec-del, .asst-rec-pause {
  background: var(--fb-surface); color: var(--fb-text); border: 1px solid var(--fb-border);
}
.asst-rec-del:hover, .asst-rec-pause:hover { background: var(--fb-surface-2); }
.asst-rec-send { background: var(--fb-accent); color: #0A0B0E; border: none; }

/* красная точка записи */
.asst-rec-dot {
  flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%;
  background: var(--fb-expense);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fb-expense) 35%, transparent);
  animation: asst-rec-blink 1.2s ease-in-out infinite;
}
@keyframes asst-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

/* живая волна: бары растягиваются по scaleY (0..1) из JS */
.asst-rec-wave {
  flex: 1; display: flex; align-items: center; gap: 2px;
  height: 36px; min-width: 0; overflow: hidden;
}
.asst-rec-bar {
  flex: 1 1 0; min-width: 2px; max-width: 5px; height: 100%;
  background: var(--fb-accent); border-radius: 2px;
  transform: scaleY(0.12); transform-origin: center;
  transition: transform .06s linear;
}

/* таймер */
.asst-rec-timer {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  color: var(--fb-muted); white-space: nowrap;
}
.asst-rec-limit { font: 400 14px var(--fb-font-body); }
.asst-rec-time {
  font-family: var(--fb-font-mono); font-size: 16px;
  color: var(--fb-text); font-variant-numeric: tabular-nums;
  min-width: 34px; text-align: center;
}

/* переключатель пауза/продолжить: показываем нужный из двух значков */
.asst-rec-pause .asst-rec-ic-resume { display: none; }
.asst-rec--paused .asst-rec-pause .asst-rec-ic-pause { display: none; }
.asst-rec--paused .asst-rec-pause .asst-rec-ic-resume { display: inline-flex; }
/* на паузе точка не мигает */
.asst-rec--paused .asst-rec-dot { animation: none; opacity: .5; }
/* на паузе кнопка продолжения — красная и пульсирует, привлекает внимание */
.asst-rec--paused .asst-rec-pause {
  background: var(--fb-expense); color: var(--fb-accent-fg, #0A0B0E);
  border-color: var(--fb-expense);
  animation: asst-rec-pause-pulse 1.2s ease-in-out infinite;
}
.asst-rec--paused .asst-rec-pause:hover { background: color-mix(in srgb, var(--fb-expense) 88%, #000); }
@keyframes asst-rec-pause-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fb-expense) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px color-mix(in srgb, var(--fb-expense) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fb-expense) 0%, transparent); }
}

/* состояние «Распознаю…»: вместо волны/таймера — спиннер с текстом */
.asst-rec-busy {
  display: none; flex: 1; align-items: center; gap: 8px; min-width: 0;
  color: var(--fb-muted); font-size: 13px; font-style: italic;
}
.asst-rec--busy .asst-rec-dot,
.asst-rec--busy .asst-rec-wave,
.asst-rec--busy .asst-rec-timer { display: none; }
.asst-rec--busy .asst-rec-busy { display: flex; }
.asst-rec--busy .asst-rec-del,
.asst-rec--busy .asst-rec-pause,
.asst-rec--busy .asst-rec-send { opacity: .5; pointer-events: none; }
.asst-rec-busy-dot {
  flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--fb-border); border-top-color: var(--fb-accent);
  animation: asst-spin .7s linear infinite;
}

/* мобильные тап-таргеты 48px (как у .asst-mic/.asst-send) */
@media (max-width: 768px) {
  .asst-rec-del, .asst-rec-pause, .asst-rec-send { width: 48px; height: 48px; }
}
@media (max-width: 400px) {
  .asst-rec { gap: 6px; }
}

/* доступность: без анимаций — точка статична, волна без переходов */
@media (prefers-reduced-motion: reduce) {
  .asst-rec-dot { animation: none; }
  .asst-rec-bar { transition: none; }
  .asst-rec-busy-dot { animation: none; }
  .asst-rec--paused .asst-rec-pause { animation: none; }   /* красная остаётся, без пульса */
}

/* ---------- AI-ассистент: кнопка отмены запроса («стоп» во время обработки) ---------- */
.asst-stop {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: var(--fb-expense); color: var(--fb-accent-fg, #0A0B0E); border: none;
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.asst-stop:hover { background: color-mix(in srgb, var(--fb-expense) 88%, #000); }
/* во время обработки прячем «отправить», показываем «отмену» */
#asst-form.is-streaming > .asst-send { display: none; }
#asst-form.is-streaming > .asst-stop { display: inline-flex; }
@media (max-width: 768px) {
  .asst-stop { width: 48px; height: 48px; }   /* тап-таргет */
}

/* === Проверка FoodCost (costcheck) === */
.cc-run-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cc-select { background: var(--fb-surface-2); color: var(--fb-text); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-sm); padding: 8px 10px; font: 500 13px var(--fb-font-body); }
.cc-notice { margin-top: 8px; color: var(--fb-tag-warning-fg); font: 500 12px var(--fb-font-body); }
.cc-run-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
/* border-collapse: separate — иначе border-radius на плашках/рамках не работает */
.cc-table { border-collapse: separate; border-spacing: 0; }
.cc-table td { white-space: normal; }
/* Дерево папок iiko (v4): строка-папка со стрелкой; вложенность — отступом
   (inline padding-left в шаблоне), сворачивание — ccApplyTree в costcheck_run.html.
   text-align: left перебивает .runs-table td:last-child {right} — иначе папка
   уезжает вправо (дебаг владельца 02.08) */
.cc-tree .cc-folder-row td { background: var(--fb-surface-2); text-align: left; }
.cc-folder-btn { background: none; border: none; padding: 0; color: var(--fb-text); font: 700 13px var(--fb-font-mono); cursor: pointer; text-align: left; display: inline-flex; align-items: baseline; gap: 6px; }
.cc-folder-btn:hover { color: var(--fb-accent); }
.cc-folder-arrow { display: inline-block; font-size: 10px; transition: transform .15s; }
.cc-folder-btn.cc-closed .cc-folder-arrow { transform: rotate(-90deg); }
.cc-folder-meta { color: var(--fb-muted); font: 500 12px var(--fb-font-body); }
.cc-folder-exc { color: var(--fb-tag-alarm-fg); }
.cc-dish-btn { background: none; border: none; padding: 0; color: var(--fb-text); font: inherit; cursor: pointer; text-align: left; }
.cc-dish-btn:hover { color: var(--fb-accent); text-decoration: underline; }
/* Клик зарегистрирован, техкарта грузится из iiko (htmx сам вешает htmx-request на кнопку) */
.cc-dish-btn.htmx-request { opacity: .55; cursor: progress; text-decoration: none; }
.cc-dish-btn.htmx-request::after { content: ' …'; color: var(--fb-muted); }
.cc-input.htmx-request { opacity: .55; cursor: progress; }
.cc-venue-tag { margin-left: 6px; }
/* Пара Митино: общая рамка со скруглёнными углами */
.cc-pair td { background: var(--fb-surface-2); }
.cc-pair td:first-child { border-left: 1px solid var(--fb-border); }
.cc-pair td:last-child { border-right: 1px solid var(--fb-border); }
.cc-pair tr:first-child td { border-top: 1px solid var(--fb-border); }
.cc-pair tr:first-child td:first-child { border-top-left-radius: var(--fb-radius-sm); }
.cc-pair tr:first-child td:last-child { border-top-right-radius: var(--fb-radius-sm); }
.cc-pair tr:last-child td:first-child { border-bottom-left-radius: var(--fb-radius-sm); }
.cc-pair tr:last-child td:last-child { border-bottom-right-radius: var(--fb-radius-sm); }
/* Красная плашка превышения — ПОСЛЕ .cc-pair, чтобы фон выигрывал внутри пары */
.cc-exceeded td { background: var(--fb-tag-alarm-bg); }
.cc-exceeded td:first-child { border-top-left-radius: var(--fb-radius-sm); border-bottom-left-radius: var(--fb-radius-sm); }
.cc-exceeded td:last-child { border-top-right-radius: var(--fb-radius-sm); border-bottom-right-radius: var(--fb-radius-sm); }
/* Внутри пары углы скругляет рамка пары, а не плашка превышения */
.cc-pair .cc-exceeded td:first-child,
.cc-pair .cc-exceeded td:last-child { border-radius: 0; }
.cc-input { width: 74px; background: var(--fb-surface-2); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-sm); color: var(--fb-text); font: 500 13px var(--fb-font-mono); padding: 4px 6px; }
.cc-input:focus { border-color: var(--fb-accent); outline: none; }
.cc-del-btn { background: none; border: none; padding: 4px; cursor: pointer; color: var(--fb-muted); }
.cc-del-btn:hover { color: var(--fb-tag-alarm-fg); }
/* фильтр «только превышения»: строки/папки прячет ccApplyTree (JS) —
   в дереве чистым CSS :has не выразить «у папки нет превышений в поддереве» */
.cc-filter-exceeded .cc-nocost,
.cc-filter-exceeded .cc-reminder { display: none; }
.cc-nocost { margin-top: 16px; }
.cc-nocost summary { cursor: pointer; font: 600 13px var(--fb-font-body); color: var(--fb-muted); padding: 6px 0; }
.cc-reminder { margin-top: 16px; padding: 12px 14px; background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); font: 400 12px var(--fb-font-longform); color: var(--fb-muted); }
.cc-reminder ul { margin: 6px 0 0 18px; }
.cc-tc-card {
  max-width: 940px;            /* было 640 — окно было уже данных (дебаг владельца 15.07) */
  width: min(940px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  max-height: 92vh;            /* фолбэк без dvh */
  max-height: calc(100dvh - 32px);
}
.cc-tc-body {
  overflow-y: auto;            /* вертикальная прокрутка всего тела модалки:
                                  состав + вывод + таблицы закупок */
  min-height: 0;
  flex: 1 1 auto;
}
/* первая колонка липнет при горизонтальном скролле — на телефоне видно,
   к какому компоненту/поставщику относится строка (жалоба владельца 15.07) */
.cc-tc-table th:first-child,
.cc-tc-table td.cc-tc-name {
  position: sticky; left: 0; background: var(--fb-surface); z-index: 1;
}
.cc-tc-meta { color: var(--fb-muted); font: 400 12px var(--fb-font-body); margin: -8px 0 12px; }
.cc-tc-minor { color: var(--fb-muted); font-size: 11px; margin-top: 2px; white-space: nowrap; }
.cc-tc-minor-inline { color: var(--fb-muted); }
.cc-tc-summary { margin-top: 10px; font: 400 13px var(--fb-font-longform); color: var(--fb-text); }
.cc-tc-via { color: var(--fb-muted); font-size: 11px; margin-left: 6px; }
.cc-tc-drivers { margin-top: 12px; font: 400 13px var(--fb-font-longform); color: var(--fb-text); }
.cc-tc-empty { color: var(--fb-muted); font: 400 13px var(--fb-font-longform); }
.cc-tc-purchases { margin-top: 14px; }
.cc-tc-purchases-title { font: 600 13px var(--fb-font-body); margin-bottom: 6px; }
@media (max-width: 640px) {
  .cc-tc-table td { font-size: 11.5px; padding: 6px 5px; }
  .cc-tc-table th { padding: 4px 5px; }
}

/* === Производительность меню (menuperf) ===
   Своих цветов раздел не заводит: вердикт красит строку теми же токенами, что
   тег (--fb-tag-*), вкладки — .yd-ptab, форма и список прогонов — классы cc-*. */
.mp-hint { margin-top: 8px; color: var(--fb-muted); font: 400 12px var(--fb-font-longform); }
.mp-progress { color: var(--fb-muted); font: 400 11.5px var(--fb-font-body); margin-left: 8px; }
/* Продолжение оборванного прогона: в списке — компактная кнопка рядом с
   корзиной, на странице прогона — кнопка со строкой-обещанием под ней */
.mp-resume-btn { background: none; border: 1px solid var(--fb-border); border-radius: var(--fb-radius); padding: 3px 8px; cursor: pointer; color: var(--fb-muted); font: 500 12px var(--fb-font-body); display: inline-flex; align-items: center; gap: 4px; }
.mp-resume-btn:hover { color: var(--fb-accent); border-color: var(--fb-accent); }
.mp-resume { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-resume-hint { color: var(--fb-muted); font: 400 12px var(--fb-font-longform); }
/* Живая карточка активного прогона: стадии с барами + время (поллинг 2.5 с) */
.mp-livecard { margin-bottom: 14px; }
.mp-livehead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mp-livetitle { font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.mp-livetime, .mp-liveeta { font: 400 12px var(--fb-font-body); color: var(--fb-muted); font-variant-numeric: tabular-nums; }
.mp-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mp-stage { display: grid; grid-template-columns: 170px minmax(0, 1fr) 74px; align-items: center; gap: 10px; }
.mp-stage-name { font: 400 12px var(--fb-font-body); color: var(--fb-muted); }
.mp-stage-done .mp-stage-name { color: var(--fb-text); }
.mp-stage-current .mp-stage-name { color: var(--fb-text); font-weight: 600; }
.mp-bar { height: 6px; border-radius: 4px; background: var(--fb-border); overflow: hidden; }
.mp-bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--fb-accent); transition: width .6s ease; }
.mp-bar-indet { animation: mp-indet 1.4s ease-in-out infinite; }
@keyframes mp-indet { 0% { opacity: .35; } 50% { opacity: 1; } 100% { opacity: .35; } }
.mp-stage-note { font: 400 11px var(--fb-font-body); color: var(--fb-muted); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .mp-stage { grid-template-columns: 120px minmax(0, 1fr) 60px; } }
.mp-tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.mp-panel[hidden] { display: none; }
.mp-counts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
/* Сводка прогона (§5) — строка для владельца, а не отладочный вывод: тем же
   приглушённым тоном, что и мета прогона, и только когда есть что сказать */
.mp-summary { display: block; margin-top: 6px; color: var(--fb-muted); font: 400 12px var(--fb-font-longform); }
.mp-warnings { margin: 10px 0; padding: 10px 12px; background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); font: 400 12.5px var(--fb-font-longform); color: var(--fb-muted); }
.mp-warnings div { display: flex; align-items: flex-start; gap: 6px; margin: 2px 0; }
.mp-warnings .ic { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 2px; }
/* Дерево папок iiko — как в Фудкосте: вложенность отступом (inline padding-left
   в шаблоне), сворачивание — mpApplyTree в menuperf_run.html */
.mp-tree .mp-folder-row td { background: var(--fb-surface-2); text-align: left; }
.mp-folder-btn { background: none; border: none; padding: 0; color: var(--fb-text); font: 700 13px var(--fb-font-mono); cursor: pointer; text-align: left; display: inline-flex; align-items: baseline; gap: 6px; }
.mp-folder-btn:hover { color: var(--fb-accent); }
.mp-folder-arrow { display: inline-block; font-size: 10px; transition: transform .15s; }
.mp-folder-btn.mp-closed .mp-folder-arrow { transform: rotate(-90deg); }
.mp-folder-meta { color: var(--fb-muted); font: 500 12px var(--fb-font-body); }
.mp-folder-red { color: var(--fb-tag-alarm-fg); }
.mp-dish-btn { background: none; border: none; padding: 0; color: var(--fb-text); font: inherit; cursor: pointer; text-align: left; }
.mp-dish-btn:hover { color: var(--fb-accent); text-decoration: underline; }
.mp-z, .mp-mark { margin-left: 6px; }
/* Пара Митино: общая рамка, как у .cc-pair */
.mp-pair td { background: var(--fb-surface-2); }
.mp-pair td:first-child { border-left: 1px solid var(--fb-border); }
.mp-pair td:last-child { border-right: 1px solid var(--fb-border); }
.mp-pair tr:first-child td { border-top: 1px solid var(--fb-border); }
.mp-pair tr:last-child td { border-bottom: 1px solid var(--fb-border); }
/* Цвет вердикта на строке — ПОСЛЕ .mp-pair, чтобы выигрывал внутри пары */
.mp-row-green td { background: var(--fb-tag-signal-bg); }
.mp-row-yellow td { background: var(--fb-tag-warning-bg); }
.mp-row-red td { background: var(--fb-tag-alarm-bg); }
.mp-row-green td:first-child, .mp-row-yellow td:first-child, .mp-row-red td:first-child { border-top-left-radius: var(--fb-radius-sm); border-bottom-left-radius: var(--fb-radius-sm); }
.mp-row-green td:last-child, .mp-row-yellow td:last-child, .mp-row-red td:last-child { border-top-right-radius: var(--fb-radius-sm); border-bottom-right-radius: var(--fb-radius-sm); }
.mp-pair .mp-row-green td:first-child, .mp-pair .mp-row-yellow td:first-child, .mp-pair .mp-row-red td:first-child,
.mp-pair .mp-row-green td:last-child, .mp-pair .mp-row-yellow td:last-child, .mp-pair .mp-row-red td:last-child { border-radius: 0; }
/* Карточка позиции — та же геометрия, что у модалки техкарты Фудкоста */
.mp-card {
  max-width: 940px;
  width: min(940px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  max-height: 92vh;            /* фолбэк без dvh */
  max-height: calc(100dvh - 32px);
}
.mp-card-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.mp-metrics td { white-space: normal; }
.mp-metrics td:nth-child(odd) { color: var(--fb-muted); font-size: 12px; }
.mp-metrics td:last-child { text-align: left; }
.mp-reason { margin: 0 0 10px; font: 400 13.5px var(--fb-font-longform); color: var(--fb-text); }
.mp-note { margin: 6px 0; font: 400 12.5px var(--fb-font-longform); color: var(--fb-muted); }
.mp-block-title { margin: 14px 0 6px; font: 600 13px var(--fb-font-body); }
.mp-list { margin: 0 0 0 18px; font: 400 13px var(--fb-font-longform); color: var(--fb-text); }
.mp-untouchable { display: inline-flex; align-items: center; gap: 6px; }
.mp-untouchable .ic { width: 15px; height: 15px; }
.mp-untouchable-on { border: 1px solid var(--fb-accent); color: var(--fb-accent); }
/* Складской блок: сводка суммой раскрывается в два списка (§4) */
.mp-stock { margin: 12px 0 4px; }
.mp-stock summary { cursor: pointer; padding: 8px 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mp-stock-sum { font: 700 14px var(--fb-font-mono); color: var(--fb-text); }
.mp-stock-meta { color: var(--fb-muted); font: 500 12px var(--fb-font-body); }
.mp-stock-dishes { display: block; color: var(--fb-muted); font: 400 11.5px var(--fb-font-body); }
/* Идеальное меню (G01): две версии РЯДОМ; на узком экране — одна под другой */
.mp-ideal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.mp-ideal-col { min-width: 0; }
.mp-ideal-head { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; margin-bottom: 8px; font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.mp-ideal-count { color: var(--fb-muted); font: 500 12px var(--fb-font-body); flex: 0 0 auto; }
.mp-ideal-table td { white-space: normal; vertical-align: top; }
.mp-ideal-dish { font-weight: 600; }
.mp-origin { margin-left: 6px; }
.mp-ideal-cat { color: var(--fb-muted); font: 400 11.5px var(--fb-font-body); margin-top: 2px; }
.mp-ideal-why { color: var(--fb-muted); font: 400 12px var(--fb-font-longform); margin-top: 4px; }
.mp-ideal-comp { margin-top: 6px; font: 400 12px var(--fb-font-body); }
.mp-ideal-comp > div { margin: 3px 0; }
/* Пометка «оценка» стоит у КАЖДОЙ вилки: цифра без неё читается как измеренная */
.mp-ideal-est { color: var(--fb-muted); font: 400 11px var(--fb-font-body); margin-top: 2px; }
.mp-ideal-turnover { color: var(--fb-text); font: 400 12px var(--fb-font-longform); }
@media (max-width: 1100px) {
  .mp-ideal { grid-template-columns: minmax(0, 1fr); }
}

/* === Отчёт анализа конкурентов (карта Leaflet + ранжирование) === */
.comp-map {
  height: 340px; border-radius: var(--fb-radius); border: 1px solid var(--fb-border);
  margin: 0 0 8px; position: relative; z-index: 0;  /* свой stacking context: тайлы/попапы не перекрывают сайдбар и мобильную навигацию */
}
.leaflet-container { background: var(--fb-surface); font: 400 13px var(--fb-font-body); }
/* Попапы Leaflet в тёмной теме (дефолт — светлый) */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--fb-surface); color: var(--fb-text);
  border: 1px solid var(--fb-border); border-radius: var(--fb-radius-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.5); font: 400 13px var(--fb-font-body);
}
.leaflet-popup-content a { color: var(--fb-accent); }
a.leaflet-popup-close-button { color: var(--fb-muted); }
.comp-map-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 2px 14px; }
.comp-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.comp-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rank-group-title {
  font: 600 11px var(--fb-font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--fb-muted); margin: 14px 0 2px;
}
.rank-own { background: color-mix(in srgb, var(--fb-accent) 12%, transparent); border-radius: var(--fb-radius-sm); }
.rank-pos { color: var(--fb-muted); font: 500 12px var(--fb-font-mono); min-width: 18px; }
.rank-dist { color: var(--fb-muted); font: 400 11px var(--fb-font-mono); margin-right: 8px; white-space: nowrap; }
.comp-prose { font: 400 14px var(--fb-font-body); color: var(--fb-text); white-space: pre-line; margin: 4px 0 0; }
.report-cat-vals { display: inline-flex; gap: 0; }
.report-cat-col { min-width: 74px; text-align: right; font: 400 12px var(--fb-font-mono); color: var(--fb-text); }
.report-cat-head .report-cat-col { color: var(--fb-muted); font-size: 11px; }
.tag-warning-text { color: var(--fb-warning, #f0b35e); }
.tag-signal-text { color: var(--fb-signal, #4ade80); }
details.comp-details summary { cursor: pointer; font: 600 13px var(--fb-font-body); color: var(--fb-muted); }
details.comp-details[open] summary { margin-bottom: 8px; }

/* ── Карточка «План» вкладки доставки: мандат владельца и критерий подъёма ── */
.yd-plan-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 6px 0 2px; }
.yd-plan-field { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .4px; }
.yd-plan-input { width: 150px; }
.yd-plan-save { padding: 6px 14px; font-size: 12px; }
.yd-plan-note { font-size: 11.5px; padding: 6px 0; color: var(--fb-accent); }
.yd-plan-note.warn { color: var(--fb-tag-warning-fg); }
.yd-plan-weeks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
.yd-plan-weeks-note { font-size: 11px; color: var(--fb-muted); }

/* === Рейтинг официантов (waiterrating) ===
   Своих цветов раздел не заводит: статусы/стрики — токены тегов (--fb-tag-*),
   вкладки периода — .yd-ptab, кнопка сбора — .btn-primary-fb, таблицы — .runs-table. */
.wr-hub-empty { margin-bottom: 12px; color: var(--fb-muted); font: 400 13px var(--fb-font-longform); }
.wr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
a.wr-card { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
a.wr-card:hover { border-color: var(--fb-accent); }
.wr-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wr-card-label { font: 700 13px var(--fb-font-mono); color: var(--fb-text); letter-spacing: .04em; }
.wr-card-leader { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wr-card-leader .ic { width: 15px; height: 15px; color: var(--fb-accent); flex: 0 0 auto; }
.wr-card-name { font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.wr-card-score { font: 700 14px var(--fb-font-mono); color: var(--fb-accent); }
.wr-card-meta { margin-top: 6px; color: var(--fb-muted); font: 400 12px var(--fb-font-body); }
.wr-empty { color: var(--fb-muted); font: 400 13px var(--fb-font-longform); }
.wr-muted { color: var(--fb-muted); font: 400 12px var(--fb-font-body); }

/* страница точки */
.wr-tabs { display: flex; gap: 8px; margin: 0 0 12px; }
a.wr-tab { text-decoration: none; display: inline-flex; align-items: center; }
.wr-period { margin: 10px 0 6px; color: var(--fb-muted); font: 500 12px var(--fb-font-body); }
.wr-block { margin-top: 16px; }
.wr-block-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.wr-block-h .ic { width: 15px; height: 15px; color: var(--fb-muted); }
.wr-block-h a { margin-left: auto; color: var(--fb-muted); font: 500 12px var(--fb-font-body); text-decoration: none; }
.wr-block-h a:hover { color: var(--fb-accent); }
.wr-rank { font: 700 13px var(--fb-font-mono); color: var(--fb-muted); }
.wr-name { font: 600 13px var(--fb-font-body); color: var(--fb-text); white-space: normal; }
.wr-delta-up { color: var(--fb-tag-signal-fg); }
.wr-delta-down { color: var(--fb-tag-alarm-fg); }
.wr-commentary-text { font: 400 13.5px var(--fb-font-longform); color: var(--fb-text); white-space: pre-wrap; }

/* графики: бары по дням + линии по неделям (рендерит static/js/waiterrating.js) */
.wr-chart { margin-top: 6px; }
.wr-chart-t { color: var(--fb-muted); font: 500 11px var(--fb-font-mono); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }
.wr-bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.wr-bar { flex: 1 1 0; min-width: 3px; background: var(--fb-accent); border-radius: 2px 2px 0 0; opacity: .85; }
.wr-bar.zero { background: var(--fb-surface-2); opacity: 1; }
.wr-chart-x { display: flex; gap: 2px; margin-top: 4px; }
.wr-chart-x span { flex: 1 1 0; min-width: 3px; text-align: center; color: var(--fb-muted); font: 400 9px var(--fb-font-mono); overflow: hidden; }
.wr-line-svg { width: 100%; height: 64px; display: block; }
.wr-line-minmax { display: flex; justify-content: space-between; color: var(--fb-muted); font: 400 10px var(--fb-font-mono); margin-top: 2px; }
.wr-person { border: 1px solid var(--fb-border); border-radius: var(--fb-radius); background: var(--fb-surface); margin-top: 8px; }
.wr-person > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font: 600 13px var(--fb-font-body); color: var(--fb-text); }
.wr-person > summary::-webkit-details-marker { display: none; }
.wr-person > summary .wr-muted { margin-left: auto; }
.wr-person-body { padding: 0 12px 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.wr-total-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

/* архив и выпуск */
.wr-report-text { font: 400 13px var(--fb-font-longform); color: var(--fb-text); white-space: pre-wrap; }
.wr-chart-img { max-width: 100%; border-radius: var(--fb-radius); border: 1px solid var(--fb-border); display: block; }

/* Delivery economics and fixed, dual zone axes. */
.yd-bar{flex:0 0 auto;box-sizing:border-box}
.yd-cost{position:absolute;left:2px;right:2px;min-height:0}
.yd-cost-commission,.yd-legend .sw.commission{background:#7d8ba3}
.yd-cost-food,.yd-legend .sw.food{background:#b98bce}
.yd-cost-extra,.yd-legend .sw.extra{background:#e5a444}
.yd-cost-margin,.yd-legend .sw.profit{background:#4bb69a}
.yd-cost.loss{background:#db6470}
.yd-bar.sel,.yd-bar:focus{outline:1px solid var(--fb-accent);outline-offset:-1px}
.yd-zone-titles{display:flex;justify-content:space-between;font-size:10px;margin:12px 0 6px;color:var(--fb-muted)}
.yd-zone-titles span:last-child,.yd-zone-orders{color:var(--fb-accent)}
.yd-zone-plot{display:grid;grid-template-columns:36px minmax(0,1fr) 36px;gap:5px}
.yd-zone-axis{display:flex;flex-direction:column;justify-content:space-between;font-size:10px;height:110px;padding:6.6px 0;box-sizing:border-box}
.yd-zone-pos{text-align:right}.yd-zone-orders{text-align:left}
.yd-zone-x{margin-left:41px;margin-right:41px}
.yd-report-table{width:100%;border-collapse:collapse;font-size:12px}
.yd-report-table td,.yd-report-table th{text-align:left;padding:12px 6px;border-bottom:1px solid var(--fb-border)}
.yd-chart-x span{overflow:visible;font-size:8px;letter-spacing:-.5px}

/* Product version and its public, keyboard-accessible release history. */
.release-badge { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.sidebar-logo { flex-wrap: wrap; column-gap: 8px; row-gap: 0; }
.release-info-btn, .release-close-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--fb-radius-sm);
  background: transparent; color: var(--fb-muted); cursor: pointer;
}
.release-info-btn .ic { width: 14px; height: 14px; }
.release-info-btn:hover, .release-close-btn:hover { color: var(--fb-text); background: var(--fb-surface-2); }
.release-info-btn:focus-visible, .release-close-btn:focus-visible {
  outline: 2px solid var(--fb-accent); outline-offset: 2px;
}
.release-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  border: 1px solid var(--fb-border); border-radius: var(--fb-radius-lg);
  background: var(--fb-surface); color: var(--fb-text); overflow: auto;
}
.release-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.release-dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; padding: 20px 24px; background: var(--fb-surface);
  border-bottom: 1px solid var(--fb-border);
}
.release-dialog-head h2 { margin: 0; font: 600 17px var(--fb-font-longform); }
.release-close-btn { width: 36px; height: 36px; }
.release-dialog-body { padding: 0 24px; }
.release-entry { padding: 24px 0; }
.release-entry + .release-entry { border-top: 1px solid var(--fb-border); }
.release-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.release-entry-head h3 { margin: 0; font: 600 14px var(--fb-font-mono); }
.release-entry-head time { color: var(--fb-muted); font: 400 12px var(--fb-font-longform); }
.release-current { color: var(--fb-accent); font: 500 11px var(--fb-font-longform); }
.release-entry ul { padding-left: 18px; margin: 12px 0 0; font: 400 14px/1.6 var(--fb-font-longform); overflow-wrap: anywhere; }
.release-entry li + li { margin-top: 6px; }
@media (max-width: 519px) {
  .head-logo { flex-wrap: wrap; gap: 0 6px; }
  .release-info-btn, .release-close-btn { width: 44px; height: 44px; }
  .release-dialog-head { padding: 12px 16px; }
  .release-dialog-body { padding: 0 16px; }
}
