/* Pruma - public site (pruma.org).
   Design system v1 (handoff Claude Design, T-844): light-first, tokens.css is
   the single source of color/type/spacing - every color here is a token or a
   color-mix() derivation of one. Dark mode, if it ever comes, derives from the
   tokens later - never the reverse.
   Rule kept from day one: status color NEVER alone - icon + label always.
   The public side is calm and informative (arquitetura.md §7): no threshold
   config, statuses reduced to normal | attention (+ planned | no_data). */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--surface-1);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: var(--leading);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); text-decoration: underline; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 10px var(--sp-4);
  background: var(--surface-0);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1100;
  flex-wrap: wrap;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: none;
}
.header__brand:hover { text-decoration: none; }
.header__brand svg { flex: none; }
.header__wordmark {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* slot between brand and nav: the home mounts the municipality search here */
.header__slot { flex: 1; min-width: 0; display: flex; }

.header__nav {
  margin-left: auto;
  display: flex;
  gap: var(--sp-4);
  font-size: 14px;
  font-weight: 500;
}
.header__nav a { padding: 10px 2px; color: var(--brand); }
.header__nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.header__cta {
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--surface-0);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  flex: none;
}
.header__cta:hover { background: var(--brand-ink); color: var(--surface-0); text-decoration: none; }

/* ---------- Municipality search (home header) ---------- */

.municipality-search {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 340px;
}
.municipality-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 0 var(--sp-3);
  min-height: 40px;
  font: inherit;
  font-size: 14px;
}
.municipality-search input:focus {
  border-color: var(--brand);
  background: var(--surface-0);
  outline: none;
}
.municipality-search input::placeholder { color: var(--ink-3); }
.municipality-search__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-float);
  z-index: 1200;
}
.municipality-search__list:empty { display: none; }
.municipality-search__list a {
  display: block;
  padding: 10px var(--sp-3);
  color: var(--ink);
  font-size: 14px;
}
.municipality-search__list a:hover, .municipality-search__list a.active {
  background: var(--surface-2);
  text-decoration: none;
}

/* ---------- Public notice (highlighted on EVERY page - arquitetura.md §7) ---------- */

.public-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: 8px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  background: var(--risk-attention-tint);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1090;
}
.public-notice svg { width: 15px; height: 15px; flex: none; color: var(--risk-attention-ink); }
.public-notice__source { font-weight: 400; font-size: var(--text-xs); color: var(--ink-2); }

/* ---------- Map layout (home + /<city>/mapa) ---------- */

.page-column { display: flex; flex-direction: column; height: 100vh; }

.map-screen {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

#map { flex: 1; height: 100%; background: var(--surface-2); }

/* floating summary card over the map (counts by state = the legend) */
.float-card {
  position: absolute;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  z-index: 800;
}
.summary {
  top: var(--sp-4);
  left: var(--sp-4);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 240px;
}
.summary__title { font-size: 13px; font-weight: 650; margin: 0; }
.summary__sub { font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.summary__count { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 22px; }
.summary__count b { min-width: 26px; text-align: right; font-weight: 650; }
.summary__shape {
  width: 15px; height: 15px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Map markers: --risk-*-fill dot, white 1.5px border ---------- */

.marker { text-align: center; transform: translate(-50%, -50%); position: absolute; }
.marker__dot {
  width: 13px;
  height: 13px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--marker-fill);
  border: 1.5px solid var(--surface-0);
  box-shadow: 0 1px 3px rgba(24, 32, 38, 0.3);
}
.marker--attention .marker__dot { width: 15px; height: 15px; }
.marker--alert .marker__dot { width: 16px; height: 16px; }
/* flood: the prototype's diamond - distinct SHAPE, not just color */
.marker--flood .marker__dot {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  transform: rotate(45deg);
}
.marker--muted .marker__dot {
  background: var(--surface-0);
  border: 2px dashed var(--marker-fill);
  box-shadow: 0 1px 3px rgba(24, 32, 38, 0.2);
}
.marker__label {
  margin-top: 3px;
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

/* Leaflet popup (station card on the map) */
.leaflet-popup-content-wrapper {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  background: var(--surface-0);
  color: var(--ink);
}
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.pp-city { font-size: 15px; font-weight: 650; color: var(--ink); }
.pp-river { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.pp-level { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.pp-level span { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.pp-badge-row { margin: 6px 0; }
.pp-link { display: inline-block; font-size: 13px; font-weight: 600; margin-top: 4px; }

.footer-notice {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--ink-3);
  background: var(--surface-0);
  border-top: 1px solid var(--line);
  padding: 8px var(--sp-4);
  text-align: center;
}
.footer-notice a { font-weight: 500; font-size: 12.5px; }

/* ---------- Status badge (icon + label, tint bg + ink text) ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-full);
  padding: 4px 11px;
  font-size: 13px;
  font-weight: 650;
  background: var(--badge-tint, var(--surface-2));
  color: var(--badge-ink, var(--ink-2));
}
.status-badge svg { width: 13px; height: 13px; flex: none; }
.status-badge--big { font-size: 14px; padding: 6px 13px; }
.status-badge--big svg { width: 14px; height: 14px; }

/* ---------- City panel (/<city>) - the prototype page, mobile-first ---------- */

.panel-page {
  min-height: 100vh;
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
}
.panel-page__body {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
}
@media (min-width: 760px) {
  .panel-page__body { max-width: 720px; }
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--sp-4);
  background: var(--surface-0);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.panel-header__sep { color: var(--line-strong); }
.panel-header__city {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-header__map-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-height: 44px;
}
.panel-header__map-link:hover { text-decoration: none; background: var(--surface-1); }

/* point tabs (abas de ponto, T-794) */
.point-tabs {
  display: flex;
  gap: var(--sp-2);
  padding: 12px var(--sp-4) 0;
  background: var(--surface-0);
  overflow-x: auto;
}
.point-tabs:empty { display: none; }
.point-tabs button {
  border: 1px solid var(--line);
  background: var(--surface-0);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom: 2px solid transparent;
  min-height: 44px;
  white-space: nowrap;
}
.point-tabs button[aria-pressed="true"] {
  color: var(--brand);
  border-bottom: 2px solid var(--brand);
  background: var(--surface-1);
}

/* hero: badge + display number + trend (prototype "Status do rio") */
.hero {
  background: var(--surface-0);
  padding: 20px var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.hero__status { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.hero__status-hint { font-size: 13px; color: var(--ink-2); }
.hero__level { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.hero__num {
  font-size: var(--display);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
  color: var(--ink);
}
.hero__unit { font-size: 26px; font-weight: 500; color: var(--ink-3); }
@media (min-width: 760px) {
  .hero__num { font-size: var(--display-lg); }
}
.hero__caps {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
}
.hero__meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: 14px; flex-wrap: wrap; }
.hero__updated { font-size: 13px; color: var(--ink-3); }
.hero__sentence {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.hero__sentence b { color: var(--ink); }

/* trend chip ("subindo 1,7 cm/h") - colored by state */
.trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 650;
  color: var(--chip-ink, var(--ink-2));
  background: var(--chip-tint, var(--surface-2));
  padding: 5px 11px;
  border-radius: var(--r-sm);
}
.trend-chip svg { width: 12px; height: 12px; flex: none; }

/* eta tile ("neste ritmo, atinge ... em ~X") - state tint block */
.eta-tile {
  margin-top: var(--sp-4);
  padding: 12px 14px;
  background: var(--risk-attention-tint);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: var(--leading);
  color: var(--ink);
}
.eta-tile__disclaimer { color: var(--ink-2); font-size: var(--text-xs); display: block; margin-top: 2px; }

/* stat tiles grid (cota, média 30d, chuva hoje...) */
.stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}
@media (min-width: 760px) {
  .stat-tiles { grid-template-columns: repeat(4, 1fr); }
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.stat-tile__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-tile__value { font-size: 20px; font-weight: 650; margin-top: 3px; }
.stat-tile__value small { font-size: 13px; font-weight: 500; color: var(--ink-3); }

/* official quota block (T-789) */
.official-tile {
  margin-top: var(--sp-4);
  padding: 12px 14px;
  background: var(--brand-tint);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  display: grid;
  gap: 6px;
}
.official-tile__hint { font-size: var(--text-xs); color: var(--ink-2); }

/* stacked cards (chart, forecast, rainmap, satellite) */
.panel-card {
  margin: 12px var(--sp-4) 0;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.panel-card:last-of-type { margin-bottom: 12px; }
.panel-card__title { font-size: 16px; font-weight: 650; margin: 0; }
.panel-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.panel-card__meta { font-size: var(--text-xs); color: var(--ink-3); }

.panel-footer {
  padding: var(--sp-5) var(--sp-4) var(--sp-6);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--ink-3);
  line-height: 1.6;
}
.panel-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Error / empty ---------- */

.empty { color: var(--ink-3); text-align: center; padding: 2rem 1rem; font-size: 14px; }

.error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: var(--surface-1);
}
.error-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.error-box h1 { margin: 0 0 var(--sp-2); font-size: var(--text-2xl); letter-spacing: -0.02em; }
.error-box p { color: var(--ink-2); margin: 0 0 var(--sp-4); }

/* ---------- Sound toggle (T-791) ---------- */

.sound-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: var(--r-sm);
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex: none;
  transition: background var(--dur-fast) var(--ease);
}
.sound-toggle:hover { color: var(--ink); background: var(--surface-2); }
.sound-toggle svg { width: 15px; height: 15px; }
.sound-toggle[aria-pressed="false"] { color: var(--ink-3); }

/* ---------- Chart (level + rain small multiple) ---------- */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid { stroke: var(--surface-2); stroke-width: 1; }
.chart .tick { font-size: 10.5px; fill: var(--ink-3); font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .level-line { stroke: var(--chart-line, var(--brand)); stroke-width: 2.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .level-area { fill: var(--chart-tint, var(--brand-tint)); opacity: 0.55; }
.chart .level-dot { fill: var(--chart-fill, var(--brand)); stroke: var(--surface-0); stroke-width: 2; }
.chart .threshold-line { stroke: var(--risk-alert-fill); stroke-width: 1.5; }
.chart .threshold-label { font-size: 10.5px; font-weight: 600; fill: var(--risk-alert-ink); font-family: var(--font-ui); }
/* rain: brand-derived light blue (the prototype's #B9D3E4) */
.chart .rain-bar { fill: color-mix(in srgb, var(--brand) 30%, var(--surface-0)); }
.chart .cursor { stroke: var(--ink-3); stroke-width: 1; }
.chart .cursor-dot { fill: var(--chart-fill, var(--brand)); stroke: var(--surface-0); stroke-width: 2; }

.chart-legend {
  display: flex;
  gap: var(--sp-4);
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--ink-2);
  flex-wrap: wrap;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { flex: none; }
.chart-legend .swatch-line { width: 14px; height: 3px; border-radius: 2px; }
.chart-legend .swatch-bar { width: 8px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--brand) 30%, var(--surface-0)); }
.chart-legend .swatch-dash { width: 14px; height: 0; border-top: 2px dashed var(--risk-alert-fill); }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 10px;
  font-size: var(--text-xs);
  box-shadow: var(--shadow-md);
  z-index: 10;
  white-space: nowrap;
  display: none;
}
.chart-tooltip .chip { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* date slider */
.date-slider { margin-top: var(--sp-2); }
.date-slider input[type="range"] { width: 100%; accent-color: var(--brand); }
.date-slider__value {
  font-size: var(--text-sm);
  color: var(--ink-2);
  text-align: center;
}
.date-slider label { font-size: var(--text-xs); color: var(--ink-3); }

/* period selector: segmented control (prototype) */
.filters {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 3px;
  margin-bottom: var(--sp-3);
}
.filters button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-2);
  border-radius: 8px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease);
}
.filters button[aria-pressed="true"] {
  background: var(--surface-0);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- Forecast (T-786 / T-790) ---------- */

.forecast-days { display: flex; gap: var(--sp-2); }
.forecast-day {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: var(--surface-1);
  border-radius: var(--r-md);
  padding: 10px 4px;
}
.forecast-day__name { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.forecast-day__icon { color: var(--ink-2); margin: 4px 0 2px; }
.forecast-day__icon svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
.forecast-day__temp { font-size: 12px; color: var(--ink-2); }
.forecast-day__temp b { color: var(--ink); }
.forecast-day__temp span { color: var(--ink-3); }
.forecast-day__bar-slot { height: 26px; display: flex; align-items: flex-end; justify-content: center; margin-top: 4px; }
.forecast-day__bar { width: 8px; background: color-mix(in srgb, var(--brand) 30%, var(--surface-0)); border-radius: 4px 4px 0 0; }
.forecast-day__rain { font-size: 12px; font-weight: 650; color: var(--brand); display: flex; flex-direction: column; }
.forecast-day__rain span { color: var(--ink-3); font-weight: 400; }
.forecast-accum {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--ink-2);
  align-items: baseline;
}
.forecast-accum__label { color: var(--ink-3); }
.forecast-accum__item { white-space: nowrap; }
.forecast-accum__item b { color: var(--ink); }
.forecast-disclaimer { font-size: var(--text-xs); color: var(--ink-3); margin: var(--sp-3) 0 0; }

.forecast-day__wind { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.forecast-wind { margin-top: var(--sp-3); font-size: var(--text-sm); color: var(--ink-2); }
.forecast-wind b { color: var(--ink); }
.forecast-wind__label { color: var(--ink-3); }

/* satellite (GOES-19, T-790) */
.satellite__img { display: block; width: 100%; border-radius: var(--r-md); background: var(--surface-1); min-height: 120px; }
.satellite__hint { font-size: var(--text-xs); color: var(--ink-3); margin: var(--sp-3) 0 0; }

/* forecast-rain mini map (T-790) */
.rainmap__map { height: 260px; border-radius: var(--r-md); background: var(--surface-1); }
.rainmap__legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: var(--sp-3); font-size: var(--text-xs); color: var(--ink-2); }
.rainmap__legend-item { display: inline-flex; align-items: center; gap: 4px; }
.rainmap__swatch { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- Mirror table (the chart's WCAG twin) ---------- */

.table-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th, .table td {
  text-align: right;
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface-2);
  white-space: nowrap;
}
.table th:first-child, .table td:first-child { text-align: left; }
.table th {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.table tbody tr:hover { background: var(--surface-1); }

.link-button {
  background: none;
  border: none;
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 6px 0;
}
.link-button:hover { text-decoration: underline; }

/* ---------- AI chat ---------- */

.chat-button {
  position: fixed;
  right: 18px;
  bottom: 52px;
  z-index: 1200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--surface-0);
  border: none;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease);
}
.chat-button svg { width: 24px; height: 24px; }
.chat-button:hover { background: var(--brand-ink); }

.chat-window {
  position: fixed;
  right: 18px;
  bottom: 116px;
  z-index: 1200;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-window.open { display: flex; }
.chat-window__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  font-size: 14px;
}
.chat-window__top svg { width: 17px; height: 17px; color: var(--brand); }
.chat-window__close { margin-left: auto; background: none; border: none; color: var(--ink-3); font-size: 1.2rem; line-height: 1; }
.chat-window__notice { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.chat-msg--me { align-self: flex-end; background: var(--brand); color: var(--surface-0); border-bottom-right-radius: 4px; }
.chat-msg--ai { align-self: flex-start; background: var(--surface-1); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg--thinking { color: var(--ink-3); font-style: italic; }
.chat-form { display: flex; gap: var(--sp-2); padding: 12px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink);
  border-radius: var(--r-full);
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
}
.chat-form input:focus { border-color: var(--brand); background: var(--surface-0); outline: none; }
.chat-form button {
  background: var(--brand);
  border: none;
  color: var(--surface-0);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-form button svg { width: 17px; height: 17px; }

/* ---------- Institutional pages (/products, /company, /contact) ---------- */

.institutional-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface-1); }
.institutional { width: 100%; max-width: 880px; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-7); flex: 1; }
.institutional h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; margin: 0 0 var(--sp-2); }
.institutional h2 { font-size: var(--text-xl); letter-spacing: -0.01em; margin: var(--sp-6) 0 var(--sp-3); }
.institutional p, .institutional li { color: var(--ink-2); max-width: 64ch; }
.institutional b { color: var(--ink); }
.institutional .intro { font-size: var(--text-lg); margin: 0 0 var(--sp-5); }

.card {
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.card__title {
  margin: 0 0 var(--sp-2);
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); margin: var(--sp-5) 0; }
.card-grid .card p { font-size: var(--text-sm); margin: var(--sp-2) 0 0; }
.card-grid .card ul { font-size: var(--text-sm); margin: var(--sp-2) 0 0; padding-left: 1.1rem; }
.card-grid .card li { margin: 2px 0; }
.card--featured { border-color: var(--brand); box-shadow: var(--shadow-md); }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--brand);
  background: var(--brand-tint);
  border-radius: var(--r-full);
  padding: 3px 10px;
  margin-bottom: var(--sp-2);
}

.institutional-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-0);
  padding: var(--sp-4);
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .header { gap: var(--sp-2); }
  .header__nav { gap: var(--sp-2); font-size: 13px; }
  .header__cta { font-size: 12px; padding: 7px 11px; }
  .summary { max-width: 200px; padding: 10px 12px; }
  .stat-tile__value { font-size: 18px; }
}
