:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e2da;
  --paper: #fffcf8;
  --panel: #ffffff;
  --accent: #c45c26;
  --awarded: #c45c26;
  --open: #d4a017;
  --nobid: #8c6b63;
  --private: #4f6b8a;
  --unmarketed: #d9d3c7;
  --public: #ece8e1;
  --shadow: 0 8px 28px rgba(26, 26, 26, .08);
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}
html[dir="rtl"] body { font-family: Heebo, Assistant, sans-serif; }
#map { position: absolute; inset: 0; background: #d9e0e4; }
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(255,255,255,.85) !important; }
.maplibregl-ctrl-attrib a { color: #888; }
.maplibregl-ctrl-group { box-shadow: var(--shadow) !important; border: none !important; }
html[dir="rtl"] .maplibregl-ctrl-bottom-right { right: auto; left: 0; }
html[dir="rtl"] .maplibregl-ctrl-bottom-left { left: auto; right: 0; }

.panel {
  position: absolute; z-index: 1000;
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
#brand { top: 24px; left: 24px; padding: 20px 24px 18px; min-width: 260px; max-width: min(380px, calc(100vw - 48px)); }
html[dir="rtl"] #brand { left: auto; right: 24px; }
#brand h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; }
html[dir="rtl"] #brand h1 { letter-spacing: 0; }
#brand .count { margin-top: 8px; font-size: 13px; color: var(--muted); }
#brand .count strong { color: var(--ink); font-weight: 500; }
#brand .switch { margin-top: 10px; font-size: 13px; }
#brand .switch a { color: var(--accent); text-decoration: none; font-weight: 500; }
#brand .switch a:hover { text-decoration: underline; }
#brand .assumption {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.45;
}
.langs { display: flex; gap: 4px; margin-top: 12px; }
.langs button {
  font: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 3px 8px; cursor: pointer;
}
.langs button:hover { color: var(--ink); }
.langs button.is-on { color: var(--accent); border-color: var(--line); background: #fffcf8; }

#legend { bottom: 24px; left: 24px; padding: 16px 18px 14px; }
html[dir="rtl"] #legend { left: auto; right: 24px; }
#legend h2 {
  font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
html[dir="rtl"] #legend h2 { letter-spacing: 0.04em; }
#legend button, #legend .row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; background: none; border: 0;
  font: inherit; color: var(--ink); font-size: 13px;
  padding: 4px 0; cursor: pointer; text-align: start;
}
#legend .row { cursor: default; }
#legend button.is-off { opacity: .38; }
#legend i { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; border: 1px solid rgba(26,26,26,.12); }
i.awarded { background: var(--awarded); border-color: var(--awarded); }
i.open { background: var(--open); border-color: var(--open); }
i.no_bid { background: var(--nobid); border-color: var(--nobid); }
i.private { background: var(--private); border-color: var(--private); }
i.unmarketed { background: var(--unmarketed); }
i.public { background: var(--public); }

#card {
  top: 24px; right: 24px; width: 340px;
  max-height: calc(100vh - 48px); overflow: auto;
  padding: 22px 24px 24px; display: none;
}
html[dir="rtl"] #card { right: auto; left: 24px; }
#card.is-open { display: block; }
#card .close {
  float: right; border: 0; background: none;
  font-size: 22px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 0 8px 8px;
}
html[dir="rtl"] #card .close { float: left; padding: 0 8px 8px 0; }
#card .kicker {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 6px;
}
#card h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 4px; clear: both; }
html[dir="rtl"] #card h2 { letter-spacing: 0; }
#card .brand-name { font-size: 16px; font-weight: 500; margin: 0 0 14px; letter-spacing: -0.02em; }
#card .status-pill {
  display: inline-block; font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; margin: 0 0 16px;
}
html[dir="rtl"] #card .status-pill { letter-spacing: 0.02em; text-transform: none; }
.status-pill.awarded { background: #f8e8df; color: #9a3d12; }
.status-pill.open { background: #f8efd2; color: #7a5c00; }
.status-pill.no_bid { background: #eee6e4; color: #6a4e48; }
.status-pill.private { background: #e4ebf2; color: #334960; }
.status-pill.unmarketed, .status-pill.public { background: #f0ece6; color: #5c574e; }
#card dl { display: grid; gap: 12px; }
#card dt {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 2px;
}
html[dir="rtl"] #card dt { letter-spacing: 0.02em; text-transform: none; }
#card dd { font-size: 14px; line-height: 1.45; }
#card .note { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
#card .note.differ { color: #9a3d12; }
#card .sources { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.5; }

@media (max-width: 640px) {
  #brand { top: 12px; left: 12px; right: 12px; max-width: none; padding: 16px 18px 14px; }
  html[dir="rtl"] #brand { left: 12px; right: 12px; }
  #brand h1 { font-size: 22px; }
  #legend { left: 12px; bottom: 12px; padding: 10px 12px 8px; }
  html[dir="rtl"] #legend { left: 12px; right: 12px; }
  #legend h2 { margin-bottom: 6px; }
  #legend button, #legend .row { font-size: 12px; padding: 2px 0; }
  #card { top: auto; right: 12px; left: 12px; bottom: 12px; width: auto; max-height: 48vh; padding: 18px; }
  html[dir="rtl"] #card { left: 12px; right: 12px; }
  .maplibregl-ctrl-attrib { display: none; }
}
