/* ═══════════════════════════════════════════════════════════
   Client Dashboard — styles
   Builds on the CSS variables already defined in style.css
   (--bg, --card, --border, --text, --muted, --grad, --font, etc.)
   ═══════════════════════════════════════════════════════════ */

:root {
  --status-good:     #22C55E;
  --status-good-bg:   rgba(34, 197, 94, 0.12);
  --status-warning:  #F59E0B;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-critical: #EF4444;
  --status-critical-bg: rgba(239, 68, 68, 0.12);
  --rate-track: rgba(255,255,255,0.08);
}

/* ── Access page ───────────────────────────────────────── */
.access-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.access-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.access-logo {
  display: inline-block;
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  text-decoration: none;
}

.access-card h1 {
  font-size: 1.5rem;
  color: var(--text);
  margin: 0 0 8px;
}

.access-sub {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 24px;
}

#accessForm { display: flex; flex-direction: column; gap: 12px; }

#accessCode {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
}
#accessCode:focus { outline: 2px solid var(--purple); outline-offset: 1px; }

.access-error {
  color: var(--status-critical);
  font-size: 0.85rem;
  margin-top: 16px;
}

.access-footer {
  margin-top: 24px;
  font-size: 0.82rem;
  color: var(--subtle);
}
.access-footer a { color: var(--purple); text-decoration: none; }

/* ── Dashboard shell ───────────────────────────────────── */
.dash-body { background: var(--bg); min-height: 100vh; }

.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.dash-brand { display: flex; align-items: center; gap: 10px; }
.dash-brand .logo-mark {
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dash-brand .client-name { color: var(--text); font-weight: 600; }
.dash-brand .client-name::before { content: '·'; color: var(--subtle); margin: 0 8px; }

.dash-systems {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
}
.dash-systems .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-good); }
.dash-systems.warn .dot { background: var(--status-warning); }

.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
}

.dash-nav {
  position: sticky;
  top: 65px;
  align-self: start;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.dash-nav a:hover { background: var(--card); color: var(--text); }
.dash-nav a.active { background: var(--card-2); color: var(--text); box-shadow: inset 3px 0 0 var(--purple); }

.dash-main { padding: 24px 24px 80px; min-width: 0; }

.dash-section { padding-top: 12px; margin-bottom: 56px; scroll-margin-top: 80px; }
.dash-section h2 {
  font-size: 1.15rem;
  color: var(--text);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-section .section-sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }

/* ── Stat grid / tiles ─────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-tile .stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}
.stat-tile .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-tile.stat-tile-headline .stat-value {
  font-size: 2.4rem;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.stat-tile .stat-note { font-size: 0.78rem; color: var(--subtle); margin-top: 6px; }

/* ── Needs-attention ticket ────────────────────────────── */
.attention-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--status-critical);
  background: var(--status-critical-bg);
}
.attention-card.calm {
  border-color: var(--status-good);
  background: var(--status-good-bg);
}
.attention-card .attn-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.attention-card.calm .attn-title::before { content: '✓'; color: var(--status-good); }
.attention-card:not(.calm) .attn-title::before { content: '⚠'; color: var(--status-critical); }
.attn-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attn-list li {
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 8px;
  padding: 8px 12px;
}
.attn-list li strong { color: var(--text); }

/* ── Rate bar ──────────────────────────────────────────── */
.rate-row { margin-bottom: 14px; }
.rate-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.rate-row-head strong { color: var(--text); }
.rate-track {
  height: 8px;
  border-radius: 999px;
  background: var(--rate-track);
  overflow: hidden;
}
.rate-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width 0.6s ease;
}

/* ── Activity feed ─────────────────────────────────────── */
.feed-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
}
.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
}
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-icon {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  background: var(--bg-2);
}
.feed-icon.good { background: var(--status-good-bg); color: var(--status-good); }
.feed-icon.warn { background: var(--status-warning-bg); color: var(--status-warning); }
.feed-icon.neutral { background: var(--bg-2); color: var(--muted); }

.feed-body { flex: 1; min-width: 0; }
.feed-title { font-size: 0.9rem; color: var(--text); font-weight: 600; }
.feed-meta { font-size: 0.78rem; color: var(--subtle); margin-top: 2px; }
.feed-empty { padding: 24px; text-align: center; color: var(--subtle); font-size: 0.88rem; }

.stars { color: var(--status-warning); letter-spacing: 1px; font-size: 0.85rem; }

/* ── Loading / error states ────────────────────────────── */
.dash-loading, .dash-error {
  max-width: 480px;
  margin: 15vh auto;
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.dash-error h2 { color: var(--text); margin-bottom: 8px; }
.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border-2);
  border-top-color: var(--purple);
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-nav {
    position: sticky; top: 61px;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 15;
  }
  .dash-nav a { white-space: nowrap; }
  .dash-nav a.active { box-shadow: inset 0 -3px 0 var(--purple); }
}
