/* ═══════════════════════════════════════════════
   PEAKWEALTH — Frosted Glass Design System
   ═══════════════════════════════════════════════ */

/* ── Custom Properties ── */
:root {
  /* Colors – Dark Theme (default) */
  --bg-from: #000000;
  --bg-to: #000000;
  --orb-1: #6c47ff55;
  --orb-2: #1e9fff44;
  --orb-3: #ff4f7b33;

  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-blur: blur(20px);

  --nav-bg: rgba(10, 10, 26, 0.72);
  --nav-border: rgba(255, 255, 255, 0.08);

  --text-primary: #f0f0ff;
  --text-secondary: rgba(240, 240, 255, 0.55);
  --text-tertiary: rgba(240, 240, 255, 0.3);

  --accent: #7c6dfa;
  --accent-hover: #9b8eff;
  --accent-glow: rgba(124, 109, 250, 0.35);

  --positive: #34d399;
  --negative: #f87171;

  --cat-giro: #60a5fa;
  --cat-crypto: #f59e0b;
  --cat-aktien: #34d399;
  --cat-kreditkarte: #f87171;

  --input-bg: rgba(255, 255, 255, 0.07);
  --input-border: rgba(255, 255, 255, 0.14);
  --input-focus: rgba(124, 109, 250, 0.45);

  --divider: rgba(255, 255, 255, 0.08);
  --card-radius: 20px;
  --modal-radius: 24px;
  --pill-radius: 100px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
}

[data-theme="light"] {
  --bg-from: #ffffff;
  --bg-to: #ffffff;
  --orb-1: #6c47ff30;
  --orb-2: #1e9fff22;
  --orb-3: #ff4f7b18;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px rgba(100, 120, 200, 0.15);

  --nav-bg: rgba(230, 234, 250, 0.75);
  --nav-border: rgba(255, 255, 255, 0.6);

  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.6);
  --text-tertiary: rgba(26, 26, 46, 0.35);

  --accent: #6c47ff;
  --accent-hover: #5535e8;
  --accent-glow: rgba(108, 71, 255, 0.2);

  --input-bg: rgba(255, 255, 255, 0.7);
  --input-border: rgba(108, 71, 255, 0.2);
  --input-focus: rgba(108, 71, 255, 0.35);
  --divider: rgba(26, 26, 46, 0.1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  min-height: 100dvh;
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background var(--transition);
}

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }
#app-screen.active { display: flex; }

/* ═══════════════════════════════════════════════
   GLASS UTILITIES
   ═══════════════════════════════════════════════ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: var(--glass-shadow);
}

.glass-nav {
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--nav-border);
}

.glass-banner {
  background: rgba(124, 109, 250, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 109, 250, 0.3);
  border-radius: 14px;
}

/* ═══════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════ */
#auth-screen {
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
#auth-screen.active {
  display: flex;
}

.auth-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orb-float 8s ease-in-out infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  top: -100px; left: -100px;
  background: var(--orb-1);
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  bottom: -80px; right: -80px;
  background: var(--orb-2);
  animation-delay: -3s;
}
.orb-3 {
  width: 300px; height: 300px;
  top: 40%; left: 50%;
  background: var(--orb-3);
  animation-delay: -6s;
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.97); }
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  border-radius: var(--modal-radius);
}

.auth-logo { text-align: center; margin-bottom: 32px; }

.logo-full-img {
  width: 220px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
  filter: invert(1) drop-shadow(0 0 24px var(--accent-glow));
}

[data-theme="light"] .logo-full-img {
  filter: invert(0) drop-shadow(0 0 12px rgba(108, 71, 255, 0.2));
}

[data-theme="light"] .topbar-logo {
  filter: invert(0);
}

.logo-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 0;
}

/* Auth Tabs — removed (registration disabled) */

/* Auth Forms */
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active { display: flex; }

.auth-actions { display: flex; justify-content: flex-end; margin-top: -8px; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}
.link-btn:hover { color: var(--accent-hover); }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.input-group input,
.input-group select,
.input-group textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  width: 100%;
  -webkit-appearance: none;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: var(--text-tertiary);
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--input-focus);
  background: var(--input-bg);
}

.input-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237c6dfa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-group select option {
  background: #1a1a2e;
  color: #f0f0ff;
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #9b8eff 100%);
  color: #fff;
  border: none;
  border-radius: var(--pill-radius);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
  filter: brightness(1.1);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary.btn-full { width: 100%; margin-top: 8px; }
.btn-primary svg { width: 18px; height: 18px; stroke: currentColor; pointer-events: none; }

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-secondary);
  border: 1px solid var(--input-border);
  border-radius: var(--pill-radius);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--glass-bg); color: var(--text-primary); }

.btn-icon-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-icon-round:hover { transform: scale(1.1); filter: brightness(1.15); }

.btn-loader { font-size: 10px; letter-spacing: 4px; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════
   ERROR / SUCCESS MESSAGES
   ═══════════════════════════════════════════════ */
.error-msg {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #f87171;
}

.success-msg {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--positive);
}

/* ═══════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════ */
#app-screen {
  min-height: 100dvh;
  flex-direction: column;
}

/* ── Top Bar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-top: none;
  border-left: none;
  border-right: none;
  border-radius: 0 0 20px 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 26px;
  height: 26px;
  display: block;
  filter: invert(1);
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.icon-btn:hover { background: var(--glass-bg); border-color: var(--accent); }

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  pointer-events: none;
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #9b8eff 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── User Dropdown ── */
#user-dropdown {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 200;
  min-width: 200px;
  padding: 12px;
  border-radius: 16px;
  animation: dropdown-in var(--transition);
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-email {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 8px 8px;
  word-break: break-all;
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 4px 0;
}

.dropdown-item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--negative);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  transition: background var(--transition-fast);
}

.dropdown-item:hover { background: rgba(248, 113, 113, 0.1); }

/* ── Update Banner ── */
.update-banner {
  position: fixed;
  top: 68px;
  left: 16px;
  right: 16px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  animation: slide-down 0.35s var(--transition);
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.banner-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  padding: 80px 16px 100px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-bottom: none;
  border-left: none;
  border-right: none;
  border-radius: 20px 20px 0 0;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 14px;
  transition: all var(--transition);
  color: var(--text-tertiary);
}

.nav-btn.active { color: var(--accent); }

.nav-btn:hover { background: var(--glass-bg); }

.nav-icon { font-size: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 20px; height: 20px; stroke: currentColor; pointer-events: none; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }

/* ═══════════════════════════════════════════════
   VIEWS
   ═══════════════════════════════════════════════ */
.view { display: none; flex-direction: column; gap: 16px; }
.view.active { display: flex; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.date-badge {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--pill-radius);
  padding: 4px 10px;
}

/* ── Total Wealth Card ── */
.total-wealth-card {
  padding: 28px 24px;
  text-align: center;
}

.total-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.total-amount {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.total-change {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.total-change.positive { color: var(--positive); }
.total-change.negative { color: var(--negative); }

/* ── Currency Toggle ── */
.currency-toggle {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.currency-chip {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--pill-radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  padding: 4px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.04em;
}

.currency-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.currency-chip:not(.active):hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Value + Currency row in modal ── */
.value-currency-row {
  display: flex;
  gap: 8px;
}

.value-currency-row input {
  flex: 1;
}

.value-currency-row select {
  width: 90px;
  flex-shrink: 0;
  padding-right: 28px;
}

/* ── Currency badge on account cards ── */
.currency-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(124, 109, 250, 0.12);
  border: 1px solid rgba(124, 109, 250, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Chart Section ── */
.chart-section {
  padding: 20px;
}

.pie-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.pie-center-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pie-center-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background var(--transition-fast);
}

.legend-item:hover { background: var(--input-bg); }

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

.legend-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

.legend-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.legend-pct {
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 36px;
  text-align: right;
}

/* ── Category Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.category-card {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: default;
  transition: transform var(--transition), box-shadow var(--transition);
}

.category-card:hover { transform: translateY(-2px); }

.cat-icon { font-size: 28px; display: flex; align-items: center; }
.cat-icon svg { width: 28px; height: 28px; stroke: currentColor; }

.cat-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.cat-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* ── Filter / Range Chips ── */
.filter-row, .time-range-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.filter-chip, .range-chip {
  padding: 7px 16px;
  border-radius: var(--pill-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip.active, .range-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 12px var(--accent-glow);
}

/* ── Accounts List ── */
.accounts-list, .orders-list, .history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  animation: card-in 0.25s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.account-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.account-icon svg { width: 22px; height: 22px; stroke: currentColor; }

.account-icon.giro        { background: rgba(96, 165, 250, 0.15); }
.account-icon.crypto      { background: rgba(245, 158, 11, 0.15); }
.account-icon.aktien      { background: rgba(52, 211, 153, 0.15); }
.account-icon.kreditkarte { background: rgba(248, 113, 113, 0.15); color: var(--cat-kreditkarte); }

.account-info { flex: 1; min-width: 0; }

.account-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.account-right { text-align: right; flex-shrink: 0; }

.account-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.account-value.negative { color: var(--negative); }

.account-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

.action-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-primary);
  opacity: 0.65;
  transition: opacity var(--transition-fast);
  padding: 8px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn svg { width: 14px; height: 14px; stroke: currentColor; pointer-events: none; }

.action-btn:hover { opacity: 1; }

/* ── Order Cards ── */
.order-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  animation: card-in 0.25s ease;
}

.order-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.order-icon svg { width: 22px; height: 22px; stroke: currentColor; }

.order-icon.income  { background: rgba(52, 211, 153, 0.15); }
.order-icon.expense { background: rgba(248, 113, 113, 0.15); }

.order-info { flex: 1; min-width: 0; }

.order-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.order-amount {
  font-size: 17px;
  font-weight: 700;
}

.order-amount.income  { color: var(--positive); }
.order-amount.expense { color: var(--negative); }

/* ── History List ── */
.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: 16px;
  animation: card-in 0.25s ease;
}

.history-date { font-size: 13px; color: var(--text-secondary); }
.history-val  { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.history-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.history-change {
  font-size: 13px;
  font-weight: 500;
}

.history-change.pos { color: var(--positive); }
.history-change.neg { color: var(--negative); }

/* ── Line Chart ── */
.line-chart-wrapper {
  margin-top: 16px;
  overflow: hidden;
}

#line-chart { width: 100%; height: auto; }

/* ── Orders Summary ── */
.orders-summary {
  padding: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 0;
}

.summary-row hr { margin: 4px 0; }

.summary-total { font-weight: 700; color: var(--text-primary); font-size: 15px; }
.summary-positive { color: var(--positive); font-weight: 600; }
.summary-negative { color: var(--negative); font-weight: 600; }

.orders-summary hr {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 6px 0;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon { font-size: 48px; }
.empty-icon svg { width: 48px; height: 48px; stroke: currentColor; opacity: 0.45; }
.empty-state p { font-size: 15px; }
.empty-sub { font-size: 13px; color: var(--text-tertiary); }
.empty-state .btn-primary { margin-top: 4px; }

/* ═══════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════ */
.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlay-in 0.2s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-slide-up {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal {
  position: static !important;
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  padding: 0 24px 36px;
  border-radius: 28px 28px 0 0;
  flex-shrink: 0;
  height: fit-content;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(10, 10, 28, 0.92);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top: 1px solid rgba(124, 109, 250, 0.35);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
  animation: modal-slide-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Drag handle pill */
.modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  margin: 14px auto 22px;
}

[data-theme="light"] .modal {
  background: rgba(240, 240, 255, 0.92);
  border-top-color: rgba(108, 71, 255, 0.25);
  box-shadow: 0 -8px 40px rgba(100, 120, 200, 0.2), 0 0 0 1px rgba(108,71,255,0.1);
}

[data-theme="light"] .modal::before {
  background: rgba(26, 26, 46, 0.15);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.modal-header {
  position: static !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-header h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover { background: rgba(124,109,250,0.15); color: var(--text-primary); border-color: var(--accent); }

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary {
  flex: 1;
}

/* ═══════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(30, 30, 60, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--pill-radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 999;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (min-width: 480px) {
  .modal {
    border-radius: var(--modal-radius);
    max-width: 440px;
  }

  .modal-overlay {
    align-items: center;
  }

  .topbar { border-radius: 0; }
  .bottom-nav { border-radius: 0; }
}

/* ═══════════════════════════════════════════════
   DESKTOP LAYOUT (≥ 768px)
   ═══════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* ── Sidebar Navigation (replaces bottom nav) ── */
  .bottom-nav {
    top: 0;
    bottom: 0;
    right: auto;
    width: 220px;
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 80px 12px 32px;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid var(--nav-border);
    gap: 4px;
  }

  .nav-btn {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    width: 100%;
  }

  .nav-label { font-size: 14px; }

  /* ── Topbar shifts right of sidebar ── */
  .topbar { left: 220px; }

  /* ── Main content shifts right of sidebar ── */
  .main-content {
    margin-left: 220px;
    margin-right: 0;
    width: auto;
    max-width: none;
    padding: 80px 32px 48px;
  }

  /* ── Dashboard: 2-column grid ── */
  #view-dashboard.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "header header"
      "wealth chart"
      "cats   chart"
      "btn    btn";
    gap: 20px;
    align-items: start;
  }

  #view-dashboard .section-header    { grid-area: header; margin-bottom: 0; }
  #view-dashboard .total-wealth-card { grid-area: wealth; }
  #view-dashboard .chart-section     { grid-area: chart; align-self: stretch; }
  #view-dashboard .category-grid     { grid-area: cats; }
  #view-dashboard #snapshot-btn      { grid-area: btn; }

  /* ── Accounts: 2-column card grid ── */
  .accounts-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .accounts-list .empty-state { grid-column: 1 / -1; }

  /* ── Orders: 2-column card grid ── */
  .orders-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .orders-list .empty-state { grid-column: 1 / -1; }

  /* ── History: 2-column entry grid ── */
  .history-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-list .empty-state { grid-column: 1 / -1; }

  /* ── Centered modal on desktop ── */
  .modal-overlay { align-items: center; }
  .modal {
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 440px;
    animation: modal-slide-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .modal::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
