/* Админка Booking API. Цвета и шрифты — из макета «Wegosty | Web Design». */
@font-face { font-family: "Berlin Type"; src: url("./fonts/BerlinType-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Berlin Type"; src: url("./fonts/BerlinType-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f7f8f9;
  --hover: #fafbfc;
  --line: #e6e9ec;
  --line-2: #eff1f3;
  --field: #d0d5da;
  --text: #141414;
  --text-2: #434343;
  --muted: #5c5c5c;
  --faint: #8a8a8a;
  --black: #141414;
  --weg: #ff0044;
  --weg-strong: #cc0033;
  --focus: #2f6fdb;
  --ok: #1f6b0f;
  --ok-bg: #e3f5d6;
  --ok-line: #b7e3a0;
  --bad: #a8071a;
  --bad-bg: #fff1f0;
  --bad-line: #ffccc7;
  --warn: #6b4300;
  --warn-bg: #fff7e0;
  --warn-line: #ffe08a;
  --gold: #613400;
  --gold-bg: #fff1b8;
  --info: #0b4cb3;
  --info-bg: #e8f0ff;
  --info-line: #bcd3ff;
  --neutral-bg: #eef1f3;
  --head: "Berlin Type", "Inter", Arial, sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/20px var(--body); font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--head); font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
ol, ul { margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.bad-text { color: var(--bad); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack:empty { display: none; }

/* ---------- Каркас: меню слева, содержимое во всю ширину ---------- */

.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }

/* Меню прилипает и прокручивается само: на низком экране низ меню не обрезается. */
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 20px 12px 12px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--weg); color: #fff; font: 700 16px/1 var(--head); flex: none; }
.brand-text { display: grid; }
.wordmark { font: 700 18px/20px var(--head); letter-spacing: .02em; }
.product { color: var(--muted); font-size: 12px; line-height: 16px; }

.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--black); color: #fff; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px; background: var(--neutral-bg); color: var(--text-2); font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }
.nav-badge:empty { display: none; }
.nav-badge.alert { background: var(--weg-strong); color: #fff; }
.nav a.active .nav-badge:not(.alert) { background: rgba(255, 255, 255, .18); color: #fff; }

.sidebar-foot { margin-top: auto; display: grid; gap: 4px; }
.model-status { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); text-decoration: none; }
.model-status:hover { border-color: var(--field); }
.ms-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; line-height: 16px; }
.ms-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ms-sub { color: var(--muted); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3f8f2f; flex: none; }
.dot.off, .dot.bad { background: var(--weg-strong); }
.foot-link, .logout { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.foot-link svg, .logout svg { width: 18px; height: 18px; flex: none; }
.foot-link .ext { width: 14px; height: 14px; margin-left: auto; }
.foot-link:hover, .logout:hover { background: var(--surface-2); color: var(--text); }
.logout .who { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--faint); font-weight: 400; }

.page { min-width: 0; padding: 20px 24px 64px; }
.page-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; order: 3; flex: 1 1 100%; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .model-status { display: none; }
  .foot-link .foot-label, .foot-link .ext, .logout .who { display: none; }
}
@media (max-width: 720px) {
  .page { padding: 16px 12px 48px; }
}

/* ---------- Заголовки страниц ---------- */

.back { display: inline-flex; align-items: center; gap: 4px; justify-self: start; color: var(--muted); text-decoration: none; font-weight: 500; }
.back:hover { color: var(--text); }
.back svg { width: 18px; height: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 26px; line-height: 32px; }
.page-head .id, .id { color: var(--faint); font-weight: 400; }
.page-sub { margin-top: 6px; max-width: 720px; color: var(--muted); }
.head-meta { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; color: var(--muted); }
.head-meta a { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.head-meta a svg { width: 14px; height: 14px; }
.api-id { display: inline-flex; align-items: center; gap: 6px; }
.api-id code { color: var(--text); }
.copy-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.copy-btn:hover { color: var(--text); background: var(--line); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--black); }
.tabs .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px; background: var(--neutral-bg); color: var(--text-2); font-size: 12px; line-height: 20px; text-align: center; }
.tabs .n.alert { background: var(--weg-strong); color: #fff; }

/* ---------- Карточки ---------- */

.card { min-width: 0; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card.flush { padding: 0; overflow: hidden; }
/* Подпись и ссылка — рядом с заголовком, а не у дальнего края широкой карточки. */
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.card-head h2 { font-size: 18px; line-height: 24px; }
.card-head .hint { color: var(--muted); font-size: 13px; }
.card.flush > .card-head { margin: 0; padding: 16px 20px 12px; }
.card-lead { margin: -6px 0 14px; }
.card.flush > .card-lead.padded { margin: 0 20px 14px; }
.card-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.more-link { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; text-decoration: none; }
.more-link svg { width: 16px; height: 16px; }
.more-link:hover { text-decoration: underline; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; }
.cap { display: grid; gap: 10px; align-content: start; height: 100%; }
.cap-head { display: flex; align-items: center; gap: 12px; }
.cap p { color: var(--text-2); }
.cap .sub { color: var(--muted); }
.cap-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Кнопка — сразу за описанием, а не у правого края карточки. */
.setting-row { display: flex; align-items: flex-start; gap: 16px 24px; padding: 16px 0; border-top: 1px solid var(--line-2); }
.setting-row > div { flex: 0 1 520px; min-width: 0; }
.card-head + .setting-row { padding-top: 0; border-top: 0; }
.setting-row:last-child { padding-bottom: 0; }
.setting-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.setting-row .sub { margin-top: 4px; }
.setting-row > .btn { flex: none; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 24px; max-width: 1100px; }
.fact-label { color: var(--muted); font-size: 12px; line-height: 16px; }
.fact-value { margin-top: 4px; font-weight: 600; font-size: 16px; line-height: 22px; }
.fact-value .sub { display: block; font-weight: 400; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.kv-label { color: var(--muted); padding-top: 6px; }
.kv + .kv { margin-top: 0; }
.params { display: flex; flex-wrap: wrap; gap: 8px; }
.param { display: inline-flex; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.param b { color: var(--text); font-weight: 600; }

/* ---------- Плашки ---------- */

.callout { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; }
.callout > svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.callout-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.callout-title { font-weight: 600; }
.callout-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.callout .go { align-self: center; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }
.callout .go svg { width: 16px; height: 16px; }
.callout > .btn { align-self: center; }
.callout.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.callout.bad > svg, .callout.bad .callout-title { color: var(--bad); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.callout.warn > svg, .callout.warn .callout-title { color: var(--warn); }
.callout.info { background: var(--info-bg); border-color: var(--info-line); }
.callout.info > svg, .callout.info .callout-title { color: var(--info); }
.callout.ok { background: #f2fbec; border-color: var(--ok-line); }
.callout.ok > svg, .callout.ok .callout-title { color: var(--ok); }
.callout.neutral > svg { color: var(--muted); }
a.callout:hover { border-color: currentColor; }
a.callout.bad:hover { border-color: var(--bad); }
.callout a { font-weight: 600; }
.todo { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---------- Значки ---------- */

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 100px; background: var(--neutral-bg); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; vertical-align: middle; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.pill.gold { background: var(--gold-bg); color: var(--gold); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill svg { width: 12px; height: 12px; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pill svg { animation: none; } }

/* ---------- Кнопки ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 100px; border: 1px solid var(--field); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--text); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--black); border-color: var(--black); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #870514; }
.btn.danger-outline { color: var(--bad); border-color: var(--bad-line); }
.btn.danger-outline:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { border-color: var(--field); }
.btn.primary:disabled:hover { background: var(--black); border-color: var(--black); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--text); }

/* ---------- Фильтры ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .spacer { flex: 1 1 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 100px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--field); }
.chip .n { color: var(--muted); }
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }
.chip.active .n { color: #c4c4c4; }
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 280px; min-width: 200px; height: 40px; padding: 0 14px; border-radius: 100px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--focus); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search svg { flex: none; }
.select { height: 40px; max-width: 280px; padding: 0 36px 0 14px; border-radius: 100px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; appearance: none; font-weight: 500; cursor: pointer; }
.select:hover { border-color: var(--field); }

/* ---------- Таблицы ---------- */

/* position: relative — иначе скрытые подписи колонок (absolute) вылезают за прокрутку таблицы и распирают страницу на телефоне. */
.table-wrap { position: relative; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 500; text-align: left; white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .title { font-weight: 600; text-decoration: none; }
.tbl a.title:hover { text-decoration: underline; }
.tbl .sub { display: block; margin-top: 2px; }
.tbl .pill + .sub { margin-top: 6px; }
.tbl tr.link-row { cursor: pointer; }
.tbl tr.link-row:hover td { background: var(--hover); }
.tbl tr.revoked td { color: var(--muted); }
.tbl.compact td { padding-top: 10px; padding-bottom: 10px; }
.chev-col { width: 40px; color: var(--faint); }
.tbl .id-col { width: 64px; color: var(--muted); white-space: nowrap; }
.tbl .id-col .title { color: var(--text); }
.sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.sort:hover { color: var(--text); }
.sort.active { color: var(--text); font-weight: 600; }
.sort-dir { min-width: 10px; }
/* У колонок, по которым можно сортировать, — бледная стрелка: видно, что заголовок нажимается. */
.sort-dir:empty::after { content: '↕'; opacity: .35; }
.chev-col svg { display: block; }
.venue-cell { min-width: 260px; max-width: 460px; }
.sub { color: var(--muted); font-size: 12px; line-height: 16px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; }
.row-alert { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: 13px; line-height: 18px; }
.row-alert svg { flex: none; margin-top: 1px; }
.row-alert.warn { background: var(--warn-bg); color: var(--warn); }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }
.empty { padding: 24px 20px; color: var(--muted); text-align: center; }
.card > .empty, .card-body .empty { padding: 12px 0; text-align: left; }

.pager { display: flex; align-items: center; gap: 4px; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.pg:hover:not(:disabled) { border-color: var(--text); }
.pg.active { background: var(--black); border-color: var(--black); color: #fff; }
.pg:disabled { opacity: .4; cursor: default; }
.pg-gap { padding: 0 4px; }

/* ---------- Формы ---------- */

.form-stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
@media (max-width: 720px) { .form-grid.two { grid-template-columns: minmax(0, 1fr); } }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { font-size: 13px; font-weight: 600; padding: 0; }
.hint { color: var(--muted); font-size: 12px; line-height: 16px; }
.input, .textarea { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface); }
select.input { padding-right: 36px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; text-overflow: ellipsis; }
.textarea { height: auto; min-height: 88px; padding: 12px 14px; line-height: 20px; resize: vertical; }
.input:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input-suffix { position: relative; display: block; }
.input-suffix .input { padding-right: 36px; }
.input-suffix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; max-width: 720px; }
.inline-form .input { flex: 1 1 280px; }

.segmented { display: flex; gap: 8px; }
.segmented label { position: relative; flex: 1 1 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; place-items: center; height: 44px; border-radius: 12px; border: 1px solid var(--field); font-weight: 600; cursor: pointer; }
.segmented input:checked + span { background: var(--black); border-color: var(--black); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.check-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; }
.check-card input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--black); }
.check-card > span { display: grid; gap: 2px; }
.check-card .sub { font-size: 13px; line-height: 18px; }
.check-card.selected { border-color: var(--black); }
.check-card.disabled { background: var(--surface-2); cursor: default; }
.check-card.disabled b { color: var(--muted); }
.radio-list { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.radio-list legend { margin-bottom: 8px; }
.field-group { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.field-group legend { margin-bottom: 8px; }
.note-box { padding: 12px 14px; border-radius: 12px; background: var(--bg); color: var(--text-2); font-size: 13px; line-height: 18px; }
details.more-options summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.more-options[open] summary { margin-bottom: 8px; }

/* ---------- Окна ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; background: rgba(20, 24, 28, .45); }
.modal { width: min(580px, 100%); padding: 28px; border-radius: 20px; background: var(--surface); box-shadow: 0 24px 64px rgba(20, 20, 20, .22); }
.modal.narrow { width: min(460px, 100%); }
.modal > .modal-form, .modal { display: grid; gap: 20px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head h2 { font-size: 22px; line-height: 28px; }
.modal-head .sub { margin-top: 2px; font-size: 14px; line-height: 20px; }
.modal-text { color: var(--text-2); }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.modal-foot .hint { flex: 1 1 200px; }
.modal-foot .buttons { display: flex; gap: 8px; margin-left: auto; }
.modal-foot > a { color: var(--text-2); font-size: 13px; }

/* ---------- Сообщения и подсказки ---------- */

.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: grid; gap: 8px; justify-items: end; }
.toast { max-width: 440px; padding: 12px 16px; border-radius: 12px; background: var(--black); color: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }
.toast.bad { background: var(--bad); }
[data-tip] { cursor: help; }
button[data-tip], a[data-tip], label[data-tip] { cursor: pointer; }
.tip { position: fixed; z-index: 70; max-width: 300px; padding: 8px 12px; border-radius: 10px; background: var(--black); color: #fff; font: 400 12.5px/17px var(--body); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); pointer-events: none; opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }

/* ---------- Нюансы и чат ---------- */

.notes-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .notes-layout { grid-template-columns: minmax(0, 1fr); } }
#notes-list { display: grid; gap: 12px; }
.note { display: grid; gap: 6px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); }
.note.proposed { background: var(--warn-bg); border-color: var(--warn-line); }
.note.off .note-text { color: var(--muted); }
.note-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.note-kind { color: var(--muted); font-size: 12px; font-weight: 600; }
.note-target { color: var(--muted); font-size: 12px; }
.events { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.events li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.note-text { font-weight: 500; }
.note-rule { color: var(--muted); font-size: 13px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.note-actions:empty { display: none; }
.chat-feed { display: grid; gap: 10px; max-height: 440px; overflow-y: auto; padding: 4px 2px; }
.msg { display: grid; gap: 4px; max-width: 88%; }
.msg.operator { justify-self: end; justify-items: end; }
.bubble { padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.operator .bubble { background: var(--black); border-color: var(--black); color: #fff; }
/* Сообщение самого сервиса: самолечение сдалось или форма упёрлась в потолок — нужен человек. */
.msg.service { max-width: 100%; }
.msg.service .bubble { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.msg-meta { color: var(--muted); font-size: 11px; }
.chat-form { display: grid; gap: 8px; margin-top: 12px; }
.chat-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Шаги ---------- */

.timeline, .scn, .events { list-style: none; }
/* Номер, скриншот, описание: скриншот рядом с шагом, а не у правого края. */
.tl-step { display: grid; grid-template-columns: 32px 192px minmax(0, 1fr); gap: 16px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line-2); }
.tl-step:first-child { border-top: 0; padding-top: 0; }
.tl-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--neutral-bg); font-size: 12px; font-weight: 600; }
.tl-num.err { background: var(--bad-bg); color: var(--bad); }
.tl-title { font-weight: 500; overflow-wrap: anywhere; }
.tl-meta { margin-top: 2px; color: var(--muted); font-size: 12px; }
.tl-error { margin-top: 6px; color: var(--bad); font-size: 13px; }
.tl-shot { display: block; width: 192px; height: 120px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.tl-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tl-shot:hover { border-color: var(--text); }
.who { font-weight: 600; }
.who.agent { color: var(--info); }
.who.scenario { color: var(--ok); }
.who.reader { color: var(--gold); }
@media (max-width: 720px) {
  .tl-step { grid-template-columns: 28px minmax(0, 1fr); }
  .tl-shot { grid-column: 2; grid-row: 2; }
}
.scn-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.scn-step:first-child { border-top: 0; }
.scn-what { font-weight: 500; overflow-wrap: anywhere; }
.scn-where { margin-top: 2px; color: var(--muted); font-size: 12px; }
code.tpl { padding: 1px 6px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-size: 12px; }
.events li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.events li:first-child { border-top: 0; }
.e-time { min-width: 72px; color: var(--muted); font-size: 12px; }
details.card.more > summary { display: flex; align-items: center; gap: 8px; font: 700 18px/24px var(--head); cursor: pointer; list-style: none; }
details.card.more > summary::-webkit-details-marker { display: none; }
details.card.more > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
details.card.more[open] > summary::before { transform: rotate(45deg); }
details.card.more[open] > summary { margin-bottom: 16px; }
details.card.more .n { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 100px; background: var(--neutral-bg); font: 600 12px/22px var(--body); text-align: center; }
details.sample summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 4px; }
details.sample pre { max-height: 240px; overflow: auto; margin: 6px 0 0; padding: 10px; border-radius: 8px; background: var(--surface-2); font: 12px/16px var(--mono); white-space: pre-wrap; word-break: break-all; }

/* ---------- Заказ ---------- */

.code-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.code-input { width: 160px; height: 44px; font: 600 18px/1 var(--mono); letter-spacing: .1em; }
/* Цена и кнопка рядом с названием варианта, а не через весь экран. */
.rooms { display: grid; gap: 8px; max-width: 980px; }
.room { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); }
.room-name { font-weight: 500; }
.room-price { font-weight: 600; white-space: nowrap; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { min-width: 72px; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); font-weight: 600; cursor: pointer; }
.slot:hover { border-color: var(--text); }
details.more-rooms { margin-top: 8px; }
details.more-rooms summary { padding: 8px 0; cursor: pointer; font-weight: 600; }
details.more-rooms[open] summary { margin-bottom: 8px; }
.venue-name { max-width: 200px; }

/* ---------- Статистика ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi { padding: 16px 20px; border-left: 1px solid var(--line-2); }
.kpi:first-child { border-left: 0; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { margin-top: 8px; font: 700 28px/32px var(--head); }
.kpi-value small { font: 400 14px/1 var(--body); color: var(--muted); }
.kpi-note { margin-top: 6px; color: var(--muted); font-size: 12px; }
.bars { display: grid; gap: 14px; max-width: 1000px; }
.bar-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr) 96px; gap: 16px; align-items: center; }
.bar-label { display: grid; font-weight: 500; }
.bar-track { height: 8px; border-radius: 100px; background: var(--line-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--black); }
.bar-value { display: grid; justify-items: end; font-weight: 600; white-space: nowrap; }
@media (max-width: 720px) { .bar-row { grid-template-columns: minmax(0, 1fr) 96px; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Настройки ---------- */

/* Формы настроек — узкими колонками слева: подпись и поле рядом, а не по разным краям широкого экрана. */
.narrow-page { max-width: 1280px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 480px); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .settings-grid { grid-template-columns: minmax(0, 680px); } }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.change-list { display: grid; gap: 6px; padding: 12px 14px 12px 32px; border-radius: 12px; background: var(--bg); }
.issued-key { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: #f2fbec; border: 1px solid var(--ok-line); }
.issued-key > div { flex: 1 1 100%; }
.key-value { flex: 1 1 320px; padding: 8px 10px; border-radius: 8px; background: var(--surface); font-size: 13px; word-break: break-all; user-select: all; }
.points { display: grid; gap: 2px; padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 18px; }
.sms-code { font: 600 15px/1 var(--mono); }

/* ---------- Вход ---------- */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; display: grid; gap: 24px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.login-card { padding: 28px; display: grid; gap: 16px; }
.login-card h1 { font-size: 24px; line-height: 28px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login-card input { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--field); font-weight: 400; }
.login-card input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.login-card .btn { width: 100%; margin-top: 4px; }
.error-text { margin: 0; min-height: 18px; color: var(--bad); }

/* ---------- Просмотр скриншотов ---------- */

.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #111315; color: #fff; }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.lb-caption { min-width: 0; }
.lb-count { color: rgba(255, 255, 255, .65); font-size: 12px; line-height: 16px; }
.lb-title { font-size: 16px; line-height: 22px; font-weight: 600; overflow-wrap: anywhere; }
.lb-tools { display: flex; gap: 8px; flex: none; }
.lb-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn svg { width: 18px; height: 18px; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 84px 24px; cursor: zoom-out; }
.lb-img { display: block; max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 0 24px 64px rgba(0, 0, 0, .5); cursor: default; }
.lb-empty { color: rgba(255, 255, 255, .7); }
.lb-nav { position: absolute; top: 50%; display: grid; place-items: center; width: 52px; height: 52px; margin-top: -26px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.lb-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .26); }
.lb-nav:disabled { opacity: .2; cursor: default; }
.lb-nav svg { width: 24px; height: 24px; }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.tl-shot { cursor: zoom-in; }
@media (max-width: 720px) {
  .lb-stage { padding: 0 12px 80px; }
  .lb-nav { top: auto; bottom: 16px; margin-top: 0; }
}

/* ---------- Вызов модели: вход и выход ---------- */

.modal.wide { width: min(1480px, 96vw); height: min(92vh, 1100px); padding: 0; gap: 0; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.modal.wide > .empty { padding: 48px 24px; }
.modal.wide .modal-head { padding: 20px 24px 12px; }
.modal.wide .head-actions { flex-wrap: nowrap; }
.llm-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 0 24px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.llm-facts b { color: var(--text); font-weight: 600; }
.llm-facts a { color: var(--text); font-weight: 600; }
.llm-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); min-height: 0; }
.llm-col { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 16px 24px 24px; }
.llm-col + .llm-col { border-left: 1px solid var(--line); background: var(--surface-2); }
.llm-col h3 { display: flex; align-items: baseline; gap: 10px; font: 700 16px/22px var(--head); }
.llm-msg { display: grid; gap: 6px; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); }
.llm-msg.system { background: #fbfbfc; }
.llm-msg.assistant { border-color: var(--info-line); }
.llm-msg.tool { background: var(--surface-2); }
.llm-msg.reasoning { background: var(--warn-bg); border-color: var(--warn-line); }
.llm-role { color: var(--muted); font-size: 12px; font-weight: 600; }
.msg-text { margin: 0; font: 14px/20px var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text.code { font: 12.5px/18px var(--mono); }
.llm-jump { margin-left: auto; }
.llm-msg.last { scroll-margin-top: 8px; }
.msg-text.tall { max-height: 460px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--surface-2); }
.msg-more > summary { cursor: pointer; color: var(--info); font-size: 13px; font-weight: 600; }
.msg-more[open] > summary { margin-bottom: 8px; }
.llm-tools { padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line); }
.llm-tool { display: grid; gap: 4px; }
.llm-tool-name { color: var(--info); font: 600 13px/18px var(--mono); }
@media (max-width: 900px) {
  .modal.wide { height: 94vh; grid-template-rows: auto auto minmax(0, 1fr); }
  .llm-cols { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .llm-col { overflow: visible; }
  .llm-col + .llm-col { border-left: 0; border-top: 1px solid var(--line); }
}

/* Варианты по позициям: услуга, под ней её время */
.item-group + .item-group { margin-top: 14px; }
.item-group .slots { margin-top: 6px; }
.note-box ul { margin: 6px 0; padding-left: 18px; }
.chat-row .attach { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chat-row .chat-file { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file { display: block; margin-top: 6px; font-size: 12.5px; opacity: .8; }
.note-facts { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }

/* Раздел параметров работы в настройках: самолечение, кэш. */
.tune-group { margin-top: 6px; font: 700 15px/20px var(--head); }
