:root {
  --bg-1: #f7faf8;
  --bg-2: #e7f2ee;
  --bg-3: #dbe8e4;
  --panel: rgba(255, 255, 255, 0.9);
  --border: rgba(177, 207, 221, 0.84);
  --text: #13342e;
  --muted: #4d6862;
  --accent: #0d8c74;
  --accent-2: #3e6cae;
  --warn-bg: #fff8ef;
  --warn-border: #ecd9bd;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(244, 253, 255, 0.98) 0%, rgba(244, 253, 255, 0) 45%),
    radial-gradient(circle at 86% 8%, rgba(217, 238, 249, 0.78) 0%, rgba(217, 238, 249, 0) 34%),
    linear-gradient(145deg, #edf7f4 0%, #dfefea 54%, #d7e8e4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 28%, rgba(15, 130, 108, 0.11) 0%, rgba(15, 130, 108, 0) 42%),
    radial-gradient(circle at 78% 22%, rgba(40, 100, 170, 0.12) 0%, rgba(40, 100, 170, 0) 44%),
    repeating-linear-gradient(117deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 13px);
}

body::after {
  content: "";
  position: fixed;
  inset: -14%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 65% 38%, rgba(255, 255, 255, 0.64) 0%, rgba(255, 255, 255, 0) 56%),
    radial-gradient(circle at 34% 72%, rgba(14, 107, 90, 0.14) 0%, rgba(14, 107, 90, 0) 46%);
  filter: blur(16px);
}

.layout {
  max-width: 1420px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 14px 28px rgba(13, 52, 66, 0.08);
  backdrop-filter: blur(4px);
}

.hero {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  background:
    linear-gradient(125deg, rgba(13, 140, 116, 0.09), rgba(13, 140, 116, 0.01) 55%),
    linear-gradient(300deg, rgba(62, 108, 174, 0.09), rgba(62, 108, 174, 0.01) 52%),
    var(--panel);
}

.hero h1 {
  margin: 4px 0 6px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--accent);
  color: #0a6f5a;
  background: linear-gradient(180deg, #ffffff, #f2fbf8);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 108, 93, 0.16);
  background: linear-gradient(180deg, #ffffff, #e9f8f2);
}

.status[data-kind="loading"] {
  color: #215c8f;
}

.status[data-kind="error"] {
  color: #a02e2e;
}

.status[data-kind="success"] {
  color: #126a54;
}

.selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 700;
}

.field select {
  border: 1px solid #bfd7cf;
  border-radius: 10px;
  padding: 8px;
  font: inherit;
  background: #ffffff;
}

.year-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.year-picker-row select {
  flex: 1 1 180px;
  min-width: 140px;
}

.year-picker-row .btn {
  padding: 7px 10px;
}

.year-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 30px;
}

.year-chip {
  border: 1px solid #b9d6ce;
  color: #0f6f5a;
  background: #effaf6;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.year-chip:hover {
  background: #e5f5ef;
}

.chip-empty {
  color: var(--muted);
  font-size: 12px;
}


.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.warn {
  font-size: 14px;
}

.warn details {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  padding: 8px 10px;
}

.warn summary {
  cursor: pointer;
  font-weight: 700;
}

.warn ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-panel {
  border: 1px solid #d5e4de;
  border-radius: 14px;
  padding: 10px;
  min-height: 380px;
  background:
    linear-gradient(180deg, rgba(13, 140, 116, 0.03), rgba(13, 140, 116, 0)),
    #ffffff;
  box-shadow: 0 8px 16px rgba(20, 66, 88, 0.08);
}

.plot {
  width: 100%;
  min-height: 340px;
}

#intraChart.plot {
  min-height: 680px;
}

.empty-note {
  border: 1px dashed #b3c8c2;
  border-radius: 10px;
  padding: 18px;
  color: #4e6862;
  font-size: 14px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.details-summary {
  cursor: pointer;
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #173d35;
}

.table-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  margin-top: 10px;
}

.ice-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 980px;
}

.ice-table th,
.ice-table td {
  border: 1px solid #d3e2dd;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.ice-table th {
  background: #eff6f3;
  font-weight: 700;
}

.help-box {
  margin-top: 10px;
  background:
    linear-gradient(180deg, rgba(61, 109, 173, 0.08), rgba(61, 109, 173, 0.02)),
    #f7fcfa;
  border: 1px solid #d2e3dd;
  border-radius: 10px;
  padding: 10px;
  color: #3f5f58;
  font-size: 13px;
}

.external-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.external-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.external-card {
  border: 1px solid #d3e2dd;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: 0 8px 18px rgba(18, 60, 52, 0.07);
}

.external-card h3 {
  margin: 0;
  padding: 10px 12px 0;
  font-size: 16px;
}

.external-card .meta {
  margin: 0;
  padding: 3px 12px 10px;
  color: var(--muted);
  font-size: 12px;
}

.external-card img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  border-top: 1px solid #e2ece9;
  border-bottom: 1px solid #e2ece9;
  background: #f6faf8;
}

.external-card .actions {
  padding: 10px 12px;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1120px) {
  .selectors,
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .external-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .layout {
    padding: 12px;
  }
  .plot {
    min-height: 300px;
  }
  #intraChart.plot {
    min-height: 440px;
  }
}
