:root {
  color-scheme: dark;
  --bg: #08131b;
  --bg-soft: #0d1c27;
  --panel: #112331;
  --panel-2: #142b3a;
  --text: #eef6f8;
  --muted: #aec1ca;
  --line: #294455;
  --accent: #4fd1a5;
  --accent-2: #76b7ff;
  --link: #8bdfff;
  --link-hover: #b7efff;
  --footer-bg: #041017;
  --button-primary-text: #062019;
  --theme-toggle-bg: var(--panel);
  --theme-toggle-text: var(--text);
  --theme-toggle-border: var(--line);
  --theme-toggle-shadow: none;
  --input-bg: color-mix(in srgb, var(--bg) 85%, #000 15%);
  --badge-bg: color-mix(in srgb, var(--accent) 12%, transparent);
  --hero-accent-wash: color-mix(in srgb, var(--accent) 12%, transparent);
  --hero-blue-wash: color-mix(in srgb, var(--accent-2) 11%, transparent);
  --placeholder-bg: color-mix(in srgb, var(--accent-2) 8%, transparent);
  --focus-ring: color-mix(in srgb, var(--accent) 35%, transparent);
  --qr-bg: #ffffff;
  --warning: #ffd166;
  --danger: #ff8a8a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  --radius: 8px;
  --max: 1120px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8f7;
  --bg-soft: #eaf2ef;
  --panel: #ffffff;
  --panel-2: #eef6f3;
  --text: #10202a;
  --muted: #49616c;
  --line: #c7d7d2;
  --accent: #0f9f77;
  --accent-2: #2478c6;
  --link: #075fa8;
  --link-hover: #034d88;
  --footer-bg: #e7f0ed;
  --button-primary-text: #ffffff;
  --theme-toggle-bg: #10202a;
  --theme-toggle-text: #ffffff;
  --theme-toggle-border: #10202a;
  --theme-toggle-shadow: 0 8px 20px rgba(16, 32, 42, 0.22);
  --input-bg: color-mix(in srgb, var(--panel) 92%, var(--bg) 8%);
  --badge-bg: color-mix(in srgb, var(--accent) 10%, var(--panel));
  --hero-accent-wash: color-mix(in srgb, var(--accent) 10%, transparent);
  --hero-blue-wash: color-mix(in srgb, var(--accent-2) 9%, transparent);
  --placeholder-bg: color-mix(in srgb, var(--accent-2) 8%, var(--panel));
  --focus-ring: color-mix(in srgb, var(--accent) 35%, transparent);
  --qr-bg: #ffffff;
  --warning: #8a6100;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(18, 49, 66, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
  font-weight: 700;
}

a:hover,
a:focus {
  color: var(--link-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-wrap,
.container {
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 18px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-text);
  border-radius: var(--radius);
  min-width: 42px;
  min-height: 42px;
  padding: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--theme-toggle-shadow);
}

.site-nav a {
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a:focus {
  color: var(--text);
}

.site-nav a:hover,
.site-nav a:focus,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}

.hero {
  padding: 44px 0 34px;
  background:
    linear-gradient(135deg, var(--hero-accent-wash), transparent 35%),
    linear-gradient(225deg, var(--hero-blue-wash), transparent 40%);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 28px;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  margin: 0 0 10px;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4.8vw, 3.8rem);
  margin: 0 0 14px;
  max-width: 820px;
}

h2 {
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  margin: 0 0 14px;
}

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

p {
  margin: 0 0 16px;
}

.lead {
  color: var(--muted);
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  max-width: 760px;
}

.hero-panel,
.card,
.tool-card,
.result-card,
.notice,
.faq-item,
.support-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 24px;
}

.hero-panel strong {
  color: var(--accent);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
}

.button.primary {
  background: var(--accent);
  color: var(--button-primary-text);
  border-color: var(--accent);
}

.tool-card .button {
  background: var(--accent);
  color: var(--button-primary-text);
  border-color: var(--accent);
}

.button:hover,
.button:focus {
  text-decoration: none;
  filter: brightness(1.05);
}

.section {
  padding: 48px 0;
}

.section.alt {
  background: var(--bg-soft);
  border-block: 1px solid var(--line);
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.card,
.tool-card,
.faq-item,
.notice {
  padding: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.tool-card h2 {
  font-size: 1.25rem;
}

.tool-card p,
.card p,
.faq-item p,
.muted {
  color: var(--muted);
}

.tool-card .button {
  margin-top: auto;
  align-self: flex-start;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.badge-list li,
.status-pill {
  border: 1px solid var(--line);
  background: var(--badge-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.92rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 22px;
  align-items: start;
}

form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.field-help,
.error {
  font-size: 0.92rem;
}

.field-help {
  color: var(--muted);
}

.error {
  color: var(--danger);
  min-height: 1.4em;
}

.result-card {
  padding: 22px;
  position: sticky;
  top: 92px;
}

.result-card h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.results-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.result-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 14px;
}

.snapshot-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  padding: 14px;
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.summary-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
  line-height: 1.1;
}

.status-good strong {
  color: var(--accent);
}

.status-warn strong {
  color: var(--warning);
}

.status-bad strong {
  color: var(--danger);
}

.bar-list {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 45%, transparent);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: var(--bar-width, 0%);
  background: var(--accent);
  border-radius: inherit;
}

.bar-fill.debt {
  background: var(--accent-2);
}

.bar-fill.goals {
  background: var(--warning);
}

.bar-fill.over {
  background: var(--danger);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button.small {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.92rem;
}

.debt-list {
  display: grid;
  gap: 12px;
}

.debt-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
}

.debt-row label {
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.result-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.result-row strong {
  text-align: right;
}

.notice {
  border-left: 4px solid var(--warning);
}

.notice strong {
  color: var(--warning);
}

.trust-notice {
  margin-top: 18px;
}

.keyword-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.keyword-grid p {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
}

.province-links {
  columns: 2;
  padding-left: 18px;
}

.support-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 22px;
  align-items: center;
  padding: 24px;
}

.qr {
  background: var(--qr-bg);
  border-radius: var(--radius);
  padding: 8px;
}

.site-footer {
  background: var(--footer-bg);
  color: var(--text);
  border-top: 1px solid var(--line);
  padding: 42px 0 22px;
}

.site-footer a {
  color: var(--link);
}

.site-footer a:hover,
.site-footer a:focus {
  color: var(--link-hover);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  gap: 24px;
}

.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.footer-bottom {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.page-header {
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.page-header h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.article {
  max-width: 820px;
}

.article h2 {
  margin-top: 28px;
}

.article h2:first-child {
  margin-top: 0;
}

.article .notice {
  margin: 22px 0;
}

.article > .faq-item + .faq-item {
  margin-top: 14px;
}

.article ul,
.article ol {
  color: var(--muted);
}

.placeholder-box {
  border: 1px dashed var(--line);
  padding: 18px;
  border-radius: var(--radius);
  background: var(--placeholder-bg);
}

@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    inset: 72px 16px auto;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .site-nav.is-open {
    display: flex;
  }

  .theme-toggle {
    width: 100%;
    justify-content: center;
  }

  .hero-grid,
  .tool-layout,
  .grid.two,
  .grid.three,
  .footer-grid,
  .support-panel {
    grid-template-columns: 1fr;
  }

  .result-card {
    position: static;
  }

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

  .province-links {
    columns: 1;
  }

  .debt-row {
    grid-template-columns: 1fr;
  }

  .snapshot-summary {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header,
  .site-footer,
  .button-row,
  .nav-toggle {
    display: none;
  }

  body {
    background: #fff;
    color: #111;
  }

  .result-card,
  .card,
  .notice {
    box-shadow: none;
    border-color: #999;
    color: #111;
    background: #fff;
  }
}
