:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --accent: #0f9f8f;
  --accent-2: #3157d5;
  --danger: #c2410c;
  --good: #087f5b;
  --chart-positive: #0f9f8f;
  --chart-negative: #d84a13;
  --chart-1: #3157d5;
  --chart-2: #0f9f8f;
  --chart-3: #f97316;
  --chart-4: #7c3aed;
  --chart-5: #0891b2;
  --shadow: 0 18px 45px rgba(18, 38, 63, .12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101419;
  --panel: #171d24;
  --panel-2: #202832;
  --text: #eef4f8;
  --muted: #aab6c5;
  --line: #303b48;
  --accent: #31c4b3;
  --accent-2: #82a2ff;
  --danger: #ff8a65;
  --good: #6ee7b7;
  --chart-positive: #6ee7b7;
  --chart-negative: #ff8a65;
  --chart-1: #82a2ff;
  --chart-2: #31c4b3;
  --chart-3: #ff8a65;
  --chart-4: #c084fc;
  --chart-5: #67e8f9;
  --shadow: 0 18px 45px rgba(0, 0, 0, .26);
}

[data-palette="rose"] {
  --bg: #fff5f8;
  --panel: #ffffff;
  --panel-2: #fde7ef;
  --text: #2b1720;
  --muted: #8a5b6b;
  --line: #f3c7d5;
  --accent: #ec4899;
  --accent-2: #db2777;
  --danger: #e11d48;
  --good: #0f9f8f;
  --chart-positive: #ec4899;
  --chart-negative: #fb7185;
  --chart-1: #ec4899;
  --chart-2: #fb7185;
  --chart-3: #f59e0b;
  --chart-4: #a855f7;
  --chart-5: #14b8a6;
  --shadow: 0 18px 45px rgba(190, 24, 93, .12);
}

[data-theme="dark"][data-palette="rose"] {
  --bg: #171016;
  --panel: #211720;
  --panel-2: #322231;
  --text: #fff1f7;
  --muted: #e4b5c7;
  --line: #493244;
  --accent: #f472b6;
  --accent-2: #fb7185;
  --danger: #fb7185;
  --good: #6ee7d2;
  --chart-positive: #f472b6;
  --chart-negative: #fb7185;
  --chart-1: #f472b6;
  --chart-2: #fb7185;
  --chart-3: #fbbf24;
  --chart-4: #c084fc;
  --chart-5: #5eead4;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

[data-palette="lavender"] {
  --bg: #f8f5ff;
  --panel: #ffffff;
  --panel-2: #eee7ff;
  --text: #211733;
  --muted: #6f5b8f;
  --line: #d9ccfb;
  --accent: #a855f7;
  --accent-2: #7c3aed;
  --danger: #e11d48;
  --good: #0f9f8f;
  --chart-positive: #a855f7;
  --chart-negative: #e879f9;
  --chart-1: #7c3aed;
  --chart-2: #a855f7;
  --chart-3: #06b6d4;
  --chart-4: #ec4899;
  --chart-5: #f59e0b;
  --shadow: 0 18px 45px rgba(124, 58, 237, .12);
}

[data-theme="dark"][data-palette="lavender"] {
  --bg: #12101a;
  --panel: #1b1728;
  --panel-2: #28213a;
  --text: #f7f2ff;
  --muted: #c9b9e8;
  --line: #3d3356;
  --accent: #c084fc;
  --accent-2: #a78bfa;
  --danger: #fb7185;
  --good: #6ee7b7;
  --chart-positive: #c084fc;
  --chart-negative: #f0abfc;
  --chart-1: #a78bfa;
  --chart-2: #c084fc;
  --chart-3: #67e8f9;
  --chart-4: #f472b6;
  --chart-5: #fbbf24;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent-2);
  cursor: pointer;
  min-height: 40px;
}

button:hover { filter: brightness(1.06); }

button:disabled,
button.is-loading {
  cursor: wait;
  opacity: .78;
  filter: none;
}

.processing-notice {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent-2));
  color: var(--text);
  box-shadow: var(--shadow);
}

.processing-content {
  display: grid;
  gap: 6px;
  min-width: min(280px, 62vw);
}

.processing-content small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.processing-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid color-mix(in srgb, var(--accent-2) 20%, transparent);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: processing-spin .8s linear infinite;
  flex: 0 0 auto;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--panel);
  color: var(--text);
}

input.is-filter-active,
select.is-filter-active,
.table-search.is-filter-active,
.column-filter-control.is-filter-active input:not([type="checkbox"]) {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 10%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
}

.column-filter-control.is-filter-active label,
label.is-filter-active-label {
  color: var(--accent-2);
  font-weight: 800;
}

.column-filter-control.is-filter-active {
  padding: 4px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 9%, transparent);
}

textarea { min-height: 86px; resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 32px; }
h2 { font-size: 18px; }
p { color: var(--muted); margin: 6px 0 0; }
a { color: inherit; text-decoration: none; }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

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

.compact-check {
  display: inline-flex;
  width: auto;
  min-height: 40px;
  white-space: nowrap;
}
.mini-link,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 7px 10px;
  color: #fff;
  background: var(--accent);
  white-space: nowrap;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 246px;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  text-align: center;
}

.logo-switch {
  display: inline-flex;
  align-items: center;
}

.logo-switch img {
  display: block;
  height: auto;
  object-fit: contain;
}

.logo-dark { display: none !important; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: block !important; }

.brand-logo img {
  width: 176px;
  max-height: 54px;
}

.brand-logo.logo-switch {
  min-width: 176px;
}

.brand strong {
  display: block;
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-user {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
}

.brand-user span,
.brand-user em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.brand-user b {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-user small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-user.is-support {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
}

.brand-user.is-support span {
  color: var(--accent);
}

nav {
  display: grid;
  gap: 6px;
}

nav a,
.logout,
.theme-form button {
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

nav a:hover,
.logout:hover,
.theme-form button:hover {
  background: var(--panel-2);
  color: var(--text);
}

nav a.active {
  background: var(--accent-2);
  color: #fff;
  font-weight: 800;
  box-shadow: inset 4px 0 0 var(--accent);
}

.theme-form { margin-top: auto; }
.theme-form button { width: 100%; color: var(--text); border: 1px solid var(--line); }
.logout { display: block; }

.main {
  margin-left: 246px;
  padding: 28px;
}

.auth-main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(49, 87, 213, .18), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(15, 159, 143, .2), transparent 30%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
}

[data-theme="dark"] .auth-card { background: rgba(23,29,36,.86); }
.auth-logo.logo-switch {
  width: min(260px, 100%);
  margin-bottom: 22px;
}

.auth-logo img {
  width: 100%;
  max-height: 86px;
}
.auth-card form, .stack { display: grid; gap: 14px; margin-top: 22px; }

.purchase-link {
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  font-weight: 800;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 22%, transparent);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

.inline-action-form {
  display: contents;
}

.account-ai-consent {
  grid-column: 1 / -1;
}

.account-ai-consent small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.panel,
.bulkbar,
.support-bar,
.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel { padding: 20px; margin-bottom: 20px; }
.table-panel { overflow: auto; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title form {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.section-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.compact-link {
  padding: 8px 12px;
  min-height: 36px;
}

.section-title button {
  background: var(--danger);
}

.master-panel {
  align-self: start;
}

.master-sections {
  display: grid;
  gap: 18px;
}

.master-panel > .stack {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(90px, .35fr) auto;
  align-items: end;
}

.master-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.master-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, .9fr) minmax(86px, .35fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.category-master-row {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, .75fr) minmax(86px, .3fr) auto auto auto;
}

.project-create-row {
  grid-template-columns: minmax(220px, 1fr) 74px 180px;
}

.master-panel > .category-create-row {
  grid-template-columns: minmax(220px, 1fr) 150px 74px minmax(190px, .7fr) 96px;
  align-items: center;
}

.project-master-row {
  grid-template-columns: minmax(220px, 1fr) 74px 96px 96px;
}

.category-master-row {
  grid-template-columns: minmax(220px, 1fr) 150px 74px minmax(170px, .8fr) 96px 96px;
}

.project-create-row input[type="color"],
.project-master-row input[type="color"],
.category-create-row input[type="color"],
.category-master-row input[type="color"] {
  width: 74px;
  min-width: 74px;
  height: 38px;
  min-height: 38px;
  padding: 4px;
}

.project-master-row button,
.category-master-row button,
.category-create-row button {
  width: 96px;
  min-width: 96px;
  padding-inline: 10px;
}

.master-row button {
  min-height: 36px;
  padding: 8px 10px;
}

.danger-button {
  background: var(--danger);
}

.danger-panel {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

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

.linked-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-note {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.flash {
  padding: 13px 15px;
  margin-bottom: 18px;
  color: var(--good);
}

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

.support-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: #fff7ed;
  color: #7c2d12;
}

[data-theme="dark"] .support-bar {
  background: #3a2418;
  color: #fed7aa;
}

.support-bar form { display: inline-flex; }
.support-bar button { min-height: 34px; padding: 7px 10px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-period-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  box-shadow: var(--shadow);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.segmented-control a,
.period-stepper a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 900;
  text-decoration: none;
}

.segmented-control a.active {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 22%, transparent);
}

.period-stepper {
  display: inline-grid;
  grid-template-columns: 38px minmax(150px, auto) 38px;
  align-items: center;
  gap: 6px;
}

.period-stepper a {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--accent);
  font-size: 22px;
}

.period-stepper strong {
  color: var(--text);
  font-size: 17px;
  text-align: center;
}

.dashboard-period-switcher > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpis div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpis span { display: block; color: var(--muted); font-size: 13px; }
.kpis strong { display: block; margin-top: 8px; font-size: 25px; }

.kpis .kpi-card {
  position: relative;
  overflow: hidden;
  padding: 19px 20px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, #fff 4%), var(--panel));
}

.kpis .kpi-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 12px 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 32%, transparent), transparent);
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  margin-top: 11px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.kpi-trend.good {
  background: color-mix(in srgb, var(--chart-positive) 12%, var(--panel));
  color: var(--chart-positive);
}

.kpi-trend.bad {
  background: color-mix(in srgb, var(--chart-negative) 12%, var(--panel));
  color: var(--chart-negative);
}

.dashboard-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dashboard-filter span {
  color: var(--muted);
}

.dashboard-filter a {
  margin-left: auto;
  color: var(--accent-2);
  font-weight: 800;
}

.dashboard-controls {
  display: grid;
  gap: 12px;
}

.dashboard-filter-details {
  padding: 0;
  overflow: hidden;
}

.dashboard-filter-details summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 14px 18px;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.dashboard-filter-details summary::-webkit-details-marker {
  display: none;
}

.dashboard-filter-details summary::after {
  content: "+";
  justify-self: end;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.dashboard-filter-details[open] summary::after {
  content: "-";
}

.dashboard-filter-details summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-filter-details .dashboard-controls {
  padding: 0 18px 18px;
}

.period-form,
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.period-form label {
  min-width: 150px;
}

.dashboard-period-form label {
  min-width: 128px;
}

.period-form .button-link,
.quick-filters .button-link {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

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

.dashboard-pie-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.dashboard-project-category-grid {
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
}

.dashboard-stacked-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-stacked-chart .pie-chart-wrap {
  min-height: 154px;
}

.stacked-chart-divider {
  height: 1px;
  background: var(--line);
}

.dashboard-wide {
  margin-bottom: 20px;
}

.apple-chart-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, #fff 12%), var(--panel));
}

[data-theme="dark"] .apple-chart-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, #2a3340 12%), var(--panel));
}

.chart-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.chart-title-row p {
  margin-top: 4px;
  font-size: 13px;
}

.chart-title-row > span {
  color: var(--muted);
  font-size: 12px;
}

.chart-bars {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.month-chart,
.dashboard-bars {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 120px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.bar-row i,
.bar-row b {
  display: block;
  width: var(--w);
  height: 12px;
  border-radius: 999px;
}

.bar-row i { background: var(--chart-positive); justify-self: start; }
.bar-row b { background: var(--chart-negative); justify-self: start; }
.bar-row em { color: var(--text); font-style: normal; text-align: right; }

a.bar-row:hover,
.dash-bar:hover {
  background: var(--panel-2);
}

.daily-expense-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(26px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 240px;
  margin-top: 18px;
  padding: 16px 8px 4px;
  border-bottom: 1px solid var(--line);
}

.monthly-finance-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  align-items: end;
  gap: 14px;
  min-height: 310px;
  margin-top: 16px;
  padding: 18px 10px 6px;
  border-bottom: 1px solid var(--line);
}

.monthly-finance-month {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 7px;
  min-height: 270px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}

.monthly-finance-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 6px;
  height: 100%;
}

.monthly-finance-bars i {
  display: block;
  min-height: 4px;
  height: max(4px, var(--h));
  border-radius: 10px 10px 3px 3px;
  transition: transform .16s ease, filter .16s ease;
}

.monthly-finance-bars .income,
.chart-legend .income {
  background: linear-gradient(180deg, color-mix(in srgb, var(--chart-positive) 48%, #fff 52%), var(--chart-positive));
}

.monthly-finance-bars .expense,
.chart-legend .expense {
  background: linear-gradient(180deg, color-mix(in srgb, var(--chart-negative) 46%, #fff 54%), var(--chart-negative));
}

.monthly-finance-month:hover .monthly-finance-bars i {
  filter: saturate(1.08) brightness(1.03);
  transform: translateY(-2px);
}

.monthly-finance-month:hover .daily-expense-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.monthly-finance-month > b {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.monthly-finance-month > em {
  overflow: hidden;
  max-width: 100%;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-grid {
  align-items: stretch;
}

.dashboard-action-panel {
  display: flex;
  flex-direction: column;
}

.dashboard-action-list {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.dashboard-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 78%, #fff 22%), var(--panel-2));
  color: var(--muted);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.dashboard-action-card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-1px);
}

.dashboard-action-card span {
  font-weight: 800;
}

.dashboard-action-card strong {
  color: var(--text);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.daily-expense-bar {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  min-height: 220px;
  color: var(--muted);
  text-align: center;
}

.daily-expense-bar i {
  display: block;
  width: 100%;
  min-height: 3px;
  height: max(3px, var(--h));
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--chart-negative), color-mix(in srgb, var(--chart-negative) 74%, var(--chart-3)));
  transition: transform .16s ease, filter .16s ease;
}

.daily-expense-bar b {
  margin-top: 8px;
  font-size: 11px;
}

.daily-expense-bar:hover i {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.daily-expense-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h) + 34px);
  z-index: 6;
  width: min(380px, 86vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .16s ease, transform .16s ease;
}

.daily-expense-tooltip strong,
.daily-expense-tooltip em,
.daily-expense-tooltip small {
  display: block;
}

.daily-expense-tooltip em {
  margin: 3px 0 6px;
  color: var(--danger);
  font-style: normal;
  font-weight: 800;
}

.daily-expense-tooltip small {
  color: var(--muted);
  line-height: 1.35;
}

.daily-expense-list {
  display: grid;
  gap: 5px;
}

.daily-expense-list > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.daily-expense-list span span {
  overflow-wrap: anywhere;
}

.daily-expense-list i {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.daily-expense-list b {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-expense-bar:hover .daily-expense-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dashboard-column-chart.month-columns {
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  min-height: 280px;
}

.dashboard-column-chart.daily-columns {
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  min-height: 240px;
}

.dashboard-column-bar i {
  background: linear-gradient(180deg, color-mix(in srgb, var(--chart-positive) 58%, #fff 42%), var(--chart-positive));
}

.dashboard-column-bar.is-negative i {
  background: linear-gradient(180deg, var(--chart-negative), color-mix(in srgb, var(--chart-negative) 72%, var(--chart-3)));
}

.dashboard-column-bar .daily-expense-tooltip em {
  color: var(--text);
}

.dashboard-column-bar.is-negative .daily-expense-tooltip em {
  color: var(--chart-negative);
}

.dashboard-column-bar.is-positive .daily-expense-tooltip em {
  color: var(--chart-positive);
}

.comparison-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  align-items: end;
  gap: 14px;
  min-height: 280px;
  padding: 18px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.comparison-previous-area {
  position: absolute;
  inset: 18px 12px 34px;
  width: calc(100% - 24px);
  height: calc(100% - 52px);
  overflow: visible;
  pointer-events: none;
}

.comparison-previous-area .area {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
}

.comparison-previous-area .line {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 46%, var(--muted));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 6 8;
  opacity: .78;
  vector-effect: non-scaling-stroke;
}

.comparison-month {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  min-width: 0;
  min-height: 240px;
  color: var(--muted);
  text-decoration: none;
}

.comparison-bars {
  display: flex;
  align-items: end;
  justify-content: stretch;
  height: 100%;
}

.comparison-bars i {
  display: block;
  width: 100%;
  min-height: 2px;
  height: max(2px, var(--h));
  border-radius: 12px 12px 5px 5px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 32%, transparent), 0 12px 24px color-mix(in srgb, var(--chart-negative) 11%, transparent);
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.comparison-bars .current,
.chart-legend .current {
  background: linear-gradient(180deg, var(--chart-negative), color-mix(in srgb, var(--chart-negative) 72%, var(--chart-3)));
}

.comparison-bars .current {
  opacity: .74;
}

.comparison-bars .previous {
  background: color-mix(in srgb, var(--accent) 24%, var(--panel));
}

.chart-legend .previous,
.chart-legend .previous-line {
  background: color-mix(in srgb, var(--accent) 44%, var(--muted));
}

.chart-legend .previous-line {
  height: 4px;
  border-radius: 999px;
}

.comparison-month:hover .comparison-bars i {
  filter: saturate(1.1);
  opacity: .92;
  transform: translateY(-2px);
}

.comparison-month:hover .daily-expense-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.comparison-month > b {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.dash-bar {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(90px, 2fr) minmax(90px, auto);
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.dash-bar:hover {
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 78%, #fff 22%), var(--panel-2));
  transform: translateY(-1px);
}

[data-theme="dark"] .dash-bar:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 82%, #fff 6%), var(--panel-2));
}

.dash-bar > span:first-child {
  overflow: hidden;
  color: var(--muted);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-track {
  display: block;
  position: relative;
  height: 20px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 72%, #fff 28%), color-mix(in srgb, var(--panel-2) 92%, #000 8%));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 72%, transparent);
}

.dash-track i {
  display: block;
  width: var(--w);
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 34%, transparent), 0 4px 12px color-mix(in srgb, var(--accent) 16%, transparent);
  transition: width .2s ease, filter .16s ease;
}

.dash-track b {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: var(--w);
  height: 4px;
  min-width: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 24%, var(--muted));
  opacity: .65;
}

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

.budget-compare-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(160px, 2fr) minmax(110px, auto);
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 74%, transparent);
  color: inherit;
  text-decoration: none;
  transition: background .16s ease, transform .16s ease;
}

.budget-compare-row:hover {
  background: color-mix(in srgb, var(--accent) 9%, var(--panel-2));
  transform: translateY(-1px);
}

.budget-compare-row strong {
  display: block;
  color: var(--text);
}

.budget-compare-row span {
  color: var(--muted);
  font-size: 12px;
}

.budget-compare-row em {
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.budget-compare-track {
  position: relative;
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 42%, transparent);
}

.budget-compare-track i,
.budget-compare-track b {
  position: absolute;
  left: 0;
  display: block;
  border-radius: 999px;
}

.budget-compare-track i {
  top: 4px;
  width: var(--w);
  height: 14px;
  background: linear-gradient(90deg, var(--accent), var(--chart-2));
}

.budget-compare-track b {
  bottom: 2px;
  width: var(--w);
  height: 4px;
  background: color-mix(in srgb, var(--accent) 34%, var(--muted));
}

.dash-bar.is-positive .dash-track i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--chart-positive) 68%, #fff 32%), var(--chart-positive));
}

.dash-bar.is-negative .dash-track i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--chart-negative) 64%, #fff 36%), var(--chart-negative));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 34%, transparent), 0 4px 12px color-mix(in srgb, var(--chart-negative) 18%, transparent);
}

.dash-bar:hover .dash-track i {
  filter: saturate(1.08) brightness(1.02);
}

.dash-bar strong {
  display: grid;
  gap: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dash-bar strong small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.expense-stacked-chart {
  display: grid;
  position: relative;
  grid-auto-flow: column;
  grid-auto-columns: minmax(58px, 1fr);
  align-items: end;
  gap: 12px;
  min-height: 300px;
  overflow-x: auto;
  padding: 18px 4px 8px;
}

.expense-previous-area {
  position: absolute;
  inset: 18px 4px 48px;
  z-index: 0;
  width: calc(100% - 8px);
  height: calc(100% - 66px);
  overflow: visible;
  pointer-events: none;
}

.expense-previous-area .area {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
}

.expense-previous-area .line {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 48%, var(--muted));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 7;
  vector-effect: non-scaling-stroke;
}

.expense-month-stack {
  display: grid;
  position: relative;
  z-index: 1;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  min-width: 58px;
  min-height: 260px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  transition: transform .16s ease, filter .16s ease;
}

.expense-month-stack i {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  width: 100%;
  height: var(--h);
  min-height: 3px;
  overflow: hidden;
  border-radius: 10px 10px 4px 4px;
  background: color-mix(in srgb, var(--line) 55%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 35%, transparent), 0 10px 22px color-mix(in srgb, var(--accent) 10%, transparent);
}

.expense-month-stack i span {
  display: block;
  height: var(--h);
  min-height: 3px;
  background: var(--c);
  opacity: .78;
}

.expense-month-stack b {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.expense-month-stack em {
  color: var(--danger);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.expense-month-stack:hover {
  filter: saturate(1.08);
  transform: translateY(-2px);
}

.expense-month-stack:hover .expense-month-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.expense-month-tooltip {
  bottom: calc(var(--h) + 46px);
  width: min(230px, 82vw);
}

.expense-month-stack.is-active-filter i,
.expense-category-bars .dash-bar.is-active-filter {
  outline: 2px solid color-mix(in srgb, var(--accent) 68%, transparent);
  outline-offset: 3px;
}

.expense-category-bars .dash-bar.is-active-filter {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}

.expense-category-legend {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.expense-category-legend .legend-current {
  background: var(--chart-negative);
}

.expense-category-legend .legend-previous-area {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 62%, transparent);
}

.expense-category-bars .dash-track i {
  background: var(--row-color, var(--chart-negative));
}

.category-lines {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.category-line-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 14px;
  background:
    radial-gradient(circle at 90% 10%, color-mix(in srgb, var(--line-color) 16%, transparent), transparent 36%),
    var(--panel-2);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.category-line-card:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-1px);
}

.category-line-card > div {
  display: grid;
  gap: 4px;
}

.category-line-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-line-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.category-line-card svg {
  width: 100%;
  height: 72px;
  overflow: visible;
}

.category-line-card path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.category-line-card .previous-area {
  fill: color-mix(in srgb, var(--line-color) 12%, transparent);
  stroke: none;
}

.category-line-card .current {
  stroke: var(--line-color);
  stroke-width: 2.2;
  filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--line-color) 16%, transparent));
}

.category-line-card .previous {
  stroke: color-mix(in srgb, var(--line-color) 42%, var(--muted));
  stroke-dasharray: 5 7;
  stroke-width: 1.6;
  opacity: .72;
}

.category-line-legend .current-line {
  background: var(--accent);
}

.category-line-legend .previous-line {
  background: color-mix(in srgb, var(--accent) 44%, var(--muted));
  opacity: .72;
}

.pie-chart-wrap {
  display: grid;
  grid-template-columns: minmax(128px, 160px) 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

.pie-chart {
  position: relative;
  width: min(160px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow:
    inset 0 0 0 22px color-mix(in srgb, var(--panel) 82%, transparent),
    inset 0 0 0 25px color-mix(in srgb, var(--line) 36%, transparent),
    0 18px 46px color-mix(in srgb, var(--accent) 16%, transparent);
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, color-mix(in srgb, #fff 70%, transparent), transparent 38%),
    var(--panel);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 78%, transparent), 0 8px 26px color-mix(in srgb, #000 12%, transparent);
}

.pie-legend {
  display: grid;
  gap: 7px;
}

.pie-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.pie-legend-item:hover {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: var(--panel-2);
  transform: translateY(-1px);
}

.pie-legend-item i {
  width: 10px;
  height: 22px;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 36%, transparent);
}

.pie-legend-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend-item strong,
.pie-legend-item em {
  color: var(--text);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pie-legend-item em {
  min-width: 38px;
  color: var(--muted);
  text-align: right;
}

.pie-legend-item strong.neg {
  color: var(--danger);
}

.pie-legend-item strong.pos {
  color: var(--good);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.two-col,
.three-col {
  display: grid;
  gap: 18px;
}

.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.bulkbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 16px;
  padding: 12px;
  margin-bottom: 14px;
}

.bulkbar form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  min-width: 0;
}

.bulk-details summary {
  display: none;
}

.bulk-buttons {
  display: flex;
  gap: 8px;
  align-self: end;
}

.bulk-buttons button {
  white-space: nowrap;
}

.bulkbar label {
  color: var(--muted);
  font-size: 12px;
}

.selection-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  max-width: 100%;
}

.selection-actions button {
  min-height: 32px;
  padding: 6px 10px;
}

.selection-actions label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: auto;
  min-width: 0;
  max-width: none;
  line-height: 1.2;
  white-space: nowrap;
}

.selection-actions label input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
}

.bulkbar input,
.bulkbar select {
  min-height: 36px;
}

.movement-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.movement-filter-form label {
  color: var(--muted);
  font-size: 12px;
}

.movement-filter-form input,
.movement-filter-form select {
  min-height: 46px;
}

.movement-filter-form button,
.movement-filter-form .button-link {
  min-height: 46px;
  padding: 10px 18px;
  align-self: end;
}

.movement-filter-form span {
  color: var(--muted);
  font-size: 13px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-note {
  margin: 6px 0 12px;
  font-size: 13px;
}

.table-limit-note {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--muted);
  font-weight: 800;
}

.data-table th,
.data-table td {
  min-width: 0;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.data-table th a {
  color: inherit;
  text-decoration: none;
}

.data-table .column-filters th {
  padding: 8px 6px;
  background: var(--panel-2);
  cursor: default;
}

.data-table .column-filters input[type="text"],
.data-table .column-filters input:not([type]) {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.column-filter-control {
  display: grid;
  gap: 4px;
}

.column-filter-control label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  text-transform: none;
}

.column-filter-control input[type="checkbox"] {
  width: 14px;
  min-width: 14px;
  min-height: 14px;
  padding: 0;
}

.data-table .num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tfoot td {
  padding: 12px 10px;
  border-top: 2px solid var(--line);
  font-weight: 800;
  background: var(--panel-2);
}

.data-table .wrap-cell {
  max-width: 520px;
  white-space: normal;
}

#movements {
  table-layout: auto;
  min-width: max(100%, 1280px);
  width: 100%;
}

#movements th:nth-child(1),
#movements td:nth-child(1) { width: 42px; }
#movements th:nth-child(2),
#movements td:nth-child(2) { width: 1%; min-width: 92px; }
#movements th:nth-child(3),
#movements td:nth-child(3) { width: 1%; min-width: 116px; max-width: 160px; }
#movements th:nth-child(4),
#movements td:nth-child(4) { width: auto; min-width: 220px; max-width: 520px; }
#movements th:nth-child(5),
#movements td:nth-child(5) { width: 1%; min-width: 110px; }
#movements th:nth-child(6),
#movements td:nth-child(6) { width: 1%; min-width: 116px; max-width: 170px; }
#movements th:nth-child(7),
#movements td:nth-child(7) { width: 1%; min-width: 118px; max-width: 180px; }
#movements th:nth-child(8),
#movements td:nth-child(8) { width: 1%; min-width: 82px; }
#movements th:nth-child(9),
#movements td:nth-child(9) { width: 1%; min-width: 92px; }
#movements th:nth-child(10),
#movements td:nth-child(10) { width: 1%; min-width: 92px; }
#movements th:nth-child(11),
#movements td:nth-child(11) { width: auto; min-width: 150px; max-width: 360px; }
#movements th:nth-child(12),
#movements td:nth-child(12) { width: 86px; }

#movements .movement-description-cell {
  min-width: 220px;
}

#movements td:nth-child(11) [data-view] {
  min-width: 0;
}

#movements .movement-description-cell [data-view] {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#movements td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#movements th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#movements .column-filters input[type="text"],
#movements .column-filters input:not([type]) {
  min-width: 0;
}

#movements td [data-view] {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#movements td.num-cell [data-view] {
  text-align: right;
}

#movements .truncate-cell [data-view] {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#movements tr.is-editing .movement-description-cell [data-edit] {
  min-width: 100%;
}

#movements tbody tr[data-incomplete="0"] {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

#movements tbody tr[data-incomplete="1"] {
  background: var(--panel);
}

#movements tbody tr[data-incomplete="0"]:hover {
  background: color-mix(in srgb, var(--accent) 17%, var(--panel));
}

#movements tbody tr[data-incomplete="1"]:hover {
  background: var(--panel-2);
}

.data-table tbody tr:hover { background: var(--panel-2); }
.data-table input[type="checkbox"] { width: 18px; min-height: 18px; }
.pos { color: var(--good); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
code { color: var(--accent-2); }

[data-edit] {
  display: none;
}

.data-table tr.is-editing {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.data-table tr.is-editing [data-view] {
  display: none;
}

.data-table tr.is-editing [data-edit] {
  display: block;
  min-width: 120px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 13px;
}

.data-table tr.is-editing input[type="hidden"][data-edit] {
  display: none;
}

.data-table tr.is-editing td:nth-child(4) [data-edit] {
  min-width: 260px;
}

.inline-edit-button {
  min-height: 32px;
  padding: 6px 10px;
}

.data-table tr.is-editing .inline-edit-button {
  background: var(--good);
  color: #fff;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 14px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  margin-right: 6px;
}

.pagination a {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  text-decoration: none;
}

.inline-admin {
  display: grid;
  grid-template-columns: 120px 120px 170px auto;
  gap: 8px;
  align-items: center;
}

.inline-admin input,
.inline-admin select {
  min-height: 34px;
  padding: 6px 8px;
}

.inline-admin button {
  min-height: 34px;
  padding: 7px 10px;
}

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

.support-form textarea {
  min-height: 140px;
  resize: vertical;
}

.support-form span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

.support-form button {
  justify-self: start;
}

.status-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-form select {
  min-height: 34px;
}

.support-reply-form {
  display: grid;
  gap: 8px;
  min-width: 280px;
}

.support-status-form {
  display: grid;
  gap: 4px;
  min-width: 280px;
  margin-bottom: 8px;
}

.autosave-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.support-status-form select,
.support-reply-form select,
.support-reply-form textarea,
.support-reply-form button {
  min-height: 34px;
}

.support-reply-form textarea {
  min-height: 74px;
  resize: vertical;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(620px, calc(100% - 28px));
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0,0,0,.42); }
.modal-form { display: grid; gap: 14px; padding: 22px; }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 0; }
menu button:first-child { background: var(--panel-2); color: var(--text); }

@media (max-width: 980px) {
  .budget-compare-row {
    grid-template-columns: 1fr;
  }

  .budget-compare-row em {
    text-align: left;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    max-height: none;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 10px;
  }

  .brand {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  .brand-logo img {
    width: 136px;
    max-height: 42px;
  }

  .brand-logo.logo-switch {
    min-width: 136px;
  }

  .brand strong {
    width: auto;
    font-size: 12px;
  }

  .brand-user {
    width: auto;
    min-width: 150px;
    max-width: 260px;
    padding: 7px 9px;
  }

  .brand-user span,
  .brand-user em {
    font-size: 9px;
  }

  .brand-user b {
    font-size: 12px;
  }

  nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  nav a,
  .logout,
  .theme-form button {
    flex: 0 0 auto;
    padding: 9px 10px;
    white-space: nowrap;
  }

  .theme-form {
    margin-top: 0;
  }

  .main {
    margin-left: 0;
    padding: 16px;
  }

  .page-head {
    display: grid;
    gap: 12px;
  }

  .page-head h1 {
    font-size: 26px;
  }

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

  .dashboard-head p {
    margin-top: 2px;
  }

  .page-actions {
    justify-content: stretch;
  }

  .page-actions > *,
  .page-actions button,
  .page-actions .button-link {
    flex: 1 1 160px;
  }

  .panel {
    padding: 14px;
    margin-bottom: 14px;
  }

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

  .dashboard-period-switcher {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 0;
    padding: 9px;
  }

  .dashboard-period-switcher > span {
    margin-left: 0;
    text-align: center;
  }

  .period-stepper {
    grid-template-columns: 38px 1fr 38px;
  }

  .kpis div {
    padding: 14px;
  }

  .kpis strong {
    font-size: 20px;
  }

  .dashboard-filter-details summary {
    min-height: 46px;
    padding: 11px 14px;
  }

  .dashboard-filter-details .dashboard-controls {
    padding: 0 14px 14px;
  }

  .two-col,
  .three-col,
  .grid-form,
  .dashboard-grid,
  .master-panel > .stack,
  .master-row,
  .project-create-row,
  .category-create-row,
  .project-master-row,
  .category-master-row,
  .inline-admin,
  .bulkbar,
  .bulkbar form {
    grid-template-columns: 1fr;
  }

  .bulkbar {
    position: static;
    gap: 10px;
    padding: 10px;
  }

  .bulk-details {
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .bulk-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text);
    font-weight: 800;
    list-style: none;
  }

  .bulk-details summary::-webkit-details-marker {
    display: none;
  }

  .bulk-details summary::after {
    content: "+";
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
  }

  .bulk-details[open] summary::after {
    content: "-";
  }

  .bulk-details:not([open]) form {
    display: none;
  }

  .period-form,
  .quick-filters,
  .movement-filter-form,
  .section-title,
  .selection-panel,
  .selection-actions,
  .bulk-buttons {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .period-form label,
  .movement-filter-form label {
    min-width: 0;
  }

  .project-create-row input[type="color"],
  .project-master-row input[type="color"],
  .category-create-row input[type="color"],
  .category-master-row input[type="color"],
  .category-master-row button {
    width: 100%;
  }

  .project-master-row {
    grid-template-columns: minmax(170px, 1fr) 44px 74px 74px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .project-master-row input[type="color"] {
    width: 44px;
    min-width: 44px;
    height: 38px;
    padding: 3px;
  }

  .project-master-row button {
    width: 74px;
    min-width: 74px;
    padding-inline: 6px;
    font-size: 12px;
  }

  .master-panel > .category-create-row {
    grid-template-columns: 54px minmax(0, 1fr) 118px;
    gap: 10px;
  }

  .category-master-row {
    grid-template-columns: 54px minmax(0, 1fr) 86px 86px;
    gap: 10px;
  }

  .category-create-row input[name="name"],
  .category-master-row input[name="name"],
  .category-master-row select {
    grid-column: 1 / -1;
  }

  .category-create-row select {
    grid-column: 1 / 3;
  }

  .category-create-row input[type="color"],
  .category-master-row input[type="color"] {
    grid-column: 1;
    width: 54px;
    min-width: 54px;
    height: 46px;
    padding: 3px;
  }

  .category-create-row input[name="name"],
  .category-create-row select,
  .category-master-row input[name="name"],
  .category-master-row select {
    min-height: 48px;
    font-size: 16px;
  }

  .category-create-row .check-row {
    grid-column: 3;
  }

  .category-master-row .check-row {
    grid-column: 2 / -1;
  }

  .category-create-row .check-row,
  .category-master-row .check-row {
    min-height: 46px;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .category-master-row button,
  .category-create-row button {
    width: 86px;
    min-width: 86px;
    min-height: 46px;
    padding: 8px 6px;
    font-size: 13px;
  }

  .category-create-row button {
    grid-column: 2 / -1;
    width: 100%;
    min-width: 0;
  }

  .category-master-row button[name="action"][value="update_category"] {
    grid-column: 3;
  }

  .category-master-row button[name="action"][value="delete_category"] {
    grid-column: 4;
  }

  .movement-filter-form button,
  .movement-filter-form .button-link,
  .quick-filters .button-link,
  .bulk-buttons button,
  .selection-actions button,
  .selection-actions label {
    width: 100%;
  }

  .table-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 860px;
    font-size: 13px;
  }

  #movements {
    min-width: 1280px;
  }

  .data-table th,
  .data-table td {
    padding: 9px 8px;
  }

  .data-table .wrap-cell {
    max-width: 360px;
  }

  .dash-bar {
    grid-template-columns: 1fr;
  }

  .category-lines {
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 72vw);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

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

  .pie-chart {
    width: min(190px, 70vw);
    justify-self: center;
  }

  .bar-row {
    grid-template-columns: 72px 1fr 1fr 92px;
  }

  .daily-expense-chart,
  .dashboard-column-chart.daily-columns,
  .dashboard-column-chart.month-columns,
  .monthly-finance-chart {
    grid-auto-flow: column;
    grid-auto-columns: 36px;
    grid-template-columns: none;
    justify-content: start;
    gap: 7px;
    min-height: 190px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .comparison-chart {
    grid-auto-flow: column;
    grid-auto-columns: 40px;
    grid-template-columns: none;
    justify-content: start;
    gap: 10px;
    min-height: 190px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .comparison-month {
    min-height: 165px;
  }

  .daily-expense-bar {
    min-height: 165px;
  }

  .daily-expense-bar b,
  .comparison-month > b {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .dashboard-column-chart.month-columns {
    grid-auto-columns: 44px;
  }

  .monthly-finance-chart {
    grid-auto-columns: 62px;
    min-height: 230px;
  }

  .monthly-finance-month {
    min-height: 195px;
  }

  .monthly-finance-month > em {
    display: none;
  }

  .daily-expense-tooltip {
    width: min(300px, 82vw);
  }

  dialog {
    width: calc(100% - 20px);
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .sidebar {
    padding: 10px;
  }

  .brand {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .brand-logo img {
    width: 118px;
  }

  .brand strong {
    font-size: 11px;
  }

  .brand-user {
    min-width: 0;
    max-width: calc(100vw - 24px);
    grid-column: 1 / -1;
  }

  .brand-user small,
  .brand-user em {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .auth-card {
    padding: 22px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .dashboard-head h1 {
    font-size: 22px;
  }

  .dashboard-head p {
    font-size: 13px;
  }

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

  .segmented-control {
    width: 100%;
  }

  .period-stepper strong {
    font-size: 15px;
  }

  .kpis .kpi-card {
    padding: 12px;
  }

  .kpis span {
    font-size: 11px;
  }

  .kpis strong {
    font-size: 18px;
  }

  .kpi-trend {
    display: none;
  }

  .dashboard-filter-details {
    margin-bottom: 12px;
  }

  .dashboard-filter-details summary {
    grid-template-columns: auto 1fr auto;
  }

  button,
  .button-link,
  .mini-link {
    width: 100%;
  }

  .dashboard-filter {
    display: grid;
  }

  .dashboard-filter a {
    margin-left: 0;
  }

  .apple-chart-card {
    overflow-x: auto;
  }

  .daily-expense-chart,
  .dashboard-column-chart.daily-columns,
  .dashboard-column-chart.month-columns,
  .monthly-finance-chart {
    grid-auto-columns: 38px;
    min-width: max-content;
  }

  .dashboard-column-chart.month-columns {
    grid-auto-columns: 46px;
  }

  .monthly-finance-chart {
    grid-auto-columns: 64px;
  }

  .expense-stacked-chart {
    grid-auto-columns: minmax(48px, 56px);
    min-width: max-content;
  }

  .expense-month-stack {
    min-height: 230px;
  }

  .dashboard-action-card {
    min-height: 54px;
    padding: 12px;
  }

  .comparison-chart {
    grid-auto-columns: 42px;
    min-width: max-content;
  }

  .chart-title-row {
    display: grid;
  }

  .modal-form {
    padding: 16px;
  }

  menu {
    display: grid;
  }
}
