:root {
  --bg: #f7e4cf;
  --bg-secondary: #fdf5ea;
  --card: rgba(255, 250, 245, 0.92);
  --card-strong: #fff7ef;
  --text: #3f2317;
  --muted: #86624b;
  --line: rgba(166, 111, 79, 0.22);
  --accent: #d86f3d;
  --accent-soft: #ffd9bc;
  --accent-strong: #b24b27;
  --danger: #b33042;
  --danger-soft: #ffd8dd;
  --success-soft: #dff7d8;
  --shadow: 0 18px 40px rgba(121, 66, 37, 0.14);
  --radius: 24px;
  --surface-glow: radial-gradient(circle at top left, rgba(255, 214, 153, 0.55), transparent 40%);
  --panel-gradient: linear-gradient(180deg, rgba(255, 248, 241, 0.98) 0%, rgba(255, 243, 230, 0.94) 100%);
  --theme-meta: #d86f3d;
  --category-1-color: #db6d52;
  --category-2-color: #d88c2d;
  --category-3-color: #7b9b47;
  --category-4-color: #c7567d;
  --category-5-color: #8d5fd3;
  --category-6-color: #4397a8;
  --category-7-color: #e65f94;
  --category-8-color: #b45d2b;
  --category-9-color: #6f7f2c;
  --category-10-color: #8f4b86;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  position: relative;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 207, 148, 0.82), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 153, 102, 0.28), transparent 26%),
    linear-gradient(180deg, #f8d8bd 0%, var(--bg) 260px);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

body::before {
  top: -120px;
  left: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 241, 209, 0.95) 0%, rgba(255, 241, 209, 0) 70%);
}

body::after {
  right: -100px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border-radius: 40% 60% 53% 47%;
  background: radial-gradient(circle, rgba(236, 164, 129, 0.4) 0%, rgba(236, 164, 129, 0) 68%);
}

body.auth-screen {
  background: linear-gradient(180deg, #fff3e3 0%, #f9e3ca 100%);
}

body[data-theme="default"] {
  --bg: #f7e4cf;
  --bg-secondary: #fdf5ea;
  --card: rgba(255, 250, 245, 0.92);
  --card-strong: #fff7ef;
  --text: #3f2317;
  --muted: #86624b;
  --line: rgba(166, 111, 79, 0.22);
  --accent: #d86f3d;
  --accent-soft: #ffd9bc;
  --accent-strong: #b24b27;
  --danger: #b33042;
  --danger-soft: #ffd8dd;
  --success-soft: #dff7d8;
  --shadow: 0 18px 40px rgba(121, 66, 37, 0.14);
  --surface-glow: radial-gradient(circle at top left, rgba(255, 214, 153, 0.55), transparent 40%);
  --panel-gradient: linear-gradient(180deg, rgba(255, 248, 241, 0.98) 0%, rgba(255, 243, 230, 0.94) 100%);
  --theme-meta: #d86f3d;
}

body[data-theme="groovy"] {
  --bg: #ffe56f;
  --bg-secondary: #fff4bf;
  --card: rgba(255, 248, 232, 0.9);
  --card-strong: rgba(255, 253, 242, 0.96);
  --text: #4b195d;
  --muted: #7a4b2b;
  --line: rgba(130, 26, 157, 0.2);
  --accent: #ff4f9f;
  --accent-soft: #ffd8ec;
  --accent-strong: #ff7a18;
  --danger: #d7263d;
  --danger-soft: #ffd5dd;
  --success-soft: #dcffca;
  --shadow: 0 20px 44px rgba(155, 58, 112, 0.18);
  --surface-glow:
    radial-gradient(circle at top left, rgba(255, 111, 145, 0.55), transparent 36%),
    radial-gradient(circle at top right, rgba(96, 218, 255, 0.35), transparent 28%);
  --panel-gradient:
    linear-gradient(135deg, rgba(255, 249, 191, 0.94) 0%, rgba(255, 225, 248, 0.92) 48%, rgba(214, 255, 191, 0.9) 100%);
  --theme-meta: #ff4f9f;
  --category-1-color: #ff5470;
  --category-2-color: #ff9f1c;
  --category-3-color: #2ec4b6;
  --category-4-color: #9b5de5;
  --category-5-color: #00bbf9;
  --category-6-color: #f15bb5;
  --category-7-color: #fee440;
  --category-8-color: #00f5d4;
  --category-9-color: #fb5607;
  --category-10-color: #8338ec;
}

a { color: var(--accent); }

.wrap {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.4fr 1fr;
  align-items: stretch;
  margin-bottom: 24px;
}

.panel {
  background:
    var(--surface-glow),
    var(--panel-gradient),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-main {
  padding: 30px;
}

.hero-main h1 {
  margin: 0 0 10px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.hero-main p {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.6;
}

.hero-side {
  padding: 22px;
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.app-logout-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.app-logout-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-screen-card {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.login-screen-button {
  min-width: 240px;
}

.login-screen-message {
  max-width: 320px;
  text-align: center;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

body.is-auth-locked #appShell,
body.is-auth-locked .app-logout-button {
  display: none;
}

body:not(.is-auth-locked) #loginScreen {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.checkbox-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.people-manager {
  display: grid;
  gap: 18px;
}

.people-list {
  display: grid;
  gap: 6px;
}

.category-manager-sidebar {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.category-manager-inline {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.category-manage-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.person-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.person-meta {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.person-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-count {
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.compact-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.icon-action {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.icon-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-action:disabled:hover {
  border-color: var(--line);
  color: var(--muted);
}

.icon-action-danger:hover {
  border-color: #fca5a5;
  color: var(--danger);
}

.category-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-inline {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #f8fafc;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
  border: 1px solid var(--line);
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
}

.icon-button i {
  font-size: 16px;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, white);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}

.btn-add i {
  font-size: 16px;
  line-height: 1;
}

.toolbar-stack {
  display: grid;
  gap: 8px;
  height: 100%;
  align-self: stretch;
}

.btn-half {
  height: 100%;
  padding-block: 0;
  padding-inline: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  width: 300px;
  min-width: 300px;
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 16px;
  overflow: hidden;
  transition: width 180ms ease, min-width 180ms ease, padding 180ms ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle i {
  transition: transform 180ms ease;
}

.sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (min-width: 981px) {
  .sidebar-toggle i {
    transform: rotate(-90deg);
  }

  .layout.is-sidebar-collapsed {
    grid-template-columns: 68px 1fr;
  }

  .sidebar.is-collapsed {
    width: 68px;
    min-width: 68px;
    padding-inline: 10px;
  }

  .sidebar.is-collapsed #sidebarContent,
  .sidebar.is-collapsed .sidebar-head h2 {
    display: none;
  }

  .sidebar.is-collapsed .sidebar-head {
    justify-content: center;
  }

  .sidebar.is-collapsed .sidebar-toggle i {
    transform: rotate(90deg);
  }
}

.sidebar-section + .sidebar-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.sidebar h2, .content h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.category-list {
  display: grid;
  gap: 10px;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.category-pill {
  border-left: 4px solid var(--category-color, var(--line));
  padding-left: 12px;
}

.category-pill.active {
  border-color: var(--category-color, var(--accent));
  background: color-mix(in srgb, var(--category-color, var(--accent)) 14%, white);
}

.pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pill small {
  color: var(--muted);
}

.content {
  display: grid;
  gap: 18px;
}

.section {
  padding: 20px;
}

.filters-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.55), transparent 32%),
    linear-gradient(135deg, rgba(255, 248, 239, 0.9) 0%, rgba(255, 236, 217, 0.86) 100%);
  position: relative;
  overflow: hidden;
}

.filters-panel.is-collapsed {
  display: none;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filters-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-switcher {
  min-width: 170px;
}

.theme-switcher label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.theme-switcher select {
  min-height: 44px;
  background: rgba(255, 255, 255, 0.82);
}

.sort-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-controls > .btn-add,
.section-controls > .filter-toggle {
  flex: 0 0 44px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  width: 44px;
  padding: 0;
  line-height: 1;
}

.filter-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-flip-vertical {
  transform: scaleY(-1);
}


.sort-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-weight: 600;
}

.filter-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-chip-category {
  background: color-mix(in srgb, var(--category-color, #cbd5e1) 14%, white);
  border-color: color-mix(in srgb, var(--category-color, #cbd5e1) 28%, white);
  color: color-mix(in srgb, var(--category-color, #374151) 88%, black);
}

.filter-chip-category.is-active {
  background: color-mix(in srgb, var(--category-color, #cbd5e1) 22%, white);
  border-color: var(--category-color, var(--accent));
  color: color-mix(in srgb, var(--category-color, #1f2937) 92%, black);
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  height: 52px;
}

.view-toggle .btn-ghost {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  line-height: 1;
}

.view-toggle .btn-ghost i {
  font-size: 16px;
}

.view-toggle .btn-ghost.is-active {
  background: var(--accent);
  color: white;
}

.view-toggle .btn-ghost:disabled {
  opacity: 0.6;
  cursor: default;
}

.cards {
  display: grid;
  gap: 14px;
}

.cards.cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cards.cards-list {
  grid-template-columns: 1fr;
}

.cards.cards-chart {
  grid-template-columns: 1fr;
}

.chart-view {
  width: 100%;
}

.pie-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.pie-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.pie-panel-head h3 {
  margin: 0;
}

.chart-surface {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.96) 0%, rgba(255, 255, 255, 0.92) 22%),
    white;
  box-shadow: var(--shadow);
  padding: 14px 14px 8px;
  min-width: 0;
  overflow: hidden;
}

.chart-stage {
  width: 100%;
}

.pie-stage {
  min-height: 360px;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie-stage .apexcharts-canvas,
.pie-stage .apexcharts-svg,
.pie-stage foreignObject {
  max-width: 100%;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 248, 240, 0.92) 100%);
  display: grid;
  gap: 12px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  box-shadow: 0 12px 30px rgba(121, 66, 37, 0.08);
}

.card.is-draggable {
  cursor: grab;
}

.card.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.card.is-dragging-touch {
  position: fixed;
  z-index: 30;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  opacity: 0.96;
  cursor: grabbing;
}

.drag-placeholder {
  border: 1px dashed var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, white);
}

.card.drag-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, white);
}

.cards-list .card {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  padding: 14px 18px;
}

.card-top,
.list-main {
  min-width: 0;
}

.card-heading-block,
.list-title-group {
  min-width: 0;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.cards-list .list-main {
  display: grid;
  gap: 4px;
}

.list-row-shell {
  display: block;
}

.list-content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.card-title-row,
.list-title-group {
  display: grid;
  gap: 4px;
}

.list-heading h3 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.list-provider {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.drag-handle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.cards-list .card-top > div:first-child,
.cards-list .list-main {
  min-width: 0;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.title-amount {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}

.title-amount small {
  font-weight: 500;
  opacity: 0.8;
}

.cards-list .card h3,
.cards-list .meta,
.cards-list .list-notes {
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--line);
}

.tag-category {
  background: color-mix(in srgb, var(--category-color, #cbd5e1) 14%, white);
  border-color: color-mix(in srgb, var(--category-color, #cbd5e1) 28%, white);
  color: color-mix(in srgb, var(--category-color, #374151) 88%, black);
  font-weight: 700;
}

.tag-amount-debet {
  color: #be123c;
}

.tag-amount-credit {
  color: #15803d;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cards-list .card-actions {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  min-width: 120px;
  justify-self: end;
}

.cards-list .card-actions .btn-secondary,
.cards-list .card-actions .btn-ghost {
  width: 100%;
}

.cards-list .card-actions .icon-button {
  width: 44px;
}

.cards-list .list-notes {
  margin: 0;
  line-height: 1.35;
}

.list-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cards-list .list-meta-row .card-actions {
  margin-left: auto;
  display: grid;
  grid-auto-flow: column;
  align-items: center;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fafcff;
}

.helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 22px;
  max-width: 760px;
  width: calc(100% - 24px);
  box-shadow: 0 30px 80px rgba(98, 47, 19, 0.28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.modal-grid .full {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.success-box {
  position: fixed;
  top: 20px;
  right: 64px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 96px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
  color: #166534;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
  display: none;
}

.success-box.show {
  display: block;
}

.success-box.is-error {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

body[data-theme="groovy"] {
  background:
    radial-gradient(circle at top left, rgba(255, 117, 143, 0.48), transparent 24%),
    radial-gradient(circle at 15% 18%, rgba(255, 241, 118, 0.78), transparent 20%),
    radial-gradient(circle at 82% 9%, rgba(103, 232, 249, 0.48), transparent 18%),
    linear-gradient(135deg, #fff48a 0%, #ffd166 18%, #ff99c8 46%, #b8f2e6 72%, #fefae0 100%);
}

body[data-theme="groovy"]::before {
  top: 24px;
  left: 28px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 241, 118, 0.95) 0 16%, transparent 17% 22%, rgba(255, 79, 159, 0.78) 23% 34%, transparent 35% 40%, rgba(46, 196, 182, 0.7) 41% 52%, transparent 53%);
  filter: blur(1px);
}

body[data-theme="groovy"]::after {
  right: 18px;
  bottom: 18px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.84) 0 10%, transparent 11%),
    conic-gradient(from 0deg, #ff4f9f, #ff9f1c, #fee440, #2ec4b6, #00bbf9, #9b5de5, #ff4f9f);
  box-shadow: 0 0 40px rgba(255, 79, 159, 0.22);
  opacity: 0.9;
}

body[data-theme="groovy"] .panel,
body[data-theme="groovy"] .filters-panel,
body[data-theme="groovy"] .card,
body[data-theme="groovy"] .chart-surface {
  border-width: 2px;
}

body[data-theme="groovy"] .hero-main h1,
body[data-theme="groovy"] .content h2,
body[data-theme="groovy"] .sidebar h2 {
  color: #6b1da5;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}

body[data-theme="groovy"] .filters-panel {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 25%),
    linear-gradient(120deg, rgba(255, 245, 153, 0.92) 0%, rgba(255, 209, 232, 0.9) 34%, rgba(204, 255, 153, 0.86) 68%, rgba(180, 242, 230, 0.9) 100%);
}

body[data-theme="groovy"] .filters-panel::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -24px;
  width: 110px;
  height: 110px;
  background:
    radial-gradient(circle, #fff 0 16%, transparent 17%),
    conic-gradient(from 0deg, #ff4f9f, #ff9f1c, #fee440, #2ec4b6, #9b5de5, #ff4f9f);
  border-radius: 50%;
  opacity: 0.85;
  transform: rotate(18deg);
}

body[data-theme="groovy"] .filter-chip,
body[data-theme="groovy"] .tag,
body[data-theme="groovy"] .btn-ghost,
body[data-theme="groovy"] .btn-secondary,
body[data-theme="groovy"] .theme-switcher select,
body[data-theme="groovy"] input,
body[data-theme="groovy"] select,
body[data-theme="groovy"] textarea,
body[data-theme="groovy"] .checkbox-group,
body[data-theme="groovy"] .pill,
body[data-theme="groovy"] .stat {
  background: rgba(255, 255, 255, 0.68);
}

body[data-theme="groovy"] .view-toggle .btn-ghost.is-active,
body[data-theme="groovy"] .btn-primary {
  background: linear-gradient(135deg, #ff4f9f 0%, #ff7a18 45%, #ffd60a 100%);
  color: #fffafc;
}

body[data-theme="groovy"] .filter-chip.is-active,
body[data-theme="groovy"] .sort-button.is-active,
body[data-theme="groovy"] .filter-toggle.is-active {
  background: linear-gradient(135deg, rgba(255, 79, 159, 0.18) 0%, rgba(255, 214, 10, 0.28) 100%);
  color: #8a145f;
  border-color: #ff4f9f;
}

@media (max-width: 980px) {
  .hero, .layout, .filters-grid {
    grid-template-columns: 1fr;
  }

  .success-box {
    top: 64px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .sidebar {
    position: static;
    width: auto;
    min-width: 0;
  }

  .sidebar-toggle i {
    transform: rotate(0deg);
  }

  .sidebar.is-collapsed #sidebarContent {
    display: none;
  }

  .sidebar.is-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
  }

  .cards-list .card {
    grid-template-columns: 1fr;
  }

  .cards-list .card-actions {
    flex-direction: row;
    justify-content: flex-start;
    min-width: 0;
  }

  .cards-list .card-actions .btn-secondary,
  .cards-list .card-actions .btn-ghost {
    width: auto;
  }

  .cards-list .card-actions .icon-button {
    width: 44px;
  }

  .inline-form,
  .category-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - 20px, 1200px);
  }

  .view-toggle {
    display: inline-flex;
    height: 44px;
    gap: 4px;
    padding: 3px;
  }

  .view-toggle .btn-ghost {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .view-toggle .btn-ghost i {
    font-size: 14px;
  }

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

  .hero-main, .hero-side, .section, .sidebar, .modal {
    padding: 18px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .cards-list .card {
    gap: 8px;
    padding: 12px 14px;
    border-radius: 14px;
  }

  .cards-list .list-row-shell {
    display: block;
  }

  .cards-list .list-content {
    gap: 8px;
  }

  .cards-list .drag-handle {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    color: var(--muted);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .cards-list .drag-handle i {
    font-size: 16px;
  }

  .cards-list .card.show-drag-handle .drag-handle {
    display: inline-flex;
  }

  .cards-list .card.show-drag-handle .list-row-shell {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .cards-list .list-main {
    gap: 2px;
  }

  .cards-list .list-heading {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: start;
  }

  .cards-list .list-provider {
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
  }

  .cards-list .list-title-group,
  .card-title-row {
    gap: 2px;
  }

  .cards-list .title-amount,
  .card-title-row .title-amount {
    font-size: 12px;
  }

  .cards-list .list-heading h3 {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cards-list .card h3 {
    font-size: 17px;
    margin-bottom: 2px;
  }

  .cards-list .meta,
  .cards-list .list-notes {
    font-size: 13px;
    line-height: 1.35;
  }

  .cards-list .tag {
    padding: 4px 8px;
    font-size: 11px;
  }

  .cards-list .tag-people,
  .cards-list .tag-category {
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cards-list .list-notes {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .cards-list .list-meta-row {
    gap: 5px;
  }

  .cards-list .card-actions {
    gap: 6px;
    justify-self: end;
    display: grid;
    grid-auto-flow: column;
    align-items: center;
  }

  .cards-list .icon-button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
}
