/* Shared by the staff workspaces and sign-in pages. */
:root {
  color-scheme: light;
  --surface: #ffffff;
  --ink: #1d2927;
  --green: #0d514d;
  --on-green: var(--surface);
  --muted: #526460;
  --line: #d5dedb;
  --tint: #e8f2ef;
  --edge: #798c87;
  --hover: #093f3c;
  --scrim: rgb(29 41 39 / 35%);
  --sans: Inter, system-ui, "Segoe UI", Arial, sans-serif;
}

.brand { color: var(--green); }
.brand img { display: block; }
.topbar { border-bottom: 1px solid var(--line); }
.entry h1, .welcome h1, .surface-heading h1, .workspace-heading h1 {
  margin: 8px 0 12px;
  font: 650 clamp(1.45rem, 2.6vw, 1.9rem)/1.2 var(--sans);
  letter-spacing: -.025em;
}
.assistant-title h2, .overlay-heading h2 {
  margin: 0 0 8px;
  font: 600 1.15rem/1.3 var(--sans);
  letter-spacing: normal;
}
.primary-button, .send-button, .view-tabs button[aria-selected="true"],
.mobile-switch button[aria-pressed="true"] {
  background: var(--green);
  color: var(--on-green);
}
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.composer:focus-within { border-color: var(--green); }
.warning, .surface-error, .photo-error { border-inline-start: 3px solid var(--green); }
.activation-status { margin: 12px 24px; padding: 12px 16px; border: 1px solid var(--line); border-inline-start: 3px solid var(--green); background: var(--tint); color: var(--green); font: 13px/1.5 var(--sans); }

.request-table th {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
}
.request-table tbody tr:focus-within {
  background: var(--tint);
  box-shadow: inset 3px 0 var(--green);
}
@media (hover: hover) {
  .request-table tbody tr:hover { background: var(--tint); }
}
.ticket-button:hover .ticket-title, .ticket-button:focus-visible .ticket-title {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.metric strong, .house-counts strong, .ticket-number {
  font-variant-numeric: tabular-nums;
}
.filters input, .filters select { border-color: var(--edge); }
input[type="checkbox"] { accent-color: var(--green); }


/* Shared role-aware workspace navigation. Only header chrome changes. */
.staff-tabs { display: flex; align-items: center; gap: 4px; margin: 0; flex-wrap: wrap; }
.staff-tabs a { display: inline-flex; align-items: center; padding: 9px 11px;
  color: var(--green); text-decoration: none; white-space: nowrap; border-radius: 3px;
  font: 550 13px/1.35 var(--sans); border: 1px solid transparent; }
.staff-tabs a[hidden] { display: none; }
.staff-tabs a[aria-current="page"] { background: var(--green); color: var(--surface); }
.staff-tabs a:not([aria-current]):hover { background: var(--tint); border-color: var(--line); }
.activity-topbar { display:flex; align-items:center; justify-content:space-between;
  gap: 20px; min-height: 70px; padding: 12px clamp(16px, 3.5vw, 52px);
  background: var(--surface); }
.staff-brand { display:flex; align-items:center; gap:12px; color:var(--green); text-decoration:none; flex:none; }
.staff-brand img { width:38px; height:38px; }
.staff-brand b { display:block; font:650 23px/1.1 var(--sans); letter-spacing:-.6px; }
.staff-brand small { display:block; color:var(--muted); text-transform:uppercase;
  font:500 10px/1.3 var(--sans); letter-spacing:.10em; margin-top:5px; }
.staff-logout { margin:0; }
.staff-logout button { color:var(--green); border:0; background:none; padding:5px 0; font:500 13px/1.3 var(--sans); }
@media (max-width:1100px) {
  .topbar:has(.staff-tabs) { flex-wrap:wrap; }
  .topbar:has(.staff-tabs) .staff-tabs { flex-basis:100%; order:3; }
}
@media (max-width:600px) {
  .staff-tabs { gap:3px; }
  .staff-tabs a { padding:8px 7px; font-size:12px; }
}

/* ════════════════════════════════════════════════════════════════════
   ДОМОВОЙ · v4 «ФОТО ПОД МАТОВЫМ СТЕКЛОМ»
   Обои под интерфейсом, карточки — матовое стекло, слегка просвечивают.
   Движение отключено полностью. Подключается последним.
   ════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  --beige: #eef0ea;          /* резервный фон, если обои не загрузились */
  --surface: #fdfcf8;
  --ink: #1f231f;
  --green: #0d514d;
  --on-green: #f7f5ef;
  --muted: #454f49;          /* проверено расчётом на матовом стекле */
  --edge: #8b9a93;
  --line: rgb(31 35 31 / 14%);
  --tint: rgb(31 35 31 / 5%);
  --hover: #0a423e;
  --scrim: rgb(13 81 77 / 14%);

  /* матовое стекло: плотное, но фон читается сквозь */
  --card: rgb(253 252 248 / 84%);
  --card-strong: rgb(253 252 248 / 94%);
  --bar: rgb(253 252 248 / 78%);
  --card-border: rgb(255 255 255 / 70%);
  --card-rim: rgb(255 255 255 / 98%);
  --card-blur: 22px;

  --radius-lg: 16px;
  --radius-md: 11px;
  --shadow-soft: 0 10px 28px rgb(12 24 20 / 18%), 0 2px 6px rgb(12 24 20 / 10%);
  --shadow-lift: 0 16px 36px rgb(12 24 20 / 26%), 0 4px 10px rgb(12 24 20 / 14%);

  /* затемнение обоев: держит контраст и гасит пестроту фотографии */
  --wall-veil: linear-gradient(180deg, rgb(252 250 245 / 46%) 0px, rgb(252 250 245 / 30%) 15%, rgb(252 250 245 / 26%) 100%);
  --wall-blur: 2px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --beige: #14171a;
  --surface: #1b1f23;
  --ink: #e9e6dd;
  --green: #e9e6dd;
  --on-green: #0f1a18;
  --muted: #b5b3aa;
  --edge: #4a504c;
  --line: rgb(233 230 221 / 14%);
  --tint: rgb(233 230 221 / 6%);
  --hover: #f7f4ec;
  --scrim: rgb(0 0 0 / 34%);

  --card: rgb(27 31 36 / 82%);
  --card-strong: rgb(26 30 35 / 92%);
  --bar: rgb(18 21 26 / 80%);
  --card-border: rgb(255 255 255 / 14%);
  --card-rim: rgb(255 255 255 / 22%);

  --shadow-soft: 0 10px 28px rgb(0 0 0 / 55%), 0 2px 6px rgb(0 0 0 / 35%);
  --shadow-lift: 0 16px 36px rgb(0 0 0 / 65%), 0 4px 10px rgb(0 0 0 / 40%);

  --wall-veil: linear-gradient(180deg, rgb(8 10 13 / 54%) 0px, rgb(8 10 13 / 44%) 15%, rgb(8 10 13 / 48%) 100%);
  --wall-blur: 2px;
}

/* ── обои под интерфейсом ─────────────────────────────────────────────
   Фон задан и на html, и на body, с attachment: scroll.
   Проверено: при attachment: fixed Chrome оставлял нижнюю часть страницы
   без фотографии, и там проступал цвет --beige. Вариант scroll покрывает
   всю высоту документа на реальных длинных страницах кабинетов.
   ─────────────────────────────────────────────────────────────────── */

html {
  background-color: var(--beige);
  background-image:
    var(--wall-veil),
    url("wallpaper.jpg");
  background-size: cover, cover;
  background-position: center 42%, center 42%;
  background-attachment: scroll, scroll;
  background-repeat: no-repeat, no-repeat;
}

html body {
  background-image: var(--wall-veil), url("wallpaper.jpg");
  background-size: cover, cover;
  background-position: center 42%, center 42%;
  background-repeat: no-repeat, no-repeat;
  background-color: transparent;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100svh;
}

/* ── матовое стекло ───────────────────────────────────────────── */

/* панели реальных кабинетов: то, что должно пропускать обои */
.dashboard, .queue-view, .board-lane, .board-card, .house-card, .case-card,
.assistant-pane, .metric, .notice, .empty-state, .journal-row, .profile-card,
.profile-version-card, .profile-conflict, .action-form, .action-preview:not(:empty),
.legal-readiness, .table-card, .brief-card, .login-card, .turn-failure,
.archive-state, .chat-notice, .surface-error, .overlay-panel {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(118%);
  backdrop-filter: blur(var(--card-blur)) saturate(118%);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--card-rim);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .brief-card, .table-card, .journal-row, .profile-card, .login-card, .notice,
  .empty-state, .surface-error, .turn-failure, .archive-state, .metric,
  .assistant-pane, .overlay-panel, .case-card, .board-lane, .action-form,
  .profile-version-card, .profile-conflict, .chat-notice, .legal-readiness,
  .topbar { background: var(--surface); }
}

.journal-row, .case-card, .board-lane, .notice { border-radius: 13px; }

.table-scroll {
  background: transparent;
  border-radius: var(--radius-md);
  overflow-x: auto;
}

/* таблица внутри стеклянной панели: только линии, без своей заливки */
.request-table, .request-table tbody, .request-table tr,
.request-table td, .request-table th {
  background: transparent;
}
.request-table th {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.request-table td { border-top: 1px solid var(--line); }
.request-table tbody tr:hover,
.request-table tbody tr:focus-within { background: var(--tint); }
.request-table th, td { } /* приоритет по специфичности задаётся ниже */
.table-note { border-top: 1px solid var(--line); color: var(--muted); }

/* поля ввода остаются плотными: сквозь них не должно быть видно обоев */
.filters input, .filters select, .house-controls input, .house-controls select,
.house-filter-field input, .house-editor input:not([type="checkbox"]),
.profile-field input, .profile-field select, .profile-field textarea,
.link-search input, .composer { background: var(--card-strong); }

/* ── текст поверх фотографии: тень держит контраст ────────────── */

.page-title, main > h1 {
  text-shadow: 0 1px 2px rgb(255 255 255 / 55%), 0 2px 12px rgb(255 255 255 / 35%);
}
.page-sub, main > .lead, .workspace-heading .lead, .surface-heading .lead {
  text-shadow: 0 1px 2px rgb(255 255 255 / 60%);
}
[data-theme="dark"] .page-title, [data-theme="dark"] main > h1,
[data-theme="dark"] .workspace-heading h1, [data-theme="dark"] .surface-heading h1 {
  text-shadow: 0 1px 3px rgb(0 0 0 / 65%), 0 2px 14px rgb(0 0 0 / 45%);
}
[data-theme="dark"] .page-sub, [data-theme="dark"] main > .lead {
  text-shadow: 0 1px 3px rgb(0 0 0 / 70%);
}

/* ── заголовок рабочей области: такая же стеклянная панель ──────
   Заголовок и подзаголовок лежат поверх фотографии, поэтому им нужна
   собственная матовая подложка — иначе текст теряется на застройке.
   ─────────────────────────────────────────────────────────────── */

.workspace-heading,
.surface-heading,
.page-head {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px 15px;
  margin-bottom: 14px;
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(118%);
  backdrop-filter: blur(var(--card-blur)) saturate(118%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 var(--card-rim);
}
.workspace-heading h1, .surface-heading h1, .page-head h1 { margin: 6px 0 6px; }
.workspace-heading .lead, .surface-heading .lead, .page-head .lead { margin: 0; }
.workspace-heading .eyebrow { color: var(--muted); }

/* заголовки вне панели: мягкая тень вместо подложки */
.entry h1, .welcome h1 { text-shadow: 0 1px 3px rgb(255 255 255 / 45%); }
[data-theme="dark"] .entry h1, [data-theme="dark"] .welcome h1 { text-shadow: 0 1px 4px rgb(0 0 0 / 60%); }

/* ── шапка ────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  min-height: 64px;
  max-width: none;
  margin: 0;
  padding: 12px clamp(14px, 3vw, 34px);
  background: var(--bar);
  border-bottom: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  backdrop-filter: blur(20px) saturate(120%);
  box-shadow: inset 0 1px 0 var(--card-rim), 0 6px 18px rgb(12 24 20 / 12%);
}

.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.brand { color: var(--green); font-size: 21px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px var(--line); }
.brand-sub { margin-top: 3px; font-size: 10px; letter-spacing: .11em; color: var(--muted); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card-strong); color: var(--green);
}
.theme-toggle:hover { border-color: var(--green); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-moon { display: block; }
[data-theme="dark"] .theme-toggle .i-sun { display: none; }

/* ── ссылки и служебные подписи вне карточек ─────────────────────
   На фотографии обычный текст не читается, поэтому всё, что лежит прямо
   на фоне, получает стеклянную подложку-пилюлю.
   ─────────────────────────────────────────────────────────────── */

.cabinet-links,
.cabinet-links a,
.cabinet-links summary,
.demo-link,
.sign-in-links,
.sign-in-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-strong);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  box-shadow: inset 0 1px 0 var(--card-rim), 0 6px 16px rgb(12 24 20 / 14%);
  color: var(--green);
  text-decoration: none;
  font-size: 13px;
}
.cabinet-links { display: inline-flex; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.cabinet-links a:hover, .cabinet-links summary:hover, .demo-link:hover { border-color: var(--green); }

/* ── элементы управления ──────────────────────────────────────── */

.primary-button, .send-button, .secondary-button, .retry-button,
.reconnect-button, .voice-button, .suggestion { border-radius: var(--radius-md); }

.primary-button:not(:disabled):hover, .send-button:not(:disabled):hover {
  filter: brightness(1.06);
}

.composer {
  background: var(--card-strong);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 var(--card-rim);
}
.composer:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--scrim); }

/* ── статусы ──────────────────────────────────────────────────── */

.status, .status-pill, .journal-state, .case-status, .data-state,
.legal-pill, .form-status, .profile-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-strong);
  color: var(--muted);
  font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.status-resolved { color: var(--green); }
.priority-urgent { color: var(--muted); font-weight: 650; }

/* ── метрики ──────────────────────────────────────────────────── */

.metrics { gap: 12px; }
.metric { padding: 14px 16px; }
.metric strong { font-size: 28px; font-weight: 650; letter-spacing: -.02em; }
.metric-label { font-size: 12px; color: var(--muted); }

/* ── варианты панелей: одно стекло, без выбивающихся заливок ────
   Базовые стили задают .metric.urgent, .notice.warning/.success и
   .profile-status собственную подложку — из-за этого соседние карточки
   выглядели разными. Приводим их к общему стеклу, акцент оставляем
   только на подписи и кромке.
   ─────────────────────────────────────────────────────────────── */

.metric.urgent,
.notice.warning,
.notice.success,
.profile-status,
.profile-status[data-tone="error"],
.board-lane,
.lane-count {
  background: var(--card);
}

.metric.urgent { border-color: var(--card-border); }
.metric.urgent .metric-label { color: var(--green); font-weight: 600; }

/* ── наведение: только тень и граница, без движения ───────────── */

.metric:hover, .journal-row:hover, .case-card:hover {
  border-color: rgb(255 255 255 / 85%);
  box-shadow: var(--shadow-lift), inset 0 1px 0 var(--card-rim);
}
[data-theme="dark"] .metric:hover,
[data-theme="dark"] .journal-row:hover,
[data-theme="dark"] .case-card:hover { border-color: rgb(255 255 255 / 26%); }

/* ── движение отключено по решению владельца ──────────────────── */

*, *::before, *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ── узкие экраны ─────────────────────────────────────────────── */

@media (max-width: 760px) {
  .topbar { min-height: 56px; padding: 10px 14px; gap: 8px 12px; }
  .brand { font-size: 19px; }
  .brand img { width: 30px; height: 30px; }
  .brand-sub { font-size: 9px; }
  .top-actions { gap: 6px 12px; }
  .metric strong { font-size: 24px; }
  html { background-position: center 35%, center 35%; }
}

/* ── кабинет «Контроль активности» ────────────────────────────────
   У этого кабинета собственный инлайновый CSS с жёсткими цветами
   (#fff карточки, синеватые подписи). Он подключается раньше, поэтому
   общая тема перекрывает цвета, сохраняя его раскладку.
   ─────────────────────────────────────────────────────────────── */

.activity .card,
.activity .stats div {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(118%);
  backdrop-filter: blur(var(--card-blur)) saturate(118%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 var(--card-rim);
}
.activity .stats div { border-radius: var(--radius-md); }
.activity .muted, .activity small { color: var(--muted); }
.activity a { color: var(--green); }
.activity th { color: var(--muted); border-bottom-color: var(--line); }
.activity td { border-bottom-color: var(--line); }
.activity button {
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--green);
}
.activity button:hover { border-color: var(--green); }
.activity pre, .activity .message { color: var(--ink); }
.activity h1, .activity h2 { color: var(--green); }

/* шапка и навигация активности лежат прямо на фотографии — даём им панель */
.activity > header,
.activity > nav {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 0 0 14px;
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(118%);
  backdrop-filter: blur(var(--card-blur)) saturate(118%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 var(--card-rim);
}
.activity > nav { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.activity > header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.activity > header h1 { margin: 0; }
/* заголовки внутри содержимого: мягкая тень, чтобы не терялись на застройке */
.activity h1, .activity h2 { text-shadow: 0 1px 3px rgb(255 255 255 / 55%); }
[data-theme="dark"] .activity h1, [data-theme="dark"] .activity h2 { text-shadow: 0 1px 4px rgb(0 0 0 / 70%); }
