:root {
  --bg-main: #050b10;
  --bg-soft: #0b141c;
  --surface: #121e28;
  --surface-elevated: #182632;
  --ink-900: #eaf3f0;
  --ink-700: #c3d5d0;
  --ink-500: #8fa8a1;
  --green-700: #1ca16c;
  --green-600: #24b278;
  --green-300: #7ad4ae;
  --amber-500: #d19a49;
  --amber-300: #f0c98b;
  --danger: #ff8f8f;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --ring: 0 0 0 3px rgba(42, 186, 131, 0.3);
  --shadow: 0 24px 58px rgba(3, 9, 13, 0.55);
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  color: var(--ink-900);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 14% 12%, rgba(28, 161, 108, 0.22), transparent 36%),
    radial-gradient(circle at 86% 18%, rgba(209, 154, 73, 0.2), transparent 35%),
    linear-gradient(160deg, var(--bg-main) 0%, #09131b 52%, #0f1922 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(45deg, rgba(136, 177, 159, 0.12) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(136, 177, 159, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(132, 174, 156, 0.1) 1px, transparent 1px);
  background-size: 16px 16px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 62%);
}

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

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.35;
  pointer-events: none;
  animation: floatOrb 10s ease-in-out infinite;
}

.orb-1 {
  top: -80px;
  left: -70px;
  background: radial-gradient(circle at 40% 35%, #285844, #10251d);
}

.orb-2 {
  right: -70px;
  bottom: -100px;
  background: radial-gradient(circle at 50% 50%, #5f4626, #2c2014);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.panel,
.card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(117, 160, 142, 0.24);
  background: linear-gradient(160deg, rgba(22, 35, 45, 0.94), rgba(14, 23, 31, 0.9));
  backdrop-filter: blur(7px);
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.panel:hover,
.card:hover {
  border-color: rgba(138, 188, 166, 0.42);
  transform: translateY(-1px);
}

.label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.hidden {
  display: none !important;
}

.auth-panel {
  width: min(520px, 100%);
  margin: 40px auto;
  padding: 34px;
  display: grid;
  gap: 14px;
}

.auth-panel h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
}

.subtitle {
  color: var(--ink-700);
  font-size: 0.98rem;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.tab-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-700);
  background: rgba(120, 170, 147, 0.3);
  transition: all 0.2s ease;
}

.tab-btn.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  box-shadow: 0 10px 20px rgba(16, 98, 61, 0.25);
}

.auth-form {
  display: none;
  gap: 8px;
}

.auth-form.is-active {
  display: grid;
}

.auth-link-btn {
  border: 0;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  justify-self: start;
  padding: 2px 0;
}

.auth-link-btn:hover {
  color: var(--ink-900);
}

.auth-form label,
.expense-form label,
.budget-form label,
.toolbar label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-700);
}

.auth-form input,
.expense-form input,
.expense-form textarea,
.expense-form select,
.budget-form input,
.search-wrap input,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid rgba(122, 170, 148, 0.34);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--ink-900);
  font-size: 0.94rem;
  padding: 11px 12px;
  font-family: inherit;
}

.auth-form input:focus,
.expense-form input:focus,
.expense-form textarea:focus,
.expense-form select:focus,
.budget-form input:focus,
.search-wrap input:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  box-shadow: var(--ring);
  border-color: rgba(55, 203, 144, 0.72);
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-content: start;
  align-items: start;
}

.expense-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

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

.expense-form textarea {
  resize: vertical;
  min-height: 80px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-700);
}

.inline-check input {
  width: auto;
  margin: 0;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  box-shadow: 0 11px 20px rgba(16, 98, 61, 0.24);
}

.btn.secondary {
  color: #ffffff;
  background: linear-gradient(135deg, #b07b2b, var(--amber-500));
}

.btn.ghost {
  color: var(--ink-700);
  background: rgba(120, 170, 147, 0.2);
}

.btn.small {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.btn.full {
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.reset-fields {
  display: grid;
  gap: 8px;
}

.demo-code {
  border: 1px solid rgba(122, 170, 148, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(120, 170, 147, 0.12);
  color: var(--ink-900);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 10px 12px;
}

.feedback {
  min-height: 1.1rem;
  font-size: 0.86rem;
  color: var(--ink-500);
}

.feedback.is-success {
  color: #6ae0b0;
}

.feedback.is-error {
  color: var(--danger);
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-500);
}

.dashboard {
  display: grid;
  gap: 18px;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 16px;
  height: fit-content;
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 20px;
}

.brand-title {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.3;
}

.brand-subtitle {
  margin-top: 9px;
  color: var(--ink-700);
  font-size: 0.84rem;
  line-height: 1.5;
}

.welcome {
  color: var(--ink-700);
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 11px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(117, 160, 142, 0.26);
  background: rgba(120, 170, 147, 0.18);
}

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

.nav-btn {
  border: 1px solid rgba(117, 160, 142, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 11px 12px;
  color: var(--ink-700);
  background: rgba(120, 170, 147, 0.14);
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-icon {
  min-width: 2.1rem;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(120, 170, 147, 0.3);
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.nav-btn.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  border-color: transparent;
}

.nav-btn.is-active .nav-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.content-area {
  display: grid;
  gap: 17px;
}

.content-header {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.content-header h2 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.view-subtitle {
  margin-top: 8px;
  color: var(--ink-700);
  font-size: 0.88rem;
  line-height: 1.4;
}

.insight-strip {
  margin-top: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.insight-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(20, 92, 58, 0.12);
  background: rgba(167, 210, 185, 0.14);
  padding: 5px 9px;
  color: var(--ink-700);
  font-size: 0.74rem;
  line-height: 1;
}

.insight-pill strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-900);
}

.view {
  display: grid;
  gap: 14px;
}

.view.view-enter {
  animation: viewIn 0.28s ease both;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 188px;
}

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

.toolbar-custom-range input {
  min-width: 0;
}

.undo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(122, 170, 148, 0.34);
  border-radius: var(--radius-md);
  background: rgba(24, 38, 50, 0.9);
  padding: 10px 12px;
}

.undo-banner p {
  font-size: 0.84rem;
  color: var(--ink-700);
}

.undo-actions {
  display: flex;
  gap: 8px;
}

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

.forecast-grid p {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: rgba(120, 170, 147, 0.16);
}

.forecast-grid span {
  font-size: 0.76rem;
  color: var(--ink-500);
}

.forecast-grid strong {
  font-size: 0.93rem;
  font-family: var(--font-display);
}

.filter-panel {
  border: 1px solid rgba(117, 160, 142, 0.22);
  border-radius: var(--radius-md);
  background: rgba(18, 30, 40, 0.64);
  padding: 14px;
}

.filter-panel h4 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.98rem;
}

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

.filter-grid > div {
  display: grid;
  gap: 4px;
}

.filter-grid label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-500);
}

.filter-grid input,
.filter-grid select,
.saved-view-row input,
.saved-view-row select,
.report-builder-controls select,
.report-builder-controls input,
.lock-controls input {
  border: 1px solid rgba(122, 170, 148, 0.34);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--ink-900);
  font-size: 0.86rem;
  padding: 8px 10px;
  font-family: inherit;
}

.saved-view-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.saved-view-row input,
.saved-view-row select {
  min-width: 150px;
}

.report-builder-controls,
.lock-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.report-builder-output {
  display: grid;
  gap: 10px;
}

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

.builder-cards p {
  display: grid;
  gap: 4px;
  border-radius: var(--radius-sm);
  background: rgba(120, 170, 147, 0.14);
  padding: 9px 10px;
}

.builder-cards span {
  color: var(--ink-500);
  font-size: 0.76rem;
}

.pie-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 380px) 1fr;
  align-items: center;
}

.pie-canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(117, 160, 142, 0.22);
  background: rgba(22, 35, 45, 0.58);
}

#report-pie-chart {
  width: 100%;
  max-width: 380px;
  height: auto;
}

.pie-meta {
  display: grid;
  gap: 10px;
}

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

.pie-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(122, 170, 148, 0.25);
  background: rgba(120, 170, 147, 0.12);
  padding: 7px 9px;
}

.pie-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.pie-label {
  color: var(--ink-900);
  font-size: 0.84rem;
}

.pie-value {
  color: var(--ink-700);
  font-size: 0.8rem;
}

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

.settings-grid > div {
  display: grid;
  gap: 5px;
}

.settings-grid label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-500);
}

.settings-grid input,
.settings-grid select {
  border: 1px solid rgba(122, 170, 148, 0.34);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--ink-900);
  font-size: 0.86rem;
  padding: 8px 10px;
  font-family: inherit;
}

.settings-grid > button {
  width: fit-content;
  align-self: start;
}

#appearance-settings-form > button[type="submit"] {
  grid-column: 1;
  justify-self: start;
}

.theme-light {
  --bg-main: #f3f8f6;
  --bg-soft: #e8f1ee;
  --surface: #ffffff;
  --surface-elevated: #f6fbf9;
  --ink-900: #0f1e24;
  --ink-700: #294149;
  --ink-500: #56707a;
  --shadow: 0 20px 40px rgba(43, 73, 84, 0.16);
}

.font-small {
  font-size: 14px;
}

.font-medium {
  font-size: 16px;
}

.font-large {
  font-size: 18px;
}

.theme-color-emerald {
  --green-700: #1ca16c;
  --green-600: #24b278;
  --amber-500: #d19a49;
}

.theme-color-ocean {
  --green-700: #256fb3;
  --green-600: #2e86d8;
  --amber-500: #49a3d1;
}

.theme-color-sunset {
  --green-700: #c96f2d;
  --green-600: #d9863f;
  --amber-500: #e0a04e;
}

.theme-color-rose {
  --green-700: #b34f73;
  --green-600: #c06084;
  --amber-500: #d98474;
}

.theme-color-slate {
  --green-700: #334155;
  --green-600: #475569;
  --amber-500: #0ea5e9;
}

.theme-color-cobalt {
  --green-700: #1d4ed8;
  --green-600: #2563eb;
  --amber-500: #38bdf8;
}

.theme-color-graphite {
  --green-700: #3f3f46;
  --green-600: #52525b;
  --amber-500: #a1a1aa;
}

.theme-color-amber {
  --green-700: #92400e;
  --green-600: #b45309;
  --amber-500: #f59e0b;
}

.toast-stack {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 25;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100% - 28px));
  pointer-events: none;
}

.toast {
  border: 1px solid rgba(117, 160, 142, 0.22);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(28, 43, 55, 0.96), rgba(18, 29, 38, 0.92));
  box-shadow: 0 14px 28px rgba(3, 9, 13, 0.46);
  color: var(--ink-900);
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 9px 10px;
  animation: toastIn 0.2s ease both;
}

.toast.success {
  border-color: rgba(106, 224, 176, 0.4);
}

.toast.error {
  border-color: rgba(255, 143, 143, 0.42);
}

.toast.info {
  border-color: rgba(122, 170, 148, 0.35);
}

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

.card {
  padding: 19px;
}

.card-label {
  color: var(--ink-500);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-icon {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(157, 195, 174, 0.26);
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
}

.stat-card h3 {
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  font-family: var(--font-display);
}

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

.split-layout {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: minmax(0, 300px) 1fr;
}

#expenses-view {
  gap: 16px;
}

#expenses-view .split-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

#expenses-view .two-col {
  gap: 16px;
  grid-template-columns: 1fr;
  align-items: start;
}

#expenses-view .split-layout > .inner-panel,
#expenses-view .two-col > .inner-panel {
  height: auto;
}

#expenses-view .inner-panel {
  gap: 14px;
}

#expenses-view .table-wrap.compact {
  max-height: none;
}

.inner-panel {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.inner-panel h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.budget-panel {
  gap: 14px;
}

.budget-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.budget-note {
  margin-top: 6px;
  font-size: 0.84rem;
  line-height: 1.42;
  color: var(--ink-700);
}

.budget-form {
  min-width: min(100%, 420px);
  display: grid;
  gap: 7px;
}

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

.budget-actions input {
  flex: 1;
}

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

.budget-metrics p {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: rgba(162, 201, 179, 0.15);
}

.budget-metrics span {
  font-size: 0.79rem;
  color: var(--ink-500);
}

.budget-metrics strong {
  font-size: 0.97rem;
  font-family: var(--font-display);
}

.budget-progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(157, 195, 174, 0.22);
  overflow: hidden;
}

.budget-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-600), #3aa571);
  transition: width 0.28s ease;
}

.budget-progress.is-warning .budget-progress-fill {
  background: linear-gradient(90deg, #ca8a2d, #dfb35f);
}

.budget-progress.is-danger .budget-progress-fill {
  background: linear-gradient(90deg, #ca5050, #b22d2d);
}

.budget-status {
  font-size: 0.87rem;
  color: var(--ink-700);
}

.budget-status.is-safe {
  color: #6ae0b0;
}

.budget-status.is-warning {
  color: #f0c98b;
}

.budget-status.is-danger {
  color: var(--danger);
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(162, 201, 179, 0.15);
}

.recent-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recent-copy {
  display: grid;
  gap: 4px;
}

.recent-main strong {
  font-size: 0.91rem;
}

.recent-badge {
  min-width: 2rem;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(160, 203, 178, 0.34);
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-align: center;
}

.recent-amount {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.recent-kind {
  font-size: 0.72rem;
  color: var(--ink-500);
}

.recent-meta {
  font-size: 0.78rem;
  color: var(--ink-500);
}

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

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(157, 195, 174, 0.22);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-600), #3aa571, var(--amber-500));
}

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

.search-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrap input {
  min-width: 260px;
  flex: 1 1 280px;
}

.search-wrap .btn {
  white-space: nowrap;
}

.btn.ghost.is-active-filter {
  color: var(--ink-900);
  background: rgba(120, 170, 147, 0.34);
  border: 1px solid rgba(122, 170, 148, 0.4);
}

.filter-panel {
  margin-top: 10px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(117, 160, 142, 0.24);
}

.table-wrap.compact {
  max-height: 300px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(117, 160, 142, 0.16);
  font-size: 0.88rem;
  white-space: nowrap;
}

th {
  font-size: 0.79rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-500);
  background: rgba(120, 170, 147, 0.12);
}

tbody tr {
  transition: background-color 0.18s ease;
}

tbody tr:hover {
  background: rgba(120, 170, 147, 0.14);
}

td.description {
  max-width: 250px;
  white-space: normal;
  color: var(--ink-700);
}

.table-actions {
  display: flex;
  gap: 6px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-actions .btn {
  border: 1px solid rgba(20, 92, 58, 0.15);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hidden-file-input {
  display: none;
}

.category-budget-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.category-budget-form select,
.category-budget-form input {
  border: 1px solid rgba(122, 170, 148, 0.34);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--surface-elevated);
}

.category-budget-form select:focus,
.category-budget-form input:focus {
  outline: none;
  box-shadow: var(--ring);
  border-color: rgba(55, 203, 144, 0.72);
}

.cell-muted {
  color: var(--ink-500);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pill.safe {
  color: #78e2b7;
  background: rgba(81, 182, 128, 0.16);
}

.status-pill.warning {
  color: #f0c98b;
  background: rgba(224, 179, 95, 0.2);
}

.status-pill.danger {
  color: #ffaaaa;
  background: rgba(199, 80, 80, 0.18);
}

.status-pill.neutral {
  color: var(--ink-700);
  background: rgba(120, 170, 147, 0.22);
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge.active {
  color: #78e2b7;
  background: rgba(81, 182, 128, 0.16);
}

.badge.inactive {
  color: #ffaaaa;
  background: rgba(199, 80, 80, 0.18);
}

.empty {
  padding: 14px 0;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.admin-grid {
  margin-bottom: 14px;
}

.protected-label {
  color: var(--ink-500);
  font-size: 0.78rem;
}

.card-grid .card:nth-child(1) { animation-delay: 0.03s; }
.card-grid .card:nth-child(2) { animation-delay: 0.08s; }
.card-grid .card:nth-child(3) { animation-delay: 0.14s; }
.card-grid .card:nth-child(4) { animation-delay: 0.2s; }

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

@keyframes floatOrb {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .sidebar {
    position: static;
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

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

  .budget-metrics {
    grid-template-columns: 1fr;
  }

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

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

  .builder-cards {
    grid-template-columns: 1fr 1fr;
  }

  .pie-layout {
    grid-template-columns: 1fr;
  }

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

  .two-col,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .search-wrap input {
    min-width: 0;
  }

  .category-budget-form {
    width: 100%;
  }

  .category-budget-form select,
  .category-budget-form input {
    flex: 1;
    min-width: 140px;
  }
}

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

  #expenses-view {
    gap: 12px;
  }

  #expenses-view .expense-form {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .auth-panel,
  .sidebar,
  .content-header,
  .inner-panel,
  .card {
    border-radius: 16px;
  }

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

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

  .nav-icon {
    min-width: 1.8rem;
    padding: 2px 6px;
  }

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

  .toolbar {
    width: 100%;
  }

  .toolbar-custom-range {
    grid-template-columns: 1fr;
  }

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

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

  .insight-strip {
    width: 100%;
  }

  .search-wrap {
    width: 100%;
  }

  .search-wrap input {
    flex: 1;
  }

  .budget-actions {
    flex-wrap: wrap;
  }

  .report-actions {
    width: 100%;
  }

  .report-actions .btn {
    width: 100%;
  }

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

  .undo-actions {
    width: 100%;
  }

  .undo-actions .btn {
    flex: 1;
  }

  .saved-view-row,
  .report-builder-controls,
  .lock-controls {
    width: 100%;
  }

  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .lock-controls input {
    flex: 1;
    min-width: 0;
  }

  .filter-grid,
  .forecast-grid,
  .builder-cards {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .card,
  .bg-orb,
  .view.view-enter,
  .btn,
  tbody tr {
    animation: none !important;
    transition: none !important;
  }

  .toast {
    animation: none !important;
  }
}

/* Premium 2026 redesign layer: visual refresh without changing app structure. */
:root {
  --bg-main: #030915;
  --bg-soft: #091426;
  --surface: #101f36;
  --surface-elevated: #152946;
  --ink-900: #f3f8ff;
  --ink-700: #c7d8ee;
  --ink-500: #88a4c5;
  --green-700: #0f9f79;
  --green-600: #1ec59a;
  --green-300: #8de8ca;
  --amber-500: #ffaf47;
  --amber-300: #ffd9a8;
  --danger: #ff8c97;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 13px;
  --ring: 0 0 0 3px rgba(33, 197, 154, 0.34);
  --shadow: 0 34px 84px rgba(2, 8, 20, 0.62);
}

body.theme-dark {
  --bg-main: #030915;
  --bg-soft: #091426;
  --surface: #101f36;
  --surface-elevated: #152946;
  --ink-900: #f3f8ff;
  --ink-700: #c7d8ee;
  --ink-500: #88a4c5;
}

body.theme-light {
  --bg-main: #eef4f9;
  --bg-soft: #dfe9f3;
  --surface: #ffffff;
  --surface-elevated: #f5f9fe;
  --ink-900: #102238;
  --ink-700: #304b63;
  --ink-500: #557089;
  --shadow: 0 24px 52px rgba(41, 67, 92, 0.15);
}

body {
  background:
    radial-gradient(circle at 10% 10%, rgba(33, 206, 160, 0.28), transparent 34%),
    radial-gradient(circle at 90% 8%, rgba(255, 170, 74, 0.24), transparent 34%),
    radial-gradient(circle at 2% 100%, rgba(41, 87, 172, 0.3), transparent 46%),
    radial-gradient(circle at 60% 100%, rgba(24, 61, 124, 0.32), transparent 52%),
    linear-gradient(155deg, var(--bg-main) 0%, #071024 48%, #11253f 100%);
  letter-spacing: 0.01em;
}

body.theme-light {
  background:
    radial-gradient(circle at 10% 8%, rgba(33, 170, 132, 0.2), transparent 34%),
    radial-gradient(circle at 88% 6%, rgba(243, 171, 81, 0.18), transparent 35%),
    linear-gradient(165deg, #edf4fa 0%, #e2ecf6 55%, #d6e4f1 100%);
}

body::before {
  opacity: 0.2;
  background-size: 48px 48px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(178, 223, 255, 0.025) 0,
      rgba(178, 223, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
  opacity: 0.34;
}

.bg-grid {
  opacity: 0.78;
  background-size: 18px 18px;
}

.bg-orb {
  width: 500px;
  height: 500px;
  opacity: 0.5;
  filter: blur(30px);
  mix-blend-mode: screen;
}

.orb-1 {
  top: -130px;
  left: -110px;
  background: radial-gradient(circle at 36% 30%, rgba(56, 229, 177, 0.86), rgba(18, 97, 120, 0.68) 48%, rgba(5, 18, 34, 0) 76%);
}

.orb-2 {
  right: -130px;
  bottom: -150px;
  background: radial-gradient(circle at 58% 46%, rgba(255, 190, 96, 0.78), rgba(57, 95, 170, 0.62) 54%, rgba(7, 19, 35, 0) 78%);
}

.app-shell {
  width: min(1360px, 100%);
  padding: 34px;
}

.panel,
.card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(123, 168, 220, 0.28);
  background:
    linear-gradient(170deg, rgba(14, 32, 54, 0.96), rgba(10, 24, 41, 0.93));
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(224, 240, 255, 0.06);
}

body.theme-light .panel,
body.theme-light .card {
  border: 1px solid rgba(113, 142, 168, 0.22);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 255, 0.95));
}

.panel::before,
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(
      140deg,
      rgba(102, 228, 187, 0.16) 0%,
      rgba(98, 169, 255, 0.09) 46%,
      rgba(255, 196, 116, 0.17) 100%
    );
  mix-blend-mode: screen;
}

.panel::after,
.card::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -92px;
  top: -98px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(106, 205, 255, 0.24), transparent 68%);
  pointer-events: none;
  z-index: -1;
}

.panel:hover,
.card:hover {
  border-color: rgba(153, 202, 247, 0.52);
  transform: translateY(-4px);
  box-shadow: 0 36px 92px rgba(2, 10, 21, 0.68), inset 0 1px 0 rgba(231, 243, 255, 0.08);
}

body.theme-light .panel:hover,
body.theme-light .card:hover {
  box-shadow: 0 24px 54px rgba(37, 62, 87, 0.22);
}

.label {
  color: var(--ink-500);
  letter-spacing: 0.14em;
  font-size: 0.73rem;
}

.subtitle,
.hint,
.budget-note,
.view-subtitle,
.welcome,
.feedback {
  color: var(--ink-700);
}

.auth-panel {
  width: min(560px, 100%);
  margin: 46px auto;
  padding: 38px;
  gap: 16px;
}

.auth-panel h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.auth-tabs {
  gap: 12px;
}

.tab-btn {
  font-weight: 700;
  border: 1px solid rgba(145, 186, 220, 0.25);
  background: rgba(93, 133, 167, 0.18);
  color: var(--ink-700);
}

.tab-btn.is-active {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  box-shadow: 0 16px 28px rgba(12, 93, 68, 0.34);
}

.dashboard {
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.sidebar {
  top: 20px;
  padding: 26px;
  gap: 22px;
  background:
    radial-gradient(circle at 8% 0%, rgba(40, 124, 188, 0.24), transparent 40%),
    linear-gradient(178deg, rgba(14, 34, 58, 0.97), rgba(10, 25, 43, 0.96));
}

body.theme-light .sidebar {
  background: linear-gradient(170deg, rgba(251, 254, 255, 0.98), rgba(236, 245, 255, 0.94));
}

.brand-title {
  font-size: 1.62rem;
  letter-spacing: -0.02em;
}

.welcome {
  background: rgba(65, 111, 151, 0.25);
  border: 1px solid rgba(142, 189, 227, 0.38);
}

.nav {
  gap: 9px;
}

.nav-btn {
  justify-content: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(66, 105, 141, 0.26);
  border-color: rgba(137, 182, 219, 0.34);
  font-weight: 700;
}

.nav-btn.is-active {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  box-shadow: 0 14px 24px rgba(13, 90, 67, 0.3);
}

.nav-icon {
  background: rgba(119, 171, 214, 0.36);
  color: var(--ink-900);
}

.content-header {
  padding: 22px 24px;
  align-items: flex-start;
  gap: 18px;
}

.content-header h2 {
  font-size: clamp(1.55rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.toolbar {
  min-width: 232px;
  background: rgba(67, 109, 149, 0.26);
  border: 1px solid rgba(149, 196, 237, 0.36);
  border-radius: 14px;
  padding: 10px;
}

.insight-pill {
  border: 1px solid rgba(151, 201, 241, 0.4);
  background: rgba(70, 122, 165, 0.28);
  color: var(--ink-700);
}

.pie-canvas-wrap {
  border: 1px solid rgba(156, 205, 244, 0.36);
  background:
    radial-gradient(circle at 50% 12%, rgba(101, 179, 245, 0.18), transparent 44%),
    linear-gradient(170deg, rgba(26, 52, 82, 0.58), rgba(14, 30, 49, 0.5));
  box-shadow: inset 0 1px 0 rgba(210, 234, 255, 0.08);
}

#report-pie-chart {
  filter: drop-shadow(0 14px 24px rgba(2, 12, 23, 0.45));
}

.pie-meta {
  gap: 12px;
}

.pie-legend li {
  position: relative;
  border-color: rgba(156, 205, 244, 0.34);
  background: linear-gradient(135deg, rgba(63, 107, 148, 0.28), rgba(43, 80, 116, 0.2));
}

.pie-legend li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--pie-soft, #9fd3ff), var(--pie-color, #63afff));
  opacity: 0.9;
}

.pie-swatch {
  width: 13px;
  height: 13px;
  box-shadow: 0 0 0 2px rgba(224, 240, 255, 0.1), 0 0 16px rgba(121, 188, 241, 0.35);
}

.pie-value strong {
  color: var(--ink-900);
  font-weight: 800;
}

body.theme-light .pie-canvas-wrap {
  background:
    radial-gradient(circle at 50% 12%, rgba(95, 157, 224, 0.2), transparent 42%),
    linear-gradient(170deg, rgba(250, 254, 255, 0.95), rgba(233, 244, 255, 0.9));
}

.card-grid {
  gap: 16px;
}

.card {
  padding: 22px;
}

.card-label {
  margin-bottom: 10px;
  color: var(--ink-700);
}

.stat-card h3 {
  font-size: clamp(1.2rem, 2.6vw, 1.65rem);
  letter-spacing: -0.02em;
}

.stat-icon {
  border: 1px solid rgba(145, 188, 221, 0.38);
  background: rgba(74, 124, 162, 0.22);
  color: var(--ink-900);
}

.inner-panel {
  padding: 20px;
  gap: 14px;
}

.inner-panel h3 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.budget-metrics p,
.forecast-grid p,
.builder-cards p,
.recent-item,
.pie-legend li {
  border: 1px solid rgba(147, 191, 228, 0.33);
  background: rgba(63, 107, 148, 0.24);
}

.budget-progress,
.bar-track {
  background: rgba(131, 176, 216, 0.3);
}

.budget-progress-fill,
.bar-fill {
  background: linear-gradient(90deg, var(--green-700), var(--green-600), var(--amber-500));
}

.table-wrap {
  border: 1px solid rgba(142, 185, 222, 0.34);
  background: rgba(44, 82, 116, 0.18);
}

th,
td {
  padding: 11px 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid rgba(149, 193, 230, 0.4);
  background: rgba(58, 100, 139, 0.36);
  color: var(--ink-700);
}

tbody tr:nth-child(2n) {
  background: rgba(68, 107, 145, 0.14);
}

tbody tr:hover {
  background: rgba(94, 151, 194, 0.24);
}

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

:is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  border: 1px solid rgba(152, 197, 235, 0.42);
  background: rgba(58, 97, 136, 0.28);
  color: var(--ink-900);
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  background: rgba(255, 255, 255, 0.95);
}

.btn {
  border: 1px solid transparent;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.btn.primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-600), #52dfc1);
  box-shadow: 0 14px 30px rgba(10, 103, 79, 0.42);
}

.btn.secondary {
  background: linear-gradient(135deg, #db8d22, var(--amber-500), #ffc167);
  box-shadow: 0 14px 30px rgba(123, 74, 16, 0.36);
}

.btn.ghost {
  border-color: rgba(154, 197, 234, 0.44);
  background: rgba(66, 108, 146, 0.28);
}

.undo-banner {
  border: 1px solid rgba(155, 201, 240, 0.42);
  background: rgba(62, 104, 143, 0.28);
}

.toast {
  border: 1px solid rgba(159, 203, 240, 0.44);
  background: linear-gradient(160deg, rgba(13, 34, 56, 0.99), rgba(9, 24, 40, 0.96));
}

body.theme-light .toast {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 255, 0.96));
}

.view.view-enter > * {
  animation: viewItemIn 0.45s ease both;
}

.view.view-enter > *:nth-child(2) {
  animation-delay: 0.04s;
}

.view.view-enter > *:nth-child(3) {
  animation-delay: 0.08s;
}

.view.view-enter > *:nth-child(4) {
  animation-delay: 0.12s;
}

@keyframes viewItemIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    padding: 22px;
  }

  .dashboard {
    gap: 16px;
  }

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

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

  .auth-panel {
    padding: 24px;
    margin-top: 24px;
  }

  .toolbar {
    width: 100%;
    min-width: 0;
  }

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

/* Signature beauty layer: richer atmosphere, cleaner hierarchy, and refined interactions. */
:root {
  --ui-edge: rgba(175, 216, 248, 0.42);
  --ui-soft: rgba(61, 105, 145, 0.26);
  --ui-soft-strong: rgba(35, 74, 111, 0.36);
  --ui-glow-cyan: rgba(98, 215, 255, 0.24);
  --ui-glow-gold: rgba(255, 191, 105, 0.2);
}

body {
  background-size: 120% 120%, 140% 140%, 150% 150%, 150% 150%, 100% 100%;
  animation: ambianceShift 26s ease-in-out infinite;
}

body.theme-light {
  background-size: 130% 130%, 140% 140%, 100% 100%;
}

@keyframes ambianceShift {
  0%,
  100% {
    background-position: 0% 0%, 100% 0%, 0% 100%, 60% 100%, 0% 0%;
  }
  50% {
    background-position: 6% 4%, 94% 2%, 2% 96%, 56% 98%, 0% 0%;
  }
}

.app-shell {
  position: relative;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.app-shell::before {
  left: 8%;
  right: 8%;
  top: 8px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(163, 209, 245, 0.45) 22%,
    rgba(255, 190, 113, 0.34) 50%,
    rgba(118, 220, 255, 0.38) 78%,
    transparent
  );
  opacity: 0.9;
}

.app-shell::after {
  width: 360px;
  height: 360px;
  right: 2%;
  top: 100px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--ui-glow-cyan), transparent 70%);
  filter: blur(20px);
  opacity: 0.55;
}

.panel,
.card {
  overflow: hidden;
  border-color: var(--ui-edge);
}

.panel::before,
.card::before {
  background:
    linear-gradient(
      135deg,
      rgba(108, 224, 188, 0.2) 0%,
      rgba(132, 197, 255, 0.1) 46%,
      rgba(255, 199, 128, 0.22) 100%
    );
}

.panel:hover,
.card:hover {
  border-color: rgba(186, 227, 255, 0.58);
}

.brand-title,
.content-header h2,
.auth-panel h1 {
  text-shadow: 0 10px 24px rgba(2, 10, 20, 0.36);
}

.inner-panel h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inner-panel h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(165, 211, 245, 0.48), transparent 74%);
}

.nav-btn {
  position: relative;
  backdrop-filter: blur(6px);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-btn::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8be8cb, #77d8ff);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-btn.is-active::before {
  opacity: 1;
}

.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 25%, rgba(255, 255, 255, 0.44) 50%, transparent 75%);
  transform: translateX(-145%);
  transition: transform 0.62s ease;
}

.btn:hover::after {
  transform: translateX(145%);
}

.btn.primary {
  border-color: rgba(154, 239, 213, 0.42);
}

.btn.secondary {
  border-color: rgba(255, 219, 160, 0.44);
}

:is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  box-shadow: inset 0 1px 0 rgba(213, 235, 255, 0.12), 0 1px 0 rgba(8, 20, 35, 0.35);
  border-color: rgba(165, 210, 245, 0.46);
  background: linear-gradient(180deg, var(--ui-soft), var(--ui-soft-strong));
}

:is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
):focus {
  background: linear-gradient(180deg, rgba(82, 131, 173, 0.34), rgba(53, 95, 132, 0.42));
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 250, 255, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 1px 0 rgba(149, 180, 205, 0.24);
}

.table-wrap {
  box-shadow: inset 0 1px 0 rgba(219, 239, 255, 0.1);
}

tbody tr td:first-child {
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease;
}

tbody tr:hover td:first-child {
  border-left-color: rgba(136, 221, 255, 0.6);
}

.pie-canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 100%, var(--ui-glow-gold), transparent 52%);
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  body,
  .btn::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Near-black SaaS dark theme overhaul */
:root {
  --font-display: "Poppins", "Inter", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

body:not(.theme-light) {
  --bg-main: #0d1117;
  --bg-soft: #010409;
  --surface: #161b22;
  --surface-elevated: #21262d;
  --ink-900: #f0f6fc;
  --ink-700: #c9d1d9;
  --ink-500: #8b949e;
  --green-700: #2ea043;
  --green-600: #3fb950;
  --amber-500: #d29922;
  --ring: 0 0 0 3px rgba(245, 158, 11, 0.28);
  --shadow: 0 14px 34px rgba(1, 4, 9, 0.62);
}

body:not(.theme-light) {
  background:
    radial-gradient(900px circle at 14% -18%, rgba(210, 153, 34, 0.1), transparent 48%),
    radial-gradient(900px circle at 86% -26%, rgba(56, 139, 253, 0.1), transparent 46%),
    linear-gradient(180deg, #0d1117 0%, #010409 100%);
  animation: none;
}

body:not(.theme-light)::before,
body:not(.theme-light)::after,
body:not(.theme-light) .bg-grid,
body:not(.theme-light) .bg-orb,
body:not(.theme-light) .panel::after,
body:not(.theme-light) .card::after {
  opacity: 0;
}

body:not(.theme-light) .panel,
body:not(.theme-light) .card {
  border: 1px solid #30363d;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.94));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

body:not(.theme-light) .panel::before,
body:not(.theme-light) .card::before {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
}

body:not(.theme-light) .panel:hover,
body:not(.theme-light) .card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.38);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.64),
    0 0 0 1px rgba(245, 158, 11, 0.18) inset,
    0 0 20px rgba(245, 158, 11, 0.12);
}

body:not(.theme-light) .app-shell {
  padding: 32px;
}

body:not(.theme-light) .dashboard,
body:not(.theme-light) .content-area,
body:not(.theme-light) .view,
body:not(.theme-light) .card-grid,
body:not(.theme-light) .two-col,
body:not(.theme-light) .split-layout {
  gap: 16px;
}

body:not(.theme-light) .label {
  color: #8b949e;
  letter-spacing: 0.12em;
}

body:not(.theme-light) h1,
body:not(.theme-light) h2,
body:not(.theme-light) h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: #f0f6fc;
}

body:not(.theme-light) .subtitle,
body:not(.theme-light) .hint,
body:not(.theme-light) .budget-note,
body:not(.theme-light) .view-subtitle,
body:not(.theme-light) .feedback,
body:not(.theme-light) .welcome,
body:not(.theme-light) .cell-muted {
  color: #8b949e;
}

body:not(.theme-light) .sidebar {
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.95), rgba(13, 17, 23, 0.97));
  border-color: #30363d;
}

body:not(.theme-light) .welcome {
  background: rgba(33, 38, 45, 0.58);
  border: 1px solid #30363d;
}

body:not(.theme-light) .demo-code {
  border-color: #30363d;
  background: rgba(33, 38, 45, 0.72);
  color: #f0f6fc;
}

body:not(.theme-light) .nav-btn {
  position: relative;
  border: 1px solid #30363d;
  background: rgba(22, 27, 34, 0.68);
  color: #c9d1d9;
  border-radius: 12px;
  padding: 12px 14px;
}

body:not(.theme-light) .nav-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
  opacity: 0;
  transition: opacity 0.2s ease;
}

body:not(.theme-light) .nav-btn:hover {
  border-color: #8b949e;
  color: #f0f6fc;
  background: rgba(33, 38, 45, 0.86);
}

body:not(.theme-light) .nav-btn.is-active {
  color: #f9fafb;
  border-color: rgba(245, 158, 11, 0.42);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(251, 191, 36, 0.1));
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.18);
}

body:not(.theme-light) .nav-btn.is-active::before {
  opacity: 1;
}

body:not(.theme-light) .nav-icon {
  background: rgba(48, 54, 61, 0.9);
  color: #c9d1d9;
}

body:not(.theme-light) .content-header,
body:not(.theme-light) .toolbar,
body:not(.theme-light) .undo-banner {
  border-color: #30363d;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.94), rgba(13, 17, 23, 0.94));
}

body:not(.theme-light) .inner-panel h3::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 70%);
}

body:not(.theme-light) .card-label,
body:not(.theme-light) .pie-value,
body:not(.theme-light) .recent-kind,
body:not(.theme-light) .recent-meta,
body:not(.theme-light) th {
  color: #c9d1d9;
}

body:not(.theme-light) .stat-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.1));
  color: transparent;
}

body:not(.theme-light) #overview-view .stat-card:nth-child(1) .stat-icon::before { content: "$"; }
body:not(.theme-light) #overview-view .stat-card:nth-child(2) .stat-icon::before { content: "M"; }
body:not(.theme-light) #overview-view .stat-card:nth-child(3) .stat-icon::before { content: "#"; }
body:not(.theme-light) #overview-view .stat-card:nth-child(4) .stat-icon::before { content: "*"; }
body:not(.theme-light) #admin-view .stat-card:nth-child(1) .stat-icon::before { content: "U"; }
body:not(.theme-light) #admin-view .stat-card:nth-child(2) .stat-icon::before { content: "A"; }
body:not(.theme-light) #admin-view .stat-card:nth-child(3) .stat-icon::before { content: "E"; }
body:not(.theme-light) #admin-view .stat-card:nth-child(4) .stat-icon::before { content: "S"; }

body:not(.theme-light) .stat-icon::before {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fde68a;
  letter-spacing: 0.03em;
}

body:not(.theme-light) .btn {
  border-radius: 12px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease, background-color 0.22s ease;
}

body:not(.theme-light) .btn.primary {
  color: #111827;
  border: 1px solid rgba(255, 210, 143, 0.46);
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 52%, #fcd34d 100%);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

body:not(.theme-light) .btn.secondary {
  color: #111827;
  border: 1px solid rgba(255, 213, 153, 0.4);
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

body:not(.theme-light) .btn.ghost {
  color: #c9d1d9;
  border-color: #30363d;
  background: rgba(33, 38, 45, 0.56);
}

body:not(.theme-light) .btn:hover {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.06);
}

body:not(.theme-light) :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  border: 1px solid #30363d;
  background: #0d1117;
  color: #f0f6fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body:not(.theme-light) :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
):focus {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

body:not(.theme-light) :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .filter-grid input,
  .saved-view-row input,
  .report-builder-controls input,
  .settings-grid input,
  .category-budget-form input,
  .lock-controls input
)::placeholder {
  color: #8b949e;
}

body:not(.theme-light) select option {
  background: #161b22;
  color: #f0f6fc;
}

body:not(.theme-light) .feedback.is-success,
body:not(.theme-light) .budget-status.is-good {
  color: #3fb950;
}

body:not(.theme-light) .feedback.is-error,
body:not(.theme-light) .budget-status.is-over {
  color: #f85149;
}

body:not(.theme-light) .budget-metrics p,
body:not(.theme-light) .forecast-grid p,
body:not(.theme-light) .builder-cards p,
body:not(.theme-light) .recent-item,
body:not(.theme-light) .pie-legend li,
body:not(.theme-light) .insight-pill {
  border: 1px solid #30363d;
  background: rgba(33, 38, 45, 0.56);
}

body:not(.theme-light) .table-wrap {
  border: 1px solid #30363d;
  background: rgba(13, 17, 23, 0.72);
}

body:not(.theme-light) th,
body:not(.theme-light) td {
  border-bottom: 1px solid #30363d;
}

body:not(.theme-light) th {
  background: #161b22;
  color: #c9d1d9;
}

body:not(.theme-light) tbody tr:nth-child(2n) {
  background: rgba(22, 27, 34, 0.54);
}

body:not(.theme-light) tbody tr:hover {
  background: rgba(210, 153, 34, 0.1);
}

body:not(.theme-light) .budget-progress,
body:not(.theme-light) .bar-track {
  background: #21262d;
}

body:not(.theme-light) .budget-progress-fill,
body:not(.theme-light) .bar-fill {
  position: relative;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

body:not(.theme-light) .budget-progress-fill::after,
body:not(.theme-light) .bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  right: -32%;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: sheenMove 2s linear infinite;
}

body:not(.theme-light) .pie-layout {
  align-items: flex-start;
  gap: 18px;
}

body:not(.theme-light) .pie-canvas-wrap {
  min-height: 320px;
  border-color: #30363d;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body:not(.theme-light) .pie-canvas-wrap::after {
  display: none;
}

body:not(.theme-light) #report-pie-chart {
  cursor: pointer;
  filter: none;
}

body:not(.theme-light) .pie-meta {
  gap: 12px;
}

body:not(.theme-light) .pie-legend {
  gap: 10px;
}

body:not(.theme-light) .pie-legend li {
  grid-template-columns: 12px 1fr auto;
  padding: 9px 11px;
  border-color: #30363d;
  background: rgba(22, 27, 34, 0.76);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
  cursor: pointer;
}

body:not(.theme-light) .pie-legend li::before {
  display: none;
}

body:not(.theme-light) .pie-legend li:hover,
body:not(.theme-light) .pie-legend li.is-active,
body:not(.theme-light) .pie-legend li:focus {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
  transform: translateY(-1px);
}

body:not(.theme-light) .pie-label {
  color: #f0f6fc;
  font-size: 0.86rem;
}

body:not(.theme-light) .pie-value {
  color: #8b949e;
  font-size: 0.8rem;
}

body:not(.theme-light) .pie-value strong {
  color: #f0f6fc;
  font-weight: 700;
}

body:not(.theme-light) .pie-swatch {
  box-shadow: none;
}

body:not(.theme-light) #report-pie-total {
  color: #c9d1d9;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  min-width: 156px;
  max-width: 220px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 32, 0.97);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.48);
  color: #e5e7eb;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f9fafb;
}

.chart-tooltip-meta {
  margin: 3px 0 0;
  font-size: 0.76rem;
  color: #d1d5db;
}

body.theme-light .chart-tooltip {
  border-color: rgba(44, 73, 102, 0.2);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(27, 55, 88, 0.2);
  color: #1f2937;
}

body.theme-light .chart-tooltip-title {
  color: #0f172a;
}

body.theme-light .chart-tooltip-meta {
  color: #334155;
}

@keyframes sheenMove {
  0% { right: -36%; }
  100% { right: 110%; }
}

body:not(.theme-light) .divider,
body:not(.theme-light) hr {
  border-color: rgba(255, 255, 255, 0.06);
}

@media (max-width: 1080px) {
  body:not(.theme-light) .app-shell {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  body:not(.theme-light) .app-shell {
    padding: 14px;
  }

  body:not(.theme-light) .content-header {
    gap: 12px;
  }
}

/* Premium light mode refinement: layered, airy, and high-contrast SaaS styling. */
body.theme-light {
  --bg-main: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --ink-900: #0f172a;
  --ink-700: #475569;
  --ink-500: #94a3b8;
  --ring: 0 0 0 3px rgba(59, 130, 246, 0.16);
  --light-border: rgba(0, 0, 0, 0.06);
  --light-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  --light-shadow-hover: 0 12px 25px rgba(0, 0, 0, 0.1);
  --light-accent-start: var(--green-700);
  --light-accent-end: var(--green-600);
}

body.theme-light {
  color: #0f172a;
  background:
    radial-gradient(1200px circle at -14% -30%, rgba(59, 130, 246, 0.14), transparent 46%),
    radial-gradient(900px circle at 110% -35%, rgba(99, 102, 241, 0.12), transparent 44%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  animation: none;
}

body.theme-light::before {
  opacity: 0.08;
}

body.theme-light::after,
body.theme-light .bg-orb {
  opacity: 0;
}

body.theme-light .bg-grid {
  opacity: 0.22;
  background-size: 18px 18px;
}

body.theme-light .label {
  color: #94a3b8;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light .pie-label {
  color: #0f172a;
}

body.theme-light .subtitle,
body.theme-light .hint,
body.theme-light .budget-note,
body.theme-light .view-subtitle,
body.theme-light .feedback,
body.theme-light .welcome,
body.theme-light .card-label,
body.theme-light .pie-value,
body.theme-light .recent-meta,
body.theme-light .recent-kind,
body.theme-light th {
  color: #475569;
}

body.theme-light .app-shell::before,
body.theme-light .app-shell::after {
  opacity: 0;
}

body.theme-light .panel,
body.theme-light .card {
  border: 1px solid var(--light-border);
  background: #ffffff;
  box-shadow: var(--light-shadow);
  backdrop-filter: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

body.theme-light .panel::before,
body.theme-light .panel::after,
body.theme-light .card::before,
body.theme-light .card::after {
  display: none;
}

body.theme-light .panel:hover,
body.theme-light .card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.24);
  box-shadow: var(--light-shadow-hover);
}

body.theme-light .sidebar {
  border-color: var(--light-border);
  background: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light .welcome {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.75);
}

body.theme-light .nav-btn {
  border-color: #e2e8f0;
  background: #ffffff;
  color: #334155;
  transition: all 0.2s ease;
}

body.theme-light .nav-btn::before {
  background: linear-gradient(180deg, var(--light-accent-start), var(--light-accent-end));
}

body.theme-light .nav-btn:hover {
  border-color: rgba(59, 130, 246, 0.38);
  color: #0f172a;
  background: #f8fbff;
  padding-left: 16px;
}

body.theme-light .nav-btn:hover::before {
  opacity: 0.52;
}

body.theme-light .nav-btn.is-active {
  border-color: rgba(59, 130, 246, 0.44);
  color: #0f172a;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(99, 102, 241, 0.12));
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}

body.theme-light .nav-icon {
  background: #e2e8f0;
  color: #334155;
}

body.theme-light .nav-btn.is-active .nav-icon {
  background: linear-gradient(135deg, var(--light-accent-start), var(--light-accent-end));
  color: #ffffff;
}

body.theme-light .content-header,
body.theme-light .toolbar,
body.theme-light .undo-banner,
body.theme-light .table-wrap,
body.theme-light .insight-pill,
body.theme-light .budget-metrics p,
body.theme-light .forecast-grid p,
body.theme-light .builder-cards p,
body.theme-light .recent-item,
body.theme-light .pie-legend li {
  border: 1px solid var(--light-border);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

body.theme-light .toolbar {
  background: #f8fafc;
}

body.theme-light .btn {
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

body.theme-light .btn.primary {
  color: #ffffff;
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, var(--light-accent-start), var(--light-accent-end));
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

body.theme-light .btn.secondary {
  color: #ffffff;
  border: 1px solid rgba(79, 70, 229, 0.38);
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.26);
}

body.theme-light .btn.ghost {
  color: #334155;
  border-color: #e2e8f0;
  background: #ffffff;
}

body.theme-light .btn:hover,
body.theme-light .btn:focus-visible {
  transform: translateY(-1px) scale(1.03);
  filter: brightness(1.05);
}

body.theme-light .btn:active {
  transform: scale(0.97) !important;
  filter: brightness(0.98);
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
):focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

body.theme-light .budget-progress,
body.theme-light .bar-track {
  background: #e2e8f0;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

body.theme-light .budget-progress-fill,
body.theme-light .bar-fill {
  position: relative;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--light-accent-start), var(--light-accent-end));
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

body.theme-light .budget-progress-fill::before,
body.theme-light .bar-fill::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
}

body.theme-light .budget-progress-fill::after,
body.theme-light .bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34%;
  right: -36%;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  animation: sheenMove 2s linear infinite;
}

.budget-progress-fill.shimmer-reset::after,
.bar-fill.shimmer-reset::after {
  animation: none !important;
}

body.theme-light .pie-canvas-wrap {
  border-color: var(--light-border);
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 20px rgba(0, 0, 0, 0.06);
}

body.theme-light .pie-canvas-wrap::after {
  display: none;
}

body.theme-light #report-pie-chart {
  filter: none;
}

body.theme-light .pie-legend li:hover,
body.theme-light .pie-legend li.is-active,
body.theme-light .pie-legend li:focus {
  border-color: rgba(59, 130, 246, 0.35);
  background: #eff6ff;
  transform: translateY(-1px);
}

body.theme-light .pie-value strong {
  color: #0f172a;
}

body.theme-light #report-pie-total {
  color: #475569;
}

body.theme-light .table-wrap {
  border-color: var(--light-border);
  background: #ffffff;
}

body.theme-light th,
body.theme-light td {
  border-bottom: 1px solid #e2e8f0;
}

body.theme-light th {
  background: #f8fafc;
  color: #475569;
}

body.theme-light tbody tr:nth-child(2n) {
  background: #fbfdff;
}

body.theme-light tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

body.theme-light :is(
  .panel,
  .card,
  .btn,
  .nav-btn,
  .nav-icon,
  .content-header,
  .toolbar,
  .undo-banner,
  .table-wrap,
  .insight-pill,
  .recent-item,
  .forecast-grid p,
  .budget-metrics p,
  .builder-cards p,
  .budget-progress,
  .bar-track,
  .budget-progress-fill,
  .bar-fill,
  .pie-legend li,
  .pie-canvas-wrap,
  #report-pie-chart,
  .chart-tooltip,
  .table-actions button,
  tbody tr,
  details summary
) {
  transition: all 0.2s ease;
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  transition: all 0.2s ease;
}

body.theme-light .view.view-enter {
  animation: lightViewIn 0.25s ease both;
}

body.theme-light .view.view-enter > * {
  animation: none !important;
}

@keyframes lightViewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* Root-level font scale so rem-based typography responds to settings. */
html.font-small {
  font-size: 14px;
}

html.font-medium {
  font-size: 16px;
}

html.font-large {
  font-size: 18px;
}

/* Final theme-color mappings to override late dark/light layers consistently. */
body.theme-color-emerald {
  --green-700: #1ca16c;
  --green-600: #24b278;
  --amber-500: #d19a49;
  --light-accent-start: #1ca16c;
  --light-accent-end: #24b278;
}

body.theme-color-ocean {
  --green-700: #256fb3;
  --green-600: #2e86d8;
  --amber-500: #49a3d1;
  --light-accent-start: #256fb3;
  --light-accent-end: #2e86d8;
}

body.theme-color-sunset {
  --green-700: #c96f2d;
  --green-600: #d9863f;
  --amber-500: #e0a04e;
  --light-accent-start: #c96f2d;
  --light-accent-end: #d9863f;
}

body.theme-color-rose {
  --green-700: #b34f73;
  --green-600: #c06084;
  --amber-500: #d98474;
  --light-accent-start: #b34f73;
  --light-accent-end: #c06084;
}

body.theme-color-slate {
  --green-700: #334155;
  --green-600: #475569;
  --amber-500: #0ea5e9;
  --light-accent-start: #334155;
  --light-accent-end: #475569;
}

body.theme-color-cobalt {
  --green-700: #1d4ed8;
  --green-600: #2563eb;
  --amber-500: #38bdf8;
  --light-accent-start: #1d4ed8;
  --light-accent-end: #2563eb;
}

body.theme-color-graphite {
  --green-700: #3f3f46;
  --green-600: #52525b;
  --amber-500: #a1a1aa;
  --light-accent-start: #3f3f46;
  --light-accent-end: #52525b;
}

body.theme-color-amber {
  --green-700: #92400e;
  --green-600: #b45309;
  --amber-500: #f59e0b;
  --light-accent-start: #92400e;
  --light-accent-end: #b45309;
}

/* Independent light mode design system (not a dark-mode inversion). */
body.theme-light {
  --bg-main: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-elevated: #ffffff;
  --ink-900: #0f172a;
  --ink-700: #475569;
  --ink-500: #94a3b8;
  --light-border: rgba(0, 0, 0, 0.06);
  --light-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  --light-shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.1);
  --light-accent-start: var(--green-700);
  --light-accent-end: var(--green-600);
  color: var(--ink-900);
  background:
    radial-gradient(1000px circle at -12% -22%, rgba(59, 130, 246, 0.12), transparent 44%),
    radial-gradient(780px circle at 112% -30%, rgba(99, 102, 241, 0.1), transparent 42%),
    linear-gradient(180deg, var(--bg-main) 0%, #f3f7fb 100%);
}

body.theme-light .app-shell {
  padding: 36px;
}

body.theme-light .dashboard,
body.theme-light .content-area,
body.theme-light .view,
body.theme-light .card-grid,
body.theme-light .two-col,
body.theme-light .split-layout {
  gap: 20px;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light .pie-label {
  color: #0f172a;
}

body.theme-light .subtitle,
body.theme-light .hint,
body.theme-light .budget-note,
body.theme-light .view-subtitle,
body.theme-light .feedback,
body.theme-light .welcome,
body.theme-light .card-label,
body.theme-light .pie-value,
body.theme-light .recent-meta,
body.theme-light .recent-kind,
body.theme-light th {
  color: #475569;
}

body.theme-light .label,
body.theme-light .cell-muted {
  color: #94a3b8;
}

body.theme-light .panel,
body.theme-light .card {
  border: 1px solid var(--light-border);
  background: #ffffff;
  box-shadow: var(--light-shadow);
  backdrop-filter: none;
}

body.theme-light .panel::before,
body.theme-light .panel::after,
body.theme-light .card::before,
body.theme-light .card::after,
body.theme-light .pie-canvas-wrap::after,
body.theme-light .app-shell::before,
body.theme-light .app-shell::after {
  display: none;
}

body.theme-light .panel:hover,
body.theme-light .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--light-shadow-hover);
  border-color: rgba(59, 130, 246, 0.24);
}

body.theme-light .card {
  padding: 24px;
}

body.theme-light .inner-panel {
  padding: 24px;
  gap: 16px;
}

body.theme-light .inner-panel h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

body.theme-light .inner-panel h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.14), transparent 74%);
}

body.theme-light .content-header {
  padding: 24px 26px;
  border: 1px solid var(--light-border);
  background: var(--surface-alt);
}

body.theme-light .toolbar,
body.theme-light .undo-banner {
  border: 1px solid var(--light-border);
  background: var(--surface-alt);
}

body.theme-light .sidebar {
  background: #f1f5f9;
  border: 1px solid var(--light-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.theme-light .nav-btn {
  position: relative;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #475569;
}

body.theme-light .nav-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--light-accent-start), var(--light-accent-end));
  opacity: 0;
}

body.theme-light .nav-btn:hover {
  padding-left: 16px;
  color: #0f172a;
  border-color: rgba(59, 130, 246, 0.28);
  background: #ffffff;
}

body.theme-light .nav-btn:hover::before {
  opacity: 0.55;
}

body.theme-light .nav-btn.is-active {
  color: #0f172a;
  border-color: rgba(59, 130, 246, 0.36);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(99, 102, 241, 0.11));
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.2);
}

body.theme-light .nav-btn.is-active::before {
  opacity: 0.9;
}

body.theme-light .nav-icon {
  background: #e2e8f0;
  color: #475569;
}

body.theme-light .nav-btn.is-active .nav-icon {
  background: linear-gradient(135deg, var(--light-accent-start), var(--light-accent-end));
  color: #ffffff;
}

body.theme-light .stat-icon {
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.1));
  color: #334155;
}

body.theme-light .btn.primary {
  color: #ffffff;
  border: 1px solid rgba(59, 130, 246, 0.42);
  background: linear-gradient(135deg, var(--light-accent-start), var(--light-accent-end));
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

body.theme-light .btn.secondary {
  color: #ffffff;
  border: 1px solid rgba(79, 70, 229, 0.36);
  background: linear-gradient(135deg, #4f46e5, #6366f1);
}

body.theme-light .btn.ghost {
  color: #475569;
  border-color: #e2e8f0;
  background: #ffffff;
}

body.theme-light .btn:hover,
body.theme-light .btn:focus-visible {
  transform: scale(1.03);
  filter: brightness(1.05);
}

body.theme-light .btn:active {
  transform: scale(0.97) !important;
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
) {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
}

body.theme-light :is(
  .auth-form input,
  .expense-form input,
  .expense-form textarea,
  .expense-form select,
  .budget-form input,
  .search-wrap input,
  .toolbar input,
  .toolbar select,
  .filter-grid input,
  .filter-grid select,
  .saved-view-row input,
  .saved-view-row select,
  .report-builder-controls select,
  .report-builder-controls input,
  .settings-grid input,
  .settings-grid select,
  .category-budget-form select,
  .category-budget-form input,
  .lock-controls input
):focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

body.theme-light .budget-progress,
body.theme-light .bar-track {
  background: #e2e8f0;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

body.theme-light .budget-progress-fill,
body.theme-light .bar-fill {
  position: relative;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--light-accent-start), var(--light-accent-end));
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

body.theme-light .budget-progress-fill::after,
body.theme-light .bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.62) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: lightShimmerFlow 2s linear infinite;
}

@keyframes lightShimmerFlow {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

body.theme-light .chart-tooltip {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  color: #0f172a;
}

body.theme-light .pie-canvas-wrap,
body.theme-light .table-wrap,
body.theme-light .insight-pill,
body.theme-light .budget-metrics p,
body.theme-light .forecast-grid p,
body.theme-light .builder-cards p,
body.theme-light .recent-item,
body.theme-light .pie-legend li {
  border: 1px solid var(--light-border);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

body.theme-light th,
body.theme-light td {
  border-bottom: 1px solid #e2e8f0;
}

body.theme-light th {
  background: #f8fafc;
  color: #475569;
}

body.theme-light tbody tr:nth-child(2n) {
  background: #fbfdff;
}

body.theme-light tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

body.theme-light :is(
  .panel,
  .card,
  .btn,
  .nav-btn,
  .nav-icon,
  .table-wrap,
  .budget-progress,
  .bar-track,
  .budget-progress-fill,
  .bar-fill,
  .pie-canvas-wrap,
  .pie-legend li,
  .chart-tooltip,
  tbody tr,
  .table-actions button,
  details summary
) {
  transition: all 0.2s ease;
}

@media (max-width: 1080px) {
  body.theme-light .app-shell {
    padding: 22px;
  }
}

@media (max-width: 640px) {
  body.theme-light .app-shell {
    padding: 14px;
  }
}
