:root {
  --ink: #173246;
  --muted: #5c6e79;
  --navy: #1d4863;
  --teal: #4f8aa5;
  --sand: #f6f0e6;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(34, 75, 105, 0.14);
  --success: #5f9a67;
  --error: #b85a44;
  --shadow: 0 22px 52px rgba(15, 36, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(242, 211, 162, 0.62), transparent 28%),
    radial-gradient(circle at 100% 10%, rgba(115, 164, 190, 0.32), transparent 24%),
    linear-gradient(180deg, #fbf7f1 0%, #f2efe9 100%);
  min-height: 100vh;
}

.page-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 18px auto 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  padding: 30px 30px 20px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: "Georgia", "Palatino Linotype", serif;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 1.02;
}

.lede {
  margin-top: 16px;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(20, 53, 73, 0.96), rgba(55, 117, 146, 0.92));
  border-radius: 28px;
  padding: 28px;
  min-height: 220px;
  box-shadow: var(--shadow);
  color: #fff;
}

.pulse-ring {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  right: -26px;
  top: -26px;
  animation: pulse 3.4s ease-in-out infinite;
}

.hero-card__content {
  position: relative;
  z-index: 1;
}

.hero-card__label {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.78;
}

.hero-card__value {
  margin: 0 0 10px;
  font-size: 1.7rem;
  line-height: 1.15;
  font-family: "Georgia", "Palatino Linotype", serif;
}

.hero-card__hint {
  margin: 0;
  max-width: 280px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

.workspace {
  display: grid;
  gap: 22px;
}

.upload-panel,
.status-panel,
.insight-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.upload-panel {
  padding: 26px;
}

.upload-form {
  display: grid;
  gap: 22px;
}

.drop-zone {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 180px;
  padding: 24px;
  border-radius: 24px;
  border: 2px dashed rgba(29, 72, 99, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(230, 241, 248, 0.75)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15) 12px, rgba(79, 138, 165, 0.05) 12px, rgba(79, 138, 165, 0.05) 24px);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  transform: translateY(-2px);
  border-color: rgba(29, 72, 99, 0.58);
  box-shadow: 0 18px 40px rgba(35, 89, 120, 0.14);
}

.drop-zone__icon {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(29, 72, 99, 0.95), rgba(96, 152, 178, 0.92));
  color: #fff;
  font-size: 2.3rem;
  font-weight: 300;
}

.drop-zone__content strong,
.drop-zone__content span,
.drop-zone__content small {
  display: block;
}

.drop-zone__content strong {
  font-size: 1.18rem;
}

.drop-zone__content span {
  margin-top: 8px;
  color: var(--muted);
}

.drop-zone__content small {
  margin-top: 12px;
  color: var(--teal);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 18px;
}

.field,
.switch-field {
  display: grid;
  gap: 10px;
}

.field span,
.switch-field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
}

.field input {
  border: 1px solid rgba(29, 72, 99, 0.14);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 1rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
  border-color: rgba(29, 72, 99, 0.4);
  box-shadow: 0 0 0 4px rgba(79, 138, 165, 0.12);
}

.toggle {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.toggle--on {
  background: rgba(95, 154, 103, 0.15);
  color: #31613a;
}

.toggle--off {
  background: rgba(184, 90, 68, 0.12);
  color: #8e3f2f;
}

.toggle:hover {
  transform: translateY(-1px);
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-button,
.download-button {
  border: 0;
  border-radius: 18px;
  padding: 15px 22px;
  background: linear-gradient(145deg, var(--navy), #3f7c9b);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(29, 72, 99, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button:hover,
.download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(29, 72, 99, 0.28);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.file-chip {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(79, 138, 165, 0.12);
  color: var(--navy);
  font-weight: 700;
}

.status-panel {
  padding: 24px;
}

.state-card {
  position: relative;
  min-height: 190px;
  border-radius: 22px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(243, 248, 251, 0.9));
  border: 1px solid rgba(29, 72, 99, 0.08);
}

.state-card[hidden] {
  display: none;
}

.state-card__title {
  margin: 0 0 10px;
  font-size: 1.3rem;
  font-family: "Georgia", "Palatino Linotype", serif;
}

.state-card__text {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.progress-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid rgba(79, 138, 165, 0.14);
  border-top-color: var(--teal);
  margin-bottom: 18px;
  animation: spin 1s linear infinite;
}

.progress-bar {
  width: min(420px, 100%);
  height: 12px;
  margin-top: 20px;
  background: rgba(29, 72, 99, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar__fill {
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #87b8d0);
  transition: width 280ms ease;
}

.success-mark {
  position: relative;
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
}

.success-mark__circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(95, 154, 103, 0.18), rgba(95, 154, 103, 0.02));
  animation: pulse 1.8s ease-in-out infinite;
}

.success-mark__check {
  position: absolute;
  left: 24px;
  top: 18px;
  width: 20px;
  height: 38px;
  border-right: 6px solid var(--success);
  border-bottom: 6px solid var(--success);
  transform: rotate(42deg);
}

.download-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.download-button--secondary {
  background: rgba(29, 72, 99, 0.08);
  color: var(--navy);
  box-shadow: none;
}

.state-card--error {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255, 240, 236, 0.96));
}

.state-card--error .state-card__title {
  color: #8b3f2f;
}

.insight-panel {
  padding: 24px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-tile {
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(238,245,249,0.92));
  border: 1px solid rgba(29, 72, 99, 0.08);
}

.metric-tile span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.metric-tile strong {
  display: block;
  margin-top: 12px;
  font-size: 1.25rem;
  font-family: "Georgia", "Palatino Linotype", serif;
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 14px;
  top: -20px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0.9;
  animation: confetti-fall 1400ms ease-out forwards;
  z-index: 9999;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.82; }
}

@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); opacity: 0; }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }
}
