:root {
  --page: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #eef3ec;
  --ink: #1d2520;
  --muted: #647067;
  --line: #d8dfd7;
  --accent: #0f766e;
  --accent-soft: #d9f3ee;
  --income: #1f7a4d;
  --income-soft: #dcf4e7;
  --expense: #a94d18;
  --expense-soft: #f8e7d8;
  --danger: #b42318;
  --danger-soft: #fde7e5;
  --shadow: 0 10px 22px rgba(29, 37, 32, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.05) 0%, rgba(255, 255, 255, 0) 260px),
    var(--page);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

body.density-compact .surface,
body.density-compact .metric-card,
body.density-compact .list-card,
body.density-compact .empty-state,
body.density-compact .breakdown-row {
  padding: 10px;
}

body.density-compact .form-grid,
body.density-compact .list-stack,
body.density-compact .settings-grid {
  gap: 9px;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: #111a18;
  color: var(--ink);
}

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

button,
a.button {
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

.button:hover {
  filter: brightness(0.96);
}

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

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f6b8b2;
}

.button.income-action {
  background: var(--income);
}

label {
  display: grid;
  gap: 7px;
}

label span,
.overline {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field-hint {
  display: block;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.field-hint[data-status="ok"] {
  color: var(--income);
}

.field-hint[data-status="warning"] {
  color: var(--expense);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.app-shell {
  width: min(1360px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  min-height: 64px;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(15, 118, 110, 0.18);
}

.topbar h1,
.page h2,
.surface h3,
.auth-panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 1.35rem;
  line-height: 1.1;
}

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

.month-control {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  gap: 8px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  max-width: 100%;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pill.ok {
  background: var(--income-soft);
  border-color: #a6d8bd;
  color: var(--income);
}

.status-pill.warning {
  background: #fff4e6;
  border-color: #efc08b;
  color: #9a4d0f;
}

.status-pill.danger {
  background: #fff0ef;
  border-color: #efaaa4;
  color: var(--danger);
}

.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.flash.success {
  color: var(--accent);
  border-color: #9ad8ce;
}

.flash.error {
  color: var(--danger);
  border-color: #f1aaa2;
}

.auth-view {
  display: grid;
  place-items: start center;
  padding-top: 34px;
}

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

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

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

.sidebar {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.sidebar-title {
  padding: 8px 10px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-menu {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nav-item {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-submenu {
  display: none;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: -2px 0 6px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--accent-soft);
}

.nav-item.active + .nav-submenu,
.nav-submenu:has(.active) {
  display: grid;
}

.nav-subitem {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 750;
}

.nav-subitem.active,
.nav-subitem:hover {
  background: var(--surface-soft);
  color: var(--accent);
}

.outflow-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.sub-sidebar {
  display: none;
}

.sub-nav,
.outflow-content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.sub-nav-item {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 9px 11px;
  cursor: pointer;
  font-weight: 800;
}

.sub-nav-item.active,
.sub-nav-item:hover {
  border-color: #9ad8ce;
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  min-width: 0;
  overflow: hidden;
}

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 14px;
}

.page-head,
.section-head,
.list-card-head,
.list-card-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.page-head {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
}

.surface,
.metric-card,
.list-card,
.empty-state,
.breakdown-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.surface {
  padding: 18px;
  min-width: 0;
}

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

.metric-card {
  min-height: 108px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  min-width: 0;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 1.55rem;
  line-height: 1.1;
}

.account-highlight {
  background: var(--accent-soft);
}

.personal-highlight {
  border-color: rgba(176, 83, 18, 0.34);
  background:
    linear-gradient(135deg, rgba(176, 83, 18, 0.12), transparent 70%),
    #fff8ed;
}

.external-expense-row {
  border-color: rgba(176, 83, 18, 0.28);
  background: #fffaf2;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

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

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

.mini-balance {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.mini-balance.active {
  border-color: #9ad8ce;
  background: var(--accent-soft);
}

.mini-balance span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.mini-balance strong {
  font-size: 1.35rem;
}

.context-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.account-event-list {
  margin-top: 14px;
}

.budget-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece5;
  margin: 12px 0 4px;
}

.budget-bar span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #b45a18);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.calendar-day {
  display: grid;
  gap: 10px;
  min-height: 180px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.calendar-day.has-events {
  border-color: rgba(0, 119, 108, 0.28);
  box-shadow: 0 12px 28px rgba(26, 66, 54, 0.08);
}

.calendar-day-head,
.calendar-event {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.calendar-day-head strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.calendar-weekday,
.calendar-balance,
.calendar-event span {
  color: var(--muted);
  font-size: 0.85rem;
}

.calendar-day-totals {
  font-weight: 800;
}

.calendar-day-totals .positive {
  color: var(--accent);
}

.calendar-day-totals .negative {
  color: var(--danger);
}

.calendar-events {
  display: grid;
  gap: 8px;
}

.calendar-event {
  padding: 9px;
  border-radius: 14px;
  background: var(--soft);
}

.calendar-event.income {
  background: rgba(212, 245, 232, 0.9);
}

.calendar-event.expense {
  background: rgba(255, 244, 230, 0.9);
}

.calendar-event.scheduled {
  border: 1px dashed rgba(176, 83, 18, 0.42);
}

.calendar-event strong,
.calendar-event span {
  display: block;
}

.calendar-event b {
  white-space: nowrap;
}

.settings-grid {
  display: grid;
  gap: 10px;
}

.setting-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
  min-width: 0;
}

.setting-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.setting-card a,
.setting-card strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.setting-card small,
.setting-card em {
  color: var(--muted);
  font-size: 0.9rem;
}

.setting-card em {
  font-style: normal;
  font-weight: 750;
  color: var(--accent);
}

.user-setting-card {
  position: relative;
}

.salary-setting-card {
  grid-template-columns: minmax(140px, 0.8fr) repeat(3, minmax(150px, 1fr)) minmax(220px, 1fr);
  align-items: end;
}

.salary-estimate {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.salary-estimate strong {
  color: var(--income);
}

.salary-confirm-card .form-grid {
  margin-top: 12px;
}

.appearance-preview {
  align-self: stretch;
  display: grid;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 70%),
    var(--surface-soft);
  padding: 14px;
}

.appearance-preview span,
.appearance-preview small {
  color: var(--muted);
}

.appearance-preview strong {
  font-size: 1.35rem;
}

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

.form-actions,
.list-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.chips,
.chip-group,
.list-stack {
  display: grid;
  gap: 10px;
}

.compact-list .list-card {
  padding: 12px;
}

.alert-surface {
  border-color: rgba(176, 83, 18, 0.18);
}

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

.alert-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.alert-card.warning {
  border-color: #efc08b;
  background: #fff7ed;
}

.alert-card.success {
  border-color: #9fd5b6;
  background: var(--income-soft);
}

.alert-card.danger {
  border-color: #efaaa4;
  background: #fff0ef;
}

.alert-card span {
  color: var(--muted);
}

.duplicate-card {
  border-color: #efc08b;
}

.duplicate-hint {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #efc08b;
  border-radius: 16px;
  background: #fff7ed;
}

.duplicate-hint span {
  color: var(--muted);
}

.chips {
  margin-top: 16px;
}

.chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
}

.chip small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.chip.expense {
  color: var(--expense);
  background: var(--expense-soft);
}

.chip.income {
  color: var(--income);
  background: var(--income-soft);
}

.list-card,
.empty-state,
.breakdown-row {
  padding: 14px;
  min-width: 0;
}

.list-card-head {
  align-items: flex-start;
}

.list-card-head strong {
  display: block;
  margin-bottom: 4px;
}

.list-card-meta {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 8px;
}

.list-actions {
  margin-top: 12px;
}

.muted,
.empty-state {
  color: var(--muted);
}

.amount {
  font-weight: 800;
  white-space: nowrap;
}

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

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

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

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

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

.expense-entry-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, auto);
  gap: 12px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.expense-entry-choice > div:first-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.expense-entry-choice strong {
  font-size: 1rem;
  line-height: 1.3;
}

.expense-entry-choice .camera-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.entry-option h4,
.entry-option p {
  margin: 0;
}

.entry-option p {
  color: var(--muted);
  line-height: 1.4;
}

.compact-form {
  margin-top: 6px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 220px) auto;
  gap: 12px;
  align-items: center;
}

.breakdown-row span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--expense);
}

.goal-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.goal-progress .bar-track span {
  background: var(--income);
}

.goal-allocation-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(92px, 120px) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.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;
}

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

.file-status {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: none;
}

.recurring-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.recurring-box legend,
.recurring-box span {
  text-transform: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.recurring-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(96px, 0.6fr);
  gap: 10px;
}

.pending-label {
  color: var(--expense);
  font-weight: 800;
}

.recurring-transaction {
  border-color: rgba(15, 128, 115, 0.28);
  background:
    linear-gradient(90deg, rgba(15, 128, 115, 0.08), transparent 38%),
    var(--surface);
}

.recurring-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--income-soft);
  color: var(--accent);
  font-weight: 850;
}

.receipt-link-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #9ad8ce;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.info-strip {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.info-strip strong {
  font-size: 0.95rem;
}

.info-strip span {
  color: var(--muted);
}

.info-strip.ok {
  border-color: #a6d8bd;
  background: var(--income-soft);
}

.info-strip.warn {
  border-color: #e7c19d;
  background: var(--expense-soft);
}

.manual-hint {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--expense-soft);
  color: var(--expense);
  font-weight: 650;
}

.manual-hint span {
  color: var(--expense);
  font-weight: 500;
}

.manual-hint .button {
  width: fit-content;
}

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

.details-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-row strong {
  overflow-wrap: anywhere;
}

.qr-copy-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid #9ad8ce;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.qr-copy-card img {
  width: min(300px, 100%);
  aspect-ratio: 1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 37, 32, 0.42);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 38px rgba(29, 37, 32, 0.2);
  padding: 18px;
}

.qr-scanner-panel {
  width: min(680px, 100%);
}

.confirm-panel {
  width: min(560px, 100%);
}

.confirm-input {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.confirm-input span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qr-camera-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(72vh, 520px);
  overflow: hidden;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.08), transparent 45%),
    #101815;
}

.qr-camera-box video {
  width: 100%;
  height: 100%;
  min-height: min(72vh, 520px);
  object-fit: cover;
}

.qr-scanner-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#qr-torch-button[aria-pressed="true"] {
  background: #f8d56b;
  border-color: #e6b84a;
  color: #2f2507;
  box-shadow: 0 12px 26px rgba(230, 184, 74, 0.3);
}

.qr-camera-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(5, 12, 10, 0.5), rgba(5, 12, 10, 0.5)),
    radial-gradient(circle at center, transparent 0 32%, rgba(5, 12, 10, 0.42) 33% 100%);
  pointer-events: none;
}

.qr-scan-frame {
  position: absolute;
  width: min(68vw, 330px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  box-shadow:
    0 0 0 999px rgba(5, 12, 10, 0.22),
    0 0 30px rgba(15, 128, 115, 0.45);
}

.qr-scan-frame::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #5cf0d3, transparent);
  animation: scan-line 1.8s ease-in-out infinite;
}

.qr-scan-frame span {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: #5cf0d3;
}

.qr-scan-frame span:nth-child(1) {
  top: -2px;
  left: -2px;
  border-top: 5px solid;
  border-left: 5px solid;
  border-radius: 22px 0 0 0;
}

.qr-scan-frame span:nth-child(2) {
  top: -2px;
  right: -2px;
  border-top: 5px solid;
  border-right: 5px solid;
  border-radius: 0 22px 0 0;
}

.qr-scan-frame span:nth-child(3) {
  bottom: -2px;
  right: -2px;
  border-bottom: 5px solid;
  border-right: 5px solid;
  border-radius: 0 0 22px 0;
}

.qr-scan-frame span:nth-child(4) {
  bottom: -2px;
  left: -2px;
  border-bottom: 5px solid;
  border-left: 5px solid;
  border-radius: 0 0 0 22px;
}

#qr-scanner-status[data-status="ok"] {
  color: var(--income);
  font-weight: 750;
}

#qr-scanner-status[data-status="warning"] {
  color: var(--expense);
  font-weight: 750;
}

@keyframes scan-line {
  0%,
  100% {
    transform: translateY(-120px);
    opacity: 0.4;
  }

  50% {
    transform: translateY(120px);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .app-layout,
  .outflow-shell,
  .two-column,
  .two-column.compact,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 8px;
  }

  .sub-sidebar {
    position: static;
  }

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

  .sub-nav-item {
    text-align: center;
  }

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

  .nav-submenu {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px;
    border-left: 0;
    border-radius: var(--radius);
    background: rgba(238, 243, 236, 0.7);
  }

  .nav-item,
  .nav-subitem {
    text-align: center;
    white-space: normal;
  }

  .sidebar-title {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    padding: 10px 10px 28px;
  }

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

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

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .topbar,
  .auth-grid,
  .form-grid,
  .expense-entry-choice,
  .goal-allocation-form,
  .inline-form,
  .breakdown-row,
  .detail-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: stretch;
    gap: 8px;
  }

  .month-control {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .nav-menu,
  .nav-submenu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item,
  .sub-nav-item,
  .nav-subitem {
    min-height: 38px;
    padding: 8px 8px;
    font-size: 0.9rem;
  }

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

  .button,
  .topbar-actions .status-pill {
    width: 100%;
  }

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

  .recurring-fields {
    grid-template-columns: 1fr;
  }

  .page-head,
  .surface,
  .metric-card,
  .list-card,
  .empty-state,
  .breakdown-row,
  .modal-panel {
    box-shadow: none;
  }

  .page-head,
  .surface {
    padding: 12px;
  }

  .metrics-grid {
    gap: 8px;
  }

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

  .metric-card strong {
    font-size: 1.25rem;
  }

  .list-card,
  .empty-state,
  .breakdown-row {
    padding: 12px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 8px;
  }

  .modal-panel {
    max-height: calc(100vh - 16px);
    padding: 12px;
  }

  .manual-hint .button {
    width: 100%;
  }

  .list-card-head,
  .list-card-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .amount {
    white-space: normal;
  }
}
