:root,
html[data-theme="light"] {
  --bg: #e8eef5;
  --shell: rgba(255, 255, 255, 0.72);
  --card: rgba(255, 255, 255, 0.88);
  --sidebar: #0b1c2c;
  --sidebar-deep: #06131f;
  --accent: #0891b2;
  --accent-bright: #06b6d4;
  --accent-soft: rgba(8, 145, 178, 0.12);
  --text: #0f1b2d;
  --muted: #5a6b7d;
  --border: rgba(15, 40, 60, 0.12);
  --expense: #e11d48;
  --credit: #059669;
  --balance: #0891b2;
  --shadow: 0 8px 28px rgba(15, 40, 60, 0.08);
  --search-bg: rgba(15, 40, 60, 0.05);
  --surface-2: rgba(15, 40, 60, 0.04);
  --surface-3: rgba(15, 40, 60, 0.08);
  --hover-row: rgba(8, 145, 178, 0.08);
  --hero-grad: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 40%, rgba(224, 242, 254, 0.9) 100%);
  --body-glow-1: rgba(6, 182, 212, 0.22);
  --body-glow-2: rgba(14, 165, 233, 0.16);
  --chart-grid: rgba(15, 40, 60, 0.08);
  --chart-tick: #5a6b7d;
  --scroll-thumb: #9bb0c4;
  --kpi-expense-bg: rgba(225, 29, 72, 0.1);
  --kpi-credit-bg: rgba(5, 150, 105, 0.1);
  --kpi-count-bg: rgba(217, 119, 6, 0.12);
  --kpi-count-color: #d97706;
  --glass: rgba(255, 255, 255, 0.55);
  --hud: #0891b2;
  --grid-line: rgba(15, 40, 60, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #050a12;
  --shell: rgba(10, 18, 32, 0.78);
  --card: rgba(12, 22, 38, 0.82);
  --sidebar: #07101c;
  --sidebar-deep: #040a12;
  --accent: #22d3ee;
  --accent-bright: #67e8f9;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --text: #e8f1f8;
  --muted: #7a90a8;
  --border: rgba(34, 211, 238, 0.14);
  --expense: #fb7185;
  --credit: #34d399;
  --balance: #22d3ee;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --search-bg: rgba(34, 211, 238, 0.06);
  --surface-2: rgba(34, 211, 238, 0.05);
  --surface-3: rgba(34, 211, 238, 0.08);
  --hover-row: rgba(34, 211, 238, 0.08);
  --hero-grad: linear-gradient(135deg, rgba(8, 16, 28, 0.95) 30%, rgba(8, 40, 55, 0.85) 100%);
  --body-glow-1: rgba(34, 211, 238, 0.14);
  --body-glow-2: rgba(14, 165, 233, 0.1);
  --chart-grid: rgba(34, 211, 238, 0.08);
  --chart-tick: #7a90a8;
  --scroll-thumb: #2a4058;
  --kpi-expense-bg: rgba(251, 113, 133, 0.14);
  --kpi-credit-bg: rgba(52, 211, 153, 0.14);
  --kpi-count-bg: rgba(251, 191, 36, 0.14);
  --kpi-count-color: #fbbf24;
  --glass: rgba(8, 16, 28, 0.6);
  --hud: #22d3ee;
  --grid-line: rgba(34, 211, 238, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
  overflow-x: hidden;
  position: relative;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.7;
  animation: orbDrift 18s ease-in-out infinite;
}

.bg-orb--a {
  width: 520px;
  height: 520px;
  top: -12%;
  left: -8%;
  background: var(--body-glow-1);
}

.bg-orb--b {
  width: 420px;
  height: 420px;
  top: 20%;
  right: -10%;
  background: var(--body-glow-2);
  animation-delay: -7s;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
}

/* —— Sidebar —— */
.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  height: calc(100vh - 32px);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  border-radius: 18px;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  color: #e8f1f8;
  border: 1px solid rgba(34, 211, 238, 0.18);
  box-shadow: inset 0 1px 0 rgba(34, 211, 238, 0.12);
  z-index: 40;
  transition: transform 0.35s var(--ease);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanLine 4s linear infinite;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: grid;
  place-items: center;
  color: var(--accent-bright, #22d3ee);
  animation: brandPulse 3s ease-in-out infinite;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.12em;
  line-height: 1;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(34, 211, 238, 0.7);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(232, 241, 248, 0.7);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s, transform 0.2s var(--ease);
  font-size: 0.92rem;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(34, 211, 238, 0.08);
  color: #fff;
  border-color: rgba(34, 211, 238, 0.15);
}

.nav-item.active {
  background: rgba(34, 211, 238, 0.14);
  color: #67e8f9;
  font-weight: 600;
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: inset 3px 0 0 #22d3ee;
}

.nav-item.logout {
  margin-top: 8px;
  color: rgba(232, 241, 248, 0.55);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(34, 211, 238, 0.75);
  border-top: 1px solid rgba(34, 211, 238, 0.1);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: statusBlink 2s ease-out infinite;
}

/* —— Shell —— */
.shell {
  background: var(--shell);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  padding: 20px 24px 26px;
  min-width: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.menu-toggle {
  display: none;
}

.search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--search-bg);
  border-radius: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.search-wrap input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  color: var(--text);
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-kbd {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  animation: chipIn 0.35s var(--ease);
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

.chip button svg {
  width: 14px;
  height: 14px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, filter 0.2s;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  color: #041018;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn[hidden] {
  display: none;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle {
  position: relative;
}

.theme-toggle .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: block;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0e7490, #22d3ee);
  color: #041018;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.user-name {
  font-weight: 600;
  font-size: 0.88rem;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* —— Empty dashboard —— */
.dashboard-empty {
  display: grid;
  place-items: center;
  justify-items: center;
  gap: 12px;
  min-height: min(58vh, 520px);
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
  outline: none;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
  position: relative;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.dashboard-empty:hover,
.dashboard-empty:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
}

.dashboard-empty[hidden] {
  display: none;
}

.empty-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  animation: ringExpand 3s ease-out infinite;
}

.dashboard-empty svg {
  width: 36px;
  height: 36px;
  color: var(--accent);
  position: relative;
  z-index: 1;
}

.dashboard-empty p {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.dashboard-empty span {
  font-family: var(--mono);
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
}

/* —— Content grid —— */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.content-grid[hidden] {
  display: none;
}

.main-col,
.side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 50%, transparent), transparent);
  opacity: 0.6;
  pointer-events: none;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 12px 36px color-mix(in srgb, var(--accent) 8%, transparent);
}

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

.card-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hint {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge-today {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: center;
  overflow: hidden;
  position: relative;
  background: var(--hero-grad);
}

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: statusBlink 2s ease-out infinite;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-desc {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 42ch;
  font-size: 0.93rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.hero-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.hero-visual {
  position: relative;
  min-height: 160px;
  display: grid;
  place-items: center;
}

.hud-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--hud) 40%, transparent);
}

.hud-ring--outer {
  width: 150px;
  height: 150px;
  border-style: dashed;
  animation: spinSlow 24s linear infinite;
}

.hud-ring--mid {
  width: 110px;
  height: 110px;
  border-top-color: var(--hud);
  border-right-color: transparent;
  animation: spinSlow 10s linear infinite reverse;
}

.hud-core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent-bright), var(--accent) 55%, transparent 70%);
  opacity: 0.85;
  animation: corePulse 3s ease-in-out infinite;
}

.hero-stat-float {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card);
  backdrop-filter: blur(8px);
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
  animation: floatY 3.5s ease-in-out infinite;
  z-index: 1;
  white-space: nowrap;
}

.hero-stat-float svg {
  width: 16px;
  height: 16px;
  color: var(--credit);
}

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

.kpi {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-icon.expense {
  background: var(--kpi-expense-bg);
  color: var(--expense);
  border-color: color-mix(in srgb, var(--expense) 25%, transparent);
}

.kpi-icon.credit {
  background: var(--kpi-credit-bg);
  color: var(--credit);
  border-color: color-mix(in srgb, var(--credit) 25%, transparent);
}

.kpi-icon.balance {
  background: var(--accent-soft);
  color: var(--balance);
  border-color: color-mix(in srgb, var(--balance) 25%, transparent);
}

.kpi-icon.count {
  background: var(--kpi-count-bg);
  color: var(--kpi-count-color);
  border-color: color-mix(in srgb, var(--kpi-count-color) 25%, transparent);
}

.kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kpi-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.chart-wrap--donut {
  height: 220px;
  max-width: 280px;
  margin: 0 auto;
}

.donut-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.donut-legend li:hover,
.donut-legend li.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Lists */
.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow: auto;
}

.tx-item,
.top-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.2s;
  animation: fadeUp 0.4s var(--ease) both;
}

.tx-item:hover,
.top-item:hover {
  background: var(--hover-row);
}

.tx-avatar,
.top-rank {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

.tx-info,
.top-info {
  min-width: 0;
}

.tx-info strong,
.top-info strong {
  display: block;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-info span,
.top-info span {
  font-size: 0.72rem;
  color: var(--muted);
}

.tx-amount {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.tx-amount.negative {
  color: var(--credit);
}

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

/* Data table */
.data-table-card {
  min-width: 0;
}

.data-table-card[hidden] {
  display: none;
}

.data-table-head {
  align-items: flex-end;
  margin-bottom: 14px;
}

.data-table-head h2 {
  margin-bottom: 2px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.page-size select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 26px 7px 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  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='%237a90a8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.table-scroll {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  max-height: min(62vh, 560px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 860px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--card) 92%, var(--accent) 8%);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--hover-row);
}

.cell-desc {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cell-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.8rem;
}

.cell-num.negative {
  color: var(--credit);
}

.cell-num.positive {
  color: var(--expense);
}

.cat-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--search-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.page-btn svg {
  width: 16px;
  height: 16px;
}

.page-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.empty-state {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  padding: 20px 8px;
}

.empty-state[hidden] {
  display: none;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  position: relative;
  padding-left: 4px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: stretch;
  animation: fadeUp 0.4s var(--ease) both;
}

.timeline-time {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  padding-top: 12px;
  text-align: right;
}

.timeline-card {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 11px 12px;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}

.timeline-card:hover {
  transform: translateX(2px);
  border-color: var(--border);
}

.timeline-card.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.timeline-card.active .timeline-meta {
  color: color-mix(in srgb, var(--accent) 80%, var(--muted));
}

.timeline-card strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.timeline-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.top-item {
  grid-template-columns: 36px 1fr auto;
}

.top-rank {
  width: 34px;
  height: 34px;
  font-size: 0.75rem;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 18, 0.65);
  z-index: 30;
  backdrop-filter: blur(4px);
}

.overlay[hidden] {
  display: none;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: fadeUp 0.35s var(--ease);
  backdrop-filter: blur(12px);
}

.toast[hidden] {
  display: none;
}

.toast.error {
  border-color: color-mix(in srgb, var(--expense) 50%, transparent);
  color: var(--expense);
}

.toast.success {
  border-color: color-mix(in srgb, var(--credit) 50%, transparent);
  color: var(--credit);
}

/* Motion */
.fade-up {
  opacity: 0;
  animation: fadeUp 0.55s var(--ease) forwards;
  animation-delay: calc(var(--delay, 0) * 60ms);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes spinSlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes corePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes statusBlink {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes brandPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.25);
  }
  50% {
    box-shadow: 0 0 16px 2px rgba(34, 211, 238, 0.2);
  }
}

@keyframes scanLine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes orbDrift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, 20px);
  }
}

@keyframes ringExpand {
  0% {
    transform: scale(0.7);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-up,
  .bg-orb,
  .hud-ring,
  .hud-core,
  .hero-stat-float,
  .brand-icon,
  .status-dot,
  .pulse-dot,
  .empty-ring,
  .sidebar::before {
    animation: none !important;
  }

  .fade-up {
    opacity: 1;
  }
}

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

  .charts-row {
    grid-template-columns: 1fr;
  }

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

  .side-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    bottom: 10px;
    height: auto;
    width: min(260px, 82vw);
    transform: translateX(calc(-100% - 24px));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .overlay:not([hidden]) {
    display: block;
  }

  .menu-toggle {
    display: grid;
  }

  .shell {
    padding: 14px;
    border-radius: 14px;
  }

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

  .hero-visual {
    display: none;
  }

  .user-name {
    display: none;
  }

  .btn-primary span {
    display: none;
  }

  .search-kbd {
    display: none;
  }

  .side-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .btn-primary {
    padding: 10px 12px;
  }

  .donut-legend {
    grid-template-columns: 1fr;
  }
}

/* Scrollbars */
.table-scroll::-webkit-scrollbar,
.timeline::-webkit-scrollbar,
.top-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-scroll::-webkit-scrollbar-thumb,
.timeline::-webkit-scrollbar-thumb,
.top-list::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
}
