@font-face {
  font-family: "Sofia Sans";
  src: url("/static/fonts/SofiaSans-450.woff2") format("woff2");
  font-weight: 450;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sofia Sans";
  src: url("/static/fonts/SofiaSans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sofia Sans";
  src: url("/static/fonts/SofiaSans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #F3F0EE;
  --lifted: #FCFBFA;
  --ink: #141413;
  --charcoal: #262627;
  --slate: #696969;
  --dust: #D1CDC7;
  --bone: #E8E2DA;
  --orange: #CF4500;
  --orange-light: #F37338;
  --white: #FFFFFF;
  --radius-card: 40px;
  --radius-pill: 999px;
  --shadow-soft: 0 24px 48px rgba(0, 0, 0, 0.08);
  --shadow-nav: 0 4px 24px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Sofia Sans", "Inter", Arial, sans-serif;
  font-weight: 450;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- decorative orbits ---------- */
.orbits {
  position: absolute;
  inset: 0 0 auto 0;
  height: 900px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.orbit {
  position: absolute;
  border: 1px solid rgba(243, 115, 56, 0.55);
  border-radius: 50%;
}
.orbit-a { width: 560px; height: 560px; right: -120px; top: 80px; }
.orbit-b { width: 320px; height: 320px; right: 210px; top: 330px; border-color: rgba(207, 69, 0, 0.25); }
.orbit-dot {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--orange-light);
  right: 88px; top: 170px;
}
.orbits::after {
  content: "";
  position: absolute;
  width: 700px; height: 700px;
  right: -220px; top: -180px;
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 50%;
}

/* ---------- nav ---------- */
.nav-pill {
  position: sticky;
  top: 24px;
  z-index: 40;
  width: min(1180px, calc(100% - 48px));
  margin: 24px auto 0;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 16px 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-nav);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { position: relative; width: 22px; height: 22px; display: inline-block; border: 1.5px solid var(--ink); border-radius: 50%; }
.brand-mark i { position: absolute; inset: 5px; border-radius: 50%; background: var(--orange); }
.brand-name { font-weight: 500; letter-spacing: -0.02em; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--slate); font-weight: 450; margin-left: 2px; }
.nav-links { display: flex; gap: 30px; margin-left: auto; font-size: 15px; font-weight: 500; }
.nav-links a { opacity: .82; transition: opacity .2s; }
.nav-links a:hover { opacity: 1; }
.nav-live { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--slate); padding: 8px 14px; background: var(--canvas); border-radius: var(--radius-pill); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange-light); }

/* ---------- hero ---------- */
main { position: relative; z-index: 1; }
.hero {
  position: relative;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 40px;
}
.eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--charcoal);
}
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.lede {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--charcoal);
  font-size: 18px;
  line-height: 1.5;
}
.lede strong { font-weight: 700; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
}
.kpi {
  background: var(--lifted);
  border-radius: var(--radius-card);
  padding: 30px 32px 28px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(20, 20, 19, 0.04);
}
.kpi-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
.kpi-value { font-size: clamp(40px, 4.6vw, 62px); line-height: 1; font-weight: 500; letter-spacing: -0.025em; margin-top: 18px; }
.kpi-note { font-size: 13px; color: var(--slate); margin-top: 8px; }
.kpi-accent { background: var(--ink); color: var(--canvas); }
.kpi-accent .kpi-label { color: rgba(243, 240, 238, 0.62); }
.kpi-accent .kpi-note { color: rgba(243, 240, 238, 0.62); }
.kpi-accent .kpi-value { color: var(--white); }

.history-banner {
  margin-top: 22px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--slate);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  width: fit-content;
}
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange-light); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ---------- panel ---------- */
.panel {
  width: min(1180px, calc(100% - 48px));
  margin: 16px auto 0;
  background: var(--lifted);
  border-radius: var(--radius-card);
  padding: 40px;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: 96px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: clamp(28px, 3vw, 38px); font-weight: 500; letter-spacing: -0.022em; }
.panel-head p { margin: 8px 0 0; color: var(--slate); font-size: 14px; }

.segmented {
  display: inline-flex;
  gap: 3px;
  background: var(--bone);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.segmented button {
  border: 0; background: transparent;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 14px; font-weight: 500;
  color: var(--charcoal);
  transition: background .18s ease, color .18s ease;
}
.segmented button.is-active { background: var(--ink); color: var(--canvas); }
.segmented.small button { padding: 7px 16px; font-size: 13px; }

.controls {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) 220px 190px auto;
  gap: 12px;
  align-items: center;
  margin-top: 30px;
}
.search-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--white);
  border: 1px solid rgba(20, 20, 19, 0.18);
  border-radius: var(--radius-pill);
  padding: 0 18px;
  height: 48px;
}
.search-wrap svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.7; margin-right: 10px; opacity: .7; }
.search-wrap input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 15px; }
.search-wrap input::placeholder { color: var(--slate); }
select {
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(20, 20, 19, 0.18);
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23141413' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px 14px;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 44px 0 18px;
  font-size: 14px;
  outline: 0;
}
.chip {
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: transparent;
  padding: 0 20px;
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }

.list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-top: 30px; padding-top: 18px;
  border-top: 1px solid rgba(20, 20, 19, 0.1);
}
.list-summary { font-size: 14px; color: var(--slate); }
.legend { display: flex; gap: 18px; font-size: 13px; color: var(--slate); }
.legend span { display: flex; align-items: center; gap: 7px; }
.sw { width: 14px; height: 8px; border-radius: var(--radius-pill); display: inline-block; }
.sw-domestic { background: var(--ink); }
.sw-imported { background: var(--orange); }

/* ---------- gap rows ---------- */
.gap-list { display: flex; flex-direction: column; }
.gap-row {
  display: grid;
  grid-template-columns: 44px minmax(230px, 1.35fr) minmax(280px, 1.6fr) 98px;
  gap: 22px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(20, 20, 19, 0.09);
  border-radius: 20px;
  padding: 20px 16px;
  transition: background .16s ease;
}
.gap-row:first-child { border-top: 0; }
.gap-row:hover, .gap-row:focus-visible { background: var(--canvas); outline: none; }
.gap-row.zero { box-shadow: inset 3px 0 0 var(--orange); }
.rank { font-size: 13px; color: #A9A39B; font-weight: 500; font-variant-numeric: tabular-nums; }
.row-title h3 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; }
.row-title .cat { display: block; margin-top: 6px; font-size: 12px; color: var(--slate); }
.zero-pill {
  display: inline-flex; align-items: center;
  margin-top: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--orange);
  border: 1px solid rgba(207, 69, 0, 0.45);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
}
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-line { display: grid; grid-template-columns: 36px 1fr 62px; align-items: center; gap: 10px; }
.bar-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--slate); }
.track { height: 12px; background: var(--bone); border-radius: var(--radius-pill); overflow: hidden; }
.bar { display: block; height: 100%; border-radius: var(--radius-pill); min-width: 2px; }
.bar.domestic { background: var(--ink); }
.bar.imported { background: var(--orange); }
.bar-num { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.row-gap { text-align: right; }
.row-gap strong { display: block; font-size: 21px; font-weight: 500; letter-spacing: -0.02em; }
.row-gap small { font-size: 11px; color: var(--slate); }
.row-gap.zero strong { color: var(--orange); }

.empty { padding: 50px 10px; color: var(--slate); text-align: center; }
.more-btn {
  display: block;
  margin: 26px auto 0;
  border: 1.5px solid var(--ink);
  background: transparent;
  border-radius: 20px;
  padding: 11px 30px;
  font-size: 14px; font-weight: 500;
}
.more-btn:hover { background: var(--ink); color: var(--canvas); }

.skeleton { padding: 46px 10px; color: var(--slate); }
.skeleton span { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--dust); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 10px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- footer ---------- */
.footer {
  background: var(--ink);
  color: var(--canvas);
  margin-top: 88px;
  padding: 80px max(24px, calc((100vw - 1180px) / 2)) 44px;
  border-radius: 40px 40px 0 0;
}
.footer h2 { margin: 0 0 64px; font-size: clamp(36px, 5vw, 62px); line-height: 1.02; font-weight: 500; letter-spacing: -0.025em; }
.footer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; padding-bottom: 56px; }
.footer-grid span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: rgba(243, 240, 238, 0.45); margin-bottom: 12px; }
.footer-grid p { margin: 0; font-size: 14px; line-height: 1.5; color: rgba(243, 240, 238, 0.78); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid rgba(243, 240, 238, 0.18); padding-top: 26px; font-size: 12px; color: rgba(243, 240, 238, 0.5); }
.footer-bottom a:hover { color: var(--canvas); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 20, 19, 0.32); z-index: 60; }
.drawer {
  position: fixed;
  z-index: 70;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 92vw);
  background: var(--white);
  border-radius: 40px 0 0 40px;
  padding: 34px 34px 24px;
  transform: translateX(105%);
  transition: transform .32s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.12);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.drawer-kicker { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--slate); margin-left: 8px; }
.drawer-head h3 { margin: 14px 0 0; font-size: 28px; line-height: 1.12; font-weight: 500; letter-spacing: -0.02em; }
.close { border: 1.5px solid var(--ink); background: transparent; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; flex-shrink: 0; }
.close:hover { background: var(--ink); color: var(--canvas); }
.drawer-meta { margin-top: 18px; font-size: 13px; color: var(--slate); padding-bottom: 18px; border-bottom: 1px solid rgba(20,20,19,.1); }
.permit-list { overflow: auto; padding-right: 4px; }
.permit {
  padding: 18px 0;
  border-bottom: 1px solid rgba(20, 20, 19, 0.08);
}
.permit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.permit .nie { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.permit .status { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--canvas); color: var(--charcoal); }
.permit .status.ok { background: rgba(20,20,19,.08); }
.permit .status.bad { background: rgba(207,69,0,.1); color: var(--orange); }
.permit h4 { margin: 8px 0 0; font-size: 15px; font-weight: 500; line-height: 1.3; }
.permit p { margin: 6px 0 0; font-size: 12px; color: var(--slate); line-height: 1.45; }
.permit-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--slate); }
.permit .dates { margin-top: 8px; font-size: 11px; color: var(--slate); }
.drawer-empty { padding: 40px 0; color: var(--slate); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .gap-row { grid-template-columns: 36px 1fr 90px; }
  .bars { grid-column: 2 / -1; }
  .row-gap { grid-column: 3; grid-row: 1; }
  .row-title { grid-column: 2; grid-row: 1; }
  .rank { grid-row: 1; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-accent { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .nav-pill { top: 12px; width: calc(100% - 24px); margin-top: 12px; padding: 10px 14px; gap: 10px; }
  .nav-links { display: none; }
  .brand-sub { display: none; }
  .nav-live { margin-left: auto; padding: 6px 10px; }
  .hero { width: calc(100% - 32px); padding-top: 44px; }
  .lede { font-size: 16px; }
  .kpis { grid-template-columns: 1fr; gap: 12px; margin-top: 36px; }
  .kpi { min-height: 140px; padding: 24px; }
  .panel { width: calc(100% - 24px); padding: 24px 18px; border-radius: 28px; }
  .panel-head { gap: 16px; }
  .segmented { width: 100%; justify-content: space-between; }
  .segmented button { flex: 1; padding: 9px 6px; }
  .controls { grid-template-columns: 1fr; gap: 10px; }
  .chip { height: 44px; }
  select, .search-wrap { height: 44px; width: 100%; }
  .gap-row { grid-template-columns: 28px 1fr auto; gap: 12px; padding: 18px 6px; }
  .row-gap { grid-column: 3; grid-row: 1; text-align: right; display: block; }
  .row-gap strong { font-size: 18px; }
  .bars { grid-column: 1 / -1; margin-top: 4px; }
  .bar-line { grid-template-columns: 36px 1fr 48px; }
  .list-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .footer { border-radius: 28px 28px 0 0; margin-top: 48px; padding: 56px 24px 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .drawer { width: 100%; top: auto; height: 88vh; border-radius: 40px 40px 0 0; transform: translateY(105%); padding: 26px 22px; }
  .drawer.open { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}