:root {
  color-scheme: light;
  --ink: #15202b;
  --muted: #5b6570;
  --line: #d9dee5;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --green: #11865a;
  --red: #bd2e3a;
  --blue: #1f5f9e;
  --gold: #a66b00;
  --shadow: 0 16px 40px rgba(21, 32, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 95, 158, 0.12), transparent 35%),
    linear-gradient(315deg, rgba(166, 107, 0, 0.12), transparent 32%),
    #edf1f5;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.summary-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 34px;
  color: #fff;
  background: #172535;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: #9dd2ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 6vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: #d5dee8;
  font-size: 1.05rem;
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 14px 16px;
  color: #e8eef5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.ok {
  background: #35d78a;
}

.status-dot.error {
  background: #ff6772;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric,
.controls,
.details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(21, 32, 43, 0.07);
}

.metric {
  min-height: 150px;
  padding: 20px;
}

.metric.primary {
  grid-column: span 2;
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 3vw, 2.75rem);
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.negative {
  color: var(--red);
}

.positive {
  color: var(--green);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 18px;
}

.controls,
.details {
  padding: 22px;
}

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus {
  outline: 3px solid rgba(31, 95, 158, 0.2);
  border-color: var(--blue);
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

button {
  min-height: 42px;
  padding: 0 14px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

.icon-button {
  display: inline-grid;
  width: 42px;
  padding: 0;
  place-items: center;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, auto);
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:first-child {
  padding-top: 0;
}

.detail-row span {
  color: var(--muted);
  font-weight: 750;
}

.detail-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.source-copy,
.fine-print {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.source-copy a {
  color: var(--blue);
  font-weight: 800;
}

.fine-print {
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .summary-band,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .status-panel {
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric.primary {
    grid-column: span 2;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .summary-band {
    padding: 22px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric.primary {
    grid-column: span 1;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .detail-row strong {
    text-align: left;
  }
}
