/* ═════════════════════════════════════════════════════════════════════════
   ThreadDB — Professional Thread & Fastener Reference Database
   Design: Clean, fast, modern. Inspired by Tailwind CSS + Stripe docs.
   ═════════════════════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────────────────────── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-size: 14px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --green-500: #22c55e;
  --red-400: #f87171;
  --red-500: #ef4444;

  --bg-primary: var(--slate-50);
  --bg-secondary: #ffffff;
  --bg-tertiary: var(--slate-100);
  --bg-sidebar: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.9);
  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-tertiary: var(--slate-500);
  --border-color: var(--slate-200);
  --accent: var(--blue-600);
  --accent-hover: var(--blue-700);
  --accent-light: var(--blue-50);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
}

/* ─── Dark Mode ──────────────────────────────────────────────────────────── */
.dark {
  --bg-primary: #0b1120;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-header: rgba(15, 23, 42, 0.9);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-color: #1e293b;
  --accent: var(--blue-500);
  --accent-hover: var(--blue-400);
  --accent-light: rgba(59, 130, 246, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.15s ease, color 0.15s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ─── Font Loading (system fonts only, no external requests) ─────────── */

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.2s ease, background 0.15s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 12px 0;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.sidebar-section-title:hover {
  color: var(--text-secondary);
}

.sidebar-link {
  display: block;
  width: 100%;
  padding: 6px 20px 6px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.1s ease;
  position: relative;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.sidebar-link-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  margin-left: 6px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 10px;
  font-size: 20px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
}

/* ─── Top Header ──────────────────────────────────────────────────────────── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.15s ease;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s;
}

.search-input::placeholder { color: var(--text-tertiary); }
.search-input:focus {
  border-color: var(--accent);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ─── Dynamic Containers (CLS prevention) ──────────────────────────────── */
#statsBar {
  min-height: 84px;
}

#standardTabs {
  min-height: 42px;
}

/* ─── Page Content ────────────────────────────────────────────────────────── */
.page-content {
  padding: 32px;
  max-width: 1280px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 640px;
}

/* ─── Stats Bar ──────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  min-height: 84px;
  contain: layout;
}

.stat-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  min-width: 120px;
  transition: box-shadow 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--accent);
}

.stat-metric { color: #15803d; }
.stat-unified { color: #b45309; }
.stat-pipe { color: #dc2626; }
.stat-grades { color: #7c3aed; }

.dark .stat-metric { color: #22c55e; }
.dark .stat-unified { color: #f59e0b; }
.dark .stat-pipe { color: #f87171; }
.dark .stat-grades { color: #a78bfa; }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ─── Standard Tabs ────────────────────────────────────────────────────────── */
.standard-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.tab-btn.active .tab-count {
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── Table ────────────────────────────────────────────────────────────────── */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-height: 360px;
  contain: layout;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  contain: paint;
}

.table-wrap table {
  min-width: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-tertiary);
  padding: 10px 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.1s;
}

thead th:hover {
  color: var(--text-primary);
}

thead th.num {
  text-align: center;
}

thead th.sort-asc::after {
  content: ' ▲';
  font-size: 9px;
}
thead th.sort-desc::after {
  content: ' ▼';
  font-size: 9px;
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s;
  cursor: pointer;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--accent-light);
}

tbody tr.selected {
  background: var(--accent-light);
  border-left: 2px solid var(--accent);
}

tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: var(--text-primary);
  line-height: 1.4;
  text-align: center;
}

td.size-cell {
  font-weight: 600;
  font-size: 13px;
  color: var(--blue-600);
  white-space: nowrap;
  min-width: 90px;
}

.dark td.size-cell {
  color: var(--blue-400);
}

td.num {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

td.label {
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* ─── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  line-height: 1.4;
}

.badge-blue {
  background: var(--blue-100);
  color: var(--blue-700);
}
.dark .badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-400);
}

.badge-amber {
  background: #fef3c7;
  color: #92400e;
}
.dark .badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-400);
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}
.dark .badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-500);
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}
.dark .badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-400);
}

/* ─── Detail Panel ─────────────────────────────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary);
  z-index: 51;
  overflow-y: auto;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
}

.detail-panel.open {
  right: 0;
}

.detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.detail-close {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.detail-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.detail-body {
  padding: 20px 24px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.detail-item-label {
  color: var(--text-secondary);
}

.detail-item-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.detail-conversion {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ─── No Results ──────────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.no-results-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.no-results-text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.no-results-hint {
  font-size: 13px;
}

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

.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.tool-card-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.tool-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Info Box ────────────────────────────────────────────────────────────── */
.info-box {
  background: var(--accent-light);
  border: 1px solid var(--blue-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 24px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.dark .info-box {
  border-color: rgba(59, 130, 246, 0.2);
}

.info-box strong {
  color: var(--text-primary);
}

/* ─── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb-sep {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 24px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.app-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Loading ──────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--text-tertiary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── Count Badge ─────────────────────────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  background: var(--accent);
  color: white;
}

/* ─── Hero Section (Landing) ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: white;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* ─── Standard Quick Links ───────────────────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 32px 0;
}

.quick-link-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.15s;
}

.quick-link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quick-link-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: var(--radius);
}

.quick-link-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.quick-link-content p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: flex;
  }
  .main-content {
    margin-left: 0;
  }
  .page-content {
    padding: 20px 16px;
  }
  .top-header {
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 24px;
  }
  .hero {
    padding: 24px 16px 20px;
  }
  .stats-bar {
    gap: 6px;
  }
  .stat-card {
    min-width: 72px;
    padding: 8px 10px;
  }
  .stat-value {
    font-size: 16px;
  }
  .stat-label {
    font-size: 10px;
  }
  .page-title {
    font-size: 20px;
  }
  .detail-panel {
    width: 100vw;
    right: -100vw;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .sidebar-toggle {
    min-width: 40px;
    min-height: 40px;
  }
  .table-wrap table {
    font-size: 13px;
  }
  .table-wrap th, .table-wrap td {
    padding: 6px 8px;
  }
  .search-box {
    padding: 8px 12px;
    font-size: 14px;
  }
  .page-content {
    padding: 16px 12px;
  }
}

/* ─── Icon System ──────────────────────────────────────────────────────────── */
.icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  stroke: currentColor;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-2xl { width: 40px; height: 40px; }

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ─── Dark Mode Contrast Fixes ─────────────────────────────────────────────── */
.dark .stat-label {
  color: #cbd5e1;
}

.dark .sidebar-section-title {
  color: #94a3b8;
}

.dark .sidebar-link-badge {
  color: #94a3b8;
}

.dark .tab-count {
  color: #94a3b8;
}

.dark .no-results-hint {
  color: #94a3b8;
}

.dark .info-box {
  color: #cbd5e1;
}


/* ─── Pre-rendered Table (CLS fix) ─────────────────────────────────────────── */
#initialTable {
  width: 100%;
  border-collapse: collapse;
}
#initialTable tbody tr {
  cursor: pointer;
}
#initialTable tbody tr:hover {
  background: var(--accent-light);
}
#initialTable tbody tr.selected {
  background: var(--accent-light);
}
/* ─── Content Pages (About, Contact) ──────────────────────────────────────── */
.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.content-section {
  margin-bottom: 40px;
}

.content-section h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  margin-top: 0;
}

.content-section p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.content-section ul {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  margin-left: 24px;
  padding-left: 0;
}

.content-section li {
  margin-bottom: 8px;
}

.content-section li strong {
  color: var(--text-primary);
}

.content-section a {
  color: var(--accent);
  text-decoration: underline;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.contact-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.contact-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.contact-card-header svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}

.contact-card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.contact-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  margin-bottom: 12px;
}

.contact-card a {
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
  text-decoration: underline;
}

.cta-box {
  background: var(--accent-light);
  border: 1px solid var(--blue-200);
  border-radius: 8px;
  padding: 20px;
}

.dark .cta-box {
  border-color: rgba(59, 130, 246, 0.2);
}

.cta-box h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cta-box h2 svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.cta-box p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.notice-box {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 16px;
  border-radius: 4px;
  margin: 20px 0;
}

.dark .notice-box {
  background: rgba(59, 130, 246, 0.1);
}

.notice-box p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.inquiry-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.inquiry-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inquiry-card h3 svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.inquiry-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  margin: 0;
}

@media (max-width: 768px) {
  .content-wrapper {
    max-width: 100%;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Full-Width Content Pages (No Sidebar) ───────────────────────────────── */
.page-layout-full {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.page-header-bar .logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 18px;
  transition: opacity 0.2s;
}

.page-header-bar .logo-link:hover {
  opacity: 0.8;
}

.page-header-bar .logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.page-main-full {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.back-to-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  transition: opacity 0.2s;
  margin-top: 40px;
}

.back-to-home:hover {
  opacity: 0.9;
}

.back-to-home svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .page-header-bar {
    padding: 12px 16px;
  }
  
  .page-main-full {
    padding: 24px 16px 48px;
  }
  
  .back-to-home {
    width: 100%;
    justify-content: center;
  }
}
