:root {
  --bg: #eaf6fb;
  --card: #ffffff;
  --card-soft: #f3fbff;
  --ink: #12384d;
  --ink-soft: #4f6b7d;
  --teal: #0d86a4;
  --teal-deep: #08607b;
  --mint: #53c8b2;
  --line: rgba(12, 76, 104, 0.2);
  --warn: #a33327;
  --ok: #0f7a55;
  --loading: #a06a16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 6% 8%, rgba(83, 200, 178, 0.28), transparent 46%),
    radial-gradient(ellipse at 100% 12%, rgba(13, 134, 164, 0.18), transparent 42%),
    linear-gradient(170deg, #eef9fd 0%, var(--bg) 42%, #f5fbff 100%);
  min-height: 100vh;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 18px 32px;
}

h1,
h2,
h3 {
  font-family: "Fraunces", "Georgia", serif;
}

.hero {
  position: relative;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(120deg, rgba(8, 62, 84, 0.95), rgba(10, 93, 122, 0.94));
  color: #ecfcff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 36px rgba(7, 53, 77, 0.18);
  margin-bottom: 16px;
}

.hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -110px;
  bottom: -130px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(83, 200, 178, 0.5), transparent 72%);
  pointer-events: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 232px;
  max-width: 46vw;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: #a6efe2;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.06;
}

.subtitle {
  margin: 9px 0 0;
  max-width: 760px;
  color: #d3eef5;
  line-height: 1.42;
}

.hero-note {
  margin: 8px 0 0;
  color: #c4e9f2;
  font-size: 0.9rem;
}

.hero-links {
  margin: 10px 0 0;
}

.hero-links a {
  color: #baf7ea;
  text-decoration: none;
  font-weight: 600;
}

.hero-links a:hover {
  text-decoration: underline;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.6fr);
  gap: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 14px 28px rgba(13, 75, 103, 0.1);
}

.form-panel {
  align-self: start;
  position: sticky;
  top: 16px;
  background: linear-gradient(180deg, #ffffff, #f7fdff 52%);
}

h2 {
  margin: 0 0 10px;
  font-size: 1.38rem;
}

label,
legend {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input[type="text"],
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 0.96rem;
  color: var(--ink);
  background: #fff;
}

input[type="text"]:focus,
select:focus {
  outline: 2px solid rgba(13, 134, 164, 0.22);
  border-color: rgba(13, 134, 164, 0.5);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 14px 0 0;
  padding: 10px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}

.toggle-card:hover {
  border-color: rgba(13, 134, 164, 0.45);
  transform: translateY(-1px);
}

.toggle-card input {
  accent-color: var(--teal);
}

.checkbox-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.89rem;
}

button {
  margin-top: 16px;
  width: 100%;
  border: 0;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(92deg, var(--teal-deep), var(--teal));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

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

button:active {
  transform: translateY(1px);
}

.menu-button {
  margin-top: 8px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  font-weight: 700;
}

.menu-button:hover {
  border-color: rgba(13, 134, 164, 0.45);
}

.note {
  color: var(--ink-soft);
  font-size: 0.84rem;
  margin-top: 12px;
}

.results-panel {
  background: linear-gradient(180deg, #ffffff, #f5fcff 62%);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.pill.idle {
  background: #e9f3fa;
  color: #466177;
}

.pill.loading {
  background: #fff1da;
  color: var(--loading);
}

.pill.ready {
  background: #d8f6ea;
  color: var(--ok);
}

.pill.error {
  background: #ffe9e7;
  color: var(--warn);
}

.empty-state {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.hidden {
  display: none;
}

.error-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(163, 51, 39, 0.34);
  background: #fff2f1;
  border-radius: 12px;
  color: var(--warn);
}

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

.kpi {
  background: linear-gradient(180deg, #ffffff, #f1fbff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}

.kpi-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.kpi-value {
  margin: 6px 0 0;
  font-size: 1.16rem;
  font-weight: 700;
  font-family: "Fraunces", "Georgia", serif;
}

.split-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.subpanel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--card-soft);
}

h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.summary-list li {
  margin-bottom: 6px;
  font-size: 0.91rem;
  line-height: 1.42;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  vertical-align: top;
}

thead th {
  color: #4f6a7f;
  font-weight: 700;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero,
.panel {
  animation: liftIn 560ms ease both;
}

.panel:nth-of-type(1) {
  animation-delay: 70ms;
}

.panel:nth-of-type(2) {
  animation-delay: 130ms;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1020px) {
  .brand-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-logo {
    width: 204px;
    max-width: 74vw;
  }

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

  .form-panel {
    position: static;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

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

@media (prefers-reduced-motion: reduce) {
  .hero,
  .panel {
    animation: none;
  }
}
