/**
 * dashboard.css — Dark dashboard design system for Owner and Manager surfaces.
 * Loaded in addition to (or instead of) style.css on dashboard pages.
 * Imports Google Fonts inline via @import in each page's <head>.
 */

@import url('promo-bar.css');

/* ============================================================
   DARK THEME VARIABLES
   ============================================================ */
:root {
  /* Marketing tokens — used by promo-bar.css (app.js injects launch bar on all pages with app.js) */
  --gold: #a67c24;
  --navy: #1a3558;
  --navy-rgb: 26, 53, 88;
  --gold-light: #c49338;
  --dash-bg:           #0c1520;
  --dash-surface:      #142030;
  --dash-surface-2:    #1c2d42;
  --dash-surface-3:    #243548;
  --dash-border:       rgba(255,255,255,0.07);
  --dash-border-hover: rgba(255,255,255,0.13);

  --dash-text:         #e2e8f0;
  --dash-text-2:       #8fa3bd;
  --dash-text-muted:   #4d6580;

  --dash-gold:         #d4ad4f;
  --dash-gold-light:   #e4c06a;
  --dash-gold-faint:   rgba(212, 173, 79, 0.14);

  --dash-green:        #3db87a;
  --dash-green-faint:  rgba(61,184,122,0.1);
  --dash-amber:        #f59e0b;
  --dash-amber-faint:  rgba(245,158,11,0.1);
  --dash-red:          #e05555;
  --dash-red-faint:    rgba(224,85,85,0.1);
  --dash-blue:         #5b9bd5;
  --dash-blue-faint:   rgba(91,155,213,0.1);

  --dash-sidebar-w:    240px;
  --dash-topbar-h:     56px;
  --dash-radius:       10px;
  --dash-transition:   0.18s ease;
}

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

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

/* ============================================================
   LAYOUT — sidebar + main
   ============================================================ */
.dash-layout {
  display: flex;
  min-height: 100vh;
}

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

.dash-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--dash-border);
  text-decoration: none;
  color: var(--dash-text);
  transition: background var(--dash-transition);
}
.dash-sidebar-brand:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dash-sidebar-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dash-sidebar-wordmark {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, #f1f5f9 0%, var(--dash-gold) 55%, #c9a227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .dash-sidebar-wordmark {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    color: var(--dash-text);
  }
}

.dash-sidebar-section {
  padding: 20px 12px 8px;
  flex: 1;
}

.dash-sidebar-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dash-text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
  margin-top: 16px;
}
.dash-sidebar-label:first-child { margin-top: 0; }

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--dash-text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dash-transition), color var(--dash-transition);
  position: relative;
  margin-bottom: 2px;
}

.dash-nav-item:hover {
  background: var(--dash-surface-2);
  color: var(--dash-text);
}

.dash-nav-item.active {
  background: var(--dash-gold-faint);
  color: var(--dash-gold-light);
}

.dash-nav-item svg {
  flex-shrink: 0;
  opacity: 0.75;
}
.dash-nav-item.active svg,
.dash-nav-item:hover svg { opacity: 1; }

.dash-nav-badge {
  margin-left: auto;
  background: var(--dash-red);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 99px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.dash-sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--dash-border);
}

.dash-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--dash-transition);
}
.dash-user-row:hover { background: var(--dash-surface-2); }

.dash-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dash-gold-faint);
  border: 1px solid var(--dash-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dash-gold);
  flex-shrink: 0;
}

.dash-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dash-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-user-role {
  font-size: 0.6875rem;
  color: var(--dash-text-muted);
}

/* ── Main area ── */
.dash-main {
  margin-left: var(--dash-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top bar ── */
.dash-topbar {
  height: var(--dash-topbar-h);
  background: var(--dash-surface);
  border-bottom: 1px solid var(--dash-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.dash-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--dash-text-2);
}
.dash-breadcrumb-sep { opacity: 0.4; }
.dash-breadcrumb-current { color: var(--dash-text); font-weight: 500; }

.dash-topbar-spacer { flex: 1; }

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

/* ── Page content ── */
.dash-content {
  padding: 28px 28px 48px;
  flex: 1;
}

.dash-page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dash-page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dash-text);
  line-height: 1.2;
}

.dash-page-subtitle {
  font-size: 0.875rem;
  color: var(--dash-text-2);
  margin-top: 4px;
}

/* ============================================================
   CARDS
   ============================================================ */
.dash-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 20px 24px;
}

.dash-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dash-text-muted);
  margin-bottom: 14px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--dash-transition);
}
.stat-card:hover { border-color: var(--dash-border-hover); }

.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dash-text-muted);
}

.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--dash-text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--dash-text-2);
  margin-top: 2px;
}

.stat-trend {
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up   { color: var(--dash-green); }
.stat-trend.down { color: var(--dash-red); }
.stat-trend.warn { color: var(--dash-amber); }

/* ============================================================
   PROGRESS / FUND BARS
   ============================================================ */
.fund-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.fund-bar-label {
  font-size: 0.8125rem;
  color: var(--dash-text-2);
  width: 140px;
  flex-shrink: 0;
}
.fund-bar-track {
  flex: 1;
  height: 6px;
  background: var(--dash-surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.fund-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-bar-fill.green  { background: var(--dash-green); }
.fund-bar-fill.amber  { background: var(--dash-amber); }
.fund-bar-fill.red    { background: var(--dash-red); }
.fund-bar-val {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dash-text);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
}

/* ============================================================
   TABLES
   ============================================================ */
.dash-table-wrap {
  overflow-x: auto;
  border-radius: var(--dash-radius);
  border: 1px solid var(--dash-border);
}

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

.dash-table thead tr {
  background: var(--dash-surface-2);
  border-bottom: 1px solid var(--dash-border);
}

.dash-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dash-text-muted);
  white-space: nowrap;
}

.dash-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--dash-border);
  color: var(--dash-text);
  vertical-align: middle;
}

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

.dash-table tbody tr {
  transition: background var(--dash-transition);
  background: var(--dash-surface);
}

.dash-table tbody tr:hover {
  background: var(--dash-surface-2);
  cursor: pointer;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-green  { background: var(--dash-green-faint);  color: var(--dash-green); }
.badge-amber  { background: var(--dash-amber-faint);  color: var(--dash-amber); }
.badge-red    { background: var(--dash-red-faint);    color: var(--dash-red); }
.badge-blue   { background: var(--dash-blue-faint);   color: var(--dash-blue); }
.badge-muted  { background: var(--dash-surface-3);    color: var(--dash-text-2); }
.badge-gold   { background: var(--dash-gold-faint);   color: var(--dash-gold-light); }

/* severity dot */
.sev-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sev-dot.critical { background: var(--dash-red); }
.sev-dot.high     { background: var(--dash-amber); }
.sev-dot.medium   { background: var(--dash-blue); }
.sev-dot.low      { background: var(--dash-green); }

/* ============================================================
   FILTER / TAB BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--dash-border);
  background: transparent;
  color: var(--dash-text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dash-transition);
  font-family: inherit;
}
.filter-btn:hover {
  background: var(--dash-surface-2);
  color: var(--dash-text);
  border-color: var(--dash-border-hover);
}
.filter-btn.active {
  background: var(--dash-gold-faint);
  color: var(--dash-gold-light);
  border-color: rgba(212, 173, 79, 0.3);
}

.filter-spacer { flex: 1; }

/* ============================================================
   BUTTONS (dark theme)
   ============================================================ */
.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dash-transition);
  border: none;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.dash-btn-primary {
  background: var(--dash-gold);
  color: #0c1520;
  font-weight: 600;
}
.dash-btn-primary:hover { background: var(--dash-gold-light); }

.dash-btn-ghost {
  background: transparent;
  color: var(--dash-text-2);
  border: 1px solid var(--dash-border);
}
.dash-btn-ghost:hover {
  background: var(--dash-surface-2);
  color: var(--dash-text);
  border-color: var(--dash-border-hover);
}

.dash-btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
}

.dash-btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  border-radius: 7px;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--dash-border);
  font-size: 0.875rem;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-body { flex: 1; min-width: 0; }
.activity-title { color: var(--dash-text); line-height: 1.4; }
.activity-meta { font-size: 0.75rem; color: var(--dash-text-muted); margin-top: 3px; }

/* ============================================================
   RISK SCORE RING (SVG-based)
   ============================================================ */
.risk-ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}
.risk-ring-label { font-size: 0.875rem; color: var(--dash-text-2); margin-top: 6px; text-align: center; }
.risk-score-detail { flex: 1; }
.risk-score-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  padding: 7px 0;
  border-bottom: 1px solid var(--dash-border);
  color: var(--dash-text-2);
}
.risk-score-detail-row:last-child { border-bottom: none; }
.risk-score-detail-row span:last-child { font-weight: 600; color: var(--dash-text); }

/* ============================================================
   GRID HELPERS
   ============================================================ */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .dash-grid-2, .dash-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   SECTION SPACING
   ============================================================ */
.dash-section { margin-bottom: 24px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--dash-text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.875rem; }

/* ============================================================
   MOBILE — hide sidebar, show hamburger
   ============================================================ */
.dash-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--dash-border);
  border-radius: 6px;
  color: var(--dash-text);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 768px) {
  .dash-sidebar {
    transform: translateX(-100%);
  }
  .dash-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5);
  }
  .dash-main {
    margin-left: 0;
  }
  .dash-content {
    padding: 20px 16px 48px;
  }
  .dash-menu-toggle { display: flex; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-gold   { color: var(--dash-gold-light); }
.text-green  { color: var(--dash-green); }
.text-amber  { color: var(--dash-amber); }
.text-red    { color: var(--dash-red); }
.text-muted  { color: var(--dash-text-muted); }
.text-2      { color: var(--dash-text-2); }
.hidden      { display: none !important; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.fw-600      { font-weight: 600; }

/* ── Additional utilities ────────────────────────────────── */
.fw-600 { font-weight: 600; }
.dash-page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dash-card-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--dash-border);
}
.dash-chart-placeholder {
  height: 100px;
  background: var(--dash-surface-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dash-text-muted);
  font-size: 0.75rem;
}

/* ── Bar chart helpers ── */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100%;
  width: 100%;
  padding: 16px 16px 32px;
  box-sizing: border-box;
}
.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.chart-bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  justify-content: center;
}
.chart-bar {
  border-radius: 3px 3px 0 0;
  min-width: 6px;
  flex: 1;
  max-width: 14px;
  transition: opacity 0.15s;
}
.chart-bar-label {
  font-size: 0.6rem;
  color: var(--dash-text-muted);
  white-space: nowrap;
  text-align: center;
}
.chart-legend {
  display: flex;
  gap: 14px;
  padding: 0 16px 8px;
  font-size: 0.7rem;
  color: var(--dash-text-muted);
  flex-shrink: 0;
  align-items: center;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.stat-value-sm { font-size: 1.2rem; }
.activity-dot-amber  { background: var(--dash-amber); }
.activity-dot-blue   { background: var(--dash-blue); }
.activity-dot-green  { background: var(--dash-green); }
.activity-dot-red    { background: var(--dash-red); }
.activity-dot-muted  { background: var(--dash-text-muted); }
.risk-ring-chart     { text-align: center; flex-shrink: 0; }
.dash-table-borderless { border: none; border-radius: 0; margin-top: 0; }
.dash-sign-out-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--dash-text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  margin-top: 4px;
  transition: background var(--dash-transition), color var(--dash-transition);
}
.dash-sign-out-btn:hover {
  background: var(--dash-surface-2);
  color: var(--dash-red);
}

/* ============================================================
   DEMO DATA BANNER
   ============================================================ */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 24px;
  font-size: 0.8rem;
  background: rgba(212, 173, 79, 0.08);
  border-bottom: 1px solid rgba(212, 173, 79, 0.2);
  color: #a07828;
  flex-shrink: 0;
}
.demo-banner a { color: var(--dash-gold); text-decoration: underline; }
.demo-banner button {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.demo-banner button:hover { opacity: 1; }
.demo-banner.hidden { display: none; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.dash-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
  gap: 10px;
}
.dash-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--dash-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dash-text-muted);
  margin-bottom: 4px;
}
.dash-empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dash-text);
}
.dash-empty-body {
  font-size: 0.8125rem;
  color: var(--dash-text-2);
  max-width: 280px;
  line-height: 1.6;
}

/* ============================================================
   LOADING SKELETONS
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--dash-surface-2) 25%, var(--dash-surface-3) 50%, var(--dash-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  display: block;
}
.skeleton-row  { height: 44px; margin-bottom: 4px; border-radius: 8px; width: 100%; }
.skeleton-stat { height: 28px; width: 55%; border-radius: 4px; margin: 8px 0 4px; }
.skeleton-text { height: 14px; border-radius: 3px; }

/* ============================================================
   UPGRADE CTA (owner gate)
   ============================================================ */
.upgrade-cta-card {
  text-align: center;
  padding: 40px 24px;
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  margin-bottom: 20px;
}
.upgrade-cta-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dash-text);
}
.upgrade-cta-card p {
  font-size: 0.875rem;
  color: var(--dash-text-2);
  margin-bottom: 20px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
