/* Compass Dashboard - Shared Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --bg-base:      #020617;
  --bg-card:      #0f172a;
  --bg-card2:     #1e293b;
  --bg-input:     #1e293b;
  --border:       #334155;
  --border-light: #1e293b;
  --text:         #f8fafc;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;
  --accent:       #6366f1;       /* indigo */
  --accent-glow:  rgba(99,102,241,0.15);
  --green:        #22c55e;
  --red:          #f43f5e;
  --amber:        #f59e0b;
  --blue:         #38bdf8;
  --purple:       #a78bfa;
  --grad-header:  linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #0c1a2e 100%);
  --grad-accent:  linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-green:   linear-gradient(135deg, #059669, #22c55e);
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-card:  0 2px 12px rgba(0,0,0,0.3);
  --transition:   all 0.18s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ─── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.1rem, 3vw, 1.35rem); }
h3 { font-size: 1rem; font-weight: 600; }
p  { line-height: 1.7; }
a  { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ─── Layout ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* ─── Nav ─── */
.nav {
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.75rem 0;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.nav-brand svg { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  background: var(--bg-card2);
  color: var(--text);
}
.nav-link.active { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

/* ─── Header Banner ─── */
.page-header {
  background: var(--grad-header);
  border-bottom: 1px solid var(--border-light);
  padding: 2rem 0 1.5rem;
}
.page-header-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: clamp(1.3rem, 4vw, 1.75rem); font-weight: 800; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover { border-color: var(--border); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.card-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Metric Cards ─── */
.metric-value {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.5rem;
}
.trend-up   { background: rgba(34,197,94,0.15);  color: var(--green); }
.trend-down { background: rgba(244,63,94,0.15);  color: var(--red); }
.trend-flat { background: rgba(148,163,184,0.12); color: var(--text-muted); }
.trend-good-up   { background: rgba(34,197,94,0.15);  color: var(--green); }
.trend-good-down { background: rgba(34,197,94,0.15);  color: var(--green); }
.trend-bad-up    { background: rgba(244,63,94,0.15);  color: var(--red); }
.trend-bad-down  { background: rgba(244,63,94,0.15);  color: var(--red); }

/* ─── Grids ─── */
.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-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }

/* ─── Section ─── */
.section { padding: 1.5rem 0; }
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ─── Direction Check Banner ─── */
.direction-banner {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.direction-banner.positive {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
}
.direction-banner.neutral {
  background: rgba(148,163,184,0.06);
  border-color: rgba(148,163,184,0.2);
}
.direction-banner.negative {
  background: rgba(244,63,94,0.08);
  border-color: rgba(244,63,94,0.2);
}
.direction-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.25rem;
}
.direction-banner.positive .direction-icon { background: rgba(34,197,94,0.15); }
.direction-banner.neutral  .direction-icon { background: rgba(148,163,184,0.12); }
.direction-banner.negative .direction-icon { background: rgba(244,63,94,0.12); }
.direction-text h2 { font-size: 1.1rem; }
.direction-text p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── Phrase ─── */
.momentum-phrase {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ─── Note Card ─── */
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.note-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-accent);
}
.note-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  font-style: italic;
}
.note-date { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.75rem; }

/* ─── Charts ─── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}
.chart-container { position: relative; height: 180px; }
.chart-container-lg { position: relative; height: 240px; }

/* Expandable chart cards */
.chart-card[data-expand] { cursor: pointer; }
.chart-card[data-expand]:hover { border-color: var(--accent); }
.chart-card[data-expand] .chart-title::after {
  content: '⤢';
  float: right;
  color: var(--text-dim);
  font-size: 0.9rem;
  transition: var(--transition);
}
.chart-card[data-expand]:hover .chart-title::after { color: var(--accent); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger  { background: rgba(244,63,94,0.15); color: var(--red); border: 1px solid rgba(244,63,94,0.3); }
.btn-danger:hover  { background: rgba(244,63,94,0.25); }
.btn-ghost   { background: none; color: var(--text-muted); }
.btn-ghost:hover   { background: var(--bg-card2); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.45rem; width: 34px; height: 34px; justify-content: center; }

/* ─── Forms ─── */
.form-section { margin-bottom: 1.75rem; }
.form-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  transition: var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-hint { font-size: 0.72rem; color: var(--text-dim); }
.form-error { font-size: 0.8rem; color: var(--red); display: none; }
.form-error.show { display: block; }

/* ─── Table ─── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg-card2); }
th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  white-space: nowrap;
}
td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  white-space: nowrap;
}
td.date-cell { color: var(--text); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,0.02); }
.table-note { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-accent  { background: var(--accent-glow); color: var(--accent); }
.badge-green   { background: rgba(34,197,94,0.12); color: var(--green); }
.badge-red     { background: rgba(244,63,94,0.12); color: var(--red); }
.badge-amber   { background: rgba(245,158,11,0.12); color: var(--amber); }

/* ─── 90-day comparison ─── */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.comparison-item {
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.comparison-item-label { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.35rem; }
.comparison-item-values { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.comparison-then { color: var(--text-muted); }
.comparison-arrow { font-size: 0.8rem; }
.comparison-now  { font-weight: 700; color: var(--text); }

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(34,197,94,0.3); color: var(--green); }
.toast.error   { border-color: rgba(244,63,94,0.3);  color: var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow);
  transform: translateY(8px);
  transition: transform 0.15s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-body  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Utility ─── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.font-bold  { font-weight: 700; }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-accent{ color: var(--accent); }
.hidden     { display: none !important; }
.sr-only    { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Login Page ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 1rem;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}
.login-logo svg { color: var(--accent); }
.login-tagline { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 2rem; }
.login-error {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}
.login-error.show { display: block; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 0.5rem;
    z-index: 40;
  }
  .nav-mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .nav { position: relative; }
  .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .comparison-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header-inner { flex-direction: column; }
  .direction-banner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .container { padding: 0 0.75rem; }
  .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; }
  .card { padding: 1rem; }
  .metric-value { font-size: 1.4rem; }
  th, td { padding: 0.6rem 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
