:root {
  --bg-base: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-soft: #eef2ff;
  --line-soft: #d1d5db;
  --line-strong: #9ca3af;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #4b5563;

  --color-income: #059669;
  --color-expense: #e11d48;

  --status-ok: #2563eb;
  --status-warn: #d97706;
  --status-danger: #dc2626;

  --interactive: #1d4ed8;
  --interactive-strong: #1e40af;
  --interactive-soft: #dbeafe;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 22px rgba(15, 23, 42, 0.08);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.09), transparent 42%),
    radial-gradient(circle at 100% 8%, rgba(225, 29, 72, 0.06), transparent 40%),
    var(--bg-base);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

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

h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 17px;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-bottom: 108px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  background: linear-gradient(145deg, #ffffff, #eef4ff 58%, #f7f9ff);
  border: 1px solid #d5dff2;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
}

.brand h1 {
  font-size: 28px;
  line-height: 1.1;
}

.brand p {
  margin-top: var(--space-1);
  color: var(--text-tertiary);
  font-size: 14px;
}

.global-notice,
.budget-banner {
  display: none;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: var(--space-3);
  font-size: 13px;
  font-weight: 600;
}

.global-notice.show,
.budget-banner.show {
  display: block;
}

.global-notice.notice-info {
  background: #eef2ff;
  color: #312e81;
  border: 1px solid #c7d2fe;
}

.global-notice.notice-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.global-notice.notice-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.budget-banner.banner-warn {
  background: #fffbeb;
  color: #7c2d12;
  border: 1px solid #fcd34d;
}

.budget-banner.banner-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  animation: banner-pulse 1.4s ease-in-out infinite;
}

@keyframes banner-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(220, 38, 38, 0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.13);
  }
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.scope-panel {
  position: sticky;
  top: 8px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

.subhead {
  margin: var(--space-3) 0 var(--space-2);
  font-size: 13px;
  color: #334155;
  font-weight: 700;
}

.muted {
  color: var(--text-secondary);
}

.hint {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.between {
  justify-content: space-between;
}

.end-wrap {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.wrap-gap {
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  align-items: end;
}

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

label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
}

input,
select,
button {
  width: 100%;
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

input,
select {
  border: 1px solid var(--line-soft);
  background: #fff;
  color: var(--text-primary);
  padding: 8px 10px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--interactive), var(--interactive-strong));
  padding: 8px 12px;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

button:hover {
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.24);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

button.ghost {
  color: var(--interactive-strong);
  background: var(--interactive-soft);
  border: 1px solid #bfdbfe;
  box-shadow: none;
}

.small-select {
  max-width: 120px;
}

.medium-select {
  max-width: 190px;
}

.view-nav {
  display: flex;
  gap: var(--space-2);
}

.view-tab {
  width: auto;
  min-width: 92px;
}

.view-tab.active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
}

.view-stack {
  margin-top: var(--space-3);
}

.view {
  display: none;
}

.view.view-active {
  display: block;
  animation: view-fade-in 0.22s ease-out;
}

@keyframes view-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2);
}

.kpi {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  padding: 10px;
}

.kpi .label {
  font-size: 12px;
  color: var(--text-secondary);
}

.kpi .value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.alert-box {
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 13px;
}

.alert-box.ok {
  color: #1e40af;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.alert-box.warn {
  color: #92400e;
  border-color: #fcd34d;
  background: #fffbeb;
}

.alert-box.danger {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fef2f2;
}

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

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

.food-progress-block {
  margin-bottom: var(--space-3);
}

.food-progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  overflow: hidden;
}

.food-progress-fill {
  width: 0;
  height: 100%;
  background: var(--status-ok);
  transition: width 0.35s ease, background-color 0.2s ease;
}

.food-progress-fill.warn {
  background: var(--status-warn);
}

.food-progress-fill.danger {
  background: var(--status-danger);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
}

.mini-chart {
  margin-top: var(--space-2);
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 10px;
  min-height: 140px;
}

.mini-chart-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 12px;
}

.mini-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 120px;
}

.mini-col {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.mini-bars {
  width: 44px;
  height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.mini-bar {
  width: 14px;
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
  transition: height 0.25s ease;
}

.mini-bar.income {
  background: linear-gradient(180deg, #34d399, #059669);
}

.mini-bar.expense {
  background: linear-gradient(180deg, #fb7185, #e11d48);
}

.mini-col-label {
  font-size: 11px;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.mini-chart-legend {
  margin-top: 6px;
  color: #6b7280;
  font-size: 11px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: 13px;
}

th,
td {
  padding: 8px 6px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

th {
  white-space: nowrap;
  background: #f9fafb;
  color: #4b5563;
  font-weight: 700;
}

td.wrap {
  white-space: normal;
  line-height: 1.35;
}

td.compact {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

#txTable {
  table-layout: fixed;
  min-width: 1320px;
}

#txTable td,
#txTable th {
  white-space: nowrap;
}

#txTable td.wrap {
  white-space: normal;
}

.transactions-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.action-row {
  margin-top: var(--space-3);
}

.entry-template-block {
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 10px;
}

.entry-tools {
  margin-bottom: 8px;
}

.entry-tools button {
  width: auto;
}

.shortcut-hint {
  margin-top: 8px;
}

.tx-template-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.template-chip {
  min-width: 0;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  box-shadow: none;
  text-align: left;
  padding: 8px 10px;
}

.template-chip:hover {
  box-shadow: none;
  transform: none;
  background: #eff6ff;
}

.template-chip:active {
  transform: none;
}

.template-chip.template-income {
  border-color: #a7f3d0;
}

.template-chip.template-expense {
  border-color: #fecdd3;
}

.template-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-amount {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

.status-line {
  margin-top: var(--space-2);
  min-height: 18px;
  font-size: 12px;
}

.status-row {
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-row .status-line {
  margin-top: 0;
  flex: 1;
}

.retry-tx-btn {
  width: auto;
  min-width: 84px;
}

.hidden {
  display: none !important;
}

.input-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
  background: #fff7f7 !important;
}

.recovery-panel {
  position: relative;
  margin-top: 10px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.recovery-toast {
  margin-top: 6px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: transparent;
  font-size: 11px;
  line-height: 1.35;
  padding: 0;
  min-height: 0;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease, padding 0.2s ease;
}

.recovery-toast.show {
  padding: 5px 8px;
  min-height: 24px;
  opacity: 1;
  transform: translateY(0);
}

.recovery-toast.show.tone-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.recovery-toast.show.tone-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}

.recovery-toast.show.tone-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.recovery-toast.show.tone-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.recovery-guide {
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.recovery-guide:empty {
  display: none;
}

.recovery-guide.tone-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.recovery-guide.tone-danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.recovery-guide.tone-info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.recovery-guide-title {
  font-weight: 800;
  color: #1f2937;
}

.recovery-guide-steps {
  margin: 6px 0 0;
  padding-left: 18px;
}

.recovery-guide-steps li {
  margin: 2px 0;
  color: #334155;
}

.recovery-guide-actions {
  margin-top: 8px;
}

.recovery-guide-fix-btn {
  width: auto;
  min-width: 140px;
}

.recovery-guide-fix-btn.is-disabled,
.recovery-guide-fix-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.recovery-guide-note {
  margin-top: 6px;
  font-size: 11px;
  color: #475569;
}

.recovery-guide-manual {
  margin-top: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.recovery-guide-manual-title {
  font-size: 11px;
  font-weight: 800;
  color: #334155;
}

.recovery-guide-manual-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 11px;
  color: #334155;
}

.recovery-guide-manual-list li {
  margin: 2px 0;
}

.recovery-guide-manual-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recovery-guide-manual-btn {
  width: auto;
  min-width: 120px;
}

.recovery-clear-btn {
  width: auto;
  min-width: 84px;
}

.recovery-stats {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.recovery-subtitle {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
}

.recovery-reasons,
.recovery-recommendations,
.recovery-fixes,
.recovery-history-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.recovery-reasons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.recovery-fixes {
  display: grid;
  gap: 4px;
}

.recovery-recommendations {
  display: grid;
  gap: 6px;
}

.recovery-recommendation {
  display: grid;
  gap: 4px;
}

.recovery-recommendation.is-highlighted {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.recovery-recommendation.is-highlighted.is-pulse {
  animation: recovery-card-pulse 1.1s ease-out 1;
}

@keyframes recovery-card-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.36);
  }
  40% {
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.18);
  }
  100% {
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.22);
  }
}

.recovery-rec-feedback {
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
}

.recovery-rec-feedback.muted,
.recovery-rec-feedback:empty {
  display: none;
}

.recovery-rec-feedback.tone-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}

.recovery-rec-feedback.tone-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.recovery-rec-feedback.tone-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.recovery-rec-feedback.tone-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.recovery-rec-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.recovery-rec-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  color: #334155;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
}

.recovery-rec-badge.tone-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}

.recovery-rec-badge.tone-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.recovery-rec-badge.tone-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.recovery-rec-badge.tone-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.recovery-rec-meta {
  display: block;
  font-size: 11px;
  color: #475569;
}

.recovery-rec-suppressed-note {
  display: block;
  font-size: 10px;
  color: #b45309;
}

.recovery-rec-action-btn {
  width: auto;
  min-width: 112px;
  justify-self: start;
}

.recovery-rec-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.recovery-rec-manual-btn {
  width: auto;
  min-width: 108px;
}

.recovery-trend-row {
  display: grid;
  gap: 4px;
}

.recovery-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.recovery-trend-reason {
  font-size: 11px;
}

.recovery-trend-meta {
  font-size: 10px;
  opacity: 0.88;
}

.recovery-trend-bar {
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
}

.recovery-trend-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.9;
}

.reason-trend-row {
  display: grid;
  gap: 4px;
}

.reason-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}

.reason-trend-meta {
  font-size: 10px;
  opacity: 0.9;
}

.recovery-fix-chip {
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  color: #334155;
}

.recovery-fix-chip.tone-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}

.recovery-fix-chip.tone-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.recovery-fix-chip.tone-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.recovery-reason-chip {
  width: auto;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  box-shadow: none;
}

.recovery-reason-chip:hover {
  transform: none;
  background: #dbeafe;
}

.recovery-reason-chip.is-active {
  border-color: #1d4ed8;
  background: #bfdbfe;
  color: #1e3a8a;
}

.recovery-row {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  font-size: 12px;
}

.recovery-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.recovery-status {
  font-weight: 800;
}

.recovery-status.status-401 {
  color: #b45309;
}

.recovery-status.status-422 {
  color: #b91c1c;
}

.recovery-status.status-5xx {
  color: #7c2d12;
}

.recovery-time {
  color: #64748b;
  font-size: 11px;
}

.recovery-meta {
  color: #475569;
}

.recovery-row-actions {
  margin-top: 6px;
}

.recovery-action-btn {
  width: auto;
  min-width: 92px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.page-links {
  display: inline-flex;
  gap: 4px;
}

.tx-mobile-wrap {
  margin-top: var(--space-2);
}

.tx-quick-chips {
  margin-top: var(--space-2);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tx-quick-chips .chip {
  width: auto;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

.tx-quick-chips .chip.active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: #1d4ed8;
}

.tx-load-status {
  min-height: 18px;
  text-align: center;
  font-size: 12px;
  margin-top: 8px;
}

.tx-load-spinner {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  margin: 6px auto 0;
  opacity: 0;
  pointer-events: none;
  animation: tx-spin 0.7s linear infinite;
}

.tx-load-spinner.show {
  opacity: 1;
}

@keyframes tx-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tx-load-sentinel {
  height: 2px;
}

.tx-card-list,
.tx-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.tx-card,
.tx-preview-item {
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}

.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 8px;
}

.currency-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.tx-card-main {
  display: grid;
  gap: 8px;
}

.tx-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.text-chip {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 500;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-chip:hover {
  box-shadow: none;
  background: #eff6ff;
}

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

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

.empty-block {
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 16px;
  text-align: center;
  color: #475569;
  font-size: 13px;
}

.recent-panel {
  min-height: 160px;
}

.tx-preview-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: var(--space-2);
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  background: #e0e7ff;
  color: #312e81;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.badge.user {
  background: #dcfce7;
  color: #166534;
}

.modal-backdrop,
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid #d1d5db;
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
}

.modal-head {
  margin-bottom: 10px;
}

.modal-status {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dbe2ea;
  min-height: 20px;
}

.sheet {
  width: min(680px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: 1px solid #d1d5db;
  padding: var(--space-4);
  align-self: flex-end;
}

.sheet-content {
  margin-top: var(--space-3);
  color: #0f172a;
  white-space: pre-wrap;
  line-height: 1.45;
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid #d1d5db;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-nav .view-tab {
  width: 100%;
  min-width: 0;
}

.fab {
  position: fixed;
  right: 14px;
  bottom: 72px;
  z-index: 90;
  width: auto;
  min-width: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.32);
}

.tx-back-to-top {
  position: fixed;
  left: 14px;
  bottom: 72px;
  z-index: 90;
  width: auto;
  min-width: 0;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 12px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
  display: none;
}

.tx-back-to-top.show {
  display: inline-flex;
  align-items: center;
}

.desktop-nav {
  display: none;
}

.desktop-table-wrap {
  display: none;
}

.quick-preset {
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.quick-preset button {
  width: auto;
}

@media (min-width: 768px) {
  .app-shell {
    padding: var(--space-5);
    padding-bottom: 40px;
  }

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

  .recent-panel {
    grid-column: span 2;
  }

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

@media (min-width: 1024px) {
  .desktop-nav {
    display: flex;
  }

  .mobile-nav,
  .fab {
    display: none;
  }

  .tx-back-to-top {
    display: none !important;
  }

  .app-shell {
    padding-bottom: var(--space-4);
  }

  .transactions-layout {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }

  .entry-panel {
    position: sticky;
    top: 190px;
  }

  .tx-mobile-wrap {
    display: none;
  }

  .desktop-table-wrap {
    display: block;
  }

  .dashboard-grid {
    grid-template-columns: 1.2fr 1fr;
  }

  .recent-panel {
    grid-column: 1 / -1;
  }

  .tx-quick-chips {
    display: none;
  }
}

@media (max-width: 1023px) {
  .scope-panel {
    position: static;
    top: auto;
    z-index: auto;
    backdrop-filter: none;
  }

  .pager {
    display: none;
  }

  .tx-quick-chips {
    position: sticky;
    top: 112px;
    z-index: 8;
    margin-top: 0;
    margin-bottom: 8px;
    margin-left: -4px;
    margin-right: -4px;
    padding: 8px 4px 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82));
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #dbe2ea;
    box-shadow: 0 8px 14px rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 767px) {
  .app-shell {
    padding: 10px 10px 104px;
  }

  .topbar {
    padding: var(--space-4);
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 24px;
  }

  .scope-panel {
    top: 6px;
    padding: var(--space-3);
  }

  .tx-quick-chips {
    top: 98px;
  }

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

  .tx-template-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .template-chip {
    min-width: 180px;
    width: auto;
    flex: 0 0 auto;
  }

  .span-2 {
    grid-column: span 1;
  }

  .small-select,
  .medium-select {
    max-width: none;
  }

  button {
    min-height: 40px;
  }

  .pager {
    justify-content: space-between;
  }
}
