/* Портал отчётов для шефа/руководителя — в стилистике супер-админки (тёмная тема) */
:root {
  --chef-bg: #1a1d23;
  --chef-bg-elevated: #25282e;
  --chef-header: #1a1d23;
  --chef-header-text: #f1f3f6;
  --chef-border: #3a3f47;
  --chef-cell-alt: #1f2329;
  --chef-positive: #4ade80;
  --chef-negative: #f87171;
  --chef-text: #e4e6eb;
  --chef-text-muted: #9ca3af;
  --chef-card-bg: #25282e;
  --chef-accent: #ffc107;
  --chef-accent-soft: rgba(255, 193, 7, 0.12);
  --chef-radius: 14px;
  --chef-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --chef-chart-inner: #14171d;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, sans-serif;
  background: var(--chef-bg);
  color: var(--chef-text);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
[id] { scroll-margin-top: 16px; }

/* ═══════════ SIDEBAR ═══════════ */
.chef-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e232d 0%, #15171c 100%);
  border-right: 1px solid #2a2d35;
  padding: 16px 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}
.chef-sidebar h2 {
  padding: 0 18px;
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.chef-sidebar a {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  margin: 0 8px 2px;
  color: #9da3ae;
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chef-sidebar a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #d0d4db;
}
.chef-sidebar a.active {
  background: var(--chef-accent-soft);
  border-left-color: var(--chef-accent);
  color: var(--chef-accent);
}
.chef-sidebar a .material-icons {
  font-size: 1.25rem;
  margin-right: 12px;
  opacity: 0.85;
  flex-shrink: 0;
}
.chef-sidebar a.active .material-icons { opacity: 1; }
.chef-sidebar-logout {
  margin-top: 12px !important;
  color: #f87171 !important;
}
.chef-sidebar-logout:hover { background: rgba(248, 113, 113, 0.1) !important; }
.chef-sidebar-user {
  padding: 10px 18px 14px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: #9ca3af;
  border-bottom: 1px solid #2a2d35;
  line-height: 1.3;
}

/* ═══════════ HEADER (top bar) ═══════════ */
.chef-header {
  background: linear-gradient(165deg, #222831 0%, #1a1d23 55%, #171a20 100%);
  color: var(--chef-header-text);
  padding: 0 18px;
  min-height: 56px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid #323844;
  position: sticky;
  top: 0;
  z-index: 50;
}
.chef-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 193, 7, 0.45) 20%, rgba(255, 193, 7, 0.2) 50%, rgba(255, 193, 7, 0.45) 80%, transparent 100%);
  opacity: 0.85;
  pointer-events: none;
}
.chef-header-brand {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-left: 12px;
  border-left: 3px solid var(--chef-accent);
  border-radius: 2px 0 0 2px;
}
.chef-header-kicker {
  margin: 0 0 2px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 193, 7, 0.85);
  line-height: 1.2;
}
.chef-header-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.chef-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.chef-header-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 200px;
  padding: 6px 10px 6px 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.chef-header-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  color: #1a1d23;
  background: linear-gradient(145deg, #ffc107 0%, #ffb300 100%);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.35);
}
.chef-header-user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  text-align: right;
}
.chef-header-user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e8eaed;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chef-header-user-role {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 193, 7, 0.9);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chef-burger { background: none; border: none; color: #fff; cursor: pointer; padding: 4px; display: flex; align-items: center; }
.chef-burger .material-icons { font-size: 1.5rem; }

/* Overlay */
.chef-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
}

/* ═══════════ MAIN with sidebar offset ═══════════ */
.chef-main {
  margin-left: var(--sidebar-w);
  max-width: 1320px;
  padding: 24px 28px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* ═══════════ LOGIN (no sidebar) ═══════════ */
.chef-login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: linear-gradient(165deg, #1a1d23 0%, #12151a 100%);
}
.chef-login-wrap { width: 100%; max-width: 400px; padding: 24px; }
.chef-login-box {
  background: linear-gradient(165deg, #25282e 0%, #1f2228 100%);
  padding: 40px;
  border-radius: 18px;
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow), 0 0 0 1px rgba(255, 193, 7, 0.08);
}
.chef-login-title { margin: 0 0 8px; font-size: 1.5rem; color: #f1f3f6; font-weight: 800; letter-spacing: -0.02em; }
.chef-login-subtitle { margin: 0 0 24px; font-size: 0.95rem; color: var(--chef-text-muted); }
.chef-login-box input {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: 1px solid var(--chef-border);
  border-radius: 10px;
  font-size: 16px;
  background: #1a1d23;
  color: var(--chef-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chef-login-box input:focus {
  outline: none;
  border-color: var(--chef-accent);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15);
}
.chef-login-box button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
  color: #1a1d23;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.2s;
}
.chef-login-box button:hover { box-shadow: 0 6px 24px rgba(255, 193, 7, 0.35); }
.chef-login-box button:disabled { opacity: 0.6; cursor: not-allowed; }
.chef-login-err { margin-top: 12px; font-size: 0.9rem; min-height: 1.4em; color: var(--chef-negative); }
.chef-login-hint { margin-top: 16px; font-size: 0.8rem; color: var(--chef-text-muted); }

/* ═══════════ TOOLBAR ═══════════ */
.chef-toolbar {
  background: linear-gradient(145deg, #25282e 0%, #1f2228 100%);
  padding: 18px 22px;
  border-radius: var(--chef-radius);
  margin-bottom: 22px;
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow);
}
.chef-toolbar-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.chef-toolbar-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.chef-date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  color: var(--chef-text-muted);
  font-size: 0.84rem;
}
.chef-date-field span { flex-shrink: 0; }
.chef-toolbar label { font-weight: 600; color: var(--chef-text-muted); font-size: 0.84rem; }
.chef-toolbar input[type="date"] {
  padding: 9px 14px;
  border: 1px solid var(--chef-border);
  border-radius: 10px;
  font-size: 0.88rem;
  background: #1a1d23;
  color: var(--chef-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chef-toolbar input[type="date"]:focus {
  outline: none;
  border-color: rgba(255, 193, 7, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.12);
}
.chef-toolbar .chef-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chef-quick-btn {
  padding: 8px 14px;
  border: 1px solid var(--chef-border);
  background: #1a1d23;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--chef-text-muted);
  transition: all 0.15s;
  font-family: inherit;
}
.chef-quick-btn:hover {
  background: #2d3139;
  color: var(--chef-accent);
  border-color: rgba(255, 193, 7, 0.45);
}
.chef-quick-btn.active {
  background: var(--chef-accent-soft);
  color: var(--chef-accent);
  border-color: rgba(255, 193, 7, 0.45);
  font-weight: 600;
}
.chef-apply-btn {
  padding: 9px 18px;
  background: linear-gradient(135deg, #ffc107 0%, #e6ac00 100%);
  color: #1a1d23;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: transform 0.15s, box-shadow 0.2s;
}
.chef-apply-btn:hover { box-shadow: 0 4px 20px rgba(255, 193, 7, 0.35); }
.chef-apply-btn:disabled { opacity: 0.6; cursor: wait; }
.chef-apply-btn.chef-ai-loading { animation: chef-ai-pulse 0.8s ease-in-out infinite; }
@keyframes chef-ai-pulse { 50% { opacity: 0.6; } }

/* ═══════════ SUMMARY CARDS ═══════════ */
.chef-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.chef-summary-period {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 193, 7, 0.28);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.04) 100%);
  color: #ffe082;
  font-size: 0.9rem;
}
.chef-summary-period .material-icons {
  font-size: 20px;
  color: #ffc107;
  flex-shrink: 0;
}
.chef-summary-period-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}
.chef-summary-period-date {
  font-weight: 700;
  color: #fff3c4;
  letter-spacing: -0.01em;
}
.chef-summary-period-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cfc8a8;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 193, 7, 0.18);
}
.chef-summary-period--warn {
  background: rgba(229, 57, 53, 0.15);
  border-color: rgba(229, 57, 53, 0.45);
  color: #ffcdd2;
  margin-top: 6px;
}
.chef-rule-banner { display: none; }
.chef-paid-checks {
  margin: 0 0 22px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #3a3f47;
  background: #25282e;
}
.chef-paid-checks .chef-section-title { margin: 0 0 6px; font-size: 1.05rem; color: #e4e6eb; }
.chef-paid-checks-hint { margin: 0 0 12px; font-size: 0.82rem; color: #9ca3af; }
.chef-paid-checks-empty { color: #9ca3af; padding: 12px 0; margin: 0; }
.chef-muted { color: #9ca3af; font-size: 0.85rem; }
.chef-summary-item {
  background: linear-gradient(165deg, #25282e 0%, #1f2228 100%);
  padding: 14px 16px;
  border-radius: var(--chef-radius);
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow);
  border-top: 3px solid rgba(255, 193, 7, 0.65);
  position: relative;
  overflow: hidden;
}
.chef-summary-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.04) 0%, transparent 55%);
  pointer-events: none;
}
.chef-summary-item.negative { border-top-color: var(--chef-negative); }
.chef-summary-item.positive { border-top-color: var(--chef-positive); }
.chef-summary-item.cash-accent { border-top-color: #4caf50; }
.chef-summary-item.card-accent { border-top-color: #42a5f5; }
.chef-summary-item.mixed-accent { border-top-color: #ab47bc; }
.chef-summary-label {
  font-size: 0.72rem;
  color: var(--chef-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  position: relative;
}
.chef-summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  color: #f1f3f6;
  position: relative;
  letter-spacing: -0.02em;
}
.chef-summary-value small { font-size: 0.68rem; font-weight: 500; color: var(--chef-text-muted); }
.chef-summary-value.negative { color: var(--chef-negative); }
.chef-summary-value.positive { color: var(--chef-positive); }

/* Планшет: сводка не в 5 колонок — читаемее */
@media (max-width: 1100px) and (min-width: 769px) {
  .chef-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ═══════════ DIVIDER ═══════════ */
.chef-divider { display: flex; align-items: center; gap: 16px; margin: 28px 0 20px; }
.chef-divider::before, .chef-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--chef-border), transparent);
}
.chef-divider span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--chef-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ═══════════ DATA TABLES (collapsible) ═══════════ */
.chef-section {
  background: var(--chef-card-bg);
  border-radius: var(--chef-radius);
  margin-bottom: 12px;
  border: 1px solid var(--chef-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.chef-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(180deg, #2a2f38 0%, #25282e 100%);
  border-bottom: 1px solid var(--chef-border);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.chef-section-header:hover { background: #2d323c; }
.chef-section-header h2 { margin: 0; font-size: 0.92rem; font-weight: 700; color: #e8eaed; }
.chef-section-toggle { font-size: 1rem; color: var(--chef-text-muted); transition: transform 0.2s; }
.chef-section.collapsed .chef-section-toggle { transform: rotate(-90deg); }
.chef-section.collapsed .chef-section-body { display: none; }
.chef-section-body { padding: 0; }
.chef-section-actions { display: flex; gap: 6px; margin-left: auto; margin-right: 10px; }
.chef-export-btn {
  padding: 5px 11px;
  font-size: 0.78rem;
  border: 1px solid var(--chef-border);
  background: #1a1d23;
  color: var(--chef-text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.chef-export-btn:hover {
  background: #2d3139;
  color: var(--chef-accent);
  border-color: rgba(255, 193, 7, 0.4);
}

/* ═══════════ TABLE STYLES ═══════════ */
.chef-table-wrap { overflow-x: auto; }
.chef-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.chef-table th, .chef-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #2d3139;
}
.chef-table th {
  background: #1f2329;
  font-weight: 700;
  color: #9ca3af;
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--chef-border);
}
.chef-table tbody tr:nth-child(even) { background: var(--chef-cell-alt); }
.chef-table tbody tr:hover { background: rgba(255, 193, 7, 0.06); }
.chef-table .chef-num { text-align: right; font-variant-numeric: tabular-nums; }
.chef-table .chef-positive { color: var(--chef-positive); font-weight: 700; }
.chef-table .chef-negative { color: var(--chef-negative); font-weight: 700; }
.chef-table tfoot td {
  background: #1f2329;
  font-weight: 700;
  border-top: 1px solid var(--chef-border);
  color: #e4e6eb;
}
.chef-table .empty-state { color: var(--chef-text-muted); font-style: italic; text-align: center; padding: 20px; }
.chef-table .chef-mixed-details { background: rgba(0, 0, 0, 0.2) !important; }
.chef-table .chef-mixed-details:hover { background: rgba(255, 193, 7, 0.05) !important; }

/* ═══════════ CHARTS (как dashboard-chart-block / inventory) ═══════════ */
.chef-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.chef-chart-card {
  background: linear-gradient(165deg, #25282e 0%, #1f2228 100%);
  border-radius: var(--chef-radius);
  padding: 20px 20px 22px;
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow);
  display: flex;
  flex-direction: column;
}
.chef-chart-card-full { grid-column: 1 / -1; }
.chef-chart-card h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8eaed;
  padding-left: 12px;
  border-left: 3px solid var(--chef-accent);
  letter-spacing: 0.02em;
}
.chef-chart-canvas-wrap {
  position: relative;
  height: 250px;
  flex: 1;
  min-height: 220px;
  background: var(--chef-chart-inner);
  border-radius: 12px;
  border: 1px solid #323844;
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.chef-chart-canvas-wide { height: 270px; min-height: 240px; }
.chef-chart-empty {
  color: var(--chef-text-muted);
  font-style: italic;
  text-align: center;
  padding: 48px 16px;
  margin: 0;
}

.chef-payment-legend { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.chef-pay-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #c7cdd8;
}
.chef-pay-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.chef-pay-legend-item strong { font-weight: 700; color: #f1f3f6; }

/* ═══════════ LOADING / ERROR ═══════════ */
.chef-loading { text-align: center; padding: 40px; color: var(--chef-text-muted); font-size: 0.95rem; }
.chef-error {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  padding: 16px 18px;
  border-radius: var(--chef-radius);
  margin-bottom: 18px;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

/* ═══════════ AI ASSISTANT (сворачиваемый блок) ═══════════ */
.chef-ai-block {
  background: linear-gradient(145deg, #25282e 0%, #1f2228 100%);
  padding: 0;
  border-radius: var(--chef-radius);
  margin: 0 0 22px;
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow);
  border-left: 4px solid #7c4dff;
  overflow: hidden;
}
.chef-ai-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.chef-ai-toggle:hover {
  background: rgba(124, 77, 255, 0.08);
}
.chef-ai-toggle:focus-visible {
  outline: 2px solid rgba(255, 193, 7, 0.6);
  outline-offset: -2px;
}
.chef-ai-toggle-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.chef-ai-toggle-ico {
  font-size: 26px !important;
  color: #b39dff;
  flex-shrink: 0;
}
.chef-ai-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.chef-ai-toggle-title {
  font-size: 1rem;
  font-weight: 800;
  color: #f1f3f6;
  letter-spacing: -0.02em;
}
.chef-ai-toggle-sub {
  font-size: 0.75rem;
  color: var(--chef-text-muted);
  line-height: 1.35;
}
.chef-ai-block:not(.collapsed) .chef-ai-toggle-sub {
  display: none;
}
.chef-ai-toggle-chevron {
  flex-shrink: 0;
  font-size: 28px !important;
  color: rgba(255, 193, 7, 0.85);
  transition: transform 0.22s ease;
}
.chef-ai-block:not(.collapsed) .chef-ai-toggle-chevron {
  transform: rotate(180deg);
}
.chef-ai-block-body {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.chef-ai-block.collapsed .chef-ai-block-body {
  display: none;
}
.chef-ai-hint { margin: 0 0 12px; padding-top: 14px; font-size: 0.82rem; color: var(--chef-text-muted); line-height: 1.5; max-width: 720px; }
.chef-ai-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chef-ai-input-wrap {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  border: 1px solid var(--chef-border);
  border-radius: 10px;
  background: #1a1d23;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chef-ai-input-wrap:focus-within {
  border-color: rgba(255, 193, 7, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}
.chef-ai-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  background: transparent;
  color: var(--chef-text);
}
.chef-ai-form input::placeholder { color: #6b7280; }
.chef-ai-mic {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--chef-border);
  border-radius: 0 10px 10px 0;
  background: #25282e;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--chef-text-muted);
  transition: background 0.15s;
}
.chef-ai-mic:hover { background: #2d3139; color: var(--chef-accent); }
.chef-ai-mic.listening { background: rgba(248, 113, 113, 0.2); animation: chef-mic-pulse 0.8s ease-in-out infinite; }
@keyframes chef-mic-pulse { 50% { opacity: 0.85; } }
.chef-ai-quick-questions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chef-ai-quick-label { font-size: 0.8rem; color: var(--chef-text-muted); margin-right: 4px; }
.chef-ai-quick-q {
  padding: 6px 11px;
  border: 1px solid var(--chef-border);
  background: #1a1d23;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  color: #c7cdd8;
  transition: all 0.12s;
  font-family: inherit;
}
.chef-ai-quick-q:hover {
  border-color: rgba(255, 193, 7, 0.45);
  color: var(--chef-accent);
  background: rgba(255, 193, 7, 0.06);
}
.chef-ai-answer {
  padding: 14px 16px;
  background: #1a1d23;
  border-radius: 10px;
  min-height: 44px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.55;
  margin-top: 10px;
  border: 1px solid var(--chef-border);
  color: #d1d5db;
}
.chef-ai-answer:empty { visibility: hidden; min-height: 0; padding: 0; margin: 0; border: none; }
.chef-ai-answer.loading { color: var(--chef-text-muted); font-style: italic; }
.chef-ai-answer.error {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}
.chef-ai-structured { display: flex; flex-direction: column; gap: 14px; }
.chef-ai-summary {
  padding: 12px 14px;
  background: rgba(255, 193, 7, 0.08);
  border-left: 4px solid var(--chef-accent);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #e8eaed;
}
.chef-ai-analysis {
  padding: 12px 14px;
  background: #1f2329;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #c7cdd8;
  border: 1px solid #323844;
}
.chef-ai-recommendations {
  padding: 12px 14px;
  background: rgba(74, 222, 128, 0.08);
  border-left: 4px solid var(--chef-positive);
  border-radius: 10px;
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: #d1fae5;
}
.chef-ai-forecast {
  padding: 12px 14px;
  background: rgba(251, 191, 36, 0.08);
  border-left: 4px solid #fbbf24;
  border-radius: 10px;
  font-size: 0.88rem;
  color: #fde68a;
}
.chef-ai-charts-divider {
  margin: 20px 0 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--chef-accent);
  border-bottom: 2px solid rgba(255, 193, 7, 0.35);
  display: flex;
  align-items: center;
}
.chef-ai-charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.chef-ai-chart-item {
  background: linear-gradient(165deg, #25282e 0%, #1f2228 100%);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--chef-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.chef-ai-chart-item h4 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: #e8eaed;
  font-weight: 700;
  padding-left: 10px;
  border-left: 3px solid var(--chef-accent);
}
.chef-ai-chart-wrap {
  position: relative;
  height: 260px;
  background: var(--chef-chart-inner);
  border-radius: 10px;
  border: 1px solid #323844;
  padding: 10px;
}
.chef-ai-table-wrap { margin: 14px 0; overflow-x: auto; border-radius: 12px; border: 1px solid var(--chef-border); }
.chef-ai-table-title {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #e8eaed;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chef-ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #1a1d23;
}
.chef-ai-table th, .chef-ai-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #2d3139;
}
.chef-ai-table th {
  background: linear-gradient(135deg, #2d3540 0%, #252a33 100%);
  font-weight: 600;
  color: #c7cdd8;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--chef-border);
}
.chef-ai-table tbody tr:nth-child(even) { background: #1f2329; }
.chef-ai-table tbody tr:hover { background: rgba(255, 193, 7, 0.06); }
.chef-ai-table td:last-child { font-weight: 500; color: #e4e6eb; }

/* ═══════════ FOOTER ═══════════ */
.chef-footer {
  margin-top: 32px;
  padding: 16px 20px;
  background: linear-gradient(145deg, #25282e 0%, #1f2228 100%);
  border-radius: var(--chef-radius);
  border: 1px solid var(--chef-border);
  box-shadow: var(--chef-shadow);
}
.chef-footer-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.chef-footer-links a { color: var(--chef-accent); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.chef-footer-links a:hover { text-decoration: underline; }
.chef-footer-logout {
  padding: 8px 16px;
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 10px;
  font-size: 0.86rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.chef-footer-logout:hover { background: rgba(248, 113, 113, 0.25); }

/* Нижняя мобильная навигация — скрыта на десктопе */
.chef-mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, rgba(26, 29, 35, 0.97) 0%, #15171c 100%);
  border-top: 1px solid #323844;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.chef-mobile-nav-scroll {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  touch-action: pan-x;
}
.chef-mobile-nav-scroll::-webkit-scrollbar { display: none; }
.chef-mobile-nav-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  max-width: 88px;
  padding: 6px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: #9ca3af;
  scroll-snap-align: start;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.chef-mobile-nav-item .material-icons {
  font-size: 22px;
  margin: 0 0 2px;
  line-height: 1;
}
.chef-mobile-nav-label {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.chef-mobile-nav-item.active,
.chef-mobile-nav-item.chef-nav-link.active {
  color: var(--chef-accent);
  background: var(--chef-accent-soft);
}
.chef-mobile-nav-item:active {
  background: rgba(255, 255, 255, 0.06);
}

/* ══════════════════════════════════════════
   TABLET: sidebar collapses, header shows
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root {
    --chef-mobile-nav-h: 64px;
  }
  [id] {
    scroll-margin-top: 76px;
    scroll-margin-bottom: 12px;
  }
  .chef-sidebar h2 { display: none; }
  .chef-sidebar a.chef-nav-link[data-nav] { display: none; }
  .chef-mobile-nav { display: block; }
  .chef-main {
    margin-left: 0;
    padding-bottom: calc(20px + var(--chef-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .chef-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .chef-sidebar.open {
    transform: translateX(0);
  }
  .chef-sidebar-overlay.open {
    display: block;
  }
  .chef-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 10px;
  }
  /* Нижняя панель разделов — бургер не нужен */
  .chef-burger {
    display: none !important;
  }
}

/* ══════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .chef-header {
    padding: max(8px, env(safe-area-inset-top)) 12px 10px 12px;
    min-height: 0;
    align-items: center;
  }
  .chef-header-brand {
    padding-left: 10px;
  }
  .chef-header-kicker {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }
  .chef-header-title {
    font-size: 0.88rem;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .chef-header-user-card {
    max-width: min(48vw, 190px);
    padding: 5px 8px 5px 5px;
    gap: 8px;
    border-radius: 10px;
  }
  .chef-header-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.88rem;
    border-radius: 8px;
  }
  .chef-header-user-name {
    font-size: 0.68rem;
  }
  .chef-header-user-role {
    font-size: 0.52rem;
    letter-spacing: 0.05em;
  }

  .chef-main {
    padding: 12px;
    padding-bottom: calc(12px + var(--chef-mobile-nav-h, 64px) + env(safe-area-inset-bottom, 0px));
  }

  .chef-toolbar { padding: 12px; margin-bottom: 12px; border-radius: 14px; }
  .chef-toolbar-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .chef-toolbar-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .chef-date-field {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    font-size: 0.72rem;
  }
  .chef-toolbar input[type="date"] { width: 100%; padding: 11px 10px; font-size: 16px; min-height: 44px; border-radius: 10px; }
  .chef-toolbar .chef-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
  .chef-quick-btn { padding: 10px 4px; min-height: 42px; font-size: 0.78rem; border-radius: 10px; }
  .chef-apply-btn { width: 100%; padding: 12px; min-height: 46px; font-size: 0.92rem; border-radius: 12px; }

  /* Сводка KPI — выручка на всю ширину, остальное 2 колонки */
  .chef-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }
  .chef-summary-period {
    padding: 10px 12px;
    gap: 8px;
  }
  .chef-summary-period-text {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .chef-summary-period-date { font-size: 0.86rem; }
  .chef-summary-period-meta { font-size: 0.74rem; white-space: nowrap; }
  .chef-summary-item {
    min-width: 0;
    padding: 12px 10px;
    min-height: 74px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 14px;
  }
  .chef-summary-item--hero {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: auto;
    padding: 16px 14px;
    border-top-width: 4px;
    background:
      radial-gradient(120% 140% at 100% 0%, rgba(255, 193, 7, 0.16) 0%, transparent 55%),
      linear-gradient(165deg, #2a2e36 0%, #1f2228 100%);
  }
  .chef-summary-item--hero .chef-summary-label {
    margin-bottom: 0;
    font-size: 0.72rem;
    flex-shrink: 0;
    max-width: 38%;
  }
  .chef-summary-item--hero .chef-summary-value {
    text-align: right;
    flex: 1;
    min-width: 0;
    font-size: clamp(1.25rem, 6.2vw, 1.7rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
  }
  .chef-summary-item--hero .chef-summary-value small {
    display: inline;
    margin-left: 4px;
    margin-top: 0;
    font-size: 0.7rem;
  }
  .chef-summary-item:not(.chef-summary-item--hero) .chef-summary-label {
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 6px;
  }
  .chef-summary-item:not(.chef-summary-item--hero) .chef-summary-value {
    font-size: clamp(0.86rem, 4vw, 1.05rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    word-break: break-word;
    hyphens: none;
  }
  .chef-summary-item:not(.chef-summary-item--hero) .chef-summary-value small {
    font-size: 0.58rem;
    display: inline;
    margin-left: 3px;
    margin-top: 0;
    line-height: 1.2;
  }

  .chef-paid-checks {
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 14px;
  }
  .chef-paid-checks .chef-section-title { font-size: 0.95rem; }

  .chef-divider { margin: 20px 0 14px; }

  .chef-charts-row { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
  .chef-chart-card { padding: 16px; }
  .chef-chart-canvas-wrap { height: 210px; min-height: 200px; }
  .chef-chart-canvas-wide { height: 230px; min-height: 220px; }
  .chef-payment-legend { flex-direction: column; gap: 10px; }

  .chef-section { margin-bottom: 10px; }
  .chef-section-header { padding: 12px 14px; min-height: 46px; }
  .chef-section-header h2 { font-size: 0.88rem; flex: 1; padding-right: 6px; }
  .chef-export-btn { padding: 6px 10px; min-height: 34px; font-size: 0.8rem; }

  .chef-table-wrap { margin: 0 -14px; padding: 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chef-table { font-size: 0.8rem; min-width: 280px; }
  .chef-table th, .chef-table td { padding: 8px 10px; }
  .chef-table th { white-space: normal; font-size: 0.72rem; }

  .chef-table-cards thead { display: none; }
  .chef-table-cards tbody tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--chef-border);
    border-radius: var(--chef-radius);
    overflow: hidden;
    background: var(--chef-card-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  .chef-table-cards tbody tr:hover { background: var(--chef-card-bg); }
  .chef-table-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid #2d3139;
  }
  .chef-table-cards tbody td:last-child { border-bottom: none; }
  .chef-table-cards tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--chef-text-muted);
    font-size: 0.72rem;
    flex-shrink: 0;
    margin-right: 8px;
  }
  .chef-table-cards tbody td.chef-num { justify-content: space-between; }
  .chef-table-cards tbody td.chef-num::before { margin-right: auto; }
  .chef-table-cards tbody tr .empty-state { display: block; padding: 20px; text-align: center; }
  .chef-table-cards tbody tr .empty-state::before { display: none; }
  .chef-table-cards tfoot {
    display: block;
    margin-top: 10px;
    padding: 12px 14px;
    background: #1f2329;
    border-radius: var(--chef-radius);
    border: 1px solid var(--chef-border);
  }
  .chef-table-cards tfoot tr { display: block; margin: 0; border: none; box-shadow: none; }
  .chef-table-cards tfoot td { display: inline; padding: 0 4px 0 0; border: none; }

  .chef-ai-toggle { padding: 12px; gap: 8px; }
  .chef-ai-toggle-ico { font-size: 24px !important; }
  .chef-ai-toggle-chevron { font-size: 26px !important; }
  .chef-ai-toggle-sub { font-size: 0.68rem; }
  .chef-ai-block-body { padding: 0 12px 12px; }
  .chef-ai-form { flex-direction: column; align-items: stretch; }
  .chef-ai-input-wrap { min-width: 0; }
  .chef-ai-form input { min-width: 0; font-size: 16px; }
  .chef-ai-quick-questions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
  .chef-ai-quick-label { width: 100%; margin-bottom: 2px; }
  .chef-ai-quick-q { min-height: 36px; padding: 8px 10px; border-radius: 999px; }
  .chef-ai-charts { grid-template-columns: 1fr; gap: 12px; }

  .chef-footer { margin-top: 16px; padding: 12px; }
  .chef-footer-links { flex-direction: column; gap: 10px; }
  .chef-footer-logout { width: 100%; padding: 12px; min-height: 44px; }
  .chef-footer-links a {
    display: block;
    padding: 12px;
    text-align: center;
    background: #1a1d23;
    border-radius: 10px;
    border: 1px solid var(--chef-border);
  }
}

@media (max-width: 480px) {
  .chef-summary { gap: 7px; }
  .chef-summary-item:not(.chef-summary-item--hero) {
    padding: 11px 9px;
    min-height: 70px;
  }
  .chef-summary-item--hero { padding: 14px 12px; }
  .chef-toolbar .chef-quick { grid-template-columns: repeat(4, 1fr); }
  .chef-login-wrap { padding: 16px; }
  .chef-login-box { padding: 28px; }
  .chef-login-title { font-size: 1.25rem; }
  .chef-chart-canvas-wrap { height: 180px; min-height: 170px; }
  .chef-chart-canvas-wide { height: 200px; min-height: 190px; }
}

@media (max-width: 360px) {
  .chef-summary-item:not(.chef-summary-item--hero) .chef-summary-value {
    font-size: clamp(0.78rem, 3.8vw, 0.95rem);
  }
  .chef-quick-btn { font-size: 0.72rem; padding: 9px 2px; }
}
