:root {
  color-scheme: light;
  --bg: #eef4fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --text: #0e1f35;
  --muted: #60738d;
  --line: #d8e3f1;
  --accent: #004c8f;
  --accent-2: #0c74c9;
  --mint: #e9f3ff;
  --gold: #b46a00;
  --danger: #d71920;
  --rose: #fff0f1;
  --shadow: 0 18px 48px rgba(7, 42, 88, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(12, 116, 201, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 58%, #ffffff 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  padding: 10px 12px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  border: 1px solid rgba(216, 227, 241, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #073a78 0%, #052f63 100%);
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #05070a;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand strong {
  color: #ffffff;
}

.brand span {
  color: rgba(255, 255, 255, 0.68);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.muted,
.small-note,
.item span,
.item p {
  color: var(--muted);
}

.sidebar .brand span {
  color: rgba(255, 255, 255, 0.68);
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  min-height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 800;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar .privacy-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.privacy-chip,
.count-pill {
  margin-top: auto;
  width: fit-content;
  border-radius: 999px;
  background: var(--mint);
  color: var(--accent);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

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

.hero {
  min-height: 250px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: end;
  gap: 18px;
  padding: 26px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.18), transparent 24rem),
    linear-gradient(135deg, rgba(4, 46, 95, 0.98), rgba(0, 76, 143, 0.92));
  background-size: cover;
  background-position: center;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 760px;
  margin: 6px 0 8px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
  line-height: 1.5;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: rgba(255, 255, 255, 0.7);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

.hero-actions {
  display: grid;
  gap: 12px;
}

.month-control,
.balance-box {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.78);
  padding: 12px;
  backdrop-filter: blur(8px);
}

.balance-box span,
.smart-card span,
.metrics span,
.small-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-box span {
  color: rgba(255, 255, 255, 0.72);
}

.balance-box strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 25px;
}

.health-grid,
.metrics,
.layout-grid,
.analysis-grid,
.statement-grid,
.subscriptions-grid,
.field-row,
.insight-layout {
  display: grid;
  gap: 14px;
}

.health-grid {
  grid-template-columns: 1.5fr repeat(5, 1fr);
}

.health-card,
.smart-card,
.panel,
.metrics article {
  border: 1px solid rgba(216, 227, 241, 0.92);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.health-card {
  min-height: 150px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.score-ring {
  --score: 0%;
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent-2) var(--score), #e2edf9 0);
  position: relative;
}

.score-ring::after {
  content: "";
  position: absolute;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
}

.score-ring span {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 28px;
  font-weight: 950;
}

.smart-card,
.metrics article {
  min-height: 128px;
  display: grid;
  align-content: space-between;
  padding: 16px;
}

.smart-card strong,
.metrics strong {
  color: var(--text);
  font-size: 26px;
  line-height: 1.05;
}

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

.insight-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

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

.analysis-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.statement-panel {
  align-content: start;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.smart-card,
.metrics article {
  position: relative;
  overflow: hidden;
}

.panel::before,
.smart-card::before,
.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.advisor-panel {
  align-content: start;
}

.section-head,
.button-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d8ea;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(12, 116, 201, 0.14);
}

.hero input {
  margin-top: 6px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 76, 143, 0.18);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent);
  box-shadow: none;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(12, 116, 201, 0.35);
  outline-offset: 2px;
}

.danger {
  background: var(--rose);
  color: var(--danger);
  border: 1px solid #f5b8bd;
}

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

.segmented label {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  background: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 6px 8px;
}

.segmented input[type="radio"] {
  width: 14px;
  height: 14px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-2);
  box-shadow: none;
}

.list {
  display: grid;
  gap: 10px;
}

.compact-list {
  max-height: 330px;
  overflow: auto;
  padding-right: 3px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.item strong {
  display: block;
}

.item span,
.item p,
.muted {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.item-value {
  white-space: nowrap;
  font-weight: 950;
}

.insight-high {
  border-left: 4px solid var(--danger);
}

.insight-medium {
  border-left: 4px solid var(--gold);
}

.insight-positive {
  border-left: 4px solid var(--accent-2);
}

.bar {
  height: 9px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e4eef9;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #3a9be8);
}

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

.risk-medium .bar-fill {
  background: var(--gold);
}

.empty {
  border: 1px dashed #c8d8ea;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
}

.mix-chart {
  display: grid;
  gap: 10px;
}

.mix-tile {
  border-radius: 8px;
  padding: 13px;
  background: var(--mint);
}

.mix-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.statement-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.statement-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.statement-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.statement-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.statement-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.statement-table th,
.statement-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  font-size: 13px;
}

.statement-table th {
  background: #f1f6fc;
  color: #183a63;
  font-size: 12px;
  text-transform: uppercase;
}

.statement-table td:last-child,
.statement-table th:last-child {
  text-align: right;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
}

.subscription-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.subscription-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
  display: grid;
  gap: 10px;
}

.subscription-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.type-pill {
  border-radius: 999px;
  background: var(--mint);
  color: var(--accent);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

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

.subscription-meta div {
  border-radius: 8px;
  background: #f5f9fe;
  padding: 8px;
}

.subscription-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.subscription-meta strong {
  display: block;
  margin-top: 2px;
}

.goal-progress {
  height: 10px;
  border-radius: 999px;
  background: #e4eef9;
  overflow: hidden;
  margin-top: 8px;
}

.goal-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.mini-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  box-shadow: none;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, minmax(32px, 1fr));
  gap: 7px;
}

.heat-day {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
  padding: 6px;
  display: grid;
  align-content: space-between;
}

.heat-day strong {
  font-size: 12px;
}

.heat-day span {
  font-size: 10px;
  color: var(--muted);
}

.heat-1 {
  background: #e9f3ff;
}

.heat-2 {
  background: #cde5ff;
}

.heat-3 {
  background: #8dc7f7;
}

.heat-4 {
  background: #d71920;
  color: #fff;
}

.heat-4 span {
  color: rgba(255, 255, 255, 0.78);
}

.paid-pill {
  border-radius: 999px;
  background: #e9f8ef;
  color: #157347;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.unpaid-pill {
  border-radius: 999px;
  background: var(--rose);
  color: var(--danger);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.settings-panel {
  grid-template-columns: 1fr minmax(220px, 320px) auto;
  align-items: end;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    border-radius: 0 0 8px 8px;
  }

  nav {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .privacy-chip {
    margin-top: 0;
  }

  .hero,
  .health-grid,
  .insight-layout,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

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

  .settings-panel {
    grid-template-columns: 1fr;
  }

  .statement-summary,
  .subscription-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    background: #eef4fb;
  }

  .app-shell {
    gap: 12px;
    padding: 0 10px 14px;
  }

  .sidebar {
    gap: 12px;
    margin: 0 -10px;
    padding: 12px 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    font-size: 12px;
  }

  nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 12px;
    white-space: nowrap;
  }

  .hero {
    min-height: auto;
    padding: 18px;
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 30px;
  }

  .health-grid,
  .metrics,
  .layout-grid,
  .statement-summary,
  .subscription-list,
  .field-row {
    grid-template-columns: 1fr;
  }

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

  .health-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .item {
    align-items: flex-start;
    flex-direction: column;
  }

  .smart-card,
  .metrics article {
    min-height: 104px;
  }

  .smart-card strong,
  .metrics strong {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

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

  .statement-table {
    min-width: 620px;
  }
}

@media (max-width: 420px) {
  .hero h1 {
    font-size: 27px;
  }

  .panel,
  .health-card,
  .smart-card,
  .metrics article {
    padding: 13px;
  }

  .button-row {
    gap: 8px;
  }

  button {
    width: 100%;
  }
}

@media print {
  .sidebar,
  .hero,
  .health-grid,
  .metrics,
  .layout-grid,
  .subscriptions-grid,
  .analysis-grid,
  .settings-panel,
  .skip-link {
    display: none !important;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    border: 0;
  }
}
