/* Soccer Travel Hotels — dashboard panel */
:root {
  --map-bg: #dfe5ec;
  --panel: #fafbfc;
  --panel-elevated: #ffffff;
  --panel-border: #e2e8f0;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-muted: rgba(15, 118, 110, 0.1);
  --text: #1e293b;
  --muted: #64748b;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 12px 24px -4px rgba(15, 23, 42, 0.1);
  --radius: 14px;
  --radius-sm: 8px;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#map {
  height: 100%;
  width: 100%;
  background: var(--map-bg);
}

a {
  text-decoration: none;
  color: inherit;
}

/* Tabular / professional numerals */
.num,
.stat-card .val,
.coords-display,
.sub-metrics .v,
.mini-table td:nth-child(2),
.mini-table td:nth-child(3) {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

#controls {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(460px, calc(100vw - 28px));
  max-height: min(94vh, 960px);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 1000;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

#controls::-webkit-scrollbar {
  width: 6px;
}
#controls::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.panel-inner {
  padding: 1rem 1.1rem 1.05rem;
}

/* Header */
.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--panel-border);
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-kicker {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.2rem;
}

.brand-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-sub {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.back-link {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  margin-top: 0.35rem;
}
.back-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Year + focus */
.panel-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

#yearSelect {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-elevated);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
}

.hotel-jump-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

#hotelJump {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-elevated);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
}

.btn-clear-hotel {
  flex: 0 0 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-elevated);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-clear-hotel:hover {
  color: var(--text);
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.btn-clear-hotel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#yearSelect:focus,
#hotelJump:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.stat-card {
  background: var(--panel-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  text-align: center;
  min-width: 0;
}

.stat-card .val {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.stat-card .lbl {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.2rem;
}

.stat-card.highlight {
  background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
  border-color: #fde68a;
}
.stat-card.highlight .val {
  color: #b45309;
}

.sub-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.55rem;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}

.sub-metrics .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.sub-metrics .k {
  color: var(--muted);
  font-weight: 500;
}
.sub-metrics .v {
  color: var(--text);
  font-weight: 500;
  font-size: 0.8125rem;
  text-align: right;
}

.insights-block {
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.55rem;
  background: var(--panel-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text);
}
.insights-block strong {
  font-weight: 600;
  color: var(--text);
}
.insights-block .muted {
  color: var(--muted);
  font-weight: 400;
}

.section-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.mini-table-wrap {
  margin-bottom: 0.65rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel-elevated);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.mini-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.6rem;
  padding: 0.35rem 0.45rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--panel-border);
}

.mini-table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  line-height: 1.35;
}

.mini-table tr:last-child td {
  border-bottom: none;
}

.mini-table .hotel-cell {
  font-weight: 500;
  color: var(--text);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purpose-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  margin-bottom: 0.65rem;
}

.purpose-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.purpose-list li:last-child {
  border-bottom: none;
}
.purpose-list .p-name {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.purpose-list .p-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.7rem;
}

/* Charts */
.charts-section {
  margin-top: 0.15rem;
}

.chart-box {
  position: relative;
  background: var(--panel-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  padding: 0.25rem 0.35rem;
}

.chart-box-main {
  height: 150px;
  margin-bottom: 0.45rem;
}
.chart-box-main.tall {
  height: 180px;
}

.chart-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.chart-grid-captions {
  margin-bottom: 0.1rem;
}
.chart-grid-captions .chart-caption {
  margin: 0;
  min-width: 0;
  font-size: 0.62rem;
  line-height: 1.3;
}

.chart-box-split {
  height: 200px;
  margin-bottom: 0;
  min-width: 0;
}

.chart-caption {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 0.25rem;
  font-weight: 500;
}

@media (max-width: 420px) {
  .chart-grid-row {
    grid-template-columns: 1fr;
  }
  .chart-box-split {
    height: 200px;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--sans);
  color: var(--text);
  background: var(--panel-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.footer-hint {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--panel-border);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 0.5rem 1rem;
  background: var(--text);
  color: #fff;
  font-size: 0.8125rem;
  font-family: var(--sans);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 2000;
  transition: opacity 0.2s, transform 0.2s;
  max-width: min(90vw, 360px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Popup */
.leaflet-popup-content-wrapper {
  width: min(360px, 92vw);
  background: var(--panel-elevated) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow) !important;
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-tip {
  background: var(--panel-elevated) !important;
  border: 1px solid var(--panel-border);
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 100% !important;
}

.popHotelInfo {
  padding: 0.75rem 0.85rem;
}

.popHotelInfo h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
  line-height: 1.3;
  color: var(--text);
}

.pop-address {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

.HotelImg {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  border: 1px solid var(--panel-border);
}

.HotelInfoItem {
  list-style: none;
  padding: 0;
  margin: 0;
}

.HotelInfoItem li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
  font-size: 0.75rem;
  color: var(--text);
  padding: 0.3rem 0.45rem;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.HotelInfoItem hr {
  border: none;
  height: 1px;
  background: var(--panel-border);
  margin: 0.45rem 0 0.35rem;
}

.HotelInfoItem b {
  color: var(--accent);
  font-weight: 600;
}

.HotelInfoItem .amt {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* Leaflet */
.leaflet-bar a {
  background: var(--panel-elevated) !important;
  color: var(--text) !important;
  border-color: var(--panel-border) !important;
}
.leaflet-bar a:hover {
  background: var(--accent-muted) !important;
  color: var(--accent) !important;
}
.leaflet-control-layers {
  background: var(--panel-elevated) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
}
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--muted) !important;
  font-size: 0.65rem !important;
  max-width: 50vw;
}
.leaflet-control-attribution a {
  color: var(--accent) !important;
}

.coords-display {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  background: var(--panel-elevated) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--muted) !important;
  box-shadow: var(--shadow);
}

.counter_center {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px;
}

@media (max-width: 540px) {
  #controls {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 58vh;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sub-metrics {
    grid-template-columns: 1fr;
  }
}
