* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0; color: #1a1a1a; background: #f6f7f9;
}
header {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px; background: #1f2a44; color: #fff;
}
header .brand { font-weight: 700; font-size: 18px; color: #fff; text-decoration: none; }
header nav { display: flex; gap: 18px; }
header nav a { color: #cdd6ef; text-decoration: none; }
header nav a:hover { color: #fff; }
main { max-width: 820px; margin: 32px auto; padding: 0 20px; }
h1 { font-size: 24px; }
.search { display: flex; gap: 8px; margin: 18px 0; }
.search input { flex: 1; padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 15px; }
.search input.region { flex: 0 0 120px; }
.search button { padding: 10px 20px; border: 0; border-radius: 8px; background: #2f6fed; color: #fff; font-size: 15px; cursor: pointer; }
.search button:hover { background: #1f5bd8; }
.cascade { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.field { display: flex; flex-direction: column; gap: 4px; max-width: 460px; }
.field label { font-size: 13px; color: #6b7280; font-weight: 600; }
.field select { padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 15px; background: #fff; }
.result { background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 18px; margin-bottom: 20px; max-width: 560px; }
.result .full { font-size: 17px; font-weight: 600; color: #1f2a44; margin-bottom: 10px; }
.result .meta { display: grid; grid-template-columns: 90px 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: 14px; }
.result .meta dt { color: #6b7280; }
.result .meta dd { margin: 0; }
code { background: #eef2ff; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.results { list-style: none; padding: 0; }
.results li { background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.results li a { font-size: 16px; font-weight: 600; color: #2f6fed; text-decoration: none; }
.path { color: #6b7280; font-size: 13px; display: block; margin-top: 2px; }
.badge { display: inline-block; background: #eef2ff; color: #3949ab; border-radius: 6px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }
.muted { color: #6b7280; font-size: 13px; }
.empty { color: #b45309; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 18px; }
.card { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 16px; }
.card dt { color: #6b7280; }
.card dd { margin: 0; font-weight: 500; }
.houses { list-style: none; padding: 0; }
.houses li { background: #fff; border: 1px solid #e6e8ec; border-radius: 8px; padding: 8px 14px; margin-bottom: 6px; }
.back { color: #2f6fed; text-decoration: none; }
.final { background: #fff; border: 1px solid #cdd6ef; border-left: 4px solid #2f6fed; border-radius: 10px; padding: 18px; margin-bottom: 20px; max-width: 560px; }
.final .final-head { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #2f6fed; margin-bottom: 8px; }
.final .full { font-size: 17px; font-weight: 600; color: #1f2a44; margin-bottom: 12px; }
.final .components { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 12px; }
.final .components td { padding: 5px 8px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
.final .components td.lvl { color: #6b7280; white-space: nowrap; width: 220px; }
.final .json summary { cursor: pointer; color: #2f6fed; font-size: 13px; font-weight: 600; }
.final .json pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12px; line-height: 1.5; margin: 8px 0 0; }

/* верхняя полоса прогресса — видна, пока идут fetch-запросы */
#loading-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #2f6fed, #6ea8ff);
  z-index: 1000; opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
#loading-bar.on { opacity: 1; width: 100%; animation: loading-bar 1.1s ease-in-out infinite; }
@keyframes loading-bar {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* инлайн-спиннер в области результата/итога */
.loading-inline { display: flex; align-items: center; gap: 10px; color: #6b7280; font-size: 14px; padding: 4px 0; }
.spinner {
  width: 16px; height: 16px; flex: 0 0 16px;
  border: 2px solid #c7d2fe; border-top-color: #2f6fed;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* плавное появление готовых блоков после загрузки */
.result:not([hidden]), .final:not([hidden]) { animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
footer { text-align: center; color: #9ca3af; font-size: 13px; padding: 30px; }
