:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #edf4fb;
  --text: #172033;
  --muted: #66748a;
  --line: #dbe5f0;
  --navy: #12345b;
  --navy-2: #0d2747;
  --blue: #d9ebff;
  --green: #16865f;
  --amber: #f4a62a;
  --rose: #e65d75;
  --shadow: 0 18px 45px rgba(18, 52, 91, .10);
  color-scheme: light;
}

body.dark {
  --bg: #09111f;
  --surface: #111c2d;
  --surface-soft: #17263b;
  --text: #edf4ff;
  --muted: #aab7c8;
  --line: #293a52;
  --navy: #8fc2ff;
  --navy-2: #dbeeff;
  --blue: #183150;
  --green: #66d5a8;
  --amber: #ffce73;
  --rose: #ff8fa0;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 4%, rgba(217, 235, 255, .95), transparent 30rem),
    radial-gradient(circle at 90% 10%, rgba(223, 246, 237, .9), transparent 26rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
a { color: inherit; }

.app-header,
main,
.app-footer {
  width: min(1180px, calc(100% - 28px));
  margin-inline: auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
}

.back-link {
  color: var(--muted);
  font-weight: 850;
  text-decoration: none;
}

.theme-toggle,
.button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 850;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.button.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.button.ghost { background: transparent; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(310px, .9fr);
  gap: 18px;
  padding: 28px 0 16px;
}

.hero-copy,
.score-card,
.soft-note,
.app-shell,
.panel,
.insight-card {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-copy { padding: clamp(24px, 5vw, 46px); }
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 900;
  letter-spacing: .02em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  color: var(--navy-2);
  font-size: clamp(38px, 7vw, 68px);
  line-height: .98;
}
h2 { font-size: clamp(22px, 4vw, 34px); line-height: 1.1; margin-bottom: 10px; }
.lead { color: var(--muted); font-size: 18px; max-width: 700px; }
.muted, .cloud-label { color: var(--muted); }

.hero-actions,
.quick-actions,
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.score-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.score-ring {
  --score-color: var(--green);
  width: 128px;
  height: 128px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--score-color) calc(var(--score, 0) * 1%), var(--surface-soft) 0);
  position: relative;
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: var(--surface);
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong { font-size: 42px; line-height: 1; color: var(--navy-2); }
.score-ring span { align-self: end; margin-top: -40px; color: var(--muted); font-weight: 850; }

.mini-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-metrics article,
.report-row,
.cut-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px;
}

.mini-metrics span,
.insight-card span,
.report-row span,
.cut-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.mini-metrics strong { display: block; margin-top: 4px; color: var(--navy-2); font-size: 18px; }
.soft-note { padding: 14px 16px; color: var(--muted); font-weight: 700; }

.app-shell { margin-top: 16px; padding: 12px; }
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
  scrollbar-width: thin;
}

.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  min-height: 42px;
  padding: 9px 13px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.panel {
  display: none;
  padding: clamp(16px, 3vw, 24px);
}

.panel.active { display: block; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.panel-head small,
.panel-head > strong {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--navy-2);
  padding: 8px 10px;
  font-weight: 900;
}

.profile-form,
.budget-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.budget-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  min-height: 46px;
  padding: 10px 12px;
  outline: none;
}

input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 55%, transparent);
}

.file-button input { display: none; }
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
}

.preset.active {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  color: var(--green);
}

.summary-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.insight-card { padding: 16px; box-shadow: none; }
.insight-card strong {
  display: block;
  margin: 6px 0;
  color: var(--navy-2);
  font-size: 22px;
}

.bars,
.recommendations,
.cut-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.report-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  border-radius: inherit;
  background: var(--c, var(--green));
}

.recommendations article {
  border-left: 5px solid var(--green);
  background: var(--surface-soft);
  border-radius: 16px;
  padding: 14px;
}

.recommendations article.warn { border-left-color: var(--amber); }
.recommendations article.risk { border-left-color: var(--rose); }

.cut-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--navy-2);
  color: #fff;
  border-radius: 999px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  font-weight: 850;
}

@media (max-width: 960px) {
  .hero,
  .summary-layout,
  .budget-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .app-header,
  main,
  .app-footer {
    width: min(100% - 22px, 1180px);
  }

  .app-header { align-items: start; }
  .theme-toggle { min-width: 104px; }
  .hero { padding-top: 12px; }
  .hero-copy, .score-card, .panel { border-radius: 16px; }
  .score-card { grid-template-columns: 1fr; }
  .score-ring { width: 112px; height: 112px; }
  .mini-metrics { grid-template-columns: 1fr; }
  .panel-head { display: grid; }
  .report-row { grid-template-columns: 1fr; }
  .app-footer { flex-direction: column; }
}
