:root {
  color-scheme: light;
  --bg:
    radial-gradient(ellipse 70% 55% at 10% 0%, rgba(140, 110, 230, 0.22) 0%, transparent 58%),
    radial-gradient(ellipse 55% 50% at 88% 8%, rgba(70, 100, 230, 0.16) 0%, transparent 54%),
    radial-gradient(ellipse 50% 45% at 50% 95%, rgba(21, 154, 140, 0.14) 0%, transparent 54%),
    radial-gradient(ellipse 40% 40% at 90% 80%, rgba(220, 80, 130, 0.1) 0%, transparent 50%),
    #e8eaf4;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.75);
  --surface-muted: rgba(255, 255, 255, 0.32);
  --surface-selected: rgba(21, 154, 140, 0.08);
  --surface-hover: rgba(255, 255, 255, 0.82);
  --border: rgba(180, 185, 210, 0.45);
  --border-strong: rgba(150, 155, 190, 0.65);
  --text: #12102a;
  --text-muted: #5c5880;
  --accent: #0d8c7f;
  --accent-strong: #0a7268;
  --accent-soft: rgba(13, 140, 127, 0.1);
  --blue: #3b6ef0;
  --blue-soft: rgba(59, 110, 240, 0.1);
  --amber: #a16207;
  --amber-soft: rgba(161, 98, 7, 0.1);
  --rose: #be2d52;
  --rose-soft: rgba(190, 45, 82, 0.1);
  --accent-border-soft: rgba(13, 140, 127, 0.28);
  --blue-border-soft: rgba(59, 110, 240, 0.28);
  --amber-border-soft: rgba(161, 98, 7, 0.28);
  --rose-border-soft: rgba(190, 45, 82, 0.28);
  --accent-focus-ring: rgba(13, 140, 127, 0.18);
  --accent-focus-border: rgba(13, 140, 127, 0.5);
  --accent-shadow: rgba(13, 140, 127, 0.18);
  --track: rgba(120, 100, 180, 0.18);
  --bar-fill-end: #6b8ef5;
  --link-hover: #2550d0;
  --info-rail: #94a3b8;
  --overlay: rgba(15, 10, 40, 0.4);
  --button-text: #ffffff;
  --surface-sheen: rgba(255, 255, 255, 0.92);
  --surface-glow: rgba(120, 70, 220, 0.08);
  --hero-surface: rgba(255, 255, 255, 0.16);
  --hero-surface-strong: rgba(255, 255, 255, 0.26);
  --hero-grid: rgba(80, 40, 160, 0.05);
  --hero-beam: rgba(140, 90, 255, 0.5);
  --button-glow: rgba(13, 140, 127, 0.25);
  --grid-line: rgba(100, 80, 180, 0.08);
  --shadow:
    0 8px 32px rgba(80, 60, 160, 0.1),
    0 2px 8px rgba(80, 60, 160, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(80, 60, 160, 0.04) inset;
  --shadow-strong:
    0 16px 48px rgba(80, 60, 160, 0.14),
    0 4px 16px rgba(80, 60, 160, 0.09),
    0 1px 0 rgba(255, 255, 255, 0.96) inset,
    0 -1px 0 rgba(80, 60, 160, 0.05) inset;
  --radius: 20px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:
    radial-gradient(ellipse 55% 60% at 5%  10%, rgba(120, 60, 255, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 50% 55% at 95% 5%,  rgba(40,  90, 255, 0.35) 0%, transparent 52%),
    radial-gradient(ellipse 60% 50% at 50% 95%, rgba(20, 160, 140, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse 45% 45% at 92% 85%, rgba(160, 40, 100, 0.22) 0%, transparent 50%),
    #080612;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.09);
  --surface-muted: rgba(255, 255, 255, 0.03);
  --surface-selected: rgba(20, 160, 145, 0.10);
  --surface-hover: rgba(255, 255, 255, 0.13);
  --border: rgba(255, 255, 255, 0.18);
  --border-strong: rgba(255, 255, 255, 0.3);
  --text: #f0ecff;
  --text-muted: #a89cc8;
  --accent: #63e6d8;
  --accent-strong: #8ef2e8;
  --accent-soft: rgba(99, 230, 216, 0.14);
  --blue: #7aa2ff;
  --blue-soft: rgba(122, 162, 255, 0.16);
  --amber: #f0be66;
  --amber-soft: rgba(251, 191, 36, 0.16);
  --rose: #ff91a5;
  --rose-soft: rgba(251, 113, 133, 0.16);
  --accent-border-soft: rgba(99, 230, 216, 0.28);
  --blue-border-soft: rgba(122, 162, 255, 0.28);
  --amber-border-soft: rgba(251, 191, 36, 0.28);
  --rose-border-soft: rgba(251, 113, 133, 0.28);
  --accent-focus-ring: rgba(99, 230, 216, 0.22);
  --accent-focus-border: rgba(99, 230, 216, 0.48);
  --accent-shadow: rgba(99, 230, 216, 0.18);
  --track: rgba(71, 85, 105, 0.45);
  --bar-fill-end: #8db3ff;
  --link-hover: #bfd0ff;
  --info-rail: #7f8ea4;
  --overlay: rgba(4, 2, 18, 0.72);
  --button-text: #041715;
  --surface-sheen: rgba(255, 255, 255, 0.22);
  --surface-glow: rgba(0, 0, 0, 0.0);
  --hero-surface: rgba(255, 255, 255, 0.06);
  --hero-surface-strong: rgba(255, 255, 255, 0.1);
  --hero-grid: rgba(200, 180, 255, 0.07);
  --hero-beam: rgba(130, 190, 255, 0.6);
  --button-glow: rgba(99, 230, 216, 0.3);
  --grid-line: rgba(160, 140, 220, 0.12);
  --shadow:
    0 24px 56px rgba(4, 2, 18, 0.65),
    0 2px 8px rgba(0, 0, 15, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 -1px 0 rgba(0, 0, 0, 0.3) inset;
  --shadow-strong:
    0 32px 72px rgba(4, 2, 18, 0.75),
    0 8px 24px rgba(0, 0, 15, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(0, 0, 0, 0.4) inset;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--surface-sheen), transparent 22%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 65%);
  opacity: 0.55;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  pointer-events: none;
}

.app-shell {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  margin-bottom: 28px;
  align-items: stretch;
}

.title-block {
  display: grid;
  align-content: space-between;
  max-width: 640px;
  min-width: 0;
  min-height: 308px;
  padding: 28px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(
    180deg,
    var(--hero-surface) 0%,
    var(--hero-surface-strong) 100%
  );
  box-shadow: var(--shadow);
  backdrop-filter: blur(56px) saturate(220%) brightness(1.08);
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--hero-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.82), transparent 72%);
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -12% 26px 38%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hero-beam), transparent);
  box-shadow: 0 0 28px var(--hero-beam);
  opacity: 0.9;
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  margin: 0 0 12px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  backdrop-filter: blur(30px) saturate(180%);
}

.section-label {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 0.96;
  font-weight: 780;
}

.lede {
  margin: 14px 0 0;
  max-width: 34ch;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  align-items: center;
  margin-top: auto;
}

.theme-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  backdrop-filter: blur(40px) saturate(200%) brightness(1.05);
}

.theme-switch-button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

.theme-switch-button:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.theme-switch-button.is-active {
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
  color: var(--text);
  box-shadow: 0 10px 24px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
}

.theme-switch-button:focus-visible {
  outline: 2px solid var(--accent-focus-ring);
  outline-offset: 2px;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar,
.main-column {
  display: grid;
  gap: 18px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 24px;
}

.surface {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  backdrop-filter: blur(48px) saturate(200%) brightness(1.06);
}

.surface::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--surface-sheen), transparent);
}

.overview-panel {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.surface.overview-panel {
  overflow: visible;
  isolation: auto;
}

.overview-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.overview-head h2 {
  display: none;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-head h2,
.breakdown-head h3 {
  display: none;
}

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

.muted {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.compact {
  gap: 10px;
}

.card-theme {
  --card-accent: var(--accent);
  --card-accent-secondary: var(--bar-fill-end);
  --card-surface: var(--surface-muted);
  --card-border: var(--border);
}

.card-option {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: 0 10px 24px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
  overflow: hidden;
  transition: border-color 160ms ease, background-color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease;
}

.card-option:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow), inset 0 1px 0 var(--surface-sheen);
}

.card-option.card-theme {
  border-color: var(--card-border);
  background: linear-gradient(
    180deg,
    var(--card-surface) 0%,
    var(--surface) 72%,
    var(--surface-strong) 100%
  );
}

.card-option.card-theme:hover {
  border-color: var(--card-accent);
}

.card-option.is-selected {
  border-color: var(--accent);
  background: var(--surface-selected);
  box-shadow: inset 0 0 0 1px var(--accent-shadow);
}

.card-option.card-theme.is-selected {
  border-color: var(--card-accent);
  background: linear-gradient(
    180deg,
    var(--card-surface) 0%,
    var(--surface) 72%,
    var(--surface-strong) 100%
  );
  box-shadow: 0 16px 34px var(--surface-glow), inset 0 0 0 1px var(--card-border),
    inset 0 1px 0 var(--surface-sheen);
}

.card-option.is-selected::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.card-option.card-theme.is-selected::before {
  background: linear-gradient(
    180deg,
    var(--card-accent) 0%,
    var(--card-accent-secondary) 100%
  );
}

.card-option-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.card-option-title {
  display: flex;
  gap: 10px;
  align-items: start;
  min-width: 0;
  flex: 1 1 auto;
}

.card-option-lockup,
.recommendation-lockup {
  display: flex;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.recommendation-lockup {
  align-items: center;
}

.card-option-copy,
.recommendation-copy {
  display: grid;
  min-width: 0;
}

.card-option-title input {
  margin-top: 2px;
  flex: 0 0 auto;
}

.card-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
}

.card-brand-icon.is-fallback {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(
    135deg,
    var(--card-accent) 0%,
    var(--card-accent-secondary) 100%
  );
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.card-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  transform-origin: center;
  transform: var(--brand-logo-transform, none);
}

.card-brand-icon.is-recommendation {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

.card-brand-icon.is-tiny {
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.card-brand-icon[data-card-id="amex-cobalt"] {
  --brand-logo-transform: scale(1.03);
}

.card-brand-icon[data-card-id="cibc-dividend"] {
  --brand-logo-transform: scale(1.0);
}

.card-brand-icon[data-card-id="rbc-cashback"] {
  --brand-logo-transform: scale(1.08);
}

.card-brand-icon.is-tiny[data-card-id="cibc-dividend"] {
  --brand-logo-transform: scale(0.96) translateY(8%);
}

.card-brand-icon.is-tiny[data-card-id="rbc-cashback"] {
  --brand-logo-transform: scale(1.12);
}

.card-name {
  display: block;
  font-weight: 700;
}

.card-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.pill-row,
.inline-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.pill-neutral {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.pill-good {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-border-soft);
}

.pill-brand {
  background: var(--card-surface);
  color: var(--card-accent);
  border-color: var(--card-border);
}

.pill-logo-list {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
}

.backup-pill-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pill-info {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue-border-soft);
}

.pill-warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border-soft);
}

.pill-risk {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: var(--rose-border-soft);
}

.field {
  display: grid;
  gap: 8px;
}

.field-span-2 {
  grid-column: span 2;
}

.field-hidden {
  display: none;
}

.field-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.field-help {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease,
    background-color 160ms ease;
}

select option {
  background-color: #e8eaf4;
  color: var(--text);
}

:root[data-theme="dark"] select option {
  background-color: #080612;
}

input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--blue);
}

input:focus,
select:focus,
.button:focus-visible,
.icon-button:focus-visible,
.view-switch-button:focus-visible {
  outline: 2px solid var(--accent-focus-ring);
  outline-offset: 2px;
  border-color: var(--accent-focus-border);
}

.input-with-prefix,
.input-with-suffix {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-with-suffix {
  grid-template-columns: minmax(0, 1fr) auto;
}

.input-with-prefix:focus-within,
.input-with-suffix:focus-within {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 1px var(--accent-shadow);
}

.input-with-prefix span,
.input-with-suffix span {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.input-with-prefix input,
.input-with-suffix input {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 4px 0 0;
}

.toggle-field {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.toggle-field input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.button {
  position: relative;
  overflow: hidden;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
  color: var(--button-text);
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease,
    color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  box-shadow: 0 14px 28px var(--button-glow), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 18%,
    rgba(255, 255, 255, 0.3) 45%,
    transparent 72%
  );
  transform: translateX(-140%);
  pointer-events: none;
}

.button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 18px 34px var(--button-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.button:hover::after {
  transform: translateX(140%);
  transition: transform 700ms ease;
}

.button-small {
  min-height: 36px;
  padding: 0 13px;
  font-size: 0.84rem;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  backdrop-filter: blur(40px) saturate(200%) brightness(1.05);
}

.view-switch-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

.view-switch-button:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.view-switch-button.is-active {
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
  color: var(--text);
  box-shadow: 0 8px 18px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
}

.button-secondary {
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.button-secondary:hover {
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
}

.button-ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.button-ghost:hover {
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface-muted) 100%);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  transition: background-color 160ms ease, border-color 160ms ease,
    color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.icon-button:hover {
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
  border-color: var(--border-strong);
  box-shadow: 0 10px 20px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
  transform: translateY(-1px);
}

.icon-button-subtle {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  box-shadow: none;
}

.icon-button-subtle:hover {
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  color: var(--text);
}

.icon-button-danger {
  color: var(--rose);
}

.icon-button-danger:hover {
  background: var(--rose-soft);
  border-color: var(--rose-border-soft);
  color: var(--rose);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

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

.metric {
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100px;
  padding: 18px 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  gap: 4px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--hero-beam), transparent);
  opacity: 0.5;
}

.metric-primary {
  background: linear-gradient(180deg, var(--surface-selected) 0%, var(--surface) 100%);
  border-color: var(--accent-border-soft);
  box-shadow: 0 14px 28px var(--accent-shadow), inset 0 1px 0 var(--surface-sheen);
}

.metric-primary::before {
  opacity: 1;
}

.metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  order: 2;
}

.metric strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  order: 1;
}

.metric-primary strong {
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.summary-caption {
  margin: 0;
  max-width: 24ch;
  text-align: right;
}

.breakdown {
  margin-top: 2px;
}

.breakdown-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.breakdown-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.breakdown-row.card-theme {
  border-color: var(--card-border);
  background: linear-gradient(180deg, var(--card-surface) 0%, var(--surface) 100%);
}

.breakdown-row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.breakdown-card-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.breakdown-card-name::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: linear-gradient(
    135deg,
    var(--card-accent) 0%,
    var(--card-accent-secondary) 100%
  );
}

.breakdown-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--card-accent) 0%,
    var(--card-accent-secondary) 100%
  );
}

.cap-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.cap-bar-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.cap-bar-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cap-bar-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.cap-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--card-accent);
  opacity: 0.7;
  transition: width 300ms ease;
}

.cap-bar-fill.cap-bar-warn {
  background: var(--amber);
  opacity: 0.85;
}

.cap-bar-fill.cap-bar-danger {
  background: var(--rose);
  opacity: 0.9;
}

.cap-bar-fill.cap-bar-full {
  width: 100%;
  background: var(--card-accent);
  opacity: 0.25;
}

.cap-bar-pct {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.cap-bar-pct.cap-bar-warn {
  color: var(--amber);
}

.cap-bar-pct.cap-bar-danger {
  color: var(--rose);
}

.cap-bar-detail {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: -2px;
  margin-bottom: 4px;
  padding-left: 0;
}

.cap-bar-uncapped {
  opacity: 0.6;
}

.cap-bar-label-nocap {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-style: italic;
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.expense-form .toggle-field {
  align-self: end;
}

.expense-form .form-actions {
  grid-column: 1 / -1;
}

.expense-form-modal {
  margin: 0;
  padding: 18px 22px 22px;
  border-bottom: 0;
  overflow: auto;
}

.expense-form-modal .form-actions {
  padding-top: 6px;
}

.card-form {
  display: grid;
  gap: 16px;
  padding: 18px 22px 22px;
  overflow: auto;
}

.subcopy {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.expense-list {
  display: grid;
  gap: 16px;
}

.expense-list.is-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.expense-list.is-list {
  grid-template-columns: 1fr;
}

.expense-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: 0 16px 34px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.expense-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-strong), 0 0 0 1px var(--border-strong);
  transform: translateY(-2px);
}

.expense-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.expense-card-copy {
  min-width: 0;
}

.expense-card-title,
.recommendation-card-name {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.expense-card-meta,
.recommendation-meta {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.expense-card-amount,
.recommendation-value {
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.recommendation-value {
  font-size: 1.6rem;
}

.expense-card-tags,
.recommendation-pill-row {
  gap: 6px;
}

.expense-card-body,
.expense-card-actions {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.expense-card-actions,
.table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 600;
}

.link-button:hover {
  color: var(--link-hover);
}

.link-button.danger {
  color: var(--rose);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  color: var(--text-muted);
  line-height: 1.55;
  text-align: center;
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.empty-state-copy {
  margin: 0;
}

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(24px) saturate(160%);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  backdrop-filter: blur(56px) saturate(200%) brightness(1.08);
}

.modal-card-compact {
  width: min(100%, 520px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.modal-copy {
  margin: 8px 0 0;
}

.confidence {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  width: fit-content;
  max-width: 100%;
}

.confidence.high {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-border-soft);
}

.confidence.medium {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border-soft);
}

.confidence.low {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: var(--rose-border-soft);
}

.recommendation-cell {
  min-width: 320px;
}

.expense-recommendation {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.expense-recommendation.card-theme {
  border-color: var(--card-border);
  background: linear-gradient(
    180deg,
    var(--card-surface) 0%,
    var(--surface) 72%,
    var(--surface-strong) 100%
  );
  box-shadow: 0 14px 28px var(--surface-glow), inset 0 1px 0 var(--surface-sheen);
}

.recommendation-empty {
  padding: 10px 12px;
}

.recommendation-row {
  display: contents; /* transparent on desktop — children join the recommendation grid */
}

/* Desktop button inside VALUE metric head; mobile button after metrics row */
.metric-info-button.metric-info-desktop { display: inline-grid; }
.metric-info-button.metric-info-mobile  { display: none; }

.recommendation-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.recommendation-head-copy {
  min-width: 0;
  display: flex;
  align-items: center;
}

.recommendation-metric {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
}

.recommendation-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.detail-label,
.recommendation-metric-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.recommendation-metrics > div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, transparent 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.metric-info-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  transition: transform 160ms ease, border-color 160ms ease,
    color 160ms ease, background-color 160ms ease;
}

.metric-info-button:hover,
.metric-info-button:focus-visible,
.expense-recommendation.has-open-tooltip .metric-info-button {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
  border-color: var(--card-accent-secondary);
  transform: translateY(-1px);
}

.metric-tooltip-card {
  display: none;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--text);
  /* always use page-level surface, not card-theme */
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

:root[data-theme="light"] .metric-tooltip-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(180, 185, 210, 0.5);
  box-shadow: 0 8px 32px rgba(80, 60, 160, 0.12), 0 1px 4px rgba(80, 60, 160, 0.06);
  backdrop-filter: blur(24px) saturate(180%);
  color: #12102a;
}

:root[data-theme="light"] .metric-tooltip-title,
:root[data-theme="light"] .metric-tooltip-formula,
:root[data-theme="light"] .metric-tooltip-note {
  color: #6b7280;
}

:root[data-theme="light"] .metric-tooltip-label,
:root[data-theme="light"] .metric-tooltip-amount {
  color: #12102a;
}

:root[data-theme="light"] .metric-tooltip-divider {
  background: #e2e5ed;
}

.expense-recommendation.has-open-tooltip .metric-tooltip-card {
  display: grid;
}

.metric-tooltip-title {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-tooltip-list,
.metric-tooltip-notes {
  display: grid;
  gap: 8px;
}

.metric-tooltip-line {
  display: grid;
  gap: 4px;
}

.metric-tooltip-line-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.metric-tooltip-label {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}

.metric-tooltip-amount {
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.metric-tooltip-formula,
.metric-tooltip-note {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.metric-tooltip-divider {
  height: 1px;
  background: var(--border);
}

.metric-tooltip-line.is-total .metric-tooltip-label,
.metric-tooltip-line.is-total .metric-tooltip-amount {
  font-weight: 700;
}

@media (min-width: 721px) {
  .surface-spend {
    overflow: visible;
    isolation: auto;
  }

  .surface-spend:has(.expense-card.has-open-tooltip) {
    z-index: 10;
  }

  .expense-card.has-open-tooltip,
  .expense-card.has-open-tooltip .expense-recommendation,
  .expense-card.has-open-tooltip .recommendation-row,
  .expense-card.has-open-tooltip .recommendation-metric,
  .expense-card.has-open-tooltip .expense-card-body {
    overflow: visible;
  }

  .expense-card.has-open-tooltip {
    z-index: 50;
    isolation: auto;
  }

  .expense-card.has-open-tooltip .expense-recommendation {
    position: relative;
    z-index: 2;
    overflow: visible;
  }

  .metric-tooltip-card {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(320px, calc(100vw - 56px));
    padding: 12px 14px;
    background: rgba(18, 14, 36, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
      0 24px 48px rgba(0, 0, 0, 0.6),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px) saturate(180%);
    z-index: 30;
  }

  .metric-tooltip-card::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 18px;
    width: 14px;
    height: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(18, 14, 36, 0.92);
    transform: rotate(45deg);
  }
}

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

/* ── Upgrade Your Wallet (Affiliate) Section ── */
.upgrade-wallet-section {
  margin-top: 28px;
}

.upgrade-wallet-lede {
  font-size: 0.88rem;
  margin: 4px 0 16px;
  padding: 0 20px;
}

.upgrade-wallet-disclosure {
  font-size: 0.8rem;
  margin-top: 24px;
  line-height: 1.5;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

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

.affiliate-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.affiliate-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), inset 0 1px 0 var(--surface-sheen);
}

.affiliate-card-info {
  display: grid;
  gap: 4px;
}

.affiliate-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.affiliate-card-issuer {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.affiliate-gain {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1db954;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.affiliate-categories {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.affiliate-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1db954, #17a348);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: opacity 160ms ease, transform 160ms ease;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
}

.affiliate-apply-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.affiliate-partner-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}


/* ── Score Header Widget (Mobile Only) ── */
.score-header-widget {
  display: none;
}

@media (max-width: 920px) {
  .score-header-widget {
    display: block;
    margin: 0 16px 20px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
  }

  .metric-score-tile {
    display: none !important;
  }

  .score-header-content { padding: 14px 16px; }
  .score-ring-container { display: flex; align-items: center; gap: 14px; cursor: pointer; user-select: none; }
  .score-header-widget .score-ring-wrap { width: 48px; height: 48px; flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; }
  .score-header-widget .score-ring-value { font-size: 1.1rem; font-weight: 900; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
  .score-header-titles { display: flex; flex-direction: column; gap: 0; }
  .score-header-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); opacity: 0.8; }
  .score-header-status { font-size: 1.05rem; font-weight: 800; color: var(--text); line-height: 1.1; }
  .score-chevron { width: 20px; height: 20px; color: var(--text-muted); opacity: 0.4; transition: transform 0.3s ease; }
  .score-header-widget.is-expanded .score-chevron { transform: rotate(180deg); }
  .score-header-details { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease; opacity: 0; }
  .score-header-widget.is-expanded .score-header-details { max-height: 400px; opacity: 1; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
  .score-header-widget .score-subtext { font-size: 0.85rem; line-height: 1.45; color: var(--text); margin: 0; }
}

.insight {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
}

.insight-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.insight h3 {
  margin: 0;
  font-size: 0.94rem;
}

.insight p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.insight-metric {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.insight-good {
  border-color: var(--accent-border-soft);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 68%);
}

.insight-good .insight-metric {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-border-soft);
}

.insight-warn {
  border-color: var(--amber-border-soft);
  background: linear-gradient(180deg, var(--amber-soft) 0%, var(--surface) 68%);
}

.insight-warn .insight-metric {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border-soft);
}

.insight-info {
  border-color: var(--border);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 68%);
}

.expense-card:hover .expense-recommendation {
  transform: translateY(-1px);
  box-shadow: var(--shadow), inset 0 1px 0 var(--surface-sheen);
}

@keyframes card-deal {
  from {
    opacity: 0;
    transform: translateY(-40px) rotate(-4deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slide-right {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes number-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.1); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes hero-beam-drift {
  0%,
  100% {
    transform: translateX(-10%);
  }

  50% {
    transform: translateX(8%);
  }
}

@keyframes badge-sheen {
  0% {
    transform: translateX(-140%) skewX(-18deg);
  }

  100% {
    transform: translateX(260%) skewX(-18deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-panel::after {
    animation: hero-beam-drift 10s ease-in-out infinite;
  }
}

/* ── Credit card wallet stack ──────────────────────────────── */

.surface:has(#card-list) {
  overflow: visible;
}

#card-list {
  gap: 0;
}

#card-list .card-option {
  position: relative;
  display: block;
  height: 210px;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background:
    radial-gradient(ellipse 120% 100% at 108% 112%, var(--card-accent-secondary) 0%, transparent 56%),
    radial-gradient(ellipse 70% 70% at -6% -6%, rgba(255, 255, 255, 0.14) 0%, transparent 52%),
    var(--card-accent);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.28),
    0 6px 18px rgba(0, 0, 0, 0.16),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(0, 0, 0, 0.13);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 300ms ease;
}

#card-list .card-option + .card-option {
  margin-top: -140px;
}

#card-list .card-option:nth-child(1)  { z-index: 30; }
#card-list .card-option:nth-child(2)  { z-index: 29; }
#card-list .card-option:nth-child(3)  { z-index: 28; }
#card-list .card-option:nth-child(4)  { z-index: 27; }
#card-list .card-option:nth-child(5)  { z-index: 26; }
#card-list .card-option:nth-child(6)  { z-index: 25; }
#card-list .card-option:nth-child(7)  { z-index: 24; }
#card-list .card-option:nth-child(8)  { z-index: 23; }
#card-list .card-option:nth-child(9)  { z-index: 22; }
#card-list .card-option:nth-child(10) { z-index: 21; }
#card-list .card-option:nth-child(11) { z-index: 20; }
#card-list .card-option:nth-child(12) { z-index: 19; }
#card-list .card-option:nth-child(13) { z-index: 18; }
#card-list .card-option:nth-child(14) { z-index: 17; }
#card-list .card-option:nth-child(15) { z-index: 16; }
#card-list .card-option:nth-child(16) { z-index: 15; }
#card-list .card-option:nth-child(17) { z-index: 14; }
#card-list .card-option:nth-child(18) { z-index: 13; }
#card-list .card-option:nth-child(19) { z-index: 12; }
#card-list .card-option:nth-child(20) { z-index: 11; }
#card-list .card-option:nth-child(21) { z-index: 10; }
#card-list .card-option:nth-child(22) { z-index: 9; }
#card-list .card-option:nth-child(23) { z-index: 8; }
#card-list .card-option:nth-child(24) { z-index: 7; }
#card-list .card-option:nth-child(25) { z-index: 6; }
#card-list .card-option:nth-child(26) { z-index: 5; }
#card-list .card-option:nth-child(27) { z-index: 4; }
#card-list .card-option:nth-child(28) { z-index: 3; }
#card-list .card-option:nth-child(29) { z-index: 2; }
#card-list .card-option:nth-child(30) { z-index: 1; }

#card-list .card-option:hover,
#card-list .card-option:focus-within {
  animation: none;
  transform: translateY(-22px) scale(1.03);
  z-index: 40 !important;
  overflow: visible;
  box-shadow:
    0 38px 72px rgba(0, 0, 0, 0.42),
    0 14px 32px rgba(0, 0, 0, 0.26),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.42);
}

/* Holographic glass sheen layer */
#card-list .card-option::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    132deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.07) 40%,
    transparent 58%,
    rgba(0, 0, 0, 0.05) 100%
  );
  z-index: 1;
  border-radius: inherit;
}

/* Head fills entire card for absolute child positioning */
#card-list .card-option .card-option-head {
  position: absolute;
  inset: 0;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 3;
  overflow: visible;
}

#card-list .card-option .card-option-title {
  display: flex;
  align-items: flex-start;
}

/* Brand logo: top-left of card face */
#card-list .card-option .card-brand-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Lockup (logo + copy) sits at top-left */
#card-list .card-option .card-option-lockup {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

/* Name/meta block: anchored bottom-left */
#card-list .card-option .card-option-copy {
  position: absolute;
  bottom: 13px;
  left: 14px;
  right: 76px;
  display: grid;
  gap: 2px;
  min-width: 0;
  z-index: 4;
}

#card-list .card-option .card-name {
  color: rgba(255, 255, 255, 0.97);
  font-size: 0.93rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#card-list .card-option .card-meta {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Hide pill rows on card face */
#card-list .card-option .pill-row {
  display: none;
}

/* Show reward chips row in the middle */
#card-list .card-option .card-option-head + .pill-row {
  display: flex;
  position: absolute;
  top: 68px;
  left: 14px;
  right: 14px;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 4;
  pointer-events: none;
}

#card-list .card-option .card-option-head + .pill-row .pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.64rem;
  font-weight: 600;
  min-height: 20px;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

/* Annual fee pill: top center */
#card-list .card-option .card-option-head + .pill-row + .pill-row {
  display: flex;
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
}

#card-list .card-option .card-option-head + .pill-row + .pill-row .pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.66rem;
  font-weight: 700;
  min-height: 20px;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

#card-list .card-option .card-option-head + .pill-row + .pill-row .pill:not(:first-child) {
  display: none;
}

/* Edit + remove buttons: bottom-right, always in the visible peek zone */
.card-action-btn {
  position: absolute;
  bottom: 13px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  transition: background 150ms, color 150ms;
}

.card-action-btn[data-action="remove-card"] {
  right: 13px;
}

.card-action-btn[data-action="edit-card"] {
  right: 46px;
}

.card-action-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.3);
}

/* Mobile */
@media (max-width: 920px) {
  #card-list .card-option {
    height: 180px;
  }
  #card-list .card-option + .card-option {
    margin-top: -120px;
  }
}


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

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

  .toolbar {
    justify-content: start;
  }

  .sidebar {
    position: static;
    order: 1;
  }

  .main-column {
    order: 2;
  }

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

@media (max-width: 1280px) {
  .expense-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-span-2 {
    grid-column: span 2;
  }

  .expense-form .toggle-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 18px 14px 100px;
  }

  .title-block {
    min-height: auto;
    padding: 22px;
  }

  .topbar h1 {
    font-size: 2.2rem;
  }

  .upgrade-card-list,
  .upgrade-wallet-disclosure {
    margin-left: 16px;
    margin-right: 16px;
  }

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

  .field-span-2 {
    grid-column: auto;
  }

  .expense-form-modal {
    padding: 16px;
  }

  .card-form {
    padding: 16px;
  }

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

@media (max-width: 720px) {
  .confirm-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
  }

  #expense-view-switch {
    display: none;
  }

  .expense-list.is-grid {
    grid-template-columns: 1fr;
  }

  .surface {
    padding: 16px;
  }

  .title-block {
    padding: 20px 18px;
  }

  .topbar {
    gap: 18px;
  }

  .lede {
    font-size: 0.94rem;
  }

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

  .modal-shell {
    place-items: end stretch;
    padding: 12px 0 0;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100vh - 10px);
    border-radius: 20px 20px 0 0;
    animation: sheet-up 320ms cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  @keyframes sheet-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .modal-header {
    padding: 16px;
  }

  .breakdown-row-main,
  .expense-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .surface {
    padding: 16px;
  }

  .title-block {
    padding: 18px 16px;
  }

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

  .section-head,
  .breakdown-head,
  .insight-head {
    flex-direction: column;
  }

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

  .topbar h1 {
    font-size: 2rem;
  }

  .toolbar {
    width: 100%;
  }

  .section-actions {
    width: 100%;
  }

  .section-actions .button {
    flex: 1 1 auto;
  }

  .section-head .button {
    width: 100%;
  }

  .theme-switch {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar .button {
    flex: 1 1 auto;
  }

  .overview-head,
  .summary-caption {
    text-align: left;
  }

  .overview-head {
    flex-direction: column;
  }

  .recommendation-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .expense-form-modal .form-actions {
    padding-top: 4px;
  }

  .card-form .button,
  .card-form .button-ghost,
  .form-actions .button,
  .form-actions .button-ghost {
    width: 100%;
  }
}


/* ── Wallet mix: brand icon beside card name ────────────────── */
.breakdown-card-name {
  gap: 8px;
}

.breakdown-card-name .card-brand-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Remove the color dot now that we have the logo */
.breakdown-card-name::before {
  display: none;
}

/* ── Expense card hover: stronger lift ──────────────────────── */
.expense-card {
  transition: border-color 200ms ease, box-shadow 200ms ease,
              transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.expense-card:hover {
  transform: translateY(-3px);
}

/* ── Overview info button ───────────────────────────────────── */
#overview-info-btn.metric-tooltip-btn {
  position: static;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .overview-head .overview-caption-row {
    position: static;
  }

  #overview-info-btn.metric-tooltip-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    flex-shrink: unset;
  }
}

.overview-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.overview-caption-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-tooltip-btn.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Positioned by JS on desktop (position:fixed), static on mobile */
.overview-info-panel {
  display: none;
  z-index: 40;
  animation: tooltip-in 160ms ease both;
}

.overview-info-panel.is-open {
  display: grid;
}

@media (max-width: 920px) {
  .overview-info-panel.is-open {
    position: static;
    width: 100%;
    animation: none;
  }
}

/* ── Metric info button ──────────────────────────────────────── */
.metric-tooltip-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.metric-tooltip-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.4);
}

.metric.tooltip-open .metric-tooltip-btn {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

@keyframes tooltip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.overview-tooltip-pop {
  animation: tooltip-in 160ms ease both;
}

/* ── Card Picker Modal ─────────────────────────────────── */

.card-picker-search-wrap {
  padding: 10px 20px 4px;
  border-bottom: 1px solid var(--border);
}

.card-picker-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 150ms, box-shadow 150ms;
}

.card-picker-search::placeholder {
  color: var(--text-muted);
}

.card-picker-search:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-ring);
}

#card-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 20px 20px;
  overflow-y: auto;
  max-height: calc(100svh - 180px);
}

.card-picker-group {
  border-bottom: 1px solid var(--border);
}

.card-picker-group:last-child {
  border-bottom: none;
}

.card-picker-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 8px;
}

.card-picker-group-header::-webkit-details-marker {
  display: none;
}

.card-picker-group-header::before {
  content: "›";
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 160ms ease;
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
}

.card-picker-group[open] > .card-picker-group-header::before {
  transform: rotate(90deg);
}

.card-picker-group-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-picker-group-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
  line-height: 1.6;
}

.card-picker-group-body {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
}

.card-picker-empty {
  padding: 24px 0;
  text-align: center;
}

.card-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border, var(--border));
  background: var(--card-surface, var(--surface-muted));
}

.card-picker-info {
  flex: 1;
  min-width: 0;
}

.card-picker-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-picker-icon {
  flex-shrink: 0;
}

.card-picker-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.card-picker-meta {
  display: block;
  font-size: 0.75rem;
  margin-top: 2px;
}

.card-picker-pills {
  margin-top: 4px;
}

.card-picker-add-btn {
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 5px 14px;
}

/* Add card button in wallet header */
.section-head .button-sm {
  font-size: 0.78rem;
  padding: 5px 12px;
  flex-shrink: 0;
}

/* ── Onboarding modal ──────────────────────────────────────── */

.onboarding-card {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.onboarding-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 22px 24px 0;
}

.onboarding-step {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 200ms ease, transform 200ms ease;
}

.onboarding-step.is-active {
  background: var(--accent);
  transform: scale(1.3);
}

.onboarding-step.is-done {
  background: var(--accent-soft);
}

.onboarding-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 28px 20px;
  gap: 12px;
}

@keyframes onboarding-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.onboarding-icon {
  font-size: 3rem;
  line-height: 1;
  animation: onboarding-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.onboarding-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  line-height: 1.3;
  max-width: 26ch;
  animation: onboarding-in 240ms cubic-bezier(0.22, 1, 0.36, 1) 40ms both;
}

.onboarding-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 38ch;
  animation: onboarding-in 240ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

.onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-strong);
  gap: 12px;
}

/* ── Hint bar ──────────────────────────────────────────────── */

.hint-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.hint-bar-text {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

.hint-bar-dismiss {
  flex-shrink: 0;
}

/* ── Confirm dialog ── */
.confirm-card {
  width: min(90vw, 380px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 28px 24px;
  gap: 10px;
}

.confirm-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 2px;
}

.confirm-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}

.confirm-body {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 30ch;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.confirm-actions .button {
  flex: 1;
}

.button-danger {
  background: var(--rose);
  color: white;
  box-shadow: none;
}

.button-danger:hover {
  background: var(--rose);
  filter: brightness(1.1);
}

/* ── Hero help button ── */
.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.hero-help-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms, border-color 150ms;
  flex-shrink: 0;
}

.hero-help-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
}

:root[data-theme="light"] .hero-help-btn {
  border: 1px solid rgba(80, 60, 160, 0.25);
  background: rgba(80, 60, 160, 0.08);
  color: rgba(30, 20, 80, 0.6);
}

:root[data-theme="light"] .hero-help-btn:hover {
  background: rgba(80, 60, 160, 0.15);
  color: rgba(30, 20, 80, 0.9);
}

/* ── Wallet Score Tile ── */
.metric-score-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: inset 0 1px 0 var(--surface-sheen);
  min-height: 0;
  text-align: left;
  justify-content: flex-start;
}

.score-ring-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.score-ring-svg {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.score-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 5;
}

.score-ring-fill {
  fill: none;
  stroke: #1db954;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 163.4;
  stroke-dashoffset: 163.4;
  transition: stroke-dashoffset 800ms cubic-bezier(0.22, 1, 0.36, 1),
              stroke 400ms ease;
}

.score-ring-fill.score-low  { stroke: #ff4d4d; }
.score-ring-fill.score-mid  { stroke: #f5a623; }
.score-ring-fill.score-high { stroke: #1db954; }

.score-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.score-tile-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  position: relative;
}

.score-info-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 280px;
  z-index: 200;
  animation: tooltip-in 160ms ease both;
  text-align: left;
}

.score-info-panel.is-open {
  display: grid;
}

@media (max-width: 720px) {
  .score-info-panel.is-open {
    position: static;
    display: grid;
    width: 100%;
    margin: 10px 0 4px;
    padding: 12px 14px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: mobile-tooltip-slide-in 260ms ease both;
  }
}

.score-subtext {
  font-size: 0.78rem;
  line-height: 1.3;
  margin: 0;
  width: 100%;
}

.score-subtext a {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Overview annual fee toggle ── */
.overview-fee-row {
  padding: 10px 0 2px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.fee-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.fee-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.fee-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  border: 1px solid var(--border);
  transition: background 180ms ease, border-color 180ms ease;
  flex-shrink: 0;
}

.fee-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fee-switch input:checked ~ .fee-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.fee-switch input:checked ~ .fee-switch-track .fee-switch-thumb {
  transform: translateX(14px);
}

.fee-switch-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 180ms;
}

.fee-switch:has(input:checked) .fee-switch-label {
  color: var(--accent);
}

.fee-switch-sublabel {
  display: block;
  font-size: 0.72rem;
  opacity: 0.55;
  margin-top: 1px;
}

/* Mobile-only annual fee toggle — hidden on desktop */
.mobile-fee-switch { display: none; }

/* Recurring switch layout in expense form */
.recurring-switch {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 100%);
}

/* ── Animations ───────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  /* Hero page-load entrance (fires once, not in innerHTML containers) */
  .title-block h1 {
    animation: fade-up 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 80ms;
  }
  .title-block .lede {
    animation: fade-up 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 160ms;
  }
  .title-block .toolbar {
    animation: fade-up 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 220ms;
  }
  .overview-panel {
    animation: fade-up 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 120ms;
  }

  /* Expense cards — only when .is-animating is set by JS on real content changes */
  .expense-list.is-animating .expense-card {
    animation: fade-up 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .expense-list.is-animating .expense-card:nth-child(1) { animation-delay: 0ms; }
  .expense-list.is-animating .expense-card:nth-child(2) { animation-delay: 50ms; }
  .expense-list.is-animating .expense-card:nth-child(3) { animation-delay: 100ms; }
  .expense-list.is-animating .expense-card:nth-child(4) { animation-delay: 150ms; }
  .expense-list.is-animating .expense-card:nth-child(5) { animation-delay: 190ms; }
  .expense-list.is-animating .expense-card:nth-child(6) { animation-delay: 220ms; }
  .expense-list.is-animating .expense-card:nth-child(7) { animation-delay: 250ms; }
  .expense-list.is-animating .expense-card:nth-child(8) { animation-delay: 270ms; }

  /* Expense card hover lift */
  .expense-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
  }

  /* Insight cards */
  .insight-list.is-animating .insight {
    animation: fade-up 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .insight-list.is-animating .insight:nth-child(1) { animation-delay: 0ms; }
  .insight-list.is-animating .insight:nth-child(2) { animation-delay: 60ms; }
  .insight-list.is-animating .insight:nth-child(3) { animation-delay: 110ms; }
  .insight-list.is-animating .insight:nth-child(4) { animation-delay: 150ms; }

  /* Wallet mix breakdown rows */
  #card-breakdown.is-animating .breakdown-row {
    animation: fade-up 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  #card-breakdown.is-animating .breakdown-row:nth-child(1) { animation-delay: 0ms; }
  #card-breakdown.is-animating .breakdown-row:nth-child(2) { animation-delay: 50ms; }
  #card-breakdown.is-animating .breakdown-row:nth-child(3) { animation-delay: 90ms; }
  #card-breakdown.is-animating .breakdown-row:nth-child(4) { animation-delay: 120ms; }
  #card-breakdown.is-animating .breakdown-row:nth-child(5) { animation-delay: 145ms; }

  /* Wallet deck cards — deal in only on real wallet changes */
  #card-list.is-animating .card-option {
    animation: card-deal 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  #card-list.is-animating .card-option:nth-child(1) { animation-delay: 0ms; }
  #card-list.is-animating .card-option:nth-child(2) { animation-delay: 80ms; }
  #card-list.is-animating .card-option:nth-child(3) { animation-delay: 150ms; }
  #card-list.is-animating .card-option:nth-child(4) { animation-delay: 210ms; }
  #card-list.is-animating .card-option:nth-child(5) { animation-delay: 260ms; }
  #card-list.is-animating .card-option:nth-child(6) { animation-delay: 300ms; }
  #card-list.is-animating .card-option:nth-child(7) { animation-delay: 335ms; }
  #card-list.is-animating .card-option:nth-child(8) { animation-delay: 365ms; }

  /* Metric tiles */
  .metric {
    animation: scale-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .metric:nth-child(1) { animation-delay: 60ms; }
  .metric:nth-child(2) { animation-delay: 100ms; }
  .metric:nth-child(3) { animation-delay: 140ms; }
  .metric:nth-child(4) { animation-delay: 180ms; }

  /* Cap bars grow from left */
  .cap-bar-fill {
    transform-origin: left;
    animation: slide-right 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 150ms;
  }

  /* Button press micro-interaction */
  .button:active {
    transform: scale(0.96);
    transition: transform 80ms ease;
  }
  .icon-button:active,
  .card-action-btn:active {
    transform: scale(0.88);
    transition: transform 80ms ease;
  }
}

/* Modal spring entrance on desktop */
@media (prefers-reduced-motion: no-preference) and (min-width: 721px) {
  .modal-card {
    animation: scale-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
}

/* ── Mobile tab navigation ──────────────────────────────────── */

.mobile-tab-bar {
  display: none;
}

.mobile-topbar-nav {
  display: none;
}

.mobile-metric-info-btn {
  display: none;
}

.mobile-fab {
  display: none;
}

@media (max-width: 720px) {
  /* Fixed header */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    gap: 0;
    margin-bottom: 0;
    background: var(--bg);
    backdrop-filter: blur(24px) saturate(200%) brightness(1.08);
  }

  .hero-panel {
    display: none;
  }

  /* Compact overview strip */
  .surface.overview-panel {
    border-radius: 0;
    border: none;
    background: transparent;
    padding: 8px 16px 10px;
    backdrop-filter: none;
    box-shadow: none;
  }

  .overview-head,
  .overview-fee-row {
    display: none;
  }

  /* section-mix section-head: caption left, fee toggle right */
  #section-mix .section-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 8px;
  }

  #section-mix .section-head > div {
    display: none;
  }

  #section-mix #breakdown-caption {
    flex: 1;
    font-size: 0.8rem;
  }

  /* Hide the insights section-head on mobile (label/h2 only, empty on mobile) */
  #section-insights .section-head {
    display: none;
  }

  .overview-panel .metric-grid {
    display: flex;
    gap: 0;
  }

  /* Header info panel: slide in when opened, instant hide when closed */
  .overview-info-panel.is-open {
    display: block;
    padding: 12px 16px;
    background: var(--surface-strong);
    border-top: 1px solid var(--border);
    animation: panel-slide-down 280ms ease both;
  }

  @keyframes panel-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ! button inside the metric strip */
  .mobile-metric-info-btn {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-metric-info-btn.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text);
    border-color: var(--accent);
  }

  .overview-panel .metric {
    flex: 1;
    min-height: 0;
    padding: 4px 6px;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    gap: 2px;
    text-align: center;
    align-items: center;
  }

  .overview-panel .metric:last-child {
    border-right: none;
  }

  .overview-panel .metric::before {
    display: none;
  }

  .overview-panel .metric-primary {
    background: none;
    border-color: transparent;
    box-shadow: none;
  }

  .overview-panel .metric-primary strong {
    color: var(--accent);
  }

  .overview-panel .metric strong {
    font-size: 0.84rem;
  }

  .overview-panel .metric-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  /* Solid background on mobile — no gradient */
  html, body {
    background: #e8eaf4;
  }

  /* :root IS html — use :root selector directly, not :root html */
  :root[data-theme="dark"],
  :root[data-theme="dark"] body {
    background: #080612;
  }

  /* Remove side padding from app-shell so topbar is naturally full-width */
  .app-shell {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  /* Content grid: push below fixed header, edge-to-edge */
  .app-grid {
    padding: 0;
    gap: 0;
    margin-top: var(--mobile-header-h, 102px);
  }

  /* Sections become full-width pages — strip ALL borders and card look */
  #section-cards,
  #section-spend,
  #section-mix,
  #section-insights {
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    background: transparent;
    padding: 0;
  }

  /* Remove borders from all list items inside sections */
  .breakdown-row,
  .insight-info,
  .card-option {
    border-color: transparent;
  }

  /* Section head: compact, no page title on mobile */
  .section-head {
    padding: 12px 16px;
    border-bottom: none;
    margin-bottom: 0;
  }

  .section-head h2,
  .section-head .section-label {
    display: none;
  }

  /* Hide inline add buttons — FAB replaces them */
  #section-cards .section-head .button,
  #section-spend .section-head .button,
  #section-spend .section-head .section-actions {
    display: none;
  }

  /* Content areas: restore padding inside sections */
  #card-list {
    padding: 12px 16px 20px;
  }

  .expense-list {
    padding: 12px 16px 20px;
  }

  #expense-empty {
    margin: 12px 16px 20px;
  }

  #card-breakdown {
    padding: 8px 16px 20px;
  }

  #insight-list {
    padding: 12px 16px 20px;
  }

  /* Hide hint bar on mobile */
  #hint-bar-mount {
    display: none;
  }

  /* Show the annual fee toggle in the insights section head */
  .mobile-fee-switch {
    display: inline-flex;
  }

  /* Remove bottom dividers from stacked lists */
  .stack > * + *,
  .stack.compact > * + * {
    border-top: none;
  }

  .insight-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* FAB lives inside the tab bar — width collapses to 0 when hidden so it takes no space */
  .mobile-fab {
    display: flex;
    flex-shrink: 0;
    width: 0;
    min-width: 0;
    padding: 0;
    height: 44px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
    color: var(--button-text);
    border: 0px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    box-shadow: 0 14px 28px var(--button-glow), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    pointer-events: none;
    margin-left: 0;
    transform: scale(0);
    transition: all 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .mobile-fab .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  body[data-mobile-tab="wallet"] .mobile-fab:active,
  body[data-mobile-tab="spend"] .mobile-fab:active {
    transform: scale(0.88);
  }

  /* Reveal FAB on wallet + spend tabs */
  body[data-mobile-tab="wallet"] .mobile-fab,
  body[data-mobile-tab="spend"] .mobile-fab {
    width: 44px;
    border-width: 1px;
    margin-left: 2px;
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }

  /* Prevent iOS Safari auto-zoom on focus */
  input, select, textarea {
    font-size: 16px;
  }

  /* Mobile nav header */
  .mobile-topbar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
  }

  .mobile-brand .icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
  }

  .mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .mobile-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 120ms ease, color 120ms ease;
  }

  .mobile-icon-btn:active {
    background: var(--hover);
    color: var(--text);
  }

  .mobile-icon-btn .icon {
    width: 20px;
    height: 20px;
  }

  .mobile-info-btn,
  .mobile-help-btn {
    font-size: 1rem;
    font-weight: 600;
    width: 32px;
    height: 32px;
    border-radius: 50%;
  }

  .mobile-info-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  /* Sun shown in dark mode, moon in light mode */
  :root[data-theme="dark"] .mobile-theme-moon { display: none; }
  :root[data-theme="light"] .mobile-theme-sun { display: none; }

  /* Hide entire tab bar (incl. FAB inside it) when a modal is open */
  body.modal-open .mobile-tab-bar { display: none !important; }

  /* Sections hidden by default; shown via body[data-mobile-tab] selector */
  #section-cards,
  #section-mix,
  #section-spend,
  #section-insights {
    display: none;
  }

  body[data-mobile-tab="wallet"] #section-cards { display: block; }
  body[data-mobile-tab="spend"] #section-spend { display: block; }
  body[data-mobile-tab="insights"] #section-mix,
  body[data-mobile-tab="insights"] #section-insights { display: block; }

  /* ── Floating capsule tab bar ────────────────────────────── */
  .mobile-tab-bar {
    display: flex;
    align-items: center;
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100vw - 32px);
    height: 60px;
    padding: 5px 6px;
    gap: 0;
    background: color-mix(in srgb, var(--surface-strong) 80%, transparent);
    backdrop-filter: blur(40px) saturate(220%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(220%) brightness(1.1);
    border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    border-radius: 9999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14),
                0 1px 0 rgba(255, 255, 255, 0.12) inset;
    z-index: 100;
  }

  :root[data-theme="dark"] .mobile-tab-bar {
    background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.36),
                0 1px 0 rgba(255, 255, 255, 0.06) inset;
  }

  .mobile-tab + .mobile-tab {
    margin-left: 2px;
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 26px;
    background: none;
    border: none;
    border-radius: 9999px;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 180ms ease, background 180ms ease;
  }

  .mobile-tab .icon {
    width: 22px;
    height: 22px;
    transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* Active: filled pill inside the capsule */
  .mobile-tab.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
  }

  .mobile-tab.is-active .icon {
    transform: scale(1.08);
  }

  /* Tab switch animation */
  #section-cards,
  #section-spend,
  #section-mix,
  #section-insights {
    animation: tab-fade-in 220ms ease both;
  }

  /* ── Compact spend list ─────────────────────────────────── */

  /* Force list mode; no gaps between rows */
  .expense-list.is-grid { grid-template-columns: 1fr; }
  .expense-list { gap: 8px; }

  /* Compact card — grid: head | tags+actions | body */
  .expense-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "head   head"
      "tags   acts"
      "body   body";
    gap: 6px 8px;
    padding: 14px 14px;
    border-radius: 16px;
    transform: none !important;
  }

  /* Row 1: title left, amount right — already a flex row */
  .expense-card-head {
    grid-area: head;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .expense-card-amount {
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .expense-card-title { font-size: 0.92rem; }

  .expense-card-meta {
    margin-top: 1px;
    font-size: 0.74rem;
  }

  /* Row 2 left: tags */
  .expense-card-tags {
    grid-area: tags;
    align-self: center;
    gap: 4px;
  }

  .expense-card-tags .pill {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  /* Row 2 right: action buttons */
  .expense-card-actions {
    grid-area: acts;
    align-self: center;
    border-top: none;
    padding-top: 0;
    flex-direction: row;
    gap: 2px;
  }

  .expense-card-actions .icon-button {
    width: 32px;
    height: 32px;
  }

  /* Row 3: recommendation full-width */
  .expense-card-body {
    grid-area: body;
    padding-top: 6px;
    border-top: none;
  }

  /* ── Flat recommendation row — no inner card ──────────────── */

  /* Strip every card-like style from the recommendation block */
  .expense-recommendation {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 10px;
    margin-top: 4px;
    background: var(--card-surface) !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 10px !important;
    overflow: visible;
  }

  /* Swap button visibility on mobile */
  .metric-info-button.metric-info-desktop { display: none; }
  .metric-info-button.metric-info-mobile  { display: inline-grid; flex-shrink: 0; }

  /* Top row: logo+name on left, numbers in middle, ! button on right */
  .recommendation-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  /* Left: logo + name */
  .recommendation-head {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
  }

  .recommendation-head-copy { min-width: 0; flex: 1; }
  .recommendation-lockup { gap: 7px; min-width: 0; align-items: center; }

  .recommendation-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Middle: plain numbers, no labels, no boxes */
  .recommendation-metrics {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .recommendation-metrics .recommendation-metric {
    all: unset;
    display: flex;
    align-items: center;
  }

  .recommendation-metrics .recommendation-metric-label { display: none; }
  .recommendation-metrics .recommendation-metric-head { display: none; }

  .recommendation-value {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
  }

  /* Dot separator between value and earn */
  .recommendation-metrics .recommendation-metric + .recommendation-metric::before {
    content: "·";
    opacity: 0.35;
    margin-right: 4px;
    font-weight: 400;
    font-size: 1rem;
  }

  /* Hide confidence score and detail pills */
  .expense-recommendation .confidence { display: none; }
  .recommendation-pill-row { display: none; }

  /* Tooltip expands as second row when open — slide in from top */
  .expense-recommendation.has-open-tooltip .metric-tooltip-card {
    position: static;
    display: grid;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
    animation: mobile-tooltip-slide-in 260ms ease both;
  }

  @keyframes mobile-tooltip-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Hide cap bars inside expense cards only */
  .expense-recommendation .cap-bars { display: none; }
}

@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── OTP digit input group ─────────────────────────────────────── */
.otp-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.otp-input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.otp-digit {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  aspect-ratio: 1;
  min-height: unset;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0;
  caret-color: transparent;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  -moz-appearance: textfield;
}

.otp-digit::-webkit-outer-spin-button,
.otp-digit::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus-ring), 0 2px 8px var(--accent-shadow);
  background: var(--surface-hover);
}

.otp-digit.is-filled {
  border-color: var(--accent-focus-border);
  background: var(--surface-hover);
}

.otp-digit.is-error {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-soft);
  animation: otp-shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.otp-divider {
  color: var(--border-strong);
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

@keyframes otp-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
