/* ================================================================
   AI Assistant Panel Styles
   Author: Hub Collective AI Integration
   Purpose: Real-time writing suggestions and content quality analysis
   ================================================================ */

.ai-assistant-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 28px));
  max-height: min(74dvh, 680px);
  margin: 0;
  background: #f8fbff;
  border: 1px solid #c5d6f6;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.16);
  backdrop-filter: none;
  color: #0f172a;
  z-index: 10020;
  animation: slideInRight 0.3s ease-out;
}

.ai-assistant-panel.hidden {
  display: none;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, #e6f0ff, #d9e9ff);
  border-bottom: 1px solid #bfd3f3;
}

.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1d4ed8;
}

.ai-panel-title i {
  font-size: 14px;
  animation: spin 2s linear infinite;
}

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

.ai-panel-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #334155;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.ai-panel-close:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #0f172a;
}

.ai-panel-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px;
  max-height: calc(min(74dvh, 680px) - 58px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8fbff;
}

.ai-assistant-launcher {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 10020;
  border: 1px solid rgba(99, 102, 241, 0.32);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.94), rgba(59, 130, 246, 0.94));
  color: #ffffff;
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ai-assistant-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.28);
}

.ai-assistant-launcher.hidden {
  display: none;
}

.ai-panel-content::-webkit-scrollbar {
  width: 6px;
}

.ai-panel-content::-webkit-scrollbar-track {
  background: rgba(99, 102, 241, 0.05);
  border-radius: 3px;
}

.ai-panel-content::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}

.ai-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* ================================================================
   AI Section Styles
   ================================================================ */

.ai-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d7e3f8;
}

.ai-section:last-child {
  border-bottom: none;
}

.ai-section.hidden {
  display: none;
}

.ai-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #334155;
  margin: 0 0 12px 0;
  padding: 0;
}

.ai-section-inline {
  margin: 0 0 10px;
  border: 1px solid #bfd3f3;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbff, #edf5ff);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.ai-section-inline.hidden {
  display: none;
}

.ai-section-inline__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.ai-section-inline__summary::-webkit-details-marker {
  display: none;
}

.ai-section-inline__title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1d4ed8;
}

.ai-section-inline__meta {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.ai-section-inline__list {
  gap: 4px;
  padding: 0 10px 10px;
}

.suggestion-item--inline {
  padding: 8px;
  font-size: 12px;
}

.suggestion-item--inline .suggestion-icon {
  font-size: 12px;
}

/* ================================================================
   Quality Score Display
   ================================================================ */

.quality-score-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.quality-score-display {
  display: flex;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.quality-score-circle {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border: 2px solid rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.quality-score-circle.quality-score-good {
  border-color: rgba(34, 197, 94, 0.4);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.04));
}

.quality-score-circle.quality-score-fair {
  border-color: rgba(249, 115, 22, 0.4);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(249, 115, 22, 0.04));
}

.quality-score-circle.quality-score-poor {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
}

.quality-score-number {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.quality-score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #475569;
  margin-top: 2px;
}

.quality-metrics {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.quality-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-bar {
  height: 6px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.metric-value {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
}

.quality-meta {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ================================================================
   Suggestions List
   ================================================================ */

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-placeholder {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  margin: 0;
  padding: 8px;
  text-align: center;
}

.suggestion-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  background: #eef4ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  font-size: 13px;
  color: #0f172a;
  font-weight: 600;
  line-height: 1.4;
}

.ai-link-btn {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.ai-link-btn:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.ai-link-btn--inline {
  margin-left: auto;
  white-space: nowrap;
  align-self: center;
}

.ai-action-hint {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.ai-image-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-image-actions .ai-link-btn {
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  text-align: left;
}

.suggestion-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: #1d4ed8;
}

.suggestion-text {
  flex: 1;
}

.content-section.ai-updated-section {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
  transition: box-shadow 0.35s ease;
}

/* ================================================================
   Title Suggestions
   ================================================================ */

.title-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-suggestion-item {
  margin: 0;
  padding: 0;
}

.title-suggestion-btn {
  width: 100%;
  padding: 10px 12px;
  background: #eef4ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 13px;
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.title-suggestion-btn:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  transform: translateX(2px);
}

.title-suggestion-btn:active {
  transform: translateX(0);
}

.suggestion-reason {
  font-size: 11px;
  color: #475569;
  font-weight: 600;
}

/* ================================================================
   Tags List
   ================================================================ */

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #1e3a8a;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tag-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(30, 58, 138, 0.14);
}

.tag-text {
  display: inline-block;
}

/* ================================================================
   Loading State
   ================================================================ */

.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: rgba(99, 102, 241, 0.6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ================================================================
   Responsive Adjustments
   ================================================================ */

@media (max-width: 1280px) {
  .ai-assistant-panel {
    width: min(340px, calc(100vw - 24px));
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 1024px) {
  .ai-assistant-panel {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: min(320px, calc(100vw - 24px));
    max-height: min(72dvh, 620px);
  }

  .ai-assistant-launcher {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 768px) {
  .ai-assistant-panel {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: min(68dvh, 560px);
    border-radius: 14px;
  }

  .ai-panel-header {
    padding: 12px 14px;
  }

  .ai-panel-title {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .ai-panel-content {
    padding: 12px;
  }

  .ai-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .ai-section-title {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .quality-score-display {
    flex-direction: column;
    gap: 10px;
  }

  .quality-score-circle {
    width: 64px;
    height: 64px;
  }

  .quality-score-number {
    font-size: 20px;
  }

  .suggestion-item,
  .title-suggestion-btn {
    font-size: 12px;
    padding: 9px 10px;
  }

  .suggestion-item {
    flex-wrap: wrap;
  }

  .ai-link-btn--inline {
    margin-left: 0;
  }

  .ai-image-actions {
    grid-template-columns: 1fr;
  }

  .tag-item {
    font-size: 11px;
    padding: 5px 10px;
  }

  .ai-assistant-launcher {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .ai-assistant-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(66dvh, 520px);
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
  }

  .ai-panel-content {
    padding: 10px;
    max-height: calc(min(66dvh, 520px) - 54px);
  }

  .quality-meta {
    font-size: 13px;
  }

  .ai-assistant-launcher {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: 40px;
    font-size: 11px;
    padding: 8px 12px;
  }

  .ai-link-btn,
  .ai-image-actions .ai-link-btn {
    font-size: 10px;
    padding: 7px 9px;
  }
}

@media (max-height: 620px) {
  .ai-assistant-panel {
    max-height: min(84dvh, 520px);
  }

  .ai-panel-content {
    max-height: calc(min(84dvh, 520px) - 58px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-assistant-panel,
  .ai-assistant-launcher,
  .title-suggestion-btn,
  .metric-fill,
  .spinner {
    animation: none !important;
    transition: none !important;
  }
}

/* ================================================================
   Accessibility
   ================================================================ */

.ai-panel-close:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.title-suggestion-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

/* ================================================================
   Dark/Light Mode Support
   ================================================================ */

:root[data-theme="dark"] .ai-assistant-panel {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

:root[data-theme="light"] .ai-assistant-panel {
  background: #f8fbff;
}

:root[data-theme="dark"] .ai-panel-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-bottom-color: #334155;
}

:root[data-theme="dark"] .ai-panel-title {
  color: #93c5fd;
}

:root[data-theme="dark"] .ai-panel-content {
  background: #0f172a;
}

:root[data-theme="dark"] .ai-section {
  border-bottom-color: #1e293b;
}

:root[data-theme="dark"] .ai-section-title,
:root[data-theme="dark"] .metric-label,
:root[data-theme="dark"] .quality-score-label,
:root[data-theme="dark"] .suggestion-reason,
:root[data-theme="dark"] .ai-loading,
:root[data-theme="dark"] .quality-meta,
:root[data-theme="dark"] .suggestion-placeholder {
  color: #94a3b8;
}

:root[data-theme="dark"] .quality-score-number,
:root[data-theme="dark"] .metric-value,
:root[data-theme="dark"] .suggestion-item,
:root[data-theme="dark"] .title-suggestion-btn {
  color: #e2e8f0;
}

:root[data-theme="dark"] .suggestion-item {
  background: #1e293b;
  border-left-color: #60a5fa;
}

:root[data-theme="dark"] .title-suggestion-btn {
  background: #1e293b;
  border-color: #334155;
}

:root[data-theme="dark"] .title-suggestion-btn:hover {
  background: #243244;
  border-color: #60a5fa;
}

:root[data-theme="dark"] .tag-item {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #dbeafe;
}

:root[data-theme="dark"] .ai-link-btn {
  background: #1e293b;
  border-color: #334155;
  color: #93c5fd;
}

:root[data-theme="dark"] .ai-link-btn:hover {
  background: #243244;
  border-color: #60a5fa;
}

:root[data-theme="dark"] .ai-action-hint {
  background: #1e293b;
  color: #cbd5e1;
}
/* ================================================================
   AI Assistant Dock (Inline for Submit Page)
   ================================================================ */

.ai-assistant-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  margin: 20px 0;
  background: #f8fbff;
  border: 1px solid #c5d6f6;
  border-radius: 12px;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #0f172a;
  animation: slideInUp 0.3s ease-out;
}

.ai-assistant-dock.hidden {
  display: none;
}

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

.ai-dock-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-dock-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-dock-title i {
  font-size: 14px;
  animation: spin 2s linear infinite;
}

.ai-dock-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-dock-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-dock-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #475569;
}

.ai-dock-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-dock-suggestion {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  background: #eef4ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  font-size: 13px;
  color: #0f172a;
  line-height: 1.4;
}

.ai-dock-suggestion-icon {
  font-size: 12px;
  color: #3b82f6;
  flex-shrink: 0;
}

.ai-dock-suggestion-text {
  flex: 1;
}

.ai-dock-action {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-left: 8px;
}

.ai-dock-action:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

.ai-dock-quality {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 10px;
  background: #f0f9ff;
  border-radius: 6px;
}

.ai-dock-quality-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-dock-quality-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
}

.ai-dock-quality-bar {
  height: 6px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.ai-dock-quality-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.ai-dock-quality-value {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

@media (max-width: 768px) {
  .ai-assistant-dock {
    margin: 16px 0;
    padding: 12px;
    border-radius: 10px;
  }

  .ai-dock-quality {
    grid-template-columns: auto auto;
  }

  .ai-dock-section-title {
    font-size: 11px;
  }

  .ai-dock-suggestion {
    font-size: 12px;
    padding: 9px 10px;
  }

  .ai-dock-action {
    font-size: 10px;
    padding: 5px 9px;
  }
}
/* ================================================================
   Responsive — mobile & tablet overrides
   Loads last. Applies to all pages.
   ================================================================ */

/* ═══════════════════════════════════════════════════════════
   TABLET & MOBILE (≤ 768px)
   ═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 768px) {

  /* Layout shell — sidebar becomes a drawer */
  .app-shell {
      padding-left: 0 !important;
      padding-top: 56px !important;   /* mobile header is shorter */
    }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 2000 !important;
    transition: left 0.3s var(--ease-out) !important;
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.2) !important;
    padding-top: 72px !important;
    border-radius: 0 !important;
  }

  .sidebar.is-open { left: 0 !important; }

  .main-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 24px 16px 40px !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Header */
  .header-inner { padding: 0 16px !important; }

  .header-brand-name { font-size: 1rem !important; }
  .header-brand-version { display: none !important; }

  .header-search__text { display: none !important; }
  .header-community { display: none !important; }
  .header-icon-btn { display: none !important; }

  .header-contribute span { display: none !important; }
  .header-contribute { padding: 6px 10px !important; }

  .mobile-menu-toggle { display: inline-flex !important; }

  /* Dashboard */
  .dashboard { padding: 20px 16px 40px !important; }
  .dashboard__stats { grid-template-columns: repeat(2, 1fr) !important; }
  .dashboard__grid { grid-template-columns: 1fr !important; }
  .quick-actions { grid-template-columns: repeat(2, 1fr) !important; }

  /* Marketplace grid */
  .mp-grid-v2 { grid-template-columns: 1fr !important; gap: 16px !important; }
  .mp-shell-v2 { padding: 20px 16px 40px !important; }
  .mp-hero-v2 h1 { font-size: 1.75rem !important; }

  /* Detail page */
  .detail-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .detail-shell { padding: 20px 16px 40px !important; }
  .detail-gallery { position: static !important; }
  .detail-gallery__thumbs { grid-template-columns: repeat(4, 1fr) !important; }

  /* Content */
  .content-card { padding: 20px 16px !important; }
  .content-card > * { padding-left: 0 !important; padding-right: 0 !important; }

  /* Footer */
  .footer-inner {
    flex-direction: column !important;
    text-align: center !important;
    gap: 16px !important;
  }

  .footer-links { justify-content: center !important; gap: 20px !important; }
  .footer-share-links { justify-content: center !important; }

  /* Forms */
  .form-row,
  .field-row { grid-template-columns: 1fr !important; gap: 14px !important; }

  .form-actions,
  .drawer-footer {
    flex-direction: column-reverse !important;
    gap: 12px !important;
  }

  .form-actions > *,
  .drawer-footer > * { width: 100% !important; }
}

/* ═══════════════════════════════════════════════════════════
   SMALL PHONES (≤ 480px)
   ═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 480px) {

  .dashboard__stats { grid-template-columns: 1fr !important; }
  .quick-actions { grid-template-columns: 1fr !important; }

  .mp-hero-v2 h1 { font-size: 1.5rem !important; }

  h1 { font-size: 1.75rem !important; line-height: 1.15 !important; }
  h2 { font-size: 1.35rem !important; }

  .page-hero__title { font-size: 1.75rem !important; }

  .sidebar { width: 260px !important; left: -260px !important; }
}
/* ================================================================
   Community Color System
   Tints identify community context. They never decorate.
   Applied via data-accent attribute (set by community-color.js).
   ================================================================ */

/* ── Light palette ──────────────────────────────────────────── */
[data-accent="amber"]      { --accent: #b45309; --accent-soft: rgba(180, 83, 9, 0.12);   --accent-line: rgba(180, 83, 9, 0.28); }
[data-accent="olive"]      { --accent: #4d7c0f; --accent-soft: rgba(77, 124, 15, 0.12);  --accent-line: rgba(77, 124, 15, 0.28); }
[data-accent="teal"]       { --accent: #0f766e; --accent-soft: rgba(15, 118, 110, 0.12); --accent-line: rgba(15, 118, 110, 0.28); }
[data-accent="sky"]        { --accent: #0369a1; --accent-soft: rgba(3, 105, 161, 0.12);  --accent-line: rgba(3, 105, 161, 0.28); }
[data-accent="navy"]       { --accent: #1e40af; --accent-soft: rgba(30, 64, 175, 0.12);  --accent-line: rgba(30, 64, 175, 0.28); }
[data-accent="plum"]       { --accent: #86198f; --accent-soft: rgba(134, 25, 143, 0.12); --accent-line: rgba(134, 25, 143, 0.28); }
[data-accent="terracotta"] { --accent: #c2410c; --accent-soft: rgba(194, 65, 12, 0.12);  --accent-line: rgba(194, 65, 12, 0.28); }
[data-accent="forest"]     { --accent: #166534; --accent-soft: rgba(22, 101, 52, 0.12);  --accent-line: rgba(22, 101, 52, 0.28); }

/* ── Dark palette ───────────────────────────────────────────── */
[data-theme="dark"][data-accent="amber"]      { --accent: #fbbf24; --accent-soft: rgba(251, 191, 36, 0.14);  --accent-line: rgba(251, 191, 36, 0.32); }
[data-theme="dark"][data-accent="olive"]      { --accent: #bef264; --accent-soft: rgba(190, 242, 100, 0.14); --accent-line: rgba(190, 242, 100, 0.32); }
[data-theme="dark"][data-accent="teal"]       { --accent: #5eead4; --accent-soft: rgba(94, 234, 212, 0.14);  --accent-line: rgba(94, 234, 212, 0.32); }
[data-theme="dark"][data-accent="sky"]        { --accent: #7dd3fc; --accent-soft: rgba(125, 211, 252, 0.14); --accent-line: rgba(125, 211, 252, 0.32); }
[data-theme="dark"][data-accent="navy"]       { --accent: #93c5fd; --accent-soft: rgba(147, 197, 253, 0.14); --accent-line: rgba(147, 197, 253, 0.32); }
[data-theme="dark"][data-accent="plum"]       { --accent: #e9d5ff; --accent-soft: rgba(233, 213, 255, 0.14); --accent-line: rgba(233, 213, 255, 0.32); }
[data-theme="dark"][data-accent="terracotta"] { --accent: #fdba74; --accent-soft: rgba(253, 186, 116, 0.14); --accent-line: rgba(253, 186, 116, 0.32); }
[data-theme="dark"][data-accent="forest"]     { --accent: #86efac; --accent-soft: rgba(134, 239, 172, 0.14); --accent-line: rgba(134, 239, 172, 0.32); }

/* ══════════════════════════════════════════════════════════════
   Application — 4 core locations
   ══════════════════════════════════════════════════════════════ */

/* ── 1. Community chip on wiki pages ───────────────────────── */
.page-community-chip[data-accent] {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 6px 14px 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.page-community-chip[data-accent] i {
  color: var(--accent);
  font-size: 0.78rem;
}

/* Fallback when no accent */
.page-community-chip:not([data-accent]) {
  background: var(--surface-container-low, #f3f3ff);
  color: var(--on-surface-variant, #434750);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 999px;
  padding: 6px 14px 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ── 2. Dashboard community rows ──────────────────────────── */
.ed-list__row[data-accent] .ed-list__index {
  color: var(--accent);
  font-weight: 700;
}

.ed-list__row[data-accent] .ed-list__title {
  position: relative;
  padding-left: 14px;
}

.ed-list__row[data-accent] .ed-list__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
}

/* ── 3. Sidebar active community item ─────────────────────── */
.sidebar-nav__item--community[data-accent].is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-nav__item--community[data-accent].is-active .sidebar-nav__count {
  color: var(--accent);
  opacity: 0.9;
}

/* Left edge indicator on the active community in the sidebar */
.sidebar-nav__item--community[data-accent].is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.sidebar-nav__item--community[data-accent] {
  position: relative;
}

/* ── 4. Header community switcher dot ─────────────────────── */
.header-community[data-accent] .header-community__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── 5. Marketplace category pills (static palette) ──────── */
.mp-category-link[data-category-color="furniture"]  { --cat: #c2410c; --cat-soft: rgba(194, 65, 12, 0.10); }
.mp-category-link[data-category-color="bicycles"]   { --cat: #166534; --cat-soft: rgba(22, 101, 52, 0.10); }
.mp-category-link[data-category-color="kids"]       { --cat: #b45309; --cat-soft: rgba(180, 83, 9, 0.10); }
.mp-category-link[data-category-color="tools"]      { --cat: #4d7c0f; --cat-soft: rgba(77, 124, 15, 0.10); }
.mp-category-link[data-category-color="books"]      { --cat: #4338ca; --cat-soft: rgba(67, 56, 202, 0.10); }
.mp-category-link[data-category-color="services"]   { --cat: #be123c; --cat-soft: rgba(190, 18, 60, 0.10); }
.mp-category-link[data-category-color="food"]       { --cat: #86198f; --cat-soft: rgba(134, 25, 143, 0.10); }

.mp-category-link[data-category-color] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mp-category-link[data-category-color]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat);
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.mp-category-link[data-category-color].active::before,
.mp-category-link[data-category-color]:hover::before {
  opacity: 1;
}

.mp-category-link[data-category-color].active {
  color: var(--cat);
}

/* ── 6. Status pills ──────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-pill--pending   { background: rgba(245, 158, 11, 0.14); color: #92400e; }
.status-pill--approved  { background: rgba(16, 185, 129, 0.14); color: #047857; }
.status-pill--flagged   { background: rgba(239, 68, 68, 0.14);  color: #991b1b; }
.status-pill--draft     { background: var(--surface-container, #ebedff); color: var(--on-surface-variant, #434750); }
.status-pill--published { background: rgba(53, 86, 142, 0.14);  color: #35568e; }

[data-theme="dark"] .status-pill--pending   { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
[data-theme="dark"] .status-pill--approved  { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
[data-theme="dark"] .status-pill--flagged   { background: rgba(239, 68, 68, 0.16);  color: #fca5a5; }
[data-theme="dark"] .status-pill--published { background: rgba(147, 197, 253, 0.16); color: #93c5fd; }
/* ================================================================
   Command Palette — ⌘K navigation
   ================================================================ */

.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.cmd-palette.is-open {
  display: flex;
}

.cmd-palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 23, 72, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: cmdkFade 0.18s var(--ease-out);
}

.cmd-palette__panel {
  position: relative;
  width: min(640px, 100%);
  max-height: 76vh;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cmdkSlide 0.22s var(--ease-spring);
}

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

@keyframes cmdkSlide {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Input row */
.cmd-palette__input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-container-low);
}

.cmd-palette__search-icon {
  color: var(--outline);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cmd-palette__input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--on-surface);
  outline: none;
  padding: 0;
}

.cmd-palette__input::placeholder {
  color: var(--outline);
}

.cmd-palette__kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* Results */
.cmd-palette__results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.cmd-palette__group {
  margin-bottom: 6px;
}

.cmd-palette__group-header {
  padding: 8px 12px 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
}

.cmd-palette__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--on-surface);
  transition: background 0.12s var(--ease-out);
}

.cmd-palette__item:hover,
.cmd-palette__item.is-active {
  background: var(--surface-container-low);
}

.cmd-palette__item-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  color: var(--primary);
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.cmd-palette__item-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-palette__item-subtitle {
  font-size: 0.72rem;
  color: var(--outline);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-palette__item-arrow {
  color: var(--outline-variant);
  font-size: 0.72rem;
  opacity: 0;
  transition: opacity 0.12s var(--ease-out), transform 0.12s var(--ease-out);
}

.cmd-palette__item.is-active .cmd-palette__item-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* Empty + loading */
.cmd-palette__empty,
.cmd-palette__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--outline);
  font-size: 0.84rem;
}

.cmd-palette__empty[hidden],
.cmd-palette__loading[hidden] {
  display: none !important;
}

.cmd-palette__empty i {
  font-size: 1.6rem;
  color: var(--outline-variant);
}

.cmd-palette__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface-container);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: cmdkSpin 0.8s linear infinite;
}

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

/* Footer */
.cmd-palette__footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-container-low);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--outline);
}

.cmd-palette__hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cmd-palette__hint kbd {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--on-surface-variant);
}

/* Body lock */
body.cmd-palette-open {
  overflow: hidden;
}

/* Mobile */
@media (max-width: 640px) {
  .cmd-palette {
    padding: 6vh 8px 8px;
  }

  .cmd-palette__panel {
    max-height: 88vh;
    border-radius: var(--radius-xl);
  }

  .cmd-palette__input {
    font-size: 0.94rem;
  }

  .cmd-palette__footer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmd-palette__backdrop,
  .cmd-palette__panel,
  .cmd-palette__spinner {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .cmd-palette {
    padding: 0;
  }
  .cmd-palette__panel {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* Mobile Close Button */
.cmd-palette__close-btn {
  display: none; /* Hidden on desktop */
  background: transparent;
  border: none;
  color: var(--outline);
  font-size: 1.5rem;
  padding: 8px;
  margin-left: -8px;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 768px) {
  /* Hide the ESC hint on mobile */
  .cmd-palette__kbd {
    display: none !important;
  }
  
  /* Show the X button on mobile */
  .cmd-palette__close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
/* ================================================================
   Community Hero + Pulse Strip
   Tinted hero card (per-community accent) + recent activity strip.
   ================================================================ */

/* ── Community Hero ──────────────────────────────────────── */
.community-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 32px 36px;
  border-radius: 20px;
  background: var(--surface-container-lowest, #ffffff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  overflow: hidden;
  margin-bottom: 40px;
  isolation: isolate;
}

/* Tinted gradient wash — accent color from community-color.js */
.community-hero[data-accent] {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 8%, var(--surface-container-lowest)) 0%,
    var(--surface-container-lowest) 60%);
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border-subtle));
}

/* Soft radial glow — positioning layer, always present */
.community-hero__glow {
  position: absolute;
  top: -80px;
  right: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--accent, var(--primary)) 14%, transparent) 0%,
    color-mix(in srgb, var(--accent, var(--primary)) 4%, transparent) 40%,
    transparent 70%);
}

.community-hero__body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Eyebrow: community name with pulsing dot */
.community-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.community-hero__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, var(--primary, #35568e));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--primary)) 18%, transparent);
}

.community-hero__eyebrow-text {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent, var(--primary, #35568e));
}

/* Title — the greeting */
.community-hero__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--on-surface, #041748);
  margin: 0;
}

.community-hero__subtitle {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--on-surface-variant, #434750);
  margin: 0;
  max-width: 52ch;
}

/* Live stats row — mono, compact */
.community-hero__stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--on-surface-variant, #434750);
}

.community-hero__stat strong {
  font-weight: 700;
  color: var(--on-surface, #041748);
  margin-right: 4px;
}

.community-hero__stat--active strong {
  color: var(--accent, #ba1a1a);
}

.community-hero__stat-sep {
  color: var(--outline-variant, #c4c6d1);
}

/* CTA button */
.community-hero__enter,
.community-hero__cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--accent, var(--primary, #35568e));
  color: #ffffff;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent, var(--primary)) 40%, transparent);
}

.community-hero__enter:hover,
.community-hero__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--accent, var(--primary)) 48%, transparent);
  background: color-mix(in srgb, var(--accent, var(--primary)) 92%, #000 8%);
}

.community-hero__enter:active,
.community-hero__cta:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px -2px color-mix(in srgb, var(--accent, var(--primary)) 40%, transparent);
}

.community-hero__enter:focus-visible,
.community-hero__cta:focus-visible {
  outline: 2px solid var(--accent, var(--primary));
  outline-offset: 3px;
}

.community-hero__enter i,
.community-hero__cta i {
  font-size: 0.72rem;
}

/* Empty state */
.community-hero--empty {
  background: var(--surface-container-low, #f3f3ff);
}

.community-hero--empty .community-hero__stats {
  margin-top: 16px;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .community-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 22px;
    border-radius: 18px;
    margin-bottom: 28px;
  }

  .community-hero__glow {
    top: -60px;
    right: -100px;
    width: 240px;
    height: 240px;
  }

  .community-hero__title {
    font-size: 1.85rem;
  }

  .community-hero__subtitle {
    font-size: 0.9rem;
    max-width: 100%;
  }

  .community-hero__enter,
  .community-hero__cta {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }
}

/* ── Dark mode ───────────────────────────────────────────── */
[data-theme="dark"] .community-hero {
  background: var(--surface-container-lowest, #131a2e);
  border-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .community-hero[data-accent] {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 10%, #131a2e) 0%,
    #131a2e 60%);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

[data-theme="dark"] .community-hero__glow {
  background: radial-gradient(circle,
    color-mix(in srgb, var(--accent, #93c5fd) 18%, transparent) 0%,
    color-mix(in srgb, var(--accent, #93c5fd) 5%, transparent) 40%,
    transparent 70%);
}

[data-theme="dark"] .community-hero__title {
  color: #e2e8f0;
}

[data-theme="dark"] .community-hero__subtitle {
  color: #94a3b8;
}

[data-theme="dark"] .community-hero__stat strong {
  color: #e2e8f0;
}

[data-theme="dark"] .community-hero__stats {
  color: #94a3b8;
}

/* ══════════════════════════════════════════════════════════════
   PULSE STRIP
   ══════════════════════════════════════════════════════════════ */

.pulse {
  margin-bottom: 40px;
}

.pulse__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.pulse__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-surface, #041748);
  margin: 0;
}

.pulse__meta {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.pulse__track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

/* ── Pulse card ──────────────────────────────────────────── */
.pulse-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: var(--surface-container-lowest, #ffffff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pulse-card:hover {
  border-color: var(--border-strong, rgba(4, 23, 72, 0.2));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px rgba(4, 23, 72, 0.12);
}

.pulse-card__dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pulse-dot, var(--outline-variant));
  opacity: 0.7;
}

.pulse-card__kind {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  margin-bottom: 4px;
}

.pulse-card__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
  color: var(--on-surface, #041748);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.pulse-card__meta {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline, #747781);
  margin-top: auto;
}

/* ── Mobile: horizontal scroll with snap ─────────────────── */
@media (max-width: 768px) {
  .pulse__track {
    display: flex;
    grid-template-columns: none;
    gap: 12px;
    margin: 16px -16px 0;
    padding: 0 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .pulse__track::-webkit-scrollbar { display: none; }

  .pulse-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
  }

  .pulse__header {
    margin-bottom: 0;
  }
}

/* ── Dark mode ───────────────────────────────────────────── */
[data-theme="dark"] .pulse__title {
  color: #e2e8f0;
}

[data-theme="dark"] .pulse-card {
  background: var(--surface-container-lowest, #131a2e);
  border-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .pulse-card__title {
  color: #e2e8f0;
}

[data-theme="dark"] .pulse-card__kind,
[data-theme="dark"] .pulse-card__meta {
  color: #64748b;
}

[data-theme="dark"] .pulse-card:hover {
  border-color: rgba(148, 163, 184, 0.32);
}

/* ── Ensure button text contrast on every accent ─────────────── */

/* Default: white on primary blue */
.community-hero__enter,
.community-hero__cta {
  color: #ffffff;
  background: var(--accent, var(--primary, #35568e));
}

/* Amber, olive, teal, terracotta: darker text for contrast */
.community-hero[data-accent="amber"] .community-hero__enter,
.community-hero[data-accent="amber"] .community-hero__cta,
.community-hero[data-accent="olive"] .community-hero__enter,
.community-hero[data-accent="olive"] .community-hero__cta,
.community-hero[data-accent="teal"] .community-hero__enter,
.community-hero[data-accent="teal"] .community-hero__cta,
.community-hero[data-accent="terracotta"] .community-hero__enter,
.community-hero[data-accent="terracotta"] .community-hero__cta {
  color: #ffffff;
  /* Force a darker shade of the accent so white text always reads */
  background: color-mix(in srgb, var(--accent) 85%, #000 15%);
}

/* Dark mode: text stays white; force lighter accent for contrast */
[data-theme="dark"] .community-hero__enter,
[data-theme="dark"] .community-hero__cta {
  color: #0b1120;
  background: var(--accent, #93c5fd);
}

[data-theme="dark"] .community-hero[data-accent="amber"] .community-hero__enter,
[data-theme="dark"] .community-hero[data-accent="olive"] .community-hero__enter,
[data-theme="dark"] .community-hero[data-accent="teal"] .community-hero__enter,
[data-theme="dark"] .community-hero[data-accent="terracotta"] .community-hero__enter,
[data-theme="dark"] .community-hero[data-accent="amber"] .community-hero__cta,
[data-theme="dark"] .community-hero[data-accent="olive"] .community-hero__cta,
[data-theme="dark"] .community-hero[data-accent="teal"] .community-hero__cta,
[data-theme="dark"] .community-hero[data-accent="terracotta"] .community-hero__cta {
  color: #0b1120;
  background: color-mix(in srgb, var(--accent) 90%, #ffffff 10%);
}

.community-hero__stat strong {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary); /* Makes the numbers pop using the theme color */
  margin-right: 4px;
  letter-spacing: -0.02em;
}

/* ================================================================
   FIX: Global Hub CTA Button (Explore Communities)
   ================================================================ */
.community-hero__enter,
.community-hero__cta {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  
  background-color: var(--primary, #35568e) !important;
  color: #ffffff !important;
  
  padding: 12px 24px !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  
  box-shadow: 0 4px 12px rgba(53, 86, 142, 0.2) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
}

/* Ensure the text inside is always white and visible */
.community-hero__enter span,
.community-hero__cta span {
  color: #ffffff !important;
  display: inline-block !important;
}

/* Ensure the icon is white */
.community-hero__enter i,
.community-hero__cta i {
  color: #ffffff !important;
  font-size: 0.85rem !important;
}

/* Beautiful Hover State */
.community-hero__enter:hover,
.community-hero__cta:hover {
  background-color: var(--primary-container, #4f6fa8) !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(53, 86, 142, 0.3) !important;
}

/* Fix for Dark Mode to ensure it stays visible */
[data-theme="dark"] .community-hero__enter,
[data-theme="dark"] .community-hero__cta {
  background-color: #93c5fd !important;
  color: #0b1120 !important;
}

[data-theme="dark"] .community-hero__enter span,
[data-theme="dark"] .community-hero__cta span,
[data-theme="dark"] .community-hero__enter i,
[data-theme="dark"] .community-hero__cta i {
  color: #0b1120 !important;
}
/* ================================================================
   Components — Unified buttons, pills, cards, inputs, forms
   Every interactive element routes through here.
   Load order: after tokens.css and typography.css
   ================================================================ */

/* ══════════════════════════════════════════════════════════
   1. BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--secondary) 20%, transparent);
}

.btn--primary:hover {
  background: var(--secondary);
  color: var(--on-secondary);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--secondary) 28%, transparent);
}

.btn--secondary {
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border-color: var(--border-default);
}

.btn--secondary:hover {
  background: var(--surface-container-low);
  border-color: var(--border-strong);
  color: var(--on-surface);
}

.btn--ghost {
  background: transparent;
  color: var(--on-surface-variant);
}

.btn--ghost:hover {
  background: var(--surface-container-low);
  color: var(--on-surface);
}

.btn--dark {
  background: var(--on-surface);
  color: var(--on-primary);
}

.btn--dark:hover {
  background: var(--inverse-surface);
  color: var(--on-primary);
}

.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 0.76rem;
  border-radius: 6px;
}

.btn--lg {
  height: 46px;
  padding: 0 22px;
  font-size: 0.9rem;
}

.btn--block { width: 100%; }

/* ══════════════════════════════════════════════════════════
   2. PILLS (filter row)
   ══════════════════════════════════════════════════════════ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--border-strong);
  color: var(--on-surface);
}

.pill.is-active {
  background: var(--on-surface);
  color: var(--on-primary);
  border-color: var(--on-surface);
  font-weight: 600;
}

.pill small {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.65;
  margin-left: 2px;
}

.pill.is-active small { opacity: 0.85; }

/* ══════════════════════════════════════════════════════════
   3. CARDS
   ══════════════════════════════════════════════════════════ */

.card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
              transform 0.15s ease;
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: 0 4px 16px rgba(4, 23, 72, 0.06);
}

.card--interactive { cursor: pointer; }
.card--interactive:hover { transform: translateY(-2px); }

/* ══════════════════════════════════════════════════════════
   4. INPUTS
   ══════════════════════════════════════════════════════════ */

.input,
.textarea,
.select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--on-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  height: auto;
  min-height: 90px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder { color: var(--outline); }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 12%, transparent);
}

/* ══════════════════════════════════════════════════════════
   5. BADGES
   ══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--neutral { background: var(--surface-container); color: var(--on-surface-variant); }
.badge--crimson { background: color-mix(in srgb, var(--secondary) 10%, transparent); color: var(--secondary); }
.badge--blue    { background: rgba(59, 130, 246, 0.10); color: #1e40af; }
.badge--green   { background: rgba(16, 185, 129, 0.10); color: #047857; }

/* ══════════════════════════════════════════════════════════
   6. SECTION LABELS + DIVIDERS
   ══════════════════════════════════════════════════════════ */

.section-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 10px;
}

.divider {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: 20px 0;
}

/* ══════════════════════════════════════════════════════════
   7. APP LAYOUT
   ══════════════════════════════════════════════════════════ */

.app-shell {
  display: block;
  padding-left: 256px;
  padding-top: 64px;   /* clears the fixed header */
  min-height: 100vh;
  width: 100%;
  position: relative;
}

.main-content {
  width: 100%;
  margin: 0;
  padding: 24px 32px 40px;
  min-height: calc(100vh - 64px);
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}

.main-content::before,
.main-content::after {
  content: none;
  display: none;
}

@media (max-width: 768px) {
  .app-shell {
    padding-left: 0;
    padding-top: 56px;
  }
  .main-content {
    padding: 24px 16px 32px;
  }
}

/* ══════════════════════════════════════════════════════════
   8. PAGE HERO (reusable across pages)
   ══════════════════════════════════════════════════════════ */

.page-hero {
  margin-bottom: 32px;
  max-width: 100%;
}

.page-hero__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.page-hero__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary-container);
}

.page-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--primary);
}

.page-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.5rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--on-surface);
  margin: 0 0 12px;
}

.page-hero__subtitle {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--on-surface-variant);
  max-width: 60ch;
  margin: 0 0 20px;
}

.page-hero__chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-container-low);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--on-surface-variant);
}

.page-chip i {
  font-size: 0.75rem;
  color: var(--outline);
}

/* ══════════════════════════════════════════════════════════
   9. CONTENT CARD (wiki pages)
   ══════════════════════════════════════════════════════════ */

.content-card {
  max-width: 1240px;
  margin: 0 auto; 
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.content-card > * {
  padding-left: 24px;
  padding-right: 24px;
}

.content-card > .comments-shell,
.content-card > .page-share-bottom {
  padding: 0 24px;
}

@media (max-width: 768px) {
  .content-card > * {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ══════════════════════════════════════════════════════════
   10. FORM SHELLS (generic wrapper for narrow form pages)
   ══════════════════════════════════════════════════════════ */

.form-shell,
.submit-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
}

.status-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
}

/* ══════════════════════════════════════════════════════════
   11. FORM PRIMITIVES (used across list-service, broadcast, etc.)
   ══════════════════════════════════════════════════════════ */

.listing-form,
.status-form,
.form-shell form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
}

.listing-form .form-group,
.submit-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listing-form .form-group > label,
.submit-form .form-group > label,
.status-form label,
.form-shell label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0;
}

/* Text inputs across forms */
.listing-form input[type="text"],
.listing-form input[type="email"],
.listing-form input[type="number"],
.listing-form select,
.listing-form textarea,
.status-form input,
.form-shell input[type="text"],
.form-shell input[type="email"],
.form-shell input[type="number"],
.form-shell select,
.form-shell textarea,
form input[type="text"],
form input[type="email"],
form input[type="number"],
form select,
form textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--on-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.listing-form textarea,
.form-shell textarea,
form textarea {
  height: auto;
  min-height: 160px;
  padding: 14px;
  line-height: 1.55;
  resize: vertical;
}

.listing-form input:focus,
.listing-form select:focus,
.listing-form textarea:focus,
.status-form input:focus,
.form-shell input:focus,
.form-shell select:focus,
.form-shell textarea:focus,
form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 12%, transparent);
}

/* Custom select chevron */
.listing-form select,
.form-shell select,
form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23747781' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

/* Submit buttons across forms */
.status-form__submit,
.status-form button[type="submit"],
.form-shell button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.status-form__submit:hover,
.status-form button[type="submit"]:hover,
.form-shell button[type="submit"]:hover {
  background: var(--primary);
  color: var(--on-primary);
}

/* Form row helpers */
.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .form-row-2col { grid-template-columns: 1fr; }
}

.form-optional {
  color: var(--outline);
  font-weight: 400;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--outline);
}

/* Form actions row */
.listing-form .form-actions,
.submit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.listing-form .form-actions .btn,
.submit-actions .btn { min-width: 120px; }

/* ══════════════════════════════════════════════════════════
   12. STATUS PAGE
   ══════════════════════════════════════════════════════════ */

.status-form {
  gap: 16px;
  margin-bottom: 24px;
}

.status-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-form__field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--on-surface);
}

.status-form__field input {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.status-error {
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--error-container);
  color: var(--on-error-container);
  border-radius: var(--radius-lg);
  font-size: 0.86rem;
  font-weight: 500;
}

.status-result {
  padding: 24px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  margin-bottom: 24px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.status-badge--pending   { background: rgba(245, 158, 11, 0.15); color: #92400e; }
.status-badge--approved  { background: rgba(59, 130, 246, 0.15); color: #1e40af; }
.status-badge--published { background: rgba(16, 185, 129, 0.15); color: #047857; }
.status-badge--closed,
.status-badge--not_found { background: var(--surface-container); color: var(--on-surface-variant); }
.status-badge--invalid   { background: var(--error-container); color: var(--on-error-container); }

.status-description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  line-height: 1.55;
}

.status-share {
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.status-share__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 12px;
}

.status-share__links {
  display: flex;
  gap: 8px;
}

.status-share__links a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: all 0.15s ease;
}

.status-share__links a:hover {
  background: var(--primary-container);
  border-color: var(--primary-container);
  color: var(--on-primary-container);
}

/* ══════════════════════════════════════════════════════════
   13. SUBMIT WIZARD
   ══════════════════════════════════════════════════════════ */

.submit-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  padding: 4px;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
}

.submit-step {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.submit-step:hover { background: var(--surface-container); }

.submit-step.active {
  background: var(--surface-container-lowest);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(4, 23, 72, 0.06);
}

.submit-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.submit-step.active .submit-step__num {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.submit-panel {
  padding: 28px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
}

.submit-panel__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin: 0 0 24px;
}

/* Content type toggle */
.content-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.content-type-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-container-lowest);
  cursor: pointer;
  transition: all 0.15s ease;
}

.content-type-option:hover { border-color: var(--primary-container); }

.content-type-option input[type="radio"] { display: none; }

.content-type-option:has(input:checked) {
  border-color: var(--primary-container);
  background: color-mix(in srgb, var(--primary-container) 8%, var(--surface-container-lowest));
}

.content-type-option input[type="radio"]:checked ~ .content-type-option__title {
  color: var(--primary);
}

.content-type-option__icon {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.content-type-option__title {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--on-surface);
}

.content-type-option__desc {
  font-size: 0.78rem;
  color: var(--on-surface-variant);
  line-height: 1.4;
}

/* Submit wizard editor shell */
.editor-shell {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-container-lowest);
}

.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--border-subtle);
}

.editor-toolbar button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-default);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-toolbar button:hover {
  background: var(--surface-container-lowest);
  color: var(--primary);
}

.editor-shell .editor-area {
  min-height: 220px;
  padding: 16px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--on-surface);
  outline: none;
}

.editor-shell .editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--outline);
  pointer-events: none;
}

/* Submit wizard notice */
.submit-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: color-mix(in srgb, var(--primary-container) 8%, var(--surface-container-lowest));
  border: 1px solid color-mix(in srgb, var(--primary-container) 20%, transparent);
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
}

.submit-notice i {
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 2px;
}

.submit-notice strong {
  display: block;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 4px;
}

.submit-notice p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--on-surface-variant);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   14. FILE DROP ZONE (list-service)
   ══════════════════════════════════════════════════════════ */

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 20px;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-container-low);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-drop:hover,
.file-drop.is-dragging {
  border-color: var(--primary-container);
  background: color-mix(in srgb, var(--primary-container) 6%, var(--surface-container-low));
}

.file-drop i {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.file-drop__title {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--on-surface);
}

.file-drop__hint {
  font-size: 0.76rem;
  color: var(--outline);
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--primary-container) 10%, var(--surface-container-lowest));
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.form-error {
  padding: 10px 14px;
  background: var(--error-container);
  color: var(--on-error-container);
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 12px;
}

/* ══════════════════════════════════════════════════════════
   15. UGC REPORT ROW
   ══════════════════════════════════════════════════════════ */

.ugc-report-wrap--detail {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.report-content-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.report-content-btn:hover {
  background: var(--error-container);
  border-color: var(--error);
  color: var(--error);
}

.report-content-btn i { font-size: 0.7rem; }

/* ══════════════════════════════════════════════════════════
   16. RESPONSIVE — mobile form adjustments
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .submit-panel { padding: 20px; }
  .submit-step__label { display: none; }
  .submit-step { padding: 10px; }
  .submit-actions,
  .listing-form .form-actions {
    flex-direction: column-reverse;
  }
  .submit-actions .btn,
  .listing-form .form-actions .btn { width: 100%; }
}

/* ── Wiki section image alignment ──────────────────────── */
.lh-section { position: relative; }
.lh-clear { clear: both; }

.lh-align-center,
.lh-align-center .lh-image-container {
  display: block;
  width: 100%;
  margin: 1.5rem auto;
  text-align: center;
}

.lh-align-center .lh-fluid-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  display: block;
  margin: 0 auto;
}

.lh-align-left {
  float: left;
  width: min(45%, 380px);
  margin: 0.5rem 1.5rem 1rem 0;
}

.lh-align-right {
  float: right;
  width: min(45%, 380px);
  margin: 0.5rem 0 1rem 1.5rem;
}

.lh-align-left .lh-fluid-img,
.lh-align-right .lh-fluid-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  display: block;
}

@media (max-width: 768px) {
  .lh-align-left,
  .lh-align-right {
    float: none;
    width: 100%;
    margin: 1rem 0;
  }
}

[hidden] {
  display: none !important;
}
/* ================================================================
   Dark Mode — properly gated by data-theme="dark" OR system pref.
   Never use :not([data-theme="light"]) — that matches unset state.
   ================================================================ */

/* ── Dark tokens — only apply when explicitly dark OR system dark ── */

[data-theme="dark"] {
  --surface:                   #0b1120;
  --surface-container-lowest:  #131a2e;
  --surface-container-low:     #1a2436;
  --surface-container:         #1e293b;
  --surface-container-high:    #293548;
  --surface-container-highest: #334155;

  --on-surface:                #e2e8f0;
  --on-surface-variant:        #94a3b8;
  --outline:                   #64748b;
  --outline-variant:           #334155;

  --border-subtle:             rgba(148, 163, 184, 0.10);
  --border-default:            rgba(148, 163, 184, 0.18);
  --border-strong:             rgba(148, 163, 184, 0.32);

  --shadow-sm:  0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl:  0 12px 32px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) {
    --surface:                   #0b1120;
    --surface-container-lowest:  #131a2e;
    --surface-container-low:     #1a2436;
    --surface-container:         #1e293b;
    --surface-container-high:    #293548;
    --surface-container-highest: #334155;

    --on-surface:                #e2e8f0;
    --on-surface-variant:        #94a3b8;
    --outline:                   #64748b;
    --outline-variant:           #334155;

    --border-subtle:             rgba(148, 163, 184, 0.10);
    --border-default:            rgba(148, 163, 184, 0.18);
    --border-strong:             rgba(148, 163, 184, 0.32);
  }
}

/* ── Explicit dark overrides (only fire on [data-theme="dark"]) ── */

[data-theme="dark"] .sidebar {
  background: rgba(19, 26, 46, 0.85) !important;
}

[data-theme="dark"] .site-header {
  background: rgba(19, 26, 46, 0.9) !important;
}

[data-theme="dark"] .header-search,
[data-theme="dark"] .header-icon-btn,
[data-theme="dark"] .header-avatar {
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .dashboard__panel,
[data-theme="dark"] .quick-action,
[data-theme="dark"] .content-card {
  background: var(--surface-container-lowest);
  border-color: var(--border-subtle);
}

[data-theme="dark"] .wiki-render,
[data-theme="dark"] .wiki-render p,
[data-theme="dark"] .wiki-render li,
[data-theme="dark"] .wiki-render h1,
[data-theme="dark"] .wiki-render h2,
[data-theme="dark"] .wiki-render h3,
[data-theme="dark"] .wiki-render strong {
  color: var(--on-surface) !important;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface-container-low);
  border-color: var(--border-default);
  color: var(--on-surface);
}

[data-theme="dark"] code,
[data-theme="dark"] pre {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* ================================================================
   Dark mode — Editorial primitives + new components
   Ensures the editorial layout works as a peer, not an inverted theme.
   ================================================================ */

[data-theme="dark"] .ed-hero {
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .ed-hero__title,
[data-theme="dark"] .ed-hero__eyebrow,
[data-theme="dark"] .ed-data__value,
[data-theme="dark"] .ed-section__title,
[data-theme="dark"] .ed-list__title,
[data-theme="dark"] .ed-list__value {
  color: #e2e8f0;
}

[data-theme="dark"] .ed-hero__subtitle,
[data-theme="dark"] .ed-data__context,
[data-theme="dark"] .ed-list__meta,
[data-theme="dark"] .ed-inline__action {
  color: #94a3b8;
}

[data-theme="dark"] .ed-data-grid,
[data-theme="dark"] .ed-data,
[data-theme="dark"] .ed-list,
[data-theme="dark"] .ed-list__row,
[data-theme="dark"] .ed-inline,
[data-theme="dark"] .ed-rule {
  border-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .ed-list__row:hover {
  background: rgba(148, 163, 184, 0.06);
}

[data-theme="dark"] .ed-list__index,
[data-theme="dark"] .ed-list__arrow {
  color: #475569;
}

[data-theme="dark"] .ed-list__row:hover .ed-list__arrow {
  color: #93c5fd;
}

[data-theme="dark"] .ed-section__link {
  color: #93c5fd;
}

[data-theme="dark"] .ed-inline__action:hover {
  color: #93c5fd;
}

/* Marketplace editorial */
[data-theme="dark"] .mp-hero-v2 {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .mp-hero-v2 h1 {
  color: #e2e8f0;
}

[data-theme="dark"] .mp-hero-v2 p {
  color: #94a3b8;
}

[data-theme="dark"] .mp-hero-v2::after {
  background: #334155;
}

[data-theme="dark"] .mp-filter-row,
[data-theme="dark"] .mp-category-row {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .mp-pill-v2,
[data-theme="dark"] .mp-category-link {
  color: #94a3b8;
}

[data-theme="dark"] .mp-pill-v2:hover,
[data-theme="dark"] .mp-category-link:hover,
[data-theme="dark"] .mp-pill-v2.active,
[data-theme="dark"] .mp-category-link.active {
  color: #93c5fd;
}

[data-theme="dark"] .mp-card-v2__media {
  background: #1e293b;
}

[data-theme="dark"] .mp-card-v2__title,
[data-theme="dark"] .mp-card-v2__price {
  color: #e2e8f0;
}

[data-theme="dark"] .mp-card-v2__meta {
  color: #94a3b8;
}

[data-theme="dark"] .mp-card-v2__category {
  color: #64748b;
}

[data-theme="dark"] .mp-card-v2__heart {
  background: rgba(30, 41, 59, 0.94);
  color: #94a3b8;
}

/* Editor drawer */
[data-theme="dark"] .drawer-section-card {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .drawer-section-card .section-header {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .drawer-section-card .sec-label {
  color: #94a3b8;
}

[data-theme="dark"] .rich-toolbar {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .rich-toolbar button {
  color: #94a3b8;
}

[data-theme="dark"] .rich-toolbar button:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
}

[data-theme="dark"] .rich-toolbar button.is-active {
  background: rgba(147, 197, 253, 0.15);
  color: #93c5fd;
}

[data-theme="dark"] .editor-area {
  color: #e2e8f0;
}

[data-theme="dark"] .section-settings-panel,
[data-theme="dark"] .editor-accordion {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .editor-accordion__summary,
[data-theme="dark"] .section-settings-panel .editor-accordion__summary {
  color: #94a3b8;
}

[data-theme="dark"] .editor-accordion__content {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .drawer-header h2 {
  color: #e2e8f0;
}

[data-theme="dark"] .drawer-view-switcher {
  background: rgba(30, 41, 59, 0.6);
}

[data-theme="dark"] .drawer-view-btn {
  color: #94a3b8;
}

[data-theme="dark"] .drawer-view-btn.active {
  background: #1e293b;
  color: #93c5fd;
}

[data-theme="dark"] .btn-add-sec {
  border-color: rgba(148, 163, 184, 0.2);
  color: #93c5fd;
}

[data-theme="dark"] .btn-add-sec:hover {
  background: rgba(147, 197, 253, 0.08);
  border-color: #93c5fd;
  border-style: solid;
}

/* Wiki editorial */
[data-theme="dark"] .wiki-render h2,
[data-theme="dark"] .wiki-render h3 {
  color: #e2e8f0;
}

[data-theme="dark"] .wiki-render h2 {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .wiki-render h2::before {
  color: #334155;
}

[data-theme="dark"] .wiki-render > p,
[data-theme="dark"] .wiki-render li {
  color: #cbd5e1;
}

[data-theme="dark"] .wiki-render blockquote {
  color: #e2e8f0;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .wiki-toc__label {
  color: #94a3b8;
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .wiki-toc__link {
  color: #94a3b8;
  border-left-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .wiki-toc__link:hover {
  color: #cbd5e1;
  border-left-color: #475569;
}

[data-theme="dark"] .wiki-toc__link.is-active {
  color: #93c5fd;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .wiki-meta-strip {
  color: #94a3b8;
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .wiki-meta-strip__author {
  color: #e2e8f0;
}

[data-theme="dark"] .sidebar-nav__item > .sidebar-nav__icon {
  color: #94a3b8;
}

[data-theme="dark"] .sidebar-nav__item:hover > .sidebar-nav__icon {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

[data-theme="dark"] .sidebar-nav__item.is-active > .sidebar-nav__icon {
  background: linear-gradient(135deg,
    #4f6fa8 0%,
    #6a8cc4 100%);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 -1px 0 rgba(0, 0, 0, 0.3) inset,
    0 2px 8px -2px rgba(79, 111, 168, 0.55);
}

[data-theme="dark"] .sidebar-nav__item.is-active {
  background: rgba(79, 111, 168, 0.14);
}

[data-theme="dark"] .sidebar-nav__item.is-active > .sidebar-nav__label-text {
  color: #93c5fd;
}
/* ================================================================
   Dashboard Extras — hero motion, featured card, value prop
   ================================================================ */

/* ── 1. Hero entrance animation ────────────────────────────── */
.ed-hero__eyebrow,
.ed-hero__title,
.ed-hero__subtitle {
  animation: heroReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ed-hero__eyebrow  { animation-delay: 0ms; }
.ed-hero__title    { animation-delay: 80ms; }
.ed-hero__subtitle { animation-delay: 160ms; }

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

/* Ambient pulse behind the hero — barely noticeable */
.ed-hero::after {
  animation: heroGlow 12s ease-in-out infinite;
}

@keyframes heroGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.65; transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .ed-hero__eyebrow,
  .ed-hero__title,
  .ed-hero__subtitle {
    animation: none;
  }
  .ed-hero::after { animation: none; }
}

/* ── 2. Featured listing card ─────────────────────────────── */
.ed-featured {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: 28px;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 40px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease;
  max-width: 900px;   /* caps width — never dwarfs the page */
}

.ed-featured:hover {
  opacity: 0.92;
}

.ed-featured__media {
  aspect-ratio: 16 / 9;
  max-height: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-container-low, #f3f3ff);
  position: relative;
}

.ed-featured__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Empty state — reads as intentional, not broken */
.ed-featured__media--empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 6%, transparent),
    color-mix(in srgb, var(--primary) 2%, transparent));
  border: 1.5px dashed color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary, #35568e);
}

.ed-featured__media--empty i {
  font-size: 2.4rem;
  opacity: 0.6;
}

.ed-featured__media--empty::after {
  content: "Listing image coming soon";
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary, #35568e);
  opacity: 0.6;
}

.ed-featured__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary, #35568e);
  z-index: 2;
}

.ed-featured__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ed-featured__eyebrow {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.ed-featured__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--on-surface, #041748);
  margin: 0;
}

.ed-featured__meta {
  font-size: 0.88rem;
  color: var(--on-surface-variant, #434750);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ed-featured__meta-sep {
  color: var(--outline-variant, #c4c6d1);
}

.ed-featured__price {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--on-surface, #041748);
  margin-top: 4px;
}

.ed-featured__price span {
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--outline, #747781);
  margin-left: 4px;
}

.ed-featured__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--primary, #35568e);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  margin-top: 8px;
  width: fit-content;
  transition: background 0.15s ease;
}

.ed-featured:hover .ed-featured__cta {
  background: var(--primary-container, #4f6fa8);
}

.ed-featured__cta i {
  font-size: 0.72rem;
}

@media (max-width: 768px) {
  .ed-featured {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0;
    margin-bottom: 32px;
    max-width: 100%;
  }

  .ed-featured__media {
    max-height: 220px;
  }

  .ed-featured__title {
    font-size: 1.25rem;
  }

  .ed-featured__price {
    font-size: 1.2rem;
  }
}

/* ── 3. Value proposition section ─────────────────────────── */
.ed-value {
  padding: 48px 0 32px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-top: 24px;
}

/* Stacked header, left-aligned */
.ed-value__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 32px;
  max-width: 640px;
}

.ed-value__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--on-surface, #041748);
  margin: 0;
  max-width: 22ch;
}

.ed-value__eyebrow {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.ed-value__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.ed-value__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
  border-top: 2px solid var(--primary, #35568e);
}

.ed-value__card:nth-child(2) { border-top-color: #b45309; }
.ed-value__card:nth-child(3) { border-top-color: #86198f; }

.ed-value__num {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--outline, #747781);
}

.ed-value__title-sm {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-surface, #041748);
  margin: 0;
}

.ed-value__desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--on-surface-variant, #434750);
  margin: 0;
}

@media (max-width: 900px) {
  .ed-value__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .ed-value__title {
    font-size: 1.4rem;
  }
}

/* ── Dark mode ────────────────────────────────────────────── */
[data-theme="dark"] .ed-featured,
[data-theme="dark"] .ed-value {
  border-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .ed-featured__title,
[data-theme="dark"] .ed-featured__price,
[data-theme="dark"] .ed-value__title,
[data-theme="dark"] .ed-value__title-sm {
  color: #e2e8f0;
}

[data-theme="dark"] .ed-featured__meta,
[data-theme="dark"] .ed-value__desc {
  color: #94a3b8;
}

[data-theme="dark"] .ed-featured__media {
  background: #1e293b;
}

[data-theme="dark"] .ed-featured__media--empty {
  background: linear-gradient(135deg,
    rgba(147, 197, 253, 0.06),
    rgba(147, 197, 253, 0.02));
  border-color: rgba(147, 197, 253, 0.2);
  color: #93c5fd;
}

[data-theme="dark"] .ed-featured__media--empty::after {
  color: #93c5fd;
}

[data-theme="dark"] .ed-featured__badge {
  background: rgba(30, 41, 59, 0.92);
  color: #93c5fd;
}

/* ── 4. Broadcast highlight card ──────────────────────────── */
.ed-alert {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  margin-bottom: 40px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  text-decoration: none;
  color: inherit;
  max-width: 900px;
  transition: opacity 0.15s ease;
}

.ed-alert:hover {
  opacity: 0.94;
}

/* Urgency rail — a vertical colored bar on the left */
.ed-alert__rail {
  flex-shrink: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--alert-accent, var(--outline-variant, #c4c6d1));
  align-self: stretch;
}

/* Urgency variants — set --alert-accent on the wrapper */
.ed-alert--low      { --alert-accent: #94a3b8; }
.ed-alert--medium   { --alert-accent: #35568e; }
.ed-alert--high     { --alert-accent: #f59e0b; }
.ed-alert--critical { --alert-accent: #ba1a1a; }

.ed-alert__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Eyebrow: dot + label + expires-in */
.ed-alert__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--alert-accent, var(--outline, #747781));
}

.ed-alert__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--alert-accent, var(--outline));
  animation: edAlertPulse 2s ease-in-out infinite;
}

@keyframes edAlertPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .ed-alert__dot { animation: none; }
}

.ed-alert__eyebrow-text {
  color: var(--alert-accent, var(--outline));
}

.ed-alert__eyebrow-meta {
  color: var(--outline, #747781);
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: none;
}

/* Title */
.ed-alert__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--on-surface, #041748);
  margin: 0;
}

/* Excerpt */
.ed-alert__excerpt {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--on-surface-variant, #434750);
  margin: 0;
  max-width: 62ch;
}

/* Meta row */
.ed-alert__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--on-surface-variant, #434750);
  margin-top: 4px;
}

.ed-alert__meta-sep {
  color: var(--outline-variant, #c4c6d1);
}

.ed-alert__meta-arrow {
  margin-left: auto;
  color: var(--outline-variant, #c4c6d1);
  font-size: 0.75rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ed-alert:hover .ed-alert__meta-arrow {
  color: var(--alert-accent, var(--primary));
  transform: translateX(3px);
}

/* Mobile — rail moves to top */
@media (max-width: 600px) {
  .ed-alert {
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
    max-width: 100%;
  }

  .ed-alert__rail {
    width: 100%;
    height: 3px;
    align-self: auto;
  }

  .ed-alert__title {
    font-size: 1.25rem;
  }

  .ed-alert__excerpt {
    font-size: 0.88rem;
  }
}

/* Dark mode */
[data-theme="dark"] .ed-alert {
  border-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .ed-alert__title {
  color: #e2e8f0;
}

[data-theme="dark"] .ed-alert__excerpt,
[data-theme="dark"] .ed-alert__meta {
  color: #94a3b8;
}

[data-theme="dark"] .ed-alert--low      { --alert-accent: #64748b; }
[data-theme="dark"] .ed-alert--medium   { --alert-accent: #7dd3fc; }
[data-theme="dark"] .ed-alert--high     { --alert-accent: #fbbf24; }
[data-theme="dark"] .ed-alert--critical { --alert-accent: #fca5a5; }
/* ================================================================
   Dashboard — Homepage
   ================================================================ */

.dashboard {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0;
}

.dashboard__greeting {
  margin-bottom: 32px;
}

.dashboard__greeting h1 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin-bottom: 4px;
}

.dashboard__greeting p {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
}

/* Stats row */
.dashboard__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .dashboard__stats { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card__label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: #0f172a;
  line-height: 1;
}

/* Grid */
.dashboard__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .dashboard__grid { grid-template-columns: 1fr; }
}

/* Panels */
.dashboard__panel {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
}

.dashboard__panel--wide {
  margin-top: 0;
}

.dashboard__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dashboard__panel-head h2 {
  font-size: 0.94rem;
  font-weight: 700;
  margin: 0;
}

/* Community rows */
.community-list,
.listing-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.community-row,
.listing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.community-row:hover,
.listing-row:hover {
  background: #f8fafc;
  color: inherit;
}

.community-row__icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.community-row__body,
.listing-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.community-row__name,
.listing-row__title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-row__meta,
.listing-row__meta {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.community-row__arrow {
  color: #cbd5e1;
  font-size: 0.75rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.community-row:hover .community-row__arrow {
  color: #dc2626;
  transform: translateX(2px);
}

/* Listing thumb */
.listing-row__thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f1f5f9;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

.listing-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-row__price {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

.quick-action {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  transition: all 0.15s ease;
}

.quick-action:hover {
  border-color: rgba(220, 38, 38, 0.3);
  background: #fffbfb;
  transform: translateY(-1px);
  color: inherit;
}

.quick-action i {
  font-size: 1rem;
  color: #dc2626;
  margin-bottom: 4px;
}

.quick-action__title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
}

.quick-action__desc {
  font-size: 0.72rem;
  color: #64748b;
}
/* ================================================================
   Detail page v2 — Split layout, verified badges, inquiry panel
   ================================================================ */

.detail-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

.detail-breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--outline);
  margin-bottom: 20px;
}

.detail-breadcrumb a { color: var(--outline); text-decoration: none; }
.detail-breadcrumb a:hover { color: var(--on-surface); }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 32px;
  align-items: start;
}

@media (max-width: 1200px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 1024px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Gallery */
.detail-gallery {
  position: sticky;
  top: 88px;
}

.detail-gallery__hero {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 480px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface-container-low);
}

.detail-gallery__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.detail-gallery__hero-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-gallery__zoom {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--on-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.detail-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.detail-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: var(--surface-container-low);
  transition: border-color 0.15s ease;
}

.detail-thumb.is-active { border-color: var(--on-surface); }

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Info panel */
.detail-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* max-width: 640px; */
}

.detail-badges-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.detail-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
}

.detail-pill--verified { background: rgba(59, 130, 246, 0.12); color: #1e40af; }
.detail-pill--fast { background: rgba(16, 185, 129, 0.12); color: #047857; }
.detail-pill--pickup { background: rgba(148, 163, 184, 0.15); color: var(--on-surface-variant); }

.detail-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--on-surface);
  margin: 0;
  word-break: break-word;
}

.detail-description {
  font-size: 0.94rem;
  color: var(--on-surface-variant);
  line-height: 1.55;
  margin: 0;
}

.detail-meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--outline);
  font-weight: 500;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-meta-row span::before {
  content: "·";
  margin-right: 6px;
  color: var(--outline);
}

.detail-meta-row span:first-child::before { display: none; }

/* Price card */
.detail-price-card {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-container-lowest);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-price-card__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline);
}

.detail-price-card__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--on-surface);
  line-height: 1;
}

.detail-price-card__value span {
  font-size: 1rem;
  color: var(--outline);
  font-weight: 600;
  margin-left: 4px;
}

.detail-price-card__hint {
  font-size: 0.78rem;
  color: var(--outline);
}

.detail-price-card__hint strong { color: var(--on-surface); }

/* Seller card */
.detail-seller-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-container-lowest);
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-seller-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.detail-seller-card__body { flex: 1; min-width: 0; }

.detail-seller-card__name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--on-surface);
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-seller-card__name i { color: var(--color-verified); font-size: 0.82rem; }

.detail-seller-card__meta {
  font-size: 0.76rem;
  color: var(--outline);
}

.detail-seller-card__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.detail-seller-card__rating {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--on-surface);
}

.detail-seller-card__reviews {
  font-size: 0.7rem;
  color: var(--outline);
}

/* Inquiry shortcuts */
.detail-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-shortcuts__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline);
}

.detail-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.detail-shortcut:hover {
  border-color: var(--border-strong);
  background: var(--surface-container-low);
}

/* CTA button (full-width) */
.detail-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 24%, transparent);
  transition: background 0.15s ease, transform 0.15s ease;
}

.detail-cta:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 24%, transparent);
}

/* When gallery has no image, reduce height so comments aren't pushed far down */
.detail-gallery__hero.is-empty {
  aspect-ratio: auto;
  min-height: 240px;
  max-height: 280px;
}

/* Empty state fills the entire gallery hero when there's no image */
.detail-gallery__hero > .empty-state {
  position: absolute;
  inset: 12px;
  width: auto;
  height: auto;
  min-height: 0;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-container-low);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.detail-gallery__hero > .empty-state .empty-state__icon {
  width: 56px;
  height: 56px;
  font-size: 1.4rem;
  margin: 0;
}
/* ================================================================
   Editor Core — unified styles for drawer + submit wizard
   ================================================================ */

.editor-section {
  display: flex;
  flex-direction: column;
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
  border-radius: 16px;
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editor-section:focus-within {
  border-color: color-mix(in srgb, var(--primary-container) 40%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 10%, transparent);
}

/* Header */
.editor-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-container-low, #f8fafc);
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
}

.editor-section__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-surface-variant, #64748b);
}

.editor-section__remove {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--outline-variant, #94a3b8);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.editor-section__remove:hover {
  background: var(--error-container, rgba(239, 68, 68, 0.1));
  color: var(--error, #dc2626);
}

.editor-section__remove:disabled,
.editor-section:only-of-type .editor-section__remove {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Toolbar */
.editor-section__toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: var(--surface-container-low, #f8fafc);
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
}

.editor-section__toolbar button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--on-surface-variant, #64748b);
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.editor-section__toolbar button:hover {
  background: var(--surface-container, #ebedff);
  color: var(--on-surface, #0f172a);
}

.editor-section__toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-default, rgba(4, 23, 72, 0.1));
  margin: 0 6px;
}

/* Content area */
.editor-section__body {
  min-height: 180px;
  padding: 16px 18px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--on-surface, #0f172a);
  outline: none;
  background: var(--surface-container-lowest, #fff);
}

.editor-section__body:empty::before {
  content: attr(data-placeholder);
  color: var(--outline, #94a3b8);
  pointer-events: none;
}

.editor-section__body p {
  margin: 0 0 0.8rem;
}

.editor-section__body p:last-child {
  margin-bottom: 0;
}

/* Media block */
.editor-section__media {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-container-low, #f8fafc);
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
}

.editor-section__input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  background: var(--surface-container-lowest, #fff);
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--on-surface, #0f172a);
}

.editor-section__input:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 15%, transparent);
}

/* Add-section button */
.editor-add-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  margin-top: 8px;
  border: 2px dashed var(--border-strong, rgba(4, 23, 72, 0.2));
  border-radius: 16px;
  background: transparent;
  color: var(--primary, #35568e);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.editor-add-section:hover {
  background: color-mix(in srgb, var(--primary-container) 6%, transparent);
  border-color: var(--primary-container);
  border-style: solid;
}

/* Mobile */
@media (max-width: 768px) {
  .editor-section__toolbar {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .editor-section__toolbar::-webkit-scrollbar { display: none; }
  .editor-section__body {
    min-height: 140px;
    padding: 14px;
    font-size: 16px; /* prevent iOS zoom */
  }
}
/* ================================================================
   Editor Drawer — Editorial surface refinements
   Makes the drawer feel like a writing space, not a form.
   Loaded after editor-drawer.css.
   ================================================================ */

/* ── 1. Section cards → rule-separated blocks ─────────────── */
.drawer-section-card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 0;
  padding: 20px 0 24px;
  margin-bottom: 0;
  box-shadow: none;
  overflow: visible;
}

.drawer-section-card:first-of-type {
  border-top: none;
  padding-top: 8px;
}

.drawer-section-card:focus-within {
  border-color: color-mix(in srgb, var(--primary-container) 30%, transparent);
  box-shadow: none;
}

/* Section header — small caps label, no chrome */
.drawer-section-card .section-header {
  position: static;
  background: transparent;
  border-bottom: none;
  padding: 0 0 12px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer-section-card .section-header::before {
  display: none;
}

.drawer-section-card .sec-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  padding-left: 0;
}

/* Remove the colorful status pills */
.drawer-section-card .sec-label::after {
  content: none;
  display: none;
}

/* Remove button — subtler */
.drawer-section-card .btn-remove-sec {
  color: var(--outline-variant, #c4c6d1);
  transition: color 0.15s ease, background 0.15s ease;
}

.drawer-section-card .btn-remove-sec:hover {
  background: transparent;
  color: var(--error, #ba1a1a);
}

/* ── 2. Rich toolbar → quieter ────────────────────────────── */
.rich-toolbar {
  background: transparent;
  border-bottom: none;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  padding: 8px 0;
  margin-bottom: 8px;
}

.rich-toolbar__group {
  background: transparent;
  border: none;
  padding: 0;
  gap: 0;
}

.rich-toolbar button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--on-surface-variant, #434750);
  transition: background 0.12s ease, color 0.12s ease;
}

.rich-toolbar button:hover {
  background: var(--surface-container, #ebedff);
  color: var(--on-surface, #041748);
}

.rich-toolbar button.is-active {
  background: var(--surface-container, #ebedff);
  color: var(--primary, #35568e);
  box-shadow: none;
}

/* ── 3. Editor area — breathing room ─────────────────────── */
.editor-area {
  min-height: 200px;
  padding: 12px 0 32px;
  background: transparent;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--on-surface, #041748);
}

.editor-area:focus {
  background: transparent;
}

.editor-area:empty::before {
  padding: 0;
}

/* Word count — subtle */
.editor-area::after {
  bottom: 4px;
  right: 0;
  background: transparent;
  padding: 0;
}

/* ── 4. Media section ─────────────────────────────────────── */
.section-settings-panel {
  background: transparent;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 0;
  margin-top: 12px;
}

.section-settings-panel .editor-accordion__summary {
  padding: 14px 0;
  background: transparent;
  font-size: 0.82rem;
  color: var(--on-surface-variant, #434750);
  font-weight: 600;
}

.section-settings-panel .editor-accordion__summary::after {
  background: transparent;
  border: none;
  color: var(--outline, #747781);
  font-size: 1rem;
}

.section-settings-panel .editor-accordion__content {
  padding: 16px 0;
  border-top: none;
  background: transparent;
}

/* ── 5. Page details accordion ────────────────────────────── */
.editor-accordion {
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 12px;
  background: transparent;
}

.editor-accordion__summary {
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--on-surface-variant, #434750);
  padding: 12px 14px;
}

.editor-accordion__summary::after {
  background: transparent;
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.12));
  color: var(--outline, #747781);
}

.editor-accordion__content {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

/* ── 6. Drawer header — quieter ───────────────────────────── */
.drawer-header h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-surface, #041748);
}

.drawer-view-switcher {
  background: var(--surface-container-low, #f3f3ff);
  border: none;
  padding: 2px;
}

.drawer-view-btn {
  font-size: 0.76rem;
  padding: 5px 12px;
  border-radius: 8px;
}

.drawer-view-btn.active {
  background: var(--surface-container-lowest, #fff);
  color: var(--primary, #35568e);
  box-shadow: 0 1px 3px rgba(4, 23, 72, 0.06);
}

/* ── 7. Footer buttons — same visual weight ──────────────── */
.drawer-footer .btn-cancel,
.drawer-footer .btn-sync {
  height: 42px;
  font-size: 0.86rem;
  border-radius: 10px;
}

.drawer-footer .btn-sync {
  background: var(--primary, #35568e);
  color: #fff;
}

.drawer-footer .btn-sync:hover {
  background: var(--primary-container, #4f6fa8);
}

/* ── 8. Add section button ────────────────────────────────── */
.btn-add-sec {
  border: 1.5px dashed var(--border-strong, rgba(4, 23, 72, 0.2));
  border-radius: 12px;
  font-size: 0.86rem;
  height: 48px;
  margin: 20px 0;
}

.btn-add-sec:hover {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
  border-color: var(--primary-container);
  border-style: solid;
}

.btn-add-sec::before {
  content: "+";
  font-weight: 400;
  font-size: 1.1rem;
}

/* Give the sticky shell a solid surface so content doesn't bleed through */
.rich-toolbar-shell {
  background: var(--surface-container-lowest, #fff);
  z-index: 4;
}

[data-theme="dark"] .rich-toolbar-shell {
  background: var(--surface-container-lowest, #131a2e);
}

/* Tighter alignment after the header */
.rich-toolbar-shell {
  top: 0;
}

/* Flatten the toolbar shell — rule instead of box */
.rich-toolbar-shell {
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  background: var(--surface-container-lowest, #ffffff);
  z-index: 5;
}

[data-theme="dark"] .rich-toolbar-shell {
  background: #131a2e;
}

/* The toolbar itself stays flat inside the opaque shell */
.rich-toolbar {
  background: transparent;
  border: none;
}

/* Flatten Media & Layout accordion */
.section-settings-panel {
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  padding: 12px 0;
}

/* Keep Page Details as a boxed control — it has form inputs inside */
/* (leave .editor-accordion.editor-meta-panel alone) */

/* ── Content section header ──────────────────────────────── */
.section-text .floating-group {
  position: relative;
  display: block;
}

.section-text .content-label-fix,
.section-text .floating-label {
  position: static !important;
  display: block;
  padding: 24px 0 6px !important;
  margin: 0 !important;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  background: transparent !important;
  transform: none !important;
  pointer-events: none;
  border: none !important;
  width: 100%;
}

.section-text .floating-group::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin: 0;
}

/* ── Media & Layout section header ───────────────────────── */
.section-settings-panel {
  border: none;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 0;
  margin-top: 24px;
  background: transparent;
}

.section-settings-panel .editor-accordion__summary {
  padding: 20px 0 16px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-settings-panel .editor-accordion__summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.12));
  border-radius: 999px;
  color: var(--outline, #747781);
  font-size: 0.9rem;
  background: transparent;
  flex-shrink: 0;
}

.section-settings-panel[open] .editor-accordion__summary::after {
  content: "−";
}

.section-settings-panel .editor-accordion__content {
  padding: 0 0 20px;
  border-top: none;
  background: transparent;
}

[data-theme="dark"] .section-settings-panel,
[data-theme="dark"] .section-text .floating-group::before {
  border-top-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .section-settings-panel .editor-accordion__summary::after {
  border-color: rgba(148, 163, 184, 0.18);
  color: #94a3b8;
}

/* Moderation inline hint — non-blocking warning */
.moderation-hint {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  background: color-mix(in srgb, var(--tertiary, #7d0bd5) 8%, transparent);
  border-left: 3px solid var(--tertiary, #7d0bd5);
  border-radius: 8px;
  color: var(--on-surface, #041748);
  font-size: 0.86rem;
  line-height: 1.5;
}

.moderation-hint.is-visible { display: flex; }

.moderation-hint i {
  color: var(--tertiary, #7d0bd5);
  font-size: 0.9rem;
  margin-top: 2px;
  flex-shrink: 0;
}

[data-theme="dark"] .moderation-hint {
  background: rgba(125, 11, 213, 0.14);
  color: #e2e8f0;
}

/* ── AI score badge on section header ──────────────────────── */
.ai-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px 0 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-container, #ebedff);
  color: var(--on-surface-variant, #434750);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  gap: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-section-badge::before {
  content: "✦";
  font-size: 0.62rem;
  opacity: 0.6;
}

.ai-section-badge::after {
  content: "";
}

/* Hide the badge when the score is 0 / unknown */
.ai-section-badge[hidden] { display: none; }
.ai-section-badge[data-score="0"] { display: none; }

.ai-section-badge:hover {
  background: var(--surface-container-high, #e3e7ff);
}

.ai-section-badge.is-good {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.ai-section-badge.is-fair {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.ai-section-badge.is-low {
  background: rgba(239, 68, 68, 0.13);
  color: #991b1b;
}

[data-theme="dark"] .ai-section-badge {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

[data-theme="dark"] .ai-section-badge.is-good {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

[data-theme="dark"] .ai-section-badge.is-fair {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

[data-theme="dark"] .ai-section-badge.is-low {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

/* Hide the badge if the section is empty */
.editor-section:not(:focus-within) .ai-section-badge[data-score="0"] {
  display: none;
}

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

.editor-section .section-header .sec-label,
.editor-section .section-header [data-editor-section-number] {
  flex: 1;
}
/* ================================================================
   Editor Drawer — Complete (Phases R7 + R7.5)
   2026-grade editor with sticky headers, live word count,
   status pills, floating AI trigger, and grouped toolbar.
   ================================================================ */

/* ══════════════════════════════════════════════════════════
   1. SHELL
   ══════════════════════════════════════════════════════════ */

.editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 720px;
  background: var(--surface-container-lowest);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -12px 0 48px rgba(4, 23, 72, 0.18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out);
  visibility: hidden;
  overflow: hidden;
}

/* ── Mobile: drawer becomes a bottom sheet ─────────────────── */
/* ================================================================
   MOBILE DRAWER & TOAST FIXES
   ================================================================ */
@media (max-width: 768px) {
  /* 1. Force the drawer to take up the full screen */
  .editor-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border-left: none !important;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .editor-drawer.is-open {
    transform: translateY(0);
  }

  /* 2. Fix the Header Layout */
  .drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 16px !important;
    background: var(--surface-container-lowest) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    flex-shrink: 0;
  }

  /* Hide Editor/Preview and 'X' on mobile */
  .drawer-header-actions {
    display: none !important; 
  }

  /* Show the Mobile Cancel Button */
  .btn-cancel-header {
    display: block !important;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 0;
    cursor: pointer;
  }

  /* Center the Title perfectly */
  .drawer-header h2 {
    flex: 1;
    text-align: center;
    margin: 0 !important;
    font-size: 1rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Add a spacer to balance the Cancel button so Title stays centered */
  .drawer-header::after {
    content: "";
    display: block;
    width: 60px; /* Approximate width of Cancel button */
  }

  /* 3. Fix the Scroll Area */
  .drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 !important;
  }

  #drawer-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Let the inner view scroll */
    padding: 0 !important;
  }

  #drawer-edit-view {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px; /* Space for footer */
    -webkit-overflow-scrolling: touch;
  }

  /* Fix the Footer */
  .drawer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: var(--surface-container-lowest);
    border-top: 1px solid var(--border-subtle);
    z-index: 50;
    display: flex;
    gap: 12px;
  }
  
  .drawer-footer .btn-cancel,
  .drawer-footer .btn-sync {
    flex: 1;
    margin: 0;
  }
}

/* ================================================================
   TOAST FIX (Fix cut-off buttons)
   ================================================================ */
.undo-toast {
  position: fixed !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: #1e293b !important;
  color: white !important;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2) !important;
  z-index: 99999 !important;
  font-size: 0.9rem !important;
  font-family: var(--font-body) !important;
  
  /* Allow wrapping so it doesn't fall off screen */
  white-space: normal !important;
  flex-wrap: wrap !important; 
  max-width: calc(100vw - 32px) !important;
}

@media (max-width: 768px) {
  .undo-toast {
    bottom: 80px !important; /* Above the mobile tab bar */
    width: calc(100% - 32px) !important;
    justify-content: space-between !important;
  }
  
  .undo-toast span {
    flex: 1 1 100%; /* Force text to its own line if needed */
    margin-bottom: 8px;
  }
}

/* Desktop adjustments for the new header structure */
@media (min-width: 769px) {
  .btn-cancel-header { display: none; }
  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.editor-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 24px 0;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   2. HEADER
   ══════════════════════════════════════════════════════════ */

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.drawer-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  margin: 0;
}

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

.drawer-view-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--surface-container-low);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 4px;
}

.drawer-view-btn {
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-default);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.drawer-view-btn.active {
  background: var(--surface-container-lowest);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(4, 23, 72, 0.08);
}

.drawer-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.drawer-close:hover {
  background: var(--surface-container-low);
  color: var(--on-surface);
}

/* ══════════════════════════════════════════════════════════
   3. FORM + VIEWS
   ══════════════════════════════════════════════════════════ */

#drawer-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 16px;
}

#drawer-edit-view,
#drawer-preview-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

#drawer-edit-view.drawer-preview-hidden,
#drawer-preview-view.drawer-preview-hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════
   4. PAGE DETAILS ACCORDION
   ══════════════════════════════════════════════════════════ */

.editor-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-container-lowest);
  overflow: hidden;
}

.editor-accordion__summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--on-surface);
  cursor: pointer;
  user-select: none;
  background: var(--surface-container-low);
}

.editor-accordion__summary::-webkit-details-marker { display: none; }

.editor-accordion__summary::after {
  content: "+";
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  font-size: 0.9rem;
}

.editor-accordion[open] .editor-accordion__summary::after {
  content: "−";
}

.editor-accordion__content {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Page Details: Community + Title side-by-side */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   5. SECTION CARD
   ══════════════════════════════════════════════════════════ */

.drawer-section-card {
  position: relative;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: 0;
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.drawer-section-card:focus-within {
  border-color: color-mix(in srgb, var(--primary-container) 40%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 12%, transparent),
              0 8px 24px rgba(4, 23, 72, 0.06);
}

/* Floating AI trigger */
.drawer-section-card::after {
  content: "✨";
  position: absolute;
  top: 56px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #ffffff;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transform: scale(0.9);
  transition: all var(--duration-base) var(--ease-spring);
  pointer-events: auto;
}

.drawer-section-card:focus-within::after,
.drawer-section-card:hover::after {
  opacity: 1;
  transform: scale(1);
}

.drawer-section-card::after:hover {
  transform: scale(1.1);
}

/* ── Section header — sticky ────────────────────────────── */
.drawer-section-card .section-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--surface-container-low) 0%, var(--surface-container-lowest) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.drawer-section-card .section-header::before {
  content: "\f58e"; /* grip-vertical */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--outline-variant);
  font-size: 0.9rem;
  cursor: grab;
  margin-right: 4px;
  transition: color var(--duration-fast) var(--ease-out);
}

.drawer-section-card .section-header:hover::before {
  color: var(--outline);
}

.drawer-section-card .sec-label {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Status pill (Ready/Draft) */
.drawer-section-card .sec-label::after {
  content: attr(data-status);
  display: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

.drawer-section-card[data-status] .sec-label::after {
  display: inline-flex;
}

.drawer-section-card[data-status="complete"] .sec-label::after {
  background: color-mix(in srgb, #10b981 18%, var(--surface-container));
  color: #047857;
}

.drawer-section-card[data-status="draft"] .sec-label::after {
  background: color-mix(in srgb, #f59e0b 18%, var(--surface-container));
  color: #92400e;
}

/* Remove section button */
.drawer-section-card .btn-remove-sec {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-default);
  border: none;
  background: transparent;
  color: var(--outline-variant);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.drawer-section-card .btn-remove-sec:hover {
  background: var(--error-container);
  color: var(--error);
}

/* ══════════════════════════════════════════════════════════
   6. SECTION BODY
   ══════════════════════════════════════════════════════════ */

.drawer-section-card .section-body {
  padding: 16px;
}

.drawer-section-card .section-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-text {
  min-width: 0;
}

.section-text .floating-group {
  position: relative;
}

/* ══════════════════════════════════════════════════════════
   7. RICH TOOLBAR
   ══════════════════════════════════════════════════════════ */

.rich-toolbar-shell {
  position: sticky;
  top: 52px;
  z-index: 4;
  margin-bottom: 0;
}

.rich-toolbar-shell summary {
  list-style: none;
  cursor: pointer;
}

.rich-toolbar-shell summary::-webkit-details-marker {
  display: none;
}

.rich-toolbar-toggle {
  display: none;   /* desktop: always visible */
}

.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface-container-low);
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.rich-toolbar::-webkit-scrollbar { display: none; }

.rich-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
}

.rich-toolbar__group-label {
  display: none;
}

.rich-toolbar .v-sep {
  width: 1px;
  height: 20px;
  background: var(--border-default);
  margin: 0 4px;
  flex-shrink: 0;
}

.rich-toolbar button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-default);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.rich-toolbar button:hover {
  background: var(--surface-container-high);
  color: var(--on-surface);
}

.rich-toolbar button.is-active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-container) 20%, transparent);
}

.rich-toolbar__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ══════════════════════════════════════════════════════════
   8. EDITOR AREA
   ══════════════════════════════════════════════════════════ */

.editor-area {
  position: relative;
  min-height: 220px;
  padding: 20px 20px 40px;
  border: none;
  border-radius: 0;
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--on-surface);
  outline: none;
  transition: background var(--duration-fast) var(--ease-out);
  overflow-y: auto;
}

.editor-area:focus {
  background: var(--surface-container-lowest);
  border: none;
  box-shadow: none;
}

.editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--outline);
  pointer-events: none;
  position: absolute;
  padding: 0;
}

/* Live word count in bottom-right */
.editor-area::after {
  content: attr(data-wordcount);
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline-variant);
  background: var(--surface-container-lowest);
  padding: 2px 6px;
  border-radius: var(--radius-default);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.editor-area:not(:empty)::after {
  opacity: 1;
}

/* Prose styles inside editor */
.editor-area p { margin: 0 0 0.8rem; }
.editor-area p:last-child { margin-bottom: 0; }
.editor-area ul,
.editor-area ol { padding-left: 24px; margin: 0.8rem 0; }
.editor-area li { margin-bottom: 4px; }
.editor-area strong,
.editor-area b { font-weight: 700; }
.editor-area em,
.editor-area i { font-style: italic; }
.editor-area u { text-decoration: underline; text-underline-offset: 2px; }

/* ══════════════════════════════════════════════════════════
   9. MEDIA & LAYOUT
   ══════════════════════════════════════════════════════════ */

.section-settings-panel {
  position: static;
  width: 100%;
  margin-top: 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  background: var(--surface-container-low);
  overflow: hidden;
}

.section-settings-panel .editor-accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--on-surface);
  list-style: none;
  background: transparent;
}

.section-settings-panel .editor-accordion__summary::-webkit-details-marker {
  display: none;
}

.section-settings-panel .editor-accordion__summary::after {
  content: "+";
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  font-size: 0.85rem;
}

.section-settings-panel[open] .editor-accordion__summary::after {
  content: "−";
}

.section-settings-panel .editor-accordion__content {
  padding: 20px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-container-lowest);
}

.section-media {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.section-media .floating-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.section-media .floating-label {
  position: static;
  display: block;
  order: -1;
  margin: 0;
  padding: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--on-surface);
}

.section-media input[type="text"],
.section-media input[type="url"],
.section-media select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--on-surface);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.section-media input[type="text"]:focus,
.section-media input[type="url"]:focus,
.section-media select:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 18%, transparent);
}

/* File input — custom-styled */
.section-media input[type="file"] {
  width: 100%;
  min-height: 76px;
  padding: 14px;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.section-media input[type="file"]:hover {
  border-color: var(--primary-container);
  background: color-mix(in srgb, var(--primary-container) 4%, var(--surface-container-lowest));
}

.section-media input[type="file"]::file-selector-button,
.section-media input[type="file"]::-webkit-file-upload-button {
  padding: 8px 14px;
  margin-right: 12px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.section-media input[type="file"]::file-selector-button:hover,
.section-media input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--primary);
  color: var(--on-primary);
}

/* Select chevron */
.section-media select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23747781' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

/* Existing image indicators */
.existing-image-loaded-row,
.existing-image-removed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-low);
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
}

.existing-image-indicator {
  color: #10b981;
  font-weight: 600;
}

.existing-image-remove-btn {
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
  border-radius: var(--radius-default);
  background: var(--error-container);
  color: var(--on-error-container);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.existing-image-remove-btn:hover {
  background: color-mix(in srgb, var(--error-container) 80%, var(--error) 20%);
}

.existing-image-removed-note {
  color: var(--on-error-container);
  font-weight: 600;
}

.existing-image-undo-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  background: var(--surface-container-lowest);
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   10. AI SUGGESTION INLINE
   ══════════════════════════════════════════════════════════ */

.ai-section-inline {
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--tertiary) 30%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--tertiary-fixed) 30%, var(--surface-container-lowest));
  overflow: hidden;
}

.ai-section-inline.hidden { display: none; }

.ai-section-inline__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tertiary);
}

.ai-section-inline__summary::-webkit-details-marker { display: none; }

.ai-section-inline__meta {
  color: var(--outline);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.ai-section-inline__list {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-item--inline {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  color: var(--on-surface);
  line-height: 1.4;
}

.suggestion-item--inline .suggestion-icon {
  color: var(--tertiary);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   11. ADD SECTION BUTTON
   ══════════════════════════════════════════════════════════ */

.btn-add-sec {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin: 12px 0;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: transparent;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.btn-add-sec::before {
  content: "\2b";
  font-size: 1.1rem;
  font-weight: 400;
}

.btn-add-sec:hover {
  background: color-mix(in srgb, var(--primary-container) 8%, transparent);
  border-color: var(--primary-container);
  border-style: solid;
  color: var(--primary);
}

.btn-add-sec:active {
  transform: scale(0.99);
}

/* ══════════════════════════════════════════════════════════
   12. FOOTER
   ══════════════════════════════════════════════════════════ */

.drawer-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 0;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--surface-container-lowest);
}

.drawer-footer .btn-cancel,
.drawer-footer .btn-sync {
  min-width: 120px;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.drawer-footer .btn-cancel {
  background: transparent;
  color: var(--on-surface-variant);
  border-color: var(--border-default);
}

.drawer-footer .btn-cancel:hover {
  background: var(--surface-container-low);
  color: var(--on-surface);
}

.drawer-footer .btn-sync {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border: none;
}

.drawer-footer .btn-sync:hover {
  background: var(--primary);
  color: var(--on-primary);
}

/* Submission error */
#drawerSubmissionError,
.submission-error-inline {
  display: block;
  padding: 12px 16px;
  margin: 12px 0 0;
  background: var(--error-container);
  border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
  border-radius: var(--radius-lg);
  color: var(--on-error-container);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
}

/* Force hidden attribute to work, even if display: block is set */
.submission-error-inline[hidden] {
  display: none !important;
}

#drawerSubmissionError::before {
  content: "⚠ ";
  font-weight: 700;
  margin-right: 4px;
}

/* ══════════════════════════════════════════════════════════
   13. DRAWER INPUTS (Community, Title)
   ══════════════════════════════════════════════════════════ */

.editor-drawer input[type="text"],
.editor-drawer input[type="email"],
.editor-drawer select,
.editor-drawer textarea {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--on-surface);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.editor-drawer textarea {
  height: auto;
  min-height: 100px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
}

.editor-drawer input:focus,
.editor-drawer select:focus,
.editor-drawer textarea:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 18%, transparent);
}

/* ══════════════════════════════════════════════════════════
   14. PREVIEW CANVAS
   ══════════════════════════════════════════════════════════ */

.drawer-preview-canvas {
  flex: 1;
  min-height: 0;
  padding: 32px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  overflow-y: auto;
}

.drawer-preview-canvas .lh-section {
  margin-bottom: 24px;
}

.drawer-preview-canvas h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.drawer-preview-canvas .preview-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
  margin: 0 0 16px;
}

.drawer-preview-canvas .preview-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0 24px;
}

/* ══════════════════════════════════════════════════════════
   15. MOBILE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .editor-drawer {
    max-width: 100%;
  }

  .drawer-inner {
    padding: 16px 16px 0;
  }

  .drawer-section-card::after {
    display: none;
  }

  .rich-toolbar-shell {
    position: static;
  }

  .rich-toolbar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface-container-low);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--on-surface);
  }

  .rich-toolbar-toggle__lead {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .rich-toolbar-toggle__meta {
    font-size: 0.7rem;
    color: var(--outline);
    font-weight: 500;
  }

  .rich-toolbar-shell:not([open]) .rich-toolbar {
    display: none;
  }

  .rich-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .rich-toolbar__group {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .rich-toolbar .v-sep { display: none; }

  .drawer-section-card .section-body {
    padding: 14px;
  }

  .editor-area {
    min-height: 180px;
    padding: 16px 16px 36px;
    font-size: 0.9rem;
  }

  .section-settings-panel {
    margin-top: 0;
  }

  .section-media {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════
   16. REDUCED MOTION
   ══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .editor-drawer { transition: none; }
  .drawer-section-card::after,
  .drawer-section-card .section-header::before { transition: none; }
}

/* ================================================================
   FLAT EDITOR CANVAS (2027 Redesign)
   ================================================================ */

/* Clean up the section card */
.drawer-section-card {
  border: 1px solid var(--border-default);
  border-radius: 16px;
  margin-bottom: 24px;
  background: var(--surface-container-lowest);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.drawer-section-card:focus-within {
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border-color: var(--primary-container);
}

/* Section Header */
.drawer-section-card .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-section-card .sec-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  letter-spacing: 0.05em;
}

/* Prominent Trash Icon */
.drawer-section-card .btn-remove-sec {
  color: var(--error);
  opacity: 0.6;
  transition: all 0.2s ease;
  padding: 4px;
  font-size: 1.1rem;
}
.drawer-section-card .btn-remove-sec:hover {
  opacity: 1;
  background: var(--error-container);
  border-radius: 6px;
}

/* Sticky Toolbar */
.rich-toolbar-shell {
  position: sticky;
  top: -1px; /* Stick to top of scrolling container */
  z-index: 10;
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--border-subtle);
}
.rich-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rich-toolbar::-webkit-scrollbar { display: none; }
.rich-toolbar button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  color: var(--on-surface-variant);
  border: none;
}
.rich-toolbar button:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* Editor Body */
.drawer-section-card .section-body {
  display: flex;
  flex-direction: column;
}

/* Text Area */
.drawer-section-card .editor-area {
  min-height: 200px;
  padding: 16px;
  font-size: 1rem;
  line-height: 1.6;
  outline: none;
  background: transparent;
}

/* Exposed Media Area */
.section-media {
  padding: 16px;
  background: var(--surface-container-lowest);
  border-top: 1px dashed var(--border-default);
}

.media-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* YouTube Input redesign */
.video-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-container-low);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 14px;
  height: 48px;
}
.video-input-wrapper i {
  color: #ff0000; /* YouTube Red */
  font-size: 1.2rem;
}
.video-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  color: var(--on-surface);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .drawer-section-card {
    margin-bottom: 16px;
    border-radius: 12px;
  }
  
  .drawer-section-card .editor-area {
    min-height: 150px;
    padding: 16px;
    font-size: 16px; /* Prevents iOS Zoom */
  }

  /* Force image picker items to be larger on touch devices */
  .image-picker__strip {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  .image-picker__item {
    aspect-ratio: 1;
  }
}

/* Section Controls */
.section-controls .btn-move {
  background: transparent;
  border: none;
  color: var(--outline);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
}
.section-controls .btn-move:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* Undo Toast */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 99999;
  font-size: 0.9rem;
  transition: opacity 0.3s ease;
}
.undo-toast button {
  background: transparent;
  border: none;
  color: #93c5fd;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.undo-toast.fade-out { opacity: 0; }

.undo-toast {
  position: fixed !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: #1e293b !important;
  color: white !important;
  padding: 12px 20px !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2) !important;
  z-index: 99999 !important;
  font-size: 0.9rem !important;
  font-family: var(--font-body) !important;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .undo-toast {
    bottom: 80px !important; /* Pushes it above the mobile bottom tab bar */
    width: calc(100% - 32px) !important;
    justify-content: space-between !important;
  }
}

/* ================================================================
   FINAL FORCE OVERRIDE FOR MOBILE DRAWER
   ================================================================ */
@media screen and (max-width: 768px) {
  /* Force full screen */
  #editor-panel.editor-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    box-shadow: none !important;
    z-index: 99999 !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  #editor-panel.editor-drawer.is-open {
    transform: translateY(0) !important;
  }

  /* Hide the desktop header actions (Editor/Preview/X) */
  #editor-panel .drawer-header-actions {
    display: none !important;
  }

  /* Show the Cancel button */
  #editor-panel .btn-cancel-header {
    display: block !important;
    background: transparent !important;
    border: none !important;
    color: var(--primary) !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 0 !important;
  }

  /* Format the header */
  #editor-panel .drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px !important;
    background: var(--surface-container-lowest) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    margin: 0 !important;
  }

  #editor-panel .drawer-header h2 {
    font-size: 1rem !important;
    margin: 0 !important;
    text-align: center !important;
    flex: 1 !important;
  }

  /* Spacer to keep title centered */
  #editor-panel .drawer-header::after {
    content: "";
    display: block;
    width: 60px;
  }

  /* Fix scrolling areas */
  #editor-panel .drawer-inner {
    padding: 0 !important;
    height: 100% !important;
  }

  #editor-panel #drawer-form {
    padding: 0 !important;
    height: calc(100dvh - 65px) !important; /* Subtract header height */
    overflow-y: auto !important;
  }
  
  #editor-panel #drawer-edit-view {
    padding: 16px !important;
    padding-bottom: 100px !important;
  }

  /* Sticky Footer */
  #editor-panel .drawer-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--surface-container-lowest) !important;
    padding: 16px !important;
    border-top: 1px solid var(--border-subtle) !important;
    z-index: 100000 !important;
    display: flex !important;
    gap: 12px !important;
  }

  #editor-panel .drawer-footer .btn-sync,
  #editor-panel .drawer-footer .btn-cancel {
    flex: 1 !important;
    margin: 0 !important;
    height: 44px !important;
  }

    /* Make the footer buttons look native and touch-friendly */
  #editor-panel .drawer-footer .btn-sync {
    background: var(--primary, #35568e) !important;
    color: white !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    border: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
  }

  #editor-panel .drawer-footer .btn-cancel {
    background: transparent !important;
    color: var(--on-surface-variant, #475569) !important;
    border: 1px solid var(--border-default, #cbd5e1) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
  }
}

/* ================================================================
   FINAL MOBILE FOOTER OVERRIDE (Force side-by-side)
   ================================================================ */
@media screen and (max-width: 768px) {
  #editor-panel .drawer-footer {
    display: flex !important;
    flex-direction: row !important; 
    flex-wrap: nowrap !important; /* Prevents them from wrapping to the next line */
    justify-content: space-between !important;
    align-items: center !important;
    padding: 16px !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 12px !important;
    background: var(--surface-container-lowest) !important;
    border-top: 1px solid var(--border-subtle) !important;
    width: 100% !important;
  }

  #editor-panel .drawer-footer .btn-cancel,
  #editor-panel .drawer-footer .btn-sync {
    flex: 1 1 50% !important; /* Forces each to take exactly 50% */
    width: 50% !important; 
    max-width: 50% !important;
    height: 48px !important; 
    margin: 0 !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
}
/* ================================================================
   Editorial Layout Primitives
   Replaces generic card layouts with four named regions:
     1. .ed-hero       — loud typographic moment
     2. .ed-data       — number + label + context (data-as-design)
     3. .ed-list       — rows separated by rules, not borders
     4. .ed-inline     — text and links, no chrome
   ================================================================ */

/* ── Rules ─────────────────────────────────────────────────── */
.ed-rule {
  height: 1px;
  background: var(--border-subtle, rgba(4, 23, 72, 0.08));
  border: none;
  margin: 0;
}

/* ── 1. HERO ──────────────────────────────────────────────── */
.ed-hero {
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 40px;
}

.ed-hero__eyebrow {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ed-hero__eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--outline-variant, #c4c6d1);
}

.ed-hero__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--on-surface, #041748);
  margin: 0 0 16px;
  max-width: 18ch;
}

.ed-hero__subtitle {
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--on-surface-variant, #434750);
  margin: 0;
  max-width: 56ch;
}

/* ── 2. DATA BLOCK ────────────────────────────────────────── */
.ed-data-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0;
  margin-bottom: 48px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.ed-data {
  padding: 28px 24px 28px 0;
  border-right: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ed-data:last-child {
  border-right: none;
}

.ed-data:not(:first-child) {
  padding-left: 24px;
}

.ed-data__label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.ed-data__value {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(2.5rem, 4vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--on-surface, #041748);
  font-feature-settings: "tnum" 1;
}

.ed-data__context {
  font-size: 0.82rem;
  color: var(--on-surface-variant, #434750);
  line-height: 1.4;
  margin-top: 4px;
}

.ed-data__trend {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 600;
  color: #047857;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.ed-data__trend--flat { color: var(--outline, #747781); }
.ed-data__trend--down { color: var(--error, #ba1a1a); }

/* ── 3. LIST ──────────────────────────────────────────────── */
.ed-section {
  margin-bottom: 48px;
}

.ed-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.ed-section__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--on-surface, #041748);
  margin: 0;
}

.ed-section__link {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary, #35568e);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.ed-section__link:hover { opacity: 0.7; }

.ed-list {
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-top: 16px;
}

.ed-list__row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  text-decoration: none;
  color: inherit;
  transition: padding-left 0.15s ease, background 0.15s ease;
}

.ed-list__row:hover {
  padding-left: 12px;
  background: color-mix(in srgb, var(--primary) 3%, transparent);
}

.ed-list__index {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--outline-variant, #c4c6d1);
  min-width: 24px;
  flex-shrink: 0;
}

.ed-list__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ed-list__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--on-surface, #041748);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-list__meta {
  font-size: 0.8rem;
  color: var(--on-surface-variant, #434750);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ed-list__meta-sep {
  color: var(--outline-variant, #c4c6d1);
}

.ed-list__value {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-surface, #041748);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.ed-list__arrow {
  color: var(--outline-variant, #c4c6d1);
  font-size: 0.72rem;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ed-list__row:hover .ed-list__arrow {
  color: var(--primary, #35568e);
  transform: translateX(3px);
}

/* ── 4. INLINE ACTIONS ────────────────────────────────────── */
.ed-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 20px 0;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.ed-inline__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--on-surface-variant, #434750);
  text-decoration: none;
  transition: color 0.15s ease;
  position: relative;
}

.ed-inline__action::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ed-inline__action:hover {
  color: var(--primary, #35568e);
}

.ed-inline__action:hover::after {
  opacity: 0.3;
  transform: translateY(0);
}

.ed-inline__action i {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── Two-column layout for editorial sections ─────────────── */
.ed-columns {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 900px) {
  .ed-columns {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .ed-data-grid {
    grid-template-columns: 1fr;
    border: none;
    border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  }
  .ed-data {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
    padding: 20px 0;
  }
  .ed-data:not(:first-child) {
    padding-left: 0;
  }
  .ed-data:last-child { border-bottom: none; }
}

/* ── Error & empty state pages — editorial ────────────────── */
.ed-error {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 0 80px;
}

.ed-error__hero {
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 40px;
}

.ed-error__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  margin-bottom: 16px;
}

.ed-error__eyebrow-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}

.ed-error__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--on-surface, #041748);
  margin: 0 0 20px;
  max-width: 22ch;
}

.ed-error__subtitle,
.ed-error__body {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--on-surface-variant, #434750);
  margin: 0 0 12px;
  max-width: 60ch;
}

.ed-error__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.ed-error__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  background: transparent;
  color: var(--on-surface, #041748);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ed-error__btn:hover {
  background: var(--surface-container-low, #f3f3ff);
  border-color: var(--border-strong, rgba(4, 23, 72, 0.2));
  color: var(--on-surface, #041748);
}

.ed-error__btn--primary {
  background: var(--primary, #35568e);
  color: #fff;
  border-color: transparent;
}

.ed-error__btn--primary:hover {
  background: var(--primary-container, #4f6fa8);
  color: #fff;
  border-color: transparent;
}

/* List sections */
.ed-error__list {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.ed-error__list:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.ed-error__list-header {
  margin-bottom: 16px;
}

.ed-error__list-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.ed-error__list-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ed-error__list-items li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--on-surface-variant, #434750);
}

.ed-error__list-items li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--outline-variant, #c4c6d1);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}

/* Link rows */
.ed-error__link-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ed-error__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
  color: var(--on-surface, #041748);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  transition: padding-left 0.15s ease, color 0.15s ease;
}

.ed-error__link:hover {
  padding-left: 8px;
  color: var(--primary, #35568e);
}

.ed-error__link i {
  color: var(--outline-variant, #c4c6d1);
  font-size: 0.78rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ed-error__link:hover i {
  color: var(--primary, #35568e);
  transform: translateX(3px);
}

/* Submission ID panel */
.submission-id-panel {
  margin: 20px 0 0;
  padding: 16px;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  border-left: 3px solid var(--primary, #35568e);
  border-radius: 8px;
}

.submission-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.submission-id-code {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.1));
  border-radius: 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--on-surface, #041748);
  overflow-x: auto;
  white-space: nowrap;
}

.btn-copy-id {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary, #35568e);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-copy-id:hover { background: var(--primary-container, #4f6fa8); }

.submission-id-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--on-surface-variant, #434750);
}

/* Dark mode */
[data-theme="dark"] .ed-error__title { color: #e2e8f0; }
[data-theme="dark"] .ed-error__subtitle,
[data-theme="dark"] .ed-error__body,
[data-theme="dark"] .ed-error__list-items li,
[data-theme="dark"] .ed-error__link { color: #cbd5e1; }
[data-theme="dark"] .ed-error__link { border-bottom-color: rgba(148, 163, 184, 0.08); }
[data-theme="dark"] .ed-error__link:hover { color: #93c5fd; }
[data-theme="dark"] .ed-error__link:hover i { color: #93c5fd; }
[data-theme="dark"] .ed-error__hero,
[data-theme="dark"] .ed-error__list { border-color: rgba(148, 163, 184, 0.12); }

/* ── Sticky footer shell ──────────────────────────────────── */
html, body { min-height: 100%; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-shell {
  flex: 1 0 auto;
  display: block;
  width: 100%;
}

.site-footer {
  flex-shrink: 0;
}

/* Mobile: keep the tab bar above the footer */
@media (max-width: 768px) {
  .site-footer {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Data block accent tints (subtle, per column) */
.ed-data-grid .ed-data:nth-child(1) {
  --data-accent: #b45309;
  --data-accent-soft: rgba(180, 83, 9, 0.06);
}
.ed-data-grid .ed-data:nth-child(2) {
  --data-accent: #0369a1;
  --data-accent-soft: rgba(3, 105, 161, 0.06);
}
.ed-data-grid .ed-data:nth-child(3) {
  --data-accent: #86198f;
  --data-accent-soft: rgba(134, 25, 143, 0.06);
}

.ed-data {
  position: relative;
}

.ed-data::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--data-accent, var(--primary));
  opacity: 0.75;
  border-radius: 0 0 2px 2px;
}

.ed-data__value {
  color: var(--data-accent, var(--on-surface));
}

[data-theme="dark"] .ed-data::before {
  opacity: 0.55;
}

.ed-list__thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface-container-low, #f3f3ff);
  color: var(--on-surface-variant, #434750);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-right: 14px;
}

.ed-list__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ed-list__thumb i {
  font-size: 0.9rem;
  opacity: 0.7;
}

[data-theme="dark"] .ed-list__thumb {
  background: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
}

.ed-list__monogram {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-soft, var(--surface-container-low, #f3f3ff));
  color: var(--accent, var(--primary, #35568e));
  display: grid;
  place-items: center;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-right: 14px;
}

.ed-hero {
  position: relative;
}

.ed-hero::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(53, 86, 142, 0.08) 0%,
    rgba(53, 86, 142, 0.03) 40%,
    transparent 70%);
  pointer-events: none;
  z-index: -1;
}

[data-theme="dark"] .ed-hero::after {
  background: radial-gradient(circle,
    rgba(147, 197, 253, 0.06) 0%,
    rgba(147, 197, 253, 0.02) 40%,
    transparent 70%);
}

/* ── Overflow safety ──────────────────────────────────────── */
.dashboard-ed,
.ed-hero,
.ed-data-grid,
.ed-columns,
.ed-featured,
.ed-value,
.ed-inline {
  max-width: 100%;
  overflow-x: clip;
}

/* Belt-and-braces: kill horizontal scroll at the shell level */
.app-shell,
.main-content {
  overflow-x: clip;
  max-width: 100%;
}
/* ================================================================
   Empty States — category-tinted placeholders
   Uses new design tokens from tokens.css
   ================================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 180px;
  padding: 24px;
  border-radius: var(--radius-xl);
  text-align: center;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--category-accent, var(--primary)) 8%, var(--surface-container-low)),
    color-mix(in srgb, var(--category-accent, var(--primary)) 3%, var(--surface-container-low)));
  border: 1px dashed color-mix(in srgb, var(--category-accent, var(--primary)) 28%, transparent);
  transition: background var(--duration-base) var(--ease-out);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  font-size: 1.6rem;
  color: var(--category-accent, var(--primary));
  background: color-mix(in srgb, var(--category-accent, var(--primary)) 12%, var(--surface-container-lowest));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--category-accent, var(--primary)) 18%, transparent);
  animation: emptyFloat 3s ease-in-out infinite;
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.empty-state__label {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--on-surface);
}

.empty-state__hint {
  color: var(--on-surface-variant);
  font-size: 0.78rem;
  font-weight: 500;
}

/* Category accents */
.empty-state[data-category="Food"]           { --category-accent: #ec4899; }
.empty-state[data-category="Parking"]        { --category-accent: #f59e0b; }
.empty-state[data-category="Rentals"]        { --category-accent: #10b981; }
.empty-state[data-category="Services"]       { --category-accent: #3b82f6; }
.empty-state[data-category="Items for Sale"] { --category-accent: #8b5cf6; }
.empty-state[data-category="General"]        { --category-accent: #64748b; }

/* Inline (used inside wiki content) */
.empty-state.empty-state--inline {
  width: 100%;
  max-width: 100%;
  min-height: 120px;
  padding: 16px;
  border-radius: var(--radius-xl);
  margin: 12px 0;
}

.empty-state.empty-state--inline .empty-state__icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}

.empty-state.empty-state--inline .empty-state__label {
  font-size: 0.8rem;
}

@media (prefers-reduced-motion: reduce) {
  .empty-state__icon { animation: none; }
}
/* ================================================================
   Footer — aligned with main content column
   ================================================================ */

.site-footer {
  margin-left: 256px;
  /* padding: 0 32px 32px; */
  margin-top: 16px;
  background: transparent;
  border-top: none;
}

.footer-inner {
  /* max-width: 1240px; */
  margin: 0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--surface-container-low);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
}

/* ── Logo ───────────────────────────────────────────────── */
.footer-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-image,
.logo-image--footer {
  display: block;
  height: 26px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

/* ── Share links ────────────────────────────────────────── */
.footer-share-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-share-links a {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all var(--duration-fast) var(--ease-out);
}

.footer-share-links a:hover {
  background: var(--primary-container);
  border-color: var(--primary-container);
  color: var(--on-primary-container);
  transform: translateY(-1px);
}

/* ── Nav links ──────────────────────────────────────────── */
.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 24px;
}

.footer-links a {
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-links a:hover {
  color: var(--primary);
}

/* ── Copyright ──────────────────────────────────────────── */
.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-footer {
    margin-left: 0;
    padding: 0 16px 24px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 16px;
  }

  .footer-links {
    gap: 20px;
  }

  .logo-image--footer {
    height: 22px;
  }
}

/* Ensure Font Awesome brand glyphs render in footer share row */
.footer-share-links a i,
.footer-share-links a .fa-brands,
.footer-share-links a .fa-solid {
  font-family: "Font Awesome 6 Brands", "Font Awesome 6 Free" !important;
  font-style: normal;
  font-weight: 900;
  display: inline-block;
  line-height: 1;
}

/* Fix blank X icon on FA6 — allow alias fallback */
.footer-share-links a i.fa-x-twitter::before {
  content: "\e61b"; /* x-twitter glyph */
}

.logo-image--footer {
  height: 32px;    /* was 26px — new wordmark is taller */
  max-width: 240px;
}

@media (max-width: 768px) {
  .logo-image--footer { height: 26px; }
}
/* ================================================================
   Form Polish — counters, chips, modals, locked fields
   Uses new design tokens from tokens.css
   ================================================================ */

/* ── Character counters ────────────────────────────────── */
.char-count {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--on-surface-variant);
  text-align: right;
  transition: color var(--duration-fast) var(--ease-out);
  min-height: 1em;
}

.char-count.is-warn { color: #f59e0b; }
.char-count.is-over { color: var(--error); font-weight: 700; }

/* ── Locked fields ─────────────────────────────────────── */
.field-locked,
.condo-input-locked {
  position: relative;
  background: var(--surface-container-low) !important;
  cursor: not-allowed !important;
  color: var(--on-surface-variant) !important;
  padding-right: 40px !important;
  border-color: var(--outline-variant) !important;
}

.field-locked::after {
  content: "\f023";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--outline);
  font-size: 0.85rem;
  pointer-events: none;
}

.field-locked-helper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline);
}

/* ── AI suggestion chip ───────────────────────────────── */
.ai-suggestion-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  font-size: 0.82rem;
  color: #78350f;
  animation: chipSlideDown 0.3s var(--ease-out);
}

@keyframes chipSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-suggestion-chip__icon { font-size: 1rem; }
.ai-suggestion-chip__text { flex: 1; line-height: 1.35; }

.ai-suggestion-chip__apply {
  border: 1px solid #d97706;
  background: var(--surface-container-lowest);
  color: #92400e;
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.ai-suggestion-chip__apply:hover { background: #fef3c7; }

.ai-suggestion-chip__dismiss {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #b45309;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* ── Success modal ────────────────────────────────────── */
.success-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 23, 72, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modalFadeIn 0.2s var(--ease-out);
}

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

.success-modal-card {
  width: min(92vw, 460px);
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: modalPopIn 0.4s var(--ease-spring);
}

@keyframes modalPopIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-modal-card__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #10b981, #059669);
  color: var(--on-primary);
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.success-modal-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--on-surface);
}

.success-modal-card p {
  margin: 0 0 16px;
  color: var(--on-surface-variant);
  font-size: 0.94rem;
  line-height: 1.5;
}

.success-modal-card__id {
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 16px;
  background: var(--surface-container-low);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--on-surface-variant);
}

.success-modal-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.success-modal-card__actions > * {
  flex: 1;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.success-modal-card__actions .btn-secondary {
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  border: 1px solid var(--border-default);
}

.success-modal-card__actions .btn-primary {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border: none;
  box-shadow: var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  .success-modal-card,
  .success-modal-card__icon,
  .success-modal-overlay,
  .ai-suggestion-chip { animation: none; }
}

/* Fix Toolbar Alignment */
.editor-toolbar {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}
#btn-ai-format {
  margin-left: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
/* ================================================================
   Header — Matches Stitch reference
   ================================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 64px;
  background: rgba(250, 248, 255, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.header-inner {
  height: 100%;
  max-width: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── LEFT: Brand ──────────────────────────────────────── */
.header-left {
  display: flex;
  align-items: center;
  min-width: 240px;
}

.header-brand {
  display: flex;
  align-items: center; 
  gap: 10px;
  text-decoration: none;
}

.header-brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
  transform: translateY(-2px); 
}

.header-brand-name {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--on-surface, #041748);
  white-space: nowrap;
}

/* Hide the long name on narrow viewports */
@media (max-width: 1100px) {
  .header-brand-name { font-size: 0.95rem; }
}

@media (max-width: 768px) {
  .header-brand-name { display: none; }
  .header-brand-version { display: none; }
}

.header-brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--on-surface);
}

.header-brand-version {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 0.875rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── CENTER: Search ───────────────────────────────────── */
.header-center {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 18px;
  min-height: 40px;
  background: var(--surface-container-low);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
  text-align: left;
}

.header-search:hover {
  background: var(--surface-container);
}

.header-search > i {
  color: var(--outline);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.header-search__text {
  flex: 1;
  font-family: var(--font-editorial);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0;
  color: var(--outline);
}

.header-search__kbd {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 0.875rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--surface);
  color: var(--on-surface-variant);
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── RIGHT: Actions ───────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Community switcher */
.header-community {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast) var(--ease-out);
}

.header-community:hover { background: var(--surface-container); }

.header-community__select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--on-surface);
  cursor: pointer;
  padding-right: 18px;
}

.header-community__chevron {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--outline);
  font-size: 0.7rem;
  pointer-events: none;
}

/* Icon buttons */
.header-icon-btn {
   width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-icon-btn:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

/* Contribute button */
.header-contribute {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(226, 30, 73, 0.18);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.header-contribute:hover {
  opacity: 0.95;
  color: var(--on-secondary-container);
}

.header-contribute:active {
  transform: scale(0.98);
}

.header-contribute i {
  font-size: 0.85rem;
}

/* Avatar */
.header-brand-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-container), var(--tertiary-container));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-container);
  color: var(--on-surface);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.header-avatar:hover {
  transform: scale(1.05);
  color: var(--on-surface);
}

/* Hide mobile toggle on desktop — re-enable in media query */
.mobile-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--surface-container-low);
  color: var(--on-surface);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1100px) {
  .header-search__text { display: none; }
  .header-community { display: none; }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .header-left { min-width: 0; }
  .header-brand-name { font-size: 1rem; }
  .header-brand-version { display: none; }
  .header-contribute span { display: none; }
  .header-contribute { padding: 6px 10px; }
  .header-icon-btn { display: none; }
  .mobile-menu-toggle { display: inline-flex; }
}

/* ── Header avatars ────────────────────────────────────── */
.header-brand-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-container), var(--tertiary-container));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-container);
  color: var(--on-surface);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-spring);
  flex-shrink: 0;
}

.header-user-avatar:hover {
  transform: scale(1.05);
  color: var(--on-surface);
}

/* Hide ⌘K hint on touch devices */
@media (hover: none) and (pointer: coarse) {
  .header-search__kbd { display: none; }
}

@media (max-width: 768px) {
  .header-contribute {
    display: none !important; /* The bottom tab bar handles this */
  }
  .header-search__kbd {
    display: none !important; /* Hide ⌘K on touch devices */
  }
}
/* ================================================================
   Image Picker — mobile-first image upload + alignment
   ================================================================ */

.image-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.image-picker__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}
.image-picker__add:hover,
.image-picker__add:focus-visible {
  border-color: var(--primary-container);
  background: color-mix(in srgb, var(--primary-container) 6%, var(--surface-container-low));
  color: var(--primary);
  outline: none;
}
.image-picker__add i { font-size: 1rem; }

/* Thumbnails */
.image-picker__strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.image-picker__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-container);
  border: 2px solid transparent;
  transition: border-color 0.15s var(--ease-out);
}
.image-picker__item[data-align="left"]   { border-color: rgba(59, 130, 246, 0.35); }
.image-picker__item[data-align="center"] { border-color: rgba(16, 185, 129, 0.35); }
.image-picker__item[data-align="right"]  { border-color: rgba(245, 158, 11, 0.35); }

.image-picker__thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.image-picker__menu {
  position: absolute;
  top: 6px; right: 6px;
  width: 32px; height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.15s var(--ease-out);
}
.image-picker__menu:hover {
  background: rgba(15, 23, 42, 0.88);
  transform: scale(1.08);
}

/* Bottom sheet / modal */
.image-sheet {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.image-sheet.is-open { display: flex; }

.image-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 23, 72, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: imageSheetFade 0.18s var(--ease-out);
}
@keyframes imageSheetFade { from { opacity: 0; } to { opacity: 1; } }

.image-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 8px 16px max(16px, env(safe-area-inset-bottom)) 16px;
  box-shadow: 0 -8px 32px rgba(4, 23, 72, 0.18);
  animation: imageSheetUp 0.24s var(--ease-spring);
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes imageSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.image-sheet__handle {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--outline-variant);
  margin: 6px auto 12px;
}

.image-sheet__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
  margin: 4px 0 16px;
  letter-spacing: -0.01em;
}

/* Source options */
.image-source__option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-lg);
  color: var(--on-surface);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s var(--ease-out);
}
.image-source__option:hover,
.image-source__option:focus-visible {
  background: var(--surface-container-low);
  outline: none;
}
.image-source__option i {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
}
.image-source__option[data-source="camera"] i  { background: rgba(59,130,246,.12); color: #2563eb; }
.image-source__option[data-source="library"] i { background: rgba(168,85,247,.12); color: #7c3aed; }
.image-source__option[data-source="files"] i   { background: rgba(100,116,139,.14); color: #475569; }

.image-source__cancel {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--on-surface-variant);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.image-source__cancel:hover { background: var(--surface-container-low); }

/* Edit sheet */
.image-edit__preview {
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-container);
  margin-bottom: 16px;
}
.image-edit__preview img {
  width: 100%; height: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.image-edit__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
}
.image-edit__row:first-of-type { border-top: none; }
.image-edit__row label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
}
.image-edit__row input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--on-surface);
}
.image-edit__row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-container) 16%, transparent);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
}
.segmented__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px;
  border: none;
  border-radius: calc(var(--radius-lg) - 2px);
  background: transparent;
  color: var(--on-surface-variant);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}
.segmented__btn i { font-size: 0.9rem; }
.segmented__btn[aria-checked="true"] {
  background: var(--surface-container-lowest);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(4, 23, 72, 0.08);
}

.image-edit__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.image-edit__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s var(--ease-out);
}
.image-edit__actions button:hover:not(:disabled) { background: var(--surface-container-low); }
.image-edit__actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.image-edit__actions .is-danger {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--error) 30%, transparent);
  color: var(--error);
}
.image-edit__actions .is-danger:hover { background: var(--error-container); }

/* Lightbox */
.image-picker-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 23, 72, 0.92);
}
.image-picker-lightbox.is-open { display: flex; }
.image-picker-lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
}
.image-picker-lightbox__close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px; height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid; place-items: center;
}

/* Desktop tweaks */
@media (min-width: 768px) {
  .image-picker__strip { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .image-sheet { align-items: center; }
  .image-sheet__panel {
    border-radius: var(--radius-2xl);
    padding: 12px 20px 20px;
    max-width: 480px;
    animation: imageSheetPop 0.2s var(--ease-spring);
  }
  @keyframes imageSheetPop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-sheet__backdrop,
  .image-sheet__panel { animation: none; }
}
/* ================================================================
   Marketplace — Editorial overrides
   Flattens cards, tightens typography, editorializes the hero.
   Loaded after marketplace-v2.css.
   ================================================================ */

/* ══════════════════════════════════════════════════════════════
   1. HERO — two-column on desktop, stacked on mobile
   ══════════════════════════════════════════════════════════════ */

.mp-hero-v2 {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-rows: auto auto;
  column-gap: 48px;
  row-gap: 12px;
  align-items: end;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 32px;
  position: relative;
}

/* ── Hero eyebrow with rule — real element, no pseudo ────── */
.mp-hero-v2__eyebrow {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  align-self: end;
}

.mp-hero-v2__eyebrow-rule {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--outline-variant, #c4c6d1);
  flex-shrink: 0;
}

/* Title — left column, second row */
.mp-hero-v2 h1 {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--on-surface, #041748);
  margin: 0;
  max-width: 14ch;
}

/* Description — right column, first row */
.mp-hero-v2 p {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--on-surface-variant, #434750);
  margin: 0;
  max-width: 52ch;
  align-self: end;
}

/* Actions — right column, second row */
.mp-hero-actions {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-self: end;
  margin-top: 8px;
}

/* ── Mobile: single column, stacked ─────────────────────── */
@media (max-width: 899px) {
  .mp-hero-v2 {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    row-gap: 10px;
    padding: 24px 0 20px;
    margin-bottom: 24px;
  }

  .mp-hero-v2__eyebrow {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
  }

  .mp-hero-v2::after {
    top: 32px;
  }

  .mp-hero-v2 h1 {
    grid-column: 1;
    grid-row: 2;
    font-size: 1.85rem;
    max-width: 16ch;
  }

  .mp-hero-v2 p {
    grid-column: 1;
    grid-row: 3;
    font-size: 0.94rem;
    align-self: start;
  }

  .mp-hero-actions {
    grid-column: 1;
    grid-row: 4;
    margin-top: 6px;
    align-self: start;
  }
}

@media (max-width: 480px) {
  .mp-hero-v2 h1 {
    font-size: 1.65rem;
  }
}

/* ── Hero buttons ──────────────────────────────────────────── */
.mp-btn {
  border-radius: 10px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ══════════════════════════════════════════════════════════════
   2. FILTER ROW — buttons instead of pills
   ══════════════════════════════════════════════════════════════ */

.mp-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 4px;
}

.mp-pill-v2 {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--on-surface-variant, #434750);
  position: relative;
  transition: color 0.15s ease;
}

.mp-pill-v2::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.mp-pill-v2:hover {
  color: var(--on-surface, #041748);
}

.mp-pill-v2:hover::after {
  opacity: 0.3;
  transform: translateY(0);
}

.mp-pill-v2.active {
  background: transparent;
  color: var(--primary, #35568e);
  font-weight: 600;
}

.mp-pill-v2.active::after {
  opacity: 1;
  transform: translateY(0);
  background: var(--primary, #35568e);
}

.mp-pill-v2 small {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  opacity: 0.6;
  margin-left: 4px;
}

/* ══════════════════════════════════════════════════════════════
   3. CATEGORY ROW — inline, subtle
   ══════════════════════════════════════════════════════════════ */

.mp-category-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.mp-category-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.mp-category-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.mp-category-link {
  font-size: 0.85rem;
  color: var(--on-surface-variant, #434750);
  position: relative;
  transition: color 0.15s ease;
}

.mp-category-link:hover {
  color: var(--on-surface, #041748);
}

.mp-category-link.active {
  color: var(--primary, #35568e);
  font-weight: 600;
}

.mp-category-link.active::after {
  content: none;
}

/* ══════════════════════════════════════════════════════════════
   4. GRID + CARDS — flatten
   ══════════════════════════════════════════════════════════════ */

.mp-grid-v2 {
  gap: 32px 24px;
}

.mp-card-v2 {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.mp-card-v2:hover {
  transform: none;
  box-shadow: none;
}

.mp-card-v2__media {
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-container-low, #f3f3ff);
  aspect-ratio: 4 / 3;
  margin-bottom: 14px;
  transition: opacity 0.15s ease;
}

.mp-card-v2:hover .mp-card-v2__media {
  opacity: 0.92;
}

.mp-card-v2__media img {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mp-card-v2:hover .mp-card-v2__media img {
  transform: scale(1.03);
}

.mp-card-v2__body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-card-v2__category {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  margin-bottom: 2px;
}

.mp-card-v2__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--on-surface, #041748);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mp-card-v2__meta {
  font-size: 0.8rem;
  color: var(--on-surface-variant, #434750);
  margin: 0;
}

.mp-card-v2__price {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--on-surface, #041748);
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mp-card-v2__price span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--outline, #747781);
  letter-spacing: 0;
}

.mp-card-v2__heart {
  background: rgba(255, 255, 255, 0.94);
  color: var(--on-surface-variant, #434750);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, color 0.15s ease;
}

.mp-card-v2__heart.is-saved {
  color: #e21e49;
}

.mp-badge {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.66rem;
  padding: 4px 8px;
}

.mp-empty-v2 {
  border: none;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: 0;
  background: transparent;
  padding: 64px 24px;
}

/* ══════════════════════════════════════════════════════════════
   5. MOBILE TWEAKS — filters, categories, grid, cards
   (Hero is handled above. Nothing here should re-declare it.)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .mp-btn {
    height: 42px;
    padding: 0 16px;
    font-size: 0.84rem;
  }

  .mp-filter-row {
    gap: 2px 14px;
    padding: 12px 0;
  }

  .mp-pill-v2 {
    font-size: 0.82rem;
  }

  .mp-category-row {
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 24px;
  }

  .mp-category-links {
    gap: 14px;
  }

  .mp-category-link {
    font-size: 0.82rem;
  }

  .mp-grid-v2 {
    gap: 20px 16px;
  }

  .mp-card-v2__title {
    font-size: 0.98rem;
  }

  .mp-card-v2__price {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .mp-filter-row {
    gap: 2px 10px;
  }

  .mp-pill-v2 {
    font-size: 0.78rem;
  }

  .mp-category-links {
    gap: 12px;
  }

  .mp-category-link {
    font-size: 0.78rem;
  }
}
/* ================================================================
   Marketplace v2 — Editorial grid, pill filters, verified badges
   ================================================================ */

.mp-shell-v2 {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

/* Breadcrumb */
.mp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--outline);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.mp-breadcrumb a {
  color: var(--outline);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--duration-fast) var(--ease-out);
}

.mp-breadcrumb a:hover { color: var(--on-surface); }

.mp-breadcrumb__sep { opacity: 0.5; }

.mp-breadcrumb__current {
  color: var(--on-surface);
  font-weight: 600;
}

/* Hero title */
.mp-hero-v2 {
  margin-bottom: 32px;
}

.mp-hero-v2 h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--on-surface);
  margin: 0 0 12px;
  max-width: 22ch;
}

.mp-hero-v2 p {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  color: var(--on-surface-variant);
  max-width: 60ch;
  margin: 0 0 24px;
}

/* Hero actions */
.mp-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.mp-btn--primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 24%, transparent);
}

.mp-btn--primary:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 24%, transparent);
}

.mp-btn--secondary {
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border: 1px solid var(--border-default);
}

.mp-btn--secondary:hover {
  background: var(--surface-container-low);
  border-color: var(--border-strong);
}

.mp-btn__badge {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 4px;
}

/* Filter pills row */
.mp-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.mp-pill-v2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.mp-pill-v2:hover {
  border-color: var(--border-strong);
  color: var(--on-surface);
}

.mp-pill-v2.active {
  background: var(--on-surface);
  color: #ffffff;
  border-color: var(--on-surface);
}

.mp-pill-v2 small {
  font-size: 0.72rem;
  opacity: 0.7;
  font-weight: 700;
}

.mp-pill-v2.active small { opacity: 0.85; }

/* Category row */
.mp-category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.mp-category-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
}

.mp-category-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.mp-category-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.mp-category-link:hover { color: var(--on-surface); }

.mp-category-link.active {
  color: var(--on-surface);
  font-weight: 600;
  position: relative;
}

.mp-category-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* Grid */
.mp-grid-v2 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 1600px) {
  .mp-grid-v2 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) { .mp-grid-v2 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .mp-grid-v2 { grid-template-columns: 1fr; } }

/* Card */
.mp-card-v2 {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease-out),
              box-shadow 0.2s var(--ease-out),
              border-color 0.2s ease;
}

.mp-card-v2:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-default);
}

/* Media */
.mp-card-v2__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-container-low);
  overflow: hidden;
}

.mp-card-v2__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease-out);
}

.mp-card-v2:hover .mp-card-v2__media img { transform: scale(1.04); }

/* Media overlay badges */
.mp-card-v2__badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 2;
}

.mp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.mp-badge--dark {
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
}

.mp-badge--verified {
  background: rgba(59, 130, 246, 0.9);
  color: #ffffff;
}

.mp-badge--recent {
  background: rgba(148, 163, 184, 0.85);
  color: #ffffff;
}

.mp-badge--count {
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
}

/* Heart button */
.mp-card-v2__heart {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--on-surface-variant);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  transition: transform 0.2s var(--ease-spring), color 0.15s ease;
}

.mp-card-v2__heart:hover { transform: scale(1.1); }

.mp-card-v2__heart.is-saved {
  color: var(--primary);
  animation: heartPop 0.4s var(--ease-spring);
}

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

/* Body */
.mp-card-v2__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-card-v2__category {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mp-card-v2__title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mp-card-v2__meta {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.25;
  letter-spacing: 0.005em;
  color: var(--outline);
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mp-card-v2__price {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin-top: 4px;
  line-height: 1.2;
}

.mp-card-v2__price span {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--outline);
  margin-left: 4px;
  letter-spacing: 0;
}

/* Empty state */
.mp-empty-v2 {
  grid-column: 1 / -1;
  padding: 60px 24px;
  text-align: center;
  color: var(--outline);
  background: var(--surface-container-lowest);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
}
/* ================================================================
   Mobile Safe Areas & Dynamic Viewport Height
   Loaded last. Overrides legacy 100vh where it matters.
   ================================================================ */

/* ── 1. Replace 100vh with 100dvh on mobile ───────────────── */
@supports (height: 100dvh) {
  @media (max-width: 768px) {
    body,
    .app-shell,
    .main-content,
    .sidebar,
    .editor-drawer,
    .cmd-palette,
    .image-sheet {
      /* If a rule above uses 100vh, override it here. */
    }

    body { min-height: 100dvh; }
    .sidebar { height: 100dvh; }
    .editor-drawer { height: 92dvh; max-height: 92dvh; }
    .cmd-palette { height: 100dvh; }
    .image-sheet { height: 100dvh; }
  }
}

/* ── 2. Header respects notch ─────────────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .site-header {
      padding-top: env(safe-area-inset-top);
      height: calc(56px + env(safe-area-inset-top));
    }

    /* Content must clear both the fixed header AND the tab bar */
    .app-shell {
      padding-top: calc(56px + env(safe-area-inset-top)) !important;
      padding-left: 0 !important;
      padding-bottom: 0 !important;
    }

    .main-content {
      padding-top: 16px !important;
      padding-bottom: 24px !important;
    }

    /* Space for the mobile tab bar at the bottom of the scroll */
    body {
      padding-bottom: env(safe-area-inset-bottom);
    }

    body::after {
      /* Extra padding to keep footer content clear of the tab bar */
      content: "";
      display: block;
      height: calc(72px + env(safe-area-inset-bottom));
      pointer-events: none;
    }
  }
}

/* ── 3. Bottom sheets and tab bars respect home indicator ─── */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .mobile-tabbar {
      padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }

    .mobile-contribute-sheet__panel {
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .image-sheet__panel {
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .editor-drawer .drawer-footer {
      padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
  }
}

/* ── 4. Landscape phone: don't eat the whole screen ──────── */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .editor-drawer { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .editor-drawer::before { display: none; }

  .mobile-contribute-sheet { align-items: stretch; }
  .mobile-contribute-sheet__panel { border-radius: 0; padding-top: 12px; }

  .image-sheet { align-items: stretch; }
  .image-sheet__panel { border-radius: 0; }
}

.swipe-wiki-hint {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(4, 23, 72, 0.88);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
  z-index: 1005;
}
.swipe-wiki-hint.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* ================================================================
   Mobile Tab Bar — bottom navigation for <769px
   ================================================================ */

.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(250, 248, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
  box-shadow: 0 -4px 24px -8px rgba(4, 23, 72, 0.08);
}

.mobile-tabbar__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: var(--on-surface-variant, #64748b);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s ease, background 0.12s ease;
}

.mobile-tabbar__tab i {
  font-size: 1.05rem;
  line-height: 1;
}
.mobile-tabbar__tab > span {
  font-size: 0.66rem;
  line-height: 1;
  margin-top: 2px;
}
.mobile-tabbar__tab:active {
  background: var(--surface-container, rgba(235, 237, 255, 0.5));
}
.mobile-tabbar__tab.is-active {
  color: var(--primary, #35568e);
}

.mobile-tabbar__tab--center {
  position: relative;
  color: var(--primary, #35568e);
}
.mobile-tabbar__center-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: -22px;
  margin-bottom: 2px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e21e49, #ba0035);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px -6px rgba(226, 30, 73, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mobile-tabbar__tab--center:active .mobile-tabbar__center-icon {
  transform: scale(0.94);
  box-shadow: 0 4px 12px -4px rgba(226, 30, 73, 0.5);
}
.mobile-tabbar__tab--center[aria-expanded="true"] .mobile-tabbar__center-icon {
  transform: rotate(45deg);
}

@media (max-width: 768px) {
  .mobile-tabbar { display: grid; }

  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .app-shell { padding-left: 0 !important; }
  .site-footer { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; }

  .sidebar { display: none !important; }
  .sidebar.is-open { display: flex !important; z-index: 1001 !important; }
  .mobile-menu-toggle { display: none !important; }
}

/* ── Contribute sheet ──────────────────────────────────────── */
.mobile-contribute-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.mobile-contribute-sheet.is-open { display: flex; }

.mobile-contribute-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 23, 72, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: mobileSheetFade 0.18s ease;
}
@keyframes mobileSheetFade { from { opacity: 0; } to { opacity: 1; } }

.mobile-contribute-sheet__panel {
  position: relative;
  width: 100%;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-container-lowest, #fff);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(4, 23, 72, 0.18);
  animation: mobileSheetUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes mobileSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mobile-contribute-sheet__handle {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--outline-variant, #c4c6d1);
  margin: 6px auto 14px;
}
.mobile-contribute-sheet__title {
  margin: 0 0 16px;
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface, #0f172a);
  letter-spacing: -0.01em;
}

.mobile-contribute-sheet__option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  margin-bottom: 4px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--on-surface, #0f172a);
  transition: background 0.12s ease;
}
.mobile-contribute-sheet__option:active {
  background: var(--surface-container-low, rgba(243, 243, 255, 0.6));
}

.mobile-contribute-sheet__option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-container, #ebedff);
  color: var(--primary, #35568e);
  font-size: 1.05rem;
  flex-shrink: 0;
}
.mobile-contribute-sheet__option:nth-of-type(1) .mobile-contribute-sheet__option-icon { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.mobile-contribute-sheet__option:nth-of-type(2) .mobile-contribute-sheet__option-icon { background: rgba(168, 85, 247, 0.12); color: #7c3aed; }
.mobile-contribute-sheet__option:nth-of-type(3) .mobile-contribute-sheet__option-icon { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.mobile-contribute-sheet__option:nth-of-type(4) .mobile-contribute-sheet__option-icon { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

.mobile-contribute-sheet__option-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.mobile-contribute-sheet__option-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--on-surface, #0f172a);
}
.mobile-contribute-sheet__option-desc {
  font-size: 0.76rem;
  color: var(--outline, #747781);
  line-height: 1.3;
}
.mobile-contribute-sheet__option-arrow {
  color: var(--outline-variant, #c4c6d1);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.mobile-contribute-sheet__cancel {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--on-surface-variant, #64748b);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.mobile-contribute-sheet__cancel:active {
  background: var(--surface-container, #ebedff);
}

body.mobile-sheet-open { overflow: hidden; }

@media (max-width: 768px) {
  .header-search {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 16px;
    min-height: 44px;   /* tap-target minimum */
    background: var(--surface-container-low);
    border-radius: 12px;
  }

  .header-search__text {
    display: block;
    flex: 1;
    font-size: 0.9rem;
  }

  .header-center {
    flex: 1;
    max-width: none;
  }
}

/* ── Add to Home Screen Banner ───────────────────────────── */
.a2hs-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom)); /* Above mobile tabbar */
  left: 16px;
  right: 16px;
  z-index: 999;
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(4, 23, 72, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideUp 0.3s ease;
}

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

.a2hs-content { display: flex; align-items: center; gap: 12px; flex: 1; }
.a2hs-logo { width: 40px; height: 40px; border-radius: 8px; }
.a2hs-text { display: flex; flex-direction: column; }
.a2hs-text strong { font-family: var(--font-display); font-size: 0.9rem; }
.a2hs-text span { font-size: 0.75rem; color: var(--on-surface-variant); line-height: 1.3; }
.a2hs-actions { display: flex; align-items: center; gap: 8px; }
.a2hs-btn-primary { background: var(--primary); color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.a2hs-btn-close { background: transparent; border: none; font-size: 1.2rem; color: var(--outline); cursor: pointer; }

@media (min-width: 769px) {
  .a2hs-banner { display: none !important; } /* Hide on desktop */
}
.settings-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-top: 24px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.settings-item__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-surface, #041748);
  margin-bottom: 4px;
}

.settings-item__desc {
  font-size: 0.86rem;
  color: var(--on-surface-variant, #434750);
  line-height: 1.5;
  max-width: 52ch;
}

.settings-item--danger .settings-item__title {
  color: var(--error, #ba1a1a);
}

.settings-item__zoom {
  display: inline-flex;
  gap: 4px;
}

@media (max-width: 640px) {
  .settings-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
/* ================================================================
   Sidebar Marks — monograms for communities, icons for pages
   ================================================================ */

/* Shared mark shell */
.sidebar-nav__item-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 6px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
}

/* ── Community monogram ──────────────────────────────────── */
.sidebar-nav__item-mark--community {
  background: var(--accent-soft, var(--surface-container, #ebedff));
  color: var(--accent, var(--on-surface-variant, #434750));
  border: 1px solid var(--accent-line, transparent);
}

/* When the community row is active, invert the monogram */
.sidebar-nav__item--community.is-active .sidebar-nav__item-mark--community {
  background: var(--accent, var(--primary, #35568e));
  color: #ffffff;
  border-color: transparent;
}

/* ── Page type icon ──────────────────────────────────────── */
.sidebar-nav__item-mark--page {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  margin-left: 6px;
  background: transparent;
  border: none;
  color: var(--outline-variant, #c4c6d1);
}

.sidebar-nav__item-mark--page svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Active sub-page — icon inherits the community accent */
.sidebar-nav__subpage.is-active .sidebar-nav__item-mark--page {
  color: var(--accent, var(--primary, #35568e));
}

.sidebar-nav__subpage:hover .sidebar-nav__item-mark--page {
  color: var(--on-surface-variant, #434750);
}

/* ── Adjust padding so marks align cleanly with labels ───── */
.sidebar-nav__item--community {
  gap: 0;
  padding-left: 12px;
}

.sidebar-nav__subpage {
  gap: 0;
  padding-left: 6px;
}

/* ── Dark mode ───────────────────────────────────────────── */
[data-theme="dark"] .sidebar-nav__item-mark--community {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"]
  .sidebar-nav__item--community.is-active
  .sidebar-nav__item-mark--community {
  background: var(--accent, #93c5fd);
  color: #0b1120;
}

[data-theme="dark"] .sidebar-nav__item-mark--page {
  color: #64748b;
}

[data-theme="dark"] .sidebar-nav__subpage.is-active .sidebar-nav__item-mark--page {
  color: var(--accent, #93c5fd);
}
/* ================================================================
   Sidebar — LIGHT LAVENDER, matches Stitch reference
   ================================================================ */

/* Kill every inherited decoration from style.css */
.sidebar::before,
.sidebar::after,
.sidebar-nav::before,
.sidebar-nav::after,
.sidebar-info-card::before,
.sidebar-info-card::after,
.nav-section::before,
.nav-section::after,
.nav-section small::before {
  content: none !important;
  display: none !important;
  background: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 256px;
  background: rgba(243, 243, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 80px 16px 24px;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: none;
  font-family: var(--font-body);
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

/* ── Nav groups ──────────────────────────────────────── */
.sidebar-nav__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav__label {
  display: block;
  padding: 4px 16px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--outline);
}

/* ── Nav items ───────────────────────────────────────── */
.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 12px;
  color: var(--on-surface-variant);
  font-size: 0.9375rem;
  line-height: 1.5rem;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav__item > i {
  width: 20px;
  font-size: 0.95rem !important;   /* was 0.82 */
  font-weight: 400;                 /* lighter */
  color: var(--on-surface-variant);
  opacity: 0.85;                    /* slightly muted */
  text-align: center;
  flex-shrink: 0;
  transition: color var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.sidebar-nav__item:hover > i {
  color: var(--on-surface);
  opacity: 1;
}



.sidebar-nav__item:hover>i {
  color: var(--on-surface);
}

/* Active state — slate blue container, white text */
.sidebar-nav__item.is-active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
}

.sidebar-nav__item.is-active > i {
  color: var(--on-primary-container);
  opacity: 1;
}

/* Badge (red pill for count) */
.sidebar-nav__badge {
  margin-left: auto;
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 0.875rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

/* Community item — compact */
.sidebar-nav__item--community {
  padding: 6px 16px;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  border-radius: 8px;
  justify-content: space-between;
}

.sidebar-nav__count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--outline);
  margin-left: auto;
}

.sidebar-nav__item--community.is-active .sidebar-nav__count {
  color: var(--on-primary-container);
  opacity: 0.85;
}

/* ── Bottom info card ────────────────────────────────── */
.sidebar-info-card {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface-container);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.sidebar-info-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.sidebar-info-card__head i {
  color: var(--primary);
  font-size: 1rem;
}

.sidebar-info-card__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--primary);
}

.sidebar-info-card__text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: var(--on-surface-variant);
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    left: -280px;
    width: 280px;
    z-index: 200;
    transition: left 0.3s ease;
  }

  .sidebar.is-open {
    left: 0;
  }
}

/* Kill any leftover pseudo-element decorations */
.sidebar *::before,
.sidebar *::after,
.sidebar::before,
.sidebar::after {
  /* Exception: allow the info-card icons and nav-badge */
}

.sidebar-nav::before,
.sidebar-nav::after,
.sidebar-brand-block::before,
.sidebar-brand-block::after,
.sidebar-nav__group::before,
.sidebar-nav__group::after,
.sidebar-nav__item::before,
.sidebar-nav__item::after {
  content: none !important;
  display: none !important;
  background: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
  opacity: 0 !important;
}

/* Ensure the info card has no decoration */
.sidebar-info-card::before,
.sidebar-info-card::after {
  content: none !important;
  display: none !important;
}

/* ── Sub-pages under the active community ─────────────────── */
.sidebar-nav__subpages {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 8px 14px;
  padding-left: 10px;
  border-left: 1px solid var(--border-subtle, rgba(100, 116, 139, 0.18));
}

.sidebar-nav__subpage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--on-surface-variant, #64748b);
  font-size: 0.8125rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  overflow: hidden;
}

.sidebar-nav__subpage > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav__subpage i {
  font-size: 0.72rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.sidebar-nav__subpage:hover {
  background: var(--surface-container-low, #f8fafc);
  color: var(--on-surface, #0f172a);
}

.sidebar-nav__subpage.is-active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav__subpage.is-active i {
  opacity: 1;
}

/* Sidebar nav icon refinements */
.sidebar-nav__item > i {
  width: 22px;
  font-size: 1rem !important;
  color: var(--on-surface-variant);
  opacity: 0.75;
  transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.sidebar-nav__item:hover > i {
  opacity: 1;
  transform: scale(1.05);
}

.sidebar-nav__item.is-active > i {
  opacity: 1;
  color: var(--on-primary-container);
}

/* Section label gets a small accent */
.sidebar-nav__label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-nav__label::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0.5;
}

/* Community section header gets a different accent */
.sidebar-nav__group--communities .sidebar-nav__label::before {
  background: var(--outline-variant);
  opacity: 0.6;
}

/* ================================================================
   Sidebar icon chips — professional, subtle gloss on active
   ================================================================ */

/* Icon container */
.sidebar-nav__item > .sidebar-nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  background: transparent;
  color: var(--on-surface-variant, #64748b);
  transition:
    background 180ms cubic-bezier(0.16, 1, 0.3, 1),
    color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.sidebar-nav__item > .sidebar-nav__icon i {
  font-size: 0.88rem;
  line-height: 1;
}

/* Hover — the icon chip lifts slightly */
.sidebar-nav__item:hover > .sidebar-nav__icon {
  background: var(--surface-container, #ebedff);
  transform: scale(1.04);
}

/* Active — gradient fill, gloss highlight, white icon */
.sidebar-nav__item.is-active > .sidebar-nav__icon {
  background: linear-gradient(135deg,
    var(--primary, #35568e) 0%,
    #4f6fa8 100%);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 -1px 0 rgba(0, 0, 0, 0.12) inset,
    0 2px 6px -2px rgba(53, 86, 142, 0.45);
  transform: scale(1.02);
}

/* Gloss highlight — subtle top sheen */
.sidebar-nav__item.is-active > .sidebar-nav__icon::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  height: 40%;
  border-radius: 6px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}

/* Label text — same as before */
.sidebar-nav__item .sidebar-nav__label-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Restore alignment — gap was on the <a>, now on the icon + text */
.sidebar-nav__item {
  gap: 12px;
  padding: 6px 12px;
  min-height: 40px;
}

/* Active item — remove the old full-blue background, keep it subtle */
.sidebar-nav__item.is-active {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary, #35568e);
  font-weight: 600;
}

.sidebar-nav__item.is-active > .sidebar-nav__label-text {
  color: var(--primary, #35568e);
}

/* Override the old icon rules that were targeting <i> directly */
.sidebar-nav__item > i {
  display: none;
}

/* Community rows and sub-pages keep their existing mark system —
   only the main nav gets the new chip treatment. */
/* ================================================================
   ResiHub Design Tokens — Matches Stitch reference
   ================================================================ */

:root {
  /* ── SURFACES ──────────────────────────────────────────── */
  --surface:                  #faf8ff;
  --surface-dim:              #d0d9ff;
  --surface-bright:           #faf8ff;
  --surface-container-lowest: #ffffff;
  --surface-container-low:    #f3f3ff;
  --surface-container:        #ebedff;
  --surface-container-high:   #e3e7ff;
  --surface-container-highest:#dbe1ff;
  --surface-variant:          #dbe1ff;

  /* ── PRIMARY (slate blue) ──────────────────────────────── */
  --primary:                  #35568e;
  --primary-container:        #4f6fa8;
  --primary-fixed:            #d7e2ff;
  --primary-fixed-dim:        #abc7ff;
  --on-primary:               #ffffff;
  --on-primary-container:     #f0f3ff;
  --on-primary-fixed:         #001b3f;
  --on-primary-fixed-variant: #23467d;
  --inverse-primary:          #abc7ff;

  /* ── SECONDARY (crimson) ──────────────────────────────── */
  --secondary:                #ba0035;
  --secondary-container:      #e21e49;
  --secondary-fixed:          #ffdada;
  --secondary-fixed-dim:      #ffb3b6;
  --on-secondary:             #ffffff;
  --on-secondary-container:   #fffbff;
  --on-secondary-fixed:       #40000c;
  --on-secondary-fixed-variant:#920028;

  /* ── TERTIARY (purple — AI accent) ─────────────────────── */
  --tertiary:                 #7d0bd5;
  --tertiary-container:       #9839ef;
  --tertiary-fixed:           #f0dbff;
  --tertiary-fixed-dim:       #ddb8ff;
  --on-tertiary:              #ffffff;
  --on-tertiary-container:    #fbefff;
  --on-tertiary-fixed:        #2c0051;
  --on-tertiary-fixed-variant:#6800b4;

  /* ── TEXT ──────────────────────────────────────────────── */
  --on-surface:               #041748;
  --on-surface-variant:       #434750;
  --on-background:            #041748;
  --inverse-surface:          #1d2e5e;
  --inverse-on-surface:       #eff0ff;

  /* ── OUTLINES / BORDERS ───────────────────────────────── */
  --outline:                  #747781;
  --outline-variant:          #c4c6d1;
  --border-subtle:            rgba(4, 23, 72, 0.06);
  --border-default:           rgba(4, 23, 72, 0.10);
  --border-strong:            rgba(4, 23, 72, 0.20);

  /* ── ERROR ─────────────────────────────────────────────── */
  --error:                    #ba1a1a;
  --error-container:          #ffdad6;
  --on-error:                 #ffffff;
  --on-error-container:       #93000a;

  /* ── SEMANTIC SHORTCUTS ───────────────────────────────── */
  --color-success:            #10b981;
  --color-warning:            #f59e0b;
  --color-info:               #4f6fa8;

  /* ── SPACING (Tailwind scale from Stitch) ─────────────── */
  --space-xs:    0.25rem;   /* 4px  */
  --space-sm:    0.5rem;    /* 8px  */
  --space-md:    1rem;      /* 16px */
  --space-lg:    1.5rem;    /* 24px */
  --space-xl:    2.5rem;    /* 40px */
  --margin:      1rem;
  --margin-md:   2rem;
  --margin-lg:   3.5rem;
  --gutter:      1.25rem;
  --gutter-md:   1.5rem;
  --gutter-lg:   2rem;

  /* ── RADIUS ────────────────────────────────────────────── */
  --radius-default: 0.25rem;   /* 4px  */
  --radius-lg:      0.5rem;    /* 8px  */
  --radius-xl:      0.75rem;   /* 12px */
  --radius-2xl:     1rem;      /* 16px */
  --radius-full:    9999px;

  /* ── SHADOWS ───────────────────────────────────────────── */
  --shadow-sm:  0 1px 4px rgba(0, 0, 0, 0.03);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl:  0 12px 32px rgba(0, 0, 0, 0.10);
  --shadow-btn: 0 4px 12px rgba(226, 30, 73, 0.18);
  --shadow-btn-lg: 0 4px 16px rgba(226, 30, 73, 0.22);

  /* ── MOTION ────────────────────────────────────────────── */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}
/* ================================================================
   Typography — Matches Stitch scale exactly
   ================================================================ */

:root {
  --font-display:   'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-body:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  --font-editorial: 'Merriweather', Georgia, serif;
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9375rem;      /* body-md — 15px */
  line-height: 1.5;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* ── HEADINGS — Plus Jakarta Sans ─────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--on-surface);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 600;
}

/* Display — 3.5rem, 700, tightest */
h1 {
  font-size: 3.5rem;
  line-height: 4rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

/* Headline LG — 2.5rem, 600 */
h2 {
  font-size: 2.5rem;
  line-height: 3rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Headline MD — 1.75rem, 600 */
h3 {
  font-size: 1.75rem;
  line-height: 2.25rem;
  letter-spacing: -0.015em;
  font-weight: 600;
}

/* Headline SM — 1.25rem, 600 */
h4 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  letter-spacing: -0.01em;
  font-weight: 600;
}

h5 {
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  h1 { font-size: 2.25rem; line-height: 2.75rem; letter-spacing: -0.025em; }
  h2 { font-size: 1.75rem; line-height: 2.25rem; letter-spacing: -0.015em; }
}

/* ── BODY ──────────────────────────────────────────────────── */
p {
  margin: 0 0 1rem;
  color: var(--on-surface-variant);
  line-height: 1.75;
  font-weight: 400;
}

/* Body LG — 1.125rem */
.body-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
  letter-spacing: -0.005em;
  color: var(--on-surface-variant);
}

/* Body MD — 0.9375rem (default) */
.body-md {
  font-size: 0.9375rem;
  line-height: 1.5rem;
  letter-spacing: 0;
}

/* Body SM — 0.8125rem */
.body-sm {
  font-size: 0.8125rem;
  line-height: 1.25rem;
  letter-spacing: 0.005em;
  color: var(--on-surface-variant);
}

/* ── MONO LABELS ───────────────────────────────────────────── */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: uppercase;
}

.mono-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 0.875rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ── EDITORIAL (Merriweather) ──────────────────────────────── */
.editorial {
  font-family: var(--font-editorial);
  font-size: 1.125rem;
  line-height: 1.875rem;
  font-weight: 300;
  letter-spacing: 0;
  font-style: italic;
  color: var(--outline);
}

/* ── LINKS ─────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary);
}

/* ── CONTENT BODY (wiki pages) ─────────────────────────────── */
.content-card p,
.wiki-render p {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--on-surface-variant);
}

.wiki-render h1 { font-size: 2.5rem; margin: 1.5rem 0 1rem; }
.wiki-render h2 { font-size: 1.75rem; margin: 1.5rem 0 0.75rem; }
.wiki-render h3 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }

/* ── CODE ──────────────────────────────────────────────────── */
code, pre, kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── REDUCED MOTION ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.wiki-render blockquote {
  font-family: var(--font-editorial);
  font-size: 1.125rem;
  line-height: 1.875rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0;
  color: var(--on-surface);
  padding: 16px 20px;
  margin: 20px 0;
  border-left: 3px solid var(--primary-container);
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
}

.wiki-render blockquote p {
  margin: 0;
  color: inherit;
}

/* ── Editorial blockquotes (wiki pull-quotes) ──────────── */
.wiki-render blockquote {
  font-family: var(--font-editorial);
  font-size: 1.125rem;
  line-height: 1.875rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0;
  color: var(--on-surface);
  padding: 16px 20px;
  margin: 20px 0;
  border-left: 3px solid var(--primary-container);
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
}

.wiki-render blockquote p {
  margin: 0;
  color: inherit;
}

.wiki-render blockquote cite {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--outline);
  font-style: normal;
}
/* ================================================================
   Visual Polish — 2026 signature effects
   Spotlight glow · noise texture · gradient borders · shimmer
   ================================================================ */

/* ── 1. NOISE TEXTURE OVERLAY ─────────────────────────────────
   Breaks the sterile digital feel with a subtle grain. Zero network. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  body::after {
    mix-blend-mode: screen;
    opacity: 0.06;
  }
}

/* ── 2. SPOTLIGHT GLOW ON CARDS ───────────────────────────────
   Radial gradient that follows the cursor. Pure CSS + one JS file. */
.spotlight-card {
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
  background: radial-gradient(
    500px circle at var(--spotlight-x, 50%) var(--spotlight-y, 50%),
    rgba(147, 51, 234, 0.10),
    transparent 40%
  );
  z-index: 1;
}

.spotlight-card:hover::before {
  opacity: 1;
}

.spotlight-card > * {
  position: relative;
  z-index: 2;
}

/* Apply spotlight automatically to common cards */
.hub-card,
.asymmetric-card,
.ad-card-wrapper,
.drawer-section-card,
.empty-state,
.success-modal-card {
  /* opt-in via .spotlight-card class in markup for control */
}

/* ── 3. GRADIENT FOCUS BORDERS ────────────────────────────────
   Rotating conic-gradient on focused inputs. Linear-style signature. */
@property --border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.gradient-focus {
  position: relative;
}

.gradient-focus:focus-within {
  outline: none;
}

.gradient-focus:focus-within::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0%,
    var(--primary, #9333ea) 25%,
    transparent 50%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box,
                linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: borderSpin 4s linear infinite;
  pointer-events: none;
}

@keyframes borderSpin {
  to { --border-angle: 360deg; }
}

/* ── 4. SHIMMER TEXT (loading state) ────────────────────────── */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--text-muted) 0%,
    var(--text-primary) 50%,
    var(--text-muted) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerSlide 2s linear infinite;
}

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

/* ── 5. CARD HOVER LIFT (unified) ───────────────────────────── */
.hub-card,
.asymmetric-card,
.ad-card-wrapper {
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
  will-change: transform;
}

.hub-card:hover,
.asymmetric-card:hover,
.ad-card-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── 6. BUTTON PRESS FEEDBACK ───────────────────────────────── */
.btn-primary-header:active,
.btn-submit-main:active,
.btn-sync:active,
.form-button:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 60ms;
}

/* ── 7. SMOOTH THEME TRANSITION ─────────────────────────────── */
html.theme-transitioning,
html.theme-transitioning * {
  transition:
    background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out) !important;
}

/* ── 8. FOCUS RING (unified, accessible) ────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary, #9333ea);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── 9. RESPECT REDUCED MOTION ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .spotlight-card::before,
  .gradient-focus:focus-within::after,
  .shimmer-text {
    animation: none !important;
    transition: none !important;
  }
  .hub-card:hover,
  .asymmetric-card:hover,
  .ad-card-wrapper:hover {
    transform: none;
  }
}
/* ================================================================
   Wiki Alerts — stacked, urgency-coded notices
   ================================================================ */

.wiki-alerts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 32px;
}

/* ── Container ────────────────────────────────────────────── */
.wiki-alert {
  position: relative;
  border-radius: 14px;
  background: var(--surface-container-lowest, #ffffff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  overflow: hidden;
  /* Urgency tokens — overridden per data-urgency below */
  --alert-accent: #64748b;
  --alert-soft: rgba(100, 116, 139, 0.06);
  --alert-ring: rgba(100, 116, 139, 0.18);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wiki-alert:hover {
  border-color: var(--alert-ring);
  box-shadow: 0 2px 12px -4px rgba(4, 23, 72, 0.06);
}

/* Urgency variants */
.wiki-alert[data-urgency="low"] {
  --alert-accent: #64748b;
  --alert-soft: rgba(100, 116, 139, 0.05);
  --alert-ring: rgba(100, 116, 139, 0.20);
}
.wiki-alert[data-urgency="medium"] {
  --alert-accent: #35568e;
  --alert-soft: rgba(53, 86, 142, 0.06);
  --alert-ring: rgba(53, 86, 142, 0.22);
}
.wiki-alert[data-urgency="high"] {
  --alert-accent: #f59e0b;
  --alert-soft: rgba(245, 158, 11, 0.08);
  --alert-ring: rgba(245, 158, 11, 0.28);
}
.wiki-alert[data-urgency="critical"] {
  --alert-accent: #ba1a1a;
  --alert-soft: rgba(186, 26, 26, 0.06);
  --alert-ring: rgba(186, 26, 26, 0.24);
}

/* Left urgency rail */
.wiki-alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--alert-accent);
  z-index: 1;
}

/* ── Summary row ──────────────────────────────────────────── */
.wiki-alert__summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 22px;
  background: var(--alert-soft);
  cursor: pointer;
  list-style: none;
  font-family: inherit;
  transition: background 0.15s ease;
}

.wiki-alert__summary::-webkit-details-marker { display: none; }

.wiki-alert__summary:hover {
  background: color-mix(in srgb, var(--alert-accent) 10%, transparent);
}

/* Live indicator dot */
.wiki-alert__live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.wiki-alert__dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert-accent);
  box-shadow: 0 0 0 0 var(--alert-accent);
  animation: wikiAlertPulse 2s ease-in-out infinite;
}

@keyframes wikiAlertPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--alert-accent) 40%, transparent);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--alert-accent) 0%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wiki-alert__dot { animation: none; }
}

/* Title */
.wiki-alert__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--on-surface, #041748);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Meta: urgency label + time */
.wiki-alert__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--alert-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.wiki-alert__meta-label {
  text-transform: uppercase;
}

.wiki-alert__meta-sep {
  opacity: 0.5;
}

.wiki-alert__meta-time {
  color: var(--outline, #747781);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* Chevron */
.wiki-alert__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--outline, #747781);
  font-size: 0.72rem;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease;
}

.wiki-alert[open] .wiki-alert__chevron {
  transform: rotate(180deg);
  color: var(--alert-accent);
}

/* ── Body (expanded) ──────────────────────────────────────── */
.wiki-alert__body {
  padding: 18px 22px 20px;
  background: var(--surface-container-lowest, #ffffff);
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.wiki-alert__content {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--on-surface-variant, #434750);
  max-width: 68ch;
}

.wiki-alert__content > :first-child { margin-top: 0; }
.wiki-alert__content > :last-child { margin-bottom: 0; }

.wiki-alert__content p { margin: 0 0 12px; }
.wiki-alert__content a {
  color: var(--primary, #35568e);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Footer */
.wiki-alert__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.06));
}

.wiki-alert__date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline, #747781);
}

.wiki-alert__date i {
  font-size: 0.7rem;
  opacity: 0.6;
}

.wiki-alert__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary, #35568e);
  text-decoration: none;
  transition: opacity 0.15s ease, gap 0.15s ease;
}

.wiki-alert__link:hover {
  opacity: 0.8;
  gap: 9px;
}

.wiki-alert__link i {
  font-size: 0.7rem;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wiki-alert__summary {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 10px;
    padding: 12px 14px 12px 18px;
  }

  .wiki-alert__title {
    font-size: 0.94rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .wiki-alert__meta {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.62rem;
    padding-left: 22px;
  }

  .wiki-alert__chevron {
    grid-row: 1;
    grid-column: 3;
  }

  .wiki-alert__body {
    padding: 14px 18px 16px;
  }

  .wiki-alert__content {
    font-size: 0.88rem;
  }

  .wiki-alert__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ── Dark mode ────────────────────────────────────────────── */
[data-theme="dark"] .wiki-alert {
  background: var(--surface-container-lowest, #131a2e);
  border-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .wiki-alert[data-urgency="low"]      { --alert-accent: #94a3b8; --alert-soft: rgba(148, 163, 184, 0.06); }
[data-theme="dark"] .wiki-alert[data-urgency="medium"]   { --alert-accent: #7dd3fc; --alert-soft: rgba(125, 211, 252, 0.06); }
[data-theme="dark"] .wiki-alert[data-urgency="high"]     { --alert-accent: #fbbf24; --alert-soft: rgba(251, 191, 36, 0.07); }
[data-theme="dark"] .wiki-alert[data-urgency="critical"] { --alert-accent: #fca5a5; --alert-soft: rgba(252, 165, 165, 0.06); }

[data-theme="dark"] .wiki-alert__title { color: #e2e8f0; }
[data-theme="dark"] .wiki-alert__meta-time { color: #94a3b8; }
[data-theme="dark"] .wiki-alert__body {
  background: var(--surface-container-lowest, #131a2e);
  border-top-color: rgba(148, 163, 184, 0.12);
}
[data-theme="dark"] .wiki-alert__content { color: #cbd5e1; }
[data-theme="dark"] .wiki-alert__footer {
  border-top-color: rgba(148, 163, 184, 0.10);
}
[data-theme="dark"] .wiki-alert__date { color: #64748b; }
[data-theme="dark"] .wiki-alert__link { color: #93c5fd; }

/* ================================================================
   Broadcast detail page
   ================================================================ */

.broadcast-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 0 48px;
  --alert-accent: #35568e;
  --alert-soft: rgba(53, 86, 142, 0.06);
}

.broadcast-page[data-urgency="low"]      { --alert-accent: #64748b; --alert-soft: rgba(100, 116, 139, 0.05); }
.broadcast-page[data-urgency="medium"]   { --alert-accent: #35568e; --alert-soft: rgba(53, 86, 142, 0.06); }
.broadcast-page[data-urgency="high"]     { --alert-accent: #f59e0b; --alert-soft: rgba(245, 158, 11, 0.08); }
.broadcast-page[data-urgency="critical"] { --alert-accent: #ba1a1a; --alert-soft: rgba(186, 26, 26, 0.06); }

.broadcast-page__hero {
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-bottom: 32px;
}

.broadcast-page__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--alert-accent);
  margin-bottom: 16px;
}

.broadcast-page__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert-accent);
  animation: broadcastPulse 2s ease-in-out infinite;
}

@keyframes broadcastPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--alert-accent) 40%, transparent); }
  50%      { opacity: 0.7; box-shadow: 0 0 0 5px color-mix(in srgb, var(--alert-accent) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .broadcast-page__dot { animation: none; }
}

.broadcast-page__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--on-surface, #041748);
  margin: 0 0 16px;
  max-width: 20ch;
}

.broadcast-page__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--on-surface-variant, #434750);
  flex-wrap: wrap;
}

.broadcast-page__sep {
  color: var(--outline-variant, #c4c6d1);
}

.broadcast-page__body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--on-surface-variant, #434750);
  max-width: 68ch;
  margin-bottom: 48px;
}

.broadcast-page__body > :first-child { margin-top: 0; }
.broadcast-page__body > :last-child  { margin-bottom: 0; }

.broadcast-page__body p { margin: 0 0 1rem; }
.broadcast-page__body h2 {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface, #041748);
  margin: 32px 0 16px;
}

.broadcast-page__body a {
  color: var(--primary, #35568e);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.broadcast-page__footer {
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.broadcast-page__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary, #35568e);
  text-decoration: none;
  transition: gap 0.15s ease;
}

.broadcast-page__back:hover {
  gap: 12px;
}

.broadcast-page__back i {
  font-size: 0.72rem;
}

/* Mobile */
@media (max-width: 640px) {
  .broadcast-page {
    padding: 12px 0 32px;
  }

  .broadcast-page__title {
    font-size: 1.6rem;
  }

  .broadcast-page__body {
    font-size: 0.94rem;
  }
}

/* Dark mode */
[data-theme="dark"] .broadcast-page__hero,
[data-theme="dark"] .broadcast-page__footer {
  border-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .broadcast-page__title {
  color: #e2e8f0;
}

[data-theme="dark"] .broadcast-page__body,
[data-theme="dark"] .broadcast-page__meta {
  color: #94a3b8;
}

[data-theme="dark"] .broadcast-page__body h2 {
  color: #e2e8f0;
}

[data-theme="dark"] .broadcast-page__back {
  color: #93c5fd;
}

[data-theme="dark"] .broadcast-page[data-urgency="low"]      { --alert-accent: #94a3b8; }
[data-theme="dark"] .broadcast-page[data-urgency="medium"]   { --alert-accent: #7dd3fc; }
[data-theme="dark"] .broadcast-page[data-urgency="high"]     { --alert-accent: #fbbf24; }
[data-theme="dark"] .broadcast-page[data-urgency="critical"] { --alert-accent: #fca5a5; }

/* ── View All Alerts Button ──────────────────────────────── */
.wiki-alerts__view-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  background: var(--surface-container-low, #f3f3ff);
  border: 1px dashed var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 12px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary, #35568e);
  text-decoration: none;
  transition: all 0.15s ease;
}

.wiki-alerts__view-all:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-color: var(--primary);
  border-style: solid;
}

/* Mobile Collapsible Alerts */
.mobile-alerts-wrapper {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-alerts-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--surface-container-lowest, #fff);
    border: 1px solid var(--border-default, rgba(0,0,0,0.1));
    border-radius: 12px;
    font-family: var(--font-display, sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--on-surface, #000);
    cursor: pointer;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  }
  
  .mobile-alerts-badge {
    background: var(--error, #dc2626);
    color: white;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
  }

  /* Force the alerts to hide unless the .is-open class is present */
  #wikiAlertsContainer:not(.is-open) {
    display: none !important;
  }
  
  #wikiAlertsContainer.is-open {
    display: flex !important;
  }
}

.mobile-alerts-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-default, rgba(0,0,0,0.1));
  border-radius: 12px;
  font-family: var(--font-display, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--on-surface, #000);
  cursor: pointer;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.mobile-alerts-badge {
  background: var(--error, #dc2626);
  color: white;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Hide the mobile toggle on desktop screens */
@media (min-width: 769px) {
  .mobile-alerts-toggle {
    display: none !important;
  }
}
/* ================================================================
   Wiki Reading Companion
   TOC rail, reading progress, oversized headings, pull quotes,
   meta strip. Loaded only on wiki pages.
   ================================================================ */

/* ── 1. Reading progress bar ──────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
}

.reading-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary, #35568e) 0%, #7d0bd5 100%);
  transition: width 0.08s linear;
  opacity: 0;
  will-change: width;
}

.reading-progress.is-active .reading-progress__fill {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .reading-progress__fill { transition: none; }
}

/* ── 2. Layout: article + TOC rail ────────────────────────── */
.wiki-layout {
  display: flex;
  justify-content: center;
  gap: 48px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

/* Let the card expand to fill the space left of the TOC */
.wiki-layout .content-card {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 0 24px !important; 
}

/* Constrain ONLY the reading text and headers to a comfortable width */
.wiki-render,
.wiki-meta-strip,
.page-community-chip,
.wiki-render > h1 {
  max-width: 75ch;
  margin-left: auto;
  margin-right: auto;
}

.wiki-render {
  max-width: none !important;
}

/* Ensure the title still looks prominent */
.wiki-render > h1 {
  font-size: 2.5rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

/* Remove extra constraints from the worker's wrapper */
.wiki-render .lh-content-body {
  max-width: 100%;
  margin: 0;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

/* ── 3. TOC rail — editorial, borderless ──────────────────── */
.wiki-toc {
  position: sticky;
  top: 96px;
  width: 220px;
  flex-shrink: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: none;
}

.wiki-toc::-webkit-scrollbar { display: none; }

.wiki-toc__label {
  display: block;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.wiki-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wiki-toc__link {
  display: block;
  padding: 7px 0 7px 12px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--on-surface-variant, #434750);
  text-decoration: none;
  border-left: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin-left: 0;
  transition: color 0.15s ease, border-color 0.15s ease, padding-left 0.15s ease;
}

.wiki-toc__link:hover {
  color: var(--on-surface, #041748);
  border-left-color: var(--outline-variant, #c4c6d1);
}

.wiki-toc__link.is-active {
  color: var(--primary, #35568e);
  font-weight: 600;
  border-left-color: var(--primary, #35568e);
  padding-left: 14px;
}

.wiki-toc__link--h3 {
  padding-left: 24px;
  font-size: 0.78rem;
  color: var(--outline, #747781);
}

.wiki-toc__link--h3.is-active {
  padding-left: 26px;
}

/* ── 4. Oversized chapter headings ────────────────────────── */
.wiki-render h2 {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--on-surface, #041748);
  margin: 56px 0 20px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  position: relative;
}

.wiki-render h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.wiki-render h3 {
  font-size: 1.35rem;
  line-height: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--on-surface, #041748);
  margin: 40px 0 16px;
}

/* Chapter eyebrow — small numeral before h2 */
.wiki-render h2::before {
  content: "§";
  position: absolute;
  left: -28px;
  top: 36px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--outline-variant, #c4c6d1);
  opacity: 0.7;
}

.wiki-render h2:first-child::before {
  top: 4px;
}

/* ── 5. Editorial pull quotes ─────────────────────────────── */
.wiki-render blockquote {
  font-family: var(--font-editorial, "Merriweather", Georgia, serif);
  font-size: 1.25rem;
  line-height: 1.7;
  font-weight: 300;
  font-style: italic;
  color: var(--on-surface, #041748);
  margin: 32px 0;
  padding: 4px 0 4px 28px;
  border-left: 2px solid var(--primary, #35568e);
  border-radius: 0;
  background: transparent;
}

.wiki-render blockquote p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.wiki-render blockquote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  font-style: normal;
}

/* ── 6. Meta strip under title ────────────────────────────── */
.wiki-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 20px 0;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  font-size: 0.84rem;
  color: var(--on-surface-variant, #434750);
}

.wiki-meta-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wiki-meta-strip__item i {
  font-size: 0.72rem;
  opacity: 0.55;
}

.wiki-meta-strip__sep {
  color: var(--outline-variant, #c4c6d1);
  font-size: 0.6rem;
}

.wiki-meta-strip__author {
  color: var(--on-surface, #041748);
  font-weight: 600;
}

.wiki-meta-strip a {
  color: var(--primary, #35568e);
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.wiki-meta-strip a:hover { opacity: 0.75; }

/* ── 7. Article body breathing room ───────────────────────── */
.wiki-render > p,
.wiki-render .lh-text p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--on-surface-variant, #434750);
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.wiki-render > ul,
.wiki-render > ol {
  padding-left: 24px;
  margin-bottom: 1.25rem;
}

.wiki-render > ul li,
.wiki-render > ol li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.wiki-render > img,
.wiki-render .lh-image-container {
  margin: 32px 0;
}

.wiki-eyebrow {
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.wiki-eyebrow__label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

/* ── Float the Back to Top button ───────────────────────── */
.wiki-back-to-top {
  position: fixed;
  bottom: 30rem;
  
  /* THIS IS THE MAGIC LINE: */
  /* It keeps it 2rem from the edge on mobile, but aligns it with 
     the right side of the 1200px wiki-layout container on desktop. */
  right: max(2rem, calc((60vw - 1200px) / 2 + 2rem));
  
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.1));
  border-radius: 999px;
  color: var(--on-surface-variant, #434750);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  
  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.wiki-back-to-top:hover {
  background: var(--surface-container, #f3f3ff);
  color: var(--primary, #35568e);
}

/* This class is added by JS when scrolling down */
.wiki-back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* On mobile, just keep it near the edge */
@media (max-width: 1200px) {
  .wiki-back-to-top {
    right: 1rem;
    bottom: 1rem;
  }
}

.wiki-back-to-top i {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.wiki-back-to-top:hover i {
  transform: translateY(-2px);
}

/* ── 8. Mobile Adjustments ────────────────────────────────── */
@media (max-width: 1023px) {
  .wiki-layout {
    display: block;
  }
  .wiki-toc { 
    display: none; 
  }
}

@media (max-width: 900px) {
  .wiki-render h2 {
    font-size: 1.75rem;
    line-height: 2rem;
    margin: 40px 0 16px;
    padding-top: 24px;
  }
  .wiki-render h2::before { display: none; }
}

@media (max-width: 768px) {
  /* Force full width on mobile */
  .wiki-layout {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .wiki-layout .content-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 16px !important;
  }

  .wiki-render,
  .wiki-meta-strip,
  .page-community-chip,
  .wiki-render > h1 {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Action row wraps gracefully */
  .page-actions-row {
    flex-wrap: wrap;
    gap: 16px;
  }
  .page-share-inline {
    margin-left: 0 !important;
    width: 100%;
    justify-content: flex-start;
  }
}

/* Hide the mobile toggle on desktop */
@media (min-width: 769px) {
  .mobile-alerts-toggle {
    display: none;
  }
}

/* ── Page Share Footer ───────────────────────────────────── */
.page-share-bottom {
  margin-top: 32px;
  padding-top: 24px;
  /* border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08)); */
  display: flex;
  justify-content: flex-start;
}

.page-share-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* The "Share this page" text */
.page-share-inline__label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

/* The icon container */
.page-share-inline__links {
  display: flex;
  gap: 8px;
}

/* Individual social buttons */
.page-share-inline__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-container-low, #f3f3ff);
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  color: var(--on-surface-variant, #434750);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

/* Hover effect */
.page-share-inline__links a:hover {
  background: var(--primary, #35568e);
  border-color: var(--primary, #35568e);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(53, 86, 142, 0.2);
}

/* ── Submit Page Preview ─────────────────────────────────── */
.submit-preview {
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  border-radius: var(--radius-xl, 12px);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(4, 23, 72, 0.02);
}

.submit-preview .preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-container-low, #f3f3ff);
  color: var(--primary, #35568e);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.submit-preview h1 {
  font-family: var(--font-display, sans-serif);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--on-surface, #041748);
  margin: 0 0 16px;
  line-height: 1.2;
}

.submit-preview .preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.submit-preview .preview-tags span {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  color: var(--outline, #747781);
  background: var(--surface-container, #ebedff);
  padding: 4px 8px;
  border-radius: 6px;
}

.submit-preview .preview-divider {
  border: none;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  margin: 24px 0;
}

.submit-preview .preview-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--on-surface-variant, #434750);
}

.submit-preview .preview-body p {
  margin-bottom: 1rem;
}

.submit-preview .text-muted {
  color: var(--outline);
  font-style: italic;
}

/* Fix the native button styling for the Edit action */
.btn-edit-action,
.btn-cancel-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-container-lowest, #fff);
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 8px;
  color: var(--on-surface, #041748);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.btn-edit-action:hover,
.btn-cancel-header:hover {
  background: var(--surface-container-low, #f3f3ff);
  border-color: var(--primary-container, #4f6fa8);
  color: var(--primary, #35568e);
}

.btn-edit-action i,
.btn-cancel-header i {
  font-size: 0.9rem;
}

/* ── Global Lightbox ─────────────────────────────────────── */
.global-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.global-lightbox.is-open {
  display: flex;
  opacity: 1;
}

.global-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 23, 72, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.global-lightbox__img {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-lightbox.is-open .global-lightbox__img {
  transform: scale(1);
}

.global-lightbox__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.global-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Fix Community Chip spacing on Mobile */
@media (max-width: 768px) {
  .page-community-chip {
    margin-top: 10px !important;
    margin-bottom: 24px !important;
    display: inline-flex !important;
    /* Ensures it doesn't stretch full width */
    width: auto !important; 
  }
  
  /* Ensure the meta strip below it has proper spacing */
  .wiki-meta-strip {
    margin-top: 0 !important;
    padding-top: 16px !important;
  }
}

/* ── Responsive Video Embeds ───────────────────────────────── */
.lh-video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: 12px;
  background: #000;
  width: 100%;
}

.lh-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Force video wrappers to respect alignment classes */
.lh-align-center .lh-video-container { margin: 1.5rem auto; max-width: 800px; }
.lh-align-left .lh-video-container { float: left; width: min(50%, 500px); margin: 0.5rem 1.5rem 1rem 0; }
.lh-align-right .lh-video-container { float: right; width: min(50%, 500px); margin: 0.5rem 0 1rem 1.5rem; }

@media (max-width: 768px) {
  .lh-align-left .lh-video-container,
  .lh-align-right .lh-video-container {
    float: none;
    width: 100%;
    margin: 1.5rem 0;
  }
}
/* ================================================================
   Comments — Editorial
   Rule-separated rows, mono labels, no card shadows.
   ================================================================ */

.comments-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: start;
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.comments-shell__col { min-width: 0; }

@media (max-width: 900px) {
  .comments-shell {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-top: 32px;
    padding-top: 24px;
  }
}

/* ── Section wrappers ────────────────────────────────────── */
.comments-section,
.comment-form-section { margin: 0; }

.comments-container,
.comment-form-container {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.comments-title,
.comment-form-title {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
  margin: 0 0 6px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
}

.comment-form-subtitle {
  font-size: 0.82rem;
  color: var(--on-surface-variant, #434750);
  margin: 0 0 20px;
}

.comment-form-toggle { display: none; }
.comment-form-content { display: block; }

/* ── Loading / empty / error ─────────────────────────────── */
.comments-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--on-surface-variant, #434750);
  font-size: 0.82rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle, rgba(4, 23, 72, 0.12));
  border-top-color: var(--primary, #35568e);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.comments-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--on-surface-variant, #434750);
  font-size: 0.88rem;
  border: none;
  background: transparent;
  border-radius: 0;
}

.comments-empty p { margin: 0; }

.comments-error {
  padding: 12px 14px;
  background: color-mix(in srgb, var(--error) 6%, transparent);
  border-left: 3px solid var(--error, #ba1a1a);
  border-radius: 6px;
  color: var(--on-error-container, #93000a);
  font-size: 0.84rem;
}

/* ── Comment list — no cards ─────────────────────────────── */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comment-card {
  display: flex;
  gap: 14px;
  padding: 20px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border-subtle, rgba(4, 23, 72, 0.08));
  box-shadow: none;
  transition: padding-left 0.15s ease;
}

.comment-card:hover {
  box-shadow: none;
  padding-left: 6px;
}

/* Avatar */
.comment-card__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary, #35568e);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  user-select: none;
  border: none;
}

.comment-card__avatar--anon {
  background: var(--surface-container, #ebedff);
  color: var(--on-surface-variant, #434750);
}

/* Body */
.comment-card__body {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.comment-card__body::before { display: none; }

/* Meta row */
.comment-card__meta--row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-card__author {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--on-surface, #041748);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-card__date {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--outline, #747781);
}

.comment-anon-badge {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-container, #ebedff);
  color: var(--on-surface-variant, #434750);
  border: none;
}

/* Body text */
.comment-card__text {
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--on-surface-variant, #434750);
  margin: 0;
  cursor: pointer;
}

.comment-card__text--collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comment-card__text:focus-visible {
  outline: 2px solid var(--primary, #35568e);
  border-radius: 4px;
  outline-offset: 2px;
}

/* Actions row */
.comment-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.comment-card__report-bottom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--outline, #747781);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.comment-card:hover .comment-card__report-bottom { opacity: 1; }

.comment-card__report-bottom:hover {
  color: var(--error, #ba1a1a);
  background: transparent;
  border: none;
}

.comment-card__report-bottom:focus-visible {
  outline: 2px solid var(--error, #ba1a1a);
  outline-offset: 2px;
  opacity: 1;
}

.comment-card__report-bottom:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Form ────────────────────────────────────────────────── */
.comment-form { margin-top: 8px; }

.form-group { margin-bottom: 20px; }

.form-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
}

.optional-badge {
  font-family: var(--font-body, "Inter", sans-serif);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--outline, #747781);
  margin-left: auto;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--on-surface, #041748);
  box-sizing: border-box;
  height: auto;
  transition: border-color 0.15s ease;
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--outline-variant, #c4c6d1); }

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-bottom-color: var(--primary, #35568e);
  box-shadow: none;
}

.form-checkbox-row {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--on-surface, #041748);
  user-select: none;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary, #35568e);
}

.form-message {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.84rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.form-message-success {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #10b981;
  color: #047857;
}
.form-message-error {
  background: rgba(186, 26, 26, 0.06);
  border-left-color: #ba1a1a;
  color: #991b1b;
}

.form-button {
  width: 100%;
  height: 46px;
  background: var(--primary, #35568e);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.005em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
  box-shadow: none;
}

.form-button:hover:not(:disabled) {
  background: var(--primary-container, #4f6fa8);
  opacity: 1;
  transform: none;
  box-shadow: none;
}

.form-button:disabled { opacity: 0.55; cursor: not-allowed; }

.button-text { display: inline; }
.button-loader {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 6px;
  vertical-align: middle;
}

.form-button:focus-visible,
.form-input:focus-visible,
.form-textarea:focus-visible {
  outline: 2px solid var(--primary, #35568e);
  outline-offset: 2px;
}

/* ── Report modal ────────────────────────────────────────── */
.report-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(4, 23, 72, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.report-modal {
  background: var(--surface-container-lowest, #fff);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px -10px rgba(4, 23, 72, 0.28);
}

.report-modal__title {
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--on-surface, #041748);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.report-modal__subtitle {
  font-size: 0.84rem;
  color: var(--on-surface-variant, #434750);
  margin: 0 0 20px;
}

.report-modal__label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--outline, #747781);
  display: block;
  margin-bottom: 8px;
}

.report-modal__reasons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.report-reason-btn {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--on-surface, #041748);
  cursor: pointer;
  text-transform: capitalize;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.report-reason-btn:hover {
  border-color: var(--primary-container, #4f6fa8);
  background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.report-reason-btn[aria-pressed="true"] {
  border-color: var(--primary, #35568e);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  font-weight: 700;
}

.report-modal__textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--on-surface, #041748);
  resize: vertical;
  min-height: 72px;
  line-height: 1.55;
  margin-bottom: 16px;
}

.report-modal__textarea:focus {
  outline: none;
  border-color: var(--primary, #35568e);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.report-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.report-modal__cancel {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--on-surface-variant, #434750);
  cursor: pointer;
}

.report-modal__cancel:hover { background: var(--surface-container, #ebedff); }

.report-modal__submit {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: var(--primary, #35568e);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}
.report-modal__submit:hover:not(:disabled) { background: var(--primary-container, #4f6fa8); }
.report-modal__submit:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .comment-card { padding: 16px 0; gap: 12px; }
  .comment-card__avatar { width: 32px; height: 32px; font-size: 0.72rem; }
  .comment-card__author { font-size: 0.86rem; }
  .comment-card__text { font-size: 0.9rem; }
  .comment-card__report-bottom { opacity: 0.8; }
  .form-input, .form-textarea { font-size: 16px; }
  .report-modal__reasons { grid-template-columns: 1fr; }

  .comment-form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
    border-radius: 10px;
    background: transparent;
    color: var(--on-surface, #041748);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
  }
  .comment-form-toggle__icon {
    font-size: 1.2rem;
    color: var(--primary, #35568e);
  }
  .comment-form-content { display: none; }
  .comment-form-content.is-open { display: block; }
  .comments-title, .comment-form-title { display: none; }
  .comment-form-subtitle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Align form actions with the rest of the app ─────────── */

/* Post Comment: auto-width, right-aligned, no shadow */
.form-button {
  width: auto;
  min-width: 140px;
  height: 44px;
  padding: 0 22px;
  background: var(--primary, #35568e);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: none;
  margin-left: auto;
  transition: background 0.15s ease;
}

.form-button:hover:not(:disabled) {
  background: var(--primary-container, #4f6fa8);
  box-shadow: none;
  transform: none;
}

/* Wrap actions row so the button sits right */
.comment-form .form-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

/* Show the checkbox + button on one row */
.form-checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

/* Tighten label spacing — labels sit above fields, fields sit above rule */
.form-label {
  margin-bottom: 6px;
}

.form-input,
.form-textarea {
  padding: 10px 0 12px;
}

/* Character counter aligned to the right of the textarea */
.char-count-display,
.form-group .char-count {
  display: block;
  text-align: right;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--outline, #747781);
  margin-top: 6px;
}

/* ── Show More / pagination button ───────────────────────── */
.comments-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  margin: 16px 0 0;
  border: 1px solid var(--border-default, rgba(4, 23, 72, 0.1));
  border-radius: 10px;
  background: transparent;
  color: var(--on-surface, #041748);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.comments-page-btn:hover:not(:disabled) {
  background: var(--surface-container-low, #f3f3ff);
  border-color: var(--border-strong, rgba(4, 23, 72, 0.2));
}

.comments-page-btn:active:not(:disabled) {
  background: var(--surface-container, #ebedff);
}

.comments-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.comments-page-btn:focus-visible {
  outline: 2px solid var(--primary, #35568e);
  outline-offset: 2px;
}

/* Loading spinner inside the button */
.comments-page-btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle, rgba(4, 23, 72, 0.12));
  border-top-color: var(--primary, #35568e);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Dark mode */
[data-theme="dark"] .comments-page-btn {
  border-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

[data-theme="dark"] .comments-page-btn:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.3);
}

.comments-page-btn .show-more-loader .spinner {
  width: 14px !important;
  height: 14px !important;
  border-width: 2px !important;
}

#comments-show-more .spinner {
  margin-left: 6px;
}
