/* Страницы юридических документов AiGenda в стиле платформы Phoenix.
   Токены из AiGenda Brand (colors/tokens.css, ui/phoenix/source): тёмная тема переопределяет токены, правила не трогает.
   Явный выбор темы: <html data-theme="light|dark">, иначе как в системе. */
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Onest"; src: url("fonts/onest-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Onest"; src: url("fonts/onest-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Onest"; src: url("fonts/onest-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --primary: #5B66E5;
  --primary-hover: #4C57D6;
  --primary-ink: #4650C8;
  --bg: #F4F4F7;
  --surface: #FFFFFF;
  --sunk: #F1F1F5;
  --line: #E4E4EB;
  --ink: #121318;
  --ink-2: #50515E;
  --hover-2: rgba(18, 19, 40, 0.06);
  --sheet-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(18, 19, 40, 0.04);
  --seg-on: 0 1px 2px rgba(0, 0, 0, 0.08);
  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Onest", "Helvetica Neue", Arial, system-ui, sans-serif;
  --gap: 8px;
  --top-h: 64px;
  --t-fast: .16s;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-hover: #6A74EC; --primary-ink: #AEB4FF;
    --bg: #0E0E12; --surface: #17171D; --sunk: #22222B; --line: #2A2A34;
    --ink: #EEEEF3; --ink-2: #ABACB8; --hover-2: rgba(255, 255, 255, 0.06);
    --sheet-shadow: 0 0 0 1px var(--line); --seg-on: 0 0 0 1px var(--line);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo-light, :root:not([data-theme="light"]) .i-moon { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
  :root:not([data-theme="light"]) .i-sun { display: block; }
}
:root[data-theme="dark"] {
  --primary-hover: #6A74EC; --primary-ink: #AEB4FF;
  --bg: #0E0E12; --surface: #17171D; --sunk: #22222B; --line: #2A2A34;
  --ink: #EEEEF3; --ink-2: #ABACB8; --hover-2: rgba(255, 255, 255, 0.06);
  --sheet-shadow: 0 0 0 1px var(--line); --seg-on: 0 0 0 1px var(--line);
  color-scheme: dark;
}
:root[data-theme="dark"] .logo-light, :root[data-theme="dark"] .i-moon { display: none; }
:root[data-theme="dark"] .logo-dark, :root[data-theme="dark"] .i-sun { display: block; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.65 var(--f-body);
}

/* Верхняя полоса как в Phoenix: плашка на фоне, прилипает при прокрутке.
   Обёртка с цветом фона закрывает зазор над плашкой, чтобы текст не просвечивал. */
.topwrap { position: sticky; top: 0; z-index: 10; padding: var(--gap); background: var(--bg); }
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--top-h);
  margin: 0;
  padding: 0 12px 0 18px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--sheet-shadow);
}
.brand { display: flex; align-items: center; border-radius: 8px; text-decoration: none; }
.logo { height: 22px; width: auto; display: block; }
.logo-dark, .mark, .i-sun { display: none; }
.tb-sep { width: 1px; height: 22px; margin: 0 6px; background: var(--line); }
.tb-section { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.sp { flex: 1; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sunk); }
.seg a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.seg a:hover { color: var(--ink); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--seg-on); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--hover-2); color: var(--ink); }
.icon-btn svg { display: block; }
.icon-btn .i-sun { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 10px;
  font: 500 14px/1 var(--f-body); white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast);
}
.btn.primary { background: var(--primary); color: #FFFFFF; }
.btn.primary:hover { background: var(--primary-hover); }

/* Лист контента и колонка текста. */
.sheet {
  margin: 0 var(--gap) var(--gap);
  min-height: calc(100vh - var(--top-h) - var(--gap) * 3);
  padding: 56px 24px 88px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--sheet-shadow);
}
.doc { max-width: 760px; margin: 0 auto; }
h1, h2 { font-family: var(--f-display); font-weight: 500; letter-spacing: -0.015em; word-spacing: 0.1em; }
h1 { font-size: 26px; line-height: 1.22; margin: 0 0 10px; }
h1 + p { color: var(--ink-2); font-size: 13.5px; margin-bottom: 36px; }
h2 { font-size: 17px; line-height: 1.4; margin: 40px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 28px 0 8px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li { margin-bottom: 6px; }
strong { font-weight: 600; }
a { color: var(--primary-ink); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); overflow-wrap: anywhere; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Широкая таблица скроллится внутри своего блока. */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 22px;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line);
}
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--sunk); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td + td, th + th { border-left: 1px solid var(--line); }

@media (max-width: 720px) {
  .topbar { height: 56px; padding: 0 8px 0 14px; gap: 6px; }
  .tb-sep, .tb-section { display: none; }
  .sheet { min-height: 0; padding: 28px 16px 48px; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; margin-top: 32px; }
}
@media (max-width: 420px) {
  .logo, .logo-light, .logo-dark { display: none !important; }
  .mark { display: block; height: 24px; width: 24px; }
  .btn { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media print {
  body { background: #FFFFFF; color: #000000; }
  .topwrap { display: none; }
  .sheet { margin: 0; padding: 0; box-shadow: none; min-height: 0; }
  a { color: inherit; }
}
