/* Дашборд трабл-шутера в облике Айвы.
   Токены, reset и правила компонентов перенесены из services/frontend репозитория
   aiva как есть: app/styles/globals.css, LoginPage, LoginForm, Sidebar, NavItem,
   MainLayout, Button, Input, Select, Tabs, Table, DataTable, StatusBadge,
   Breadcrumbs, Card, Avatar, StatisticsPage. Свои правила — в конце файла. */

/* ===== Токены (globals.css) ===== */
:root {
  --accent-50: 346 87% 97%;
  --accent-100: 346 84% 93%;
  --accent-200: 346 82% 85%;
  --accent-300: 345 83% 75%;
  --accent-400: 345 82% 67%;
  --accent-500: 344 81% 59%;
  --accent-600: 343 69% 49%;
  --accent-700: 343 73% 39%;
  --accent-800: 343 74% 30%;
  --accent-900: 343 74% 19%;

  --graphite-0: 0 0% 100%;
  --graphite-50: 210 11% 96%;
  --graphite-100: 210 12% 93%;
  --graphite-200: 214 11% 88%;
  --graphite-300: 213 10% 79%;
  --graphite-400: 214 9% 64%;
  --graphite-500: 212 7% 46%;
  --graphite-600: 210 10% 33%;
  --graphite-700: 210 11% 22%;
  --graphite-800: 210 12% 13%;
  --graphite-950: 220 13% 5%;

  --gradient-pulp: linear-gradient(135deg, #EB416D 0%, #FF7A45 100%);
  --gradient-haze: linear-gradient(180deg, #FEF1F4 0%, #FFFFFF 100%);

  --background: var(--graphite-0);
  --foreground: 210 14% 9%;
  --card: var(--graphite-0);
  --card-foreground: 210 14% 9%;
  --page: 210 14% 97%;
  --page-gradient: linear-gradient(150deg, hsl(var(--graphite-0)) 0%, hsl(var(--graphite-50)) 50%, hsl(var(--graphite-200)) 100%);
  --card-tint: var(--graphite-0);
  --popover: var(--graphite-0);
  --popover-foreground: 210 14% 9%;
  --primary: var(--accent-500);
  --primary-foreground: var(--graphite-0);
  --secondary: var(--graphite-50);
  --secondary-foreground: 210 14% 9%;
  --muted: var(--graphite-50);
  --muted-foreground: var(--graphite-500);
  --accent: var(--graphite-100);
  --accent-foreground: 210 14% 9%;
  --destructive: 0 72% 51%;
  --destructive-foreground: var(--graphite-0);
  --success: 139 79% 40%;
  --success-foreground: var(--graphite-0);
  --warning: 38 92% 50%;
  --warning-foreground: var(--graphite-0);
  --info: 226 76% 45%;
  --info-foreground: var(--graphite-0);
  --highlight: 263 70% 50%;
  --highlight-foreground: 0 0% 100%;
  --status-success: var(--success);
  --status-success-text: 142 76% 26%;
  --status-progress: 30 95% 50%;
  --status-progress-text: 26 90% 36%;
  --status-error: var(--destructive);
  --status-error-text: 0 72% 40%;
  --status-neutral: 214 10% 62%;
  --status-neutral-text: 214 10% 40%;
  --status-info: var(--info);
  --status-info-text: 226 70% 40%;
  --border: var(--graphite-100);
  --input: var(--graphite-200);
  --ring: var(--accent-500);
  --radius-xs: 0.375rem;
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-full: 9999px;
  --radius: var(--radius-md);
  --font-sans: 'Onest', sans-serif;
  --font-display: 'Wix Madefor Display', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --text-h3-size: 1.375rem;
  --text-h3-line: 1.75rem;
  --text-h3-weight: 700;
  --text-overline-size: 0.75rem;
  --text-overline-weight: 700;
  --text-overline-tracking: 0.12em;

  color-scheme: light;

  --shadow-xs: 0 1px 2px rgba(19, 22, 25, 0.06);
  --shadow-sm: 0 2px 8px rgba(19, 22, 25, 0.08);
  --shadow-md: 0 8px 24px -6px rgba(19, 22, 25, 0.12);
  --shadow-lg: 0 24px 48px -12px rgba(19, 22, 25, 0.18);
  --shadow-accent: 0 10px 28px -8px rgba(235, 65, 109, 0.5);

  --field-height: 2.5rem;
  --field-height-sm: 2rem;
  --field-bg: hsl(var(--background));
  --field-border: hsl(var(--foreground) / 0.08);
  --field-border-hover: hsl(var(--foreground) / 0.16);
  --field-border-focus: hsl(var(--foreground) / 0.24);
  --field-shadow: 0 1px 2px rgba(19, 22, 25, 0.04);

  --surface-sheen: none;
}

.dark {
  --background: 220 6% 5%;
  --foreground: 210 9% 91%;
  --card: 220 6% 7%;
  --card-foreground: 210 9% 91%;
  --page: 0 0% 2%;
  --page-gradient:
    radial-gradient(55% 45% at 8% 0%, hsl(210 20% 80% / 0.06), transparent 70%),
    radial-gradient(70% 55% at 50% 110%, hsl(210 20% 80% / 0.04), transparent 70%),
    linear-gradient(hsl(0 0% 2%), hsl(0 0% 2%));
  --card-tint: 220 6% 7%;
  --popover: 220 6% 9%;
  --popover-foreground: 210 9% 91%;
  --primary: var(--accent-400);
  --primary-foreground: var(--graphite-950);
  --secondary: 220 5% 12%;
  --secondary-foreground: 210 9% 91%;
  --muted: 220 5% 12%;
  --muted-foreground: var(--graphite-400);
  --accent: 220 5% 12%;
  --accent-foreground: 210 9% 91%;
  --destructive: 0 91% 71%;
  --destructive-foreground: 210 14% 9%;
  --success: 140 70% 56%;
  --success-foreground: 210 14% 9%;
  --warning: 43 96% 56%;
  --warning-foreground: 210 14% 9%;
  --info: 227 83% 65%;
  --info-foreground: 210 14% 9%;
  --highlight: 255 92% 76%;
  --highlight-foreground: 0 0% 9%;
  --status-success: var(--success);
  --status-success-text: 140 65% 66%;
  --status-progress: 34 95% 58%;
  --status-progress-text: 36 95% 68%;
  --status-error: var(--destructive);
  --status-error-text: 0 90% 78%;
  --status-neutral: 214 8% 52%;
  --status-neutral-text: 214 10% 72%;
  --status-info: var(--info);
  --status-info-text: 227 85% 76%;
  --border: 220 5% 16%;
  --input: 220 5% 16%;
  --ring: var(--accent-400);

  color-scheme: dark;

  --surface-sheen: linear-gradient(180deg, hsl(0 0% 100% / 0.04) 0%, hsl(0 0% 100% / 0) 65%);
  --shadow-overlay-dark: 0 24px 48px rgba(0, 0, 0, 0.8);

  --field-bg: hsl(var(--foreground) / 0.04);
  --field-border: hsl(var(--foreground) / 0.08);
  --field-border-hover: hsl(var(--foreground) / 0.16);
  --field-border-focus: hsl(var(--foreground) / 0.24);
  --field-shadow: none;
}

/* ===== Reset (globals.css) ===== */
*,
::before,
::after {
  box-sizing: border-box;
}

* {
  border-color: hsl(var(--border));
}

/* Классы с display перебивают атрибут hidden — возвращаем ему силу. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: radial-gradient(70% 55% at 72% -10%, hsl(var(--accent-500) / 0.12), transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6,
p, blockquote, dl, dd, hr, figure, pre {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

button,
input,
select,
textarea {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

/* Иконки lucide: обводка вместо заливки, как у lucide-react. */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Утилиты (globals.css) ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.scrollbar-thin::-webkit-scrollbar { width: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.45);
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Button (shared/components/Button) ===== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition-property: color, background-color, border-color, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.button:active {
  transform: scale(0.96);
}
.button:disabled {
  pointer-events: none;
  opacity: 0.5;
}
.button svg {
  pointer-events: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.button--default {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.button--default:hover { background: hsl(var(--accent-600)); }
.button--default:active { background: hsl(var(--accent-700)); }

.button--outline {
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
}
.button--outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.button--ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.button--link {
  color: hsl(var(--primary));
  text-underline-offset: 4px;
}
.button--link:hover { text-decoration: underline; }

.button--size-default { height: 2.5rem; padding: 0.5rem 22px; }
.button--size-sm { height: 2rem; border-radius: var(--radius-sm); padding: 0 14px; font-size: 0.8125rem; }
.button--size-lg { height: 3rem; border-radius: var(--radius-md); padding: 0 26px; font-size: 1rem; }
.button--size-icon { height: 2.5rem; width: 2.5rem; }

@media (hover: none), (max-width: 767px) {
  .button--size-sm {
    min-height: 2.25rem;
  }
}

/* ===== ThemeToggle ===== */
.theme-toggle {
  display: inline-flex;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  transition-property: color, background-color, border-color, transform;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-toggle:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}
.theme-toggle:active {
  transform: scale(0.96);
}
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}
.button .theme-toggle__icon,
.theme-toggle__icon {
  height: 1.125rem;
  width: 1.125rem;
  stroke-width: 1.5;
}

/* ===== Input (shared/components/Input) ===== */
.input {
  display: flex;
  height: var(--field-height);
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  color: hsl(var(--foreground));
  box-shadow: var(--field-shadow);
  transition: border-color 150ms;
}
.input:hover:not(:disabled) {
  border-color: var(--field-border-hover);
}
.input::placeholder {
  color: hsl(var(--muted-foreground));
}
.input:focus-visible {
  outline: none;
  border-color: var(--field-border-focus);
}
.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
@media (min-width: 768px) {
  .input {
    font-size: 0.875rem;
  }
}

/* ===== Select (shared/components/Select, триггер) ===== */
.select__trigger {
  display: flex;
  height: var(--field-height);
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  padding: 0 0.625rem 0 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  box-shadow: var(--field-shadow);
  transition: border-color 150ms;
}
.select__trigger:hover:not(:disabled) {
  border-color: var(--field-border-hover);
}
.select__trigger:focus-visible {
  outline: none;
  border-color: var(--field-border-focus);
}

/* ===== Checkbox (shared/components/Checkbox) ===== */
.checkbox__root {
  display: grid;
  place-content: center;
  height: 1.25rem;
  width: 1.25rem;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  box-shadow: inset 0 0 0 1px hsl(var(--primary));
  cursor: pointer;
}
.checkbox__root:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px hsl(var(--primary)), 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
/* Галочка lucide check — картинкой: у нативного чекбокса нет детей. */
.checkbox__root:checked {
  background: hsl(var(--primary)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.875rem no-repeat;
}
.dark .checkbox__root:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0c0e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* ===== Tabs / Segmented (shared/components/Tabs) ===== */
.tabs__list {
  --tabs-height: 2.5rem;
  --tabs-pad: 0.25rem;
  --tabs-radius: var(--radius-md);
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 0.125rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: var(--tabs-radius);
  background: hsl(var(--foreground) / 0.06);
  padding: var(--tabs-pad);
  color: hsl(var(--muted-foreground));
}
.tabs__list::-webkit-scrollbar {
  display: none;
}

.tabs__trigger {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: calc(var(--tabs-height) - 2 * var(--tabs-pad));
  white-space: nowrap;
  border-radius: calc(var(--tabs-radius) - var(--tabs-pad));
  padding: 0 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  transition-property: color, background-color, box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.tabs__trigger svg {
  height: 1rem;
  width: 1rem;
  flex-shrink: 0;
}
.tabs__trigger:hover:not([data-state="active"]) {
  color: hsl(var(--foreground));
}
.tabs__trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.6);
}
.tabs__trigger[data-state="active"] {
  background: hsl(var(--graphite-0));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgba(19, 22, 25, 0.08), 0 1px 1px rgba(19, 22, 25, 0.04);
}
.dark .tabs__trigger[data-state="active"] {
  background: hsl(var(--foreground) / 0.16);
  box-shadow: none;
}

.tabs__badge {
  display: inline-flex;
  min-width: 1.125rem;
  height: 1.125rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 0.3125rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tabs__badge--muted {
  background: hsl(var(--foreground) / 0.1);
  color: hsl(var(--foreground));
}

.tabs__list--full {
  display: flex;
  width: 100%;
}
.tabs__list--full .tabs__trigger {
  flex: 1 1 0;
  min-width: 0;
}

.tabs__list--sm {
  --tabs-height: 2rem;
  --tabs-pad: 0.1875rem;
  --tabs-radius: var(--radius-sm);
}
.tabs__list--sm .tabs__trigger {
  padding: 0 0.625rem;
  font-size: 0.75rem;
}
.tabs__list--full.tabs__list--sm .tabs__trigger {
  padding: 0 0.375rem;
}

.tabs__content {
  margin-top: 1.25rem;
}

@media (hover: none), (max-width: 767px) {
  .tabs__list:not(.tabs__list--sm) {
    --tabs-height: 2.75rem;
  }
}

/* ===== Card (shared/components/Card) ===== */
.card {
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  background-image: var(--surface-sheen);
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
}

/* ===== Table + DataTable ===== */
.table__wrapper {
  position: relative;
  width: 100%;
  overflow: auto;
}

.table {
  width: 100%;
  caption-side: bottom;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.table__header tr {
  border-bottom: 1px solid hsl(var(--foreground) / 0.08);
}

.table__body tr:last-child {
  border-width: 0;
}

.table__row {
  border-bottom: 1px solid hsl(var(--foreground) / 0.06);
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.table__body .table__row:hover {
  background: hsl(var(--accent));
}

.table__head {
  height: 2.5rem;
  padding: 0 1rem;
  text-align: left;
  vertical-align: middle;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.table__cell {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.data-table {
  overflow: hidden;
  border: 1px solid hsl(var(--foreground) / 0.06);
  border-radius: var(--radius-lg);
  background: hsl(var(--card));
  box-shadow: var(--shadow-xs);
}

.data-table__header-row,
.data-table__header-row:hover {
  background: hsl(var(--card));
}

.data-table__empty-row:hover,
.table__body .data-table__empty-row:hover {
  background: transparent;
}

.data-table__empty-cell {
  height: 16rem;
}

.data-table__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.data-table__empty-icon {
  margin-bottom: 1rem;
  height: 4rem;
  width: 4rem;
  color: hsl(var(--muted-foreground) / 0.6);
  stroke-width: 1.5;
}

.data-table__empty-title {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.data-table__empty-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.skeleton {
  display: block;
  height: 1.25rem;
  width: 100%;
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  animation: pulseOpacity 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== StatusBadge ===== */
.status-badge--success { --status: var(--status-success); --status-text: var(--status-success-text); }
.status-badge--progress { --status: var(--status-progress); --status-text: var(--status-progress-text); }
.status-badge--error { --status: var(--status-error); --status-text: var(--status-error-text); }
.status-badge--neutral { --status: var(--status-neutral); --status-text: var(--status-neutral-text); }
.status-badge--info { --status: var(--status-info); --status-text: var(--status-info-text); }

.status-badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  height: 1.375rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-full);
  background: hsl(var(--status) / 0.12);
  color: hsl(var(--status-text));
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  flex-shrink: 0;
  height: 0.375rem;
  width: 0.375rem;
  border-radius: var(--radius-full);
  background: hsl(var(--status));
}

.status-badge svg {
  height: 0.8125rem;
  width: 0.8125rem;
}

/* ===== Pagination ===== */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pagination-bar__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.pagination-bar__nav-btn {
  gap: 0.25rem;
}

.button .pagination-bar__nav-icon {
  height: 1rem;
  width: 1rem;
}

.pagination-bar__nav-label {
  display: none;
}
@media (min-width: 640px) {
  .pagination-bar__nav-label {
    display: inline;
  }
}

.pagination-bar__info {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  padding-bottom: 0.75rem;
}

.breadcrumbs__list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.875rem;
}

.breadcrumbs__item {
  display: flex;
  align-items: center;
}

.breadcrumbs__item--shrink {
  min-width: 0;
}

.breadcrumbs__separator {
  height: 1rem;
  width: 1rem;
  margin: 0 0.25rem;
  color: hsl(var(--muted-foreground));
}

.breadcrumbs__current {
  color: hsl(var(--foreground));
  font-weight: 500;
}

.breadcrumbs__link,
.breadcrumbs__root {
  color: hsl(var(--muted-foreground));
  transition: color 150ms;
}
.breadcrumbs__link:hover {
  color: hsl(var(--foreground));
}

/* ===== Avatar / UserAvatar ===== */
.avatar {
  position: relative;
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-full);
}

.avatar__fallback {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: hsl(var(--muted));
}

.user-avatar__fallback {
  background: linear-gradient(
    135deg,
    hsl(var(--avatar-hue, 220) 85% 90%),
    hsl(calc(var(--avatar-hue, 220) + 18) 75% 82%)
  );
  color: hsl(var(--avatar-hue, 220) 50% 30%);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
}

.dark .user-avatar__fallback {
  background: linear-gradient(
    135deg,
    hsl(var(--avatar-hue, 220) 35% 32%),
    hsl(calc(var(--avatar-hue, 220) + 18) 35% 26%)
  );
  color: hsl(var(--avatar-hue, 220) 80% 88%);
}

.author-avatar {
  height: 1.75rem;
  width: 1.75rem;
}

.author-avatar .user-avatar__fallback {
  font-size: 0.6875rem;
}

/* ===== FormError ===== */
.form-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-xs);
  background: hsl(var(--destructive) / 0.1);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--destructive));
}

.form-error__icon {
  height: 1rem;
  width: 1rem;
  flex-shrink: 0;
  stroke-width: 1.5;
}

/* ===== BrandLogo ===== */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.brand-logo__title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
}

/* ===== LoginPage ===== */
.login-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(150deg, hsl(var(--graphite-0)) 0%, hsl(var(--graphite-50)) 50%, hsl(var(--graphite-100)) 100%);
}

.login-page__panel {
  position: relative;
  display: flex;
  flex: 1 1 50%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-page__theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
}

.login-page__content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 38rem;
  border: 1px solid hsl(var(--foreground) / 0.06);
  border-radius: var(--radius-xl);
  background: hsl(var(--card));
  padding: 5.5rem 5rem 4rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
  .login-page__content {
    padding: 4rem 1.5rem 2rem;
    border-radius: var(--radius-xl);
  }
}

.login-page__header {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.login-page__heading-group > * + * {
  margin-top: 0.5rem;
}

.login-page__brand {
  justify-content: center;
}

.login-page__brand .brand-logo__title {
  font-size: 2.75rem;
  color: hsl(var(--primary));
}

.login-page__subtitle {
  font-size: 1.0625rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.login-page__showcase {
  position: relative;
  display: none;
  flex: 1 1 50%;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .login-page__showcase {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.login-page__pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M9 6v6M6 9h6' stroke='rgba(67,67,69,0.22)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 18px 18px;
  opacity: var(--spot, 0);
  transition: opacity 300ms;
  mask-image: radial-gradient(circle 140px at var(--mx, -999px) var(--my, -999px), black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle 140px at var(--mx, -999px) var(--my, -999px), black 0%, transparent 100%);
}

.login-page__showcase-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 40rem;
  padding: 0 3rem;
  color: hsl(var(--graphite-800));
}

.login-page__showcase-eyebrow {
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--graphite-500));
}

.login-page__showcase-title {
  margin: 0;
  font-size: clamp(1.875rem, 2.8vw, 3rem);
  line-height: 1.05;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-page__showcase-list {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
}

.login-page__showcase-list li {
  padding: 0.875rem 0;
  border-top: 1px solid hsl(var(--graphite-200));
  font-size: 1rem;
  line-height: 1.45;
  color: hsl(var(--graphite-600));
}

.login-page__showcase-list li:last-child {
  border-bottom: 1px solid hsl(var(--graphite-200));
}

/* ===== ShowcasePreview ===== */
.showcase-preview {
  position: relative;
  margin-top: 2.5rem;
  width: 36rem;
  perspective: 1600px;
}

.showcase-preview__window {
  display: flex;
  height: 19rem;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #fff;
  color: #1c1e21;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.45);
  transform: rotateY(-10deg) rotateX(4deg);
  transform-origin: left center;
  font-size: 0.6875rem;
  line-height: 1.45;
  text-align: left;
}

.showcase-preview svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

.showcase-preview__sidebar {
  display: flex;
  width: 9.5rem;
  flex-shrink: 0;
  flex-direction: column;
  gap: 0.125rem;
  border-right: 1px solid #eceef1;
  padding: 0.875rem 0.625rem;
}

.showcase-preview__brand {
  margin: 0 0.375rem 0.625rem;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: hsl(var(--primary));
}

.showcase-preview__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  padding: 0.3125rem 0.375rem;
  color: #3a3d42;
}

.showcase-preview__nav--active {
  background: #f1f2f4;
  font-weight: 600;
}

.showcase-preview__section {
  margin: 0.75rem 0.375rem 0.25rem;
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a9ea6;
}

.showcase-preview__chat {
  height: 0.4375rem;
  margin: 0.3125rem 0.375rem;
  border-radius: var(--radius-full);
  background: #eceef1;
}

.showcase-preview__chat--short {
  width: 60%;
}

.showcase-preview__main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.125rem 0.875rem;
}

.showcase-preview__question {
  align-self: flex-end;
  max-width: 80%;
  border: 1px solid #eceef1;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
}

.showcase-preview__answer ul {
  margin: 0.375rem 0 0.625rem;
  padding-left: 0.875rem;
  list-style: disc;
}

.showcase-preview__answer li::marker {
  color: hsl(var(--primary));
}

.showcase-preview__source {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid #eceef1;
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  font-weight: 500;
  color: #3a3d42;
}

.showcase-preview__input {
  position: relative;
  margin-top: auto;
  border: 1px solid #eceef1;
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  color: #9a9ea6;
}

.showcase-preview__send {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  height: 1.25rem;
  width: 1.25rem;
  transform: translateY(-50%);
  border-radius: var(--radius-full);
  background: hsl(var(--primary));
}

.showcase-preview__toast {
  position: absolute;
  left: -1.5rem;
  bottom: -1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.625rem 0.875rem;
  color: #1c1e21;
  font-size: 0.75rem;
  line-height: 1.3;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.showcase-preview__toast b {
  display: block;
  font-weight: 600;
}

.showcase-preview__toast small {
  color: #6b6f76;
  font-size: 0.6875rem;
}

.showcase-preview__toast-icon {
  display: inline-flex;
  height: 1.75rem;
  width: 1.75rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--gradient-pulp);
  color: #fff;
}

.showcase-preview__toast-icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

@media (max-height: 820px) {
  .showcase-preview {
    display: none;
  }
}

/* ===== LoginForm ===== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form__fields {
  overflow: hidden;
  border: 1px solid hsl(var(--foreground) / 0.12);
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  transition: border-color 150ms;
}

.login-form__fields:focus-within {
  border-color: hsl(var(--foreground) / 0.3);
}

.login-form__field {
  display: block;
  width: 100%;
  height: 3.75rem;
  border: 0;
  background: transparent;
  padding: 0 1.25rem;
  font-size: 1.0625rem;
  color: hsl(var(--foreground));
}

.login-form__field::placeholder {
  color: hsl(var(--muted-foreground));
}

.login-form__field:focus {
  outline: none;
}

.login-form__field:-webkit-autofill {
  -webkit-text-fill-color: hsl(var(--foreground));
  box-shadow: 0 0 0 100px hsl(var(--background)) inset;
  caret-color: hsl(var(--foreground));
}

.login-form__field:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.login-form__password {
  position: relative;
  border-top: 1px solid hsl(var(--foreground) / 0.1);
}

.login-form__field--password {
  padding-right: 3rem;
}

.login-form__eye {
  position: absolute;
  top: 50%;
  right: 0.625rem;
  display: inline-flex;
  height: 2rem;
  width: 2rem;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 150ms, background-color 150ms;
}

.login-form__eye:hover {
  background: hsl(var(--foreground) / 0.06);
  color: hsl(var(--foreground));
}

.login-form__eye:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}

.login-form__eye svg {
  height: 1.125rem;
  width: 1.125rem;
  stroke-width: 1.5;
}

.login-form__hint {
  margin-top: -0.25rem;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  color: hsl(var(--destructive));
}

.login-form__submit {
  width: 100%;
  height: 3.5rem;
  border-radius: var(--radius-lg);
  font-size: 1.0625rem;
}

/* ===== MainLayout ===== */
.main-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--page-gradient);
  background-attachment: fixed;
  color: hsl(var(--foreground));
}

.main-layout__sidebar {
  display: flex;
  flex-direction: column;
  width: calc(16rem + 0.5rem);
  flex-shrink: 0;
  padding: 0.5rem 0 0.5rem 0.5rem;
  overflow: hidden;
}

.main-layout__sidebar .main-layout__panel {
  overflow: hidden;
  border: 1px solid hsl(var(--foreground) / 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.main-layout__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}

.main-layout__main {
  flex: 1 1 0%;
  overflow-y: auto;
}

.main-layout__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Sidebar + NavItem ===== */
.sidebar {
  --sidebar-radius: var(--radius-sm);
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  background-image: var(--surface-sheen);
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 4rem;
  padding: 0.75rem 1rem;
}

.sidebar__brand {
  display: flex;
  height: 2.5rem;
  align-items: center;
  padding-left: 0.625rem;
  white-space: nowrap;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  color: hsl(var(--primary));
}

.sidebar__nav {
  padding: 0 1rem 0.75rem;
}
.sidebar__nav > * + * {
  margin-top: 0.25rem;
}

.sidebar__spacer {
  flex: 1 1 0%;
}

.sidebar__footer {
  margin: 0 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid hsl(var(--border));
}

.sidebar__avatar {
  height: 2.25rem;
  width: 2.25rem;
  flex-shrink: 0;
}

.sidebar__profile-info {
  flex: 1 1 0%;
  min-width: 0;
}

.sidebar__profile-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.sidebar__profile-email {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  white-space: nowrap;
  padding: 0.625rem;
  border-radius: var(--sidebar-radius, 0.5rem);
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.nav-item:hover {
  background: hsl(var(--foreground) / 0.04);
  color: hsl(var(--foreground));
}
.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.6);
}

.nav-item--active,
.nav-item--active:hover {
  background: hsl(var(--foreground) / 0.07);
  color: hsl(var(--foreground));
}

.nav-item__icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  transition: color 150ms;
  color: hsl(var(--muted-foreground));
}

.nav-item--active .nav-item__icon {
  color: hsl(var(--foreground));
}

.nav-item__label-wrap {
  display: flex;
  min-width: 0;
  flex: 1 1 0%;
  align-items: center;
  gap: 0.5rem;
}

.nav-item__label {
  min-width: 0;
  flex: 1 1 0%;
  font-size: 0.875rem;
}

.nav-item__badge {
  margin-left: auto;
  display: inline-flex;
  height: 1.25rem;
  min-width: 1.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: hsl(var(--foreground) / 0.07);
  padding: 0 0.25rem;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: hsl(var(--muted-foreground));
}

/* ===== StatisticsPage ===== */
.statistics-page {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 2.5rem;
}

.statistics-page__section-title {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  border-bottom: 1px solid hsl(var(--border));
  padding-bottom: 0.5rem;
}

.statistics-page__section-title-heading {
  font-size: var(--text-overline-size);
  font-weight: var(--text-overline-weight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--foreground) / 0.75);
}

.statistics-page__chart-card-title {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.statistics-page__kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: hsl(var(--border));
  box-shadow: none;
  padding: 0;
  border-radius: var(--radius-lg);
}

@media (min-width: 1024px) {
  .statistics-page__kpi-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Пять ячеек в две колонки: последняя на всю ширину, без дыры. */
@media (max-width: 1023px) {
  .statistics-page__kpi-cell:last-child:nth-child(odd) {
    grid-column: span 2;
  }
}

.statistics-page__kpi-cell {
  background: hsl(var(--card));
  padding: 1rem 1.25rem;
}

.statistics-page__kpi-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.statistics-page__kpi-icon {
  height: 0.875rem;
  width: 0.875rem;
  flex-shrink: 0;
}

.statistics-page__kpi-value {
  margin-top: 0.375rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

.statistics-page__tile-tag {
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.125rem 0.5rem;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  white-space: nowrap;
}

.statistics-page__empty {
  padding: 2.5rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.statistics-page__fade-in {
  display: inline-block;
  animation: statistics-page-fade-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes statistics-page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ===== Markdown-ритм из globals.css (списки, цитата) ===== */
.markdown-body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: hsl(var(--foreground));
  overflow-wrap: anywhere;
  word-break: break-word;
}
.markdown-body > * + * {
  margin-top: 1.05rem;
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4rem;
}
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin: 0.3rem 0; }
.markdown-body li::marker { color: hsl(var(--primary)); }
.markdown-body blockquote {
  padding: 0.85rem 1.1rem;
  border-left: 3px solid hsl(var(--primary));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: hsl(var(--muted) / 0.4);
  color: hsl(var(--muted-foreground));
}

/* ===== Свои правила дашборда (на токенах Айвы) ===== */

.sidebar__brand-sub {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  color: hsl(var(--muted-foreground));
}

.sidebar__theme {
  padding: 0 1rem 0.75rem;
}

.sidebar__profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.125rem;
}

.sidebar__logout {
  height: 2.25rem;
  width: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--sidebar-radius);
  color: hsl(var(--muted-foreground));
}
.button--ghost.sidebar__logout:hover {
  background: hsl(var(--foreground) / 0.04);
  color: hsl(var(--primary));
}

.statistics-page__section-title-hint {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* Строки, по которым переходят. */
.table__row--link {
  cursor: pointer;
}
.table__row--link:focus-visible {
  outline: none;
  background: hsl(var(--accent));
}

.table__head--num,
.table__cell--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table__head--when { width: 9rem; }
.table__head--who { width: 15rem; }

.table__cell--muted {
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.table__cell--top {
  vertical-align: top;
}

.person {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.person__text {
  min-width: 0;
}

.person__name {
  font-weight: 500;
  color: hsl(var(--foreground));
}

.person__email {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.question__title {
  font-weight: 500;
  color: hsl(var(--foreground));
}

.question__text {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.muted-dash {
  color: hsl(var(--muted-foreground) / 0.6);
}

/* Строка фильтров: как statistics-filters. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.filters__field {
  position: relative;
}

.filters__field--user {
  width: 15rem;
}

.filters__field--search {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.filters__icon {
  pointer-events: none;
  position: absolute;
  left: 0.75rem;
  top: 50%;
  height: 1rem;
  width: 1rem;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
}

.filters__select {
  padding-left: 2.25rem;
  padding-right: 2rem;
  cursor: pointer;
}

/* Иконка «вверх-вниз» у селекта (chevrons-up-down) — маской, чтобы брала цвет темы. */
.filters__field--user::after {
  content: '';
  pointer-events: none;
  position: absolute;
  right: 0.625rem;
  top: 50%;
  height: 0.875rem;
  width: 0.875rem;
  transform: translateY(-50%);
  background: hsl(var(--muted-foreground));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.filters__input {
  padding-left: 2.25rem;
}

.filters__date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filters__date-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.filters__date-input {
  width: 9.5rem;
}

.filters__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  user-select: none;
}

/* ===== Карточка разбора ===== */
.report {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Панель раздела — тот же вид, что у таблиц (DataTable). */
.panel {
  border: 1px solid hsl(var(--foreground) / 0.06);
  border-radius: var(--radius-lg);
  background: hsl(var(--card));
  background-image: var(--surface-sheen);
  box-shadow: var(--shadow-xs);
  padding: 1.25rem;
}

.panel--flush {
  padding: 0;
  overflow: hidden;
}

.panel--flush > .statistics-page__chart-card-title {
  margin: 0;
  padding: 1.25rem 1.25rem 0.75rem;
}

.report__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
}

.report__head-main {
  min-width: 0;
  flex: 1 1 24rem;
}

.report__title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

.report__meta {
  margin-top: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.report__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.report__meta-item svg {
  height: 0.875rem;
  width: 0.875rem;
}

.report__meta-name {
  font-weight: 500;
  color: hsl(var(--foreground));
}

.report__text {
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report__note {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.gemba {
  display: grid;
  grid-template-columns: minmax(10rem, 22rem) 1fr;
  font-size: 0.875rem;
}

.gemba__q,
.gemba__a {
  padding: 0.625rem 0;
  border-top: 1px solid hsl(var(--foreground) / 0.06);
}

.gemba__q:first-of-type,
.gemba__q:first-of-type + .gemba__a {
  border-top: 0;
}

.gemba__q {
  padding-right: 1.25rem;
  color: hsl(var(--muted-foreground));
}

.gemba__a {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: hsl(var(--foreground));
}

.gemba__a--empty {
  color: hsl(var(--muted-foreground) / 0.7);
}

@media (max-width: 767px) {
  .gemba {
    grid-template-columns: 1fr;
  }
  .gemba__a {
    border-top: 0;
    padding-top: 0;
  }
}

.liked {
  display: flex;
  flex-direction: column;
}

.liked__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid hsl(var(--foreground) / 0.06);
}

.liked__item:first-child {
  border-top: 0;
  padding-top: 0;
}

.liked__body {
  min-width: 0;
  flex: 1 1 0%;
}

.liked__text {
  font-size: 0.9375rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.liked__who {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.liked__votes {
  flex-shrink: 0;
}

/* Вкладки отчёта */
.report-tab {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.report-tab__subtitle {
  font-size: var(--text-overline-size);
  font-weight: var(--text-overline-weight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--foreground) / 0.75);
}

.report-tab .table__cell {
  vertical-align: top;
}

.cause__text {
  overflow-wrap: anywhere;
}

.cause__meta {
  margin-top: 0.375rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.whys {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.whys__cause {
  font-weight: 500;
}

.whys__chain {
  margin-top: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.whys__step {
  display: flex;
  gap: 0.5rem;
}

.whys__num {
  flex-shrink: 0;
  min-width: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.75;
  color: hsl(var(--primary));
}

.report-tab__empty {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.loading-line svg {
  height: 1rem;
  width: 1rem;
}

.error-line {
  color: hsl(var(--destructive));
}

/* ===== Узкий экран: сайдбар становится верхней панелью ===== */
@media (max-width: 767px) {
  .main-layout {
    flex-direction: column;
  }

  .main-layout__sidebar {
    width: 100%;
    padding: 0.5rem 0.5rem 0;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
  }

  .sidebar__header {
    min-height: 3.5rem;
    padding: 0.5rem 0.75rem;
  }

  .sidebar__nav {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .sidebar__nav > * + * {
    margin-top: 0;
  }

  .sidebar__spacer,
  .sidebar__theme,
  .sidebar__profile-info,
  .sidebar__avatar {
    display: none;
  }

  .sidebar__footer {
    margin: 0 0.5rem 0 auto;
    padding: 0.5rem 0;
    border-top: 0;
  }

  .main-layout__container {
    padding: 1.25rem 1rem;
  }

  .filters__field--user,
  .filters__field--search {
    width: 100%;
    flex-basis: 100%;
  }
}
