:root {
  --panel: #ffffff;
  --text: #0f1f2f;
  --muted: #4d6176;
  --accent: #0a7fa6;
  --shadow: 0 14px 35px rgba(17, 40, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 10%, rgba(10, 127, 166, 0.2), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(255, 170, 105, 0.2), transparent 35%),
    linear-gradient(160deg, #f7fbff 0%, #e7f0fa 50%, #e5f5fb 100%);
}

.app-shell {
  flex: 1 0 auto;
  width: min(1000px, 92vw);
  margin: 2.5rem auto;
  display: grid;
  gap: 1.2rem;
  align-content: start;
}

.hero,
.search-card,
.gauge-card,
.forecast-card {
  background: color-mix(in oklab, var(--panel) 95%, #f4f9ff);
  border: 1px solid #dbe6f2;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 1.4rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
}

.hero-logo {
  display: block;
  width: clamp(64px, 12vw, 90px);
  height: auto;
  margin: 0;
}

.hero-text {
  min-width: 0;
}

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

h1 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.hero-copy {
  margin: 0.55rem 0 0;
  color: var(--muted);
  max-width: 60ch;
}

.search-card,
.gauge-card,
.forecast-card {
  padding: 1.2rem 1.5rem;
}

.search-form {
  display: grid;
  gap: 0.55rem;
}

.search-form label {
  font-weight: 700;
}

.input-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.input-wrap {
  flex: 1;
  position: relative;
}

input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid #c5d5e6;
  font-size: 1rem;
  color: var(--text);
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), white 15%);
  outline-offset: 2px;
}

.suggestion-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #cfe0f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(20, 44, 71, 0.15);
  z-index: 5;
}

.suggestion-list button {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.65rem;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  background: transparent;
  color: var(--text);
}

.suggestion-list button:hover,
.suggestion-list button.active {
  background: #e7f5ff;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  background: linear-gradient(140deg, #05668d, #00a5cf);
  color: white;
  cursor: pointer;
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

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

.results {
  display: grid;
  gap: 1.2rem;
}

.site-footer {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid #dbe6f2;
  background: color-mix(in oklab, var(--panel) 92%, #eff6ff);
}

.site-footer-inner {
  width: min(1000px, 92vw);
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.footer-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.footer-text {
  min-width: 0;
}

.footer-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.92rem;
}

.footer-copy {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-link {
  color: #0a6c8e;
  font-weight: 700;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}

.gauge-card h2,
.forecast-card h3,
.chart-block h4 {
  margin: 0;
}

#decision-window,
.forecast-card p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.gauge-wrap {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.gauge-box {
  position: relative;
  width: min(440px, 82vw);
}

.semi-gauge {
  width: 100%;
  display: block;
}

.gauge-track,
.gauge-progress {
  fill: none;
  stroke-width: 20;
  stroke-linecap: round;
}

.gauge-track {
  stroke: #dce7f3;
}

.gauge-progress {
  stroke: url(#gaugeGradient);
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.4s ease;
}

.semi-gauge defs {
  display: block;
}

.gauge-value {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: grid;
  gap: 0.2rem;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  color: #5f7286;
  font-size: 0.8rem;
  margin-top: -2px;
}

#gauge-percent {
  font-size: clamp(2rem, 5.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
}

.risk-chip {
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
  width: fit-content;
  margin: 0.15rem auto 0;
  background: #edf2ff;
}

.key-metrics {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
}

.metric {
  border-radius: 14px;
  border: 1px solid #d8e6f4;
  background: #f7fbff;
  padding: 0.7rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.metric-copy {
  min-width: 0;
}

.metric-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.metric-value {
  font-size: 1.05rem;
}

.metric-icon {
  width: 34px;
  height: 34px;
  color: #0b7da4;
  flex: 0 0 auto;
}

.metric-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2.1;
}

.chart-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.chart-block {
  border-radius: 14px;
  border: 1px solid #d8e6f4;
  background: #f7fbff;
  padding: 0.9rem;
}

.chart-shell {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 0.55rem;
}

.y-axis {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
}

.y-axis-title {
  font-size: 0.74rem;
  color: #5f7286;
  font-weight: 700;
  line-height: 1.15;
}

.y-axis-ticks {
  height: 172px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.72rem;
  color: #6b7f94;
  padding-right: 4px;
}

.plot-area {
  position: relative;
}

.bar-chart {
  height: 172px;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
  padding: 0.25rem 0 0.15rem;
  border-left: 1px solid #d7e5f5;
  border-bottom: 1px solid #d7e5f5;
}

.bar {
  border-radius: 6px 6px 3px 3px;
  position: relative;
  min-height: 5px;
  cursor: default;
  transition: filter 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.bar:hover {
  filter: brightness(0.9);
}

.bar.decision::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 3px;
  border-radius: 999px;
  background: #1c7ed6;
}

.x-axis {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 5px;
  margin-top: 0.3rem;
  color: #6b7f94;
  font-size: 0.74rem;
}

.x-axis span {
  text-align: center;
  min-height: 1rem;
}

.chart-tooltip {
  position: fixed;
  z-index: 30;
  max-width: 240px;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid #b8d4ec;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(28, 55, 82, 0.18);
  font-size: 0.8rem;
  color: #14324f;
  line-height: 1.3;
  pointer-events: none;
}

@media (max-width: 680px) {
  .app-shell {
    margin: 1.25rem auto;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .hero-logo {
    width: clamp(56px, 22vw, 84px);
  }

  .input-row {
    flex-direction: column;
  }

  button,
  .input-wrap {
    width: 100%;
  }

  .gauge-value {
    top: 58%;
  }

  .bar-chart {
    gap: 3px;
  }

  .x-axis {
    gap: 3px;
  }

  .chart-shell {
    grid-template-columns: 52px 1fr;
  }

  .y-axis-title {
    font-size: 0.68rem;
  }
}
