/* Маршрутизация СПб — портал. Базовые стили. */
:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --border: #E2E8EC;
  --text: #0F2A33;
  --text-muted: #5A6B73;
  --primary: #0E7C66;
  --primary-700: #0A5C4C;
  --primary-50: #E2F3EF;
  --accent: #FF7A59;
  --warn: #C46B0E;
  --shadow: 0 1px 2px rgba(15,42,51,0.04), 0 4px 16px rgba(15,42,51,0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PT Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 44px; height: 44px; flex-shrink: 0; }
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-text h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.subtitle { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }

.primary-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s;
}
.nav-link:hover { background: var(--primary-50); color: var(--primary-700); }
.nav-link.active { background: var(--primary); color: white; }

/* Main */
.main { padding: 32px 24px 64px; }
.tab { display: none; }
.tab.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero { margin-bottom: 24px; }
.hero h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
.hero p { color: var(--text-muted); margin: 0; max-width: 800px; }

/* Cards & layout */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.search-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .search-grid { grid-template-columns: 1fr; }
}
.form-card h3 { margin: 0 0 14px; font-size: 16px; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; }
.field label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
select, input[type="search"], input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
  background: var(--surface);
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border .15s;
  margin-right: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-700); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }

/* Result */
.result-card { min-height: 320px; }
.result-empty { color: var(--text-muted); padding: 40px 20px; text-align: center; }
.result-empty p { margin: 6px 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.route-block { margin-bottom: 20px; }
.route-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}
.org-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface-2);
}
.org-card .org-name { font-weight: 600; }
.org-card .org-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-50);
  color: var(--primary-700);
  margin-right: 6px;
}
.tag.tag-anchor { background: #FFE6DD; color: #B0431F; }
.tag.tag-warn { background: #FFF3E0; color: var(--warn); }

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.info-card h4 { margin: 0 0 6px; font-size: 14px; color: var(--primary); }
.info-card p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* Workflow */
.workflow-step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: var(--surface);
}
.workflow-step .step-num {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: white; font-weight: 700;
  border-radius: 50%;
  font-size: 16px;
}
.workflow-step h4 { margin: 0 0 4px; font-size: 16px; }
.workflow-step .actor { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.workflow-step .action { font-size: 14px; margin-bottom: 6px; }
.workflow-step .branches { margin: 8px 0 0; padding: 0; list-style: none; }
.workflow-step .branches li { padding: 6px 0 6px 22px; font-size: 13px; position: relative; }
.workflow-step .branches li::before {
  content: "→";
  position: absolute; left: 0; color: var(--primary);
}

/* Map */
#leaflet-map {
  height: 600px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.chip input { accent-color: var(--primary); }

/* Tables */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-bar input[type="search"] { flex: 1; min-width: 240px; }
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table tr:last-child td { border-bottom: none; }
table tr:hover { background: var(--surface-2); }

/* Documents */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}
.doc-card h3 { margin: 0 0 8px; font-size: 15px; color: var(--primary-700); }
.doc-card p { margin: 4px 0; font-size: 13px; }
.appendices {
  margin-top: 28px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.appendices h3 { margin-top: 0; }
.appendix-list {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 32px;
}
@media (max-width: 700px) {
  .appendix-list { columns: 1; }
}
.appendix-list li { padding: 4px 0; break-inside: avoid; font-size: 14px; }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 60px;
}
.site-footer p { margin: 4px 0; font-size: 13px; color: var(--text-muted); }
