:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #dce3ea;
  --text: #1f2a37;
  --muted: #5f6b7a;
  --accent: #0f766e;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px 1fr;
}

.app__sidebar {
  border-right: 1px solid var(--border);
  background:
    radial-gradient(circle at 8% 4%, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #f6fbfd 0%, #f2f6fb 100%);
  padding: 18px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  font-weight: 800;
  color: #0b5f59;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #cfe4e8;
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfb 100%);
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.08);
}

.brand i {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, #0f766e 0%, #0ea5a0 100%);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 8px 8px;
  border-radius: 12px;
  border: 1px solid #d6e3ee;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.sidebar-nav::before {
  content: "Contents";
  margin: 0 6px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar-nav__link {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 10px 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-nav__link::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #9aa8b8;
  transition: background-color 0.2s ease;
}

.sidebar-nav__link.is-active,
.sidebar-nav__link:hover {
  color: #0b5f59;
  border-color: #cae0e4;
  background: #eef7f8;
  transform: translateX(2px);
}

.sidebar-nav__link:hover::before {
  background: #0f766e;
}

.sidebar-nav__link.is-active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f766e 0%, #0a8f87 100%);
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.28);
}

.sidebar-nav__link.is-active::before {
  background: rgba(255, 255, 255, 0.88);
}

.sidebar-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d4e1ec;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  font-size: 0.85rem;
  color: #4f6177;
}

.sidebar-status i {
  color: #0f766e;
}

.main {
  padding: 16px;
  max-width: 1400px;
  width: 100%;
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid #cfe0ec;
  border-radius: 14px;
  background:
    radial-gradient(circle at 85% 15%, rgba(14, 165, 160, 0.18), rgba(255, 255, 255, 0) 36%),
    linear-gradient(180deg, #ffffff 0%, #f5f9fd 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(180deg, #0f766e 0%, #0ea5a0 100%);
}

.hero__copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero__eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f766e;
}

.hero h1 {
  margin: 0;
  font-size: 1.72rem;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 6px 0 0;
  color: #4f6177;
  max-width: 65ch;
}

.hero__meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 230px;
}

.pill {
  display: inline-flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid #d6e2ec;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.8rem;
  color: #5d6c7f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.pill strong {
  color: #172331;
  font-size: 0.83rem;
  font-weight: 700;
  margin-left: 2px;
}

.banner {
  border: 1px solid #f4d58d;
  background: #fff9e6;
  color: #8a6200;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.state--loading { background: #eef7ff; color: #0b4f85; }
.state--error { background: #fff1f2; color: #9f1239; }
.is-hidden { display: none !important; }

.section {
  margin-bottom: 16px;
}

.section__head {
  margin-bottom: 8px;
}

.section__head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.section__head p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.section__head--split {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.time-toggle {
  border: 1px solid #d6e3ee;
  border-radius: 10px;
  margin: 0;
  padding: 6px 8px 7px;
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.95);
}

.time-toggle legend {
  padding: 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.time-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3f4d5d;
  font-weight: 600;
}

.trend-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trend-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trend-action-btn {
  border: 1px solid #cddbe7;
  border-radius: 8px;
  background: #ffffff;
  color: #244057;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.trend-action-btn:hover {
  background: #eef7f8;
  border-color: #9fc6cf;
  color: #0b5f59;
}

.trend-action-btn:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 1px;
}

.trend-feedback {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #d5e3ee;
  border-radius: 10px;
  background: #f8fcff;
}

.trend-feedback__line {
  margin: 0;
  font-size: 0.82rem;
  color: #1f3347;
}

.trend-feedback__line + .trend-feedback__line {
  margin-top: 4px;
}

.trend-feedback__hint {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.discipline-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.discipline-control__select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
  min-width: 220px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 112px;
}

.kpi-card h3 {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}

.kpi-card__value {
  margin: 8px 0 6px;
  font-size: 1.3rem;
  font-weight: 700;
}

.kpi-card__reason {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.kpi-card__action {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.kpi-card__action:hover {
  background: #e7f5f3;
}

.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.chart-grid--single {
  grid-template-columns: 1fr;
}

.shared-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
}

.shared-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.shared-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.about-copy {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.about-copy p {
  margin: 0 0 10px;
}

.about-list {
  margin: 0;
  padding-left: 18px;
}

.about-list li {
  margin: 0 0 7px;
  color: var(--muted);
}

.panel__body {
  height: 220px;
  border: 1px dashed #c9d4df;
  border-radius: 10px;
  background: #fbfdff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel__body--map { height: 280px; }
.panel__body--list { align-items: start; justify-content: stretch; padding: 8px; }
.panel__body--spotlight {
  height: auto;
  min-height: 220px;
  align-items: stretch;
  justify-content: stretch;
  padding: 12px;
}

#discipline-latest-panel,
#discipline-overall-panel {
  height: 300px;
}

.spotlight-card {
  width: 100%;
  display: grid;
  gap: 8px;
  color: var(--text);
}

.spotlight-card__eyebrow {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.spotlight-card__title {
  margin: 0;
  font-size: 1rem;
}

.spotlight-card__org {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.spotlight-card__meta {
  margin: 2px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.spotlight-card__meta dt {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.spotlight-card__meta dd {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--text);
}

.spotlight-card__footnote {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.rank-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rank-list__item {
  border: 1px solid #d6e0ea;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  padding: 8px 10px;
}

.rank-list__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.rank-list__badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7f5f3;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
}

.rank-list__state {
  min-width: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list__count {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.rank-list__track {
  margin-top: 7px;
  height: 6px;
  border-radius: 999px;
  background: #e9eef4;
  overflow: hidden;
}

.rank-list__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e 0%, #22a57f 100%);
}

.rank-list__meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.rank-list__empty {
  color: var(--muted);
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
}

.table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px dashed #c9d4df;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  text-align: left;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app__sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    padding: 12px;
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    align-items: center;
    gap: 6px;
  }
  .sidebar-nav::before { display: none; }
  .sidebar-nav__link {
    white-space: nowrap;
    transform: none !important;
  }
  .main { padding: 12px; }
  .hero {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .hero::after {
    width: 100%;
    height: 4px;
  }
  .hero h1 { font-size: 1.45rem; }
  .hero__meta {
    min-width: 0;
    width: 100%;
    align-items: stretch;
  }
  .section__head--split {
    flex-direction: column;
    align-items: stretch;
  }
  .trend-controls {
    justify-content: flex-start;
  }
  .trend-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .discipline-control__select { min-width: 0; width: 100%; }
  .kpi-grid,
  .kpi-grid--three { grid-template-columns: 1fr; }
  .spotlight-card__meta { grid-template-columns: 1fr; }
  #discipline-latest-panel,
  #discipline-overall-panel { height: 260px; }
}
