﻿:root {
  --bg: linear-gradient(135deg, #090b11 0%, #0f1723 28%, #121a2a 52%, #090d16 100%);
  --bg-strong: #0b0f17;
  --bg-soft: rgba(17, 24, 39, 0.8);
  --panel: rgba(16, 22, 31, 0.9);
  --panel-strong: rgba(12, 18, 28, 0.96);
  --panel-muted: rgba(20, 28, 39, 0.92);
  --line: rgba(148, 163, 184, 0.16);
  --ink: #f8fafc;
  --ink-soft: #c4cfe0;
  --income: #38d39f;
  --income-soft: rgba(56, 211, 159, 0.12);
  --expense: #f26b6b;
  --expense-soft: rgba(242, 107, 107, 0.12);
  --action: #7b5af7;
  --action-dark: #5f44d8;
  --shadow: 0 26px 60px rgba(2, 6, 23, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  padding: 24px 20px 120px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, sans-serif;
  overflow-x: hidden;
  color-scheme: dark;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 40rem;
  height: 40rem;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  left: -7rem;
  top: -9rem;
  background: rgba(139, 92, 246, 0.42);
  animation: ambient-drift-one 24s ease-in-out infinite alternate;
}

body::after {
  right: -7rem;
  bottom: -12rem;
  background: rgba(59, 130, 246, 0.26);
  animation: ambient-drift-two 29s ease-in-out infinite alternate;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(77, 107, 255, 0.2);
  outline-offset: 2px;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(10, 15, 22, 0.96), rgba(17, 24, 39, 0.9));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.header-note {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.site-footer-note {
  margin-top: 18px;
  text-align: center;
}

.page-view[hidden] {
  display: none;
}

.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 28px 2px 18px;
}

.view-heading h2 {
  margin-top: 6px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.home-owner-label {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.eyebrow {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

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

h1 {
  margin-top: 4px;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  line-height: 1.1;
}

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

.nav-button,
.mobile-nav-button,
.primary-button,
.secondary-button,
.type-option,
.delete-button {
  min-height: 46px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-button,
.mobile-nav-button {
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.8);
  color: var(--ink);
  padding: 0 16px;
  font-weight: 600;
}

.nav-button.is-active,
.mobile-nav-button.is-active {
  background: linear-gradient(135deg, #7b5af7, #5e7af7);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(123, 90, 247, 0.28);
}

.nav-button:hover,
.mobile-nav-button:hover,
.primary-button:hover,
.secondary-button:hover,
.type-option:hover,
.delete-button:hover {
  transform: translateY(-1px);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(460px, 2fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.spending-limit {
  display: grid;
  gap: 13px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px 6px 18px 6px;
  background: var(--panel-muted);
}

.spending-limit-heading h3 {
  margin: 5px 0 0;
  font-size: 1rem;
}

.spending-limit-form {
  display: grid;
  gap: 10px;
}

.spending-limit-form .field { gap: 6px; }
.spending-limit-form .field span { color: var(--ink-soft); font-size: .82rem; font-weight: 700; }
.spending-limit-form input,
.spending-limit-form select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px 4px;
  color: var(--ink);
  background: var(--bg-strong);
}
.spending-limit-form .primary-button { width: 100%; min-height: 42px; }
.spending-limit-status { color: var(--ink-soft); font-size: .84rem; line-height: 1.5; }
.spending-limit-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(148, 163, 184, .24); }
.spending-limit-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #38d39f, #7b5af7); transition: width .2s ease; }
.spending-limit-track span.is-over-limit { background: linear-gradient(90deg, #f2a36b, #f26b6b); }

.spending-limit-panel { display: grid; gap: 20px; margin-top: 22px; overflow: hidden; background: radial-gradient(circle at 100% 0%, rgba(123, 90, 247, .16), transparent 34%), var(--panel); }
.spending-limit-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .95fr); align-items: center; gap: 28px; }
.spending-limit-heading h2 { margin: 7px 0; font-size: clamp(1.35rem, 2.2vw, 1.8rem); }
.spending-limit-heading .spending-limit-status { margin: 0; }
.spending-limit-form { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; }
.spending-limit-form .primary-button { grid-column: 1 / -1; min-height: 44px; white-space: nowrap; }
.spending-limit-form .spending-limit-reset { grid-column: 1 / -1; min-height: 40px; }
.spending-limit-form .spending-limit-reset {
  width: auto;
  justify-self: start;
  min-height: 36px;
  padding: 0 14px;
  border-color: rgba(242, 107, 107, .22);
  border-radius: 12px 5px 12px 5px;
  background: rgba(242, 107, 107, .07);
  color: var(--ink-soft);
  font-size: .8rem;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.spending-limit-form .spending-limit-reset::before { content: "↻"; margin-right: 7px; font-size: 1rem; }
.spending-limit-form .spending-limit-reset:hover {
  transform: translateY(-1px);
  border-color: rgba(242, 107, 107, .5);
  background: rgba(242, 107, 107, .13);
  color: var(--expense);
}
.spending-limit-form-note { grid-column: 1 / -1; margin: -4px 0 0; color: var(--ink-soft); font-size: .72rem; line-height: 1.4; }
.spending-limit-error { grid-column: 1 / -1; margin: 0; padding: 9px 11px; border: 1px solid rgba(242, 107, 107, .3); border-radius: 10px 4px; color: var(--expense); background: rgba(242, 107, 107, .1); font-size: .82rem; font-weight: 700; line-height: 1.4; }
.spending-limit-track { height: 12px; background: rgba(148, 163, 184, .18); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12); }
.spending-limit-track.is-over-limit { background: rgba(242, 107, 107, .18); }
.spending-limit-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.spending-limit-metric { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px 5px; background: var(--panel-muted); }
.spending-limit-metric > span { color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.spending-limit-metric strong { overflow-wrap: anywhere; color: var(--ink); font-size: clamp(1.05rem, 2vw, 1.45rem); letter-spacing: -.025em; }
.spending-limit-metric small { color: var(--ink-soft); font-size: .73rem; line-height: 1.4; }
.spending-limit-metric.is-remaining { border-color: rgba(56, 211, 159, .32); background: linear-gradient(145deg, rgba(56, 211, 159, .12), var(--panel-muted)); }
.spending-limit-metric.is-remaining strong { color: var(--income); }
.spending-limit-metric.is-spent strong { color: var(--expense); }
.spending-limit-hint { margin: -4px 0 0; color: var(--ink-soft); font-size: .82rem; }
.category-budget-panel { display: grid; gap: 20px; margin-top: 22px; overflow: hidden; background: radial-gradient(circle at 100% 0%, rgba(56, 211, 159, .11), transparent 35%), var(--panel); }
.category-budget-panel > .panel-header { margin: 0; }
.category-budget-panel > .panel-header h2 { margin: 5px 0 0; }
.category-budget-panel > .panel-header .category-budget-new { flex: 0 0 auto; width: auto; min-width: 164px; min-height: 38px; padding: 0 15px; border-radius: 12px 5px; white-space: nowrap; }
.category-budget-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.category-budget-empty { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-soft); }
.category-budget-card { display: grid; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px 6px; background: var(--panel-muted); transition: border-color .18s ease, transform .18s ease; }
.category-budget-card.is-selected { border-color: rgba(123, 90, 247, .5); }
.category-budget-card-heading, .category-budget-card-footer, .category-budget-breakdown-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.category-budget-card-heading h3 { margin: 0; font-size: 1rem; }
.category-budget-card-heading small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .76rem; }
.category-budget-card-heading > strong, .category-budget-breakdown-heading > strong { color: var(--ink); font-size: .85rem; text-align: right; }
.category-budget-card-footer { color: var(--ink-soft); font-size: .82rem; }
.category-budget-card-footer .secondary-button { width: auto; min-height: 34px; padding: 0 12px; border-radius: 10px 4px; font-size: .78rem; }
.category-budget-progress { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(148, 163, 184, .2); }
.category-budget-progress > span { display: block; height: 100%; border-radius: inherit; transition: width .25s ease; }
.category-budget-progress.is-good > span { background: linear-gradient(90deg, #38d39f, #69d7a4); }
.category-budget-progress.is-warning > span { background: linear-gradient(90deg, #f3ca62, #f2a36b); }
.category-budget-progress.is-danger > span { background: linear-gradient(90deg, #f2a36b, #f26b6b); }
.category-budget-progress.is-critical > span { background: linear-gradient(90deg, #e54269, #b91c45); }
.category-budget-form { display: grid; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px 6px; background: var(--panel-muted); }
.category-budget-form[hidden], .category-budget-detail[hidden] { display: none; }
.category-budget-form h3, .category-budget-detail h3 { margin: 4px 0 0; }
.category-budget-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-budget-fields .field { display: grid; gap: 6px; }
.category-budget-fields .field > span { color: var(--ink-soft); font-size: .82rem; font-weight: 700; }
.category-budget-fields input, .category-budget-fields select, .category-budget-editor-row input[type="number"], .category-budget-editor-row select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px 4px; color: var(--ink); background: var(--bg-strong); }
.category-budget-currency-picker { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 8px; border: 1px solid rgba(123, 90, 247, .28); border-radius: 13px 5px; background: linear-gradient(145deg, rgba(123, 90, 247, .1), var(--panel-muted)); transition: border-color .18s ease, box-shadow .18s ease; }
.category-budget-currency-picker:focus-within { border-color: rgba(123, 90, 247, .68); box-shadow: 0 0 0 3px rgba(123, 90, 247, .12); }
.category-budget-currency-symbol { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 11px 4px; color: #fff !important; background: linear-gradient(135deg, #8a67ff, #536dff); font-size: 1rem !important; font-weight: 850 !important; }
.category-budget-fields .category-budget-currency-picker select { flex: 1; width: 100%; min-width: 0; min-height: 38px; padding: 7px 30px 7px 10px; border-color: var(--line); border-radius: 10px 4px; color: var(--ink); background-color: var(--bg-strong); font-size: .85rem; font-weight: 700; }
:root[data-theme="light"] .category-budget-currency-picker { background: linear-gradient(145deg, rgba(123, 90, 247, .07), #fff); }
.category-budget-date-hint { grid-column: 1 / -1; margin: -5px 0 0; color: var(--ink-soft); font-size: .74rem; }
.budget-date-input { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.category-budget-distribution-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.category-budget-distribution-header h4 { margin: 0; }
.category-budget-distribution-header p { margin: 4px 0 0; color: var(--ink-soft); font-size: .8rem; }
.category-budget-distribution-header .secondary-button { width: auto; min-height: 38px; padding: 0 14px; border-radius: 11px 4px; font-size: .82rem; }
.category-budget-category-fields { display: grid; gap: 8px; }
.category-budget-editor-row { display: grid; grid-template-columns: 22px minmax(110px, 1fr) 90px minmax(90px, 130px) minmax(135px, auto); align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px 4px; background: var(--panel); }
.category-budget-editor-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: #7b5af7; }
.category-budget-editor-name { font-size: .86rem; font-weight: 700; }
.category-budget-editor-row input[type="number"] { min-height: 38px; padding: 7px 9px; }
.category-budget-computed { color: var(--ink-soft); font-size: .78rem; font-weight: 750; text-align: right; white-space: nowrap; }
.category-budget-allocated { margin: 0; padding: 12px 14px; border: 1px solid rgba(56, 211, 159, .24); border-radius: 12px 4px; color: var(--income); background: rgba(56, 211, 159, .08); font-size: .9rem; font-weight: 800; }
.category-budget-allocated.is-over { border-color: rgba(242, 107, 107, .35); color: var(--expense); background: rgba(242, 107, 107, .1); }
.category-budget-detail { display: grid; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px 6px; background: var(--panel-muted); }
.category-budget-date-range { margin: 5px 0 0; color: var(--ink-soft); font-size: .84rem; }
.category-budget-actions { display: flex; gap: 8px; }
.category-budget-actions button { width: auto; min-height: 36px; padding: 0 12px; border-radius: 10px 4px; font-size: .8rem; }
.category-budget-actions .danger-button { min-height: 36px; box-shadow: none; }
.category-budget-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.category-budget-summary-item { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px 5px; background: var(--panel); }
.category-budget-summary-item span, .category-budget-percent { color: var(--ink-soft); font-size: .8rem; }
.category-budget-summary-item strong { overflow-wrap: anywhere; font-size: 1.05rem; }
.category-budget-overall { display: grid; gap: 10px; }
.category-budget-insights { display: grid; gap: 12px; padding: 16px; border: 1px solid rgba(123, 90, 247, .22); border-radius: 16px 5px; background: linear-gradient(140deg, rgba(123, 90, 247, .08), var(--panel)); }
.category-budget-insights > h4 { margin: 0; font-size: .95rem; }
.category-budget-insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.category-budget-insight-card { display: grid; gap: 6px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px 4px; background: var(--panel-muted); }
.category-budget-insight-card > span { color: var(--ink-soft); font-size: .75rem; }
.category-budget-insight-card > strong { overflow-wrap: anywhere; font-size: .9rem; }
.category-budget-insight-note { margin: 0; padding: 11px 12px; border-radius: 10px 4px; color: var(--income); background: rgba(56, 211, 159, .08); font-size: .82rem; line-height: 1.5; }
.category-budget-insight-note.is-alert { color: #e7ad38; background: rgba(242, 163, 107, .1); }
.category-budget-insight-note.is-critical { color: var(--expense); background: rgba(242, 107, 107, .1); }
.category-budget-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.category-budget-breakdown-item { display: grid; gap: 9px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px 5px; background: var(--panel); }
.category-budget-breakdown-heading h4 { margin: 0; font-size: .9rem; }
.category-budget-breakdown-heading > strong { font-size: .8rem; }
.category-budget-breakdown-item > p { margin: 0; color: var(--ink-soft); font-size: .8rem; }
.category-budget-breakdown-item.is-warning > p { color: #e7ad38; }
.category-budget-breakdown-item.is-danger > p, .category-budget-breakdown-item.is-critical > p { color: var(--expense); font-weight: 800; }
.income-limit-note { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .68rem; line-height: 1.35; }
.income-limit-note[hidden] { display: none; }
.operation-limit-hint { margin: 0; padding: 10px 12px; border: 1px solid rgba(56, 211, 159, .24); border-radius: 10px 4px; color: var(--income); background: rgba(56, 211, 159, .08); font-size: .82rem; line-height: 1.45; }
.operation-limit-hint.is-blocked { border-color: rgba(242, 107, 107, .3); color: var(--expense); background: rgba(242, 107, 107, .1); }
@media (max-width: 900px) {
  .spending-limit-top { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 620px) {
  .spending-limit-panel { gap: 15px; padding: 16px; }
  .spending-limit-form { grid-template-columns: 1fr 1fr; }
  .spending-limit-form .primary-button { grid-column: 1 / -1; }
  .spending-limit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .spending-limit-metric { padding: 12px; }
}

@media (max-width: 720px) {
  .category-budget-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-budget-summary { grid-template-columns: 1fr; }
  .category-budget-summary-item { grid-template-columns: 1fr auto; align-items: center; }
  .category-budget-insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .category-budget-panel { padding: 16px; }
  .category-budget-panel > .panel-header { align-items: start; flex-direction: column; }
  .category-budget-panel > .panel-header .category-budget-new { align-self: flex-start; min-width: 0; }
  .category-budget-fields { grid-template-columns: 1fr; }
  .category-budget-fields .category-budget-currency-picker select { font-size: .8rem; }
  .category-budget-distribution-header { align-items: stretch; flex-direction: column; }
  .category-budget-distribution-header .secondary-button { width: 100%; }
  .category-budget-editor-row { grid-template-columns: 20px minmax(0, 1fr) 68px minmax(76px, 92px); gap: 6px; padding: 8px 6px; }
  .category-budget-editor-name { min-width: 0; font-size: .76rem; }
  .category-budget-editor-row select[data-budget-mode] { grid-column: 3; grid-row: 1; min-height: 36px; padding: 6px 4px; }
  .category-budget-editor-row input[data-budget-value] { grid-column: 4; grid-row: 1; min-height: 36px; padding: 6px 5px; }
  .category-budget-computed { grid-column: 2 / -1; text-align: left; white-space: normal; font-size: .72rem; }
  .category-budget-card-heading, .category-budget-breakdown-heading { align-items: start; flex-direction: column; }
  .category-budget-card-heading > strong, .category-budget-breakdown-heading > strong { text-align: left; }
  .category-budget-actions { width: 100%; }
  .category-budget-actions button { flex: 1; }
}

.operation-dialog {
  grid-column: 1 / -1;
}

@media (min-width: 981px) {
  .list-panel {
    width: 100%;
    max-width: none;
  }

  .operations-list {
    max-height: clamp(260px, calc(100vh - 500px), 720px);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-gutter: stable;
  }

  .operation-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .operation-main p,
  .operation-main h3 {
    overflow-wrap: anywhere;
  }
}

.panel {
  position: relative;
  z-index: 1;
  padding: 22px;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.operation-dialog {
  width: min(520px, calc(100% - 28px));
  max-width: none;
  max-height: min(90vh, 820px);
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.operation-dialog[open] {
  animation: dialog-enter 0.2s ease-out;
}

.operation-dialog::backdrop {
  background: rgba(35, 25, 57, 0.36);
  backdrop-filter: blur(7px);
  animation: backdrop-enter 0.2s ease-out;
}

.operation-dialog .form-panel {
  max-height: min(90vh, 820px);
  overflow-y: auto;
}

.account-switcher-dialog {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(3, 7, 14, 0.72);
  backdrop-filter: blur(7px);
}

.account-switcher-dialog[hidden] {
  display: none;
}

.delete-confirm-dialog {
  z-index: 30;
}

.delete-confirm-panel {
  width: min(420px, 100%);
  padding: 28px;
  text-align: center;
  animation: dialog-enter 0.2s ease-out;
}

.delete-confirm-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid rgba(242, 107, 107, 0.28);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(242, 107, 107, 0.2), rgba(242, 107, 107, 0.08));
  color: var(--expense);
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(242, 107, 107, 0.12);
}

.reset-confirm-icon {
  border-color: rgba(123, 90, 247, .3);
  background: linear-gradient(145deg, rgba(123, 90, 247, .22), rgba(83, 109, 255, .08));
  color: #a894ff;
  font-size: 2rem;
}

.delete-confirm-panel .eyebrow {
  margin-bottom: 8px;
  color: var(--expense);
}

.delete-confirm-panel h2 {
  margin: 0 0 9px;
  font-size: 1.4rem;
}

.delete-confirm-panel > p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.delete-operation-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.68);
  text-align: left;
}

.delete-operation-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-operation-preview span {
  flex-shrink: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.delete-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.danger-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(242, 107, 107, 0.32);
  border-radius: 12px;
  background: linear-gradient(135deg, #e85e67, #c94255);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(201, 66, 85, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 26px rgba(201, 66, 85, 0.3);
}

.account-switcher-panel {
  width: min(440px, 100%);
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 22px;
}

.account-switcher-panel .panel-header {
  align-items: center;
}

.account-switcher-current {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 8px 0 18px;
  padding: 15px;
  border: 1px solid rgba(123, 90, 247, 0.24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(123, 90, 247, 0.12), rgba(15, 23, 42, 0.74));
}

.account-switcher-current > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.account-switcher-current strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-switcher-current > div span {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.account-current-badge {
  flex-shrink: 0;
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid rgba(56, 211, 159, 0.2);
  border-radius: 99px;
  background: rgba(56, 211, 159, 0.1);
  color: var(--income);
  font-size: 0.72rem;
  font-weight: 700;
}

.dialog-close {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink-soft);
  font-size: 1.7rem;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.dialog-close:hover {
  transform: rotate(5deg);
  background: rgba(123, 90, 247, 0.1);
}

.info-panel {
  position: sticky;
  top: 16px;
}

.budget-add-button {
  display: none;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin-top: 6px;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.2;
}

.form-notice {
  margin: -4px 0 16px;
  padding: 11px 14px;
  border: 1px solid rgba(217, 101, 89, 0.22);
  border-radius: 12px;
  background: rgba(217, 101, 89, 0.1);
  color: #b7463d;
  font-size: 0.9rem;
  font-weight: 700;
}

.form-notice[hidden] {
  display: none;
}

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

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted);
}

.stat-block span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat-block strong {
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.2;
}

.stat-block.income strong {
  color: var(--income);
}

.stat-block.expense strong {
  color: var(--expense);
}

.stat-block.balance strong {
  color: var(--action);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 18px;
  border: none;
  background: linear-gradient(135deg, #7b5af7, #5f7df6);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(123, 90, 247, 0.28);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink);
  font-weight: 700;
}

.primary-button:active,
.secondary-button:active,
.type-option:active,
.delete-button:active,
.nav-button:active,
.mobile-nav-button:active {
  transform: translateY(0);
}

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

.operation-form.hidden {
  display: none;
}

.type-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  background: #0c121a;
  background-image: none;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.01), 0 10px 24px rgba(2, 6, 23, 0.22);
}

.type-option {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.type-option.is-active {
  background: linear-gradient(135deg, #7b5af7, #5f7df6);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(123, 90, 247, 0.22);
}

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

.field span,
.field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: #0d141d;
  background-image: none;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 16px rgba(15, 23, 42, 0.2);
}

.field select,
.currency-select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(203, 213, 225, 0.9) 50%),
    linear-gradient(135deg, rgba(203, 213, 225, 0.9) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--expense);
  box-shadow: 0 0 0 4px rgba(217, 94, 75, 0.08);
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: var(--expense);
  font-size: 0.76rem;
  font-weight: 600;
}

.field-hint {
  margin: -2px 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
}

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

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.compact-field {
  gap: 6px;
}

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

.operation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(12, 18, 28, 0.78);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.18);
  animation: appear 0.2s ease;
}

.operation-item.income {
  background: rgba(56, 211, 159, 0.08);
  border-color: rgba(56, 211, 159, 0.15);
}

.operation-item.expense {
  background: rgba(242, 107, 107, 0.08);
  border-color: rgba(242, 107, 107, 0.15);
}

.operation-main {
  min-width: 0;
}

.operation-main h3 {
  font-size: 1.05rem;
  line-height: 1.3;
  word-break: break-word;
}

.operation-main p {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.operation-date {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
}

.amount-box {
  text-align: right;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.operation-item.income .amount-box {
  color: var(--income);
}

.operation-item.expense .amount-box {
  color: var(--expense);
}

.delete-button {
  padding: 0 10px;
  border: 1px solid rgba(217, 94, 75, 0.22);
  background: transparent;
  color: var(--expense);
  font-weight: 700;
}

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

.operation-edit-button,
.operation-actions .delete-button {
  min-height: 38px;
  padding: 0 11px;
  white-space: nowrap;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.75);
}

.empty-state[hidden] {
  display: none;
}

.empty-inner {
  max-width: 300px;
  text-align: center;
}

.empty-inner h3 {
  margin-bottom: 12px;
  font-size: 1.6rem;
}

.empty-inner p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.operations-add-action {
  margin-top: 16px;
}

@media (min-width: 981px) {
  .list-panel {
    display: flex;
    flex-direction: column;
  }

  .list-panel .operations-list {
    flex: 1 1 auto;
  }

  .operations-add-action {
    align-self: stretch;
  }
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

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

.analytics-card > span {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.analytics-card strong {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.analytics-card.income strong {
  color: var(--income);
}

.analytics-card.expense strong {
  color: var(--expense);
}

.analytics-card.balance strong {
  color: var(--action);
}

.analytics-panel,
.categories-panel,
.settings-panel {
  margin-bottom: 18px;
}

.category-breakdown {
  display: grid;
  gap: 16px;
}

.category-row {
  display: grid;
  gap: 9px;
}

.category-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
}

.category-row-heading strong {
  white-space: nowrap;
}

.category-track {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(123, 90, 247, 0.12);
}

.category-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a67ff, #6b7cff);
}

.analytics-note {
  color: var(--ink-soft);
  line-height: 1.6;
}

.analytics-operation-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(123, 90, 247, 0.18);
  border-radius: 14px;
  background: rgba(123, 90, 247, 0.08);
  color: var(--ink-soft);
  font-weight: 600;
}

.analytics-operation-total strong {
  color: var(--ink);
  font-size: 1.25rem;
}

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

.category-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 17px;
  background: #111b27;
  background-image: none;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.16);
}

.category-card h3 {
  font-size: 1rem;
}

.category-card p {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.category-card > strong {
  text-align: right;
  white-space: nowrap;
}

.category-card.income > strong {
  color: var(--income);
}

.category-card.expense > strong {
  color: var(--expense);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(21, 30, 43, 0.84), rgba(13, 19, 29, 0.88));
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.setting-row:hover {
  border-color: rgba(148, 163, 184, 0.2);
  background: linear-gradient(135deg, rgba(24, 34, 49, 0.94), rgba(15, 22, 33, 0.94));
}

.settings-panel .panel-header {
  margin-bottom: 20px;
}

.settings-group + .settings-group {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.settings-group-title {
  margin: 0 0 12px 2px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-group .setting-row:first-of-type {
  margin-top: 0;
}

.currency-select-wrap {
  display: flex;
  align-items: center;
}

.currency-select-wrap select,
.field select,
.compact-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-width: 170px;
  min-height: 44px;
  padding: 10px 42px 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(45deg, transparent 50%, rgba(203, 213, 225, 0.9) 50%) calc(100% - 18px) calc(50% - 2px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(203, 213, 225, 0.9) 50%, transparent 50%) calc(100% - 12px) calc(50% - 2px) / 6px 6px no-repeat,
    #0d141d;
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 18px rgba(15, 23, 42, 0.14);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.currency-select-wrap select {
  min-width: 180px;
}

.field select,
.compact-field select {
  width: 100%;
}

.currency-select-wrap select:hover,
.field select:hover,
.compact-field select:hover,
.currency-select-wrap select:focus,
.field select:focus,
.compact-field select:focus {
  border-color: rgba(123, 90, 247, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 0 0 3px rgba(123, 90, 247, 0.1);
}

.currency-picker {
  display: grid;
  flex: 0 1 500px;
  gap: 12px;
  min-width: min(100%, 300px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px 6px 18px 6px;
  background: linear-gradient(145deg, rgba(123, 90, 247, .10), var(--panel-muted));
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
}
.currency-current { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 12px; border: 1px solid rgba(123, 90, 247, .28); border-radius: 13px 5px; background: var(--panel); }
.currency-current-symbol { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px 4px; color: #fff; background: linear-gradient(135deg, #8a67ff, #536dff); font-size: 1.15rem; font-weight: 850; }
.currency-current-details, .currency-choice-details { display: grid; gap: 3px; min-width: 0; }
.currency-current-details strong { color: var(--ink); font-size: .92rem; }
.currency-current-details small, .currency-choice-details small { color: var(--ink-soft); font-size: .75rem; }
.currency-search { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px 4px; outline: none; color: var(--ink); background: var(--panel); font: inherit; }
.currency-search:focus { border-color: #8a67ff; box-shadow: 0 0 0 3px rgba(123, 90, 247, .15); }
.currency-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 278px; overflow-y: auto; padding: 2px 4px 2px 2px; scrollbar-gutter: stable; }
.currency-choice { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 54px; padding: 8px; border: 1px solid var(--line); border-radius: 12px 4px; color: var(--ink); text-align: left; background: var(--panel); transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.currency-choice:hover { transform: translateY(-1px); border-color: rgba(138, 103, 255, .65); }
.currency-choice[aria-pressed="true"] { border-color: #8a67ff; background: rgba(123, 90, 247, .18); box-shadow: inset 0 0 0 1px rgba(138, 103, 255, .24); }
.currency-choice-symbol { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px 3px; color: var(--action); background: rgba(123, 90, 247, .13); font-size: .92rem; font-weight: 850; }
.currency-choice-details strong { font-size: .78rem; letter-spacing: .04em; }
.currency-choice-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; }
.currency-choice-details .currency-choice-rate { color: var(--action); font-size: .68rem; font-weight: 750; }
.currency-rate-note { display: inline-flex; align-items: center; width: fit-content; margin: 0; padding: 6px 9px; border: 1px solid rgba(123, 90, 247, .2); border-radius: 999px; color: var(--action); background: rgba(123, 90, 247, .08); font-size: .72rem; font-weight: 800; letter-spacing: .01em; }
:root[data-theme="light"] .currency-search,
:root[data-theme="light"] .currency-current,
:root[data-theme="light"] .currency-choice { background-color: #fff; }
@media (max-width: 620px) {
  .currency-picker { width: 100%; min-width: 0; padding: 11px; }
  .currency-choices { max-height: 230px; }
}

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: var(--bg);
}

.auth-screen[hidden] {
  display: none;
}

.auth-screen.add-account-mode .auth-tabs {
  display: none;
}

.auth-screen.is-exiting {
  animation: auth-exit 0.22s ease-in forwards;
  pointer-events: none;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: var(--shadow);
}

#appShell.is-entering {
  animation: app-enter 0.65s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.auth-header {
  text-align: center;
  margin-bottom: 22px;
}

.auth-header h2 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

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

.auth-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.auth-tab.is-active {
  background: linear-gradient(135deg, #7b5af7, #5f7df6);
  color: #fff;
  box-shadow: 0 10px 18px rgba(123, 90, 247, 0.24);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: #0d141d;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 16px rgba(15, 23, 42, 0.2);
}

.auth-field input:focus {
  border-color: rgba(123, 90, 247, 0.42);
  box-shadow: 0 0 0 3px rgba(123, 90, 247, 0.12);
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 82px;
}

.password-input-wrap input::-ms-reveal,
.password-input-wrap input::-ms-clear {
  display: none;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  min-height: 34px;
  padding: 0 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.password-visibility-toggle:hover {
  color: var(--ink);
}

.auth-field-name,
.auth-field-confirm {
  display: none;
}

.auth-screen.register .auth-field-name,
.auth-screen.register .auth-field-confirm {
  display: grid;
}

.auth-screen.login .auth-field-name,
.auth-screen.login .auth-field-confirm {
  display: none;
}

.auth-error {
  min-height: 18px;
  margin: 0;
  color: var(--expense);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-submit {
  margin-top: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.setting-row:first-of-type {
  margin-top: 0;
}

.setting-row h3 {
  font-size: 0.96rem;
  letter-spacing: 0.01em;
}

.setting-row p {
  max-width: 600px;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.setting-row > strong {
  display: grid;
  min-width: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(123, 90, 247, 0.2);
  border-radius: 13px;
  background: rgba(123, 90, 247, 0.1);
  color: #c4b5fd;
  font-size: 1rem;
}

#currentAccountDetails {
  color: var(--ink);
  font-weight: 600;
}

.setting-badge {
  flex-shrink: 0;
  padding: 9px 13px;
  border-radius: 99px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--income);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, 0.22);
}

.danger-button {
  min-height: 42px;
  flex-shrink: 0;
  padding: 0 16px;
  border: 1px solid rgba(217, 101, 89, 0.25);
  border-radius: 12px;
  background: var(--expense-soft);
  color: var(--expense);
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.account-action-button {
  width: auto;
  min-width: 120px;
  min-height: 42px;
  flex-shrink: 0;
  padding: 0 16px;
  border-color: rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.72);
  box-shadow: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.account-action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 90, 247, 0.42);
  background: rgba(123, 90, 247, 0.12);
}

.setting-danger {
  border-color: rgba(242, 107, 107, 0.16);
  background: linear-gradient(135deg, rgba(46, 25, 32, 0.48), rgba(18, 20, 29, 0.9));
}

.setting-danger:hover {
  border-color: rgba(242, 107, 107, 0.28);
  background: linear-gradient(135deg, rgba(55, 27, 35, 0.62), rgba(20, 21, 30, 0.96));
}

.danger-button:hover {
  transform: translateY(-1px);
  border-color: rgba(242, 107, 107, 0.42);
  background: rgba(217, 101, 89, 0.18);
}

.mobile-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(680px, calc(100% - 32px));
  padding: 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 16px 42px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(22px);
  transform: translateX(-50%);
}

.mobile-nav-button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 64px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

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

.mobile-nav-button.is-active {
  background: linear-gradient(135deg, #7b5af7, #5e7af7);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(123, 90, 247, 0.25);
}

.mobile-nav-button:hover {
  transform: translateY(-1px);
}

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

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

@keyframes auth-exit {
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes app-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen.is-exiting,
  #appShell.is-entering {
    animation-duration: 1ms;
  }
}

@keyframes ambient-drift-one {
  0% {
    transform: translate3d(0, 0, 0) scale(0.92);
  }

  50% {
    transform: translate3d(10vw, 8vh, 0) scale(1.12);
  }

  100% {
    transform: translate3d(3vw, 17vh, 0) scale(1.02);
  }
}

@keyframes ambient-drift-two {
  0% {
    transform: translate3d(0, 0, 0) scale(1.04);
  }

  50% {
    transform: translate3d(-11vw, -7vh, 0) scale(0.9);
  }

  100% {
    transform: translate3d(-4vw, -15vh, 0) scale(1.12);
  }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

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

@keyframes backdrop-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 980px) {
  body {
    padding: 16px 16px 96px;
  }

  .topbar {
    padding: 14px 16px;
  }

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

  .info-panel {
    position: static;
  }

  .analytics-summary {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 520px) {
  body {
    padding-bottom: 112px;
  }

  .header-note {
    display: none;
  }

  .mobile-nav {
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    gap: 4px;
    padding: 7px;
    border-radius: 18px;
  }

  .mobile-nav-button {
    min-height: 58px;
    font-size: 0.69rem;
  }

  .mobile-nav-button svg {
    width: 19px;
    height: 19px;
  }

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

  .operation-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
    margin: auto;
  }

  .operation-dialog .form-panel {
    max-height: calc(100dvh - 20px);
    padding: 18px;
    border-radius: 20px;
  }

  .all-categories {
    grid-template-columns: 1fr;
  }

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

  .setting-row > div,
  .currency-select-wrap,
  .currency-select-wrap select,
  .account-action-button,
  .danger-button {
    width: 100%;
  }

  .setting-row > strong,
  .setting-badge {
    align-self: flex-start;
  }

  .operation-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .delete-button {
    justify-self: end;
  }

  .operation-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .amount-box {
    grid-column: 2;
    justify-self: end;
  }
}

/* Settings controls and theme switch */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: linear-gradient(135deg, #f8f7ff 0%, #edf2ff 50%, #f8fbff 100%);
  --bg-strong: #ffffff;
  --bg-soft: rgba(255, 255, 255, 0.84);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-muted: #f4f3fb;
  --line: rgba(90, 74, 145, 0.16);
  --ink: #20213a;
  --ink-soft: #62647d;
  --shadow: 0 22px 50px rgba(55, 54, 98, 0.15);
}

:root[data-theme="light"] body { color-scheme: light; }
:root[data-theme="light"] .setting-row,
:root[data-theme="light"] .setting-row:hover {
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(243,241,255,.92));
  border-color: rgba(104, 85, 180, .18);
}
:root[data-theme="light"] .currency-select-wrap select,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .compact-field select { background-color: #fff; }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.88); }

.theme-toggle,
.account-action-button,
.settings-panel .danger-button {
  position: relative;
  min-height: 46px;
  padding: 10px 20px;
  border: 0;
  border-radius: 16px 6px 16px 6px;
  color: #fff;
  font-weight: 800;
  letter-spacing: .01em;
  background: linear-gradient(120deg, #8a67ff, #536dff);
  box-shadow: 0 8px 0 rgba(47, 37, 116, .28), 0 14px 24px rgba(96, 79, 214, .24);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.theme-toggle { display: inline-flex; align-items: center; gap: 9px; min-width: 132px; justify-content: center; }
.theme-toggle-icon { font-size: 1.2rem; }
.account-action-button:hover, .theme-toggle:hover, .settings-panel .danger-button:hover { transform: translateY(-2px) rotate(-1deg); filter: brightness(1.08); }
.account-action-button:active, .theme-toggle:active, .settings-panel .danger-button:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(47, 37, 116, .28); }
.settings-panel .danger-button { background: linear-gradient(120deg, #ff7474, #e54269); box-shadow: 0 8px 0 rgba(131, 34, 60, .24); }
@media (max-width: 620px) {
  .theme-toggle, .account-action-button, .settings-panel .danger-button { align-self: flex-start; }
}

.saved-accounts-section { margin: 22px 0 18px; }
.saved-accounts-section h3 { margin: 0 0 10px; font-size: .9rem; color: var(--ink-soft); }
.saved-accounts-list { display: grid; gap: 9px; max-height: 240px; overflow-y: auto; }
.saved-account-button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; color: var(--ink); text-align: left; border: 1px solid var(--line); border-radius: 14px 5px 14px 5px; background: var(--panel-muted); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.saved-account-button:hover { transform: translateX(4px); border-color: var(--action); background: var(--bg-soft); }
.saved-account-details { display: grid; gap: 3px; min-width: 0; }
.saved-account-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-account-details small, .saved-accounts-empty { color: var(--ink-soft); }
.saved-account-arrow { margin-left: auto; color: var(--action); font-size: 1.15rem; }
.saved-accounts-empty { margin: 0 0 12px; font-size: .88rem; line-height: 1.5; }

:root[data-layout="desktop"] .page-shell { max-width: 1440px; }
:root[data-layout="mobile"] .page-shell { max-width: 760px; }
.page-shell { transition: max-width .3s ease; }
.layout-mode-picker { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 16px 6px; background: var(--panel-muted); }
.layout-mode-button { min-height: 40px; padding: 8px 14px; border: 0; border-radius: 12px 4px; color: var(--ink-soft); background: transparent; font-size: .88rem; font-weight: 750; transition: color .18s ease, background .18s ease, transform .18s ease; }
.layout-mode-button[aria-pressed="true"] { color: #fff; background: linear-gradient(120deg, #8a67ff, #536dff); box-shadow: 0 5px 12px rgba(96,79,214,.24); }
.layout-mode-button:hover { transform: translateY(-1px); }
@media (max-width: 620px) {
  .layout-mode-picker { align-self: flex-start; }
  .layout-mode-button { padding-inline: 12px; }
}

/* Light theme refresh. All changes below apply only while the light theme is active. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: linear-gradient(145deg, #f5f3ff 0%, #f6f8ff 48%, #eff8f5 100%);
  --bg-strong: #ffffff;
  --bg-soft: #f4f3fb;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-muted: #f7f6fc;
  --line: rgba(78, 68, 120, .13);
  --ink: #28243b;
  --ink-soft: #716d82;
  --income: #168365;
  --income-soft: rgba(22, 131, 101, .1);
  --expense: #c94e61;
  --expense-soft: rgba(201, 78, 97, .1);
  --action: #6b50d8;
  --action-dark: #523bb8;
  --shadow: 0 18px 44px rgba(47, 42, 89, .1);
}

:root[data-theme="light"] body { color-scheme: light; }
:root[data-theme="light"] body::before { background: rgba(139, 112, 239, .17); }
:root[data-theme="light"] body::after { background: rgba(87, 174, 157, .12); }
:root[data-theme="light"] .topbar {
  border-color: rgba(78, 68, 120, .12);
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(249,248,255,.94));
  box-shadow: 0 12px 34px rgba(47, 42, 89, .09);
}
:root[data-theme="light"] .panel {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(47, 42, 89, .08);
}
:root[data-theme="light"] .nav-button,
:root[data-theme="light"] .mobile-nav-button:not(.is-active) {
  border-color: rgba(78, 68, 120, .12);
  background: rgba(255,255,255,.78);
  color: var(--ink-soft);
}
:root[data-theme="light"] .nav-button.is-active,
:root[data-theme="light"] .mobile-nav-button.is-active,
:root[data-theme="light"] .type-option.is-active,
:root[data-theme="light"] .auth-tab.is-active {
  background: linear-gradient(135deg, #755ce2, #6382e9);
  box-shadow: 0 8px 18px rgba(103, 82, 204, .2);
}
:root[data-theme="light"] .mobile-nav {
  border-color: rgba(78, 68, 120, .14);
  background: rgba(255,255,255,.9);
  box-shadow: 0 12px 34px rgba(47, 42, 89, .16);
}
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .auth-field input,
:root[data-theme="light"] .spending-limit-form input,
:root[data-theme="light"] .spending-limit-form select,
:root[data-theme="light"] .category-budget-fields input,
:root[data-theme="light"] .category-budget-fields select,
:root[data-theme="light"] .category-budget-editor-row input[type="number"] {
  border-color: rgba(78, 68, 120, .16);
  background-color: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(47, 42, 89, .035);
}
:root[data-theme="light"] .field select,
:root[data-theme="light"] .currency-select-wrap select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(83, 73, 126, .8) 50%),
    linear-gradient(135deg, rgba(83, 73, 126, .8) 50%, transparent 50%);
}
:root[data-theme="light"] .type-switch,
:root[data-theme="light"] .auth-tabs {
  border-color: rgba(78, 68, 120, .12);
  background: #f0eef8;
  box-shadow: inset 0 1px 2px rgba(47, 42, 89, .04);
}
:root[data-theme="light"] .type-option:not(.is-active),
:root[data-theme="light"] .auth-tab:not(.is-active) { color: var(--ink-soft); }
:root[data-theme="light"] .operation-item {
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 6px 18px rgba(47, 42, 89, .055);
}
:root[data-theme="light"] .operation-item.income {
  border-color: rgba(22, 131, 101, .16);
  background: linear-gradient(110deg, rgba(22, 131, 101, .07), #fff 72%);
}
:root[data-theme="light"] .operation-item.expense {
  border-color: rgba(201, 78, 97, .15);
  background: linear-gradient(110deg, rgba(201, 78, 97, .055), #fff 72%);
}
:root[data-theme="light"] .operation-actions .operation-edit-button {
  border-color: rgba(107, 80, 216, .2);
  background: #f1effb;
  color: #523bb8;
}
:root[data-theme="light"] .operation-actions .operation-edit-button:hover {
  border-color: rgba(107, 80, 216, .34);
  background: #e8e3fb;
}
:root[data-theme="light"] .operation-actions .delete-button {
  border-color: rgba(201, 78, 97, .24);
  background: #fff5f6;
  color: #b33f52;
}
:root[data-theme="light"] .operation-actions .delete-button:hover {
  background: #ffe9ec;
}
:root[data-theme="light"] .empty-state { border-color: rgba(78, 68, 120, .18); background: #f8f7fc; }
:root[data-theme="light"] .category-card {
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 8px 22px rgba(47, 42, 89, .06);
}
:root[data-theme="light"] .account-switcher-current {
  border-color: rgba(107, 80, 216, .18);
  background: linear-gradient(135deg, #f0edff, #f8faff);
}
:root[data-theme="light"] .dialog-close,
:root[data-theme="light"] .delete-operation-preview {
  border-color: var(--line);
  background: #f6f5fb;
  color: var(--ink-soft);
}
:root[data-theme="light"] .auth-card { border-color: var(--line); background: rgba(255,255,255,.96); }
:root[data-theme="light"] .account-action-button { border-color: var(--line); background: #f1eff9; color: var(--ink); box-shadow: none; }
:root[data-theme="light"] .account-action-button:hover { background: #e9e5fb; }
:root[data-theme="light"] .setting-danger { border-color: rgba(201, 78, 97, .16); background: linear-gradient(135deg, #fff5f6, #fff); }
:root[data-theme="light"] .setting-row > strong { border-color: rgba(107, 80, 216, .16); background: rgba(107, 80, 216, .09); color: #654dcc; }
:root[data-theme="light"] .category-budget-panel,
:root[data-theme="light"] .spending-limit-panel {
  background: radial-gradient(circle at 100% 0%, rgba(107, 80, 216, .07), transparent 34%), var(--panel);
}
:root[data-theme="light"] .spending-limit-metric.is-remaining { border-color: rgba(22, 131, 101, .2); }
:root[data-theme="light"] .category-budget-insights { border-color: rgba(107, 80, 216, .14); background: linear-gradient(140deg, #f4f1ff, #fff 78%); }
:root[data-theme="light"] .category-budget-insight-note.is-alert { color: #9a6214; background: #fff5df; }
:root[data-theme="light"] .category-budget-insight-note.is-critical { color: #b33f52; background: #fff0f2; }
:root[data-theme="light"] .currency-current,
:root[data-theme="light"] .currency-choice,
:root[data-theme="light"] .currency-search { border-color: var(--line); background: #fff; }
:root[data-theme="light"] .currency-choice[aria-pressed="true"] { border-color: #765dde; background: #f1edff; }
:root[data-theme="light"] .category-budget-currency-picker { background: linear-gradient(145deg, #f3f0ff, #fff); }
:root[data-theme="light"] .secondary-button {
  border-color: rgba(78, 68, 120, .18);
  background: #f1eff9;
  color: var(--ink);
}
:root[data-theme="light"] .secondary-button:hover {
  border-color: rgba(107, 80, 216, .32);
  background: #e9e5f7;
}
:root[data-theme="light"] #cancelResetSpendingLimitBtn {
  border-color: rgba(78, 68, 120, .18);
  background: #f1eff9;
  color: var(--ink);
}
:root[data-theme="light"] #cancelResetSpendingLimitBtn:hover { background: #e9e5f7; }
:root[data-theme="light"] .dialog-close {
  border-color: var(--line);
  background: #f1eff9;
  color: var(--ink-soft);
}
:root[data-theme="light"] .dialog-close:hover { background: #e9e5f7; }
:root[data-theme="light"] .type-switch {
  border-color: rgba(78, 68, 120, .14);
  background: #f0eef8;
  box-shadow: inset 0 1px 2px rgba(47, 42, 89, .05);
}
:root[data-theme="light"] .category-budget-editor-row select {
  border-color: rgba(78, 68, 120, .16);
  background-color: #fff;
  color: var(--ink);
}

.notification-stack {
  position: fixed;
  z-index: 2000;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  gap: 9px;
  width: min(480px, calc(100% - 28px));
  pointer-events: none;
  transform: translateX(-50%);
}
.notification-toast {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid rgba(242, 107, 107, .28);
  border-radius: 15px 5px;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: 0 14px 38px rgba(12, 18, 36, .24);
  pointer-events: auto;
  animation: notification-enter .24s cubic-bezier(.2,.75,.25,1) both;
}
.notification-toast.is-leaving { animation: notification-leave .2s ease-in both; }
.notification-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px 4px; color: #fff; background: linear-gradient(135deg, #e85e67, #c94255); font-weight: 900; }
.notification-content { display: grid; gap: 2px; min-width: 0; }
.notification-content strong { color: var(--expense); font-size: .77rem; }
.notification-content span { color: var(--ink); font-size: .84rem; line-height: 1.4; overflow-wrap: anywhere; }
.notification-close { width: 28px; height: 28px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 1.3rem; line-height: 1; }
.notification-close:hover { color: var(--ink); background: var(--bg-soft); }
.field-error, .form-notice, .spending-limit-error, .auth-error { display: none !important; }
.operation-notification { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid rgba(242, 107, 107, .32); border-radius: 16px 5px; color: var(--ink); background: linear-gradient(125deg, rgba(242, 107, 107, .12), var(--panel-muted)); box-shadow: 0 8px 22px rgba(12, 18, 36, .12); }
.operation-notification[hidden] { display: none; }
.operation-notification.is-visible { animation: operation-notification-enter .24s cubic-bezier(.2,.75,.25,1) both; }
.operation-notification-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(242, 107, 107, .3); border-radius: 11px 4px; color: #fff; background: linear-gradient(135deg, #e85e67, #c94255); font-weight: 900; box-shadow: 0 5px 12px rgba(201, 66, 85, .2); }
.operation-notification-content { display: grid; gap: 4px; min-width: 0; }
.operation-notification-content > strong { color: var(--expense); font-size: .78rem; letter-spacing: .02em; }
.operation-notification-messages { display: grid; gap: 3px; }
.operation-notification-message { margin: 0; color: var(--ink); font-size: .8rem; line-height: 1.4; overflow-wrap: anywhere; }
.operation-notification-message::before { content: "• "; color: var(--expense); font-weight: 900; }
.operation-notification-ok { min-height: 34px; padding: 0 13px; border: 0; border-radius: 10px 4px; color: #fff; background: linear-gradient(135deg, #795ce0, #5874df); font-size: .78rem; font-weight: 800; box-shadow: 0 5px 12px rgba(96, 79, 214, .2); transition: transform .18s ease, filter .18s ease; }
.operation-notification-ok:hover { transform: translateY(-1px); filter: brightness(1.08); }
@keyframes operation-notification-enter { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes notification-enter { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes notification-leave { to { opacity: 0; transform: translateY(-8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .notification-toast { animation-duration: .01ms; } }
