:root {
  --ink: #07304a;
  --muted: #536f6e;
  --paper: #f7f7f0;
  --panel: rgba(255, 255, 250, 0.92);
  --line: rgba(7, 48, 74, 0.16);
  --water: #2d9fbd;
  --water-dark: #07304a;
  --forest: #174d2d;
  --algae: #7fa158;
  --foam: #dff3f6;
  --clay: #8c9d42;
  --danger: #a83b32;
  --shadow: 0 24px 70px rgba(7, 48, 74, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(127, 161, 88, 0.34), transparent 28rem),
    radial-gradient(circle at 92% 2%, rgba(45, 159, 189, 0.24), transparent 34rem),
    linear-gradient(135deg, #fbfaf4 0%, #edf5df 46%, #e1f3f5 100%);
  font-family: "Aptos", "Trebuchet MS", sans-serif;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--water), var(--water-dark));
  padding: 0.82rem 1.1rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(15, 66, 73, 0.2);
}

.secondary-button {
  margin-top: 0.8rem;
  background: var(--forest);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  background: var(--danger);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #fff;
  box-shadow: none;
}

#importData,
.file-button input {
  display: none;
}

.hero {
  color: #fff;
  padding: 2rem clamp(1rem, 4vw, 4rem) 3.5rem;
  background:
    radial-gradient(circle at 78% 5%, rgba(127, 161, 88, 0.44), transparent 24rem),
    linear-gradient(120deg, rgba(7, 48, 74, 0.98), rgba(18, 92, 111, 0.92)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 14px);
  border-bottom-left-radius: 48px;
  border-bottom-right-radius: 48px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: flex-end;
}

.brand-lockup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.brand-logo {
  width: clamp(96px, 13vw, 168px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.45rem;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--algae);
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, Cambria, serif;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 5.6rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.25rem);
}

.hero-copy {
  max-width: 860px;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.84);
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 800;
}

.sync-status.online {
  background: rgba(127, 161, 88, 0.24);
}

.sync-status.offline {
  background: rgba(168, 59, 50, 0.26);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.metric-card {
  padding: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.17), rgba(223, 243, 246, 0.08));
  backdrop-filter: blur(10px);
}

.metric-card strong {
  display: block;
  font-size: clamp(1.45rem, 3vw, 2.4rem);
  font-family: Georgia, Cambria, serif;
}

.metric-card span {
  color: rgba(255, 255, 255, 0.76);
}

.shell {
  width: min(1480px, calc(100% - 2rem));
  margin: -2rem auto 4rem;
}

.grid {
  display: grid;
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 30px;
  padding: clamp(1rem, 2vw, 1.6rem);
  box-shadow: var(--shadow);
}

.wide {
  min-height: 260px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-heading p:last-child {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.45;
}

.section-heading.compact {
  align-items: flex-start;
}

.form-card {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.38rem;
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0.82rem 0.9rem;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--water);
  box-shadow: 0 0 0 4px rgba(28, 109, 120, 0.14);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.compact-table {
  margin-top: 1rem;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.compact-table table {
  min-width: 680px;
}

.compact-table th {
  position: sticky;
  top: 0;
  background: rgba(247, 247, 240, 0.96);
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td strong {
  display: block;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(127, 161, 88, 0.2);
  color: var(--forest);
  padding: 0.22rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 900;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.split-target {
  border: 1px dashed rgba(28, 109, 120, 0.38);
  border-radius: 22px;
  padding: 0.9rem;
}

.split-target legend {
  padding: 0 0.35rem;
  color: var(--water-dark);
  font-weight: 900;
}

.target-form {
  display: grid;
  gap: 0.9rem;
}

.year-picker {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  color: var(--muted);
  font-size: 0.88rem;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
  align-items: end;
}

.correction-fields {
  display: grid;
  gap: 0.9rem;
}

.annual-metrics {
  margin-top: 0.5rem;
}

.result-card {
  margin-top: 1rem;
  border-radius: 22px;
  background: rgba(28, 109, 120, 0.08);
  border: 1px solid rgba(28, 109, 120, 0.16);
  padding: 1rem;
  line-height: 1.55;
}

.result-card strong {
  color: var(--water-dark);
}

.source-note {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.timeline {
  display: grid;
  gap: 0.8rem;
  max-height: 460px;
  overflow: auto;
}

.event {
  border-left: 4px solid var(--clay);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  padding: 0.85rem 1rem;
}

.event strong {
  display: block;
}

.empty {
  padding: 1rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 18px;
}

@media (max-width: 1020px) {
  .metrics,
  .grid.two,
  .annual-metrics,
  .inline-form,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    display: grid;
  }

  .brand-lockup {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .hero {
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
  }

  .shell {
    width: min(100% - 1rem, 1480px);
  }

  .panel {
    border-radius: 22px;
  }
}
