/* ============================================================
   WealthGuard — Global Styles
   Aesthetic: Refined dark luxury, editorial finance
   Fonts: Playfair Display + DM Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --bg-base: #0a0d12;
  --bg-surface: #111520;
  --bg-card: #161c2a;
  --bg-card-hover: #1c2436;
  --bg-input: #0e1219;
  --bg-overlay: rgba(10, 13, 18, 0.85);

  --border: rgba(255,255,255,0.07);
  --border-input: rgba(255,255,255,0.1);
  --border-active: rgba(212, 175, 55, 0.4);
  --bg-input-hover: rgba(255,255,255,0.03);

  --gold: #d4af37;
  --gold-light: #f0d060;
  --gold-muted: rgba(212, 175, 55, 0.15);
  --gold-glow: 0 0 20px rgba(212, 175, 55, 0.2);

  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.1);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.1);
  --purple: #a78bfa;

  --text-primary: #f0f2f5;
  --text-secondary: #8892a4;
  --text-muted: #4a5568;
  --text-gold: #d4af37;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.7);
  --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.15);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-w: 260px;
  --header-h: 64px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-secondary); }

.display-num {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* ============================================================
   LAYOUT — AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(212,175,55,0.08) 0%, transparent 60%),
    var(--bg-base);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-modal);
  animation: fadeSlideUp 0.5s ease both;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.auth-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), #a07830);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.auth-logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-title { font-size: 1.6rem; margin-bottom: 0.4rem; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 2rem; }

/* ============================================================
   LAYOUT — APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold), #a07830);
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.8rem 0.6rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--gold-muted);
  color: var(--gold);
  border: 1px solid rgba(212,175,55,0.2);
}

.nav-item .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

.sidebar-bottom {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,0.05); }

.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--gold), #a07830);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bg-base);
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.72rem; color: var(--text-muted); text-transform: capitalize; }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOP BAR */
.topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.3rem;
}

.page-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.page-subtitle { font-size: 0.8rem; color: var(--text-secondary); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notif-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.notif-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  border: 1.5px solid var(--bg-surface);
}

/* PAGE CONTENT */
.page-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0.25rem 0;
}

.card-meta { font-size: 0.8rem; color: var(--text-secondary); }

/* Stat card variants */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover::before { opacity: 1; }

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.icon-gold { background: var(--gold-muted); color: var(--gold); }
.icon-green { background: var(--green-bg); color: var(--green); }
.icon-red { background: var(--red-bg); color: var(--red); }
.icon-blue { background: var(--blue-bg); color: var(--blue); }

/* ============================================================
   FORMS — Comprehensive Design System
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; position: relative; }
.form-group:last-child { margin-bottom: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Form section divider */
.form-section {
  margin: 1.5rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.form-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Label ───────────────────────────────────────────────────── */
.form-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  letter-spacing: 0.03em;
  user-select: none;
}

.form-required {
  color: var(--red);
  font-size: 0.7rem;
  line-height: 1;
}

.form-label-optional {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

/* ── Base input/select/textarea (both .form-control and .form-input work) ── */
.form-control,
.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.95rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.form-control:hover,
.form-input:hover {
  border-color: rgba(255,255,255,0.15);
}

.form-control:focus,
.form-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(14, 18, 25, 0.95);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.12), 0 1px 4px rgba(0,0,0,0.3);
}

.form-control::placeholder,
.form-input::placeholder { color: var(--text-muted); font-size: 0.85rem; }

/* ── States ──────────────────────────────────────────────────── */
.form-control.error,
.form-input.error {
  border-color: var(--red);
  background: rgba(248,113,113,0.04);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.1);
}

.form-control.success,
.form-input.success {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.1);
}

.form-control:disabled,
.form-input:disabled,
.form-control[readonly],
.form-input[readonly] {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.05);
}

/* ── Select ──────────────────────────────────────────────────── */
select.form-control,
select.form-input,
.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238892a4' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

select.form-control option,
select.form-input option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

/* ── Textarea ────────────────────────────────────────────────── */
textarea.form-control,
textarea.form-input,
.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  padding-top: 0.75rem;
}

/* ── Input with icon prefix ──────────────────────────────────── */
.form-field {
  position: relative;
}

.form-field-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}

.form-field .form-control,
.form-field .form-input {
  padding-left: 2.4rem;
}

/* ── Input addons (prefix/suffix — e.g. currency symbol, %) ─── */
.form-addon-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.form-addon-wrap .form-control,
.form-addon-wrap .form-input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex: 1;
  min-width: 0;
}

.form-addon {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.form-addon-right {
  border-right: 1.5px solid rgba(255,255,255,0.08);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-addon-wrap .form-control:focus ~ .form-addon,
.form-addon-wrap .form-input:focus ~ .form-addon,
.form-addon-wrap:focus-within .form-addon {
  border-color: var(--gold);
}

/* ── Field with suffix (action button inside input) ─────────── */
.form-field-suffix {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.form-field .form-control.has-suffix,
.form-field .form-input.has-suffix {
  padding-right: 3rem;
}

/* ── Password toggle button ──────────────────────────────────── */
.btn-pw-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}
.btn-pw-toggle:hover { color: var(--text-secondary); }

/* ── Number input — hide spinners ────────────────────────────── */
.form-control.no-spin::-webkit-inner-spin-button,
.form-input.no-spin::-webkit-inner-spin-button,
input[type=number].no-spin::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=number].no-spin { -moz-appearance: textfield; }

/* ── Character counter ───────────────────────────────────────── */
.form-counter {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  transition: color 0.2s;
}
.form-counter.warn  { color: #fbbf24; }
.form-counter.over  { color: var(--red); }

/* ── Hints and validation messages ──────────────────────────── */
.form-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
}

.form-error {
  font-size: 0.74rem;
  color: var(--red);
  margin-top: 0.35rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  animation: slideDown 0.15s ease;
}

.form-success-msg {
  font-size: 0.74rem;
  color: var(--green);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Custom Checkbox / Radio ─────────────────────────────────── */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  accent-color: var(--gold);
  cursor: pointer;
  border-radius: 3px;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.form-check-label strong { color: var(--text-primary); }

/* ── Toggle switch ───────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  cursor: pointer;
  transition: 0.25s;
  border: 1.5px solid rgba(255,255,255,0.08);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--gold);
  border-color: var(--gold);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #0a0d12;
}

/* ── Input group (connected fields) ─────────────────────────── */
.form-input-group {
  display: flex;
  gap: 0;
}
.form-input-group .form-control:not(:last-child),
.form-input-group .form-input:not(:last-child) {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.form-input-group .form-control:not(:first-child),
.form-input-group .form-input:not(:first-child) {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.form-input-group > select { flex: 0 0 auto; width: auto; }

/* ── Amount + currency combo ─────────────────────────────────── */
.form-amount-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
}
.form-amount-group .form-control,
.form-amount-group .form-input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
  font-family: var(--font-mono);
}
.form-amount-group select {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  width: auto;
  min-width: 80px;
  border-left: 1.5px solid rgba(255,255,255,0.04) !important;
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.7rem 1.8rem 0.7rem 0.7rem;
  background-color: rgba(255,255,255,0.03);
}

/* Focus state for amount group */
.form-amount-group:focus-within .form-control,
.form-amount-group:focus-within .form-input,
.form-amount-group:focus-within select {
  border-color: var(--gold);
}

/* ── Date input ──────────────────────────────────────────────── */
input[type="date"].form-control,
input[type="date"].form-input {
  color-scheme: dark;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ── Number input ────────────────────────────────────────────── */
input[type="number"].form-control,
input[type="number"].form-input {
  font-family: var(--font-mono);
}

/* ── Search input ────────────────────────────────────────────── */
.form-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}
.form-search-icon { color: var(--text-muted); font-size: 0.875rem; flex-shrink: 0; }
.form-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}
.form-search input::placeholder { color: var(--text-muted); }

/* ── File input ──────────────────────────────────────────────── */
.form-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.form-file input[type="file"] { display: none; }
.form-file-btn {
  flex-shrink: 0;
}
.form-file-name {
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Inline form (horizontal label + input) ──────────────────── */
.form-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.form-inline .form-label {
  margin-bottom: 0;
  white-space: nowrap;
  min-width: 120px;
}
.form-inline .form-control,
.form-inline .form-input { flex: 1; }

/* ── Settings row (label left, control right) ────────────────── */
.form-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.form-settings-row:last-child { border-bottom: none; }
.form-settings-info {}
.form-settings-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.form-settings-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  -webkit-appearance: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #a07830 100%);
  color: var(--bg-base);
  box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212,175,55,0.25);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}

.btn-danger:hover { background: rgba(248,113,113,0.2); }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}

.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--bg-base);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--bg-surface);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: rgba(255,255,255,0.02); color: var(--text-primary); }

.td-name { color: var(--text-primary); font-weight: 500; }

.td-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge-gold { background: var(--gold-muted); color: var(--gold); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

.gain { color: var(--green); }
.loss { color: var(--red); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop.open { display: grid; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.25s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title { font-family: var(--font-display); font-size: 1.3rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-modal);
  z-index: 1000;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 360px;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { border-left: 3px solid var(--green); }
.toast-success .toast-icon { color: var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-error .toast-icon { color: var(--red); }
.toast-info { border-left: 3px solid var(--blue); }
.toast-info .toast-icon { color: var(--blue); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-desc { font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-bar input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: border-color var(--transition);
}

.search-bar input:focus { outline: none; border-color: var(--gold); }
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

/* ============================================================
   FILTER ROW
   ============================================================ */
.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892a4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}

.filter-select:focus { outline: none; border-color: var(--gold); color: var(--text-primary); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-body);
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ============================================================
   ALLOCATION CHART LEGEND
   ============================================================ */
.legend-list { display: flex; flex-direction: column; gap: 0.6rem; }
.legend-item { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { color: var(--text-secondary); flex: 1; }
.legend-value { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-primary); }

/* ============================================================
   SUBSCRIPTION / TRIAL BANNER
   ============================================================ */
.trial-banner {
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(212,175,55,0.06));
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.trial-text { font-size: 0.85rem; color: var(--gold); }

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */
.page-enter { animation: fadeSlideUp 0.4s ease both; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-load 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-load {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ============================================================
   RESPONSIVE — MOBILE FIRST
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

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

  .main-content { margin-left: 0; }

  .menu-toggle { display: flex; }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }

  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-amount-group { grid-template-columns: 1fr auto; }
  .form-amount-group select { min-width: 70px; }
  .form-inline { flex-direction: column; align-items: flex-start; }
  .form-inline .form-label { min-width: unset; }

  .page-content { padding: 1rem; }
}

@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .modal { padding: 1.5rem; }
  .topbar { padding: 0 1rem; }
  .filter-row { gap: 0.5rem; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { flex-shrink: 0; }
}

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  display: none;
}

.sidebar-overlay.open { display: block; }

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie-chart-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: center;
}

/* ============================================================
   IMPORT ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-muted);
}

.drop-zone-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.6; }
.drop-zone-text { font-size: 0.9rem; color: var(--text-secondary); }
.drop-zone-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
