@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ─── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-card: #f3f4f6;
  --text: #0a0a0a;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --accent-light: #dcfce7;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --black: #0a0a0a;
  --white: #ffffff;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1);
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --nav-h: 64px;
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
}
.nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(34,197,94,.3); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}
.btn-outline:hover { border-color: var(--text); background: var(--bg-card); }
.btn-black {
  background: var(--black);
  color: var(--white);
}
.btn-black:hover { background: #1a1a1a; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: 96px 0; }
.section-sm { padding: 64px 0; }

/* ─── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green { background: var(--accent-light); color: var(--accent-dark); }
.badge-black { background: var(--black); color: var(--white); }
.badge-gray { background: var(--bg-card); color: var(--text-muted); }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-dark {
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card-dark .muted { color: rgba(255,255,255,.5); }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ─── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--bg-subtle); }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-subtle); }

/* ─── Stat blocks ─────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-value { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-positive { color: var(--accent-dark); }
.stat-negative { color: #ef4444; }

/* ─── Pill tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; background: var(--bg-card); border-radius: var(--radius-sm); padding: 4px; width: fit-content; }
.tab {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all .15s;
}
.tab.active { background: var(--white); color: var(--text); box-shadow: var(--shadow); }
.tab:hover:not(.active) { color: var(--text); }

/* ─── Profit / Loss colors ────────────────────────────────────────────────── */
.profit { color: #16a34a; font-weight: 500; }
.loss { color: #dc2626; font-weight: 500; }
.neutral { color: var(--text-muted); }

/* ─── Alerts / Messages ───────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid;
}
.alert-success { background: var(--accent-light); border-color: #86efac; color: #14532d; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* ─── Trend indicators ────────────────────────────────────────────────────── */
.trend-up::before { content: '↑ '; color: var(--accent-dark); }
.trend-down::before { content: '↓ '; color: #dc2626; }
.trend-stable::before { content: '→ '; color: var(--text-muted); }

/* ─── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.page-title {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}
.page-subtitle { color: var(--text-muted); margin-top: 6px; font-size: 15px; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a:hover { color: var(--text); }
.footer-logo {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.footer-logo span { color: var(--accent); }

/* ─── Dashboard sidebar layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  background: var(--bg);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-subtle);
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 20px;
}
.sidebar-section-label:first-child { margin-top: 0; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  transition: all .15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--bg-card); color: var(--text); }
.sidebar-link.active { background: var(--black); color: var(--white); font-weight: 500; }
.sidebar-link.pro-locked { opacity: .5; }
.sidebar-link .icon { font-size: 16px; width: 20px; text-align: center; }
.main-content { flex: 1; padding: 32px 40px; overflow-x: hidden; }
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 24px 16px; }
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-family: var(--font-head); font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.modal-close { float: right; background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-muted); }

/* ─── Utility ─────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-dark); }
.font-head { font-family: var(--font-head); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ─── Print (Flip Tracker PDF) ────────────────────────────────────────────── */
@media print {
  .nav, .sidebar, .no-print { display: none !important; }
  .main-content { padding: 0 !important; }
  body { font-size: 12px; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; }
  .btn { display: none !important; }
  .print-header { display: block !important; }
}
.print-header { display: none; }
