@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Тёмно-серая (графитовая) палитра (slate + изумруд), вдохновлённая финансовыми дашбордами */
  --bg: #1a1d21;            /* тёмно-серый фон страницы (графитовый, мягче для глаз) */
  --bg-elevated: #1f2329;   /* чуть приподнятый фон (topbar, выезжающее меню) */
  --paper: #1a1d21;         /* псевдоним для совместимости со старым кодом */
  --card: #23272e;          /* фон карточек */
  --card-hover: #2a2f38;    /* карточка при наведении */
  --line: #313840;          /* границы/разделители */
  --ink: #e8edf4;           /* основной текст (светлый) */
  --ink-soft: #8a95a5;      /* приглушённый текст */
  --ink-faint: #5b6573;     /* совсем тихий текст */

  --accent: #34d399;        /* изумрудный акцент (деньги/успех) */
  --accent-strong: #10b981;
  --accent-soft: #10241d;   /* фон под акцентом */
  --accent-ink: #062017;    /* текст на акцентной кнопке */

  --info: #38bdf8;          /* голубой — графики/информация */
  --info-soft: #0c2230;

  --warn: #f87171;          /* красный — ошибки/опасность */
  --warn-soft: #2a1416;
  --gold: #d8b44a;          /* золотой — роль директора, рейтинг */
  --gold-soft: #2a2310;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.32);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

.topbar { background: var(--bg-elevated); }
.nav-toggle span { background: var(--ink); }
input, select, textarea {
  background: #1f2329; color: var(--ink); border-color: var(--line);
}
.btn-secondary { background: #2a2f38; color: var(--ink); }
.btn-secondary:hover { background: #313840; }
img.brand-logo { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.list-item-link:hover { background: var(--card-hover); }

* { box-sizing: border-box; }

html {
  touch-action: pan-y; /* разрешаем обычную вертикальную прокрутку, блокируем pinch-zoom и боковой pan */
  -ms-touch-action: pan-y;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(1200px 600px at 50% -10%, rgba(52,211,153,0.05), transparent 70%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
/* Страницы с широкими таблицами (например "Зарплаты" у директора) — больше места по горизонтали,
   чтобы таблица меньше упиралась в горизонтальную прокрутку на обычном мониторе. */
.container.container-wide {
  max-width: 1500px;
}

/* --- Topbar --- */
.topbar {
  background: var(--bg-elevated);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.topbar-inner {
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  color: #ffffff; font-weight: 700; display: flex; align-items: center; gap: 12px;
  font-family: "Outfit", sans-serif; font-size: 19px;
  white-space: nowrap; margin-right: auto;
}
.brand-logo { height: 32px; width: 32px; object-fit: contain; background: none; padding: 0; }
.brand-name { display: inline-flex; align-items: baseline; gap: 7px; color: #ffffff; }
.brand-name b { font-weight: 700; letter-spacing: 2px; color: #ffffff; }
.brand-name span { font-weight: 300; color: #ffffff; letter-spacing: 3px; font-size: 0.78em; text-transform: uppercase; opacity: 0.7; }
/* Логотип на странице логина — DIAMOND и STUDIO в две строки, STUDIO полностью белым (не приглушённым) */
.brand-name--stacked { flex-direction: column; align-items: center; gap: 2px; }
.brand-name--stacked span { opacity: 1; color: #ffffff; }
.brand:hover { text-decoration: none; opacity: 0.92; }

.back-bar { background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px; }
.back-button {
  background: none; border: none; color: var(--ink-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 0; font-family: inherit;
}
.back-button:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.nav a { color: var(--ink-soft); }
.nav a:hover { color: var(--ink); }
.nav-divider { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; margin: 0 2px; }
.user-name { color: var(--ink); font-weight: 500; }
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 500;
  background: rgba(255,255,255,0.07); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge-director { background: var(--gold-soft); color: var(--gold); border-color: transparent; font-weight: 600; }

.link-button {
  background: none; border: none; color: var(--ink-soft); font-size: 14px; cursor: pointer; padding: 0;
  font-family: inherit;
}
.link-button:hover { color: var(--ink); text-decoration: underline; }

/* --- Typography --- */
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.4px; font-weight: 700; }
h2 { font-size: 19px; margin: 0 0 12px; font-weight: 600; letter-spacing: -0.2px; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
.subtitle { color: var(--ink-soft); margin: 0 0 28px; font-size: 14px; }

/* --- Cards / sections --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.section-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat {
  background: linear-gradient(160deg, var(--card), #11161e);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.18s, transform 0.18s;
}
.stat:hover { border-color: #2e3a49; transform: translateY(-2px); }
.stat .stat-label { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; font-weight: 500; }
.stat .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; }

/* --- Forms --- */
.auth-wrap {
  max-width: 380px;
  margin: 64px auto;
}
.auth-wrap .card { box-shadow: var(--shadow-lg); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input[type="text"], input[type="password"], input[type="number"], input[type="file"], input[type="date"], input[type="datetime-local"], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  background: #1f2329;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.15);
}
textarea { min-height: 160px; resize: vertical; }

/* Иконка календаря/часов у браузерного datetime-local по умолчанию тёмная — невидима на тёмном фоне */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 11px 19px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
button:hover, .btn:hover { background: var(--accent-strong); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary { background: #2a2f38; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: #313840; }
.btn-warn { background: var(--warn); color: #2a0d0d; }
.btn-warn:hover { background: #ef4444; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-full { display: block; width: 100%; text-align: center; padding: 14px 18px; font-size: 15px; }

.error-msg {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(248,113,113,0.3);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}
.notice-msg {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(52,211,153,0.3);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}

.helper-text { font-size: 13px; color: var(--ink-soft); margin-top: -10px; margin-bottom: 16px; }

/* --- Tables / lists --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }

.screenshots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.screenshots img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
}

.shift-open-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.search-box { display: flex; gap: 8px; margin-bottom: 22px; }
.search-box input { margin-bottom: 0; }

.doc-content { white-space: pre-wrap; line-height: 1.7; font-size: 15px; }
.doc-meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.category-tag {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 6px; font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 0;
  font-size: 14px;
}

.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; }

/* --- Ticker / биржевой блок --- */
.ticker-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.ticker-value { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.ticker-change { font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.ticker-up { background: var(--accent-soft); color: var(--accent); }
.ticker-down { background: var(--warn-soft); color: var(--warn); }
.ticker-sub { color: var(--ink-soft); font-size: 13px; }
.rate-note { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.currency-row { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.currency-usd { font-weight: 700; color: var(--accent); }
.currency-rub { color: var(--ink-soft); font-size: 13px; }

.select-inline { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--card); color: var(--ink); }

.period-tabs { display: flex; gap: 6px; }
.period-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.period-btn:hover { background: var(--accent-soft); color: var(--ink); }
.period-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* --- Обзор статистики (карточка графика) --- */
.stat-block-label { font-size: 13px; color: var(--ink-soft); margin-bottom: 2px; }
.stat-block-value { font-size: 30px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.time-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); border-radius: 10px; padding: 12px 16px; margin-top: 16px;
}
.time-icon {
  width: 34px; height: 34px; border-radius: 50%; background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px;
}
.time-label { font-size: 13px; color: var(--ink-soft); }
.time-value { font-size: 18px; font-weight: 700; margin-left: auto; }
.balance-note { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.fine-item { border-left: 3px solid var(--warn); padding-left: 12px; }
.fine-amount { color: var(--warn); font-weight: 700; }

/* --- Текстовый редактор методичек --- */
.rte-toolbar {
  display: flex; gap: 4px; padding: 8px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px 8px 0 0; flex-wrap: wrap;
}
.rte-toolbar button {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  width: 32px; height: 32px; cursor: pointer; font-size: 14px; color: var(--ink);
}
.rte-toolbar button:hover { background: var(--accent-soft); }
.rte-editor {
  min-height: 240px; border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px;
  padding: 14px; font-size: 14px; line-height: 1.6; margin-bottom: 16px; background: var(--card); color: var(--ink);
}
.rte-editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rte-editor img { max-width: 100%; border-radius: 6px; }
.doc-content img { max-width: 100%; border-radius: 6px; margin: 8px 0; }

/* --- Задачи / рекомендации --- */
.task-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.task-title { font-size: 14px; }
.task-title.completed { text-decoration: line-through; color: var(--ink-soft); }
.task-important-tag { font-size: 11px; font-weight: 700; background: var(--warn-soft); color: var(--warn); padding: 2px 7px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }

/* --- Цели --- */
.goal-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.goal-item:last-child { border-bottom: none; }
.goal-bonus { font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap; }

/* --- Калькулятор токенов --- */
.token-table { width: 100%; border-collapse: collapse; }
.token-table th { text-align: left; font-size: 12px; color: var(--ink-soft); padding: 0 8px 8px; font-weight: 600; }
.token-table td { padding: 8px; vertical-align: middle; }
.token-table input[type="text"], .token-table input[type="number"] { margin-bottom: 0; }
.token-site-name { font-weight: 600; }
.token-value-input { width: 110px; }
@media (max-width: 760px) {
  .token-value-input { width: 78px; padding: 9px 8px; font-size: 13px; }
}
.token-usd { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* --- Брейк / норма часов --- */
.break-banner {
  display: flex; align-items: center; gap: 12px; background: var(--gold-soft); border: 1px solid rgba(216,180,74,0.3);
  color: var(--gold); border-radius: 10px; padding: 12px 16px; margin-top: 14px;
}
.break-timer { font-size: 20px; font-weight: 700; font-family: monospace; margin-left: auto; }

.hours-progress-wrap { margin-top: 10px; }
.hours-progress-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.hours-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.hours-progress-fill.over { background: var(--warn); }

.shift-type-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.shift-type-day { background: var(--gold-soft); color: var(--gold); }
.shift-type-evening { background: var(--info-soft); color: var(--info); }
.shift-type-night { background: #1c2330; color: #b9c2d0; }

/* --- Календарь выходных --- */
.cal-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap: wrap; gap: 10px;}
.cal-nav { display:flex; gap:8px; align-items:center; }
.cal-grid { display:grid; grid-template-columns: repeat(7, 1fr); gap:6px; }
.cal-dow { text-align:center; font-size:12px; color:var(--ink-soft); font-weight:600; padding-bottom:4px; }
.cal-cell { aspect-ratio: 1; }
.cal-day-btn {
  width:100%; height:100%; border-radius:8px; border:1px solid var(--line); background:var(--card);
  font-size:14px; cursor:pointer; font-family:inherit; color: var(--ink);
  display:flex; align-items:center; justify-content:center; padding:0;
}
.cal-day-btn:hover { background:var(--accent-soft); }
.cal-day-btn.is-off { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight:700; }
.cal-empty { visibility:hidden; }
.cal-legend { margin-top:14px; font-size:13px; color:var(--ink-soft); display:flex; align-items:center; gap:8px; }
.cal-legend-swatch { width:14px; height:14px; border-radius:4px; background:var(--accent); display:inline-block; }

/* --- Гамбургер-кнопка (видна только на мобильных) --- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Бургер-меню шапки — отдельный (более широкий) брейкпоинт от остальной мобильной вёрстки ниже.
   Ряд иконок+бейдж+имя+кнопка "Выйти" у директора физически не помещается в строку уже на
   "узких десктопах"/планшетах (~800-1100px), а не только на телефонах — раньше переключение на
   бургер было только при <=760px, из-за чего на этих промежуточных ширинах пункты наезжали друг
   на друга (текст подписей перекрывался). Триггер бургера подняли до 1100px — это покрывает и
   планшеты (~768px из тест-кейса), и любые узкие десктопные окна. */
@media (max-width: 1100px) {
  .topbar-inner { position: relative; }
  .nav-toggle { display: flex; }

  /* Меню разворачивается вертикально по клику */
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  .nav.open { display: flex; }
  /* Иконки в мобильном меню — на всю ширину строки, с подписью, выровнены слева */
  .nav .nav-icon {
    width: 100%;
    justify-content: flex-start;
    height: auto;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }
  .nav .nav-icon[data-label]::after { display: inline; }
  .nav .nav-icon:not([data-label]) { width: 100% !important; padding: 13px 18px !important; }
  .nav .nav-divider { display: none; }
  .nav a, .nav .user-name, .nav .badge, .nav form {
    width: 100%;
    padding: 12px 18px;
    margin: 0;
  }
  .nav a { border-bottom: 1px solid var(--line); color: var(--ink); }
  .nav .badge { width: auto; margin: 8px 18px; }
  .nav .user-name { font-size: 13px; color: var(--ink-soft); padding-top: 12px; padding-bottom: 4px; }
  .link-button { font-size: 15px; }
}

@media (max-width: 760px) {
  /* Шапка компактнее на телефонах (бургер уже включён брейкпоинтом выше) */
  .topbar-inner { height: 54px; padding: 0 16px; }
  .brand { font-size: 16px; }

  /* Основной контейнер */
  .container { padding: 18px 14px 60px; }
  h1 { font-size: 22px; }
  h2 { font-size: 17px; }

  /* Карточки статистики — по одной в ряд */
  .section-row { grid-template-columns: 1fr; gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat .stat-value { font-size: 22px; }

  /* Карточки */
  .card { padding: 16px; }

  /* Вкладки периода — горизонтальная прокрутка, чтобы не ломались */
  .period-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    width: 100%;
  }
  .period-btn { white-space: nowrap; flex-shrink: 0; }

  /* График */
  .chart-wrap { padding: 14px; }
  .stat-block-value { font-size: 24px; }

  /* Таблицы — горизонтальная прокрутка вместо ломания вёрстки */
  .table-scroll, .token-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  table { min-width: 480px; }
  .token-table { min-width: 420px; }

  /* Формы на всю ширину */
  input, select, textarea, button { font-size: 16px; } /* 16px не даёт iOS зумить при фокусе */

  /* Списки — элементы переносятся вертикально */
  .list-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .list-item > div:last-child { width: 100%; }

  /* Инлайновые формы-строки (фильтры, привязки) переносятся, поля тянутся на всю ширину */
  form[style*="flex"] { flex-wrap: wrap; }
  .card form select, .card form input[type="date"] { max-width: 100%; }

  /* Валюта/время */
  .currency-row { flex-wrap: wrap; }
  .time-row { flex-wrap: wrap; }

  /* Скриншоты смен — компактнее */
  .screenshots img { width: 72px; height: 72px; }

  /* Календарь выходных */
  .cal-grid { gap: 3px; }
  .cal-day-btn { font-size: 13px; }

  /* Форма входа/регистрации ближе к верху */
  .auth-wrap { margin: 28px auto; }
}

@media (max-width: 400px) {
  .brand span { display: none; } /* на узких экранах оставляем только логотип */
  h1 { font-size: 20px; }
  .stat-block-value { font-size: 21px; }
}

/* --- Кликабельная строка списка --- */
.list-item-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 8px;
}
.list-item-link:hover { background: var(--paper, #f5f4f0); }
.list-item-link strong { color: var(--ink); }
.list-arrow { font-size: 22px; color: var(--ink-soft); }

/* --- Счётчики и иконки в шапке --- */
/* На десктопе все пункты — компактные круглые значки без подписи, понятные через title
   при наведении. Подпись (data-label) показывается ТОЛЬКО в мобильном меню-гамбургере
   (см. @media max-width:760px ниже), где наведения нет и подпись нужна для понимания. */
.nav-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; height: 34px; width: 34px; flex-shrink: 0; color: var(--ink-soft);
  font-size: 14px; font-weight: 500; padding: 0; border-radius: 999px;
  transition: background 0.15s;
}
.nav-icon[data-label]::after {
  content: attr(data-label);
  white-space: nowrap;
  display: none;
}
.ic { display: block; flex-shrink: 0; }
.nav-icon .ic { color: var(--ink-soft); transition: color 0.15s, transform 0.15s; }
.nav-icon:hover { color: var(--ink); text-decoration: none; background: var(--card-hover); }
.nav-icon:hover .ic { color: var(--accent); transform: translateY(-1px); }
.nav-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  background: var(--warn);
  color: #2a0d0d;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  text-align: center;
  vertical-align: middle;
  position: absolute;
  top: -7px;
  right: -9px;
}

/* --- Плавающий чат --- */
#chatWidget { position: fixed; bottom: 22px; right: 22px; z-index: 200; }
.chat-bubble {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: none; font-size: 24px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.chat-bubble:hover { transform: scale(1.06); }
.chat-bubble.active { background: #173f2c; }

.chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  height: 460px;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e3e1da);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--line, #e3e1da);
  background: var(--paper, #f7f6f2);
}
.chat-tabs { display: flex; gap: 6px; }
.chat-tab {
  border: none; background: transparent; padding: 6px 10px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft, #6b6a64);
  border-radius: 8px; cursor: pointer;
}
.chat-tab.active { background: var(--accent); color: var(--accent-ink); }
.chat-close { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink-soft, #6b6a64); line-height: 1; padding: 0 4px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--ink-soft, #6b6a64); font-size: 13px; text-align: center; margin-top: 20px; }
.chat-msg { max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-msg-author { font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.chat-dir-tag { background: var(--accent); color: var(--accent-ink); font-size: 10px; padding: 1px 5px; border-radius: 5px; }
.chat-msg-body {
  display: inline-block; padding: 7px 11px; border-radius: 12px;
  background: var(--paper, #f0efe9); font-size: 13px; line-height: 1.4;
  word-break: break-word; text-align: left;
}
.chat-msg.mine .chat-msg-body { background: var(--accent); color: var(--accent-ink); }
.chat-msg-time { font-size: 10px; color: var(--ink-soft, #6b6a64); margin-top: 2px; }

/* Markdown-разметка внутри ответа ассистента — компактные отступы, чтобы не "распирало" пузырёк */
.chat-msg-body h4 { margin: 0 0 6px; font-size: 14px; }
.chat-msg-body p { margin: 0 0 8px; }
.chat-msg-body p:last-child { margin-bottom: 0; }
.chat-msg-body ul { margin: 0 0 8px; padding-left: 18px; }
.chat-msg-body ul:last-child { margin-bottom: 0; }
.chat-msg-body li { margin-bottom: 3px; }
.chat-msg-body hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
.chat-msg-body code {
  background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 4px;
  font-size: 12px; font-family: 'SFMono-Regular', Consolas, monospace;
}

/* Индикатор "ассистент думает" — три прыгающие точки */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 9px 11px !important; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-soft, #9a9890);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-row { display: flex; border-top: 1px solid var(--line, #e3e1da); padding: 8px; gap: 6px; margin: 0; }
.chat-input-row input {
  flex: 1; border: 1px solid var(--line, #e3e1da); border-radius: 20px;
  padding: 8px 14px; font-size: 14px; margin: 0;
}
.chat-input-row button {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; cursor: pointer; margin: 0;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-input-row button .ic { display: block; }

.chat-contacts { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-contact-btn {
  text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line, #e3e1da); background: var(--paper, #f7f6f2);
  cursor: pointer; font-size: 13px;
}
.chat-contact-btn:hover { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 600px) {
  /* Чат на весь экран на мобильном */
  #chatWidget { right: 14px; bottom: 14px; }
  #assistantWidget { right: 82px; bottom: 14px; }

  /* Панель-пузырёк — показывается через JS (display:flex), на мобильном
     при появлении принудительно занимает весь экран */
  .chat-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 300 !important;
  }

  .chat-panel-header {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .chat-close {
    font-size: 24px;
    padding: 4px 8px;
  }
  .chat-messages {
    padding: 12px 14px;
  }
  .chat-input-row {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}

/* --- Плавающий ИИ-ассистент: второй пузырёк рядом с обычным чатом, не перекрывает его --- */
#assistantWidget { position: fixed; bottom: 22px; right: 92px; z-index: 200; }
.assistant-bubble { background: var(--gold); color: #1a1606; }
.assistant-bubble.active { background: #6b5a1e; }

@media (max-width: 480px) {
  /* На мобильных мало места по горизонтали — ставим ассистента ВЫШЕ чата, а не рядом */
  #assistantWidget { right: 14px; bottom: 86px; }
}

/* --- Сворачиваемые блоки (Рекомендации/цели на главной) --- */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--ink-soft);
  transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }

/* --- Регулятор громкости в шапке чата --- */
.chat-volume { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); }
.chat-volume input[type="range"] {
  width: 60px; height: 4px; margin: 0; accent-color: var(--accent); cursor: pointer;
}

/* --- Лучшие/худшие периоды --- */
.top-periods-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.top-periods-col h3 { margin: 0 0 8px; font-size: 14px; }
.top-periods-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.top-periods-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; }
.top-good { color: var(--accent); }
.top-bad { color: var(--warn); }

/* --- Заметки о модели: сохраняем переводы строк, если директор пишет их столбиком --- */
.notes-text { white-space: pre-line; }

/* --- Иконки внутри кнопок/заголовков: выравнивание по центру с текстом --- */
.btn-ic { display: inline-flex; vertical-align: middle; margin-right: 2px; position: relative; top: -1px; }
.btn-ic .ic { display: block; }
h2 .btn-ic, h3 .btn-ic, summary .btn-ic { margin-right: 7px; color: var(--accent); }
.period-btn .btn-ic { margin-right: 4px; }

/* --- Компактный блок выплаты на странице зарплат (без переполнения колонки) --- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pay-status { display: flex; flex-direction: column; }
.pay-inline-form { display: flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.pay-select { margin: 0; padding: 6px 8px; font-size: 12px; width: auto; min-width: 0; flex: 1 1 90px; }
.pay-btn-row { display: flex; gap: 6px; margin-top: 8px; }
.pay-btn-row button { flex: 1; }

/* --- Сетка "З/П" по ролям: всегда чётно (2x2 на средних экранах, 4 в ряд на широких) --- */
.payroll-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) {
  .payroll-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .payroll-grid { grid-template-columns: 1fr; }
}

/* --- Светофор операторов на дашборде директора --- */
.status-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px;
  text-decoration: none; color: inherit; border-bottom: 1px solid var(--line);
}
.status-row:last-child { border-bottom: none; }
.status-row:hover { background: var(--card-hover); }
.status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.status-dot.is-green { background: var(--accent); }
.status-dot.is-yellow { background: var(--gold); }
.status-dot.is-red { background: var(--warn); }
.status-name { font-weight: 600; min-width: 140px; }
.status-reason { color: var(--ink-soft); font-size: 13px; }

/* TASK-21: модальное окно для скриншота смены (первое модальное окно в проекте) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--card);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
}
.modal-box-image {
  max-width: 90vw;
  max-height: 90vh;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
}
.modal-header span:nth-child(2) { flex: 1; }
.modal-close {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 16px; }
.modal-body-image {
  display: flex;
  justify-content: center;
  max-height: 80vh;
  overflow: auto;
  padding: 12px;
}
.modal-body-image img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 8px;
  object-fit: contain;
}

/* TASK-24: содержимое окна AI-отчёта по смене (сам модал — общие .modal-* классы из TASK-21) */
.feedback-score { font-size: 1.1rem; margin: 0 0 12px; color: var(--ink); }
.feedback-section { margin-bottom: 14px; }
.feedback-section h4 { font-size: .85rem; margin: 0 0 6px; }
.feedback-section ul { margin: 0; padding-left: 18px; color: var(--ink); }
.feedback-good h4 { color: var(--accent); }
.feedback-improve h4 { color: var(--gold); }
.feedback-warn h4 { color: var(--warn); }
.feedback-summary { margin-top: 10px; font-style: italic; }

/* TASK-26: контроль выдачи официального Telegram модели — заметный бейдж/блок, отдельно от обычных нарушений */
.ca-telegram-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--warn);
  background: rgba(248, 113, 113, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
}
.feedback-critical {
  background: rgba(248, 113, 113, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.feedback-critical h4 { color: var(--warn); margin: 0 0 4px; font-size: .8rem; }
.feedback-critical p { margin: 0; color: var(--ink); }

/* TASK-28/29: система нарушений и штрафов */
.penalties-header   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.visibility-toggle  { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); cursor: pointer; }
.visibility-toggle input { cursor: pointer; }
.penalties-dev-notice { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-soft);
  background: var(--bg-elevated); padding: 8px 12px; border-radius: 8px; margin-bottom: 16px; }
.violation-row      { padding: 12px 14px; background: var(--bg-elevated); border-radius: 10px; margin-bottom: 10px;
  border-left: 3px solid var(--border, #333); }
.violation-row.level-3 { border-left-color: var(--gold); }
.violation-row.level-4 { border-left-color: var(--warn); }
.violation-level-badge { font-size: .7rem; padding: 2px 8px; border-radius: 10px; background: var(--card); color: var(--ink-soft); margin-right: 6px; }
.violation-name     { font-weight: 600; display: block; margin: 4px 0; }
.violation-meta     { font-size: .76rem; color: var(--ink-soft); }
.violation-client   { font-size: .76rem; color: var(--ink-soft); display: block; margin-top: 2px; }
.violation-explanation { font-style: italic; font-size: .82rem; margin-top: 6px; color: var(--ink-soft); }
.violation-actions  { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.violation-suggestion { font-size: .78rem; color: var(--gold); padding: 4px 0; }
.badge-count        { display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 10px; background: var(--warn); color: #fff;
  font-size: .7rem; font-weight: 700; padding: 0 5px; margin-left: 6px; }
.mine-pending       { background: var(--bg-elevated); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.mine-pending textarea { width: 100%; margin: 8px 0; background: var(--card); border: 1px solid var(--border, #333);
  border-radius: 8px; color: var(--ink); padding: 8px; font-size: .85rem; resize: vertical; min-height: 60px; }
.mine-row           { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-elevated); border-radius: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.mine-row .fine-amount { color: var(--warn); font-weight: 700; margin-left: auto; }
.status-badge       { font-size: .72rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.status-badge.status-warning  { background: rgba(251,191,36,.15); color: var(--gold); }
.status-badge.status-fined    { background: rgba(248,113,113,.15); color: var(--warn); }
.status-badge.status-dismissed{ background: var(--card); color: var(--ink-soft); }
