/* Кабинет ресторана «Как вас видят ИИ».
   Палитра и шрифты — как в демо-кабинете 04-demo-13 (Cormorant Garamond и Rubik,
   если они есть в системе; иначе системные). Шрифты не грузим из сети.
   Без инлайновых стилей: страницы отдаются с Content-Security-Policy style-src 'self'. */
:root {
  --bg: #F5F1E8;
  --surface: #FBF9F4;
  --surface-2: #EFE8DA;
  --surface-3: #E6DDCB;
  --ink: #17221C;
  --ink-2: #4F5D54;
  --ink-3: #667069;
  --line: #E2D9C6;
  --accent: #A84320;
  --accent-soft: rgba(168, 67, 32, 0.10);
  --good: #2F5D46;
  --good-soft: rgba(47, 93, 70, 0.11);
  --warn: #946312;
  --warn-soft: rgba(148, 99, 18, 0.12);
  --info: #245A86;
  --info-soft: rgba(36, 90, 134, 0.10);
  --header: #17221C;
  --on-header: #F5F1E8;
  --on-accent: #FBF9F4;
  --f-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --f-text: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --f-cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --side-w: 220px;
  --pad: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111814; --surface: #18221C; --surface-2: #202C25; --surface-3: #2A382F;
    --ink: #ECE7DB; --ink-2: #AEB8B1; --ink-3: #94A099; --line: #2D3A32;
    --accent: #E0805A; --accent-soft: rgba(224, 128, 90, 0.16);
    --good: #74B592; --good-soft: rgba(116, 181, 146, 0.15);
    --warn: #DDB05A; --warn-soft: rgba(221, 176, 90, 0.15);
    --info: #86B4E0; --info-soft: rgba(134, 180, 224, 0.15);
    --header: #0B100D; --on-header: #ECE7DB; --on-accent: #111814;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--f-text);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
[lang="zh"] { font-family: var(--f-text), var(--f-cjk); }
[lang="ar"] { direction: rtl; text-align: right; unicode-bidi: plaintext; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.15; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: 13px; }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── шапка ───────── */
.bar {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 10px var(--pad); background: var(--header); color: var(--on-header);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: inherit; text-decoration: none; white-space: nowrap; }
.logo__mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; flex: none; }
.logo__mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bar__client { font-family: var(--f-display); font-size: 20px; font-weight: 600; }
.bar__sp { flex: 1; }
.bar__user { font-size: 14px; opacity: 0.85; }
.bar form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.bar select { background: transparent; color: var(--on-header); border: 1px solid color-mix(in srgb, var(--on-header) 40%, transparent); border-radius: var(--r-sm); padding: 4px 6px; max-width: 180px; }
.bar select option { color: #17221C; }
.bar__ghost {
  font-size: 14px; padding: 5px 12px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--on-header) 40%, transparent); background: transparent; color: var(--on-header);
}
.bar__ghost:hover { background: color-mix(in srgb, var(--on-header) 12%, transparent); }
.preview { background: var(--warn-soft); color: var(--warn); padding: 8px var(--pad); font-size: 14px; }

/* ───────── каркас ───────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - 52px); }
.side {
  background: var(--surface-2); border-right: 1px solid var(--line); padding: 14px 0; display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
}
.side__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 20px; color: var(--ink); text-decoration: none; font-size: 15px;
  border-left: 3px solid transparent;
}
.side__item:hover { background: var(--surface-3); }
.side__item[aria-current="page"] { background: var(--surface); border-left-color: var(--accent); font-weight: 600; }
.side__badge { font-size: 12px; font-weight: 600; min-width: 22px; text-align: center; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 1px 7px; }
.page { padding: 24px var(--pad) 80px; display: flex; flex-direction: column; gap: 18px; min-width: 0; max-width: 980px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.lead { color: var(--ink-2); max-width: 70ch; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section > h2 { margin-top: 8px; }

/* ───────── карточки ───────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.card--accent { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card--tint { background: var(--surface-2); border-color: transparent; }
.card--off { opacity: 0.75; }
.card__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.card__title { font-size: 16px; font-weight: 600; }
.card__meta { font-size: 13px; color: var(--ink-2); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { text-decoration: none; color: inherit; gap: 4px; }
a.kpi:hover { border-color: var(--ink-3); }
.kpi__label { font-size: 13.5px; color: var(--ink-2); }
.kpi__value { font-size: 34px; line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 13px; color: var(--ink-2); }
.kpi--accent .kpi__value { color: var(--accent); }

/* ───────── строки «что не так / как надо» ───────── */
.rows { display: flex; flex-direction: column; }
.rows__row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 14px; padding: 7px 0; border-top: 1px solid var(--line); }
.rows__row:first-child { border-top: 0; }
.rows__lbl { font-size: 13.5px; color: var(--ink-2); }
.rows__row > span:last-child, .quote__text, .choice span { overflow-wrap: anywhere; }
.now { color: var(--accent); }
.ok { color: var(--good); font-weight: 500; }

/* ───────── чипы, метки ───────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12.5px; line-height: 1.3; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
}
/* long platform names (e.g. several Chinese services in one option) wrap on a phone */
.chips > .chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.chip--ok { background: var(--good-soft); color: var(--good); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--info { background: var(--info-soft); color: var(--info); }
.chip--accent, .chip--high { background: var(--accent); color: var(--on-accent); }
.chip--mid { background: var(--accent-soft); color: var(--accent); }
.chip--low, .chip--muted { background: var(--surface-2); color: var(--ink-3); }
.chip--est { background: transparent; border: 1px dashed var(--warn); color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  font-size: 14px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.filter[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.filter__n { color: var(--ink-3); margin-left: 4px; font-size: 12.5px; }
.filter[aria-current="true"] .filter__n { color: inherit; opacity: 0.8; }

/* ───────── кнопки и формы ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 500;
  text-decoration: none; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn--link { background: var(--info); border-color: var(--info); color: #fff; }
.btn--link:hover { background: color-mix(in srgb, var(--info) 85%, var(--ink)); }
.btn--sm { padding: 5px 10px; font-size: 13.5px; min-height: 32px; }
.btn--ghost { background: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .field__label { font-size: 13.5px; color: var(--ink-2); }
.input, textarea.input, select.input {
  font-size: 15px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; width: 100%; max-width: 100%;
}
textarea.input { min-height: 70px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input--budget { max-width: 200px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--ink-3); font-size: 13px; }
.choices { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.choices legend { font-size: 13.5px; color: var(--ink-2); padding: 0; margin-bottom: 4px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); cursor: pointer; }
.choice input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.choice__where { display: block; font-size: 13px; color: var(--ink-3); }
.inline-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* ───────── раскрывающиеся блоки ───────── */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--ink-3); transition: transform 0.15s; }
details[open] > summary::before { transform: rotate(90deg); }
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 18px; }
.fold > summary { font-weight: 600; font-size: 16px; }
.fold[open] > summary { margin-bottom: 10px; }
.fold__body { display: flex; flex-direction: column; gap: 10px; }
.mini > summary { font-size: 14px; color: var(--info); }
.mini[open] > summary { margin-bottom: 8px; }
.mini__body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-md); }

/* ───────── группы площадок ───────── */
.group { display: flex; flex-direction: column; gap: 10px; }
.group__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 6px; }
.group__head h3 { font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.group__who { font-size: 13.5px; color: var(--ink-2); }
.list-plain > li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.list-plain > li:first-child { border-top: 0; }
.list-plain__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.history { font-size: 13px; color: var(--ink-3); display: flex; flex-direction: column; gap: 2px; }

/* ───────── выноски ───────── */
.callout { display: block; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14.5px; }
.callout--ok { background: var(--good-soft); color: var(--good); }
.callout--error { background: var(--accent-soft); color: var(--accent); }
.callout--accent { background: var(--accent-soft); }
.callout--info { background: var(--info-soft); }
.empty { padding: 18px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 6px; }
.empty__title { font-family: var(--f-display); font-size: 22px; font-weight: 600; color: var(--ink); }

/* ───────── лента изменений ───────── */
.feed > li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.feed > li:first-child { border-top: 0; }
.feed__date { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ───────── ответы ИИ ───────── */
.vis > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.vis > li:first-child { border-top: 0; }
.vis__value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.vis__sub { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); }
.quote { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.quote__q { font-weight: 500; }
.quote__meta { font-size: 13px; color: var(--ink-3); }
.quote__text { white-space: pre-line; }
.quote__more > summary { color: var(--ink); }
.quote__more > summary::before { content: none; }
.quote__toggle { color: var(--info); font-size: 13.5px; white-space: nowrap; }
.quote__toggle--close, .quote__more[open] .quote__toggle--open, .quote__more[open] .quote__excerpt { display: none; }
.quote__more[open] .quote__toggle--close { display: inline; }
.quote__more[open] > summary { margin-bottom: 6px; }
.plan-list > li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.plan-list > li:first-child { border-top: 0; }

/* ───────── реклама ───────── */
.calc { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); }
.calc__form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.calc__rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.calc__cell { background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.calc__cell b { font-size: 16px; font-variant-numeric: tabular-nums; }
.calc__cell span { font-size: 13px; color: var(--ink-2); }

/* ───────── вход ───────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__box { width: min(400px, 100%); }
.login__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 4px; }
.login__brand .logo__mark { color: var(--ink); }

/* ───────── адаптив ───────── */
@media (max-width: 900px) {
  :root { --pad: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side { position: static; height: auto; overflow: visible; }
  .side__item {
    position: relative; flex: 1 1 calc(33.333% - 6px); min-width: 0; justify-content: center; text-align: center;
    padding: 8px 4px; border-left: 0; border-radius: var(--r-sm); font-size: 14px; line-height: 1.25; background: var(--surface);
    border: 1px solid var(--line); hyphens: none;
  }
  .side__item[aria-current="page"] { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
  .side__badge { position: absolute; top: -7px; right: -4px; font-size: 11px; min-width: 18px; padding: 0 5px; white-space: nowrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  h1 { font-size: 28px; }
  .bar { gap: 6px 10px; }
  .bar__user, .logo__text { display: none; }
  .rows__row { grid-template-columns: minmax(0, 1fr); }
  .kpi__value { font-size: 28px; }
  .calc__rows { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px; }
  .fold { padding: 12px 14px; }
  .side__item { font-size: 13px; }
}
@media print {
  .bar, .side, form, .preview { display: none; }
  .app { display: block; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
