/* Оформление админки — светлое рабочее, по макетам 18.11.2026 (холст «Бо Хам — новый дизайн админки»). */

/* Inter лежит рядом (admin/fonts, лицензия SIL OFL): админка не ходит к Google и не зависит от внешней сети.
   cyrillic-ext — таджикские буквы (ғ, ӣ, қ, ӯ, ҳ, ҷ). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/admin/fonts/inter-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/admin/fonts/inter-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/admin/fonts/inter-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f6f6f7;
  --panel: #fff;
  --panel-2: #fafafb;
  --sidebar: #fff;
  --tile: #f0f0f2;
  --text: #18181b;
  --nav-text: #3f3f46;
  --muted: #6b6b76;
  --border: #e6e6ea;
  --border-soft: #f0f0f2;
  --border-strong: #dcdce1;
  --accent: #3b4fd8;
  --accent-text: #3341b8;
  --accent-tint: #eef0ff;
  --row-selected: #f4f5ff;
  --gold: #8f5100;
  --gold-tint: #fff3df;
  --danger: #b42318;
  --danger-solid: #d92d20;
  --danger-tint: #fdeceb;
  --danger-line: #f5c2bd;
  --ok: #17733a;
  --ok-solid: #17733a;
  --ok-tint: #e7f6ec;
  --muted-tint: #f0f0f2;
  --ink: #18181b;
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04);
  --shadow-pop: 0 8px 24px rgba(16, 16, 20, 0.12), 0 1px 2px rgba(16, 16, 20, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 15px; }
h3 { font-size: 15px; }
a { color: var(--accent-text); }
a:hover { color: #1f2a8a; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; }
.small { font-size: 12.5px; }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 12px;
  height: 36px;
  width: 100%;
}
textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
input::placeholder, textarea::placeholder { color: #8a8a94; }
input[type='checkbox'] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover { background: var(--panel-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3244c4; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.ok { background: var(--ok-solid); border-color: var(--ok-solid); color: #fff; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); padding: 0 8px; height: 30px; }
.btn.ghost:hover { color: var(--text); background: var(--muted-tint); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.wrap { white-space: normal; line-height: 1.25; text-align: center; min-height: 36px; height: auto; padding: 6px 12px; }
.btn.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; font-size: 11px; font-weight: 600; border: 1px solid currentColor; border-radius: 5px; opacity: .75; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.card > h3:first-child, .card-head { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; }
.login-card h1 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.login-card h1::before { content: 'БХ'; width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.login-card h1 span { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tf-setup { display: grid; justify-items: center; gap: 8px; text-align: center; }
.tf-setup img { width: 200px; height: 200px; border-radius: 12px; background: #fff; padding: 8px; border: 1px solid var(--border); }
.tf-secret { font-size: 12px; letter-spacing: .3px; word-break: break-all; user-select: all; }

/* Каркас: меню слева, шапка с поиском и рабочая область справа */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 12px; color: var(--muted); }
nav { display: grid; gap: 1px; }
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
nav a svg { flex-shrink: 0; stroke: currentColor; opacity: .85; }
nav a .label { flex-grow: 1; }
nav a:hover { background: var(--muted-tint); color: var(--text); }
nav a.active { background: var(--accent-tint); color: var(--accent-text); font-weight: 600; }
nav .count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ececef;
  color: var(--nav-text);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
nav .count.alarm { background: #e5484d; color: #fff; }
nav .group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 2px; border-top: 1px solid var(--border-soft); }
.me-avatar { width: 30px; height: 30px; border-radius: 15px; flex-shrink: 0; background: var(--accent-tint); color: var(--accent-text); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.me-text { flex-grow: 1; min-width: 0; }
#me-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#me-role { font-size: 12px; }
#logout { width: 30px; height: 30px; padding: 0; flex-shrink: 0; }
.role-select { flex-wrap: nowrap; justify-content: flex-end; }
.role-select select { width: auto; height: 32px; }
.role-select .btn { height: 32px; padding: 0 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.header { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topsearch { position: relative; flex: 1 1 320px; max-width: 520px; }
.topsearch svg { position: absolute; left: 12px; top: 10px; stroke: var(--muted); pointer-events: none; }
.topsearch input { padding-left: 36px; padding-right: 44px; background: var(--bg); border-color: var(--border); }
.topsearch .kbd { position: absolute; right: 10px; top: 8px; color: var(--muted); background: var(--panel); opacity: 1; border-color: var(--border-strong); pointer-events: none; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px 28px 40px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; min-height: 36px; }
.topbar h1 .crumb { text-decoration: none; font-size: 15px; font-weight: 500; color: var(--muted); margin-right: 6px; letter-spacing: 0; }
.topbar h1 .crumb:hover { color: var(--text); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input { width: auto; }
.toolbar select { appearance: none; -webkit-appearance: none; padding: 0 32px 0 14px; font-weight: 500; cursor: pointer; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%236b6b76'/%3E%3C/svg%3E") no-repeat right 12px center; }

/* Сегменты «Сегодня · 7 дней · 30 дней» и переключатели очередей */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: #ececef; border-radius: 10px; flex-wrap: wrap; }
.segmented a, .segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: #52525b; font: 500 13px Inter, sans-serif; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.segmented a.active, .segmented button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 16, 20, .12); }
.segmented .n { font-size: 12px; color: var(--muted); }

.filters select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  padding: 0 28px 0 12px;
  text-align: left;
  cursor: pointer;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%236b6b76'/%3E%3C/svg%3E") no-repeat right 12px center;
}
select.unset { color: var(--muted); }
.filters .range { color: var(--muted); font-size: 14px; white-space: nowrap; }
.filters label.range input { width: 52px; padding: 0 4px; text-align: center; -moz-appearance: textfield; }
.filters label.range input::-webkit-inner-spin-button { -webkit-appearance: none; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--ok-tint); color: var(--ok); margin: 0 0 16px; font-weight: 500; }
.flash.bad { background: var(--danger-tint); color: var(--danger); }

.list { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > select { width: auto; }
.row > input { width: auto; flex: 1 1 220px; min-width: 0; }
.row > input.narrow { flex: 0 0 110px; width: 110px; }
.row > input.toggle { flex: 0 0 auto; width: 46px; }
.row > form.row { flex: 1 1 360px; flex-wrap: nowrap; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.stack.tight { gap: 2px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* Вкладки-«пилюли» внутри карточек */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #52525b;
  text-decoration: none;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--muted-tint); }
.tab.active { background: var(--accent-tint); color: var(--accent-text); }

.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo {
  width: 160px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background: var(--tile);
  border: 1px solid var(--border);
  display: block;
}
.photo.big { width: 220px; }
.figure { margin: 0; }
.photo-caption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.gesture-task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--gold-tint); border: 1px solid #f3d9a8; }
.gesture-emoji { font-size: 30px; line-height: 1; }
.gesture-text { display: flex; flex-direction: column; gap: 2px; }
.gesture-label { font-size: 12px; color: var(--gold); font-weight: 600; }
.gesture-title { font-size: 16px; font-weight: 600; }
.photos.with-gesture .figure:first-child .photo { border: 2px solid #e0a43a; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--muted-tint);
  color: #52525b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.bad { background: var(--danger-tint); color: var(--danger); }
.chip.warn, .chip.gold { background: var(--gold-tint); color: var(--gold); }
.chip.good { background: var(--ok-tint); color: var(--ok); }
.chip.accent, .chip.info { background: var(--accent-tint); color: var(--accent-text); }
.chip .dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.chip.segmented { background: #ececef; height: auto; padding: 3px; gap: 2px; border-radius: 10px; }
.chip.segmented a { color: #52525b; text-decoration: none; padding: 4px 10px; border-radius: 8px; font-weight: 500; }
.chip.segmented a.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 16, 20, .12); }

.quote { border-left: 3px solid var(--border-strong); padding: 4px 12px; margin: 0; white-space: pre-wrap; word-break: break-word; color: #3f3f46; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td pre { margin: 0; font: 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
tr.selected td { background: var(--row-selected); }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border-soft); flex-wrap: wrap; }

.person { display: flex; align-items: center; gap: 10px; }
.person a { color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.person a:hover { color: var(--accent-text); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  flex-shrink: 0;
  background: var(--accent-tint);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 64px; height: 64px; border-radius: 32px; font-size: 22px; }

.inline-form { display: grid; gap: 10px; margin-top: 10px; }
.inline-form .row > * { flex: 1; }
.inline-form .row > .btn { flex: 0 0 auto; }

/* Пользователи и анкеты */
.filters > input:not([type]) { flex: 0 1 340px; }
.filters .narrow { width: 110px; flex: 0 0 110px; }
.filters label.row { flex-wrap: nowrap; white-space: nowrap; height: 36px; padding: 0 0 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel); gap: 6px; font-size: 14px; }
.filters label.row input { width: auto; border: 0; height: 34px; background: transparent; box-shadow: none; }
.search { position: relative; flex: 0 1 340px; }
.search svg { position: absolute; left: 12px; top: 10px; stroke: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.profile-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.profile-tile { display: grid; gap: 6px; color: var(--text); text-decoration: none; padding: 12px; }
.profile-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-pop); }
.profile-tile .photo { width: 100%; }
.photo.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.fields { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.field { display: grid; gap: 2px; }
.media { width: 220px; align-content: start; }
.media form.row { flex-wrap: wrap; }
.danger-zone { border-top: 1px solid var(--border); padding-top: 12px; }

/* Список пользователей: таблица и «Быстрый просмотр» справа; полоса массовых действий над таблицей */
.users-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.users-layout > .list { flex: 999 1 640px; min-width: 0; }
.quick { flex: 1 1 300px; min-width: 0; position: sticky; top: 80px; display: grid; gap: 14px; }
.quick-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.quick-photos .photo, .quick-photos img { width: 100%; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-actions .wide { grid-column: span 2; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.bulkbar strong { font-size: 13px; margin-right: 6px; }
.bulkbar .btn { height: 30px; background: #2b2b31; border-color: #3a3a42; color: #fff; font-size: 13px; }
.bulkbar .btn:hover { background: #3a3a42; }
.bulkbar .btn.danger { color: #ff9b94; }
.bulkbar .clear { margin-left: auto; background: none; border: 0; color: #c9c9d1; font: 500 13px Inter, sans-serif; cursor: pointer; }
.bulkbar form { display: flex; gap: 8px; flex: 1 1 100%; }
.bulkbar form input { height: 30px; background: #fff; }

/* Карточка пользователя: шапка с действиями и вкладки разделов */
.user-header { margin: -24px -28px 20px; padding: 18px 28px 0; background: var(--panel); border-bottom: 1px solid var(--border); display: grid; gap: 14px; }
.user-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.user-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.user-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.user-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; position: relative; }
.utabs { display: flex; overflow-x: auto; gap: 22px; }
.utab { padding: 10px 0 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: #52525b; font: 500 14px Inter, sans-serif; cursor: pointer; white-space: nowrap; }
.utab:hover { color: var(--text); }
.utab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.utab .n { color: var(--muted); font-weight: 500; margin-left: 4px; }
.user-body { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.user-body > .user-main { flex: 999 1 600px; min-width: 0; display: grid; gap: 16px; }
.user-body > .user-side { flex: 1 1 300px; min-width: 0; display: grid; gap: 16px; }
.menu { position: absolute; right: 0; top: 42px; z-index: 6; min-width: 240px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; display: grid; gap: 1px; }
.menu button { text-align: left; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font: 500 14px Inter, sans-serif; color: var(--text); cursor: pointer; }
.menu button:hover { background: var(--muted-tint); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border-soft); margin: 4px 0; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); flex-shrink: 0; }
.kv > span:last-child { text-align: right; overflow-wrap: anywhere; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-grid .btn.active { border-color: var(--accent); }
.action-panel { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); display: grid; gap: 10px; }
.card .action-panel { margin-top: 12px; }
.tile { width: 96px; height: 128px; border-radius: 10px; overflow: hidden; background: var(--tile); border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; border-radius: 0; }
.tile figure { height: 100%; }
.tile-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 4px 6px; text-align: center; font-size: 11.5px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(16, 16, 20, 0.75)); }
.tile-caption.gold { color: #ffd38a; }
.tile-caption.ok { color: #a6f0c0; }
.tile-caption.accent { color: #c9cff7; }
.tile-caption.bad { color: #ffb3ad; }
.tile-wrap { display: grid; gap: 6px; justify-items: center; width: 96px; }
.tile-wrap .link { font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }
.tile-wrap .link:hover { color: var(--danger); }
.notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--gold-tint); color: #6b3d00; font-size: 14px; }

/* Анкета глазами других — окно поверх карточки. */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(16, 16, 20, 0.45); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.preview { width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); box-shadow: var(--shadow-pop); }
.preview .flash { margin: 0; }
.preview-photo { position: relative; border-radius: 12px; overflow: hidden; }
.preview-photo .photo, .preview-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border: 0; border-radius: 0; display: block; }
.preview-photo figure { margin: 0; }
.preview-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 14px; color: #fff; background: linear-gradient(transparent, rgba(16, 16, 20, 0.85)); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.preview-name .muted { flex-basis: 100%; color: #d4d4da; }

/* Настройки: карточки в две колонки, строка — название и подсказка слева, значение справа. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.setting { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.setting:last-child { border-bottom: 0; }
.setting-text { flex: 1 1 220px; gap: 3px; }
.setting-text strong { font-size: 14px; font-weight: 500; }
.setting-text .small { color: var(--muted); }
.setting-control { flex: 0 0 auto; justify-content: flex-end; flex-wrap: nowrap; }
.setting-control input:not([type]) { width: 220px; }
.setting-editor { flex: 1 1 100%; }
.number { display: inline-flex; align-items: center; gap: 6px; }
.number input { width: 72px; min-width: 72px; text-align: right; height: 34px; }
.number .unit { font-size: 13px; color: var(--muted); min-width: 44px; white-space: nowrap; }
.setting-control .number input { width: 84px; }
.setting.dirty .setting-text strong::after { content: ' •'; color: var(--accent); }

.toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: #d4d4da;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(16px); }

.city-list { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-remove { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 6px; font-size: 14px; line-height: 1; }
.legal-text { width: 100%; font-family: inherit; font-size: 13px; line-height: 1.5; resize: vertical; }

/* Сводка */
.dashboard { gap: 16px; }
.waiting { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.waiting a { padding: 16px 18px; text-decoration: none; color: var(--text); display: grid; gap: 6px; align-content: start; border-right: 1px solid var(--border-soft); border-top: 1px solid var(--border-soft); }
.waiting a:hover { background: var(--panel-2); }
.waiting .label { font-size: 13px; color: #52525b; }
.waiting .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.waiting .chip { justify-self: start; }
.waiting-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; gap: 12px; flex-wrap: wrap; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.kpi .muted:first-child { font-size: 13px; color: #52525b; }
.kpi-note { font-size: 13px; color: var(--ok); margin-top: 4px; }
.kpi-note.neutral { color: var(--muted); }
.kpi-note.bad, .queue .bad { color: var(--danger); }
.dash-row { display: flex; gap: 16px; flex-wrap: wrap; }
.dash-row .grow { flex: 2 1 420px; min-width: 0; }
.dash-row .side { flex: 1 1 300px; min-width: 0; }
.bars { height: 200px; display: flex; align-items: flex-end; gap: 6px; border-bottom: 1px solid var(--border); }
.bar { flex: 1; background: #c9cff7; border-radius: 4px 4px 0 0; }
.bar:last-child, .bar:hover { background: var(--accent); }
.bars-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; }
.queue { display: grid; }
.queue a { display: flex; justify-content: space-between; align-items: center; height: 40px; border-bottom: 1px solid var(--border-soft); color: var(--text); text-decoration: none; font-size: 14px; }
.queue strong { font-weight: 600; }
.funnel { display: flex; gap: 10px; flex-wrap: wrap; }
.funnel-step { flex: 1 1 120px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.funnel-step > .muted:first-child { font-size: 12.5px; }
.funnel-step strong { font-size: 20px; font-weight: 700; margin-top: 2px; }
.shares { display: grid; gap: 12px; }
.share { display: grid; grid-template-columns: 110px minmax(60px, 1fr) auto; gap: 12px; align-items: center; font-size: 13.5px; }
.share > span:last-child { color: var(--muted); text-align: right; min-width: 36px; }
.share-track { height: 8px; border-radius: 4px; background: var(--muted-tint); overflow: hidden; }
.share-fill { height: 100%; border-radius: 4px; background: var(--accent); }

/* Очереди проверки: одна вещь на экране, решения с клавиатуры */
.review { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; }
.review-context { flex: 1 1 260px; min-width: 0; display: grid; gap: 12px; align-content: start; }
.review-context .photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.review-context .photos .photo { width: 100%; }
.review-stage { flex: 3 1 520px; min-width: 0; display: grid; gap: 12px; grid-template-rows: auto 1fr auto; }
.stage { min-height: 520px; border-radius: 12px; background: #1d1d22; display: flex; align-items: center; justify-content: center; padding: 16px; gap: 12px; flex-wrap: wrap; }
.stage .photo, .stage img, .stage video { min-width: min(360px, 100%); object-fit: contain; width: auto; max-width: 100%; max-height: 640px; height: auto; aspect-ratio: auto; border: 0; border-radius: 8px; background: none; }
.stage .figure { display: grid; justify-items: center; }
.stage .photo-caption { color: #c9c9d1; }
.stage-text { background: var(--panel); color: var(--text); border-radius: 12px; padding: 20px; max-width: 560px; font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.filmstrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.filmstrip button { flex: none; width: 54px; height: 68px; border-radius: 8px; border: 0; padding: 0; background: var(--tile); color: var(--muted); font: 600 12px Inter, sans-serif; cursor: pointer; overflow: hidden; }
.filmstrip button.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.filmstrip button img { width: 100%; height: 100%; object-fit: cover; }
.review-actions { flex: 1 1 280px; min-width: 0; display: grid; gap: 10px; align-content: start; }
.review-actions .approve { height: 52px; font-size: 15px; font-weight: 600; }
.reason { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: 500 14px Inter, sans-serif; cursor: pointer; text-align: left; }
.reason:hover { border-color: var(--danger-line); background: #fffafa; }
.reason .kbd { color: var(--danger); }
.progress { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: #52525b; }
.progress-bar { width: 140px; height: 6px; border-radius: 3px; background: #ececef; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }

/* Жалобы: входящие слева, разбор справа */
.inbox { display: flex; flex-wrap: wrap; padding: 0; overflow: hidden; min-height: 640px; }
.inbox-list { flex: 1 1 320px; min-width: 0; border-right: 1px solid var(--border-soft); max-height: calc(100vh - 200px); overflow-y: auto; }
.inbox-item { display: grid; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); text-decoration: none; color: var(--text); cursor: pointer; }
.inbox-item:hover { background: var(--panel-2); }
.inbox-item.active { background: var(--row-selected); box-shadow: inset 3px 0 0 var(--accent); }
.inbox-item .title { font-weight: 600; }
.inbox-item .excerpt { font-size: 13px; color: #52525b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-detail { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; }
.inbox-detail > .head { padding: 16px 22px; border-bottom: 1px solid var(--border-soft); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.inbox-detail > .body { padding: 18px 22px; display: grid; gap: 14px; flex: 1; align-content: start; }
.inbox-detail > .foot { border-top: 1px solid var(--border-soft); padding: 14px 22px; display: grid; gap: 10px; background: var(--panel-2); }
.report-text { margin: 0; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.evidence { border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; }
.evidence > .head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border-soft); gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.evidence > .body { padding: 14px; }

/* Удалённые аккаунты и переписка */
.notice-gold { padding: 12px 16px; border-radius: 12px; background: var(--gold-tint); border: 1px solid #f3d9a8; color: #6b3d00; font-size: 13.5px; line-height: 1.45; }
.gold { color: var(--gold); }
.deleted-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-pane { display: grid; grid-template-columns: 260px minmax(0, 1fr); padding: 0; overflow: hidden; min-height: 520px; }
.chat-list { border-right: 1px solid var(--border-soft); padding: 10px; display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.chat-list h3 { padding: 6px 10px 8px; }
.chat-link { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.chat-link:hover { background: var(--panel-2); }
.chat-link.active { background: var(--row-selected); }
.chat-messages { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; background: #fcfcfd; }
.bubble { align-self: flex-start; max-width: 72%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--panel); border: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble.mine .muted { color: #c9cff7; }
.bubble.flagged { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.bubble .photo { width: 200px; border: 0; }
.chat-pane.framed { border: 1px solid var(--border); border-radius: 14px; }
.chip-button { border: 1px solid var(--border-strong); background: var(--panel); color: var(--nav-text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip-button:hover { background: var(--panel-2); }
.chip-button.active { background: var(--ink); border-color: var(--ink); color: #fff; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .quick { position: static; }
}

@media (max-width: 900px) {
  .deleted-layout, .chat-pane { grid-template-columns: 1fr; }
  .chat-list { border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--border-soft); max-height: 320px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; }
  .brand { padding-bottom: 8px; }
  nav { grid-auto-flow: column; overflow-x: auto; }
  nav .group { display: none; }
  .me { margin-top: 8px; }
  .header { padding: 10px 16px; position: static; }
  .content { padding: 16px; }
  .user-header { margin: -16px -16px 16px; padding: 14px 16px 0; }
  h1 { font-size: 21px; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .setting-control { flex-wrap: wrap; }
  .setting-control input:not([type]) { width: 100%; }
  .search, .filters > input:not([type]) { flex: 1 1 100%; }
  .action-grid, .quick-actions { grid-template-columns: minmax(0, 1fr); }
  .quick-actions .wide { grid-column: auto; }
  .photo, .photo.big { width: 44vw; }
  .stage { min-height: 320px; }
}

/* Карта (Leaflet) */
.map { width: 100%; background: var(--tile); position: relative; z-index: 0; isolation: isolate; }
.card .map { border-radius: 10px; }
.card.flush .map { border-radius: 0; }
.legend { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.leaflet-container { font: 13px/1.4 'Inter', system-ui, sans-serif; }
