/* SiteGuard Benchmark — Shared Design Tokens
   Source of truth: DESIGN.md (2026-04-12)
   Dark theme default, light via [data-theme="light"] */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* Shared tokens (both themes)
   Muted neutral palette: white-on-dark / black-on-light is the default.
   Accents are kept subtle (slate / sage / amber / dusty-rose) so the UI
   reads as one consistent surface. Each accent is paired with a tinted
   background so emphasis comes from contrast, not saturation. */
:root {
  /* Accents (muted) */
  --blue:          #94a3b8;   /* slate */
  --green:         #84a98c;   /* sage */
  --red:           #c98a8a;   /* dusty rose */
  --yellow:        #c2a878;   /* warm sand */
  --orange:        #b08968;   /* taupe */
  --purple:        #9c93a6;   /* lavender-grey */
  --cyan:          #8aa6a3;   /* mineral */

  /* Subtle accent backgrounds (tints). 22% alpha so they read clearly on
     the muted-white background while staying soft on dark. */
  --blue-tint:     rgba(148,163,184,0.22);
  --green-tint:    rgba(132,169,140,0.24);
  --red-tint:      rgba(201,138,138,0.22);
  --yellow-tint:   rgba(194,168,120,0.26);
  --orange-tint:   rgba(176,137,104,0.22);
  --purple-tint:   rgba(156,147,166,0.22);
  --cyan-tint:     rgba(138,166,163,0.22);

  /* Tier accents — same family, slightly different hues so cards differ
     subtly without shouting. */
  --t1: #94a3b8;   /* slate */
  --t2: #9c93a6;   /* lavender-grey */
  --t3: #c2a878;   /* warm sand */
  --t4: #c98a8a;   /* dusty rose */

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  --font: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', monospace;

  --transition: 0.18s ease;
}

/* Light "muted white" — the new default theme. Slightly warm off-white
   surfaces (parchment / paper), warm near-black text. Pure #fff and #000
   are intentionally avoided so the page reads soft and consistent. */
:root, [data-theme="light"] {
  --bg:            #f3f1ec;   /* page = warm off-white parchment */
  --surface:       #faf9f5;   /* cards = slightly lighter, paper-like */
  --surface-hover: #e8e6df;
  --border:        #d8d5cc;
  --text:          #1d1f24;   /* warm near-black, not pure #000 */
  --muted:         #74726b;
}

/* Dark theme — kept available via the toggle. */
[data-theme="dark"] {
  --bg:            #14161b;
  --surface:       #1c1f26;
  --surface-hover: #24272f;
  --border:        #2d313a;
  --text:          #ffffff;
  --muted:         #9aa0a6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:            #14161b;
    --surface:       #1c1f26;
    --surface-hover: #24272f;
    --border:        #2d313a;
    --text:          #ffffff;
    --muted:         #9aa0a6;
  }
}

/* ── Base reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav bar ── */
.sg-nav {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sg-nav-logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-right: 24px;
  white-space: nowrap;
  text-decoration: none;
}
.sg-nav-logo:hover { text-decoration: none; }

.sg-nav-link {
  padding: 12px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  line-height: 22px;
}
.sg-nav-link:hover {
  color: var(--text);
  text-decoration: none;
}
.sg-nav-link.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Admin dropdown */
.sg-nav-dropdown {
  position: relative;
}
.sg-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 0;
  z-index: 200;
  margin-top: 4px;
}
.sg-nav-dropdown:hover .sg-nav-dropdown-menu,
.sg-nav-dropdown:focus-within .sg-nav-dropdown-menu {
  display: block;
}
.sg-nav-dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
}
.sg-nav-dropdown-item:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.sg-nav-spacer { flex: 1; }

/* Theme toggle */
.sg-theme-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.sg-theme-toggle:hover { color: var(--text); }

/* User name + logout */
.sg-nav-user {
  font-size: 13px;
  color: var(--muted);
  margin-left: 8px;
  padding: 4px 8px;
  white-space: nowrap;
}
.sg-nav-logout {
  margin-left: 4px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.sg-nav-logout:hover {
  color: var(--text);
  border-color: var(--text);
  text-decoration: none;
  background: var(--surface-hover);
}

/* Help button */
.sg-help-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
  font-family: var(--mono);
  border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition);
  margin-left: 4px;
}
.sg-help-btn:hover { color: var(--text); border-color: var(--text); }

/* ── Skip to content (a11y) ── */
.sg-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  z-index: 300;
  font-size: 14px;
  transition: top 0.2s;
}
.sg-skip-link:focus {
  top: 0;
}

/* ── Main content ── */
.sg-main {
  padding: 24px 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Toast notifications ── */
.sg-toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sg-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  animation: sg-toast-in 0.18s ease forwards;
  max-width: 360px;
}
.sg-toast.success { border-left: 3px solid var(--green); }
.sg-toast.error { border-left: 3px solid var(--red); }
.sg-toast.warning { border-left: 3px solid var(--yellow); }

@keyframes sg-toast-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Keyboard help modal ── */
.sg-help-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.sg-help-modal.open { display: flex; }
.sg-help-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.sg-help-modal h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.sg-shortcut-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sg-shortcut-key {
  font-family: var(--mono);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
}

/* ── Utility: tables ── */
.sg-table {
  width: 100%;
  border-collapse: collapse;
}
.sg-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.sg-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.sg-table tr:hover td {
  background: var(--surface-hover);
}

/* ── Utility: buttons ── */
.sg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-family: var(--font);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}
.sg-btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.sg-btn-primary:hover { opacity: 0.9; text-decoration: none; }
.sg-btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.sg-btn-secondary:hover {
  border-color: var(--text);
  text-decoration: none;
}

/* ── Utility: mono text ── */
.mono { font-family: var(--mono); }

/* ── Utility: skeleton loaders ── */
.sg-skeleton {
  background: var(--surface);
  border-radius: var(--radius-sm);
  animation: sg-pulse 1.5s ease-in-out infinite;
}
@keyframes sg-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Utility: empty state ── */
.sg-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.sg-empty p { margin-bottom: 16px; }
