:root {
  --bg: #070b14;
  --bg-2: #0c1322;
  --surface: rgba(16, 24, 40, 0.82);
  --surface-solid: #121a2c;
  --line: rgba(212, 175, 55, 0.18);
  --line-strong: rgba(212, 175, 55, 0.42);
  --gold: #d4af37;
  --gold-2: #f3e6b8;
  --sapphire: #4c8dff;
  --sapphire-deep: #1e4ed8;
  --teal: #3dd6c6;
  --coral: #ff6b6b;
  --amber: #f0b429;
  --text: #f4f1ea;
  --muted: #9aa6b8;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: "Plus Jakarta Sans", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0.01em;
}

body {
  overflow-x: hidden;
}

.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(76, 141, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 141, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}

.bg-orb {
  pointer-events: none;
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.bg-orb-a { top: -160px; left: -80px; background: #1e3a8a; }
.bg-orb-b { right: -120px; top: 120px; background: #8a6b12; opacity: 0.22; }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px 8px;
  gap: 20px;
}

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

.brand-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.health {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.7);
  color: var(--muted);
  font-size: 13px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

.health.ok .health-dot { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.health.bad .health-dot { background: var(--coral); box-shadow: 0 0 10px var(--coral); }

.shell {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px 80px;
}

.hero { margin: 18px 0 22px; max-width: 760px; }

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

.hero h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  font-weight: 640;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0;
  margin: 0 0 22px;
}

.report-panel {
  display: grid;
  grid-template-columns: 1.3fr auto auto auto;
  gap: 18px 20px;
  align-items: end;
  margin-bottom: 22px;
}

.report-copy h3 {
  margin: 2px 0 6px;
  font-family: var(--display);
  font-size: 22px;
}

.report-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.date-mode {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0;
  padding: 10px 14px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.date-mode legend {
  padding: 0 6px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.radio input {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}

.date-filters {
  display: flex;
  gap: 12px;
}

.date-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.date-filters input[type="date"] {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  background: #0d1526;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 150px;
  color-scheme: dark;
}

.excel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  color: #e8fff2;
  background: linear-gradient(180deg, #2e8b57, #217346);
  box-shadow: 0 10px 22px rgba(33, 115, 70, 0.28);
}

.excel-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.excel-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.report-panel .hint {
  grid-column: 1 / -1;
  margin-top: -8px;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(12, 19, 34, 0.6);
}

.steps li span {
  font-family: var(--display);
  color: var(--gold);
}

.steps li.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.12), rgba(12, 19, 34, 0.8));
}

.steps li.is-done { color: var(--teal); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hidden { display: none !important; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dropzone {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 28px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 18px;
  cursor: pointer;
  transition: 0.2s ease;
  background:
    radial-gradient(circle at 0% 0%, rgba(76, 141, 255, 0.12), transparent 40%),
    rgba(7, 11, 20, 0.45);
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.dropzone-icon { color: var(--gold-2); }

.dropzone strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ghost-btn,
.ghost,
.primary {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.ghost-btn,
.ghost {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--gold-2);
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.primary {
  padding: 13px 22px;
  border-radius: 999px;
  color: #1a1404;
  background: linear-gradient(180deg, #f3e6b8, #d4af37);
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.25);
}

.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.hint { margin: 0; color: var(--muted); font-size: 13px; }

.working {
  display: flex;
  gap: 18px;
  align-items: center;
}

.working h3 { margin: 0 0 4px; font-family: var(--display); }
.working p { margin: 0; color: var(--muted); }

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.18);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

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

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.result-head h3 {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 28px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.tile {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
}

.tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.tile strong {
  font-family: var(--display);
  font-size: 28px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.choice {
  text-align: left;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0d1526;
  color: var(--text);
  cursor: pointer;
  transition: 0.18s ease;
}

.choice:hover { border-color: var(--gold); transform: translateY(-2px); }
.choice.danger:hover { border-color: var(--coral); }

.choice-kicker {
  display: block;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.choice.danger .choice-kicker { color: var(--coral); }

.choice strong { display: block; margin-bottom: 8px; font-size: 16px; }
.choice span:last-child { color: var(--muted); font-size: 13px; line-height: 1.5; }

#choiceCard, #blockCard {
  margin-bottom: 20px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.55);
}

#blockCard { border-color: rgba(255, 107, 107, 0.4); }

#blockCard h4 { margin: 0 0 8px; color: var(--coral); }
#choiceCard h4, #choiceCard p, .split h4 { margin-top: 0; }
#choiceCard p, .split h4 + * { color: var(--muted); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--gold-2);
  font-size: 0.92em;
}

.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.chip-list li {
  padding: 6px 10px;
  border-radius: 999px;
  background: #18233a;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--gold-2);
}

#commitBar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.split h4 {
  font-family: var(--display);
  color: var(--text);
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

th {
  color: var(--gold);
  font-weight: 600;
  background: #10182a;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1526;
}

.log li {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.log li.success { color: var(--teal); }
.log li.warning { color: var(--amber); }
.log li.error { color: var(--coral); }
.log li.note { color: var(--sapphire); }

.success-banner {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.success-gem {
  width: 54px;
  height: 54px;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0 38%);
  background: linear-gradient(160deg, #f3e6b8, #4c8dff 55%, #1e3a8a);
}

.success-banner h3 {
  margin: 4px 0;
  font-family: var(--display);
  font-size: 30px;
}

.foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 40px 32px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .steps, .tiles, .choice-grid, .split { grid-template-columns: 1fr 1fr; }
  .dropzone { grid-template-columns: 1fr; }
  .topbar, .foot { padding-left: 20px; padding-right: 20px; flex-direction: column; align-items: flex-start; }
  .report-panel { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 640px) {
  .steps, .tiles, .choice-grid, .split { grid-template-columns: 1fr; }
}
