:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --brand: #00a950;
  --brand-soft: rgba(0, 169, 80, 0.12);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.12);
  --indigo: #6366f1;
  --indigo-soft: rgba(99, 102, 241, 0.12);
  --amber: #f59e0b;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.04);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --brand: #10b981;
  --brand-soft: rgba(16, 185, 129, 0.16);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Anuphan", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.num,
.kpi-value,
.cat-amount,
.donut-center-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.bank-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00a950, #059669);
  color: #ffffff;
  font-weight: 700;
  font-size: 22px;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(0, 169, 80, 0.25);
  flex-shrink: 0;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.period-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.verified-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

.account-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.month-select,
.year-select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 34px 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background-color: var(--brand-soft);
  color: var(--brand);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 13px;
}

.year-select {
  border-color: var(--indigo);
  background-color: var(--indigo-soft);
  color: var(--indigo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.month-select option,
.year-select option {
  background: var(--surface);
  color: var(--text);
}

.month-select:focus,
.year-select:focus {
  outline: 2px solid var(--brand);
}

.view-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Fixed Cost vs Variable Cost Card */
.fixed-cost-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  align-items: start;
}

.split-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
  display: flex;
  margin: 10px 0 8px;
}

.split-fixed {
  background: #f59e0b;
  height: 100%;
}

.split-variable {
  background: #0ea5e9;
  height: 100%;
}

.split-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.split-labels strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.fixed-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.inst-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inst-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.inst-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.inst-fill {
  height: 100%;
  border-radius: 999px;
  background: #0d9488;
}

.inst-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.legend-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.overview-table tbody tr {
  cursor: pointer;
}

.overview-table tfoot td,
.overview-table tr.summary-row td {
  font-weight: 700;
  background: var(--surface-alt);
}

@media (max-width: 900px) {
  .fixed-cost-grid {
    grid-template-columns: 1fr;
  }
}

.icon-btn,
.btn-secondary,
.btn-primary {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn,
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.icon-btn:hover,
.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-alt);
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid transparent;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

/* Control Banner */
.control-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.control-switches {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 480px;
}

.control-divider {
  height: 1px;
  background: var(--border);
}

.control-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.control-title {
  font-size: 14px;
  font-weight: 600;
}

.control-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-strong);
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background-color: var(--indigo);
}

.switch input:checked + .slider.slider-green {
  background-color: var(--brand);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-badge.green { background: var(--green-soft); color: var(--green); }
.kpi-badge.rose { background: var(--rose-soft); color: var(--rose); }
.kpi-badge.indigo { background: var(--indigo-soft); color: var(--indigo); }
.kpi-badge.neutral { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-value.green { color: var(--green); }
.kpi-value.rose { color: var(--rose); }

.kpi-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Cards & Charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.chip-clear {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}

.chip-clear:hover {
  border-color: var(--rose);
  color: var(--rose);
}

/* Donut + Category List */
.category-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  align-items: center;
}

.donut-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.donut-svg {
  width: 230px;
  height: 230px;
  overflow: visible;
}

.donut-slice {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-origin: center;
}

.donut-slice:hover {
  opacity: 0.9;
}

.donut-slice.is-dimmed {
  opacity: 0.3;
}

.donut-center-label {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.donut-center-value {
  fill: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.donut-center-sub {
  fill: var(--text-muted);
  font-size: 11px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.cat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cat-row:hover {
  background: var(--surface-alt);
}

.cat-row.is-active {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.cat-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.cat-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count {
  font-size: 11.5px;
  color: var(--text-muted);
}

.cat-amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
}

.cat-amount {
  font-weight: 700;
}

.cat-pct {
  font-size: 11.5px;
  color: var(--text-muted);
  min-width: 38px;
  text-align: right;
}

.cat-bar-bg {
  height: 5px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* Category Detail Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.15s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPopIn 0.16s ease;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.modal-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.modal-close-btn:hover {
  border-color: var(--rose);
  color: var(--rose);
}

.modal-body {
  padding: 16px 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.drilldown-merchants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.merchant-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.merchant-pill strong {
  font-variant-numeric: tabular-nums;
}

.drilldown-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  flex-shrink: 0;
}

.drilldown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.drilldown-row:last-child {
  border-bottom: none;
}

.drilldown-row:hover {
  background: var(--surface-alt);
}

.drilldown-row-left {
  min-width: 0;
}

.drilldown-row-merchant {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.drilldown-row-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-word;
}

.drilldown-row-amount {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Segmented Tabs */
.segmented {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Daily Chart */
.daily-chart-wrap {
  width: 100%;
}

.daily-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-dasharray: 3 3;
}

.chart-axis-text {
  fill: var(--text-muted);
  font-size: 11px;
}

.chart-hit-area {
  cursor: pointer;
}

.daily-bar {
  fill: var(--rose);
  opacity: 0.82;
  transition: opacity 0.15s ease;
  cursor: pointer;
}

.daily-bar:hover,
.daily-bar.is-selected {
  opacity: 1;
  fill: var(--indigo);
}

.balance-line {
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.balance-dot {
  fill: var(--green);
  stroke: var(--surface);
  stroke-width: 1.5;
  cursor: pointer;
}

.balance-dot.has-income {
  fill: var(--brand);
}

.balance-dot.is-selected {
  fill: var(--indigo);
}

.daily-highlights {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hl-item {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 8px 12px;
}

.hl-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.hl-val {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

/* Table Section */
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.search-box {
  position: relative;
  flex: 1 1 240px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px 8px 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  outline: none;
}

.search-box input:focus,
.select-input:focus {
  border-color: var(--indigo);
  background: var(--surface);
}

.type-pills {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.pill-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.pill-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.select-input {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}

.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo);
}

.filter-tag button {
  background: none;
  border: none;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}

/* Table */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.tx-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tx-table th.num,
.tx-table td.num {
  text-align: right;
  white-space: nowrap;
}

.tx-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.tx-table tbody tr:last-child td {
  border-bottom: none;
}

.tx-table tbody tr:hover {
  background: var(--surface-alt);
}

.date-main {
  font-weight: 600;
  white-space: nowrap;
}

.date-time {
  font-size: 12px;
  color: var(--text-muted);
}

.merchant-main {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.action-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.desc-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 420px;
}

.note-input {
  margin-top: 6px;
  width: 100%;
  max-width: 320px;
  font-family: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px dashed transparent;
  background: transparent;
  color: var(--text);
  transition: all 0.15s ease;
}

.note-input:hover,
.note-input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
  outline: none;
}

.note-input::placeholder {
  color: var(--text-soft);
}

.cat-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  max-width: 190px;
  white-space: nowrap;
}

.cat-select:focus {
  outline: 2px solid var(--indigo);
}

.channel-badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-muted);
  white-space: nowrap;
}

.amount-in {
  font-weight: 700;
  color: var(--green);
}

.amount-out {
  font-weight: 700;
  color: var(--text);
}

.balance-cell {
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}

.table-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-totals {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-totals strong {
  color: var(--text);
}

/* Tooltip */
.chart-tooltip {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  min-width: 190px;
}

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

.tt-title {
  font-weight: 700;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tt-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #cbd5e1;
  margin-top: 2px;
}

.tt-row strong {
  color: #ffffff;
}

.tt-hint {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  color: #94a3b8;
}

/* Responsive */
@media (max-width: 1060px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .category-layout {
    grid-template-columns: 1fr;
  }
  .daily-highlights {
    grid-template-columns: 1fr;
  }
}
