/* ============================================
   RyZe Codes — Codex Dark Theme
   OpenAI Codex-inspired · Deep Dark · Minimal
   Consolidated: style.css + shared.css + admin.css
   ============================================ */

/* ══════════════════════════════════════════
   1. DESIGN TOKENS
   ══════════════════════════════════════════ */

:root {
  /* ── Core Colors ── */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-soft: #1a1a1a;
  --surface-hover: #222222;
  --card: #181818;
  --card-hover: #1e1e1e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.03);
  --fg: #e5e5e5;
  --fg-secondary: #a3a3a3;
  --muted: #737373;
  --dim: #525252;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-dim: rgba(16, 185, 129, 0.10);
  --accent-light: #0d2818;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.08);
  --warning: #f59e0b;
  --code-bg: #0d0d0d;
  --purple: #a855f7;
  --sky: #0ea5e9;
  --secondary: #3b82f6;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);

  /* ── Radii ── */
  --rz-radius: 12px;
  --rz-radius-lg: 16px;
  --rz-radius-xl: 20px;
  --rz-radius-2xl: 24px;
  --rz-radius-pill: 9999px;

  /* ── Easing ── */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Duration ── */
  --rz-duration-fast: 150ms;
  --rz-duration-normal: 250ms;
  --rz-duration-slow: 350ms;

  /* ── Font Stacks ── */
  --rz-font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --rz-font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* ── Alias tokens for shared code ── */
  --rz-bg: #0a0a0a;
  --rz-surface: #181818;
  --rz-surface-soft: #1a1a1a;
  --rz-surface-elevated: #1e1e1e;
  --rz-border: rgba(255, 255, 255, 0.06);
  --rz-border-strong: rgba(255, 255, 255, 0.12);
  --rz-border-subtle: rgba(255, 255, 255, 0.03);
  --rz-text: #e5e5e5;
  --rz-text-soft: #a3a3a3;
  --rz-muted: #737373;
  --rz-accent: #10b981;
  --rz-accent-hover: #34d399;
  --rz-accent-soft: rgba(16, 185, 129, 0.10);
  --rz-accent-light: #0d2818;
  --rz-secondary: #3b82f6;
  --rz-secondary-hover: #60a5fa;
  --rz-secondary-soft: rgba(59, 130, 246, 0.10);
  --rz-success: #10b981;
  --rz-warning: #f59e0b;
  --rz-purple: #a855f7;
  --rz-danger: #ef4444;
  --rz-danger-soft: rgba(239, 68, 68, 0.08);

  /* ── Alias Shadows ── */
  --rz-shadow: 0 1px 2px rgba(0,0,0,0.3);
  --rz-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --rz-shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --rz-shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --rz-shadow-xl: 0 24px 60px rgba(0,0,0,0.6);

  /* ── Radius aliases for admin ── */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --font: var(--rz-font);
  --font-mono: var(--rz-font-mono);

  /* ── Frosted glass bg ── */
  --glass-bg: rgba(20, 20, 20, 0.85);
  --glass-bg-strong: rgba(14, 14, 14, 0.92);
}

/* ══════════════════════════════════════════
   LIGHT MODE TOKENS
   ══════════════════════════════════════════ */
html[data-theme="light"] {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f9f9fb;
  --surface-hover: #f0f0f2;
  --card: #ffffff;
  --card-hover: #f5f5f7;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --fg: #1d1d1f;
  --fg-secondary: #6e6e73;
  --muted: #86868b;
  --dim: #aeaeb2;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-dim: rgba(16, 185, 129, 0.08);
  --accent-light: #ecfdf5;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.06);
  --warning: #f59e0b;
  --code-bg: #f5f5f7;
  --purple: #a855f7;
  --sky: #0ea5e9;
  --secondary: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.12);

  --rz-bg: #f5f5f7;
  --rz-surface: #ffffff;
  --rz-surface-soft: #f9f9fb;
  --rz-surface-elevated: #f0f0f2;
  --rz-border: rgba(0, 0, 0, 0.08);
  --rz-border-strong: rgba(0, 0, 0, 0.14);
  --rz-border-subtle: rgba(0, 0, 0, 0.04);
  --rz-text: #1d1d1f;
  --rz-text-soft: #6e6e73;
  --rz-muted: #86868b;
  --rz-accent: #10b981;
  --rz-accent-hover: #059669;
  --rz-accent-soft: rgba(16, 185, 129, 0.08);
  --rz-accent-light: #ecfdf5;
  --rz-secondary: #3b82f6;
  --rz-secondary-hover: #2563eb;
  --rz-secondary-soft: rgba(59, 130, 246, 0.08);
  --rz-success: #10b981;
  --rz-warning: #f59e0b;
  --rz-purple: #a855f7;
  --rz-danger: #ef4444;
  --rz-danger-soft: rgba(239, 68, 68, 0.06);

  --rz-shadow: 0 1px 2px rgba(0,0,0,0.05);
  --rz-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --rz-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --rz-shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --rz-shadow-xl: 0 24px 60px rgba(0,0,0,0.12);

  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-bg-strong: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] {
  color-scheme: light;
}

/* ══════════════════════════════════════════
   2. BASE & HTML/BODY
   ══════════════════════════════════════════ */

html {
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.95) 0%, var(--bg) 400px),
    var(--bg) !important;
  color: var(--fg) !important;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
  font-family: var(--rz-font);
  letter-spacing: -0.01em;
}

img,
video,
iframe,
canvas {
  max-width: 100%;
}

::-webkit-scrollbar { display: none; }
.no-scroll { overflow: hidden; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════
   3. TAILWIND CLASS OVERRIDES
   High-specificity overrides for inline Tailwind
   ══════════════════════════════════════════ */

/* ── Background overrides ── */
body.bg-white,
.bg-white,
[class*="bg-white"] {
  background-color: var(--surface-soft) !important;
}

.bg-\[\#f8f9fa\],
.bg-\[\#F7F7FA\] {
  background-color: var(--surface) !important;
}

.bg-\[\#f1f3f4\] {
  background-color: var(--surface) !important;
}

.bg-\[\#e8eaed\] {
  background-color: var(--surface-hover) !important;
}

.bg-surface-50 {
  background-color: var(--surface) !important;
}

.bg-surface-100 {
  background-color: var(--surface) !important;
}

.bg-surface-950 {
  background-color: var(--code-bg) !important;
}

.bg-neutral-50 {
  background-color: var(--surface) !important;
}

.bg-neutral-200 {
  background-color: var(--surface-hover) !important;
}

.bg-neutral-300 {
  background-color: var(--dim) !important;
}

/* ── Text color overrides ── */
.text-neutral-900,
.text-neutral-950,
.text-\[\#1D1D1F\] {
  color: var(--fg) !important;
}

.text-\[\#5f6368\],
.text-\[\#636366\] {
  color: var(--fg-secondary) !important;
}

.text-neutral-500,
.text-neutral-400 {
  color: var(--fg-secondary) !important;
}

.text-neutral-300 {
  color: var(--muted) !important;
}

.text-\[\#8E8E93\] {
  color: var(--muted) !important;
}

.text-\[\#007AFF\] {
  color: var(--rz-secondary) !important;
}

/* ── Border overrides ── */
.border-\[\#dadce0\],
.border-\[\#D1D1D6\] {
  border-color: var(--border-strong) !important;
}

.border-\[\#e8eaed\],
.border-\[\#3c4043\] {
  border-color: var(--border) !important;
}

.border-neutral-100,
.border-neutral-200 {
  border-color: var(--border) !important;
}

.border-b-neutral-100,
.border-b-neutral-200 {
  border-bottom-color: var(--border) !important;
}

/* ── Colored tint backgrounds (dark variants) ── */
.bg-purple-50,
.bg-purple-500\/10 {
  background-color: rgba(168, 85, 247, 0.08) !important;
}

.bg-sky-50,
.bg-sky-500\/10 {
  background-color: rgba(14, 165, 233, 0.08) !important;
}

.bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.08) !important;
}

.bg-red-50 {
  background-color: var(--danger-dim) !important;
}

.bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.08) !important;
}

.bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.06) !important;
}

.bg-emerald-50 {
  background-color: var(--accent-dim) !important;
}

.bg-green-50 {
  background-color: var(--accent-dim) !important;
}

/* ── Colored borders (dark variants) ── */
.border-purple-100,
.border-purple-200 {
  border-color: rgba(168, 85, 247, 0.15) !important;
}

.border-sky-100,
.border-sky-200 {
  border-color: rgba(14, 165, 233, 0.15) !important;
}

.border-red-100 {
  border-color: rgba(239, 68, 68, 0.15) !important;
}

.border-amber-100 {
  border-color: rgba(245, 158, 11, 0.15) !important;
}

/* ── Colored text (keep, but adjust for dark) ── */
.text-amber-700 {
  color: var(--warning) !important;
}

.text-amber-700\/90 {
  color: rgba(245, 158, 11, 0.85) !important;
}

.text-red-600 {
  color: var(--danger) !important;
}

.text-red-500 {
  color: var(--danger) !important;
}

.text-red-400 {
  color: #f87171 !important;
}

.text-red-300 {
  color: #fca5a5 !important;
}

.text-blue-500 {
  color: var(--rz-secondary) !important;
}

.text-blue-600 {
  color: #60a5fa !important;
}

.text-purple-500,
.text-purple-600 {
  color: var(--purple) !important;
}

.text-purple-400 {
  color: #c084fc !important;
}

.text-sky-500 {
  color: var(--sky) !important;
}

.text-sky-400 {
  color: #38bdf8 !important;
}

.text-sky-300 {
  color: #7dd3fc !important;
}

.text-sky-600 {
  color: var(--sky) !important;
}

.text-orange-500 {
  color: #f97316 !important;
}

.text-orange-400 {
  color: #fb923c !important;
}

.text-indigo-500 {
  color: #818cf8 !important;
}

.text-emerald-600\/80 {
  color: rgba(52, 211, 153, 0.8) !important;
}

/* ── Input overrides ── */
input::placeholder,
textarea::placeholder,
.placeholder\:text-neutral-300 {
  color: var(--dim) !important;
}

/* ── Colored icon/text overrides ── */
.bg-accent\/10 {
  background-color: var(--accent-dim) !important;
}

.bg-sky-100 {
  background-color: rgba(14, 165, 233, 0.10) !important;
}

.border-sky-100 {
  border-color: rgba(14, 165, 233, 0.15) !important;
}

.hover\:bg-red-50:hover {
  background-color: var(--danger-dim) !important;
}

.hover\:bg-neutral-50:hover,
.hover\:bg-neutral-200:hover {
  background-color: var(--surface-hover) !important;
}

.hover\:bg-surface-50:hover,
.hover\:bg-surface-100:hover {
  background-color: var(--surface-hover) !important;
}

.hover\:bg-\[\#f1f3f4\]:hover {
  background-color: var(--surface-hover) !important;
}

/* ── Divider overrides ── */
.divide-\[\#e8eaed\] > :not(:last-child) {
  border-color: var(--border) !important;
}

/* ── Shadow overrides ── */
.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

/* ── Auth tab active override ── */
.auth-tab.bg-white {
  background-color: var(--card) !important;
  color: var(--fg) !important;
}

/* ── Accent utility overrides ── */
.text-accent { color: var(--accent) !important; }
.bg-accent { background-color: var(--accent) !important; }
.border-accent { border-color: var(--accent) !important; }
.hover\:bg-accent-hover:hover { background-color: var(--accent-hover) !important; }
.focus\:border-accent:focus { border-color: var(--accent) !important; }
.focus\:ring-accent\/10:focus { --tw-ring-color: rgba(16, 185, 129, 0.10) !important; }

/* ── Element font overrides ── */
button,
a,
input,
textarea,
select {
  letter-spacing: -0.01em !important;
  font-family: var(--rz-font);
}

/* ── Override surface token vars for Tailwind runtime ── */
body,
.ios-page {
  --accent: var(--rz-accent) !important;
  --accent-hover: var(--rz-accent-hover) !important;
  --accent-dim: var(--rz-accent-soft) !important;
  --accent-light: var(--rz-accent-light) !important;
  --surface: var(--rz-surface-soft) !important;
  --surface-hover: var(--rz-surface-hover) !important;
  --border: var(--rz-border) !important;
  --border-light: var(--rz-border-subtle) !important;
  --fg: var(--rz-text) !important;
  --fg-secondary: var(--rz-text-soft) !important;
  --muted: var(--rz-muted) !important;
}

/* ── Handle bar inside sheets ── */
.bg-neutral-200,
.w-10.h-1.rounded-full.bg-neutral-200 {
  background-color: var(--dim) !important;
}

/* ══════════════════════════════════════════
   4. ANIMATIONS
   ══════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px) scale(0.96); }
}

@keyframes skeletonPulse {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes slide-bg {
  0% { background-position: 0 0; }
  100% { background-position: 16px 0; }
}

@keyframes chatTypingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

@keyframes adminChatTypingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.admin-rainbow-badge {
  background: linear-gradient(270deg, #ff0000, #ff8000, #ffff00, #00ff00, #00bfff, #8000ff, #ff00ff, #ff0000);
  background-size: 400% 400%;
  animation: rainbowShift 3s ease infinite;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

.fade-in {
  animation: fadeIn 0.2s var(--ease-out);
}

.fade-up {
  animation: fadeUp 0.4s var(--ease-out) both;
}

.slide-up {
  animation: slideUp 0.3s var(--ease-out);
}

.toast-anim {
  animation: toastIn 0.3s var(--ease-out),
             toastOut 0.3s ease 2.2s forwards;
}

.card-press {
  transition: transform 0.15s var(--ease);
}

.card-press:active {
  transform: scale(0.97);
}

.pop-anim {
  animation: heartPop 0.35s var(--ease-spring);
}

/* ══════════════════════════════════════════
   5. SPINNER & LOADING
   ══════════════════════════════════════════ */

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.10);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,0.04) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: var(--rz-radius);
}

.loading-indicator {
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ══════════════════════════════════════════
   6. SHELL & LAYOUT
   ══════════════════════════════════════════ */

.rz-shell {
  width: min(1180px, 100%);
  margin-inline: auto;
  min-height: 100vh;
}

.ios-page,
.apple-page {
  background: var(--bg) !important;
  color: var(--rz-text) !important;
}

/* ── Section & Grid ── */
.rz-section {
  padding: 16px 20px;
}

.rz-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rz-quick-action,
.rz-admin-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 14px;
  border-radius: var(--rz-radius-lg);
  border: 0.5px solid var(--rz-border) !important;
  background: var(--card) !important;
  box-shadow: var(--rz-shadow-sm);
  text-align: left;
  text-decoration: none;
  color: var(--rz-text);
  transition: transform var(--rz-duration-normal) var(--ease-out),
              box-shadow var(--rz-duration-normal) var(--ease-out),
              border-color var(--rz-duration-normal) var(--rz-ease),
              background var(--rz-duration-fast) var(--rz-ease);
}

.rz-quick-action:hover,
.rz-admin-entry:hover {
  border-color: var(--rz-border-strong) !important;
  background: var(--card-hover) !important;
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-md);
}

.rz-quick-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--rz-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rz-accent);
  background: var(--rz-accent-soft);
  flex: 0 0 auto;
  transition: transform var(--rz-duration-normal) var(--ease-spring);
}

.rz-quick-action:hover .rz-quick-icon {
  transform: scale(1.08);
}

.rz-admin-entry {
  grid-column: 1 / -1;
  border-color: rgba(16, 185, 129, 0.18) !important;
  background: linear-gradient(135deg, var(--card) 0%, var(--accent-light) 100%) !important;
}

.rz-admin-entry .rz-quick-icon {
  background: var(--rz-accent);
  color: #fff;
}

/* ══════════════════════════════════════════
   7. NAVIGATION — TOP BAR
   ══════════════════════════════════════════ */

.home-topbar-wrap {
  background: transparent;
  border-bottom: none;
}

.home-topbar-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border: 0.5px solid var(--border-strong);
  border-radius: 18px;
  background: var(--glass-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: box-shadow 0.25s var(--ease);
}

.home-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--rz-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 52%, #10b981 120%);
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring);
}

.home-brand-mark:hover {
  transform: scale(1.05);
}

.home-mini-pill,
.home-icon-btn,
.header-user-pill,
.header-login-pill,
.home-dock-create-btn {
  transition: all 0.2s var(--ease);
}

.home-mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--rz-radius-pill);
  border: 0.5px solid var(--border-strong);
  background: var(--card);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.home-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-user-pill {
  width: 40px;
  height: 40px;
  padding: 2px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.header-user-pill img,
#headerUserFallback {
  width: 100%;
  height: 100%;
}

#headerUserFallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.header-user-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--accent);
}

.header-login-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 22px;
  border-radius: var(--rz-radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22);
}

.home-mini-pill:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.home-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.header-user-pill:hover {
  border-color: var(--accent);
}

.header-login-pill:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
  transform: scale(1.02);
}

.home-dock-create-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.38);
  transform: scale(1.08);
}

/* ── Admin Top Bar ── */
.admin-topbar-wrap {
  background: transparent;
  border-bottom: none;
}

.admin-topbar-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.admin-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 52%, #10b981 120%);
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring);
}

.admin-brand-mark:hover {
  transform: scale(1.05);
}

.admin-topbar-link,
.admin-profile-link,
.admin-logout-btn {
  transition: all 0.2s var(--ease);
}

.admin-topbar-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-topbar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.admin-profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  text-decoration: none;
  position: relative;
}

.admin-profile-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.admin-profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fg-secondary), var(--muted));
}

.admin-profile-avatar > * {
  width: 100%;
  height: 100%;
}

.admin-profile-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--accent);
}

.admin-logout-btn {
  border: 0.5px solid var(--border-strong);
  background: var(--card);
  color: var(--danger);
  border-radius: var(--radius-pill);
  height: 38px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s var(--ease);
}

.admin-logout-btn:hover {
  background: var(--danger-dim);
  border-color: rgba(239, 68, 68, 0.20);
}

/* ══════════════════════════════════════════
   8. FROSTED GLASS NAVIGATION
   ══════════════════════════════════════════ */

.ios-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 0.5px solid var(--border-strong) !important;
  background: var(--glass-bg) !important;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.rz-topbar,
.home-topbar-shell,
.admin-topbar-shell {
  border-radius: var(--rz-radius-lg) !important;
  border: 0.5px solid var(--border-strong) !important;
  background: var(--glass-bg) !important;
  box-shadow: var(--shadow-md) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  transition: box-shadow var(--rz-duration-normal) var(--rz-ease);
}

.apple-nav,
.apple-glass-bar {
  border: 0.5px solid var(--border-strong) !important;
  background: var(--glass-bg) !important;
  box-shadow: var(--shadow-md) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}

/* ══════════════════════════════════════════
   9. BOTTOM NAVIGATION (Frosted Glass)
   ══════════════════════════════════════════ */

.rz-bottom-nav,
.home-dock-shell,
.admin-dock-shell {
  border-top: 0.5px solid var(--border-strong) !important;
  background: var(--glass-bg) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}

.home-dock-shell {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 4px 0 6px;
  border-radius: 0;
  border: none;
  border-top: 0.5px solid var(--border-strong);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: none;
}

.nav-item {
  color: var(--fg-secondary) !important;
  transition: color var(--rz-duration-fast) var(--rz-ease) !important;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 0 8px;
  border-radius: 0;
  border: none;
  background: transparent;
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background: transparent;
  color: var(--fg) !important;
}

.nav-item.active {
  color: var(--accent) !important;
  background: transparent;
  box-shadow: none;
  transform: none;
  font-weight: 600;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

#navCreateItem {
  padding: 0;
  min-height: auto;
  border: none;
  background: transparent;
}

#navCreateItem:hover {
  background: transparent;
  border-color: transparent;
  transform: none;
}

#navCreateItem.active::after {
  display: none;
}

.home-dock-create-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.32);
  margin-top: -12px;
  transition: transform var(--rz-duration-normal) var(--ease-spring),
              box-shadow var(--rz-duration-normal) var(--rz-ease) !important;
}

.home-dock-create-btn:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.38) !important;
}

.home-dock-create-btn:active {
  transform: scale(0.95) !important;
}

#navChatBadge {
  top: 4px;
  right: 50%;
  transform: translateX(14px);
}

/* ── Admin Bottom Dock ── */
.admin-dock-shell {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 4px 0 8px;
  border-radius: 0;
  border: none;
  border-top: 0.5px solid var(--border-strong);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: none;
  width: 100%;
  box-shadow: var(--rz-shadow-lg) !important;
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  padding: 6px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--fg-secondary) !important;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  width: 100%;
  min-width: 0;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.bottom-nav-btn:hover {
  background: transparent;
  color: var(--fg) !important;
}

.bottom-nav-btn.active {
  background: transparent;
  color: var(--accent) !important;
  border: none;
  box-shadow: none;
}

.bottom-nav-btn.active::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.admin-more-tab-btn {
  min-height: 96px !important;
}

/* ══════════════════════════════════════════
   10. DESKTOP RAIL
   ══════════════════════════════════════════ */

.rz-rail {
  display: none;
}

.rz-mobile-only {
  display: block;
}

.rz-desktop-only {
  display: none;
}

/* ══════════════════════════════════════════
   11. CARDS & SURFACES
   ══════════════════════════════════════════ */

.ios-card {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-xl) !important;
  background: var(--card) !important;
  backdrop-filter: blur(8px);
  box-shadow: var(--rz-shadow-sm) !important;
  transition: transform var(--rz-duration-normal) var(--rz-ease-out),
              box-shadow var(--rz-duration-normal) var(--rz-ease-out);
}

.ios-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--rz-shadow-md) !important;
}

.ios-list {
  border: 0.5px solid var(--rz-border);
  border-radius: var(--rz-radius-xl);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--rz-shadow-sm);
}

.ios-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  transition: background var(--rz-duration-fast) var(--rz-ease);
}

.ios-row:hover {
  background: var(--surface-hover);
}

.ios-row:last-child {
  border-bottom: 0;
}

.apple-card,
.apple-list,
.apple-sheet {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--card) !important;
  backdrop-filter: blur(12px);
  box-shadow: var(--rz-shadow-sm), var(--rz-shadow-md) !important;
}

.apple-row {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  transition: background var(--rz-duration-fast) var(--rz-ease);
}

.apple-row:hover {
  background: var(--surface-hover);
}

/* ── Card Grid System ── */
.rz-card,
.admin-stat-card,
.admin-surface-card,
.market-hero-card,
.market-ticker-card,
.market-board-row,
#scrapersGrid > article,
#communityGrid > article,
#filesGrid > article,
#galleryGrid > article,
.profile-sidebar-card,
.profile-surface-card {
  border-radius: var(--rz-radius-xl) !important;
  border: 0.5px solid var(--rz-border) !important;
  background: var(--card) !important;
  box-shadow: var(--rz-shadow-sm) !important;
  overflow: hidden;
  transition: transform var(--rz-duration-normal) var(--rz-ease-out),
              box-shadow var(--rz-duration-normal) var(--rz-ease-out),
              border-color var(--rz-duration-normal) var(--rz-ease);
}

.rz-card:hover,
#scrapersGrid > article:hover,
#communityGrid > article:hover,
#filesGrid > article:hover,
#galleryGrid > article:hover {
  border-color: var(--rz-border-strong) !important;
  transform: translateY(-2px);
  box-shadow: var(--rz-shadow-md) !important;
}

/* ── Admin Stat Card ── */
.admin-stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.admin-stat-card:hover {
  box-shadow: var(--rz-shadow-md) !important;
  transform: translateY(-1px);
}

/* ── Admin Surface Card ── */
.admin-surface-card {
  transition: box-shadow 0.25s var(--ease);
}

.admin-surface-card:hover {
  box-shadow: var(--rz-shadow-md) !important;
}

/* ── Admin Hero Card ── */
.admin-hero-card {
  position: relative;
  overflow: hidden;
  border: 0.5px solid var(--rz-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, transparent 45%),
              var(--card) !important;
  box-shadow: var(--rz-shadow-sm);
  transition: box-shadow 0.25s var(--ease);
}

.admin-hero-card:hover {
  box-shadow: var(--rz-shadow-md);
}

.admin-hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}

.admin-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
}

.admin-hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--border-strong);
  background: var(--card);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.admin-hero-action:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-sm);
}

.admin-hero-action.primary {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22);
}

.admin-hero-action.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
  transform: translateY(-1px);
}

/* ── More Tab Button ── */
.admin-more-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  min-height: 112px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--rz-border);
  background: var(--card);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.admin-more-tab-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-sm);
}

.admin-more-tab-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.06);
}

/* ── Code Panel (GitHub-inspired) ── */
.apple-code-panel {
  overflow: hidden;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--rz-radius-xl);
  background: var(--card);
  box-shadow: var(--rz-shadow-sm);
}

.apple-code-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  padding: 0 14px;
}

/* ══════════════════════════════════════════
   12. BUTTONS
   ══════════════════════════════════════════ */

.rz-btn,
.rz-icon-btn,
.home-icon-btn,
.admin-topbar-link,
.bottom-nav-btn,
.nav-item {
  min-width: 44px;
  min-height: 44px;
}

.rz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--rz-radius-pill);
  border: 0.5px solid var(--border-strong);
  background: var(--card);
  color: var(--rz-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

.rz-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.rz-btn.primary {
  border-color: transparent;
  background: var(--rz-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22);
}

.rz-btn.primary:hover {
  background: var(--rz-accent-hover);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.rz-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--rz-radius-pill);
  border: none;
  color: var(--rz-text-soft);
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

.rz-icon-btn:hover,
.home-icon-btn:hover,
.admin-topbar-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--rz-text) !important;
}

.ios-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--rz-radius-pill);
  background: var(--rz-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--rz-duration-fast) var(--rz-ease);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.24);
}

.ios-primary-action:hover {
  background: var(--rz-accent-hover);
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.30);
}

.ios-primary-action:active {
  transform: scale(0.98);
}

.ios-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--rz-radius-pill);
  background: var(--rz-secondary-soft);
  color: var(--rz-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

.ios-secondary-action:hover {
  background: rgba(59, 130, 246, 0.16);
}

/* ══════════════════════════════════════════
   13. INPUTS & FORMS
   ══════════════════════════════════════════ */

input,
textarea,
select {
  border-radius: var(--rz-radius) !important;
  transition: border-color var(--rz-duration-fast) var(--rz-ease),
              box-shadow var(--rz-duration-fast) var(--rz-ease) !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--rz-accent) !important;
  box-shadow: 0 0 0 4px var(--rz-accent-soft) !important;
}

.input-field:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

/* ══════════════════════════════════════════
   14. CHIPS, TABS & PILLS
   ══════════════════════════════════════════ */

.chip {
  background: var(--card);
  color: var(--fg-secondary);
  border-color: var(--border);
  box-shadow: none;
  transition: all 0.2s var(--ease);
}

.chip:hover {
  background: var(--surface-hover);
  color: var(--fg);
  border-color: var(--border-strong);
}

.chip-active {
  background: var(--accent-light) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.16) !important;
}

.sort-chip {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}

.sort-chip:hover {
  background: var(--surface-hover);
  color: var(--fg);
  border-color: var(--border);
}

.sort-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22);
}

.ios-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--rz-radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--rz-text-soft);
  font-size: 11px;
  font-weight: 600;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

.ios-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: var(--rz-radius);
  background: rgba(255, 255, 255, 0.05);
}

.ios-segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border-radius: var(--rz-radius);
  background: rgba(255, 255, 255, 0.05);
}

.ios-segmented > * {
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--rz-text-soft);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

.ios-segmented .active,
.ios-segmented [aria-selected="true"] {
  background: var(--card);
  color: var(--rz-text);
  box-shadow: var(--rz-shadow-sm);
}

.chip,
.sort-chip,
.admin-hero-chip,
.page-btn,
.stat-pill {
  border-radius: var(--rz-radius-pill) !important;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

/* ── Stat Pills ── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 9999px;
  background: var(--surface);
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-secondary);
}

.action-pill {
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}

.action-pill:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.action-pill.liked {
  background: var(--accent-dim);
  color: var(--accent);
}

.action-pill.disliked {
  background: var(--danger-dim);
  color: var(--danger);
}

/* ── Tab indicators ── */
.tab-active {
  color: var(--fg);
  border-color: var(--accent);
}

.tab-inactive {
  color: var(--fg-secondary);
  border-color: transparent;
}

.tab-inactive:hover {
  color: var(--fg);
}

/* ── Admin dock & tab active states ── */
.admin-dock-item.active,
.admin-tab-btn.active,
.rz-rail .active {
  color: var(--rz-accent) !important;
  background: var(--rz-accent-soft) !important;
}

/* ══════════════════════════════════════════
   15. CODE WINDOWS
   ══════════════════════════════════════════ */

.code-window {
  background: var(--code-bg);
  border-radius: var(--rz-radius-xl);
  overflow: hidden;
  border: 0.5px solid var(--border-strong);
  margin: 16px;
  box-shadow: var(--shadow-md);
}

.code-topbar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  gap: 8px;
}

.code-filename {
  font-family: var(--rz-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
}

.code-with-lines {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
}

.code-gutter {
  padding: 12px 8px 12px 0;
  text-align: right;
  border-right: 0.5px solid var(--border);
  color: var(--muted);
  font-family: var(--rz-font-mono);
  font-size: 11px;
  line-height: 1.7;
  user-select: none;
  background: var(--surface);
}

.code-gutter span {
  display: block;
}

.code-block {
  margin: 0;
  padding: 12px 16px;
  overflow-x: auto;
  font-family: var(--rz-font-mono);
  font-size: 12px;
  line-height: 1.7;
  background: transparent !important;
  color: var(--fg);
}

.code-block::-webkit-scrollbar {
  height: 3px;
  display: block;
}

.code-block::-webkit-scrollbar-track {
  background: transparent;
}

.code-block::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.code-action {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--rz-radius);
  background: var(--card);
  border: 0.5px solid var(--border);
  color: var(--fg-secondary);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.code-action:hover {
  background: var(--surface-hover);
  color: var(--fg);
  border-color: var(--border-strong);
}

/* ══════════════════════════════════════════
   16. MODALS & SHEETS
   ══════════════════════════════════════════ */

.modal-backdrop {
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.modal-backdrop + div,
#createMenuSheet > div:last-child,
#suggestionModal > div:last-child,
#fileUploadModal > div:last-child,
#communityPostModal > div:last-child,
#communityEditModal > div:last-child,
#adminScraperSheet > div:last-child,
#privateCodeSheet > div:last-child {
  border-radius: var(--rz-radius-2xl) var(--rz-radius-2xl) 0 0 !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  background: var(--glass-bg-strong) !important;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.50) !important;
}

/* ══════════════════════════════════════════
   17. COMMENTS
   ══════════════════════════════════════════ */

.comment {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border);
}

.comment:last-child {
  border-bottom: none;
}

.comment-reply {
  margin-left: 38px;
  padding: 8px 0;
}

.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.comment-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.comment-time {
  font-size: 10px;
  color: var(--muted);
}

.comment-text {
  font-size: 12px;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  line-height: 1.55;
}

.comment-actions {
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.comment-like-btn,
.comment-dislike-btn,
.comment-reply-btn {
  height: 24px;
  padding: 0 8px;
  border-radius: var(--rz-radius);
  background: transparent;
  border: none;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.comment-like-btn:hover,
.comment-dislike-btn:hover,
.comment-reply-btn:hover {
  background: var(--surface);
  color: var(--fg-secondary);
}

.comment-like-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.comment-dislike-btn.active {
  color: var(--danger);
  background: var(--danger-dim);
}

.reply-input-wrap {
  padding: 8px 0 8px 42px;
}

.reply-input-wrap.hidden {
  display: none !important;
}

.reply-input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--rz-radius);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.reply-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.reply-submit-btn {
  height: 34px;
  padding: 0 18px;
  border-radius: var(--rz-radius);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border: 0;
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.18);
}

.reply-submit-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.24);
}

.comments-empty,
.ann-comments-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ══════════════════════════════════════════
   18. VOTE TOOLTIP
   ══════════════════════════════════════════ */

.vote-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: var(--rz-radius);
  background: var(--fg);
  color: #0a0a0a;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  animation: fadeIn 0.15s var(--ease);
  box-shadow: var(--shadow-md);
}

/* ══════════════════════════════════════════
   19. TOAST
   ══════════════════════════════════════════ */

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--rz-radius-lg);
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.success {
  background: rgba(5, 150, 105, 0.92);
  backdrop-filter: blur(20px);
}

.toast.error {
  background: rgba(217, 48, 37, 0.92);
  backdrop-filter: blur(20px);
}

/* ══════════════════════════════════════════
   20. ANNOUNCEMENTS
   ══════════════════════════════════════════ */

.ann-card {
  padding: 16px;
  border-radius: var(--rz-radius-xl);
  background: var(--card);
  border: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--rz-shadow-sm);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.ann-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-md);
}

.ann-card.pinned {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.15);
}

.ann-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ann-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.ann-card-date {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.ann-card-body {
  font-size: 13px;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  line-height: 1.55;
}

.ann-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
}

.ann-card-author {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ann-card-author img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.ann-card-comments-status {
  font-weight: 600;
}

.ann-card-comments-status.enabled {
  color: var(--accent);
}

.ann-card-comments-status.disabled {
  color: var(--warning);
}

.ann-comments-toggle {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--rz-radius);
  border: 0.5px solid var(--border);
  background: var(--card);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.ann-comments-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.ann-comments-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ann-comment-input-inner {
  display: flex;
  gap: 8px;
}

.ann-comment-input-inner input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--rz-radius);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.ann-comment-input-inner input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.ann-comment-send-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--rz-radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.18);
}

.ann-comment-send-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.24);
}

.ann-comments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ann-admin-comment {
  padding: 12px;
  border-radius: var(--rz-radius-lg);
  background: var(--surface);
  border: 0.5px solid var(--border);
}

.ann-admin-comment-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ann-admin-comment-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
}

.ann-admin-comment-time {
  font-size: 10px;
  color: var(--muted);
}

.ann-admin-comment-text {
  font-size: 12px;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  margin-top: 4px;
  line-height: 1.55;
}

/* ══════════════════════════════════════════
   21. PAGINATION
   ══════════════════════════════════════════ */

.page-btn {
  height: 38px;
  min-width: 38px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: none;
}

.page-btn:hover {
  background: var(--surface-hover);
  color: var(--fg);
  border-color: var(--border-strong);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22);
}

/* ══════════════════════════════════════════
   22. MARKET / TOP BOARD
   ══════════════════════════════════════════ */

.market-ticker-card {
  padding: 16px;
  border-radius: var(--rz-radius-xl);
  background: var(--card);
  border: 0.5px solid var(--border);
  backdrop-filter: none;
  box-shadow: var(--rz-shadow-sm);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.market-ticker-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-md);
}

.market-ticker-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.market-ticker-title {
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
}

.market-ticker-value {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--fg);
}

.market-board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--rz-radius-lg);
  background: var(--card);
  border: 0.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background 0.2s var(--ease), border-color 0.2s var(--ease);
  box-shadow: var(--rz-shadow-sm);
}

.market-board-row:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--rz-shadow-md);
}

.market-hero-card {
  border: 0.5px solid var(--border);
  border-radius: var(--rz-radius-xl);
  padding: 22px;
  background: var(--card);
  box-shadow: var(--rz-shadow-sm);
}

.market-board-rank {
  width: 26px;
  height: 26px;
  border-radius: var(--rz-radius);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.market-board-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
}

.market-board-val {
  font-size: 11px;
  color: var(--fg-secondary);
  font-weight: 600;
}

/* ══════════════════════════════════════════
   23. CHAT
   ══════════════════════════════════════════ */

#chatSheet .chat-messages {
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 80px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  word-wrap: break-word;
  line-height: 1.45;
}

.chat-msg-sent {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.16);
}

.chat-msg-received {
  background: var(--card);
  color: var(--fg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 0.5px solid var(--border);
}

.chat-messages .w-full {
  margin-bottom: 2px;
}

.chat-messages .w-full .chat-msg {
  position: relative;
}

/* ── Chat Hub ── */
.chat-hub-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.chat-hub-sidebar {
  min-height: 220px;
  max-height: 260px;
  overflow: hidden;
}

.chat-hub-thread-list {
  overflow-y: auto;
  max-height: calc(260px - 69px);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-hub-thread {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--rz-radius-lg);
  border: 0.5px solid transparent;
  background: transparent;
  transition: all 0.2s var(--ease);
  text-align: left;
}

.chat-hub-thread:hover {
  background: var(--surface-hover);
  border-color: transparent;
}

.chat-hub-thread.active {
  background: var(--accent-light);
  border-color: rgba(16, 185, 129, 0.12);
}

.chat-hub-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 15px;
  font-weight: 700;
}

.chat-hub-avatar img,
.chat-hub-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-hub-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.chat-hub-conversation {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-hub-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
}

.chat-image-card {
  position: relative;
  border-radius: var(--rz-radius-lg);
  overflow: hidden;
}

.chat-image-open-btn {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: var(--rz-radius-lg);
  overflow: hidden;
  cursor: pointer;
}

.chat-image-open-btn:active {
  transform: scale(0.99);
}

.chat-image-open-btn img {
  display: block;
  width: 100%;
  max-width: min(72vw, 280px);
  max-height: 380px;
  height: auto;
  object-fit: cover;
}

.chat-image-download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: background 0.2s var(--ease);
}

.chat-image-download-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.chat-image-viewer-stage {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
}

.chat-hub-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 11px;
  font-weight: 700;
}

.chat-hub-bubble {
  max-width: min(84%, 520px);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-hub-bubble.sent {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.16);
}

.chat-hub-bubble.received {
  background: var(--card);
  color: var(--fg);
  border: 0.5px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-hub-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  background: var(--card);
  border: 0.5px solid var(--border);
}

.chat-hub-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chatTypingBounce 1.1s infinite ease-in-out;
}

.chat-hub-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-hub-typing-dot:nth-child(3) { animation-delay: 0.3s; }

#chatHubSheet.chat-hub-mobile-threads .chat-hub-sidebar {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  max-height: none;
}

#chatHubSheet.chat-hub-mobile-threads .chat-hub-thread-list {
  flex: 1;
  max-height: none;
  padding-bottom: 22px;
}

#chatHubSheet.chat-hub-mobile-threads .chat-hub-conversation {
  display: none !important;
}

#chatHubSheet.chat-hub-mobile-conversation .chat-hub-sidebar {
  display: none !important;
}

#chatHubSheet.chat-hub-mobile-conversation .chat-hub-conversation {
  display: flex !important;
  flex: 1;
  min-height: 0;
}

#chatHubSheet.chat-hub-mobile-conversation #chatHubActiveHeader {
  display: none !important;
}

/* ── Admin Chat ── */
.admin-chat-thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-chat-thread {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid transparent;
  background: transparent;
  text-align: left;
  transition: all 0.2s var(--ease);
}

.admin-chat-thread:hover {
  background: var(--surface-hover);
  border-color: transparent;
}

.admin-chat-thread.active {
  background: var(--accent-dim);
  border-color: rgba(16, 185, 129, 0.10);
}

.admin-chat-avatar,
.admin-chat-mini-avatar {
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--fg-secondary), var(--muted));
}

.admin-chat-avatar {
  width: 46px;
  height: 46px;
  font-size: 15px;
}

.admin-chat-mini-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.admin-chat-avatar img,
.admin-chat-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-chat-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.admin-chat-messages {
  flex: 1;
  min-height: 320px;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
}

.admin-chat-bubble {
  max-width: min(84%, 560px);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.admin-chat-bubble.sent {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.16);
}

.admin-chat-bubble.received {
  background: var(--card);
  color: var(--fg);
  border: 0.5px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--rz-shadow-sm);
}

.admin-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  background: var(--card);
  border: 0.5px solid var(--border);
  box-shadow: var(--rz-shadow-sm);
}

.admin-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: adminChatTypingBounce 1.1s infinite ease-in-out;
}

.admin-chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.admin-chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* ══════════════════════════════════════════
   24. SPOILER TEXT
   ══════════════════════════════════════════ */

.spoiler-text {
  color: transparent !important;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.06) 75%, transparent 75%, transparent);
  background-size: 8px 8px;
  animation: slide-bg 1s linear infinite;
  border-radius: var(--rz-radius);
  user-select: none;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
  background-color: var(--dim);
}

.spoiler-text:hover {
  opacity: 0.8;
}

/* ══════════════════════════════════════════
   25. API STATUS BADGES
   ══════════════════════════════════════════ */

.api-status-ready {
  border-color: rgba(16, 185, 129, 0.20) !important;
  background: rgba(16, 185, 129, 0.08) !important;
  color: #34d399 !important;
}

.api-status-pending {
  border-color: rgba(245, 158, 11, 0.20) !important;
  background: rgba(245, 158, 11, 0.08) !important;
  color: #fbbf24 !important;
}

.api-status-failed {
  border-color: rgba(239, 68, 68, 0.18) !important;
  background: rgba(239, 68, 68, 0.06) !important;
  color: #f87171 !important;
}

.api-status-muted {
  color: var(--rz-muted) !important;
}

/* ── Status Badges (Admin) ── */
.badge-active { background: rgba(16, 185, 129, 0.08); color: #34d399; }
.badge-deprecated { background: rgba(245, 158, 11, 0.08); color: #fbbf24; }
.badge-broken { background: rgba(239, 68, 68, 0.06); color: #f87171; }
.badge-pending { background: rgba(245, 158, 11, 0.08); color: #fbbf24; }
.badge-approved { background: rgba(16, 185, 129, 0.08); color: #34d399; }
.badge-rejected { background: rgba(239, 68, 68, 0.06); color: #f87171; }
.badge-resolved { background: rgba(16, 185, 129, 0.08); color: #34d399; }
.badge-dismissed { background: rgba(115, 115, 115, 0.08); color: #737373; }
.badge-available { background: rgba(16, 185, 129, 0.08); color: #34d399; }
.badge-used { background: rgba(115, 115, 115, 0.08); color: #737373; }
.badge-expired { background: rgba(239, 68, 68, 0.06); color: #f87171; }

/* ══════════════════════════════════════════
   26. TOGGLE SWITCH
   ══════════════════════════════════════════ */

.toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.10);
  position: relative;
  cursor: pointer;
  transition: background 0.25s var(--ease);
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.toggle-switch .dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.25s var(--ease-out);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch.active {
  background: var(--accent);
}

.toggle-switch.active .dot {
  transform: translateX(18px);
}

/* ── Line clamp ── */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   27. ADMIN LOG ACTION COLORS
   ══════════════════════════════════════════ */

.log-create { border-left-color: #10b981; }
.log-update { border-left-color: #3b82f6; }
.log-delete { border-left-color: #ef4444; }
.log-auth { border-left-color: #f59e0b; }
.log-default { border-left-color: #737373; }

/* ── Scrollbar for code areas ── */
textarea::-webkit-scrollbar { display: block; width: 6px; }
textarea::-webkit-scrollbar-track { background: transparent; }
textarea::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ══════════════════════════════════════════
   28. AUTH PAGES
   ══════════════════════════════════════════ */

body:has(#loginForm),
body:has(#registerForm),
body:has(#inviteRegisterForm) {
  background:
    radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.04), transparent 28rem),
    var(--bg) !important;
}

body:has(#loginForm) > .w-full,
body:has(#registerForm) > .w-full,
body:has(#inviteRegisterForm) > .w-full,
#loginRequired > div,
#invalidLink > div,
#successScreen > div {
  border: 0.5px solid var(--border-strong) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--glass-bg-strong) !important;
  backdrop-filter: blur(12px);
  box-shadow: var(--rz-shadow-xl) !important;
  padding: 28px;
}

body:has(#loginForm) input,
body:has(#registerForm) input,
body:has(#inviteRegisterForm) input {
  min-height: 46px !important;
  border-color: var(--border-strong) !important;
  border-radius: var(--rz-radius) !important;
  background: var(--surface-soft) !important;
  color: var(--fg) !important;
}

body:has(#loginForm) input:focus,
body:has(#registerForm) input:focus,
body:has(#inviteRegisterForm) input:focus {
  border-color: var(--rz-accent) !important;
  box-shadow: 0 0 0 4px var(--rz-accent-soft) !important;
}

body:has(#loginForm) button[type="submit"],
body:has(#registerForm) button[type="submit"],
body:has(#inviteRegisterForm) button[type="submit"],
#successScreen a {
  border-radius: var(--rz-radius) !important;
  background: var(--rz-accent) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22) !important;
}

/* ══════════════════════════════════════════
   29. PROFILE PAGE
   ══════════════════════════════════════════ */

body:has(#profileContent) #profileContent {
  width: min(1120px, 100%) !important;
  margin-inline: auto !important;
}

body:has(#profileContent) .profile-sidebar-card,
body:has(#profileContent) .profile-surface-card,
body:has(#profileContent) .profile-empty-state,
body:has(#profileContent) .profile-stat-card,
body:has(#profileContent) .profile-code-card,
body:has(#profileContent) .profile-file-card {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--card) !important;
  box-shadow: var(--rz-shadow-sm) !important;
}

body:has(#profileContent) .profile-sidebar-card {
  position: sticky !important;
  top: 88px !important;
}

body:has(#profileContent) .profile-tab-shell.hidden {
  display: grid !important;
}

body:has(#profileContent) .profile-tab-shell {
  width: 100% !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 2px !important;
  border: 0.5px solid var(--border) !important;
  border-radius: var(--rz-radius) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  padding: 3px !important;
}

body:has(#profileContent) .profile-tab-btn {
  min-height: 36px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--rz-text-soft) !important;
  transition: all var(--rz-duration-fast) var(--rz-ease);
}

body:has(#profileContent) .profile-tab-btn.tab-active {
  background: var(--card) !important;
  color: var(--rz-accent) !important;
  box-shadow: var(--rz-shadow-sm) !important;
}

body:has(#profileContent) .profile-dock-shell {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--glass-bg) !important;
  box-shadow: var(--rz-shadow-lg) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}

body:has(#profileContent) #profileBottomDock {
  display: none !important;
}

body:has(#profileContent) .profile-dock-item.tab-active,
body:has(#profileContent) .profile-primary-action {
  color: var(--rz-accent) !important;
}

body:has(#profileContent) .profile-primary-action {
  background: var(--rz-accent-soft) !important;
  border-color: rgba(16, 185, 129, 0.18) !important;
}

body:has(#profileContent) .private-preview {
  border: 0.5px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

body:has(#profileContent) .private-preview::before,
body:has(#profileContent) .private-preview::after,
body:has(#profileContent) .private-preview-orb {
  display: none !important;
}

/* ══════════════════════════════════════════
   30. SETTINGS PAGE
   ══════════════════════════════════════════ */

body:has(#settingsScreen) #settingsScreen {
  width: min(920px, 100%) !important;
  margin-inline: auto !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > * {
  margin-top: 0 !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > section:nth-of-type(3) {
  order: 1 !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > section:nth-of-type(1) {
  order: 2 !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > section:nth-of-type(2) {
  order: 3 !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > section:nth-of-type(4) {
  order: 4 !important;
}

body:has(#settingsScreen) #settingsScreen .px-5.py-6.space-y-5 > section:nth-of-type(5) {
  order: 5 !important;
}

body:has(#settingsScreen) header,
body:has(#settingsScreen) section,
body:has(#settingsScreen) .verified-badge-pill {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--card) !important;
  box-shadow: var(--rz-shadow-sm) !important;
}

body:has(#settingsScreen) section {
  overflow: hidden !important;
}

body:has(#settingsScreen) section h2,
body:has(#settingsScreen) section h3 {
  color: var(--rz-text) !important;
}

body:has(#settingsScreen) .input-field,
body:has(#settingsScreen) input,
body:has(#settingsScreen) textarea,
body:has(#settingsScreen) select {
  min-height: 44px !important;
  border-color: var(--border-strong) !important;
  border-radius: var(--rz-radius) !important;
  background: var(--surface-soft) !important;
  color: var(--fg) !important;
}

body:has(#settingsScreen) .input-field:focus,
body:has(#settingsScreen) input:focus,
body:has(#settingsScreen) textarea:focus,
body:has(#settingsScreen) select:focus {
  border-color: var(--rz-accent) !important;
  box-shadow: 0 0 0 4px var(--rz-accent-soft) !important;
}

body:has(#settingsScreen) button[type="submit"],
body:has(#settingsScreen) .badge-toggle.active,
body:has(#settingsScreen) #saveProfileBtn,
body:has(#settingsScreen) #saveVerifiedBadgeBtn,
body:has(#settingsScreen) #saveUsernameBtn {
  background: var(--rz-accent) !important;
  border-color: var(--rz-accent) !important;
}

body:has(#settingsScreen) #saveProfileBtn {
  position: sticky !important;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 4 !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28) !important;
}

body:has(#settingsScreen) .badge-theme-chip.active,
body:has(#settingsScreen) .badge-theme-chip:hover {
  border-color: var(--rz-accent) !important;
  background: var(--rz-accent-soft) !important;
}

/* ══════════════════════════════════════════
   31. SCRAPER VIEWER PAGE
   ══════════════════════════════════════════ */

body.ios-page #titleArea .ios-card,
body.ios-page #codeSearchBar,
body.ios-page #codeWindow,
body.ios-page #commentsSection,
body.ios-page #authorCard,
body.ios-page #statsCard,
body.ios-page #metadataCard,
body.ios-page #relatedCard {
  border: 0.5px solid var(--rz-border) !important;
  border-radius: var(--rz-radius-2xl) !important;
  background: var(--card) !important;
  box-shadow: var(--rz-shadow-sm) !important;
  transition: transform var(--rz-duration-normal) var(--rz-ease-out),
              box-shadow var(--rz-duration-normal) var(--rz-ease-out);
}

body.ios-page #titleArea h1,
body.ios-page #scraperTitle {
  letter-spacing: -0.02em !important;
  color: var(--rz-text) !important;
}

body.ios-page #titleArea .ios-chip,
body.ios-page #codeStats > span {
  display: inline-flex !important;
  min-height: 28px !important;
  align-items: center !important;
  gap: 6px !important;
  border-radius: var(--rz-radius-pill) !important;
  border: 0.5px solid var(--border) !important;
  background: var(--surface) !important;
  padding: 6px 12px !important;
  color: var(--rz-text-soft) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

body.ios-page #titleArea button,
body.ios-page #statsCard button,
body.ios-page #codeSearchBar button,
body.ios-page #commentsSection button {
  border-radius: var(--rz-radius) !important;
}

body.ios-page #titleArea button:first-child,
body.ios-page #copyBtn,
body.ios-page #commentForm button[type="submit"] {
  background: var(--rz-accent) !important;
  border-color: var(--rz-accent) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.22) !important;
}

body.ios-page #downloadBtn,
body.ios-page #statsCard #bookmarkBtn,
body.ios-page #shareBtn,
body.ios-page #rawBtn,
body.ios-page #fullscreenBtn,
body.ios-page #reportBtn {
  background: var(--surface) !important;
  border: 0.5px solid var(--border) !important;
  color: var(--rz-secondary) !important;
}

body.ios-page .ios-editor-toolbar {
  background: var(--rz-surface-soft) !important;
  border-bottom: 0.5px solid var(--border) !important;
}

body.ios-page .code-scroll {
  background: var(--code-bg) !important;
}

body.ios-page .code-gutter {
  background: var(--surface) !important;
  color: var(--rz-muted) !important;
}

body.ios-page .code-lines {
  color: var(--rz-text) !important;
}

body.ios-page #statsCard .grid > div {
  border-radius: var(--rz-radius-lg) !important;
  background: var(--surface) !important;
}

body.ios-page #metadataCard .space-y-3 > div {
  min-height: 42px !important;
  align-items: center !important;
  border-bottom: 0.5px solid var(--border) !important;
}

body.ios-page #metadataCard .space-y-3 > div:last-child {
  border-bottom: 0 !important;
}

body.ios-page #relatedList a,
body.ios-page #commentsList > div {
  border-radius: var(--rz-radius-lg) !important;
  background: var(--surface) !important;
  transition: background var(--rz-duration-fast) var(--rz-ease);
}

body.ios-page #relatedList a:hover,
body.ios-page #commentsList > div:hover {
  background: var(--surface-hover) !important;
}

body.ios-page input,
body.ios-page textarea,
body.ios-page select {
  border-color: var(--border-strong) !important;
  background: var(--surface-soft) !important;
  color: var(--fg) !important;
}

body.ios-page input:focus,
body.ios-page textarea:focus,
body.ios-page select:focus {
  border-color: var(--rz-accent) !important;
  box-shadow: 0 0 0 4px var(--rz-accent-soft) !important;
}

/* ══════════════════════════════════════════
   32. ADMIN DASHBOARD SPECIFIC
   ══════════════════════════════════════════ */

#adminDashboard .max-w-7xl,
#topAppBar + *,
.rz-shell > section,
.rz-shell > div:not(.hidden) {
  scroll-margin-top: 96px;
}

#adminDashboard {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

#adminDashboard .max-w-7xl {
  width: min(1180px, 100%);
}

#adminDashboard [class*="rounded-2xl"],
#adminDashboard [class*="rounded-xl"],
#adminDashboard [class*="rounded-3xl"],
body:has(#scraperTitle) [class*="rounded-2xl"],
body:has(#profileUsername) [class*="rounded-2xl"],
body:has(#settingsForm) [class*="rounded-2xl"] {
  border-radius: var(--rz-radius-lg) !important;
}

body:has(#scraperTitle) main,
body:has(#profileUsername) main,
body:has(#settingsForm) main {
  width: min(1180px, 100%);
  margin-inline: auto;
}

body:has(#scraperTitle) .sticky,
body:has(#profileUsername) .sticky,
body:has(#settingsForm) .sticky {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

body:has(#scraperTitle) article,
body:has(#profileUsername) article,
body:has(#settingsForm) article,
body:has(#scraperTitle) aside > div,
body:has(#profileUsername) aside > div {
  border-color: var(--rz-border) !important;
  box-shadow: var(--rz-shadow-sm) !important;
}

body:has(#adminDashboard) .admin-hero-card,
body:has(#adminDashboard) [class*="bg-white"] {
  border-color: var(--border) !important;
}

body:has(#adminDashboard) .admin-hero-card {
  background: var(--card) !important;
}

body:has(#adminDashboard) .admin-dock-item.active,
body:has(#adminDashboard) .admin-tab-btn.active,
body:has(#adminDashboard) .rz-rail .active {
  color: var(--rz-accent) !important;
  background: var(--rz-accent-soft) !important;
}

#adminBottomNav {
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
}

#createMenuSheet button,
#adminMoreSheet button,
#notificationsOverlay button,
#announcementsOverlay button {
  border-radius: var(--rz-radius) !important;
}

/* ══════════════════════════════════════════
   33. PAGE-LEVEL HARMONIZATION
   ══════════════════════════════════════════ */

body.ios-page,
body:has(#profileContent),
body:has(#settingsScreen),
body:has(#loginForm),
body:has(#registerForm),
body:has(#inviteRegisterForm),
body:has(#adminDashboard) {
  background: var(--bg) !important;
  color: var(--rz-text) !important;
}

body.ios-page .ios-nav {
  background: var(--glass-bg) !important;
  border-bottom: 0.5px solid var(--border-strong) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}

/* ── Profile Edit Dock (Settings) ── */
.profile-edit-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 0 8px;
  border-radius: 0;
  border-top: 1px solid var(--border-strong);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.ped-item {
  color: var(--fg-secondary);
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  text-decoration: none;
  width: 100%;
  font-family: inherit;
}

.ped-item:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

.ped-danger:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

/* ── Verified badge pill ── */
.verified-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
}

.verified-badge-pill-muted {
  background: var(--surface);
  color: var(--muted);
}

.verified-badge-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

.verified-badge-sublabel {
  font-size: 12px;
  color: var(--muted);
}

.verified-badge-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 16px var(--badge-glow));
  animation: badgeFloat 2.8s ease-in-out infinite;
  flex-shrink: 0;
}

.verified-badge-icon::before,
.verified-badge-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 62% 9%, 76% 5%, 82% 20%, 96% 24%, 91% 38%, 100% 50%, 91% 62%, 96% 76%, 82% 80%, 76% 95%, 62% 91%, 50% 100%, 38% 91%, 24% 95%, 18% 80%, 4% 76%, 9% 62%, 0% 50%, 9% 38%, 4% 24%, 18% 20%, 24% 5%, 38% 9%);
}

.verified-badge-icon::before {
  background: var(--badge-gradient);
  animation: badgeOrbit 7s linear infinite;
}

.verified-badge-icon::after {
  inset: 3px;
  background: var(--badge-core);
  opacity: 0.94;
}

.verified-badge-icon-sm { width: 22px; height: 22px; }
.verified-badge-icon-md { width: 32px; height: 32px; }
.verified-badge-icon-lg { width: 54px; height: 54px; }

.verified-badge-check {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.verified-badge-icon-sm .verified-badge-check svg { width: 12px; height: 12px; }
.verified-badge-icon-md .verified-badge-check svg { width: 16px; height: 16px; }
.verified-badge-icon-lg .verified-badge-check svg { width: 26px; height: 26px; }

@keyframes badgeOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes badgeFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.03); }
}

.badge-toggle {
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}

.badge-toggle.active {
  background: #10b981;
  border-color: #10b981;
}

.badge-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge-toggle.active .badge-toggle-thumb {
  transform: translateX(24px);
}

.badge-theme-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge-theme-chip:hover {
  border-color: #10b981;
  background: var(--surface-hover);
}

.badge-theme-chip.active {
  border-color: #10b981;
  background: var(--accent-dim);
}

/* ── Filter buttons (admin) ── */
.urole-btn,
.ffilter-btn,
.sfilter-btn,
.rfilter-btn {
  border-color: var(--border-strong) !important;
  background: var(--card) !important;
  color: var(--fg-secondary) !important;
}

.urole-btn:not([class*="bg-\\[\\#10b981\\]"]),
.ffilter-btn:not([class*="bg-\\[\\#10b981\\]"]),
.sfilter-btn:not([class*="bg-\\[\\#10b981\\]"]),
.rfilter-btn:not([class*="bg-\\[\\#10b981\\]"]) {
  background: var(--card) !important;
  color: var(--fg-secondary) !important;
}

/* ══════════════════════════════════════════
   34. RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 639px) {
  .home-topbar-shell {
    padding: 8px 12px;
    border-radius: 14px;
  }

  .home-mini-pill {
    display: none !important;
  }

  .home-dock-shell {
    padding: 4px 0 6px;
    border-radius: 0;
  }

  body.ios-page #titleArea .ios-card,
  body.ios-page #codeWindow,
  body.ios-page #commentsSection,
  body.ios-page #authorCard,
  body.ios-page #statsCard,
  body.ios-page #metadataCard,
  body.ios-page #relatedCard,
  body:has(#profileContent) .profile-sidebar-card,
  body:has(#profileContent) .profile-surface-card,
  body:has(#settingsScreen) header,
  body:has(#settingsScreen) section {
    border-radius: var(--rz-radius-xl) !important;
  }
}

@media (min-width: 640px) {
  .rz-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rz-admin-entry {
    grid-column: auto;
  }

  .chat-hub-layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .chat-hub-sidebar {
    min-height: 0;
    max-height: none;
  }

  .chat-hub-thread-list {
    max-height: none;
    height: 100%;
  }

  .admin-hero-inner {
    padding: 28px;
  }

  .admin-stat-card {
    padding: 20px;
  }
}

@media (min-width: 1024px) {
  .rz-shell.has-rail {
    padding-left: 96px;
  }

  .rz-rail {
    position: fixed;
    top: 16px;
    bottom: 16px;
    left: max(16px, calc((100vw - 1180px) / 2));
    z-index: 45;
    display: flex;
    width: 72px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 0.5px solid var(--border-strong);
    border-radius: var(--rz-radius-xl);
    background: var(--glass-bg);
    box-shadow: var(--rz-shadow-md);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }

  .rz-rail a,
  .rz-rail button {
    width: 52px;
    min-height: 52px;
    border-radius: var(--rz-radius);
    color: var(--rz-text-soft);
    transition: all var(--rz-duration-fast) var(--rz-ease);
  }

  .rz-rail a:hover,
  .rz-rail button:hover,
  .rz-rail .active {
    background: var(--rz-accent-soft);
    color: var(--rz-accent);
  }

  .rz-mobile-only,
  #bottomNav,
  #adminBottomNav {
    display: none !important;
  }

  .rz-desktop-only {
    display: block;
  }

  .admin-hero-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .admin-hero-actions {
    width: min(420px, 100%);
  }

  .bottom-nav-btn {
    min-height: 52px;
    flex-direction: row;
    gap: 8px;
    font-size: 12px;
  }

  .bottom-nav-btn.active::after {
    display: none;
  }

  #adminDashboard {
    padding-bottom: 32px;
  }

  #adminDashboard header > div,
  #adminDashboard > .max-w-7xl {
    padding-left: 0 !important;
  }

  .rz-shell.has-rail > header,
  .rz-shell.has-rail > main,
  .rz-shell.has-rail > section,
  .rz-shell.has-rail > div {
    max-width: 1040px;
  }
}

@media (max-width: 520px) {
  .rz-section {
    padding-inline: 16px;
  }

  .rz-quick-action,
  .rz-admin-entry {
    min-height: 56px;
    padding: 10px;
  }
}

@supports not selector(:has(*)) {
  body > .w-full.max-w-\[380px\] {
    border: 0.5px solid var(--border-strong);
    border-radius: var(--rz-radius-2xl);
    background: var(--glass-bg-strong);
    box-shadow: var(--rz-shadow-xl);
    padding: 28px;
  }
}

/* ══════════════════════════════════════════
   35. HIGHLIGHT.JS DARK OVERRIDE
   ══════════════════════════════════════════ */

.hljs {
  background: var(--code-bg) !important;
  color: var(--fg) !important;
}

/* ══════════════════════════════════════════
   36. MISC DARK OVERRIDES
   ══════════════════════════════════════════ */

/* Force color-scheme for native elements (dark default, light override above) */
html { color-scheme: dark; }

/* Selection */
::selection {
  background: rgba(16, 185, 129, 0.25);
  color: #fff;
}
html[data-theme="light"] ::selection {
  color: #000;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Checkbox/Radio dark override */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

/* Color input dark override */
input[type="color"] {
  border-color: var(--border-strong) !important;
  background: var(--surface) !important;
}

/* Select dropdown dark override */
select {
  background-color: var(--surface-soft) !important;
  color: var(--fg) !important;
}

select option {
  background-color: var(--surface);
  color: var(--fg);
}

/* Horizontal rule */
hr {
  border-color: var(--border);
}

/* Blockquote */
blockquote {
  border-left-color: var(--accent);
  color: var(--fg-secondary);
}

/* Table dark */
table {
  border-color: var(--border);
}

th {
  background: var(--surface);
  color: var(--fg);
}

td {
  border-color: var(--border);
}

/* ── Admin Login Overlay ── */
#loginScreen {
  background: var(--bg) !important;
}

/* ── File API Doc Card ── */
#filesApiDocCard {
  background: var(--card) !important;
  border-color: var(--border-strong) !important;
}

#filesApiDocCard .border-b.border-neutral-100.bg-\[\#f8f9fa\] {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

/* ── AI Thought Stream ── */
#aiThoughtOutput {
  background: var(--code-bg) !important;
  border-color: var(--border-strong) !important;
}

/* ── Community Detail Modal ── */
#communityDetailModal .bg-surface-50 {
  background: var(--surface) !important;
}

/* ── Misc close buttons inside sheets ── */
button.bg-\[\#f1f3f4\] {
  background: var(--surface) !important;
}

button.hover\:bg-neutral-200:hover {
  background: var(--surface-hover) !important;
}

/* ── Error boxes ── */
.bg-red-50.border-red-100 {
  background: var(--danger-dim) !important;
  border-color: rgba(239, 68, 68, 0.15) !important;
}

/* ── Avatar edit icon border ── */
.border-2.border-white {
  border-color: var(--card) !important;
}

/* ── Notification badge ── */
.bg-red-500 {
  background-color: var(--danger) !important;
}

/* ══════════════════════════════════════════
   37. LIGHT MODE SPECIFIC FIXES
   ══════════════════════════════════════════ */
html[data-theme="light"] body {
  background: var(--bg) !important;
  color: var(--fg);
}

/* Fix hardcoded dark backgrounds in admin */
html[data-theme="light"] .bg-\[\#0a0a0a\],
html[data-theme="light"] .bg-\[\#1C1C1E\],
html[data-theme="light"] .bg-\[\#2C2C2E\] {
  background-color: var(--surface) !important;
}

/* Fix admin thought output dark box */
html[data-theme="light"] #aiThoughtOutput {
  background-color: var(--code-bg) !important;
  border-color: var(--border-strong) !important;
  color: var(--fg);
}

/* Fix hardcoded dark text that should be light in light mode */
html[data-theme="light"] .text-white {
  color: var(--fg) !important;
}

/* Fix login screen */
html[data-theme="light"] #loginScreen {
  background-color: var(--surface) !important;
  color: var(--fg);
}

/* Fix admin input fields hardcoded light backgrounds */
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="text"],
html[data-theme="light"] textarea {
  background-color: var(--surface-soft) !important;
  border-color: var(--border-strong) !important;
  color: var(--fg) !important;
}

/* Fix apple-card in light mode */
html[data-theme="light"] .apple-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

/* Fix apple-row in light mode */
html[data-theme="light"] .apple-row {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
}

/* Fix buttons that have hardcoded dark borders */
html[data-theme="light"] .ios-secondary-action {
  background: var(--surface-soft) !important;
  border-color: var(--border-strong) !important;
  color: var(--fg) !important;
}

/* Fix bottom nav bar */
html[data-theme="light"] .bg-\[\#0d0d0d\],
html[data-theme="light"] nav[class*="bg-black"],
html[data-theme="light"] nav[class*="bg-\[#0"],
html[data-theme="light"] header[class*="bg-black"] {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
}

/* Theme toggle button */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  cursor: pointer;
  transition: all 150ms ease;
  font-size: 16px;
}
.theme-toggle-btn:hover {
  background: var(--surface-hover);
}
