/* ==========================================================================
   GCP Cloud TPU & MoE Performance Knowledge Base — Design System
   Aesthetic: Editorial Technical Reference (Google Cloud / Stripe Docs style)
   ========================================================================== */

:root {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-code: #0f172a;
  --text-code: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --brand-primary: #1a73e8;
  --brand-primary-soft: #e8f0fe;
  --brand-primary-dark: #1557b0;

  --accent-emerald: #059669;
  --accent-emerald-soft: #ecfdf5;
  --accent-amber: #d97706;
  --accent-amber-soft: #fffbeb;
  --accent-rose: #e11d48;
  --accent-rose-soft: #fff1f2;

  --sidebar-width: 310px;
  --toc-width: 240px;
  --header-height: 60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, monospace;
}

[data-theme="dark"] {
  --bg-canvas: #0b0f19;
  --bg-surface: #111827;
  --bg-subtle: #1e293b;
  --bg-elevated: #1f2937;
  --bg-code: #060911;
  --text-code: #e2e8f0;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-subtle: #1e293b;
  --border-strong: #334155;

  --brand-primary: #60a5fa;
  --brand-primary-soft: rgba(59, 130, 246, 0.15);
  --brand-primary-dark: #93c5fd;

  --accent-emerald: #34d399;
  --accent-emerald-soft: rgba(16, 185, 129, 0.14);
  --accent-amber: #fbbf24;
  --accent-amber-soft: rgba(245, 158, 11, 0.14);
  --accent-rose: #fb7185;
  --accent-rose-soft: rgba(244, 63, 94, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  cursor: pointer;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
}

.brand-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search Trigger / Input Bar in Header */
.search-wrapper {
  position: relative;
  width: 380px;
}

.search-input-box {
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  transition: all 0.18s ease;
}

.search-input-box:focus-within {
  background: var(--bg-surface);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-soft);
}

.search-icon {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 0.9rem;
}

.search-input {
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

.search-clear-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  display: none;
}

.search-shortcut {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  white-space: nowrap;
}

/* Search Dropdown Panel */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: 520px;
  max-width: 92vw;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: none;
  z-index: 200;
}

.search-dropdown.open {
  display: block;
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-tag-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  width: 100%;
  margin-bottom: 2px;
}

.quick-tag {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-tag:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.search-result-count {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.14s ease;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
}

.search-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-chapter-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--brand-primary);
  color: #fff;
}

.search-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

mark.hl {
  background-color: #fde047;
  color: #0f172a;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

.theme-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}

.theme-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* ==========================================================================
   Main 3-Column Layout
   ========================================================================== */
.layout-shell {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* Left Sidebar Navigation */
.left-sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 18px 14px 40px;
  z-index: 90;
}

.sidebar-filter-box {
  margin-bottom: 14px;
}

.sidebar-filter-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.8rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.sidebar-filter-input:focus {
  border-color: var(--brand-primary);
}

.nav-group {
  margin-bottom: 18px;
}

.nav-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-chapter-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: all 0.14s ease;
  line-height: 1.4;
}

.nav-chapter-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-chapter-btn.active {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-weight: 600;
}

.nav-chapter-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  min-width: 26px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  text-align: center;
  margin-top: 1px;
}

.nav-chapter-btn.active .nav-chapter-num {
  background: var(--brand-primary);
  color: #fff;
}

.nav-chapter-btn.featured-chapter {
  border: 1px solid rgba(26, 115, 232, 0.3);
  background: linear-gradient(90deg, rgba(26, 115, 232, 0.07) 0%, transparent 100%);
}

.nav-sublist {
  list-style: none;
  margin: 4px 0 8px 22px;
  padding-left: 10px;
  border-left: 2px solid var(--border-subtle);
  display: none;
}

.nav-sublist.expanded {
  display: block;
}

.nav-subitem-link {
  display: block;
  padding: 5px 8px;
  font-size: 0.79rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
  line-height: 1.35;
  transition: all 0.12s;
}

.nav-subitem-link:hover,
.nav-subitem-link.active {
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
  font-weight: 500;
}

/* Main Content Area */
.main-stage {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-right: var(--toc-width);
  padding: 36px 48px 80px;
  max-width: 980px;
}

/* Right On-This-Page TOC */
.right-toc {
  width: var(--toc-width);
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  padding: 28px 18px;
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  background: var(--bg-canvas);
}

.right-toc-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.right-toc-list {
  list-style: none;
}

.right-toc-item {
  margin-bottom: 6px;
}

.right-toc-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 3px 8px;
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.right-toc-link:hover,
.right-toc-link.active {
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
  font-weight: 600;
}

/* ==========================================================================
   Article Typography & Structured Components
   ========================================================================== */
.chapter-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.chapter-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.chapter-title {
  font-size: 1.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.chapter-lead {
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.section-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-block h2 {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-block h3 {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 10px;
}

.section-block p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.section-block ul,
.section-block ol {
  padding-left: 22px;
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.section-block li {
  margin-bottom: 6px;
}

/* Callout Boxes */
.callout {
  padding: 15px 18px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  border-left: 4px solid var(--brand-primary);
  background: var(--brand-primary-soft);
}

.callout.emerald {
  border-left-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
}

.callout.amber {
  border-left-color: var(--accent-amber);
  background: var(--accent-amber-soft);
}

.callout.rose {
  border-left-color: var(--accent-rose);
  background: var(--accent-rose-soft);
}

.callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

/* KPI Summary Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0 22px;
}

.kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.38rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

table.kb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

table.kb-table th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

table.kb-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}

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

table.kb-table tr:hover td {
  background: rgba(26, 115, 232, 0.03);
}

/* ASCII Diagrams & Arithmetic Ledger Blocks */
pre.ascii-diagram {
  background: var(--bg-code);
  color: var(--text-code);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid #1e293b;
}

.formula-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-primary);
  margin: 12px 0 16px;
  line-height: 1.65;
}

.formula-card .step-highlight {
  color: var(--brand-primary);
  font-weight: 700;
}

/* Q&A Badge Header */
.qa-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--brand-primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 5px;
}

/* Chapter Footer Pagination */
.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.pager-btn {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.pager-btn.next {
  text-align: right;
}

.pager-btn:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.pager-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.pager-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-top: 2px;
}

/* Responsive Breakpoints */
@media (max-width: 1240px) {
  .right-toc {
    display: none;
  }
  .main-stage {
    margin-right: 0;
  }
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-block;
  }
  .brand-subtitle {
    display: none;
  }
  .search-wrapper {
    width: 210px;
  }
  .left-sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .left-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-stage {
    margin-left: 0;
    padding: 24px 18px 60px;
  }
}

/* ==========================================================================
   Google Auth Gate Overlay & Admin RBAC Console
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.auth-logo-badge {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a73e8 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(26, 115, 232, 0.35);
}

.auth-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.auth-notice-box {
  background: var(--brand-primary-soft);
  border: 1px solid rgba(26, 115, 232, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

.auth-notice-box strong {
  display: block;
  color: var(--brand-primary);
  margin-bottom: 4px;
}

.google-signin-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 20px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.google-signin-btn:hover {
  background: #f8fafc;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.2);
  transform: translateY(-1px);
}

.auth-alt-links {
  margin-top: 14px;
}

.auth-redirect-link {
  font-size: 0.8rem;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-redirect-link:hover {
  text-decoration: underline;
}

.auth-error-msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  font-size: 0.82rem;
  text-align: left;
}

.auth-admin-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.auth-pending-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  font-weight: 700;
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.auth-pending-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.auth-admin-contact-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.84rem;
  margin-bottom: 18px;
  line-height: 1.65;
}

.auth-pending-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-action-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}

.auth-action-btn.primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.auth-action-btn.secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Header Auth Controls */
.user-auth-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-console-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1a73e8 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.28);
}

.admin-console-btn:hover {
  opacity: 0.94;
}

.pending-count-pill {
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  color: var(--text-primary);
  max-width: 210px;
}

.user-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.user-role-dot.admin {
  background: #f59e0b;
}

.user-email-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.78rem;
  cursor: pointer;
}

.logout-btn:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

/* Admin Modal */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  max-width: 980px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.admin-modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.admin-close-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-tab.active {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.admin-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.admin-add-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.admin-input {
  flex: 2;
  min-width: 210px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.admin-input.note-input {
  flex: 1;
  min-width: 150px;
}

.admin-select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.admin-submit-btn {
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.admin-table th {
  background: var(--bg-subtle);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-strong);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.status-pill.approved {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.status-pill.pending {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

.status-pill.blocked {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
}

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.role-pill.admin {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-btn {
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.row-btn.approve {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
}

.row-btn.block {
  color: var(--accent-rose);
  border-color: rgba(225, 29, 72, 0.35);
}

.admin-rule-banner {
  background: var(--brand-primary-soft);
  border-left: 4px solid var(--brand-primary);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.55;
}

.rule-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--bg-surface);
}

