/* Локальный файл, а не CDN: страница целиком обслуживается тем же nginx.
   Шрифты — системные стеки, поэтому веб-шрифты грузить не нужно вообще. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
          Arial, 'Noto Sans', 'PT Sans', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --panel: #ffffff;
  --border: #e4e6ee;
  --border-strong: #d2d5e2;
  --text: #171a24;
  --text-muted: #5c6377;
  --text-faint: #666d80;
  --primary: #6c5ce7;
  --warning: #f59e0b;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0e1016;
    --bg-soft: #131620;
    --panel: #161a24;
    --border: #262b39;
    --border-strong: #333949;
    --text: #eceef5;
    --text-muted: #a3aabd;
    --text-faint: #868da3;
    --primary: #8b7cf8;
  }
}

/* Ручной выбор должен побеждать системную тему в обе стороны. */
:root[data-theme="dark"] {
  --bg: #0e1016;
  --bg-soft: #131620;
  --panel: #161a24;
  --border: #262b39;
  --border-strong: #333949;
  --text: #eceef5;
  --text-muted: #a3aabd;
  --text-faint: #868da3;
  --primary: #8b7cf8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--primary); }

.wrap { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 1.25rem; }

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.02em;
}
.nav .back {
  margin-left: auto;
  font-size: .9rem;
  color: var(--text-muted);
  text-decoration: none;
}
.nav .back:hover { color: var(--primary); }
.theme-toggle {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--primary); }

:where(a, button, summary):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

main { padding: 2.5rem 0 4rem; }

h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 .4rem;
}
.meta { color: var(--text-faint); font-size: .86rem; margin: 0 0 2rem; }

h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 2.4rem 0 .7rem;
  letter-spacing: -.01em;
}
h3 { font-size: 1rem; margin: 1.6rem 0 .5rem; }

p, li { color: var(--text-muted); }
p { margin: 0 0 1rem; }
ol, ul { margin: 0 0 1rem; padding-left: 1.5rem; }
li { margin-bottom: .4rem; }
strong, b { color: var(--text); }

code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .05em .35em;
}

/* Незаполненные реквизиты видны сразу — документ нельзя случайно принять
   за готовый к публикации. */
.ph {
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  border-bottom: 1px dashed var(--warning);
  color: var(--text);
  font-weight: 600;
  padding: 0 .2em;
  /* No `white-space: nowrap` here: the longest placeholders ("[СУД ПО МЕСТУ
     НАХОЖДЕНИЯ ИСПОЛНИТЕЛЯ]") are ~390px wide and ran off a 375px viewport,
     where body's overflow-x: hidden then clipped them outright. The brackets
     keep a wrapped placeholder just as readable. */
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .ph { background: #fdf0d5; }
}

.draft {
  display: flex;
  gap: .75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 0 0 2rem;
  font-size: .9rem;
}
.draft b { display: block; margin-bottom: .2rem; }
.draft p { margin: 0; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0 0 1.5rem;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .9rem; }
th, td { padding: .65rem 1rem; text-align: left; border-top: 1px solid var(--border); }
thead th {
  background: var(--bg-soft);
  border-top: none;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
td { color: var(--text-muted); }
tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }

footer.site {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 1.6rem 0;
  font-size: .85rem;
  color: var(--text-faint);
}
.foot-row { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; }
.foot-row a { color: var(--text-muted); text-decoration: none; }
.foot-row a:hover { color: var(--primary); }
