:root {
  --bg: #101735;
  --bg-deep: #090e20;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-dark: rgba(18, 27, 58, 0.86);
  --ink: #11182f;
  --text: #fff8ec;
  --muted: #aeb9d5;
  --muted-dark: #64708b;
  --line: rgba(255, 255, 255, 0.14);
  --line-dark: rgba(17, 24, 47, 0.12);
  --gold: #ffbd12;
  --orange: #ff8d00;
  --orange-deep: #e75613;
  --blue: #314db7;
  --violet: #6d4aff;
  --danger: #c54141;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(2, 6, 20, 0.35);
}

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

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 189, 18, 0.16), transparent 20%),
    radial-gradient(circle at 86% 10%, rgba(109, 74, 255, 0.22), transparent 22%),
    radial-gradient(circle at 78% 70%, rgba(255, 141, 0, 0.16), transparent 24%),
    linear-gradient(180deg, #1a2454 0%, var(--bg) 48%, var(--bg-deep) 100%);
}

body,
label,
.brand,
.session-actions,
.segmented,
.auth-summary,
.dashboard-heading,
.panel-header,
.stats,
.row-title,
.row-meta,
.amount,
.empty,
.toast-stack {
  cursor: default;
  user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
  user-select: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: white;
  cursor: text;
  outline: none;
  user-select: text;
}

textarea {
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
}

select {
  cursor: pointer;
}

select option {
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(49, 77, 183, 0.7);
  box-shadow: 0 0 0 3px rgba(49, 77, 183, 0.14);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted-dark);
  font-size: 0.86rem;
  font-weight: 700;
}

label small {
  color: var(--muted-dark);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

svg {
  display: block;
}

.app-shell {
  width: min(calc(100% - 2rem), 1180px);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.app-header {
  position: sticky;
  top: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 13, 31, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0.28rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 189, 18, 0.18), rgba(109, 74, 255, 0.24));
}

.brand-mark img {
  width: 100%;
  height: auto;
}

.brand-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #17100a;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-copy strong,
h1,
h2,
.button {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy span,
.session-actions {
  color: var(--muted);
  font-size: 0.9rem;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  color: #17100a;
  background: linear-gradient(135deg, var(--gold), var(--orange) 62%, var(--orange-deep));
}

.mini-button.button-danger {
  color: #fff;
  border-color: rgba(211, 65, 65, 0.6);
  background: var(--danger);
}

.button-subtle {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.button-secondary {
  color: #101735;
  background: #ffffff;
  border-color: rgba(17, 24, 47, 0.14);
}

.button-danger {
  color: white;
  background: var(--danger);
  border-color: rgba(255, 255, 255, 0.12);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(330px, 450px) 1fr;
  gap: 1rem;
  align-items: stretch;
}

.auth-panel,
.auth-summary,
.dashboard,
.panel,
.stats article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 1rem;
  min-height: calc(100vh - 120px);
  padding: 1.4rem;
  color: var(--ink);
  background: var(--panel);
}

.auth-summary {
  display: grid;
  align-content: end;
  gap: 0.8rem;
  min-height: calc(100vh - 120px);
  padding: 1rem;
  background:
    linear-gradient(145deg, rgba(49, 77, 183, 0.22), transparent 40%),
    linear-gradient(315deg, rgba(255, 141, 0, 0.18), transparent 44%),
    rgba(255, 255, 255, 0.06);
}

.summary-card {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 14, 32, 0.52);
}

.summary-card span,
.eyebrow,
.stats span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-card strong {
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 0.55rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

p {
  color: var(--muted-dark);
  line-height: 1.55;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(17, 24, 47, 0.05);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted-dark);
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 8px rgba(17, 24, 47, 0.12);
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  gap: 0.65rem;
}

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

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

.password-field {
  position: relative;
  display: block;
  line-height: 0;
}

.password-field input {
  padding-right: 44px;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted-dark);
  background: transparent;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--blue);
  background: rgba(49, 77, 183, 0.1);
}

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

.icon-button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(-38deg);
}

.message {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.92rem;
}

.message.info {
  color: #4865d7;
}

.dashboard {
  display: grid;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.06);
}

.app-workspace {
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
  min-height: calc(100vh - 120px);
}

.app-workspace.nav-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 13, 31, 0.56);
}

.sidebar.collapsed {
  grid-template-columns: 1fr;
  width: 68px;
}

.sidebar-toggle {
  display: grid;
  gap: 4px;
  width: 42px;
  height: 42px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
}

.side-nav {
  display: grid;
  gap: 0.35rem;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
}

.nav-icon img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar.collapsed .nav-item {
  grid-template-columns: 32px;
  justify-content: center;
}

.sidebar.collapsed .nav-label {
  display: none;
}

.workspace-main {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.workspace-section {
  display: none;
  gap: 1rem;
}

.workspace-section.active {
  display: grid;
}

.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 46px;
}

.dashboard-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.65rem, 2.2vw, 2.25rem);
  line-height: 1.1;
}

.toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.toolbar .button {
  min-width: 118px;
}

.toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 100;
  display: grid;
  gap: 0.55rem;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(18, 27, 58, 0.98);
  box-shadow: 0 18px 50px rgba(2, 6, 20, 0.32);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(-16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast::before {
  content: "";
  flex: 0 0 8px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--gold);
}

.toast.success::before {
  background: #72efaa;
}

.toast.info::before {
  background: #79c7ff;
}

.toast.warning::before {
  background: var(--gold);
}

.toast.error::before {
  background: var(--danger);
}

.toast-message {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.toast-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.row-action-popover {
  position: absolute;
  z-index: 40;
  display: grid;
  gap: 0.35rem;
  min-width: 160px;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 14, 32, 0.98);
  box-shadow: var(--shadow);
}

.row-action-popover button {
  min-height: 36px;
  padding: 0 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  font-weight: 800;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.row-action-popover button:hover,
.row-action-popover button:focus-visible {
  color: #17100a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  outline: none;
  transform: translateY(-1px);
}

.row-action-popover button.danger {
  color: #ffd8d8;
  border-color: rgba(197, 65, 65, 0.45);
  background: rgba(197, 65, 65, 0.16);
}

.row-action-popover button.danger:hover,
.row-action-popover button.danger:focus-visible {
  color: #fff;
  border-color: transparent;
  background: var(--danger);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.stats article,
.panel {
  background: var(--panel-dark);
}

.stats article {
  position: relative;
  overflow: hidden;
  padding: 1rem;
}

.stats article::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  width: var(--metric-progress, 0%);
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--gold));
  opacity: 0.82;
}

.stats strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.8rem;
  font-family: "Space Grotesk", sans-serif;
}

.stats small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 0.85rem;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-header.inner {
  margin: 1rem 0 0.65rem;
  padding: 0 0 0.65rem;
}

.panel-body {
  max-height: 430px;
  overflow-y: auto;
  padding: 0.55rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(0, 0, 0, 0.08);
}

.panel-body.large-scroll {
  max-height: 560px;
}

.panel-body::-webkit-scrollbar,
.modal::-webkit-scrollbar {
  width: 10px;
}

.panel-body::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.panel-body::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  background-clip: content-box;
}

.list {
  display: grid;
  gap: 0.4rem;
}

.row-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.8rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.row-item.selected {
  border: 1px solid rgba(255, 189, 18, 0.48);
  background: rgba(255, 189, 18, 0.12);
}

.account-row {
  cursor: pointer;
}

.account-row.selected {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
}

.account-row.selected:hover {
  background: rgba(255, 255, 255, 0.09);
}

.connection-row {
  cursor: pointer;
}

.connection-row .row-top {
  align-items: flex-start;
}

.connection-row .connection-account-list {
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.transaction-row {
  cursor: pointer;
}

.row-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
}

.mini-button {
  min-height: 30px;
  padding: 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.mini-button.button-primary {
  border-color: transparent;
  color: #10182f;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.mini-button.button-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.modal .mini-button.button-secondary {
  color: var(--text-dark);
  background: #fff;
}

.modal .mini-button.button-primary {
  color: #11182e;
}

.mini-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.compact-select {
  width: min(240px, 38vw);
  min-height: 32px;
  padding: 0 0.55rem;
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  font-weight: 800;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}

.filter-bar label {
  color: var(--muted);
}

.filter-bar input,
.filter-bar select {
  min-height: 38px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.graph-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.graph-hero label {
  width: min(360px, 100%);
  color: var(--muted);
}

.graph-hero select,
.detail-toolbar select {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #071126;
  background: #fff;
  font-size: 1rem;
  font-weight: 900;
}

.graph-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.graph-metrics article {
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 179, 18, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.06);
}

.graph-metrics span {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.graph-metrics strong {
  white-space: nowrap;
  font-size: clamp(0.95rem, 1.55vw, 1.35rem);
}

.graph-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0;
}

.segmented-control {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.segmented-control button {
  min-height: 34px;
  padding: 0 0.8rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segmented-control.compact button {
  min-width: 48px;
}

.segmented-control button.active {
  color: #17100a;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.tab-strip {
  display: inline-flex;
  gap: 0.25rem;
  width: fit-content;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.tab-strip button {
  min-height: 38px;
  padding: 0 1rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.tab-strip button.active {
  color: #17100a;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.tab-panel {
  display: none;
  gap: 1rem;
}

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

.chart-shell {
  position: relative;
  min-height: 420px;
  padding: 1rem;
}

.chart-canvas {
  width: 100%;
  height: 390px;
}

.chart-shell .empty {
  min-height: 360px;
  display: grid;
  place-items: center;
}

.graph-transactions {
  margin: 0 1rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.budget-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.budget-profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.control-label {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.budget-month-picker {
  width: min(220px, 100%);
  color: var(--muted);
}

.budget-active-button {
  min-height: 42px;
}

.budget-stats strong {
  white-space: nowrap;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.budget-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.budget-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--orange));
}

.budget-setup {
  display: grid;
  gap: 1rem;
}

.budget-pacing,
.budget-modal-layout {
  display: grid;
  gap: 1rem;
}

.budget-pacing article,
.budget-setup-section,
.budget-category-config {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.budget-pacing span,
.budget-pacing small {
  display: block;
  color: var(--muted);
}

.budget-pacing strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.45rem;
}

.budget-category-table {
  display: grid;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid rgba(15, 24, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(15, 24, 47, 0.04);
}

.budget-category-config {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) minmax(120px, 160px);
  gap: 0.75rem;
  align-items: center;
}

.budget-modal-layout .budget-setup-section,
.budget-modal-layout .budget-category-config,
.budget-modal-layout .budget-account-list .checkbox-row {
  border-color: rgba(15, 24, 47, 0.12);
  background: rgba(15, 24, 47, 0.045);
}

.budget-account-list,
.budget-category-form {
  display: grid;
  gap: 0.65rem;
}

.budget-template-goals {
  margin-bottom: 0.5rem;
}

.budget-category-subheader {
  margin-top: 0.9rem;
  padding: 0;
}

.budget-account-list .checkbox-row {
  justify-content: flex-start;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
}

.budget-account-list small {
  display: block;
  color: var(--muted);
}

.count-pill,
.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.tag-pill {
  margin-left: 0.45rem;
  border-color: rgba(255, 183, 24, 0.35);
  background: rgba(255, 183, 24, 0.14);
  color: var(--gold);
}

.transaction-tag-editor {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.transaction-tag-editor.readonly {
  grid-template-columns: 1fr;
}

.transaction-tag-editor.readonly article {
  padding: 0.85rem;
  border: 1px solid rgba(15, 24, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(15, 24, 47, 0.04);
}

.transaction-tag-editor.readonly span {
  display: block;
  color: var(--muted-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-segmented {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 1rem;
  border-color: rgba(15, 24, 47, 0.16);
  background: rgba(15, 24, 47, 0.06);
}

.modal-segmented button {
  color: var(--muted-dark);
}

.modal-segmented button.active {
  color: #10182f;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.segmented-control button.is-active-template {
  color: #10182f;
  background: rgba(124, 255, 178, 0.2);
  box-shadow: inset 0 -3px 0 rgba(124, 255, 178, 0.85);
}

.modal-segmented button.active.is-active-template {
  box-shadow: inset 0 -3px 0 rgba(124, 255, 178, 0.9);
}

.segmented-control button.active.is-active-template {
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.row-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.row-heading {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.row-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.row-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.danger-text {
  color: #ffb8b8;
}

.info-text {
  color: #b9c8ff;
}

.amount {
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.calendar-title {
  min-width: 135px;
  color: var(--text);
  font-weight: 800;
  text-align: center;
}

.calendar-shell {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.75rem;
}

.calendar-heading {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  min-height: 76px;
  align-content: space-between;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.calendar-day.muted {
  opacity: 0.45;
}

.calendar-day.current-week {
  background: rgba(255, 255, 255, 0.1);
}

.calendar-day.today {
  outline: 2px solid rgba(255, 189, 18, 0.72);
  outline-offset: -2px;
}

.calendar-day strong {
  justify-self: end;
  min-width: 26px;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #17100a;
  background: var(--muted);
  font-size: 0.82rem;
}

.calendar-day.past-due strong,
.status-pill.past-due {
  background: #d54848;
  color: #fff;
}

.calendar-day.due-today strong,
.status-pill.due-today {
  background: #ff8a00;
  color: #17100a;
}

.calendar-day.due-soon strong,
.status-pill.due-soon {
  background: #ffd84d;
  color: #17100a;
}

.calendar-day.paid strong,
.status-pill.paid {
  background: #66d68b;
  color: #0d1a11;
}

.status-pill.future {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.income-sign {
  color: #91f0b4;
}

.expense-sign {
  color: #ffb8b8;
}

.empty {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}

.section-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.section-tabs button {
  min-height: 38px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.section-tabs button.active {
  color: #17100a;
  background: linear-gradient(135deg, var(--gold), var(--orange));
}

.account-tab-panel {
  display: none;
}

.account-tab-panel.active {
  display: grid;
  gap: 1rem;
}

.compact-toggle {
  display: inline-flex;
  align-items: center;
  grid-auto-flow: column;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.compact-toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
}

.detail-grid article {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.detail-grid span {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.embedded-section {
  margin-top: 1rem;
}

.advanced-toggle {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(49, 77, 183, 0.22);
  border-radius: var(--radius);
  padding: 0 0.9rem;
  color: var(--ink);
  background: rgba(49, 77, 183, 0.08);
  font-weight: 900;
}

.advanced-toggle strong {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.65rem;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.advanced-panel {
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: rgba(49, 77, 183, 0.06);
}

.connection-account-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.connection-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.connection-account-row div:first-child {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.connection-account-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-account-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.connection-detail-grid article,
.transaction-detail-grid article {
  background: rgba(255, 255, 255, 0.92);
}

.connection-issue {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(15, 24, 47, 0.12);
  border-radius: var(--radius);
  color: #10182f;
  font-weight: 700;
  background: rgba(15, 24, 47, 0.045);
}

.connection-issue.error {
  color: #8f2525;
  border-color: rgba(211, 65, 65, 0.24);
  background: rgba(211, 65, 65, 0.08);
}

.connection-issue.info {
  color: #6a4a00;
  border-color: rgba(255, 189, 18, 0.28);
  background: rgba(255, 189, 18, 0.12);
}

.connection-map-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 0.65rem;
  flex: 1 1 100%;
}

.connection-map-controls label {
  display: grid;
  gap: 0.3rem;
}

.connection-map-controls label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-toolbar {
  width: min(340px, 100%);
  margin-bottom: 1rem;
}

.detail-toolbar label {
  color: var(--muted);
}

.detail-toolbar .compact-select {
  width: 100%;
}

.transaction-detail-grid article {
  border: 1px solid rgba(17, 24, 47, 0.09);
  color: var(--ink);
  background: #fff;
}

.transaction-detail-grid span {
  color: var(--orange-deep);
}

.transaction-detail-grid strong {
  color: var(--ink);
}

.feature-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0.85rem;
}

.settings-layout,
.help-layout {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

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

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

.settings-card,
.help-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-height: 150px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 189, 18, 0.08), transparent 36%),
    rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 30px rgba(4, 8, 20, 0.14);
}

.settings-card::before,
.help-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(var(--gold), var(--orange));
}

.profile-card {
  grid-column: 1 / -1;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
  align-items: start;
  gap: 1rem;
}

.settings-label,
.settings-detail-list span,
.settings-metrics span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-card h3,
.help-card h3 {
  margin: 0;
  font-size: 1.18rem;
}

.settings-card p,
.help-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-detail-list,
.settings-metrics {
  display: grid;
  gap: 0.55rem;
}

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

.settings-detail-list div,
.settings-metrics div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 15, 38, 0.36);
}

.settings-detail-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.settings-metrics strong {
  font-size: 1.55rem;
}

.preference-list,
.settings-actions {
  display: grid;
  gap: 0.55rem;
}

.settings-actions {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.settings-note {
  font-size: 0.88rem;
}

.danger-card {
  border: 1px solid rgba(213, 72, 72, 0.34);
}

.danger-card::before {
  background: #d54848;
}

.help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.help-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.support-card {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .support-card {
    grid-column: auto;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 8, 18, 0.68);
  backdrop-filter: blur(12px);
}

.modal {
  position: relative;
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.small-modal {
  width: min(620px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-header .eyebrow {
  color: var(--orange-deep);
}

.modal-close {
  position: relative;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  transform: none;
}

.account-form,
.type-fields {
  display: grid;
  gap: 0.85rem;
}

.type-fields {
  padding-top: 0.2rem;
}

.link-options {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(17, 24, 47, 0.04);
}

.field-label {
  color: var(--muted-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.checkbox-row,
.radio-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
}

.checkbox-row input,
.radio-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

.radio-row.disabled {
  opacity: 0.5;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-actions .button {
  width: 100%;
}

.modal-actions.two-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-actions.two-actions .button {
  width: auto;
  min-width: 150px;
}

.modal-delete {
  position: absolute;
  top: 1rem;
  right: 4.75rem;
  min-height: 38px;
  padding: 0 0.9rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .auth-layout,
  .dashboard-grid,
  .app-workspace,
  .feature-grid,
  .settings-layout,
  .help-layout,
  .profile-card,
  .settings-detail-list,
  .graph-hero,
  .graph-metrics,
  .budget-toolbar,
  .budget-category-config,
  .transaction-tag-editor,
  .filter-bar,
  .stats,
  .field-grid.two,
  .field-grid.three {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .sidebar.collapsed {
    width: auto;
  }

  .app-workspace.nav-collapsed {
    grid-template-columns: 1fr;
  }

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

  .sidebar.collapsed .nav-label {
    display: inline;
  }

  .auth-summary {
    min-height: auto;
  }

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

  .toolbar {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar .button {
    min-width: 0;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .modal-actions.two-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-actions.two-actions .button {
    width: 100%;
  }

  .modal-delete {
    position: static;
    width: 100%;
    margin-top: 0.75rem;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(calc(100% - 1rem), 1180px);
    padding-top: 0.5rem;
  }

  .app-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

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

  .button {
    width: 100%;
  }

  .session-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

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

  .nav-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }
}
