:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-soft: #f8fafc;
  --input-bg: #ffffff;
  --table-hover: #fbfdff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ef;
  --line-strong: #c8d3e1;
  --nav: #111827;
  --nav-soft: #1f2937;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #ccfbf1;
  --accent-glow: #5eead4;
  --accent-panel: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 24%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 16%, transparent);
  --warning: #d97706;
  --danger: #dc2626;
  --positive: #16a34a;
  --blue: #2563eb;
  --plum: #7c3aed;
  --gold: #f59e0b;
  --chart-income: var(--accent);
  --chart-spending: var(--danger);
  --chart-commitment: var(--warning);
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --sidebar-width: 330px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --mobile-nav-height: 76px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #172033;
  --surface-soft: #172033;
  --input-bg: #0f172a;
  --table-hover: #172033;
  --ink: #e5eefb;
  --muted: #94a3b8;
  --line: #334155;
  --line-strong: #475569;
  --nav: #020617;
  --nav-soft: #0f172a;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-soft: #134e4a;
  --accent-glow: #5eead4;
  --warning: #f59e0b;
  --danger: #f87171;
  --positive: #4ade80;
  --blue: #60a5fa;
  --plum: #a78bfa;
  --gold: #fbbf24;
  --chart-income: var(--accent);
  --chart-spending: var(--danger);
  --chart-commitment: var(--warning);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.36);
}

:root[data-chart-style="glow"] {
  --chart-income: var(--accent-glow);
  --chart-spending: #f43f5e;
  --chart-commitment: #f59e0b;
}

:root[data-theme="dark"][data-chart-style="glow"] {
  --chart-income: var(--accent-glow);
  --chart-spending: #fb7185;
  --chart-commitment: #fbbf24;
}

:root[data-chart-style="mono"] {
  --chart-income: #334155;
  --chart-spending: #64748b;
  --chart-commitment: #94a3b8;
}

:root[data-theme="dark"][data-chart-style="mono"] {
  --chart-income: #cbd5e1;
  --chart-spending: #94a3b8;
  --chart-commitment: #64748b;
}

:root[data-accent="ocean"] {
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-glow: #67e8f9;
}

:root[data-accent="violet"] {
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: #ede9fe;
  --accent-glow: #c4b5fd;
}

:root[data-accent="rose"] {
  --accent: #e11d48;
  --accent-strong: #be123c;
  --accent-soft: #ffe4e6;
  --accent-glow: #fda4af;
}

:root[data-accent="gold"] {
  --accent: #d97706;
  --accent-strong: #b45309;
  --accent-soft: #fef3c7;
  --accent-glow: #fde68a;
}

:root[data-theme="dark"][data-accent="ocean"] {
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #1e3a8a;
  --accent-glow: #93c5fd;
}

:root[data-theme="dark"][data-accent="violet"] {
  --accent: #a78bfa;
  --accent-strong: #c4b5fd;
  --accent-soft: #4c1d95;
  --accent-glow: #c4b5fd;
}

:root[data-theme="dark"][data-accent="rose"] {
  --accent: #fb7185;
  --accent-strong: #fda4af;
  --accent-soft: #881337;
  --accent-glow: #fda4af;
}

:root[data-theme="dark"][data-accent="gold"] {
  --accent: #fbbf24;
  --accent-strong: #fde68a;
  --accent-soft: #78350f;
  --accent-glow: #fde68a;
}

:root[data-color-assist="contrast"],
:root[data-color-assist="patterns"] {
  --chart-income: #0072b2;
  --chart-spending: #d55e00;
  --chart-commitment: #cc79a7;
}

:root[data-theme="dark"][data-color-assist="contrast"],
:root[data-theme="dark"][data-color-assist="patterns"] {
  --chart-income: #56b4e9;
  --chart-spending: #e69f00;
  --chart-commitment: #cc79a7;
}

/* Base reset and iOS-friendly viewport handling */
* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

:root[data-backdrop="grid"] body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.055) 1px, transparent 1px);
  background-size: 36px 36px;
}

:root[data-theme="dark"][data-backdrop="grid"] body {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
}

:root[data-backdrop="paper"] body {
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.025) 0 1px, transparent 1px 9px);
}

:root[data-theme="dark"][data-backdrop="paper"] body {
  background-image:
    repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.04) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.03) 0 1px, transparent 1px 9px);
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: var(--accent-ring);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.hidden {
  display: none !important;
}

.auth-screen,
.onboarding-screen {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Login and first-run onboarding */
.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  background: var(--bg);
}

.auth-copy {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: clamp(28px, 5vw, 72px);
  color: #ffffff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 28%, transparent), transparent 38%),
    var(--nav);
}

.auth-copy::before,
.auth-copy::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.auth-copy::before {
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-position: 0 0;
  background-size: 48px 48px;
  animation: authGridDrift 22s linear infinite;
}

.auth-copy::after {
  opacity: 0.46;
  background:
    linear-gradient(115deg, transparent 0 54%, rgba(255, 255, 255, 0.08) 55%, transparent 56%),
    repeating-linear-gradient(
      90deg,
      transparent 0 22px,
      color-mix(in srgb, var(--accent-glow) 18%, transparent) 22px 24px,
      transparent 24px 72px
    );
  transform: translateX(-12%);
  animation: authSignalSweep 14s ease-in-out infinite alternate;
}

.auth-copy > * {
  position: relative;
  z-index: 1;
}

.auth-copy h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.auth-word-rotator {
  display: inline-grid;
  min-width: 4.8em;
  color: var(--accent-glow);
  vertical-align: baseline;
}

.auth-word-rotator span {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(0.52em);
  animation: authWordRotate 12s ease-in-out infinite;
}

.auth-word-rotator span:nth-child(2) {
  animation-delay: 3s;
}

.auth-word-rotator span:nth-child(3) {
  animation-delay: 6s;
}

.auth-word-rotator span:nth-child(4) {
  animation-delay: 9s;
}

.auth-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-stats span {
  padding: 10px 12px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  font-weight: 800;
}

.auth-card {
  align-self: center;
  width: min(460px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-tab {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.auth-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
}

.auth-panel {
  display: none;
  gap: 14px;
}

.auth-panel.active {
  display: grid;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

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

.login-mfa-panel {
  display: grid;
}

.auth-screen .field:has(> input[required]) > .field-label-row::after,
.auth-screen .field:has(> select[required]) > .field-label-row::after,
.auth-screen .field:has(> textarea[required]) > .field-label-row::after {
  content: none;
  display: none;
}

@keyframes authGridDrift {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 48px 48px;
  }
}

@keyframes authSignalSweep {
  0% {
    transform: translateX(-12%);
  }

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

@keyframes authWordRotate {
  0%,
  18% {
    opacity: 0;
    transform: translateY(0.52em);
  }

  24%,
  42% {
    opacity: 1;
    transform: translateY(0);
  }

  48%,
  100% {
    opacity: 0;
    transform: translateY(-0.52em);
  }
}

.onboarding-screen {
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) max(24px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(24px, var(--safe-left));
  background: var(--bg);
}

.onboarding-card {
  width: min(1120px, 100%);
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.wizard-status {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.wizard-status span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wizard-progress {
  overflow: hidden;
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.wizard-progress span {
  display: block;
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--blue), var(--gold));
  border-radius: inherit;
  transition: width 220ms ease;
}

.wizard-steps {
  min-height: 470px;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: grid;
  min-height: 470px;
  animation: setupStepIn 260ms ease both;
}

.wizard-step h3 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4.7rem);
  line-height: 1;
}

.setup-copy {
  max-width: 680px;
  margin: 12px 0 20px;
  color: var(--muted);
}

.solo-field {
  max-width: 460px;
  margin-top: 22px;
}

.tax-toggle {
  max-width: 560px;
  margin-top: 14px;
}

.tax-preview {
  max-width: 680px;
  margin-top: 14px;
  padding: 14px;
  color: var(--accent-strong);
  background: var(--accent-panel);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-weight: 800;
}

.setup-step-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 0.94fr);
  gap: clamp(18px, 4vw, 44px);
  align-items: center;
  min-height: inherit;
}

.setup-step-copy {
  display: grid;
  gap: 10px;
}

.setup-fields-panel {
  display: grid;
  gap: 16px;
  padding: clamp(14px, 2.4vw, 24px);
  background:
    linear-gradient(180deg, var(--accent-panel), transparent 36%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.setup-fields-panel .form-grid {
  gap: 12px;
}

.setup-summary,
.setup-note {
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 800;
}

.setup-note {
  justify-self: start;
  border-left-color: var(--blue);
}

@keyframes setupStepIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-step.active {
    animation: none;
  }

  .wizard-progress span {
    transition: none;
  }
}

.wizard-actions {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

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

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

.setup-panel h3 {
  margin: 0 0 14px;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Main app chrome */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: calc(22px + var(--safe-top)) 16px calc(22px + var(--safe-bottom));
  color: #ffffff;
  background: var(--nav);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-button {
  min-height: auto;
  width: 100%;
  padding: 6px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
}

.brand-button:hover,
.brand-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: 0;
}

.brand-large {
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  background: var(--accent-glow);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 36%, transparent);
  overflow: hidden;
}

.brand-mark svg {
  width: 78%;
  height: 78%;
}

.spentlo-mark-flow,
.spentlo-mark-base {
  fill: none;
  stroke: #052e2b;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spentlo-mark-flow {
  opacity: 0.34;
}

.spentlo-mark-coin {
  fill: var(--warning);
  stroke: #052e2b;
  stroke-width: 4;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.12rem;
  letter-spacing: 0;
}

.brand p {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.84rem;
}

.mobile-top-actions {
  display: none;
}

.mobile-icon-button {
  display: grid;
  place-items: center;
}

.user-card {
  display: grid;
  gap: 9px;
  min-height: 86px;
  padding: 12px;
  margin: 22px 0 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}

.user-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-card-details {
  min-width: 0;
  flex: 1 1 auto;
}

.person-scope-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 6px;
}

.person-scope-control span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.person-scope-control select {
  min-width: 128px;
  height: 34px;
  padding: 0 26px 0 10px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 900;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card .person-scope-control span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.72rem;
}

.user-card-email {
  width: 100%;
  max-width: 100%;
}

.user-settings-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.user-settings-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.user-settings-button:hover,
.user-settings-button:focus-visible,
.user-settings-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--accent);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 950;
}

.avatar.has-image {
  background: var(--surface-2);
}

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

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--accent-glow);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 900;
}

.nav-symbol {
  display: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.app-version {
  display: block;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
}

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

#adminNavLink {
  display: none !important;
}

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

.sidebar .eyebrow {
  color: rgba(255, 255, 255, 0.54);
}

.mini-meter {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.mini-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent-glow);
  border-radius: inherit;
  transition: width 180ms ease;
}

:root[data-color-assist="patterns"] .mini-meter span,
:root[data-color-assist="patterns"] .progress span {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.42) 0 4px,
    transparent 4px 8px
  );
}

.sidebar-footer strong {
  display: block;
  margin-top: 10px;
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  overflow-x: hidden;
  padding: 24px clamp(18px, 3vw, 38px) 38px;
}

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

.topbar h2,
.section-heading h3,
.panel h3,
.modal h3,
.hero-panel h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-actions.settings-mode .workspace-action {
  display: none;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.save-status.saving {
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.34);
  background: #fffbeb;
}

.save-status.error {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.28);
  background: #fef2f2;
}

.save-status.saved {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-panel);
}

.period-control,
.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.period-control input,
.period-control select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
}

.period-control input[type="date"],
.field input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.period-control input[type="date"]::-webkit-date-and-time-value,
.field input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.25em;
  text-align: left;
}

.field input[readonly],
.field textarea[readonly] {
  color: var(--muted);
  background: var(--surface-2);
  cursor: default;
}

.field-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.verified-badge {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  color: #ffffff;
  background: #16a34a;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.verified-badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.8;
}

.field textarea {
  resize: vertical;
}

.field-title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.field-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.field:has(> input[required]) > .field-label-row::after,
.field:has(> select[required]) > .field-label-row::after,
.field:has(> textarea[required]) > .field-label-row::after {
  content: "Required";
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  color: var(--accent);
  background: var(--accent-panel);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field-help-button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  color: var(--accent);
  background: var(--accent-panel);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.field-help-button:hover,
.field-help-button:focus-visible,
.field-help-button[aria-expanded="true"] {
  color: #ffffff;
  background: var(--accent);
}

.field-help-text {
  padding: 9px 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
}

.icon-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 32px);
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-toggle-button {
  display: grid;
  place-items: center;
  min-height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 950;
}

.icon-toggle-button:hover,
.icon-toggle-button:focus-visible,
.icon-toggle-button.active {
  color: #ffffff;
  background: var(--accent);
}

.checkbox-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 800;
}

.checkbox-field .field-label-row {
  flex: 1 1 min(220px, 100%);
}

.checkbox-field .field-help-text {
  flex: 1 0 100%;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.account-updates-field {
  flex-wrap: nowrap;
  align-self: end;
  min-height: 42px;
  height: 42px;
}

.account-updates-field span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-control input:focus,
.period-control select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.button,
.text-button,
.icon-button {
  border: 0;
  border-radius: var(--radius);
  font-weight: 900;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  white-space: nowrap;
}

.button.primary {
  color: #ffffff;
  background: var(--accent);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--accent-strong);
}

.button.secondary {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.button.danger {
  color: #ffffff;
  background: var(--danger);
}

.button.danger:hover,
.button.danger:focus-visible {
  filter: brightness(0.94);
}

.full-button {
  width: 100%;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.text-button {
  padding: 6px 0;
  color: var(--accent);
  background: transparent;
}

.text-button.light {
  color: var(--accent-glow);
  font-size: 0.82rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Cards, panels, charts, and data views */
.view {
  display: none;
}

.view.active {
  display: block;
}

#dashboardView.active {
  display: grid;
  gap: 14px;
}

.hero-panel {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(18px, 3vw, 28px);
  color: #ffffff;
  background: var(--nav);
  border-radius: var(--radius);
}

.hero-panel h3 {
  max-width: 780px;
  font-size: clamp(1.55rem, 4vw, 3.1rem);
}

.hero-panel p {
  max-width: 720px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

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

.forecast-stack {
  display: grid;
  align-content: center;
  justify-items: end;
  min-width: 150px;
}

.forecast-stack span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.forecast-stack strong {
  margin-top: 6px;
  color: var(--accent-glow);
  font-size: 2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.section-heading h3 {
  font-size: 1.35rem;
}

.view > .section-heading > div > h3 {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.view > .section-heading > div {
  min-width: 0;
}

.view > .section-heading > div > p {
  max-width: 780px;
  margin-top: 0;
}

.section-heading p,
.subsection-heading p,
.panel-header p,
.metric-card p,
.empty-state p,
.finance-card p,
.person-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.view-stack {
  display: grid;
  gap: 24px;
}

.income-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 24px;
}

.income-card {
  min-height: 250px;
}

#transactionsView .tool-row {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 220px) auto;
}

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-nav {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-nav-link {
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  font-weight: 900;
}

.settings-nav-link:hover,
.settings-nav-link:focus-visible,
.settings-nav-link.active {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
}

.settings-content,
.settings-panel.active {
  min-width: 0;
  align-self: start;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.achievement-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(16px, 2vw, 22px);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, var(--accent) 6%), var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
}

.achievement-panel::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.1) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.5), transparent 56%);
}

.achievement-collection-panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface-2));
}

.achievement-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(124px, auto);
  gap: 16px;
  align-items: center;
}

.achievement-hero h3,
.achievement-hero p {
  margin: 0;
}

.achievement-hero p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.achievement-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  aspect-ratio: 1;
  color: var(--ink);
  background:
    conic-gradient(var(--accent) var(--achievement-progress), color-mix(in srgb, var(--line) 72%, transparent) 0);
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 16px 32px rgba(2, 6, 23, 0.14);
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: achievementPulse 3.2s ease-in-out infinite;
}

.achievement-ring::before {
  position: absolute;
  inset: 11px;
  content: "";
  background:
    linear-gradient(180deg, var(--surface), var(--surface-2));
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
}

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

.achievement-ring strong {
  font-size: 1.25rem;
  font-weight: 950;
}

.achievement-ring span,
.achievement-meta span,
.achievement-step-body span,
.achievement-status,
.achievement-tier,
.achievement-spotlight span,
.achievement-spotlight small,
.achievement-badge small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.achievement-meta {
  display: grid;
  gap: 6px;
  align-self: stretch;
  min-width: 124px;
  padding: 14px 16px;
  place-content: center;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent) 12%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.1);
}

.achievement-meta strong {
  font-size: 1.42rem;
}

.achievement-progress-track,
.achievement-badge-progress {
  overflow: hidden;
  height: 9px;
  background: color-mix(in srgb, var(--surface-2) 76%, var(--line) 24%);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.achievement-progress-track {
  position: relative;
  z-index: 1;
  margin-top: 16px;
}

.achievement-progress-track span,
.achievement-badge-progress span {
  display: block;
  height: 100%;
  background:
    linear-gradient(90deg, var(--accent), var(--accent-strong), var(--gold));
  border-radius: inherit;
  transition: width 380ms ease;
}

.achievement-spotlight {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 14px 14px 18px;
  color: var(--ink);
  background:
    linear-gradient(135deg, var(--accent-panel), transparent 58%),
    var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-weight: 900;
  line-height: 1.4;
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.1);
}

.achievement-spotlight::before {
  position: absolute;
  inset: 10px auto 10px 8px;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--accent), var(--gold));
  border-radius: 999px;
}

.achievement-spotlight strong,
.achievement-spotlight p {
  display: block;
  margin: 0;
}

.achievement-spotlight strong {
  margin-top: 2px;
  font-size: 1rem;
}

.achievement-spotlight p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.achievement-spotlight-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: var(--accent-strong);
  background:
    linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--surface) 72%, var(--accent) 28%));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
}

.achievement-spotlight-meter {
  display: grid;
  gap: 4px;
  min-width: 136px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.achievement-spotlight-meter span {
  color: var(--accent-strong);
}

.achievement-filter-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-width: 520px;
  margin-top: 14px;
}

.achievement-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 900;
}

.achievement-filter strong {
  color: var(--ink);
}

.achievement-filter.active,
.achievement-filter:hover,
.achievement-filter:focus-visible {
  color: var(--accent-strong);
  background: var(--accent-panel);
  border-color: var(--accent-border);
}

.achievement-step-grid,
.achievement-badge-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.achievement-badge-grid {
  grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
}

.achievement-step,
.achievement-badge {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: hidden;
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.achievement-badge {
  min-height: 218px;
}

.achievement-step {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  animation: achievementStepIn 360ms ease both;
  animation-delay: calc(var(--step-index, 0) * 45ms);
}

.achievement-step::before {
  position: absolute;
  inset: auto 14px 0 14px;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 20%, transparent));
  opacity: 0.38;
}

.achievement-step-line {
  display: none;
}

.achievement-step .small-button {
  grid-column: 1 / -1;
  justify-self: stretch;
  width: 100%;
}

.achievement-step.complete {
  border-color: var(--accent-border);
  background: var(--accent-panel);
}

.achievement-step:hover,
.achievement-badge:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.12);
}

.achievement-step-index,
.achievement-medal {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  color: var(--accent-strong);
  background:
    linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--surface) 72%, var(--accent) 28%));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 950;
}

.achievement-step.complete .achievement-step-index {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.achievement-medal {
  position: relative;
  width: 58px;
  height: 58px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 -10px 18px rgba(2, 6, 23, 0.16);
}

.achievement-medal::before {
  position: absolute;
  inset: 6px;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
}

.achievement-medal-code {
  position: absolute;
  right: 5px;
  bottom: 4px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.56rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.achievement-icon {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.achievement-step-body {
  min-width: 0;
}

.achievement-step-body span {
  display: block;
  margin-bottom: 5px;
}

.achievement-step-body h4,
.achievement-badge h4,
.achievement-badge p {
  margin: 0;
}

.achievement-step-body h4,
.achievement-badge h4 {
  font-size: 1rem;
}

.achievement-step-body p,
.achievement-badge p {
  color: var(--muted);
  line-height: 1.4;
}

.achievement-mini-track {
  overflow: hidden;
  height: 6px;
  margin-top: 10px;
  background: color-mix(in srgb, var(--surface) 55%, var(--line) 45%);
  border-radius: 999px;
}

.achievement-mini-track span {
  display: block;
  width: var(--step-progress);
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: inherit;
}

.achievement-badge.locked {
  opacity: 0.82;
}

.achievement-badge.locked .achievement-medal {
  color: var(--muted);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border-color: var(--line);
}

.achievement-badge.unlocked {
  background:
    linear-gradient(135deg, var(--accent-panel), transparent 42%),
    var(--surface-2);
  border-color: var(--accent-border);
}

.achievement-badge::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.achievement-badge.unlocked::before {
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.achievement-badge.unlocked::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(115deg, transparent 0 32%, rgba(255, 255, 255, 0.2) 43%, transparent 54% 100%);
  border-radius: inherit;
  transform: translateX(-120%);
  animation: achievementSweep 4.8s ease-in-out infinite;
}

.achievement-badge[data-tier="mastery"] .achievement-medal {
  color: #ffffff;
  background: linear-gradient(135deg, #f59e0b, #dc2626);
  border-color: rgba(255, 255, 255, 0.28);
}

.achievement-badge[data-tier="milestone"] .achievement-medal {
  color: #ffffff;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  border-color: rgba(255, 255, 255, 0.28);
}

.achievement-badge[data-tier="momentum"] .achievement-medal {
  color: #ffffff;
  background: linear-gradient(135deg, #8b5cf6, var(--accent));
}

.achievement-badge-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.achievement-badge.unlocked .achievement-status {
  color: var(--accent-strong);
}

.achievement-status {
  padding: 5px 8px;
  background: color-mix(in srgb, var(--surface) 72%, var(--line) 28%);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.achievement-badge.unlocked .achievement-status {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.achievement-badge .small-button {
  align-self: end;
  justify-self: start;
  margin-top: auto;
}

.achievement-empty {
  grid-column: 1 / -1;
}

@keyframes achievementPulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px var(--line), 0 0 0 0 var(--accent-ring);
  }

  50% {
    box-shadow: inset 0 0 0 1px var(--line), 0 0 0 8px transparent;
  }
}

@keyframes achievementStepIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes achievementSweep {
  0%,
  35% {
    transform: translateX(-120%);
  }

  55%,
  100% {
    transform: translateX(120%);
  }
}

.settings-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-fieldset legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-stack {
  display: grid;
  gap: 14px;
}

.settings-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-split form {
  min-width: 0;
}

.settings-summary {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 900;
}

.rate-history-editor {
  display: grid;
  gap: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
  font-weight: 800;
}

.rate-history-editor-list {
  display: grid;
  gap: 8px;
}

.rate-history-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.rate-history-editor-row span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.rate-history-editor-row small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

:root[data-theme="dark"] .settings-summary {
  color: var(--accent-glow);
  border-color: var(--accent-border);
}

:root[data-theme="dark"] .rate-history-editor {
  color: var(--ink);
  border-color: var(--line);
}

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

.security-card {
  display: grid;
  gap: 14px;
  align-content: space-between;
  min-height: 160px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.security-card h4 {
  margin: 0 0 6px;
}

.security-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.security-card.danger-zone {
  border-color: rgba(220, 38, 38, 0.28);
}

.mfa-setup-panel {
  display: grid;
  gap: 12px;
}

.mfa-qr-card {
  display: grid;
  place-items: center;
  width: min(240px, 100%);
  padding: 14px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
}

.mfa-qr-card.qr-fallback {
  min-height: 120px;
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.4;
}

.mfa-qr-svg {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
}

.mfa-manual-key {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mfa-manual-key summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.mfa-manual-key .mfa-secret {
  margin-top: 10px;
}

.mfa-manual-key .field {
  margin-top: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.billing-panel {
  gap: 18px;
}

.billing-status-grid,
.billing-readiness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.billing-status-card,
.billing-readiness-grid article,
.billing-history-item {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.billing-status-card.wide {
  grid-column: span 1;
}

.billing-status-card span,
.billing-readiness-grid strong,
.billing-history-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.billing-status-card strong,
.billing-readiness-grid span,
.billing-history-item strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.billing-status-card small,
.billing-history-item small {
  color: var(--muted);
  line-height: 1.4;
}

.billing-form {
  display: grid;
  gap: 16px;
}

.billing-cycle-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.billing-cycle-toggle label {
  cursor: pointer;
}

.billing-cycle-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.billing-cycle-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--muted);
  border-radius: 8px;
  font-weight: 900;
}

.billing-cycle-toggle input:checked + span {
  color: var(--button-ink);
  background: var(--accent);
}

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

.billing-plan-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.billing-plan-card:hover,
.billing-plan-card:focus-visible,
.billing-plan-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.billing-plan-card strong {
  font-size: 1.2rem;
}

.billing-plan-card small {
  color: var(--muted);
  line-height: 1.45;
}

.billing-plan-badge {
  justify-self: start;
  padding: 4px 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.billing-plan-price {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 950;
}

.billing-feature-list {
  display: grid;
  gap: 6px;
}

.billing-feature-list span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.billing-feature-list span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  background: var(--accent);
  border-radius: 999px;
}

.billing-history-list {
  display: grid;
  gap: 10px;
}

.verification-target {
  margin: 0 0 12px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.danger-copy {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.danger-copy strong {
  color: var(--danger);
  overflow-wrap: anywhere;
}

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

.feedback-entry {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.feedback-entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feedback-entry-header strong {
  color: var(--ink);
}

.feedback-entry-header span,
.feedback-entry p,
.feedback-entry small {
  color: var(--muted);
}

.feedback-entry p {
  margin: 0;
  line-height: 1.45;
}

.feedback-attachment-field {
  align-content: start;
}

.feedback-attachment-control {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-preview,
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-preview,
.attachment-chip {
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
}

.attachment-chip,
.attachment-preview {
  display: inline-flex;
}

.attachment-preview span,
.attachment-chip span {
  flex: 0 0 auto;
  padding: 3px 6px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 950;
}

.attachment-preview strong,
.attachment-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview small,
.attachment-chip small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.admin-layout {
  display: grid;
  gap: 14px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.admin-stat small,
.admin-user-card .stat-box small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

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

.admin-config-card,
.admin-action-card,
.admin-attention-item {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-config-card {
  display: grid;
  gap: 4px;
}

.admin-config-card span,
.admin-attention-item span,
.admin-action-card p {
  color: var(--muted);
}

.admin-config-card span {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-config-card strong,
.admin-attention-item strong,
.admin-action-card strong {
  color: var(--ink);
}

.admin-config-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-config-card.positive,
.admin-attention-item.positive {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.admin-config-card.warning,
.admin-attention-item.warning {
  border-color: rgba(217, 119, 6, 0.34);
  background: rgba(217, 119, 6, 0.1);
}

.admin-config-card.danger,
.admin-attention-item.danger,
.admin-action-card.danger {
  border-color: rgba(220, 38, 38, 0.34);
  background: rgba(220, 38, 38, 0.08);
}

.admin-attention-item {
  display: grid;
  gap: 5px;
}

.admin-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-action-card p {
  margin: 4px 0 0;
  line-height: 1.4;
}

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

.admin-user-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-user-main,
.admin-card-actions,
.admin-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-main {
  min-width: 0;
}

.admin-user-main h4,
.admin-user-main p {
  margin: 0;
}

.admin-user-main p,
.admin-card-actions small {
  color: var(--muted);
}

.admin-user-main > div:last-child {
  min-width: 0;
}

.admin-user-main h4,
.admin-user-main p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badges {
  flex-wrap: wrap;
}

.admin-badges span {
  min-height: 28px;
  padding: 6px 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

:root[data-theme="dark"] .admin-badges span {
  color: var(--accent-glow);
  border-color: var(--accent-border);
}

.admin-card-actions {
  justify-content: space-between;
  flex-wrap: wrap;
}

.compact-actions {
  justify-content: start;
}

.mfa-secret {
  padding: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  overflow-wrap: anywhere;
}

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

.theme-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 90px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.theme-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.theme-option strong,
.theme-option small {
  display: block;
}

.theme-option small {
  margin-top: 4px;
  color: var(--muted);
}

.preference-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.preference-form .settings-summary {
  margin-top: 14px;
}

.preference-form .settings-form-actions {
  margin-top: 14px;
}

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

.accent-option {
  position: relative;
  min-width: 0;
}

.accent-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.accent-option span {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 86px;
  padding: 12px 8px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.accent-option i {
  display: block;
  width: 32px;
  height: 32px;
  background: var(--swatch);
  border-radius: 999px;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.32);
}

.accent-option strong {
  font-size: 0.84rem;
}

.accent-option input:checked + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.accent-option span:hover {
  transform: translateY(-1px);
}

.accent-teal {
  --swatch: linear-gradient(135deg, #0f766e, #5eead4);
}

.accent-ocean {
  --swatch: linear-gradient(135deg, #1d4ed8, #67e8f9);
}

.accent-violet {
  --swatch: linear-gradient(135deg, #6d28d9, #c4b5fd);
}

.accent-rose {
  --swatch: linear-gradient(135deg, #be123c, #fda4af);
}

.accent-gold {
  --swatch: linear-gradient(135deg, #b45309, #fde68a);
}

.settings-form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.subsection-heading {
  margin-bottom: 12px;
}

.subsection-heading h4 {
  margin: 0;
  font-size: 1.08rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel,
.table-shell,
.finance-card,
.person-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.dashboard-filterbar,
.cash-flow-controlbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.dashboard-filterbar strong {
  display: block;
  font-size: 0.98rem;
}

.cash-flow-controlbar {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 0 12px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--accent) 4%);
  box-shadow: none;
}

.cash-flow-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.bank-link-panel {
  margin-bottom: 14px;
  padding: 16px;
}

.bank-link-header {
  align-items: center;
}

.bank-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.bank-connection-card {
  display: grid;
  gap: 12px;
  min-height: 136px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bank-connection-card.ready {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
}

.bank-connection-card.pending {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
}

.bank-connection-card.connected {
  border-color: color-mix(in srgb, var(--positive) 35%, var(--line));
}

.bank-connection-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bank-connection-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.02rem;
}

.bank-connection-card p,
.bank-connection-card small {
  margin: 6px 0 0;
  color: var(--muted);
}

.bank-connection-card small {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.chart-control-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.chart-control-group > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.segmented-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

:root[data-card-style="crisp"] {
  --radius: 4px;
  --shadow: none;
}

:root[data-card-style="crisp"] .metric-card,
:root[data-card-style="crisp"] .panel,
:root[data-card-style="crisp"] .table-shell,
:root[data-card-style="crisp"] .finance-card,
:root[data-card-style="crisp"] .person-card,
:root[data-card-style="crisp"] .security-card,
:root[data-card-style="crisp"] .feedback-entry,
:root[data-card-style="crisp"] .admin-user-card,
:root[data-card-style="crisp"] .stat-box,
:root[data-card-style="crisp"] .prediction-row {
  box-shadow: none;
}

:root[data-card-style="glass"] .metric-card,
:root[data-card-style="glass"] .panel,
:root[data-card-style="glass"] .table-shell,
:root[data-card-style="glass"] .finance-card,
:root[data-card-style="glass"] .person-card,
:root[data-card-style="glass"] .security-card,
:root[data-card-style="glass"] .feedback-entry,
:root[data-card-style="glass"] .admin-user-card {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(148, 163, 184, 0.38);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(16px);
}

:root[data-theme="dark"][data-card-style="glass"] .metric-card,
:root[data-theme="dark"][data-card-style="glass"] .panel,
:root[data-theme="dark"][data-card-style="glass"] .table-shell,
:root[data-theme="dark"][data-card-style="glass"] .finance-card,
:root[data-theme="dark"][data-card-style="glass"] .person-card,
:root[data-theme="dark"][data-card-style="glass"] .security-card,
:root[data-theme="dark"][data-card-style="glass"] .feedback-entry,
:root[data-theme="dark"][data-card-style="glass"] .admin-user-card {
  background: rgba(17, 24, 39, 0.72);
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.segmented-control button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.segmented-control.compact button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.segmented-control button:hover,
.segmented-control button:focus-visible {
  color: var(--ink);
  background: var(--surface);
}

.segmented-control button.active {
  color: #ffffff;
  background: var(--accent);
}

.dashboard-grid,
.planning-grid,
.insights-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: 14px;
}

.dashboard-grid.lower {
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  margin-top: 14px;
}

.dashboard-side-stack {
  display: grid;
  gap: 14px;
}

.insight-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.insight-score-ring {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  color: var(--ink);
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--accent) calc(var(--score) * 1%), rgba(148, 163, 184, 0.22) 0);
  border-radius: 999px;
}

.insight-score-ring strong,
.insight-score-ring span {
  grid-area: 1 / 1;
}

.insight-score-ring strong {
  margin-top: -12px;
  font-size: 2rem;
}

.insight-score-ring span {
  align-self: end;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-metric-grid {
  margin-bottom: 14px;
}

.insights-layout.lower {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  margin-top: 14px;
}

.projection-panel,
.upcoming-panel {
  margin-bottom: 14px;
}

.projection-panel {
  margin-top: 14px;
}

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

.planning-grid {
  align-items: start;
}

.wide-panel {
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 16px;
}

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

.panel h3 {
  font-size: 1.06rem;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(220px, 18vw, 320px);
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.projection-panel .chart-wrap {
  height: clamp(220px, 16vw, 300px);
}

.chart-wrap.square {
  display: grid;
  place-items: center;
  height: clamp(220px, 16vw, 280px);
  min-height: 0;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.chart-zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(220px, 100%);
}

.chart-zoom-control input {
  width: 150px;
  accent-color: var(--accent);
}

.cash-flow-fullscreen {
  position: fixed;
  inset: 18px;
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cash-flow-fullscreen .chart-wrap {
  height: 100%;
}

.cash-flow-report-modal {
  width: min(1120px, calc(100vw - 24px));
}

.cash-flow-report-card {
  display: grid;
  gap: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 42%),
    var(--surface);
}

.report-modal-header {
  margin-bottom: 0;
}

.report-modal-header p:not(.eyebrow) {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
}

.cash-flow-report-controls {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-content: start;
  gap: 10px;
}

.cash-flow-report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-stat-card {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.report-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.1;
}

.cash-flow-report-stage {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 84%, var(--accent) 16%), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scrollbar-width: thin;
}

.cash-flow-report-chart {
  --report-zoom: 1;
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  align-items: end;
  gap: clamp(12px, 2vw, 22px);
  min-width: 100%;
  height: clamp(300px, 38vw, 430px);
  padding: 54px 18px 42px;
}

.cash-flow-report-chart::before {
  position: absolute;
  inset: 46px 18px 46px;
  pointer-events: none;
  content: "";
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 calc(25% - 1px),
    var(--line) calc(25% - 1px) 25%
  );
  opacity: 0.72;
}

.report-month-column,
.report-net-column {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 9px;
  height: 100%;
  min-width: 0;
}

.report-bar-stack {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.report-bar-button,
.report-net-button {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  width: 30px;
  min-height: 20px;
  padding: 0;
  background: transparent;
  border: 0;
}

.report-net-button {
  align-items: center;
  width: 42px;
  height: 100%;
}

.report-bar,
.report-net-bar {
  position: relative;
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: 999px 999px 8px 8px;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.report-bar.income,
.report-net-bar.positive {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--chart-income) 88%, #ffffff 12%), var(--chart-income));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--chart-income) 22%, transparent);
}

.report-bar.expense,
.report-net-bar.negative {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--chart-spending) 86%, #ffffff 14%), var(--chart-spending));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--chart-spending) 22%, transparent);
}

.report-net-bar {
  width: 34px;
  border-radius: 999px;
}

.report-net-button::before {
  position: absolute;
  top: 50%;
  right: -18px;
  left: -18px;
  height: 1px;
  content: "";
  background: var(--line-strong);
}

.report-net-bar.positive {
  align-self: start;
}

.report-net-bar.negative {
  align-self: end;
}

.report-bar-value {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 2;
  padding: 4px 7px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
}

.cash-flow-report-chart.show-labels .report-bar-value,
.report-bar-button.selected .report-bar-value,
.report-net-button.selected .report-bar-value,
.report-bar-button:hover .report-bar-value,
.report-net-button:hover .report-bar-value,
.report-bar-button:focus-visible .report-bar-value,
.report-net-button:focus-visible .report-bar-value {
  opacity: 1;
  transform: translate(-50%, 0);
}

.report-bar-button:hover .report-bar,
.report-bar-button:focus-visible .report-bar,
.report-bar-button.selected .report-bar,
.report-net-button:hover .report-net-bar,
.report-net-button:focus-visible .report-net-bar,
.report-net-button.selected .report-net-bar {
  filter: saturate(1.14);
  transform: translateY(-4px);
}

.report-month-label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.report-month-status {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-month-column.is-future .report-month-status,
.report-net-column.is-future .report-month-status {
  color: var(--accent);
}

.dashboard-customise-panel {
  margin-top: 14px;
}

.dashboard-widget-list {
  display: grid;
  gap: 10px;
}

.dashboard-widget-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.dashboard-widget-placeholder {
  min-height: 66px;
  background:
    linear-gradient(135deg, var(--accent-panel), transparent 62%),
    var(--surface-2);
  border: 1px dashed var(--accent-border);
  border-radius: var(--radius);
}

.dashboard-widget-item:hover,
.dashboard-widget-item:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dashboard-widget-item.dragging {
  cursor: grabbing;
  border-color: var(--accent);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
}

.dashboard-widget-item.touch-dragging {
  opacity: 0.96;
  transform: rotate(0.4deg) scale(1.02);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}

.dashboard-drag-handle {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  gap: 4px;
  place-content: center;
  width: 34px;
  height: 42px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: grab;
}

.dashboard-drag-handle span {
  width: 4px;
  height: 4px;
  margin: 0;
  background: currentColor;
  border-radius: 999px;
}

.dashboard-widget-copy {
  min-width: 0;
}

.dashboard-widget-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-widget-item.is-hidden {
  opacity: 0.62;
}

.dashboard-widget-toggle {
  display: inline-grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-widget-toggle input {
  width: 40px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.chart-wrap.square canvas {
  width: min(100%, 250px);
  height: min(100%, 250px);
}

.spending-mix-chart-wrap {
  margin-bottom: 12px;
}

.legend-list,
.compact-list,
.insight-list,
.prediction-list,
.forecast-breakdown {
  display: grid;
  gap: 10px;
}

.legend-row,
.list-row,
.insight-item,
.prediction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.legend-button {
  width: 100%;
  color: inherit;
  text-align: left;
}

.legend-button:hover,
.legend-button:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.legend-button > strong:last-child {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.business-name,
.business-match-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.business-name > span:last-child {
  min-width: 0;
}

.business-logo {
  display: inline-grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: #ffffff;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  overflow: hidden;
}

.business-logo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.business-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 3px;
  background: #ffffff;
  object-fit: contain;
  z-index: 1;
}

.business-logo.logo-image-failed img {
  display: none;
}

.business-match-card {
  grid-column: 1 / -1;
  padding: 10px;
  background: var(--accent-panel);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius);
}

.business-match-card strong,
.business-match-card span {
  display: block;
}

.business-match-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.goal-capacity {
  display: grid;
  gap: 10px;
}

.goal-capacity-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.goal-capacity-hero div {
  min-width: 0;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.goal-capacity-hero span,
.goal-capacity-micro {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.goal-capacity-hero span {
  display: block;
  text-transform: uppercase;
}

.goal-capacity-hero strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: clamp(1.02rem, 2vw, 1.28rem);
}

.goal-capacity-note,
.goal-capacity-micro {
  margin: 0;
}

.goal-capacity-note {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.goal-capacity-list {
  display: grid;
  gap: 8px;
}

.goal-capacity-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.goal-capacity-row > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.insight-item.positive {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f0fdf4;
}

.insight-item.warning {
  border-color: rgba(217, 119, 6, 0.28);
  background: #fffbeb;
}

.insight-item.danger {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fef2f2;
}

.insight-bars {
  display: grid;
  gap: 12px;
}

.insight-bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.insight-bar-row strong,
.insight-bar-row span {
  display: block;
}

.insight-bar-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.insight-bar-track {
  height: 10px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

.insight-bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  border-radius: inherit;
}

:root[data-color-assist="patterns"] .insight-bar-track span {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.4) 0 4px,
      transparent 4px 8px
    ),
    linear-gradient(90deg, var(--accent), var(--accent-glow));
}

:root[data-color-assist="patterns"] .swatch {
  border: 1px solid rgba(15, 23, 42, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.26);
}

.ai-chat-panel {
  margin-top: 14px;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.ai-chat-response {
  margin-top: 12px;
  padding: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.55;
  white-space: pre-wrap;
}

:root[data-theme="dark"] .tax-preview,
:root[data-theme="dark"] .save-status.saved {
  color: var(--accent-glow);
  background: var(--accent-panel);
  border-color: var(--accent-border);
}

:root[data-theme="dark"] .save-status.saving {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.26);
}

:root[data-theme="dark"] .save-status.error,
:root[data-theme="dark"] .insight-item.danger {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.26);
}

:root[data-theme="dark"] .insight-item.positive {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.22);
}

:root[data-theme="dark"] .insight-item.warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.22);
}

.legend-main,
.row-main {
  min-width: 0;
}

.legend-main strong,
.row-main strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.93rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-main span,
.row-main span,
.row-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.row-main .progress {
  margin-top: 8px;
}

.swatch {
  flex: 0 0 auto;
  width: 11px;
  height: 32px;
  border-radius: 999px;
}

.amount-positive {
  color: var(--positive);
}

.amount-negative {
  color: var(--danger);
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 180px) minmax(180px, 220px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.tool-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.table-shell {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--table-hover);
}

td.numeric,
th.numeric {
  text-align: right;
}

.table-actions {
  width: 150px;
  text-align: right;
}

.mobile-table-cell,
.mobile-transaction-list {
  display: none;
}

.action-group {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.small-button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 900;
}

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

.small-button.accent {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.small-button.accent:hover,
.small-button.accent:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.small-select {
  min-height: 36px;
  padding: 0 28px 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 900;
}

.cards-grid,
.people-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.finance-card,
.person-card {
  display: grid;
  gap: 16px;
  min-height: 180px;
  padding: 16px;
}

.finance-card-header,
.person-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.person-card-header {
  justify-content: flex-start;
}

.finance-card h4,
.person-card h4,
.finance-card p,
.person-card p {
  margin: 0;
}

.finance-card h4,
.person-card h4 {
  font-size: 1rem;
}

.loan-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.loan-balance-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--warning) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--line));
  border-radius: var(--radius);
}

.loan-balance-prompt div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.loan-balance-prompt strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.loan-balance-prompt span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.asset-payoff {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.asset-payoff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.asset-payoff-row strong {
  color: var(--ink);
  text-align: right;
}

.asset-payoff-track {
  height: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  border-radius: 999px;
}

.asset-payoff-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
}

.rate-history {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.rate-history small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rate-history > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rate-history span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.progress {
  overflow: hidden;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
}

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

.progress.warning span {
  background: var(--warning);
}

.progress.danger span {
  background: var(--danger);
}

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

.stat-box {
  min-width: 0;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-box strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

:root[data-density="compact"] .workspace {
  padding-top: 20px;
  padding-bottom: 28px;
}

:root[data-density="compact"] .metric-grid,
:root[data-density="compact"] .cards-grid,
:root[data-density="compact"] .people-grid,
:root[data-density="compact"] .dashboard-grid,
:root[data-density="compact"] .planning-grid,
:root[data-density="compact"] .settings-stack {
  gap: 10px;
}

:root[data-density="compact"] .metric-card,
:root[data-density="compact"] .panel,
:root[data-density="compact"] .finance-card,
:root[data-density="compact"] .person-card,
:root[data-density="compact"] .security-card,
:root[data-density="compact"] .feedback-entry,
:root[data-density="compact"] .admin-user-card {
  padding: 13px;
}

:root[data-density="compact"] .legend-row,
:root[data-density="compact"] .list-row,
:root[data-density="compact"] .insight-item,
:root[data-density="compact"] .prediction-row {
  min-height: 44px;
  padding: 8px;
}

:root[data-privacy="blur"] .metric-card strong,
:root[data-privacy="blur"] .prediction-row strong,
:root[data-privacy="blur"] .finance-card .stat-box strong,
:root[data-privacy="blur"] .person-card .stat-box strong,
:root[data-privacy="blur"] .legend-button > strong:last-child,
:root[data-privacy="blur"] #forecastOutcome,
:root[data-privacy="blur"] #sidebarSavingsRate {
  filter: blur(7px);
  user-select: none;
  transition: filter 160ms ease;
}

:root[data-privacy="blur"] .metric-card:hover strong,
:root[data-privacy="blur"] .metric-card:focus-within strong,
:root[data-privacy="blur"] .metric-card:active strong,
:root[data-privacy="blur"] .metric-card.privacy-reveal strong,
:root[data-privacy="blur"] .prediction-row:hover strong,
:root[data-privacy="blur"] .prediction-row:active strong,
:root[data-privacy="blur"] .prediction-row.privacy-reveal strong,
:root[data-privacy="blur"] .finance-card:hover .stat-box strong,
:root[data-privacy="blur"] .finance-card .stat-box:active strong,
:root[data-privacy="blur"] .finance-card .stat-box.privacy-reveal strong,
:root[data-privacy="blur"] .person-card:hover .stat-box strong,
:root[data-privacy="blur"] .person-card .stat-box:active strong,
:root[data-privacy="blur"] .person-card .stat-box.privacy-reveal strong,
:root[data-privacy="blur"] .legend-button:hover > strong:last-child,
:root[data-privacy="blur"] .legend-button:active > strong:last-child,
:root[data-privacy="blur"] .legend-button.privacy-reveal > strong:last-child,
:root[data-privacy="blur"] .hero-panel:hover #forecastOutcome,
:root[data-privacy="blur"] .hero-panel:active #forecastOutcome,
:root[data-privacy="blur"] #forecastOutcome.privacy-reveal,
:root[data-privacy="blur"] .sidebar-footer:hover #sidebarSavingsRate,
:root[data-privacy="blur"] .sidebar-footer:active #sidebarSavingsRate,
:root[data-privacy="blur"] #sidebarSavingsRate.privacy-reveal {
  filter: none;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

.checkbox-field.full {
  grid-column: 1 / -1;
}

.settings-summary.full {
  grid-column: 1 / -1;
}

.form-section-heading {
  grid-column: 1 / -1;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.form-section-heading h4 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 950;
}

.form-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
}

.profile-photo-field {
  display: grid;
  gap: 8px;
}

.profile-photo-field > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-photo-control {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-photo-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--accent);
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 950;
}

.profile-photo-preview.has-image {
  background: var(--surface);
}

.profile-photo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.modal {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
  padding: 0;
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.modal-card {
  max-height: inherit;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feedback-modal-card {
  display: grid;
  gap: 14px;
}

.asset-insight-modal {
  width: min(940px, calc(100vw - 24px));
}

.asset-insight-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.asset-insight-chart-wrap {
  height: clamp(260px, 28vw, 380px);
  margin-bottom: 14px;
}

.asset-insight-list {
  display: grid;
  gap: 10px;
}

.asset-insight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.asset-insight-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.asset-insight-row strong {
  text-align: right;
}

.asset-insight-row.positive {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.asset-insight-row.warning {
  border-color: rgba(217, 119, 6, 0.34);
  background: rgba(217, 119, 6, 0.1);
}

.feedback-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.feedback-fieldset legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.feedback-choice {
  position: relative;
  display: grid;
  min-width: 0;
}

.feedback-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feedback-choice span {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.feedback-choice small {
  color: var(--muted);
  line-height: 1.35;
}

.feedback-choice input:checked + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.feedback-choice span:hover {
  transform: translateY(-1px);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 16px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: max(20px, var(--safe-right));
  bottom: max(20px, var(--safe-bottom));
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  color: #ffffff;
  background: var(--nav);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

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

  .auth-copy {
    min-height: 44vh;
  }

  .auth-card {
    margin: -52px auto 40px;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    min-height: 0;
    padding: calc(14px + var(--safe-top)) max(16px, var(--safe-right)) 16px max(16px, var(--safe-left));
  }

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

  .nav-link {
    justify-content: center;
  }

  .nav-link .nav-icon {
    display: none;
  }

  #adminNavLink {
    display: none;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    padding: 12px;
  }

  .sidebar-footer .mini-meter {
    width: 120px;
    flex: 0 0 auto;
  }

  .sidebar-footer strong {
    margin-top: 0;
    white-space: nowrap;
  }

  .sidebar-actions {
    margin-top: 0;
  }

  .dashboard-grid,
  .dashboard-grid.lower,
  .planning-grid,
  .insights-layout {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .cards-grid,
  .people-grid,
  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small screens use the same markup, but shift tables into cards and keep
   primary actions easy to tap in iOS Safari. */
@media (max-width: 760px) {
  .auth-screen {
    display: block;
  }

  .auth-copy {
    min-height: auto;
    gap: 24px;
    padding: calc(18px + var(--safe-top)) max(16px, var(--safe-right)) 22px max(16px, var(--safe-left));
  }

  .auth-copy h2 {
    max-width: 100%;
    font-size: clamp(2rem, 10.5vw, 3rem);
    line-height: 1.04;
  }

  .auth-word-rotator {
    display: grid;
    min-width: 0;
  }

  .auth-stats {
    gap: 8px;
  }

  .auth-stats span {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .auth-card {
    width: calc(100% - 28px);
    margin: 14px auto 28px;
    padding: 14px;
  }

  .auth-card .provider-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bank-link-panel {
    padding: 12px;
  }

  .bank-link-header {
    align-items: stretch;
  }

  .bank-link-header .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .bank-link-header .button {
    width: 100%;
    min-height: 42px;
    padding: 10px;
  }

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

  .onboarding-screen {
    align-items: stretch;
    padding: calc(12px + var(--safe-top)) max(12px, var(--safe-right)) calc(12px + var(--safe-bottom)) max(12px, var(--safe-left));
  }

  .onboarding-card {
    min-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
    padding: 16px;
  }

  .wizard-steps,
  .wizard-step.active {
    min-height: auto;
  }

  .setup-step-layout {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  .setup-fields-panel {
    padding: 14px;
  }

  .wizard-step h3 {
    font-size: 2rem;
    line-height: 1.04;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: calc(12px + var(--safe-top)) max(12px, var(--safe-right)) 10px max(12px, var(--safe-left));
    border-right: 0;
  }

  .brand {
    min-width: 0;
  }

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

  .brand p {
    display: none;
  }

  .brand h1 {
    font-size: 0.98rem;
  }

  .mobile-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
  }

  .mobile-icon-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .mobile-icon-button .avatar {
    width: 34px;
    height: 34px;
    font-size: 0.78rem;
    border-radius: 7px;
  }

  .mobile-icon-button:hover,
  .mobile-icon-button:focus-visible,
  .mobile-icon-button.active,
  .mobile-profile-button[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.24);
  }

  .user-card {
    position: fixed;
    top: calc(62px + var(--safe-top));
    right: max(12px, var(--safe-right));
    left: max(12px, var(--safe-left));
    z-index: 50;
    display: none;
    min-height: 0;
    margin: 0;
    padding: 12px;
    background: rgba(15, 23, 42, 0.98);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.42);
    backdrop-filter: blur(16px);
  }

  .app-shell.mobile-profile-open .user-card {
    display: grid;
  }

  .user-card span {
    max-width: 100%;
  }

  .person-scope-control {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    margin-top: 4px;
  }

  .person-scope-control span {
    display: none;
  }

  .person-scope-control select {
    width: 100%;
    min-width: 0;
    height: 32px;
    font-size: 0.78rem;
  }

  .nav-list {
    position: fixed;
    right: max(10px, var(--safe-right));
    bottom: max(10px, var(--safe-bottom));
    left: max(10px, var(--safe-left));
    display: flex;
    z-index: 35;
    gap: 7px;
    justify-content: space-between;
    width: auto;
    max-width: calc(100vw - 20px - var(--safe-left) - var(--safe-right));
    overflow-x: hidden;
    margin: 0;
    padding: 9px 10px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.35);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(14px);
  }

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

  .nav-link {
    display: flex;
    gap: 5px;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: auto;
    min-width: 0;
    min-height: 60px;
    padding: 7px 5px;
    scroll-snap-align: start;
    text-align: center;
    white-space: nowrap;
    font-size: 0.74rem;
  }

  .nav-link .nav-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 24px;
    color: currentColor;
    background: transparent;
    border-radius: 0;
  }

  .nav-number {
    display: none;
  }

  .nav-symbol {
    display: block;
  }

  .nav-link.active .nav-icon {
    color: var(--accent-glow);
  }

  .nav-label {
    display: block;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-link[data-view="budgets"],
  .nav-link[data-view="insights"] {
    display: none;
  }

  .sidebar-footer {
    position: absolute;
    right: max(10px, var(--safe-right));
    bottom: calc(84px + var(--safe-bottom));
    left: max(10px, var(--safe-left));
    z-index: 34;
    display: block;
    margin-top: 0;
    padding: 9px 12px;
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.32);
    backdrop-filter: blur(14px);
  }

  .app-shell.settings-view .sidebar-footer {
    display: none;
  }

  .sidebar-footer .eyebrow,
  .sidebar-footer .mini-meter,
  .sidebar-footer strong {
    display: none;
  }

  .sidebar-actions {
    justify-content: space-around;
    width: 100%;
  }

  .app-version {
    display: block;
    margin-top: 4px;
    text-align: center;
  }

  .sidebar-actions .text-button {
    min-height: 38px;
    padding: 0 8px;
  }

  .sidebar-actions .text-button.active {
    color: #ffffff;
  }

  .workspace {
    padding: 14px max(12px, var(--safe-right)) calc(180px + var(--safe-bottom)) max(12px, var(--safe-left));
  }

  .app-shell.settings-view .workspace {
    padding-bottom: calc(86px + var(--safe-bottom));
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 10px;
  }

  .topbar h2 {
    font-size: clamp(1.45rem, 7vw, 1.85rem);
  }

  .section-heading,
  .panel-header,
  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .forecast-stack {
    justify-items: start;
  }

  .topbar-actions,
  .tool-row,
  .income-layout,
  #transactionsView .tool-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
  }

  .topbar-actions {
    display: flex;
    justify-content: flex-end;
    width: auto;
  }

  .section-heading .button,
  .section-heading .button-row,
  .panel-header .button,
  .topbar-actions .button,
  .tool-actions .button,
  .file-button {
    width: 100%;
  }

  .tool-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    width: 100%;
  }

  .button-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

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

  .settings-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

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

  .settings-nav-link {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 11px;
    border-radius: 8px;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .settings-panel .panel {
    padding: 12px;
  }

  .settings-panel .panel-header {
    gap: 6px;
    margin-bottom: 10px;
  }

  .settings-panel .panel-header h3 {
    font-size: 1.08rem;
  }

  .settings-panel .panel-header p {
    margin-top: 3px;
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .settings-fieldset legend {
    margin-bottom: 7px;
    font-size: 0.66rem;
    letter-spacing: 0.05em;
  }

  .settings-fieldset + .settings-fieldset,
  .preference-form {
    margin-top: 12px;
  }

  .billing-status-grid,
  .billing-readiness-grid,
  .billing-plan-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .billing-status-card,
  .billing-readiness-grid article,
  .billing-history-item,
  .billing-plan-card {
    padding: 11px;
    border-radius: 10px;
  }

  .billing-plan-card {
    gap: 7px;
  }

  .billing-plan-price {
    font-size: 1.1rem;
  }

  .billing-feature-list {
    gap: 4px;
  }

  .billing-cycle-toggle {
    display: grid;
    width: 100%;
  }

  .achievement-panel {
    padding: 12px;
  }

  .achievement-hero {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }

  .achievement-ring {
    width: 78px;
  }

  .achievement-ring strong {
    font-size: 0.98rem;
  }

  .achievement-meta {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    min-height: 0;
    padding: 10px 12px;
  }

  .achievement-spotlight {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .achievement-spotlight-icon {
    width: 40px;
    height: 40px;
  }

  .achievement-spotlight-meter {
    display: flex;
    grid-column: 1 / -1;
    justify-content: space-between;
    min-width: 0;
    padding: 8px 10px;
  }

  .achievement-spotlight .small-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .achievement-filter-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .achievement-filter {
    justify-content: center;
    min-width: 0;
    padding: 0 8px;
  }

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

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

  .achievement-step {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 12px;
  }

  .achievement-step .small-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .achievement-badge {
    min-height: 196px;
    padding: 10px;
  }

  .achievement-medal {
    width: 48px;
    height: 48px;
  }

  .achievement-badge h4 {
    font-size: 0.92rem;
  }

  .achievement-badge p {
    display: -webkit-box;
    overflow: hidden;
    min-height: 2.4em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .achievement-badge .small-button {
    width: 100%;
  }

  .provider-grid,
  .feedback-choice-grid,
  .security-grid,
  .settings-form-actions {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .theme-option {
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 10px;
  }

  .theme-option input {
    width: 16px;
    height: 16px;
    margin-top: 0;
  }

  .theme-option strong {
    font-size: 0.92rem;
  }

  .theme-option small {
    margin-top: 2px;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .accent-options {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
  }

  .accent-option span {
    gap: 5px;
    min-height: 62px;
    padding: 8px 5px;
    border-radius: 10px;
  }

  .accent-option i {
    width: 24px;
    height: 24px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.32);
  }

  .accent-option strong {
    font-size: 0.68rem;
    line-height: 1.1;
  }

  .accent-option input:checked + span {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
  }

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

  .preference-grid .field {
    gap: 5px;
    font-size: 0.7rem;
  }

  .preference-grid .field input,
  .preference-grid .field select {
    min-height: 38px;
    padding: 7px 9px;
    border-radius: 9px;
    font-size: 0.86rem;
  }

  .preference-form .settings-summary {
    min-height: 0;
    margin-top: 10px;
    padding: 9px;
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .profile-photo-control {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-photo-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-form-actions {
    display: grid;
  }

  .save-status {
    justify-content: center;
    width: 100%;
    min-height: 34px;
  }

  .topbar .save-status {
    width: auto;
    min-height: 30px;
  }

  .metric-grid,
  .cards-grid,
  .people-grid,
  .admin-stat-grid,
  .admin-config-grid,
  .admin-action-grid,
  .form-grid,
  .setup-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

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

  .metric-card {
    min-height: 98px;
    padding: 12px;
  }

  .metric-card strong {
    margin-top: 7px;
    font-size: 1.28rem;
  }

  .form-grid,
  .setup-grid {
    gap: 10px;
  }

  .form-section-heading {
    padding: 9px 10px;
    border-radius: 9px;
  }

  .form-section-heading h4 {
    font-size: 0.82rem;
  }

  .achievement-hero,
  .achievement-spotlight,
  .achievement-step {
    padding: 12px;
  }

  .achievement-badge {
    padding: 10px;
  }

  .achievement-step-grid,
  .achievement-badge-grid {
    gap: 9px;
    margin-top: 10px;
  }

  .form-section-heading p,
  .field-help-text {
    font-size: 0.72rem;
  }

  .period-control,
  .field {
    gap: 5px;
    font-size: 0.76rem;
  }

  .period-control input,
  .period-control select,
  .field input,
  .field select,
  .field textarea {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 0.93rem;
  }

  .modal-card .form-grid {
    gap: 8px;
  }

  .modal-card .field,
  .modal-card .checkbox-field {
    padding: 0;
  }

  .modal-card .field input,
  .modal-card .field select,
  .modal-card .field textarea {
    min-height: 38px;
    padding: 7px 9px;
  }

  .chart-toolbar,
  .cash-flow-actions,
  .asset-payoff-row {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-zoom-control,
  .chart-zoom-control input {
    width: 100%;
  }

  .cash-flow-fullscreen {
    inset: 10px;
  }

  .cash-flow-report-modal {
    width: min(100vw, calc(100vw - 12px));
  }

  .cash-flow-report-card {
    gap: 10px;
    padding: 12px;
  }

  .cash-flow-report-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .cash-flow-report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .report-stat-card {
    padding: 10px;
  }

  .cash-flow-report-stage {
    padding: 10px;
  }

  .cash-flow-report-chart {
    grid-auto-columns: minmax(72px, 1fr);
    gap: 10px;
    height: 310px;
    padding: 46px 10px 38px;
  }

  .cash-flow-report-chart::before {
    inset: 38px 10px 42px;
  }

  .report-bar-stack {
    gap: 6px;
  }

  .report-bar-button {
    width: 24px;
  }

  .report-net-button {
    width: 34px;
  }

  .report-toolbar {
    gap: 8px;
  }

  .dashboard-widget-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px;
  }

  .dashboard-drag-handle {
    width: 28px;
  }

  .dashboard-widget-toggle {
    font-size: 0.64rem;
  }

  .period-control input[type="date"],
  .field input[type="date"] {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .admin-action-card {
    align-items: stretch;
    flex-direction: column;
  }

  .field.full {
    grid-column: auto;
  }

  .section-heading {
    gap: 10px;
    margin-bottom: 12px;
  }

  .view > .section-heading > div > p {
    max-width: 100%;
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .section-heading .button,
  .section-heading .button-row,
  .panel-header .button,
  .topbar-actions .button,
  .tool-actions .button,
  .file-button {
    min-height: 42px;
  }

  .hero-panel {
    gap: 14px;
    margin-bottom: 12px;
    padding: 18px;
  }

  .hero-panel h3 {
    max-width: 100%;
    font-size: 1.55rem;
    line-height: 1.08;
  }

  .hero-panel p {
    margin-top: 8px;
    font-size: 0.9rem;
  }

  .forecast-stack strong {
    font-size: 1.55rem;
  }

  .metric-card {
    min-height: 0;
    padding: 10px;
  }

  .metric-card strong {
    margin-top: 6px;
    font-size: clamp(1.02rem, 4.5vw, 1.28rem);
    line-height: 1.08;
  }

  .metric-card span {
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .metric-card p {
    margin-top: 5px;
    font-size: 0.76rem;
    line-height: 1.28;
  }

  .dashboard-filterbar,
  .cash-flow-controlbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .dashboard-filterbar > div:first-child {
    display: none;
  }

  .insight-hero {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .insight-score-ring {
    width: 96px;
    height: 96px;
  }

  .insight-score-ring strong {
    font-size: 1.7rem;
  }

  .insight-score-ring span {
    margin-bottom: 22px;
  }

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

  .insight-bar-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .ai-chat-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-grid,
  .dashboard-grid.lower,
  .projection-panel,
  .upcoming-panel {
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .panel {
    padding: 14px;
  }

  .finance-card,
  .person-card {
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }

  .finance-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .finance-card-header .action-group {
    justify-content: flex-start;
  }

  .loan-balance-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-card h4,
  .person-card h4 {
    font-size: 0.98rem;
  }

  .finance-card p,
  .person-card p {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .small-button {
    min-height: 34px;
    padding: 0 9px;
  }

  .card-stats {
    gap: 7px;
  }

  .stat-box {
    padding: 8px;
  }

  .stat-box span {
    font-size: 0.66rem;
  }

  .stat-box strong {
    margin-top: 3px;
    font-size: 0.96rem;
    line-height: 1.12;
  }

  .loan-note {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .rate-history {
    gap: 6px;
  }

  .rate-history span {
    min-height: 28px;
    padding: 5px 7px;
    font-size: 0.74rem;
  }

  .rate-history-editor-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .rate-history-editor-row .small-button {
    justify-self: start;
  }

  .panel-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
    white-space: normal;
  }

  .chart-wrap {
    height: 200px;
  }

  .projection-panel .chart-wrap,
  .chart-wrap.square {
    height: 200px;
  }

  .spending-mix-chart-wrap {
    height: 172px;
    margin-bottom: 12px;
  }

  .spending-mix-chart-wrap canvas {
    width: min(100%, 178px);
    height: min(100%, 178px);
  }

  #categoryLegend {
    position: relative;
    z-index: 1;
  }

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

  .asset-insight-chart-wrap {
    height: 260px;
  }

  .asset-insight-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-insight-row strong {
    text-align: left;
  }

  .legend-row,
  .list-row,
  .insight-item,
  .prediction-row {
    align-items: flex-start;
    min-height: 46px;
    padding: 9px;
  }

  .prediction-row strong {
    text-align: left;
  }

  .goal-capacity-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .goal-capacity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .goal-capacity-row > span {
    white-space: normal;
  }

  .table-shell {
    margin-right: -12px;
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .table-shell table,
  .table-shell thead,
  .table-shell tbody,
  .table-shell tr {
    display: block;
  }

  table {
    min-width: 0;
  }

  .table-shell thead {
    display: none;
  }

  .table-shell tr {
    border-bottom: 1px solid var(--line);
  }

  .table-shell tr:last-child {
    border-bottom: 0;
  }

  .table-shell td:not(.mobile-table-cell):not(.empty-table-cell) {
    display: none;
  }

  .empty-table-cell {
    display: block;
  }

  .mobile-table-cell {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .mobile-transaction-list {
    display: grid;
    gap: 10px;
    padding: 10px 12px;
  }

  .mobile-transaction-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .mobile-transaction-card strong,
  .mobile-transaction-card span {
    display: block;
  }

  .mobile-transaction-card span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
  }

  .mobile-transaction-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  th,
  td {
    padding: 12px 10px;
  }

  .modal {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - var(--safe-top));
    margin: 0;
  }

  .modal-card {
    padding: 16px max(16px, var(--safe-right)) calc(16px + var(--safe-bottom)) max(16px, var(--safe-left));
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .button {
    width: 100%;
  }

  .toast {
    right: max(12px, var(--safe-right));
    bottom: max(12px, var(--safe-bottom));
    left: max(12px, var(--safe-left));
    max-width: none;
  }
}
