:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --border: #e7e8ec;
  --text: #16181d;
  --text-dim: #8a8f98;
  --accent: #16181d;      /* основной цвет кнопок — чёрный, как в референсе */
  --accent-soft: #eef0f3;
  --orange: #ff6a3d;       /* акцентный цвет для тегов/бейджей, как "Новое" на скрине */
  --orange-soft: #fff1ea;
  --green: #1fae6b;
  --green-soft: #e7f8f0;
  --yellow: #d69a00;
  --yellow-soft: #fff6df;
  --red: #e5484d;
  --red-soft: #fdecec;
  --gray: #8a8f98;
  --gray-soft: #f0f1f3;
  --shadow: 0 1px 2px rgba(16,17,20,0.04), 0 6px 20px rgba(16,17,20,0.05);
  /* Пастельные акцентные блоки — как карточки "Unpaid invoices / Balance / Pending" и
     мягкие статус-иконки в референсах: жёлтый/голубой/сиреневый на белом. */
  --pastel-yellow-bg: #fdeeb8; --pastel-yellow-text: #8a6d00;
  --pastel-blue-bg: #cfe3f5; --pastel-blue-text: #2b5f8a;
  --pastel-purple-bg: #e7defb; --pastel-purple-text: #5b3fa0;
  --pastel-green-bg: #d9f2e3; --pastel-green-text: #1f7a4d;
  --canvas-shadow: 0 30px 80px rgba(30,34,48,0.14), 0 4px 16px rgba(30,34,48,0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  /* Мягкий градиентный "холст" за интерфейсом — как в референсах (Journey Overview,
     Schedule): приложение выглядит как большая скруглённая карточка, парящая над фоном. */
  background: linear-gradient(135deg, #eef0f6 0%, #e7e9f2 45%, #eceef5 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 18px;
}

#app {
  display: flex;
  min-height: calc(100vh - 36px);
  background: var(--bg);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--canvas-shadow);
}

.sidebar {
  width: 246px;
  background: var(--panel);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.brand {
  font-size: 15px;
  font-weight: 700;
  padding: 4px 10px 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-mark {
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.nav-item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
/* Активный пункт — сплошная чёрная "пилюля", как "Journey Overview" / "Cases" в референсах */
.nav-item.active { background: var(--accent); color: #fff; font-weight: 700; }
.nav-item.active .nav-icon { background: rgba(255,255,255,0.15); }

.project-filter {
  margin-top: 18px;
  padding: 0 10px;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.project-pill {
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
}
.project-pill:hover { background: var(--panel-2); }
.project-pill.active { background: var(--panel-2); color: var(--text); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6a3d, #ff9466);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* Фото профиля вместо буквы-инициала — просто заполняет тот же круглый контейнер
   (avatar/avatar-lg/avatar-sm/sidebar-avatar), сама обёртка не меняется. */
.avatar-img-fill { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* Блок "Фото профиля" в личном кабинете: превью + кнопки загрузки/удаления + сетка пресетов. */
.avatar-settings-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px;
}
.avatar-settings-row .avatar-lg {
  width: 88px; height: 88px; font-size: 32px;
}
.avatar-settings-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.avatar-preset-grid {
  display: grid; grid-template-columns: repeat(8, 44px); gap: 10px;
}
.avatar-preset-btn {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: none; line-height: 0;
}
.avatar-preset-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preset-btn:hover { border-color: var(--border); }
.avatar-preset-btn.active { border-color: var(--accent, #4C6FFF); }
@media (max-width: 640px) {
  .avatar-preset-grid { grid-template-columns: repeat(6, 40px); }
}
.who-name { font-size: 13px; font-weight: 700; }
.who-sub { font-size: 11px; color: var(--text-dim); }

main {
  flex: 1;
  padding: 30px 40px;
  overflow-y: auto;
  max-height: 100vh;
  min-width: 0;
}

/* Правая панель — профиль + мини-агенда, как в референсе (Mindease: карточка врача + "My agenda") */
.side-panel {
  width: 280px;
  flex-shrink: 0;
  padding: 26px 20px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: 100vh;
}
.profile-card {
  position: relative;
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.profile-menu-btn {
  position: absolute;
  top: 0; right: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.profile-menu-btn:hover { background: var(--border); color: var(--text); }
.avatar-lg-wrap { position: relative; width: 62px; margin: 0 auto 10px; }
.avatar-lg {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6a3d, #ff9466);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.avatar-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--panel);
}
.profile-name { font-weight: 700; font-size: 14.5px; }
.profile-role { color: var(--text-dim); font-size: 12px; margin: 2px 0 12px; }
.status-select-wrap { position: relative; display: inline-block; color: var(--green); }
.status-select-wrap.busy { color: var(--yellow); }
.status-select-wrap.away { color: var(--gray); }
.status-pill {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; font-family: inherit;
  padding: 5px 26px 5px 13px; border-radius: 20px;
  border: none; cursor: pointer;
  background: var(--green-soft); color: var(--green);
}
.status-select-wrap::after {
  content: '▾';
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 10px; pointer-events: none; color: inherit;
}
.status-pill.busy { background: var(--yellow-soft); color: var(--yellow); }
.status-pill.away { background: var(--gray-soft); color: var(--gray); }
.status-pill.blocked { background: var(--red-soft); color: var(--red); }

.agenda-head h4 { margin: 0 0 14px; font-size: 13px; font-weight: 700; }
.agenda-week { display: flex; justify-content: space-between; margin-bottom: 16px; }
.agenda-day { text-align: center; font-size: 11px; color: var(--text-dim); padding: 6px 4px; border-radius: 10px; min-width: 28px; font-weight: 600; }
.agenda-day .dom { font-weight: 700; font-size: 13px; margin-top: 3px; }
.agenda-day.active { background: var(--accent); color: #fff; }
.agenda-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.agenda-item { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border-radius: 14px; padding: 10px 12px; }
.agenda-icon { font-size: 15px; flex-shrink: 0; }
.agenda-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.agenda-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.agenda-all { width: 100%; }

/* Дашборд — двухколоночная сетка, как "Recent Messages" / "My clients" в референсе */
.grid-two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 20px; }
.request-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.request-row:last-child { border-bottom: none; }
.pending-download-row { cursor: pointer; }
.pending-download-row:hover { background: var(--panel-2); border-radius: 10px; }
.request-title { font-weight: 600; font-size: 13.5px; }
.request-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.team-count { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.team-sub { color: var(--text-dim); font-size: 12.5px; margin-bottom: 16px; }
.team-avatars { display: flex; }
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel-2); color: var(--text);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel);
  margin-left: -8px;
}
.avatar-sm:first-child { margin-left: 0; }
.avatar-sm.more { background: var(--text); color: #fff; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.topbar .sub { color: var(--text-dim); font-size: 13px; margin-top: 5px; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: opacity 0.12s ease, transform 0.05s ease;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--panel); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn.secondary:hover { background: var(--panel-2); opacity: 1; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 20px 58px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .label { color: var(--text-dim); font-size: 13px; margin-top: 4px; font-weight: 500; }
/* Круглый бейдж-иконка в углу карточки — как значок монеты на "Unpaid invoices/Balance/Pending" в референсе */
.stat-card-icon {
  position: absolute;
  bottom: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.stat-card:not(.pastel-yellow):not(.pastel-blue):not(.pastel-purple):not(.pastel-green):not(.pastel-red) .stat-card-icon {
  background: var(--panel-2);
}
/* Кликабельные карточки статистики (например, "Заказы и работы" на профиле эксперта) —
   открывают список заказов, из которых сложилась эта цифра. */
.stat-card.clickable { cursor: pointer; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.stat-card.clickable:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

/* Пастельные цветные блоки для ключевых метрик — как карточки "Unpaid invoices / Balance /
   Pending" в референсе Mindease. Используются выборочно (первые несколько stat-card на
   дашборде), не везде — чтобы акцент не терялся. */
.stat-card.pastel-yellow { background: var(--pastel-yellow-bg); border-color: transparent; }
.stat-card.pastel-yellow .num, .stat-card.pastel-yellow .label { color: var(--pastel-yellow-text); }
.stat-card.pastel-blue { background: var(--pastel-blue-bg); border-color: transparent; }
.stat-card.pastel-blue .num, .stat-card.pastel-blue .label { color: var(--pastel-blue-text); }
.stat-card.pastel-purple { background: var(--pastel-purple-bg); border-color: transparent; }
.stat-card.pastel-purple .num, .stat-card.pastel-purple .label { color: var(--pastel-purple-text); }
.stat-card.pastel-green { background: var(--pastel-green-bg); border-color: transparent; }
.stat-card.pastel-green .num, .stat-card.pastel-green .label { color: var(--pastel-green-text); }
.stat-card.pastel-red { background: #fbdede; border-color: transparent; }
.stat-card.pastel-red .num, .stat-card.pastel-red .label { color: #a02020; }

.registration-requests-section { border: 1px solid var(--border); }
.registration-request-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.registration-request-row:last-child { border-bottom: none; }
.registration-request-info { flex: 1 1 260px; min-width: 0; }
.registration-request-name { font-weight: 700; }
.registration-request-message {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-style: italic;
  max-width: 480px;
}
.registration-request-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.registration-role-select { width: auto; min-width: 140px; }

.payouts-summary-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.payouts-summary-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: 160px;
  box-shadow: var(--shadow);
}
.payouts-summary-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.payouts-summary-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.payouts-export-box {
  flex: 1 1 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.payouts-export-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.payouts-export-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.payouts-export-controls input[type="date"] { width: auto; min-width: 140px; }

.catalog-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.catalog-tab {
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
}
.catalog-tab .token-hint { margin: 0 0 0 4px; }
.catalog-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.catalog-tab.active .token-hint { color: rgba(255,255,255,0.85); }
.catalog-name { font-weight: 500; }

.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow-x: auto;
}
.section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge.draft { background: var(--gray-soft); color: var(--gray); }
.badge.scheduled { background: var(--yellow-soft); color: var(--yellow); }
.badge.publishing { background: var(--accent-soft); color: var(--text); }
.badge.published { background: var(--green-soft); color: var(--green); }
.badge.failed { background: var(--red-soft); color: var(--red); }
.badge.connected { background: var(--green-soft); color: var(--green); }
.badge.unknown { background: var(--gray-soft); color: var(--gray); }
.badge.error { background: var(--red-soft); color: var(--red); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.item-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}
.item-card .title { font-weight: 700; margin-bottom: 5px; font-size: 13.5px; }
.item-card .meta { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; }
.item-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }

input, textarea, select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  /* line-height сам по себе не спасает от бага с эмодзи в плейсхолдере на iOS (см. ниже) —
     оставлен как общая нормализация, но не как единственная защита. */
  line-height: 1.3;
}

/* iOS Safari: если плейсхолдер начинается с эмодзи (например, 🔎 в полях поиска), то для
   его отрисовки браузер подключает системный цветной emoji-шрифт, а его метрики (высота
   строки, заданная В САМОМ ШРИФТЕ) в WebKit для однострочных text-полей могут перебивать
   CSS line-height — поле визуально раздувается на весь экран. line-height тут не помогает,
   помогает только явно заданная высота поля (height на replaced-контроле WebKit уважает
   всегда). Чекбоксы/радио/файлы не трогаем — у них своя, компактная разметка.
*/
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
  height: 40px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--text);
}
label { font-size: 12px; font-weight: 600; color: var(--text-dim); display: block; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,17,20,0.35);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 26px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(16,17,20,0.25);
}
.modal h3 { margin-top: 0; font-size: 17px; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.checkbox-row input { width: auto; }

/* ---------------- Прикрепить заказ в чате (поиск + список) ---------------- */
.attach-order-list {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.attach-order-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.attach-order-row:last-child { border-bottom: none; }
.attach-order-row:hover { background: var(--panel-2); }
.attach-order-row.selected { background: var(--accent-soft); }
.attach-order-number { font-weight: 700; font-size: 13px; flex-shrink: 0; }
.attach-order-title { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Групповые чаты: выбор типа, участники, управление ---------------- */
.chat-chooser-options { display: flex; gap: 10px; margin: 14px 0 4px; }
.chat-chooser-btn { flex: 1; padding: 18px 10px; font-size: 14px; border-radius: 14px; }
.group-contact-list {
  max-height: 260px; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 12px;
}
.group-contact-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; cursor: pointer;
}
.group-contact-row:last-child { border-bottom: none; }
.group-contact-row:hover { background: var(--panel-2); }
.group-contact-row input[type="checkbox"] { width: auto; }
.group-participant-row { justify-content: space-between; cursor: default; }
.group-participant-row:hover { background: none; }
.group-avatar-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }

/* ---------------- Медиа диалога: вкладки "Фото/Файлы/Ссылки" ---------------- */
.media-tabs { display: flex; gap: 6px; margin: 14px 0 12px; }
.media-tab {
  flex: 1; padding: 8px 6px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--panel-2); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.media-tab.active { background: var(--accent); color: #fff; }
.media-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; }
.media-photo-thumb { width: 100%; height: 84px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.media-file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.media-file-row:last-child { border-bottom: none; }
.media-file-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-file-date { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

/* ---------------- Форма "Разместить заказ" ---------------- */
.modal.modal-wide { width: min(640px, 92vw); }
.order-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-form-row.cols-3 { grid-template-columns: 1fr auto auto; align-items: end; }
.order-form-row label { margin: 0 0 6px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 30px; }
.select-wrap::after {
  content: '▾'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-dim); pointer-events: none;
}
.date-input-wrap { position: relative; }
.date-input-wrap input[type="date"] { padding-right: 34px; }

/* ---------------- Выпадающий список с поиском (тип работы / предмет) ---------------- */
.ss-dropdown { position: relative; }
.ss-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-family: inherit;
  cursor: pointer; text-align: left;
}
.ss-dropdown.open .ss-trigger { border-color: var(--text); }
.ss-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-trigger-label.ss-placeholder { color: var(--text-dim); }
.ss-caret { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.ss-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16,17,20,0.16); padding: 8px;
}
.ss-panel.open { display: block; }
.ss-search { margin-bottom: 6px; }
.ss-list { max-height: 260px; overflow-y: auto; }
.ss-option { padding: 9px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.ss-option:hover { background: var(--panel-2); }
.ss-option.selected { font-weight: 700; }
.ss-option-custom { color: var(--accent); font-weight: 600; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; padding-bottom: 10px; }
.ss-empty { padding: 10px; color: var(--text-dim); font-size: 13px; }

.richtext-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 8px 10px;
  background: var(--panel-2);
}
.richtext-toolbar button {
  background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 7px;
  color: var(--text); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.richtext-toolbar button:hover { background: var(--border); }
.richtext-body {
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  padding: 12px;
  min-height: 140px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
}
.richtext-body:focus { outline: none; border-color: var(--text); }
.richtext-body:empty::before { content: attr(data-placeholder); color: var(--text-dim); }

.file-attach-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px dashed var(--border);
  color: var(--text-dim); font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 12px; cursor: pointer;
}
.file-attach-btn:hover { border-color: var(--text-dim); color: var(--text); }
.file-chip-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-chip {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel-2); border-radius: 10px; padding: 8px 12px; font-size: 12.5px;
}
.file-chip button { width: auto; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 15px; padding: 0; }
.file-chip button:hover { color: var(--red); }
/* Прикрепление файла к заявке на выплату — кнопка + имя выбранного файла рядом */
.file-attach-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.file-attach-name { font-size: 12.5px; color: var(--text); font-weight: 600; }

.order-price-box {
  background: var(--panel-2);
  border-radius: 16px;
  padding: 18px;
  margin-top: 16px;
}
.order-price-box .order-form-row { margin-bottom: 14px; }
.order-price-box .order-form-row:last-child { margin-bottom: 0; }
.price-info-icon { color: var(--text-dim); font-size: 12px; cursor: help; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.cal-day-head { color: var(--text-dim); font-size: 10.5px; font-weight: 700; text-transform: uppercase; padding: 4px; text-align: center; }
.cal-cell {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 100px;
  padding: 8px;
  font-size: 11px;
}
.cal-cell.other-month { opacity: 0.4; }
.cal-cell .daynum { color: var(--text-dim); margin-bottom: 5px; font-weight: 700; }
.cal-post {
  background: var(--panel);
  border-radius: 6px;
  padding: 4px 6px;
  margin-bottom: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid var(--gray);
  box-shadow: var(--shadow);
}
.cal-post.scheduled { border-color: var(--yellow); }
.cal-post.published { border-color: var(--green); }
.cal-post.failed { border-color: var(--red); }
.cal-post.draft { border-color: var(--gray); }

/* ---------- Календарь заказов ---------- */
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.today .daynum { color: var(--accent); }
.cal-order-item {
  background: var(--panel);
  border-radius: 6px;
  padding: 4px 6px;
  margin-bottom: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid var(--gray);
  box-shadow: var(--shadow);
  font-weight: 600;
}
.cal-order-item.new { border-color: var(--gray); }
.cal-order-item.in_progress { border-color: var(--accent); }
.cal-order-item.review { border-color: var(--yellow); }
.cal-order-item.revision { border-color: var(--red); }
.cal-order-item.closed { border-color: var(--green); }
.cal-order-item.cancelled, .cal-order-item.client_refusal { border-color: var(--red); opacity: 0.7; text-decoration: line-through; }
.cal-order-item.search-match { outline: 2px solid var(--accent); box-shadow: 0 0 0 2px var(--accent-2, var(--accent)); }
.cal-order-item.search-dim { opacity: 0.3; }
.cal-subtask-item {
  background: var(--panel-2);
  border-radius: 6px;
  padding: 3px 6px;
  margin-bottom: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px dashed var(--text-dim);
  color: var(--text-dim);
  font-size: 10.5px;
}
.cal-subtask-item.done { text-decoration: line-through; opacity: 0.6; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.cal-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--gray); }
.cal-legend-dot.new { background: var(--gray); }
.cal-legend-dot.in_progress { background: var(--accent); }
.cal-legend-dot.review { background: var(--yellow); }
.cal-legend-dot.revision { background: var(--red); }
.cal-legend-dot.closed { background: var(--green); }
.cal-legend-dot.cancelled, .cal-legend-dot.client_refusal { background: var(--red); }
.cal-legend-dot.subtask { background: none; border: 2px dashed var(--text-dim); }
.search-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: var(--panel-2); }
.search-result-num { font-weight: 700; flex-shrink: 0; }
.search-result-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-date { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }

.empty-state { color: var(--text-dim); text-align: center; padding: 44px 0; font-size: 13px; }
.token-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.55; }
#vk_allow_messages_group { margin-top: 4px; }
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 170px; }

.mock-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--orange-soft);
  color: var(--orange);
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

/* ---------- Экран входа ---------- */
#login-screen {
  min-height: calc(100vh - 36px);
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 28px;
  box-shadow: var(--canvas-shadow);
}
.login-card {
  width: min(360px, 88vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.login-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 22px;
}
.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 18px 0 14px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.login-divider span { padding: 0 10px; }
.yandex-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.login-error {
  color: var(--red);
  font-size: 12.5px;
  margin-top: 14px;
  text-align: center;
  min-height: 14px;
}
.login-register-hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 14px;
}
.login-register-hint a { color: var(--accent); text-decoration: none; font-weight: 600; }
.login-register-hint a:hover { text-decoration: underline; }

.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who-name, .sidebar-footer .who-sub {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Уведомления ---------- */
.bell-btn {
  margin-left: auto;
  background: var(--panel-2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  position: relative;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.bell-btn:hover { background: var(--border); }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 4px;
  min-width: 14px;
  text-align: center;
}
/* Бейдж непрочитанных сообщений внутри пункта меню — не absolute, а прижат вправо в строке */
.nav-badge {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
}
.notif-panel {
  position: fixed;
  top: 78px;
  left: 34px;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(16,17,20,0.2);
  z-index: 60;
  padding: 10px;
}
.notif-item {
  padding: 10px;
  border-radius: 10px;
  font-size: 12.5px;
  margin-bottom: 4px;
  cursor: pointer;
}
.notif-item:hover { background: var(--panel-2); }
.notif-item.unread { background: var(--orange-soft); }
.notif-item .notif-time { color: var(--text-dim); font-size: 10.5px; margin-top: 3px; }

/* ---------- Модуль "Заказы" ---------- */
.badge.new { background: var(--gray-soft); color: var(--gray); }
.badge.pool-badge { background: var(--accent-soft); color: var(--accent); font-size: 10.5px; vertical-align: middle; }
.badge.in_progress { background: var(--accent-soft); color: var(--text); }
.badge.review { background: var(--yellow-soft); color: var(--yellow); }
.badge.revision { background: var(--red-soft); color: var(--red); }
.badge.closed { background: var(--green-soft); color: var(--green); }
.badge.cancelled, .badge.client_refusal { background: var(--red-soft); color: var(--red); }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 4px;
  background: var(--orange-soft);
  color: var(--orange);
}
.tag.priority_client { background: #eee6ff; color: #7c4dff; }
.tag.repeat_client { background: #e6f4ff; color: #0080ff; }

.deadline-flag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  margin-left: 6px;
}

/* ---------- Карточки заказов (список "Заказы", в стиле studwork) ---------- */
.order-cards-grid { display: flex; flex-direction: column; gap: 14px; }
.order-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.order-card:hover { border-color: var(--text-dim); box-shadow: 0 4px 16px rgba(0,0,0,0.05); }
.order-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.order-pill { font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 20px; }
.order-card-date { color: var(--text-dim); font-size: 13px; }
.order-card-number { margin-left: auto; color: var(--text-dim); font-size: 13px; font-weight: 600; }
.order-card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.order-card-title { font-weight: 700; font-size: 16px; line-height: 1.4; }
.order-card-price { font-weight: 700; font-size: 16px; white-space: nowrap; flex-shrink: 0; }
.order-card-sub { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.order-card-meta { display: flex; align-items: center; gap: 16px; margin-top: 14px; font-size: 13px; color: var(--text-dim); }
.order-card-due.danger { color: var(--red); font-weight: 700; }
.order-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.order-card-person { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
  position: relative; width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--text); flex-shrink: 0;
}
.avatar-sm-dot {
  position: absolute; bottom: -1px; right: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--green); border: 2px solid var(--panel);
}
.order-card-person-name { font-weight: 600; font-size: 13.5px; }
.order-card-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Раздел "Выплаты" ---------- */
.badge.payout-status.pending_manager { background: var(--gray-soft); color: var(--gray); }
.badge.payout-status.pending_admin { background: var(--yellow-soft); color: var(--yellow); }
.badge.payout-status.rejected { background: var(--red-soft); color: var(--red); }
.badge.payout-status.paid { background: var(--green-soft); color: var(--green); }

.payout-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.payout-row:last-child { border-bottom: none; }
.payout-checkbox { margin-top: 6px; width: 16px; height: 16px; flex-shrink: 0; }
.payout-row-main { flex: 1; min-width: 0; }
.payout-row-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.payout-order-link { font-weight: 600; color: var(--text); cursor: pointer; text-decoration: none; }
.payout-order-link:hover { text-decoration: underline; }
/* Файл сданной работы, прикреплённый к заявке на выплату — оформлен как ссылка */
.payout-file-link {
  width: auto; background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.payout-file-link:hover { text-decoration: underline; }
.payout-row-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-dim); }
.payout-row-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
@media (max-width: 640px) {
  .payout-row { flex-wrap: wrap; }
  .payout-row-actions { flex-direction: row; width: 100%; }
}

/* ---------- База знаний: "Мои файлы" (Яндекс.Диск) ---------- */
.kb-root-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.kb-root-tab {
  padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); color: var(--text-dim); cursor: pointer;
}
.kb-root-tab.active { background: var(--accent); color: #fff; }
.kb-breadcrumbs { font-size: 12.5px; color: var(--text-dim); }
.kb-breadcrumbs a { color: var(--text); text-decoration: none; font-weight: 600; cursor: pointer; }
.kb-breadcrumbs a:hover { text-decoration: underline; }
.kb-breadcrumbs .sep { margin: 0 6px; color: var(--border); }

.kb-file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 10px;
  border-bottom: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.kb-file-row:last-child { border-bottom: none; }
.kb-file-row:hover { background: var(--panel-2); }
.kb-file-icon { font-size: 20px; flex-shrink: 0; }
.kb-file-main { flex: 1; min-width: 0; }
.kb-file-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.kb-file-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.kb-file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.kb-file-actions button {
  border: none; background: var(--panel-2); border-radius: 8px; width: 30px; height: 30px;
  cursor: pointer; font-size: 14px;
}
.kb-file-actions button:hover { background: var(--border); }

/* ---------- База знаний: "Скрипты" (заметки) ---------- */
.kb-note-row {
  padding: 14px 10px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 10px;
}
.kb-note-row:last-child { border-bottom: none; }
.kb-note-row:hover { background: var(--panel-2); }
.kb-note-title { font-weight: 700; font-size: 14.5px; }
.kb-note-snippet { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
#kb-note-content { width: 100%; resize: vertical; }

/* ---------- Профиль эксперта: отзывы о работе ---------- */
.review-card {
  padding: 12px 14px; border-left: 3px solid var(--green); background: var(--panel-2);
  border-radius: 10px; margin-bottom: 10px;
}
.review-card.negative { border-left-color: var(--red); }
.review-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-thumb { font-size: 15px; }
.review-card-text { margin-top: 6px; font-size: 13.5px; line-height: 1.5; }

/* ---------- Карточка заказа (страница заказа) ---------- */
.order-breadcrumbs { font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }
.order-breadcrumbs a { color: var(--text); text-decoration: none; font-weight: 600; cursor: pointer; }
.order-breadcrumbs a:hover { text-decoration: underline; }
.order-breadcrumbs .sep { margin: 0 6px; color: var(--border); }

.order-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.order-header-row h2 { margin: 0; font-size: 24px; font-weight: 800; }
.badge-lg { font-size: 13px; padding: 8px 16px; font-weight: 700; }

.order-profile-row { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.order-profile-row .avatar-lg-wrap { margin: 0; }
.order-profile-name { font-weight: 700; font-size: 14.5px; }
.order-profile-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.order-profile-sub.online { color: var(--green); font-weight: 600; }

.order-info-section { padding-top: 16px; padding-bottom: 16px; }
.order-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.order-info-col { display: flex; flex-direction: column; }
.order-info-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
}
.order-info-cell:nth-child(odd) { background: var(--panel-2); border-radius: 12px; }
.order-info-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; color: var(--text-dim); }
.order-info-label { color: var(--text-dim); width: 130px; flex-shrink: 0; }
.order-info-value { font-weight: 700; }
.order-info-value.danger { color: var(--red); }
.order-info-value.muted { font-weight: 500; color: var(--text-dim); }
.order-info-value button { width: auto; background: none; border: none; padding: 0; margin-left: 6px; cursor: pointer; color: var(--text-dim); font-size: 12px; }

/* Панель действий заказа — на десктопе кнопки в ряд натуральной ширины (по тексту),
   без flex-grow: так они не растягиваются и не съезжают вбок при переносе. */
.order-actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.order-actions-row .btn { flex: 0 0 auto; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { opacity: 0.88; }
.btn-info { background: #2f80ed; color: #fff; }
.btn-info:hover { opacity: 0.88; }
.btn-warn { background: var(--yellow); color: #fff; }
.btn-warn:hover { opacity: 0.88; }
.more-actions-toggle { position: relative; flex: 0 0 auto; }
.more-actions-panel {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(16,17,20,0.18);
  padding: 8px; min-width: 220px; max-width: calc(100vw - 24px); z-index: 20;
  animation: more-actions-in 0.14s ease;
}
.more-actions-panel.open { display: flex; flex-direction: column; gap: 4px; }
.more-actions-panel button { text-align: left; justify-content: flex-start; width: 100%; }
@keyframes more-actions-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Верхняя строка заказа (бейдж статуса + "К списку") — раньше была инлайн-стилем без
   переноса, из-за чего на очень узких экранах могла вылезать за край. Теперь класс,
   которым можно управлять из media-запросов. */
.order-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Раздельная сетка под три колонки ("Файлы для заказа" / "Готовая работа" / "Файлы
   корректировки") — auto-fit сам решает, сколько колонок влезает по ширине, ужимаясь
   до одной на узких экранах (см. также media-запрос ниже для совсем маленьких). */
.file-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.file-columns .section { margin-bottom: 0; min-width: 0; }
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
}
.file-row.deliverable { background: var(--green-soft); }
.file-row-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1; }
.file-row-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
/* Обёртка вокруг названия+даты — min-width:0 обязателен, иначе флекс-родитель не даст
   тексту сжаться и он вываливается за пределы карточки вместо аккуратного переноса. */
.file-row-info { min-width: 0; flex: 1; overflow: hidden; }
.file-row-name {
  font-weight: 700; font-size: 13px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: break-word; word-break: break-word;
}
.file-row-meta { color: var(--text-dim); font-size: 11px; margin-top: 4px; }
.file-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.file-row-actions button { width: 26px; height: 26px; background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 13px; border-radius: 7px; }
.file-row-actions button:hover { background: var(--border); color: var(--text); }

/* ---------- Чат по заказу (личная переписка менеджера и назначенного эксперта) ---------- */
.order-chat-box { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.order-chat-messages {
  max-height: 380px; min-height: 160px; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; background: var(--panel);
}
.order-chat-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border); position: relative;
}
.order-chat-composer textarea {
  resize: none; max-height: 120px; min-height: 38px; flex: 1 1 auto; min-width: 0;
  overflow-y: auto; line-height: 1.4;
}
@media (max-width: 480px) {
  .order-chat-composer { padding: 10px 8px; gap: 4px; }
}

.collapsible-toggle { color: #2f80ed; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.collapsible-toggle:hover { text-decoration: underline; }

.desc-view { font-size: 13.5px; line-height: 1.6; }
.desc-view h3 { font-size: 15px; }
.desc-view ul, .desc-view ol { padding-left: 20px; }

.history-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.history-item:last-child { border-bottom: none; }
.history-item .history-time { color: var(--text-dim); font-size: 11px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.checklist-item.done { text-decoration: line-through; color: var(--text-dim); }

/* ==================================================================
   АДАПТИВНОСТЬ — планшет и телефон
   ================================================================== */

/* Кнопка мобильного меню и затемнение — скрыты на десктопе */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 60;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--text);
  color: #fff;
  font-size: 17px;
  align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(16,17,20,0.25);
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(16,17,20,0.4);
  z-index: 45;
}
.sidebar-backdrop.open { display: block; }

/* ---------- ≤1150px: правая панель (профиль + агенда) уступает место основному контенту ---------- */
@media (max-width: 1150px) {
  .side-panel { display: none; }
}

/* ---------- ≤980px: двух- и многоколоночные блоки складываются в один столбец ---------- */
@media (max-width: 980px) {
  .grid-two,
  .order-info-grid,
  .file-columns {
    grid-template-columns: 1fr;
  }
  .order-form-row {
    grid-template-columns: 1fr;
  }
  .order-form-row.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- ≤860px: сайдбар превращается в выдвижное меню ---------- */
@media (max-width: 860px) {
  body { padding: 0; }
  #app, #login-screen {
    border-radius: 0;
    min-height: 100vh;
  }
  #app {
    flex-direction: column;
  }
  .mobile-menu-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    max-width: 82vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(16,17,20,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { padding-left: 44px; } /* не наезжать на кнопку меню */
  main {
    padding: 70px 16px 24px;
    max-height: none;
  }
  .side-panel {
    display: none;
  }
  .topbar { gap: 10px; }
  .topbar h2 { font-size: 20px; }
}

/* ---------- ≤600px: телефон ---------- */
@media (max-width: 600px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .card-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px 16px 50px; }
  .stat-card .num { font-size: 24px; }
  .section { padding: 16px; }
  main { padding: 64px 12px 20px; }
  .modal { padding: 18px; }
  .order-header-row { flex-direction: column; align-items: flex-start; }
  .order-header-actions { width: 100%; justify-content: space-between; }
  /* Кнопки заказа на телефоне: аккуратный вертикальный стек во всю ширину вместо
     "резинового" переноса разной ширины — так выглядит собранно на любом узком экране. */
  .order-actions-row { flex-direction: column; align-items: stretch; width: 100%; gap: 8px; }
  .order-actions-row .btn, .order-actions-row .more-actions-toggle { flex: none; width: 100%; }
  .order-actions-row .btn { text-align: center; }
  .more-actions-toggle .btn { display: flex; align-items: center; justify-content: center; }
  /* Панель "Ещё" на телефоне — не всплывающий поповер, а полноширинный список под кнопкой,
     чтобы не обрезаться о край экрана и не перекрывать соседний контент. */
  .more-actions-panel {
    position: static; width: 100%; min-width: 0; max-width: none;
    box-shadow: none; margin-top: 6px;
  }
  .more-actions-panel button { padding: 10px 14px; }
  .calendar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .cal-cell { padding: 4px; min-height: 60px; }
  .cal-day-head { font-size: 9px; padding: 2px; }
  .cal-post { font-size: 9.5px; }
  table { font-size: 12px; }
  .filters { flex-direction: column; }
  .filters select, .filters input { width: 100%; min-width: 0; }
  /* Настоящая причина "гигантского" поля поиска на телефоне: поля поиска (#order-search-input
     и т.п.) заданы инлайн-стилем flex:1 1 280px для десктопной раскладки в ряд (там 280px —
     это ширина). Когда .filters переключается в flex-direction:column (см. правило выше),
     280px из flex-basis начинает относиться к ГЛАВНОЙ оси, а на колонке главная ось — это
     высота, а не ширина! Из-за этого поле растягивалось по высоте на весь экран, а никакие
     правки line-height/height результата не давали — они боролись не с тем свойством.
     Инлайн-стиль нельзя перебить через "width"/"height", только через сам "flex" с !important. */
  #order-search-input, #payouts-search-input, #ocal-search-input {
    flex: 0 1 auto !important;
  }
  .order-info-label { width: 100px; }
}

/* Таблицы не должны ломать раскладку на узких экранах — горизонтальная прокрутка вместо обрезки */
table { min-width: 480px; }

/* ==================================================================
   МЕССЕНДЖЕР
   ================================================================== */
.chat-layout {
  display: flex;
  height: calc(100vh - 110px);
  min-height: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-list {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.chat-list-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.chat-list-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.chat-new-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-size: 16px; flex-shrink: 0;
}
.chat-search { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-search input { padding: 8px 12px; font-size: 12.5px; }
/* Фильтр "Все / Личные / Группы" над списком диалогов */
.chat-type-filter { display: flex; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.chat-type-filter-btn {
  flex: 1; padding: 6px 4px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); color: var(--text-dim); font-size: 11.5px; font-weight: 600;
}
.chat-type-filter-btn.active { background: var(--accent); color: #fff; }
.chat-items { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--panel-2); }
.chat-item-avatar { position: relative; flex-shrink: 0; margin-top: 1px; }
.chat-item-name { font-weight: 700; font-size: 13px; }
.chat-item-preview { color: var(--text-dim); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-item-meta { margin-left: auto; text-align: right; flex-shrink: 0; }
.chat-item-time { color: var(--text-dim); font-size: 10.5px; }

/* Непрочитанное сообщение — выделяем всю строку диалога (тот же акцент, что и у
   непрочитанных уведомлений в колокольчике, для единообразия), а не только циферку */
.chat-item.has-unread {
  background: var(--orange-soft);
  border-left-color: var(--orange);
}
.chat-item.has-unread:hover,
.chat-item.has-unread.active {
  background: var(--orange-soft);
  filter: brightness(0.97);
}
.chat-item-preview.unread { color: var(--text); font-weight: 600; }
.chat-item-unread-pill {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px;
  background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 20px; padding: 3px 9px;
  white-space: nowrap;
}
.chat-item-unread-count {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 6px; margin-left: auto;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 20px; padding: 2px 7px; min-width: 20px; height: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.chat-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-thread-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-thread-name { font-weight: 700; font-size: 14px; }
.chat-thread-sub { font-size: 12px; color: var(--text-dim); }
.chat-thread-sub.online { color: var(--green); font-weight: 600; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }
.chat-bubble {
  max-width: 68%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
  background: var(--panel-2);
  color: var(--text);
}
.chat-bubble-row.mine .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-row:not(.mine) .chat-bubble { border-bottom-left-radius: 4px; }
.chat-bubble-time { font-size: 10px; opacity: 0.65; margin-top: 4px; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
/* Кнопка "Ответить" под пузырьком — скрыта по умолчанию, появляется по наведению на
   сообщение (как в WhatsApp/Telegram), чтобы не загромождать ленту переписки. */
.chat-bubble-reply-btn {
  opacity: 0; transition: opacity 0.12s;
  background: none; border: none; cursor: pointer;
  font-size: 10.5px; color: inherit; opacity: 0; padding: 0;
}
.chat-bubble-row:hover .chat-bubble-reply-btn { opacity: 0.75; }
.chat-bubble-reply-btn:hover { opacity: 1 !important; text-decoration: underline; }
/* Цитата исходного сообщения внутри пузырька-ответа — вертикальная полоска слева +
   имя автора + обрезанный текст, кликабельна (пролистывает к оригиналу, см. wireReplyQuoteClicks). */
.chat-bubble-quote {
  border-left: 3px solid rgba(255,255,255,0.6);
  padding: 3px 8px; margin-bottom: 6px;
  border-radius: 4px; background: rgba(255,255,255,0.12);
  cursor: pointer;
}
.chat-bubble-row:not(.mine) .chat-bubble-quote { border-left-color: var(--accent); background: rgba(0,0,0,0.05); }
.chat-bubble-quote-author { font-size: 11px; font-weight: 700; opacity: 0.9; }
.chat-bubble-quote-text { font-size: 12px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
/* Кратковременная подсветка сообщения, к которому пролистали по клику на цитату */
.chat-bubble-flash .chat-bubble { animation: chat-bubble-flash-anim 1.2s ease; }
@keyframes chat-bubble-flash-anim {
  0% { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: none; }
}
.chat-bubble-attachment {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px; padding: 6px 10px; margin-top: 6px; font-size: 12px;
}
.chat-bubble-row:not(.mine) .chat-bubble-attachment { background: var(--panel); }
/* Вставленный скриншот/картинка в сообщении — превью вместо файловой "плашки" */
.chat-bubble-attachment.chat-bubble-image { padding: 0; background: none; display: block; }
.chat-bubble-attachment.chat-bubble-image img {
  max-width: 220px; max-height: 220px; border-radius: 12px; display: block; cursor: pointer;
  margin-top: 6px;
}
/* Голосовое сообщение — обычный проигрыватель браузера, чуть подогнанный по высоте */
.chat-bubble-attachment.chat-bubble-voice { align-items: center; }
.chat-bubble-attachment.chat-bubble-voice audio { height: 34px; max-width: 220px; }
/* Карточка обычного файла (любое расширение, включая архивы) — круглая кнопка-иконка
   скачивания слева, имя файла и вес файла справа, как в обычных мессенджерах. */
.chat-bubble-attachment.chat-bubble-file {
  display: flex; align-items: center; gap: 10px;
  min-width: 200px; max-width: 260px;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.chat-file-icon {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.25);
  font-size: 15px;
}
.chat-bubble-row:not(.mine) .chat-file-icon { background: rgba(0,0,0,0.08); }
.chat-bubble-attachment.chat-bubble-file-mock .chat-file-icon { background: transparent; font-size: 18px; }
.chat-file-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow: hidden; }
.chat-file-name {
  font-weight: 600; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-file-meta { font-size: 11px; opacity: 0.75; }
.media-file-size { opacity: 0.65; font-size: 11px; }
/* Автоматическая расшифровка голосового (Web Speech API) — отдельным блоком, курсивом,
   чтобы не путать с обычным напечатанным текстом сообщения */
.voice-transcript { font-style: italic; opacity: 0.9; margin-bottom: 2px; }

/* Индикатор "печатает..." над панелью ввода — с анимированными подпрыгивающими точками */
.typing-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 0 20px 8px; font-size: 12px; color: var(--text-dim);
}
.typing-mic { font-size: 13px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
  animation: typing-bounce 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 typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-composer {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  position: relative;
}
.chat-composer-normal { display: flex; align-items: flex-end; gap: 8px; }
/* Панель записи голосового сообщения — красная пульсирующая точка + таймер + отмена/отправка */
.chat-recording-ui { display: flex; align-items: center; gap: 10px; }
.recording-dot {
  width: 12px; height: 12px; border-radius: 50%; background: #e5484d; flex-shrink: 0;
  animation: recording-pulse 1.2s ease-in-out infinite;
}
@keyframes recording-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
.recording-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.recording-hint { font-size: 12.5px; color: var(--text-dim); flex: 1; }
.chat-composer textarea {
  resize: none;
  max-height: 140px;
  min-height: 40px;
  flex: 1 1 auto;
  min-width: 0;
  /* растёт по высоте вместе с текстом (см. autoGrowTextInput в app.js) — так набранное
     сообщение видно целиком, а не прячется в одну узкую строку на маленьком окне */
  overflow-y: auto;
  line-height: 1.4;
}
/* На совсем узких экранах (телефон/сильно свёрнутое окно) круглые кнопки эмодзи/
   вложений/заказа съедают заметную часть ширины — немного уменьшаем их и отступы,
   чтобы полю ввода оставалось больше места под текст. */
@media (max-width: 420px) {
  .chat-composer { padding: 10px 8px; }
  .chat-composer-normal, .chat-recording-ui { gap: 4px; }
  .chat-composer-btn, .chat-send-btn { width: 32px; height: 32px; font-size: 14px; }
  .recording-hint { display: none; } /* на совсем узком экране прячем подпись, оставляем таймер и кнопки */
}
.chat-composer-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--panel-2); border: none; cursor: pointer;
  font-size: 16px; flex-shrink: 0;
}
.chat-composer-btn:hover { background: var(--border); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-size: 15px; flex-shrink: 0;
}
.chat-attach-preview {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 0 16px 8px;
}
.chat-attach-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2); border-radius: 10px; padding: 5px 10px; font-size: 11.5px;
}
.chat-attach-chip button { width: auto; background: none; border: none; cursor: pointer; color: var(--text-dim); padding: 0; }

/* Превью "Ответ на сообщение" над полем ввода — появляется после клика на "Ответить"
   под пузырьком собеседника, с крестиком отмены (см. drawReplyPreview в app.js). */
.chat-reply-preview {
  align-items: center; gap: 10px;
  margin: 0 16px 8px; padding: 6px 10px;
  background: var(--panel-2); border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.chat-reply-preview-body { flex: 1; min-width: 0; }
.chat-reply-preview-author { font-size: 11.5px; font-weight: 700; color: var(--accent); }
.chat-reply-preview-text { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply-preview button {
  width: auto; background: none; border: none; cursor: pointer; color: var(--text-dim); padding: 0; font-size: 14px;
}
/* Миниатюра вставленного скриншота/картинки в панели вложений перед отправкой */
.chat-attach-image-chip { position: relative; padding: 4px; }
.chat-attach-image-chip img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; display: block; }
.chat-attach-image-chip button {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  background: var(--panel); border-radius: 50%; font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Карточка прикреплённого заказа в чате — кликабельна, ведёт на страницу заказа */
.chat-order-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 12px; padding: 8px 12px; margin-top: 8px;
  cursor: pointer; transition: background 0.15s;
}
.chat-order-card:hover { background: rgba(255,255,255,0.3); }
.chat-bubble-row:not(.mine) .chat-order-card { background: var(--panel-2); }
.chat-bubble-row:not(.mine) .chat-order-card:hover { background: var(--border); }
.chat-order-card-icon { font-size: 18px; flex-shrink: 0; }
.chat-order-card-title { font-size: 12.5px; font-weight: 600; }
.chat-order-card-sub { font-size: 11px; opacity: 0.8; }

.emoji-picker {
  display: none;
  position: absolute;
  bottom: 56px; left: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(16,17,20,0.2);
  padding: 10px;
  width: 260px;
  max-height: 200px;
  overflow-y: auto;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 30;
}
.emoji-picker.open { display: grid; }
.emoji-picker button {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px; border-radius: 6px;
}
.emoji-picker button:hover { background: var(--panel-2); }

@media (max-width: 860px) {
  .chat-layout { height: calc(100vh - 130px); border-radius: 14px; }
  .chat-list { width: 100%; }
  .chat-list.hide-on-mobile-thread { display: none; }
  .chat-thread { display: none; }
  .chat-thread.active-on-mobile { display: flex; }
  .chat-item-preview { max-width: 55vw; }
}

/* Всплывающие уведомления (тосты) — новое сообщение или событие по заказу */
#toast-root {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast-card {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  cursor: pointer;
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.toast-text { font-size: 12.5px; color: var(--text-dim); overflow-wrap: anywhere; }
.toast-close {
  background: none; border: none; cursor: pointer; color: var(--text-dim);
  font-size: 13px; padding: 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

@media (max-width: 600px) {
  #toast-root { top: 8px; right: 8px; left: 8px; max-width: none; }
}

/* Сворачиваемый список "Заказы" со статусами в сайдбаре (в стиле studwork) */
.nav-orders-toggle { position: relative; }
.nav-caret {
  width: 14px; flex-shrink: 0; text-align: center;
  font-size: 10px; color: var(--text-dim);
  transition: transform 0.15s ease;
}
.nav-orders-toggle.active .nav-caret { color: rgba(255,255,255,0.7); }
.nav-orders-toggle.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-count-badge {
  margin-left: auto;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11px; font-weight: 700;
  border-radius: 20px; padding: 2px 8px;
  flex-shrink: 0;
}
.nav-orders-toggle.active .nav-count-badge { background: rgba(255,255,255,0.18); color: #fff; }

.nav-substatus-list {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 4px 0;
}
.nav-substatus {
  display: flex; align-items: center;
  padding: 7px 12px 7px 34px; /* отступ вправо от иконки родителя, как вложенный пункт */
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12.5px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-substatus:hover { background: var(--panel-2); color: var(--text); }
.nav-substatus.active { background: var(--panel-2); color: var(--text); font-weight: 700; }
.nav-substatus-count { margin-left: auto; font-weight: 700; font-size: 11.5px; }
.new-pill {
  display: inline-block; background: var(--red, #e5484d); color: #fff; font-size: 9.5px;
  font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; border-radius: 20px;
  padding: 1px 6px; margin-left: 4px; vertical-align: middle; animation: new-pill-pulse 1.8s ease-in-out infinite;
}
@keyframes new-pill-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
