:root {
  --bg: #f4f5f7;
  --ink: #16202c;
  --muted: #56616e;
  --line: #e1e5ea;
  --soft: #eef1f5;
  --blue: #1d4ed8;
  --blue-soft: #e8effc;
  --green: #17733a;
  --green-bg: #e7f6ec;
  --card: #fff;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}
button, input, select, textarea, pre, option { font-family: inherit; }
a { color: var(--blue); }
button { cursor: pointer; }
svg { display: block; }

.wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.local-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
  padding: 0 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.brand-mark {
  min-width: 36px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tabs { display: flex; gap: 20px; font-size: 14px; }
.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 18px 0;
}
.tabs a.on {
  color: var(--ink);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--blue);
}
.topbar-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.band {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 22px;
}
.band h1 {
  margin: 0 0 16px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.search { display: flex; gap: 10px; }
.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  background: #fff;
}
.field svg { color: var(--blue); flex: none; }
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
}
.field input::placeholder { color: #8a93a0; }
.seg {
  display: flex;
  background: var(--soft);
  border-radius: 6px;
  padding: 3px;
  flex: none;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.go {
  border: 0;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: 0 22px;
  font-weight: 500;
  font-size: 15px;
}
.go:hover { background: #1a43b8; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d5dbe3;
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  font-size: 13px;
  color: #3a4552;
}
.chip select {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  max-width: min(420px, 55vw);
  outline: none;
}
.reset {
  border: 1px solid #d5dbe3;
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 24px 0 48px;
}
.side h3,
.panel-head h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.facet {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
  color: #2a3542;
  cursor: pointer;
}
.facet input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  margin: 0;
}
.facet small { color: var(--muted); font-size: 12px; }
.related { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.related button {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.35;
}
.related button .code {
  display: block;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 2px;
}
.related button:hover { border-color: #c5ccd6; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px 0;
}
.panel-head h3 { margin-bottom: 0; }
.panel-note { font-size: 13px; color: var(--muted); }
.docs { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.docs th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: #7a8592;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.docs th button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
}
.docs th button.on { color: var(--ink); font-weight: 600; }
.docs td {
  padding: 13px 18px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: top;
  line-height: 1.4;
}
.docs tr:last-child td { border-bottom: 0; }
.docs tbody tr { cursor: pointer; }
.docs tbody tr:hover { background: #f8fafc; }
.docs .code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--blue);
  white-space: nowrap;
  font-weight: 500;
}
.docs .title { color: var(--ink); }
.docs .year { color: var(--muted); white-space: nowrap; }
.docs .num { text-align: right; color: var(--muted); white-space: nowrap; }
.docs .src { white-space: nowrap; }
.docs .src a { text-decoration: none; font-size: 13px; }
.docs .src a:hover { text-decoration: underline; }
.empty {
  margin: 0;
  padding: 24px 18px;
  color: var(--muted);
  font-size: 14px;
}

.lead {
  margin: 0 0 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  line-height: 1.5;
}
.status { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.results { display: grid; gap: 12px; margin-bottom: 24px; }
.card {
  cursor: pointer;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.card:hover { border-color: #c5ccd6; }
.card .cite {
  margin: 0 0 4px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}
.card h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}
.card:hover h2 { color: var(--blue); }
.snippet { margin: 0; color: #4d5661; font-size: 14px; line-height: 1.45; }
.snippet mark { background: #fff3a0; padding: 0 1px; }

dialog {
  width: min(820px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  color: var(--ink);
}
dialog::backdrop { background: rgba(22, 32, 44, 0.4); }
.viewer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.viewer-bar button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
.viewer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px 0;
  color: var(--muted);
  font-size: 14px;
}
.viewer-meta a { text-decoration: none; white-space: nowrap; }
.viewer-meta a:hover { text-decoration: underline; }
#viewerText {
  white-space: pre-wrap;
  margin: 0;
  padding: 12px 14px 18px;
  line-height: 1.5;
  font-size: 15px;
  font-family: var(--font);
}

.doc-page { padding: 28px 0 64px; }
.doc-back { margin: 0 0 18px; }
.doc-back a { text-decoration: none; color: var(--muted); font-size: 14px; }
.doc-back a:hover { color: var(--blue); }
.doc-head {
  margin-bottom: 24px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.doc-code {
  margin: 0 0 8px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.doc-head h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 650;
}
.doc-note { margin: 0; color: var(--muted); font-size: 14px; }
.doc-body { display: grid; gap: 12px; }
.doc-point {
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.doc-point:target {
  border-color: #93b0ef;
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.doc-point h2 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1.4;
}
.doc-point p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .topbar { padding: 0 16px; gap: 16px; }
  .topbar-meta { display: none; }
  .wrap { width: calc(100% - 32px); }
  .body { grid-template-columns: 1fr; }
  .search { flex-direction: column; }
  .field { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 8px; }
  .field input { flex: 1 1 100%; padding: 4px 0; }
  .seg { width: 100%; overflow-x: auto; }
  .go { height: 44px; }
  .chip select { max-width: 60vw; }
  .docs th:nth-child(4),
  .docs td.num,
  .docs th:nth-child(5),
  .docs td.src { display: none; }
  .doc-head h1 { font-size: 22px; }
}

.brand-mark {
  width: auto;
  min-width: 38px;
  padding: 0 6px;
  white-space: nowrap;
}

.clusters { margin-top: 28px; }
.clusters > h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}
.cluster + .cluster { margin-top: 16px; }
.cluster h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}
.cluster h3 a { color: var(--ink); text-decoration: none; }
.cluster h3 a:hover { color: var(--blue); }
.query-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.query-list a { font-size: 14px; text-decoration: none; }
.query-list a:hover { text-decoration: underline; }

.site-footer {
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.site-footer .wrap {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--blue); }

.org-page,
.tema-page { padding: 28px 0 48px; }
.org-page h1,
.tema-page h1 {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 0 0 28px;
}
.offer-card {
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.offer-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}
.offer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.lead-ok,
.lead-error { margin: 0 0 14px; font-size: 14px; }
.lead-ok { color: var(--green); }
.lead-error { color: #8f2d2d; }
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 440px;
}
.lead-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}
.lead-form input,
.lead-form textarea {
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--ink);
  background: var(--card);
}
.lead-form textarea { resize: vertical; min-height: 96px; }
.lead-form .go { height: 44px; }

.tema-intro {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.tema-section + .tema-section,
.tema-intro + .query-list + .tema-section,
.query-list + .tema-section { margin-top: 28px; }
.tema-section h2 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.area-list,
.tema-docs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.area-list a,
.tema-docs a {
  display: block;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
}
.area-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.area-list a:hover,
.tema-docs a:hover { border-color: #c5ccd6; }
.area-list small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tema-docs .code {
  display: block;
  margin-bottom: 2px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 6px;
  }
  .tabs { flex-wrap: wrap; }
  .tabs a { padding: 8px 0; }
  .org-page h1,
  .tema-page h1 { font-size: 22px; }
}
