/* ==========================================================================
   Pivnexa Design System — Inspired by Linear & Cloudflare
   Ultra-fast, zero-dependency, Dark & Light Mode responsive utility UI
   ========================================================================== */

:root {
  /* Light Theme Palette */
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-code: #0f172a;
  --code-text: #e2e8f0;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Brand & Accents */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --accent-border: rgba(79, 70, 229, 0.25);

  --orange: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.12);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.12);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --rose: #ef4444;
  --rose-soft: rgba(239, 68, 68, 0.12);

  /* Elevation & Radius */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 44px -12px rgba(15, 23, 42, 0.14);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Hero Glow */
  --hero-glow: radial-gradient(ellipse 80% 50% at 50% -15%, rgba(79, 70, 229, 0.14), transparent 70%);
  --nav-bg: rgba(248, 250, 252, 0.85);
}

[data-theme="dark"] {
  --bg: #080a0f;
  --bg-elevated: #0f131c;
  --bg-subtle: #151b28;
  --bg-code: #0a0d14;
  --code-text: #e2e8f0;
  --surface-hover: #192131;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-border: rgba(99, 102, 241, 0.35);

  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.14);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.13);
  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --rose: #f87171;
  --rose-soft: rgba(248, 113, 113, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.72);

  --hero-glow: radial-gradient(ellipse 75% 45% at 50% -10%, rgba(99, 102, 241, 0.22), rgba(6, 182, 212, 0.06) 45%, transparent 72%);
  --nav-bg: rgba(8, 10, 15, 0.82);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--hero-glow);
  background-repeat: no-repeat;
  background-attachment: scroll;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.025em; color: var(--text); line-height: 1.25; }
p { margin: 0 0 1rem; color: var(--text-secondary); }
code, pre, .mono { font-family: var(--font-mono); }

.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content { flex: 1 0 auto; padding-bottom: 64px; }

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link, .nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.nav-link:hover, .nav-dropdown-btn:hover,
.nav-dropdown.open > .nav-dropdown-btn,
.nav-link.active {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-dropdown { position: relative; }
.nav-dropdown-btn .chevron { transition: transform 0.18s ease; opacity: 0.7; }
.nav-dropdown.open > .nav-dropdown-btn .chevron { transform: rotate(180deg); }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 120;
}

.nav-dropdown.open > .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background 0.12s ease;
}
.dropdown-item:hover, .dropdown-item.active {
  background: var(--surface-hover);
  color: var(--text);
}
.dropdown-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.dropdown-item-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.dropdown-item-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.accent-orange { background: var(--orange-soft); color: var(--orange); }
.accent-indigo { background: var(--accent-soft); color: var(--accent); }
.accent-emerald { background: var(--emerald-soft); color: var(--emerald); }
.accent-cyan { background: var(--cyan-soft); color: var(--cyan); }

/* Header Controls */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-hover);
}

.mobile-menu-btn { display: none; }

/* Mobile Nav Drawer */
.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 12px 20px 24px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.mobile-nav.open { display: block; }
.mobile-cat-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 16px 0 6px;
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.mobile-nav-link:hover { background: var(--surface-hover); color: var(--text); }

/* Command Palette Modal */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.cmd-backdrop.open { display: flex; }
.cmd-dialog {
  width: 100%;
  max-width: 580px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.cmd-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
}
.cmd-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background 0.1s;
}
.cmd-item:hover, .cmd-item.selected { background: var(--surface-hover); color: var(--text); }
.cmd-item-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmd-item-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Hero Section */
.hero {
  padding: 52px 0 36px;
  text-align: center;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
  display: inline-block;
}
.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  font-weight: 780;
  letter-spacing: -0.035em;
  max-width: 820px;
  margin: 0 auto 14px;
}
.gradient-text {
  background: linear-gradient(120deg, var(--accent), #3b82f6 52%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  max-width: 660px;
  margin: 0 auto 28px;
  color: var(--text-secondary);
}

/* Live Snapshot Strip on Homepage */
.snapshot-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 880px;
  margin: 0 auto 28px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.snapshot-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.snapshot-item strong { color: var(--text); font-family: var(--font-mono); font-weight: 600; }

/* Directory Filter Bar */
.directory-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.filter-tab:hover { border-color: var(--border-strong); color: var(--text); }
.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.directory-search {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 340px;
}
.directory-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.directory-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.directory-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Category Section & Tool Cards */
.category-section { margin-bottom: 42px; }
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.category-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.category-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.category-header h2 { font-size: 1.2rem; }
.category-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  position: relative;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mode-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tool-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.tool-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  flex: 1;
}
.tool-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.tool-card:hover .tool-card-footer .icon { transform: translateX(3px); }
.tool-card-footer .icon { transition: transform 0.15s ease; }

/* Feature Strip */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 48px 0 36px;
}
.feature-box {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.feature-box h3 { font-size: 1rem; margin: 12px 0 6px; }
.feature-box p { font-size: 13.5px; margin: 0; }

/* Tool Page Header & Breadcrumb */
.tool-page-header {
  padding: 28px 0 22px;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.tool-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.tool-title-group {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.tool-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tool-page-header h1 {
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  margin-bottom: 6px;
}
.tool-page-header .subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 720px;
}

/* Panels, Cards, Forms, Buttons */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-title { font-size: 1.05rem; font-weight: 650; }

.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-control, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control.mono, .form-textarea.mono { font-family: var(--font-mono); font-size: 13.5px; }
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.input-grow { flex: 1; min-width: 210px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #ffffff; }
.btn-orange {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
}
.btn-orange:hover:not(:disabled) { filter: brightness(1.07); color: #ffffff; }
.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 26px; font-size: 15.5px; }

/* Quick Preset Chips */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.chips-label { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.14s;
}
.chip:hover, .chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.metric-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  position: relative;
}
.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}
.metric-value-sm { font-size: 1.05rem; }
.metric-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Status Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.badge-success { background: var(--emerald-soft); color: var(--emerald); }
.badge-warning { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--rose-soft); color: var(--rose); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); }

/* Data Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }

/* Code / Raw Output Box */
.code-box {
  position: relative;
  background: var(--bg-code);
  color: var(--code-text);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 460px;
}

/* Copy Button Utility */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.copy-btn.copied { color: var(--emerald); border-color: var(--emerald); background: var(--emerald-soft); }

/* Alert Banners */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  border: 1px solid var(--border);
}
.alert-error { background: var(--rose-soft); border-color: rgba(239, 68, 68, 0.3); color: var(--rose); }
.alert-success { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.3); color: var(--emerald); }
.alert-warning { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.3); color: var(--amber); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

/* Tabs inside Tools */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab-btn {
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Speed Test Gauge Specifics */
.speed-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 8px;
}
.gauge-wrap {
  position: relative;
  width: 300px;
  max-width: 100%;
  aspect-ratio: 300 / 215;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gauge-svg { width: 100%; height: 100%; overflow: visible; }
.gauge-track { fill: none; stroke: var(--border-strong); stroke-width: 16; stroke-linecap: round; }
.gauge-arc {
  fill: none;
  stroke: url(#speedGrad);
  stroke-width: 16;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.18s ease-out;
}
.gauge-readout {
  position: absolute;
  bottom: 22px;
  text-align: center;
}
.gauge-value {
  font-family: var(--font-mono);
  font-size: 2.85rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}
.gauge-unit { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: 4px; }
.gauge-phase {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: 6px;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.25s ease;
}

/* Two-Column Grid Utility */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Password Display Box */
.pw-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  margin-bottom: 16px;
}
.pw-text {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 2.4vw, 1.55rem);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
  word-break: break-all;
}

/* Range & Toggle Controls */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
}
.check-card:hover { border-color: var(--border-strong); }
.check-card input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Related Tools Strip */
.related-section { margin: 36px 0 32px; }
.related-section h2 { font-size: 1.15rem; margin-bottom: 14px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.related-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.related-card:hover { border-color: var(--accent-border); transform: translateY(-1px); color: var(--text); }
.related-card strong { display: block; font-size: 13.5px; }
.related-card span { display: block; font-size: 12px; color: var(--text-muted); }

/* SEO Explanation & FAQ Section */
.seo-section {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.seo-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: start;
}
.seo-prose h2 { font-size: 1.35rem; margin-bottom: 12px; }
.seo-prose h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.seo-prose p { font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }
.seo-prose ul {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14.5px;
}
.seo-prose li { margin-bottom: 6px; }
.seo-prose li strong { color: var(--text); }

/* FAQ Accordion */
.faq-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.faq-card h2 { font-size: 1.2rem; margin-bottom: 14px; }
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.faq-q .icon { transition: transform 0.2s ease; color: var(--text-muted); }
.faq-item.open .faq-q .icon { transform: rotate(180deg); color: var(--accent); }
.faq-a {
  display: none;
  padding: 0 0 14px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.faq-item.open .faq-a { display: block; }

/* Legal / Info Content Page */
.prose-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 0;
}
.prose-page h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); margin-bottom: 10px; }
.prose-page .meta-date { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.prose-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
}
.prose-card h2 { font-size: 1.25rem; margin: 26px 0 10px; }
.prose-card h2:first-child { margin-top: 0; }
.prose-card h3 { font-size: 1.05rem; margin: 18px 0 8px; }
.prose-card p, .prose-card li { font-size: 15px; line-height: 1.72; color: var(--text-secondary); }
.prose-card ul { padding-left: 22px; margin: 0 0 16px; }
.prose-card li { margin-bottom: 6px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 48px 0 28px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 28px;
  margin-bottom: 36px;
}
.footer-brand p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 12px 0 16px;
  max-width: 290px;
}
.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 12px;
}
.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-links a {
  font-size: 13.5px;
  color: var(--text-secondary);
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-legal-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-legal-inline a { color: var(--text-muted); }
.footer-legal-inline a:hover { color: var(--text); }

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Canvas Chart Container */
.chart-box {
  width: 100%;
  height: 160px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-top: 16px;
}
.chart-box canvas { width: 100%; height: 100%; display: block; }

/* Security Grade Badge */
.grade-circle {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .nav-desktop { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .search-trigger .search-label, .search-trigger .kbd { display: none; }
  .seo-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .prose-card { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 34px 0 24px; }
  .directory-controls { flex-direction: column; align-items: stretch; }
  .directory-search { max-width: 100%; }
}

.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.flex-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
