﻿:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-alt: #f1f3f9;
  --border: rgba(15, 23, 42, 0.08);
  --primary: #5468ff;
  --primary-dark: #3640d0;
  --positive: #1fbfb8;
  --negative: #f25f5c;
  --text: #0f172a;
  --text-soft: rgba(15, 23, 42, 0.65);
  --text-muted: rgba(15, 23, 42, 0.45);
  --shadow: 0 22px 45px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --transition: 0.25s ease;

  --scrollbar-track: var(--surface);
  --scrollbar-thumb: rgba(15, 23, 42, 0.25);
  --scrollbar-thumb-hover: rgba(15, 23, 42, 0.45);
}
[data-theme='dark'] {
  --bg: #0c1220;
  --surface: #10182b;
  --surface-alt: #0f1a33;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e6e9ef;
  --text-soft: rgba(230, 233, 239, 0.85);
  --text-muted: rgba(230, 233, 239, 0.6);
  --shadow: 0 22px 45px rgba(0, 0, 0, 0.35);

  --scrollbar-track: #0f1627;
  --scrollbar-thumb: rgba(232, 238, 248, 0.25);
  --scrollbar-thumb-hover: rgba(232, 238, 248, 0.45);
}

[data-theme='dark-blue'] {
  --bg: #0b1220;
  --surface: #0f1b33;
  --surface-alt: #0c2a4a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eef8;
  --text-soft: rgba(232, 238, 248, 0.9);
  --text-muted: rgba(232, 238, 248, 0.65);
  --primary: #4a74ff;
  --primary-dark: #3757db;
  --shadow: 0 22px 45px rgba(3, 13, 36, 0.45);

  --scrollbar-track: #0f1b33;
  --scrollbar-thumb: rgba(122, 146, 255, 0.35);
  --scrollbar-thumb-hover: rgba(122, 146, 255, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
html[data-theme='dark'],
html[data-theme='dark-blue'] {
  color-scheme: dark;
}

button, input, select, textarea {
  font: inherit;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

h1, h2, h3, h4, h5 {
  margin: 0;
}

p {
  margin: 0;
  color: var(--text-soft);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  width: 100%;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: 70;
}

.sidebar-backdrop.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: var(--surface-alt);
  border-color: rgba(15, 23, 42, 0.12);
}

.menu-toggle-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: background var(--transition);
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform var(--transition), opacity var(--transition);
}

.menu-toggle-icon::before { top: -6px; }
.menu-toggle-icon::after { top: 6px; }

.menu-toggle[aria-expanded="true"] .menu-toggle-icon {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
  transform: translateY(-6px) rotate(-45deg);
}

.chart-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 320px;
}

.chart-panel .chart-body {
  height: 260px;
}

.chart-body canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 100%;
}

.chart-empty {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 0;
}
.brand-icon .brand-img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; }

.brand h1 {
  font-size: 24px;
  font-weight: 700;
}

.brand span {
  color: var(--text-muted);
  font-size: 14px;
}

.nav {
  display: grid;
  gap: 12px;
}

.nav-link {
  appearance: none;
  border: none;
  background: transparent;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(84, 104, 255, 0.16), rgba(84, 104, 255, 0.08));
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(84, 104, 255, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.content {
  padding: 32px 40px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.topbar-text h2 {
  font-size: 28px;
  font-weight: 600;
}

.topbar-text p {
  margin-top: 4px;
  max-width: 520px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(84, 104, 255, 0.35);
  outline-offset: 2px;
}

.primary {
  background: linear-gradient(135deg, var(--primary), #7a8cff);
  color: white;
  box-shadow: 0 15px 35px rgba(84, 104, 255, 0.25);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 45px rgba(84, 104, 255, 0.25);
}

.secondary {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 10px 30px rgba(84, 104, 255, 0.14);
}

.secondary:hover {
  background: linear-gradient(135deg, rgba(84, 104, 255, 0.08), rgba(84, 104, 255, 0.16));
  transform: translateY(-1px);
}

.ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.ghost:hover {
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.2);
}

.ghost.danger {
  color: var(--negative);
  border-color: rgba(242, 95, 92, 0.2);
}

.ghost.danger:hover {
  background: rgba(242, 95, 92, 0.08);
  color: var(--negative);
  border-color: rgba(242, 95, 92, 0.45);
}

.view {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.view.active {
  display: flex;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(84, 104, 255, 0.16), transparent 45%);
  opacity: 0.9;
}

.stat-card > * {
  position: relative;
  z-index: 1;
}

.stat-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.stat-subtext {
  margin-top: 8px;
  color: var(--text-muted);
}

.stat-breakdown { margin-top: 8px; color: var(--text-muted); font-size: 14px; display: grid; gap: 4px; }
.stat-breakdown .line { display: flex; justify-content: space-between; }

.panel-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 20px;
}
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel.large {
  grid-column: 1 / -1;
}

.panel.medium {
  min-height: 360px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  padding: 24px;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-weight: 600;
  font-size: 20px;
}

.panel-header p {
  margin-top: 4px;
  color: var(--text-muted);
}

.panel-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
}

#recent-transactions {
  display: grid;
  gap: 16px;
}

.progress-bar {
  height: 6px;
  background: rgba(84, 104, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width var(--transition);
}


.cookie-notice[hidden] { display: none !important; }
.cookie-notice {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0 16px 16px;
  z-index: 200;
}
.cookie-notice__content {
  margin: 0 auto;
  max-width: 840px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cookie-notice__content p { color: var(--text-soft); font-size: 14px; }
.cookie-notice__actions { display: flex; gap: 8px; }

.transaction-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.transaction-item .avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(84, 104, 255, 0.12);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--primary-dark);
}

.transaction-item .label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.text-muted,
.transaction-item small {
  color: var(--text-muted);
  font-size: 13px;
}

.transaction-item .amount {
  font-weight: 600;
}

.transaction-item.deposit .amount {
  color: var(--positive);
}

.transaction-item.withdrawal .amount {
  color: var(--negative);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.section-header p {
  margin-top: 4px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filters select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 140px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.filters select:focus {
  outline: none;
  border-color: rgba(84, 104, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(84, 104, 255, 0.16);
}

.plan-list {
  display: grid;
  gap: 20px;
}

.plan-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.plan-card header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-card header h3 {
  font-size: 22px;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 10px;
  box-shadow: 0 0 0 4px rgba(84, 104, 255, 0.12);
  vertical-align: middle;
}

.plan-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 14px;
}

.plan-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-progress strong {
  font-size: 24px;
}

.plan-status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--text-muted);
}

.plan-status-row strong {
  font-size: 26px;
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(84, 104, 255, 0.14);
  color: var(--primary-dark);
}

.status-badge.danger {
  background: rgba(242, 95, 92, 0.16);
  color: var(--negative);
}

.plan-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-details {
  color: var(--text-soft);
  line-height: 1.6;
}

.plan-empty {
  text-align: center;
}

.empty-state {
  padding: 64px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  color: var(--text-soft);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.empty-state.active {
  display: flex;
}

.transaction-table {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.transaction-table table {
  width: 100%;
  border-collapse: collapse;
}

.transaction-table thead {
  background: var(--surface-alt);
}

.transaction-table th,
.transaction-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.transaction-table tbody tr:hover {
  background: rgba(84, 104, 255, 0.08);
}

.transaction-table .type-deposit {
  color: var(--positive);
  font-weight: 600;
}

.transaction-table .type-withdrawal {
  color: var(--negative);
  font-weight: 600;
}

.settings-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.settings-body {
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  transition: border var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: rgba(84, 104, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(84, 104, 255, 0.16);
  outline: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.input-with-hint {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-with-hint span {
  color: var(--text-muted);
  font-size: 14px;
}

.toggle-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.toggle-field h4 {
  margin-bottom: 4px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  transition: background var(--transition);
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.15);
}

.switch input:checked + .slider {
  background: rgba(84, 104, 255, 0.45);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.security-status {
  font-weight: 500;
  display: flex;
  gap: 8px;
  align-items: center;
}

.security-description {
  color: var(--text-soft);
  font-size: 14px;
}

.security-form {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.data-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: min(500px, 100%);
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.modal-dialog.small {
  width: min(360px, 100%);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title { display: inline-flex; align-items: center; gap: 8px; }
.modal-title .modal-icon { width: 20px; height: 20px; border-radius: 4px; }

.modal-body {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.icon-button {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.icon-button:hover {
  color: var(--text);
}

.modal-hint {
  font-size: 14px;
  color: var(--text-muted);
}

.toast-container {
  position: fixed;
  right: 32px;
  bottom: 32px;
  display: grid;
  gap: 12px;
  z-index: 150;
}

.toast {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  min-width: 260px;
  animation: slide-in 0.3s ease forwards;
}

.toast.success { border-color: var(--positive); }
.toast.error { border-color: var(--negative); }

.toast h4 {
  margin-bottom: 6px;
  font-size: 16px;
}

.toast p {
  font-size: 14px;
  color: var(--text-muted);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.transaction-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.plan-highlight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.plan-highlight i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.badge {
  background: rgba(84, 104, 255, 0.12);
  color: var(--primary-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.transaction-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 36px;
}

.content {
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}