:root {
  --bg: #f7f5ef;
  --ink: #1f1d1a;
  --muted: #5b5750;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(31, 29, 26, 0.12);
  --primary: #0d7c66;
  --primary-strong: #095f4e;
  --danger: #a4302f;
  --track-writing: #0b7e69;
  --track-publishing: #005fa3;
  --track-marketing: #aa4a00;
  --track-relationship: #8a2d6f;
  --track-learning: #6943b0;
  --track-general: #57534e;
  --sidebar-width: 240px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #efe7d7 0%, #f7f5ef 45%, #fefcf8 100%);
  overflow-x: hidden;
}

html.onboarding-open,
body.onboarding-open {
  overflow: hidden;
  height: 100%;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-layer-a {
  background: radial-gradient(circle at 12% 12%, rgba(13, 124, 102, 0.22), transparent 35%),
    radial-gradient(circle at 85% 18%, rgba(105, 67, 176, 0.18), transparent 28%);
}

.bg-layer-b {
  background: radial-gradient(circle at 72% 78%, rgba(170, 74, 0, 0.18), transparent 32%),
    radial-gradient(circle at 22% 68%, rgba(0, 95, 163, 0.14), transparent 24%);
}

/* =========================
   Landing Page
   ========================= */
html {
  scroll-behavior: smooth;
}

.landing-page {
  min-height: auto;
  display: block;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
}

#desktopAuthPage,
#desktopCheckoutPage {
  display: none;
}

html.storyrise-desktop-preboot #authPage {
  display: none;
}

html.storyrise-desktop-preboot #desktopAuthPage {
  display: grid;
  place-items: center;
}

html.storyrise-desktop-preboot body {
  background: #1c1f26;
}

html.storyrise-desktop-preboot .bg-layer {
  display: none;
}

html.storyrise-checkout-preboot #authPage,
html.storyrise-checkout-preboot #desktopAuthPage {
  display: none;
}

html.storyrise-checkout-preboot #desktopCheckoutPage {
  display: grid;
}

.landing-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

/* --- Sticky Nav --- */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 245, 239, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
}

.landing-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
}

.landing-nav-links {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.landing-nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 150ms;
}

.landing-nav-links a:hover {
  color: var(--ink);
}

.landing-nav-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 1.5rem;
  flex-shrink: 0;
}

.landing-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: auto;
}

/* --- Hero --- */
.landing-hero {
  padding: 5rem 0 4rem;
  position: relative;
}

.landing-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.landing-eyebrow {
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.landing-hero-title {
  margin: 0 0 1rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.landing-hero-sub {
  margin: 0 0 2rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 500px;
}

.landing-hero-ctas {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.landing-hero-tertiary {
  margin: 0.8rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

.landing-inline-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin-left: 0.25rem;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.landing-inline-link:hover {
  color: var(--primary-strong);
}

.landing-hero-note {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 560px;
}

.btn-lg {
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--panel-border);
}

.btn-ghost:hover {
  background: rgba(31, 29, 26, 0.05);
}

.landing-hero-visual {
  display: flex;
  justify-content: center;
  position: relative;
}

/* --- Placeholders --- */
.landing-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  border: 2px dashed rgba(31, 29, 26, 0.18);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.landing-placeholder::after {
  content: attr(data-placeholder);
}

.landing-feature-video {
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  display: block;
}

/* ── Momentum Tracker graphic ── */
.mt-card {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  padding: 24px 26px 20px;
  font-family: 'Space Grotesk', sans-serif;
}
.mt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mt-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.mt-header-icon { width: 18px; height: 18px; color: #0d7c66; }
.mt-header-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0d7c66;
}
.mt-header-date {
  font-size: 0.7rem;
  color: #9a9590;
}
.mt-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}
.mt-ring-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mt-ring-wrap {
  position: relative;
  width: 88px; height: 88px;
}
.mt-ring-svg { width: 88px; height: 88px; }
.mt-ring-bg { fill: none; stroke: #e8e5df; stroke-width: 7; }
.mt-ring-fg {
  fill: none;
  stroke: #0d7c66;
  stroke-width: 7;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
}
.mt-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mt-ring-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f1d1a;
  line-height: 1;
}
.mt-ring-label {
  font-size: 0.56rem;
  color: #9a9590;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.mt-ring-caption {
  font-size: 0.62rem;
  color: #9a9590;
}
.mt-stats-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}
.mt-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(13,124,102,0.08);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  align-self: flex-start;
}
.mt-streak-flame { font-size: 0.9rem; line-height: 1; }
.mt-streak-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: #0d7c66;
}
.mt-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mt-mini-stat {
  background: #faf8f4;
  border-radius: 8px;
  padding: 8px 10px;
}
.mt-mini-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f1d1a;
  line-height: 1.1;
}
.mt-mini-stat-label {
  font-size: 0.56rem;
  color: #9a9590;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.mt-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: #9a9590;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.mt-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 48px;
  margin-bottom: 16px;
}
.mt-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
  justify-content: flex-end;
}
.mt-bar {
  width: 100%;
  border-radius: 3px 3px 1px 1px;
  min-height: 3px;
}
.mt-bar-day {
  font-size: 0.52rem;
  color: #b0ada8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mt-heatmap { margin-bottom: 14px; }
.mt-heatmap-grid {
  display: flex;
  gap: 2.5px;
}
.mt-heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
}
.mt-hm {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: #eae7e1;
  display: inline-block;
}
.mt-hm.l1 { background: rgba(13,124,102,0.20); }
.mt-hm.l2 { background: rgba(13,124,102,0.40); }
.mt-hm.l3 { background: rgba(13,124,102,0.65); }
.mt-hm.l4 { background: #0d7c66; }
.mt-heatmap-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}
.mt-heatmap-months {
  display: flex;
  gap: 0;
}
.mt-heatmap-month {
  font-size: 0.5rem;
  color: #b0ada8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mt-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mt-heatmap-legend-label {
  font-size: 0.5rem;
  color: #b0ada8;
  margin: 0 2px;
}
.mt-heatmap-legend-cell {
  width: 8px; height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.mt-milestones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mt-milestone {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #faf8f4;
  border-radius: 7px;
  padding: 5px 10px 5px 7px;
}
.mt-milestone-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}
.mt-milestone-text {
  font-size: 0.62rem;
  font-weight: 500;
  color: #5b5750;
}
.mt-milestone-locked {
  opacity: 0.35;
}
.mt-milestone-locked .mt-milestone-icon {
  filter: grayscale(1);
}

.landing-placeholder-hero {
  aspect-ratio: 4 / 3;
  min-height: 320px;
}

/* --- Hero Illustration --- */
.hero-illustration {
  width: 100%;
  height: auto;
  max-width: 560px;
  border-radius: 18px;
  aspect-ratio: 4 / 3;
  position: relative;
  z-index: 2;
}

/* --- Hero Author Image (crossfade target) --- */
.hero-author-image {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  /* No background — transparent PNG shows the real body gradient behind it */
  background: transparent;
}

/* ========================================
   Hero Animation System (pure CSS, infinite loop)

   10s cycle, starts at entrance point via negative delay:
     90–100% : Crossfade Image→SVG + entrance animations
     0–35%   : SVG hold (fully visible)
     35–45%  : Crossfade SVG→Image
     45–90%  : Image hold

   SVG + Image opacities always sum to 1.0 = seamless crossfade.
   prefers-reduced-motion: shows static SVG, no animation.
   ======================================== */

/* --- Crossfade keyframes (SVG + Image sum to 1.0) --- */
@keyframes heroSvgCycle {
  0%   { opacity: 1; }
  35%  { opacity: 1; }
  45%  { opacity: 0; }
  90%  { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes heroImgCycle {
  0%   { opacity: 0; }
  35%  { opacity: 0; }
  45%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Element entrance keyframes (visible 0-35%, reset 46%, re-enter 88-100%) --- */
@keyframes heroBgCycle {
  0%, 35%  { opacity: 1; }
  46%, 88% { opacity: 0; }
  100%     { opacity: 1; }
}

@keyframes heroEditorCycle {
  0%       { opacity: 1; transform: translateY(0); }
  35%      { opacity: 1; transform: translateY(0); }
  46%      { opacity: 0; transform: translateY(12px); }
  86%      { opacity: 0; transform: translateY(12px); }
  96%      { opacity: 1; transform: translateY(0); }
  100%     { opacity: 1; transform: translateY(0); }
}

@keyframes heroNexusCycle {
  0%       { opacity: 1; transform: translateY(0); }
  35%      { opacity: 1; transform: translateY(0); }
  46%      { opacity: 0; transform: translateY(10px); }
  88%      { opacity: 0; transform: translateY(10px); }
  96%      { opacity: 1; transform: translateY(0); }
  100%     { opacity: 1; transform: translateY(0); }
}

@keyframes heroBranchCycle {
  0%, 35%  { opacity: 1; }
  46%, 90% { opacity: 0; }
  98%, 100% { opacity: 1; }
}

@keyframes heroCursorCycle {
  0%       { opacity: 1; }
  35%      { opacity: 1; }
  46%      { opacity: 0; }
  92%      { opacity: 0; }
  99%      { opacity: 1; }
  100%     { opacity: 1; }
}

@keyframes heroBookCycle {
  0%       { opacity: 1; transform: translateY(0); }
  35%      { opacity: 1; transform: translateY(0); }
  46%      { opacity: 0; transform: translateY(12px); }
  87%      { opacity: 0; transform: translateY(12px); }
  96%      { opacity: 1; transform: translateY(0); }
  100%     { opacity: 1; transform: translateY(0); }
}

@keyframes heroPenCycle {
  0%, 35%  { opacity: 1; }
  46%, 89% { opacity: 0; }
  97%, 100% { opacity: 1; }
}

@keyframes heroCardsCycle {
  0%       { opacity: 1; transform: translateY(0); }
  35%      { opacity: 1; transform: translateY(0); }
  46%      { opacity: 0; transform: translateY(12px); }
  88%      { opacity: 0; transform: translateY(12px); }
  96%      { opacity: 1; transform: translateY(0); }
  100%     { opacity: 1; transform: translateY(0); }
}

@keyframes heroConnectorsCycle {
  0%, 35%  { opacity: 1; }
  46%, 91% { opacity: 0; }
  98%, 100% { opacity: 1; }
}

@keyframes heroSparklesCycle {
  0%       { opacity: 1; transform: scale(1); }
  35%      { opacity: 1; transform: scale(1); }
  46%      { opacity: 0; transform: scale(0); }
  94%      { opacity: 0; transform: scale(0); }
  98%      { opacity: 1; transform: scale(1.15); }
  100%     { opacity: 1; transform: scale(1); }
}

@keyframes heroAccentsCycle {
  0%, 35%  { opacity: 1; }
  46%, 92% { opacity: 0; }
  99%, 100% { opacity: 1; }
}

/* --- Animation assignments (motion-OK only) --- */
@media (prefers-reduced-motion: no-preference) {
  /* Crossfade containers — negative delay starts at entrance point (90%) */
  .hero-illustration {
    animation: heroSvgCycle 10s linear infinite;
    animation-delay: -9s;
  }

  .hero-author-image {
    animation: heroImgCycle 10s linear infinite;
    animation-delay: -9s;
  }

  /* SVG internal elements */
  #heroBg           { animation: heroBgCycle 10s linear infinite -9s; }
  #heroEditor       { animation: heroEditorCycle 10s linear infinite -9s; }
  #heroNexusMap     { animation: heroNexusCycle 10s linear infinite -9s; }
  #heroBranches     { animation: heroBranchCycle 10s linear infinite -9s; }
  #heroCursor       { animation: heroCursorCycle 10s linear infinite -9s; }
  #heroBook         { animation: heroBookCycle 10s linear infinite -9s; }
  #heroPen          { animation: heroPenCycle 10s linear infinite -9s; }
  #heroCards        { animation: heroCardsCycle 10s linear infinite -9s; }
  #heroConnectors   { animation: heroConnectorsCycle 10s linear infinite -9s; }
  #heroSparkles     { animation: heroSparklesCycle 10s linear infinite -9s; }
  #heroAccents      { animation: heroAccentsCycle 10s linear infinite -9s; }
}

@media (max-width: 768px) {
  .hero-author-image {
    max-width: 100%;
  }
}

.landing-placeholder-avatar {
  width: 56px;
  height: 56px;
  aspect-ratio: 1;
  border-radius: 50%;
  min-height: auto;
  flex-shrink: 0;
  font-size: 0.7rem;
}

/* --- Pain to Outcome --- */
.landing-pain-outcome {
  padding: 4rem 0;
  position: relative;
  z-index: 1;
}

.landing-pain-outcome-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

/* --- Before/After Split Cards --- */
.landing-ba-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  overflow: hidden;
}

.landing-ba-panel {
  padding: 2rem 1.75rem;
}

.landing-ba-before {
  background: rgba(164, 48, 47, 0.04);
  border-left: 3px solid var(--danger);
}

.landing-ba-after {
  background: rgba(13, 124, 102, 0.04);
  border-right: 3px solid var(--primary);
}

.landing-ba-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-ba-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 0.5rem;
}

.landing-ba-label-before {
  color: var(--danger);
}

.landing-ba-label-after {
  color: var(--primary);
}

.landing-ba-text {
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0;
  color: var(--muted);
}

.landing-ba-after .landing-ba-text {
  color: var(--ink);
  font-weight: 500;
}

.landing-ba-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  color: var(--primary);
}

/* --- Section Headings (shared) --- */
.landing-section-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}

.landing-section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 3rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Features --- */
.landing-features {
  padding: 5rem 0 3rem;
  scroll-margin-top: 80px;
}

.landing-feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 2.5rem 0;
}

.landing-feature-row-reverse .landing-feature-text {
  order: 2;
}

.landing-feature-row-reverse .landing-feature-visual {
  order: 1;
}

.landing-feature-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.landing-feature-text h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

.landing-feature-text p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
  font-size: 1rem;
}

/* --- How It Works --- */
.landing-how {
  padding: 5rem 0;
  background: rgba(255, 255, 255, 0.5);
  scroll-margin-top: 80px;
  position: relative;
  z-index: 1;
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
}

.landing-steps::before {
  content: '';
  position: absolute;
  top: 24px;
  left: calc(16.67% + 24px);
  right: calc(16.67% + 24px);
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--primary) 0,
    var(--primary) 8px,
    transparent 8px,
    transparent 16px
  );
  opacity: 0.25;
  z-index: 0;
}

.landing-step {
  text-align: center;
  padding: 1.5rem;
}

.landing-step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.landing-step h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.landing-step p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0;
}

/* --- Testimonials --- */
.landing-testimonials {
  padding: 5rem 0;
}

.landing-testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.landing-testimonial-card {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.landing-testimonial-card blockquote {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  font-style: italic;
}

.landing-testimonial-card cite {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}


/* --- Pricing Section --- */
.landing-pricing {
  padding: 5rem 0;
  scroll-margin-top: 80px;
}

.landing-pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 820px;
  margin: 2.5rem auto 0;
}

.pricing-card {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1.5px solid var(--panel-border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card-featured {
  border-color: var(--primary);
  box-shadow: 0 14px 36px rgba(13, 124, 102, 0.12);
}

.pricing-card-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 1rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.pricing-card-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.5rem 0 0.75rem;
}

.pricing-card-price {
  margin-bottom: 0.25rem;
}

.pricing-price-amount {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
}

.pricing-price-interval {
  font-size: 1rem;
  color: var(--muted);
}

.pricing-card-trial {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.pricing-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  flex: 1;
}

.pricing-card-features li {
  padding: 0.45rem 0;
  font-size: 0.92rem;
  color: var(--muted);
  border-bottom: 1px solid rgba(31, 29, 26, 0.06);
}

.pricing-card-features li::before {
  content: "\2713";
  color: var(--primary);
  font-weight: 700;
  margin-right: 0.6rem;
}

.pricing-card-cta {
  width: 100%;
}

/* --- Web Auth Page (full-screen overlay) --- */
.web-auth-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  overflow-y: auto;
  background: var(--bg);
}

.web-auth-page-card {
  max-width: 440px;
}

.web-auth-heading {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}

.web-auth-back-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.web-auth-back-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* --- Web Auth: Two-column purchase summary layout --- */

.web-auth-page-card.web-auth-page-card--with-summary {
  width: min(820px, 100%);
  max-width: 820px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.web-auth-summary {
  padding: 2rem 1.75rem;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
}

.web-auth-summary-badge {
  display: inline-block;
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 1rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.web-auth-summary-badge:empty {
  display: none;
}

.web-auth-summary-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.web-auth-summary-price {
  margin-bottom: 0.25rem;
}

.web-auth-summary-amount {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
}

.web-auth-summary-interval {
  font-size: 1rem;
  color: var(--muted);
  margin-left: 0.15rem;
}

.web-auth-summary-trial {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.web-auth-summary-features {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.web-auth-summary-features li {
  padding: 0.45rem 0;
  font-size: 0.92rem;
  color: var(--muted);
  border-bottom: 1px solid rgba(31, 29, 26, 0.06);
}

.web-auth-summary-features li::before {
  content: "\2713";
  color: var(--primary);
  font-weight: 700;
  margin-right: 0.6rem;
}

.web-auth-form-col {
  min-width: 0;
}

.web-auth-page-card.web-auth-page-card--with-summary .web-auth-form-col {
  padding-top: 0.5rem;
}

@media (max-width: 768px) {
  .web-auth-page-card.web-auth-page-card--with-summary {
    max-width: 440px;
    grid-template-columns: 1fr;
  }

  .web-auth-summary {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding: 1.5rem 1rem;
  }
}

/* --- Final CTA --- */
.landing-final-cta {
  padding: 5rem 0;
  scroll-margin-top: 80px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(13, 124, 102, 0.03) 30%,
    rgba(13, 124, 102, 0.06) 100%
  );
}

.landing-cta-centered {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.landing-cta-centered h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.landing-cta-centered p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.landing-cta-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-form-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.8rem;
  border-bottom: 2px solid var(--panel-border);
}

.auth-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-tab-panel {
  animation: authFadeIn 200ms ease;
}

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

/* =============================
   Desktop Gate (dark welcome)
   ============================= */

.desktop-gate {
  --gate-bg: #0f1115;
  --gate-surface: rgba(255, 255, 255, 0.06);
  --gate-surface-hover: rgba(255, 255, 255, 0.09);
  --gate-border: rgba(255, 255, 255, 0.08);
  --gate-text: rgba(255, 255, 255, 0.92);
  --gate-text-muted: rgba(255, 255, 255, 0.50);
  --gate-text-dim: rgba(255, 255, 255, 0.32);
  --gate-accent: #2dd4a8;
  --gate-accent-strong: #0d7c66;

  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--gate-bg);
  color: var(--gate-text);
  position: relative;
  z-index: 1;
}

.desktop-gate-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* --- Brand --- */
.desktop-gate-brand {
  text-align: center;
  margin-bottom: 2.4rem;
}

.desktop-gate-brand svg {
  color: var(--primary);
  width: 56px;
  height: 56px;
  margin-bottom: 0.75rem;
}

.desktop-gate-appname {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--gate-text);
}

.desktop-gate-version {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--gate-text-dim);
  letter-spacing: 0.06em;
}

/* --- Action Chooser --- */
.desktop-gate-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.desktop-gate-action-primary,
.desktop-gate-action-secondary {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--gate-border);
  background: var(--gate-surface);
  color: var(--gate-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 150ms ease, border-color 150ms ease;
}

.desktop-gate-action-primary {
  background: var(--gate-accent-strong);
  border-color: rgba(45, 212, 168, 0.25);
  color: #fff;
}
.desktop-gate-action-primary:hover {
  background: #0a6b58;
  border-color: rgba(45, 212, 168, 0.4);
}

.desktop-gate-action-secondary:hover {
  background: var(--gate-surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.desktop-gate-action-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.desktop-gate-action-sub {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}
.desktop-gate-action-primary .desktop-gate-action-sub {
  color: rgba(255, 255, 255, 0.7);
}

.desktop-gate-tertiary-link {
  margin: 0.6rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gate-text-dim);
}

/* --- Inline text-button links --- */
.desktop-gate-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--gate-accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(45, 212, 168, 0.3);
  text-underline-offset: 2px;
}
.desktop-gate-link:hover {
  text-decoration-color: var(--gate-accent);
}
.desktop-gate-link-prominent {
  font-size: 0.85rem;
  font-weight: 500;
}
.desktop-gate-form-footer-hint {
  font-size: 0.78rem;
  color: var(--gate-text-dim);
  margin: 0 0 0.35rem;
}

/* --- Back button --- */
.desktop-gate-back {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 1rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--gate-text-muted);
  cursor: pointer;
  transition: color 120ms ease;
}
.desktop-gate-back:hover {
  color: var(--gate-text);
}

/* --- Form Panels --- */
.desktop-gate .desktop-auth-panel {
  width: 100%;
  animation: gateSlideIn 200ms ease;
}

.desktop-gate-panel-title {
  margin: 0 0 0.25rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gate-text);
}

.desktop-gate-panel-sub {
  margin: 0 0 1.2rem;
  font-size: 0.85rem;
  color: var(--gate-text-muted);
  line-height: 1.5;
}

/* Override form inputs for dark theme */
.desktop-gate .auth-form-grid input[type="email"],
.desktop-gate .auth-form-grid input[type="password"],
.desktop-gate .auth-form-grid textarea {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--gate-border);
  color: var(--gate-text);
}

.desktop-gate .auth-form-grid input:focus,
.desktop-gate .auth-form-grid textarea:focus {
  border-color: var(--gate-accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 168, 0.15);
}

.desktop-gate .auth-form-grid input::placeholder,
.desktop-gate .auth-form-grid textarea::placeholder {
  color: var(--gate-text-dim);
}

.desktop-gate .auth-label-text {
  color: var(--gate-text-muted);
}

/* Override primary button for dark context */
.desktop-gate .btn-primary {
  background: var(--gate-accent-strong);
  color: #fff;
  border-color: rgba(45, 212, 168, 0.25);
}
.desktop-gate .btn-primary:hover {
  background: #0a6b58;
}

.desktop-gate-form-footer {
  margin-top: 0.85rem;
  text-align: center;
}

/* --- Status message dark overrides --- */
.desktop-gate .auth-status-msg {
  margin-top: 1.2rem;
  text-align: center;
  color: var(--gate-text-muted);
}
.desktop-gate .auth-status-msg.status-error {
  color: #f87171;
}
.desktop-gate .auth-status-msg.status-success {
  color: var(--gate-accent);
}

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

.auth-form-grid {
  display: grid;
  gap: 1.1rem;
}

.auth-label {
  display: grid;
  gap: 0.35rem;
}

.auth-label-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.auth-form-grid input[type="email"],
.auth-form-grid input[type="password"],
.auth-form-grid textarea {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1.5px solid rgba(31, 29, 26, 0.15);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-form-grid textarea {
  min-height: 112px;
  resize: vertical;
}

.auth-form-grid input:focus,
.auth-form-grid textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 124, 102, 0.12);
}

.auth-form-grid input::placeholder,
.auth-form-grid textarea::placeholder {
  color: rgba(91, 87, 80, 0.45);
}

.auth-submit {
  margin-top: 0.5rem;
  padding: 0.72rem 1.2rem;
  font-size: 0.95rem;
  border-radius: 10px;
}

.auth-status-msg {
  margin: 1.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.auth-status-msg.status-error {
  color: var(--danger);
}

.auth-status-msg.status-success {
  color: var(--primary);
}

.desktop-checkout-result {
  margin-top: 1rem;
  border: 1px solid rgba(13, 124, 102, 0.22);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: rgba(13, 124, 102, 0.06);
  display: grid;
  gap: 0.7rem;
}

.desktop-checkout-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.desktop-checkout-page-card {
  width: min(760px, 100%);
  border: 1px solid rgba(31, 29, 26, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(20, 18, 16, 0.1);
  padding: 1.4rem 1.4rem 1.2rem;
}

.desktop-checkout-page-brand {
  display: inline-block;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.desktop-checkout-page-brand:hover {
  text-decoration: underline;
}

.desktop-checkout-page h1 {
  margin: 0;
}

.desktop-checkout-page-lead {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.desktop-checkout-page-message {
  margin-top: 0.75rem;
  text-align: left;
}

.desktop-checkout-page .desktop-checkout-result {
  margin-top: 0.75rem;
  border-color: rgba(13, 124, 102, 0.3);
  background: rgba(13, 124, 102, 0.1);
}

.desktop-checkout-page .desktop-checkout-actions {
  justify-content: flex-start;
}

.desktop-checkout-page-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.membership-success-page-card {
  max-width: 720px;
  text-align: center;
}

.membership-success-summary {
  margin-top: 0.9rem;
}

.membership-success-summary p {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* --- Success Icon --- */
.success-icon-wrap {
  text-align: center;
  margin-bottom: 1rem;
}

/* --- Membership Success Checklist --- */
.membership-success-checklist {
  display: inline-flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0;
  text-align: left;
}

.success-checklist-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.success-checklist-item svg {
  flex-shrink: 0;
}

.membership-success-actions {
  justify-content: center;
}

/* --- Billing Wall --- */
.billing-wall-page-card {
  max-width: 520px;
  text-align: center;
}

.billing-wall-actions {
  justify-content: center;
}

.billing-wall-signout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.75rem;
  text-decoration: underline;
}

.billing-wall-signout:hover {
  color: var(--primary);
}

/* --- Desktop License Prominent Display --- */
.desktop-license-prominent {
  text-align: center;
  padding: 1.25rem;
  border: none;
  background: transparent;
}

.desktop-license-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.desktop-license-code {
  display: block;
  font-size: 1.1rem;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  background: rgba(13, 124, 102, 0.06);
  border: 1.5px solid rgba(13, 124, 102, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  word-break: break-all;
  user-select: all;
  letter-spacing: 0.04em;
}

.desktop-checkout-inline {
  margin-top: 0.25rem;
  flex-basis: 100%;
}

.desktop-checkout-summary {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink);
}

.desktop-checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.desktop-checkout-license {
  display: grid;
  gap: 0.35rem;
}

.desktop-checkout-license span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 29, 26, 0.55);
}

.desktop-checkout-license code {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(31, 29, 26, 0.14);
  background: rgba(255, 255, 255, 0.8);
  padding: 0.55rem 0.65rem;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-all;
}

/* --- Footer --- */
.landing-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.7);
  padding: 3rem 0 1.5rem;
  position: relative;
  z-index: 1;
}

.landing-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-footer-brand strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  color: #fff;
}

.landing-footer-brand p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
}

.landing-footer-org {
  opacity: 0.5;
  font-size: 0.78rem !important;
}

.landing-footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.landing-footer-col h4 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
}

.landing-footer-col a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.88rem;
  transition: color 150ms;
}

.landing-footer-col a:hover {
  color: #fff;
}

.landing-footer-bottom {
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  opacity: 0.5;
}

.landing-footer-bottom p {
  margin: 0;
}

/* --- Landing Mobile --- */
@media (max-width: 768px) {
  .desktop-gate {
    padding: 1.25rem;
  }

  .desktop-checkout-page-actions {
    flex-direction: column;
  }

  .landing-container {
    padding: 0 1.25rem;
  }

  .landing-nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(247, 245, 239, 0.97);
    backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    gap: 0.8rem;
  }

  .landing-nav.landing-nav-open .landing-nav-links {
    display: flex;
  }

  .landing-nav-actions {
    display: none;
  }

  .landing-hamburger {
    display: block;
  }

  .landing-hero {
    padding: 3rem 0 2.5rem;
  }

  .landing-hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .landing-hero-title {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
  }

  .landing-hero-sub {
    margin-left: auto;
    margin-right: auto;
    font-size: 1rem;
  }

  .landing-hero-ctas {
    justify-content: center;
  }

  .landing-pain-outcome {
    padding: 3rem 0;
  }

  .landing-ba-card {
    grid-template-columns: 1fr;
  }

  .landing-ba-divider {
    padding: 0.75rem 0;
  }

  .landing-ba-divider svg {
    transform: rotate(90deg);
  }

  .landing-ba-before {
    border-left: none;
    border-top: 3px solid var(--danger);
  }

  .landing-ba-after {
    border-right: none;
    border-bottom: 3px solid var(--primary);
  }

  .landing-features {
    padding: 3.5rem 0 2rem;
  }

  .landing-feature-row,
  .landing-feature-row.landing-feature-row-reverse {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .landing-feature-row-reverse .landing-feature-text,
  .landing-feature-row-reverse .landing-feature-visual {
    order: unset;
  }

  .landing-how {
    padding: 3.5rem 0;
  }

  .landing-steps {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .landing-steps::before {
    display: none;
  }

  .landing-testimonials {
    padding: 3.5rem 0;
  }

  .landing-testimonial-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .landing-pricing-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .landing-final-cta {
    padding: 3.5rem 0;
  }

  .landing-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .landing-footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .landing-footer-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Panel (shared)
   ========================= */
.panel {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 14px 32px rgba(31, 29, 26, 0.08);
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
}

.panel h3 {
  margin: 0 0 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
}

/* =========================
   Form Elements
   ========================= */
.form-grid {
  display: grid;
  gap: 0.7rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(31, 29, 26, 0.2);
  padding: 0.62rem 0.7rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
}

textarea {
  resize: vertical;
  min-height: 180px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  margin-right: 0.5rem;
}

/* =========================
   Buttons
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 120ms ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-ghost {
  background: rgba(13, 124, 102, 0.1);
  color: var(--primary-strong);
}

.btn-ghost:hover {
  background: rgba(13, 124, 102, 0.18);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* =========================
   Utilities
   ========================= */
.panel-title-row,
.control-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.status-error {
  color: #a4302f;
}

.status-success {
  color: #0d7c66;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(31, 29, 26, 0.12);
  overflow: hidden;
}

.weekly-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 300ms ease;
  border-radius: 999px;
}

/* =========================
   App Shell
   ========================= */
#appShell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* --- Full-width header bar (dashboard only) --- */
#appShell:not(.route-dashboard) > .dash-banner {
  display: none;
}

#appShell > .dash-banner {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0;
  padding: 1.2rem 18% 0 calc(var(--sidebar-width) + 0.5rem);
  position: relative;
  background: #2d3436;
}

/* Brand logo inside the dark dashboard header */
.dash-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  left: 0.8rem;
  transform: translateY(-50%);
  width: calc(var(--sidebar-width) - 1.6rem);
  color: #ffffff;
}

.dash-brand .storyrise-logo {
  width: 85%;
  height: auto;
}

#appShell > .dash-banner .dash-banner-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
}

/* Sidebar — row 2 on dashboard, row 1 otherwise */
#appShell.route-dashboard > #sidebar {
  grid-row: 2;
  grid-column: 1;
  align-self: start;
}

/* Sidebar brand — visible by default, hidden on dashboard */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 116px;
  margin-top: -1.2rem;
  padding: 0;
  color: var(--primary-strong);
}

.sidebar-brand .storyrise-logo {
  width: 85%;
  height: auto;
}

.route-dashboard .sidebar-brand {
  display: none;
}

/* ViewContainer — row 2 on dashboard, row 1 otherwise */
#appShell.route-dashboard > #viewContainer {
  grid-row: 2;
  grid-column: 2;
}

/* Dashboard view gets top padding since banner is moved out */
[data-view="dashboard"] {
  padding-top: 2rem;
}

/* =========================
   Sidebar
   ========================= */
#sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0.8rem;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: none;
  border-right: none;
  overflow-y: auto;
  z-index: 10;
}

/* .sidebar-brand styles are in the layout section above */

.storyrise-logo {
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: rgba(13, 124, 102, 0.08);
  color: var(--ink);
}

.nav-item.active {
  background: rgba(13, 124, 102, 0.14);
  color: var(--primary-strong);
  font-weight: 600;
}

.nav-item.has-celebrations {
  position: relative;
}

.nav-item.has-celebrations::after {
  content: '';
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  pointer-events: none;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* =========================
   Focus Mode — sidebar collapse
   ========================= */
#appShell.focus-active {
  grid-template-columns: 60px 1fr;
  transition: grid-template-columns 0.25s ease;
}

#sidebar.sidebar-focus {
  width: 60px;
  padding: 1rem 0.4rem;
  align-items: center;
  transition: width 0.25s ease, padding 0.25s ease;
}

#sidebar.sidebar-focus .sidebar-brand { display: none; }
#sidebar.sidebar-focus .nav-label { display: none; }
#sidebar.sidebar-focus .sidebar-nav-divider { display: none; }

#sidebar.sidebar-focus .sidebar-spacer { display: none; }
#sidebar.sidebar-focus .sidebar-footer { display: none; }
#sidebar.sidebar-focus .notif-badge { left: 14px; top: 0; }

#sidebar.sidebar-focus .nav-item {
  justify-content: center;
  padding: 0.55rem;
  border-radius: 8px;
  width: auto;
}

#sidebar.sidebar-focus .nav-bell {
  justify-content: center;
  padding: 0.55rem;
}

.nav-bell {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  left: 28px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
}

.notif-badge:empty,
.notif-badge[data-count="0"] {
  display: none;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-footer {
  padding: 0.8rem 0.6rem 0;
  border-top: 1px solid var(--panel-border);
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-email {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

/* =========================
   Writing Heat — GitHub-style contribution graph
   ========================= */

/* Outer wrapper generated by JS inside #momentumHeatmap */
.heat-months {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.heat-month {
  font-size: 0.7rem;
  color: var(--muted);
}

.heat-body {
  display: flex;
  gap: 3px;
  align-items: start;
}

.heat-day-labels {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  gap: 3px;
  width: 28px;
  flex-shrink: 0;
}

.heat-day-labels span {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 11px;
  text-align: right;
  padding-right: 4px;
}

.heat-grid {
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  overflow-x: auto;
}

.momentum-heat-cell {
  border-radius: 2px;
  background: rgba(123, 140, 156, 0.18);
}

.momentum-heat-cell.heat-future {
  background: transparent;
}

.momentum-heat-cell.lvl-0 { background: rgba(123, 140, 156, 0.18); }
.momentum-heat-cell.lvl-1 { background: rgba(95, 193, 180, 0.55); }
.momentum-heat-cell.lvl-2 { background: rgba(41, 186, 166, 0.72); }
.momentum-heat-cell.lvl-3 { background: rgba(14, 160, 170, 0.88); }
.momentum-heat-cell.lvl-4 { background: rgba(8, 122, 188, 0.95); }

.momentum-heat-cell:not(.heat-future):hover {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

/* Legend row below the graph */
.momentum-heat-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.momentum-heat-legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
}

.momentum-heat-legend .heat-lvl-0 { background: rgba(123, 140, 156, 0.18); }
.momentum-heat-legend .heat-lvl-1 { background: rgba(95, 193, 180, 0.55); }
.momentum-heat-legend .heat-lvl-2 { background: rgba(41, 186, 166, 0.72); }
.momentum-heat-legend .heat-lvl-3 { background: rgba(14, 160, 170, 0.88); }
.momentum-heat-legend .heat-lvl-4 { background: rgba(8, 122, 188, 0.95); }


/* =========================
   View Container
   ========================= */
#viewContainer {
  min-height: 100vh;
  overflow-y: auto;
}

[data-view] {
  display: none;
  padding: 2rem;
  animation: viewFadeIn 200ms ease;
}

[data-view].active {
  display: block;
}

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

.view-content {
  max-width: 960px;
}

.view-content-narrow {
  max-width: 720px;
}

.view-title {
  margin: 0 0 1.2rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.6rem;
}

/* =========================
   Dashboard View — Reedsy Learning-inspired
   ========================= */

/* Full-width dark banner */
[data-view="dashboard"] {
  padding-top: 0;
}

.dash-banner {
  margin: 0 -2rem;          /* break out of [data-view] padding */
  background: #2d3436;
  padding: 2.5rem 2rem 0;
}

.dash-banner-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.dash-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.8rem 0.5rem 0;
}

.dash-title {
  grid-column: 1;
  margin: 0 0 0.25rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.dash-subtitle {
  grid-column: 1;
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  max-width: 600px;
}

/* Category Navigation inside dark banner */
.dash-nav {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: end;
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0;
}

.dash-nav-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color 150ms, border-color 150ms;
  text-decoration: none;
}

.dash-nav-link:hover {
  color: #ffffff;
}

.dash-nav-link.dash-nav-link-active {
  color: #ffffff;
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Content header row (count + filters) */
.dash-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.dash-count {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 500;
}

/* Section blocks within tabs */
.dash-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--panel-border);
}

.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dash-section-head h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

/* =========================
   Performance Tab — Cohesive integrated page
   ========================= */
.perf-page {
  max-width: 1100px;
  margin: 0 auto;
}

/* Top metrics bar — flat, no cards */
.perf-metrics-bar {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--panel-border);
}

.perf-readiness {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  flex-shrink: 0;
}

.perf-readiness strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--primary-strong);
}

.perf-readiness span {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.perf-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.perf-stat-value {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}

.perf-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.perf-stat-membership {
  margin-left: auto;
}

/* Section dividers — no card panels, just clean separators */
.perf-section {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--panel-border);
}

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

.perf-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.perf-section-head h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
}

/* Bottom row — membership + quick actions inline */
.perf-bottom-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.perf-billing-inline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

.perf-billing-inline h3 {
  margin: 0 0 0.25rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.perf-billing-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.perf-quick-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

/* Override panel styling within Performance tab — remove card look */
#viewProgress .panel {
  background: transparent;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* =========================
   Dashboard Emblems — game-style award grid
   ========================= */
.dash-emblems-grid {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.dash-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  position: relative;
  transition: opacity 0.15s ease;
}

.dash-emblem-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(200, 200, 200, 0.2);
  transition: background 0.15s ease, transform 0.15s ease;
}

.dash-emblem-name {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  max-width: 68px;
  line-height: 1.15;
}

/* Locked — dimmed & grayscale (target children, not container, so popover stays opaque) */
.dash-emblem.locked .dash-emblem-icon {
  opacity: 0.38;
  filter: grayscale(1);
}

.dash-emblem.locked .dash-emblem-name {
  opacity: 0.38;
}

.dash-emblem.locked:hover .dash-emblem-icon,
.dash-emblem.locked:hover .dash-emblem-name {
  opacity: 0.55;
}

/* Unlocked — warm highlight */
.dash-emblem.unlocked .dash-emblem-icon {
  background: rgba(255, 232, 155, 0.5);
}

.dash-emblem.unlocked .dash-emblem-name {
  color: var(--ink);
}

.dash-emblem.unlocked:hover .dash-emblem-icon {
  transform: scale(1.08);
  background: rgba(255, 232, 155, 0.75);
}

/* Celebration animation for newly unlocked emblems */
@keyframes emblem-celebrate {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 232, 155, 0); }
  30% { transform: scale(1.22); box-shadow: 0 0 18px 6px rgba(255, 232, 155, 0.7); }
  60% { transform: scale(1.08); box-shadow: 0 0 12px 3px rgba(255, 232, 155, 0.4); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 232, 155, 0); }
}
.dash-emblem.celebrating .dash-emblem-icon {
  animation: emblem-celebrate 1.2s ease forwards;
  background: rgba(255, 232, 155, 0.65);
}
.dash-emblem.celebrating .dash-emblem-name {
  color: var(--ink);
  opacity: 1;
}

/* Emblem detail popover */
.emblem-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  min-width: 210px;
  max-width: 260px;
  box-shadow: 0 6px 20px rgba(31, 29, 26, 0.15);
  white-space: normal;
}

.emblem-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--panel-border);
  border-top: 1px solid var(--panel-border);
}

.emblem-popover-icon {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}

.emblem-popover-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.15rem;
}

.emblem-popover-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.4;
}

.emblem-popover-status {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  margin: 0;
}

.emblem-popover-status.is-locked {
  color: var(--muted);
  font-weight: 500;
}

/* Training tab cards */
.dash-training-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.dash-training-card {
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  padding: 0;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  transition: box-shadow 200ms, transform 200ms;
}

.dash-training-card:hover {
  box-shadow: 0 6px 24px rgba(31, 29, 26, 0.1);
  transform: translateY(-2px);
}

.dash-training-card-accent {
  height: 120px;
  background: linear-gradient(135deg, var(--primary), #0bae91);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-training-accent-blue {
  background: linear-gradient(135deg, var(--track-publishing), #3a8fd4);
}

.dash-training-accent-purple {
  background: linear-gradient(135deg, var(--track-learning), #9b6dd7);
}

.dash-training-label {
  display: inline-block;
  margin: 1rem 1rem 0.25rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(13, 124, 102, 0.08);
  border-radius: 4px;
}

.dash-training-label-blue {
  color: var(--track-publishing);
  background: rgba(0, 95, 163, 0.08);
}

.dash-training-label-purple {
  color: var(--track-learning);
  background: rgba(105, 67, 176, 0.08);
}

.dash-training-card h3 {
  margin: 0.4rem 1rem 0.3rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.dash-training-card p {
  margin: 0 1rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Legacy compat — keep greeting-row for non-dashboard usage */
.greeting-row {
  margin-bottom: 0.5rem;
}

.dashboard-metrics {
  margin-bottom: 1.5rem;
}

.metric-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.readiness-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.readiness-ring strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--primary-strong);
}

.readiness-ring span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  flex: 1;
}

.stat-card {
  border-radius: 12px;
  border: 1px solid rgba(31, 29, 26, 0.12);
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.9);
  flex: 1;
  min-width: 120px;
}

.stat-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.2rem;
  font-family: "Fraunces", Georgia, serif;
}

.dashboard-focus,
.dashboard-progress,
.dashboard-writing-heat,
.dashboard-billing {
  margin-bottom: 1rem;
}

.focus-task {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.focus-task-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.focus-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* =========================
   Billing
   ========================= */
.billing-status-card {
  border-radius: 12px;
  border: 1px solid rgba(31, 29, 26, 0.12);
  padding: 0.65rem;
  margin-bottom: 0.7rem;
  background: rgba(255, 255, 255, 0.9);
}

#billingStatusLabel {
  margin: 0.2rem 0;
  font-size: 1.1rem;
  font-weight: 700;
}

/* =========================
   Write View
   ========================= */
[data-view="write"] {
  padding: 0;
}

[data-view="write"].active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.write-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(14, 39, 54, 0.1);
  margin: 0;
  padding: 0.6rem 0.75rem;
}

.write-topbar:empty {
  display: none;
}

.write-topbar.v2-dark {
  background: #0d1117;
  border-bottom: 1px solid rgba(230, 237, 243, 0.08);
}

.write-topbar .v2-topbar-row {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 0.5rem;
  justify-content: center;
}

.write-topbar .v2-topbar-actions {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.4rem;
  justify-content: flex-end;
}

.write-topbar .v2-editor-topbar-center {
  justify-content: center;
}

.v2-topbar-save {
  flex: 1;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  min-width: 0;
  opacity: 0.4;
  white-space: nowrap;
}

.write-topbar .v2-topbar-actions .btn.active {
  background: rgba(13, 124, 102, 0.18);
  box-shadow: inset 0 0 0 1px rgba(13, 124, 102, 0.3);
}

/* =========================
   Task Items
   ========================= */
.task-list {
  display: grid;
  gap: 0.55rem;
}

.task-item {
  border: 1px solid rgba(31, 29, 26, 0.1);
  border-radius: 12px;
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.9);
}

.task-item-active {
  border-left: 4px solid var(--primary);
}

.task-snoozed {
  opacity: 0.75;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.task-title {
  margin: 0;
  font-size: 0.95rem;
}

.task-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.task-note-input {
  margin-top: 0.4rem;
}

.tasks-summary {
  margin-bottom: 0.8rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

/* =========================
   Track Pills
   ========================= */
.track-pill {
  display: inline-block;
  width: fit-content;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid rgba(31, 29, 26, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.task-writing { color: var(--track-writing); }
.task-publishing { color: var(--track-publishing); }
.task-marketing { color: var(--track-marketing); }
.task-relationship { color: var(--track-relationship); }
.task-learning { color: var(--track-learning); }
.task-general { color: var(--track-general); }

/* =========================
   Scrollable Lists
   ========================= */
.chunk-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
  max-height: 400px;
  overflow: auto;
}

/* =========================
   Notification Drawer
   ========================= */
.notif-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 29, 26, 0.3);
  z-index: 90;
}

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw - 1rem);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--panel-border);
  box-shadow: -8px 0 32px rgba(31, 29, 26, 0.12);
  z-index: 95;
  padding: 1.2rem;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 200ms ease;
}

.notif-drawer.open {
  transform: translateX(0);
}

.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.notif-drawer-header h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.notif-item {
  border-radius: 12px;
  border: 1px solid rgba(31, 29, 26, 0.1);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.65rem;
}

.notif-item p {
  margin: 0.2rem 0;
}

.notif-unread {
  border-left: 4px solid var(--primary);
}

.notif-kind-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 29, 26, 0.16);
  border-radius: 999px;
  padding: 0.08rem 0.46rem;
  background: rgba(241, 238, 227, 0.8);
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* =========================
   Settings
   ========================= */
.settings-section {
  margin-bottom: 1.2rem;
}

/* =========================
   Onboarding Overlay
   ========================= */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 245, 239, 0.97);
  backdrop-filter: blur(8px);
  padding: 1.5rem;
  overflow-y: hidden;
}

.onboarding-overlay[hidden] {
  display: none !important;
}

.onboarding-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: onboardFadeIn 300ms ease;
}

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

.onboarding-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 29, 26, 0.1);
  overflow: hidden;
  margin-bottom: 2rem;
}

.onboarding-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 300ms ease;
  border-radius: 999px;
}

.onboard-step {
  text-align: center;
  animation: onboardStepIn 250ms ease;
}

.onboard-step[hidden] {
  display: none !important;
}

.onboard-step.onboard-step-active {
  display: block;
}

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

.onboard-step h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  margin: 0 0 0.6rem;
}

.onboard-step .muted {
  margin: 0 0 1.5rem;
}

.onboard-cta {
  padding: 0.7rem 2rem;
  font-size: 1rem;
  margin-top: 1rem;
}

.onboard-cards {
  display: grid;
  gap: 0.6rem;
  text-align: left;
}

.onboard-cards-grid {
  grid-template-columns: repeat(2, 1fr);
}

.onboard-option {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 2px solid rgba(31, 29, 26, 0.12);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.onboard-option:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(13, 124, 102, 0.12);
  transform: translateY(-1px);
}

.onboard-option:active {
  transform: translateY(0);
}

.onboard-option.selected {
  border-color: var(--primary);
  background: rgba(13, 124, 102, 0.06);
}

.onboard-option strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.onboard-option span {
  font-size: 0.82rem;
  color: var(--muted);
}

.onboard-option-default {
  border-color: rgba(13, 124, 102, 0.3);
}

.onboard-checkbox {
  margin-top: 1rem;
  justify-content: center;
  font-size: 0.9rem;
}

.onboard-channel-panel {
  margin-top: 0.9rem;
  text-align: left;
}

.onboard-summary {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.onboard-summary-stat {
  text-align: center;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.9);
  min-width: 130px;
}

.onboard-summary-stat strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  color: var(--primary-strong);
}

.onboard-summary-stat span {
  font-size: 0.78rem;
  color: var(--muted);
}

/* =========================
   Sidebar Visual Refresh
   ========================= */
.sidebar-nav-divider {
  height: 1px;
  background: var(--panel-border);
  margin: 0.35rem 0.5rem;
}

.nav-item.active {
  background: rgba(13, 124, 102, 0.1);
  color: var(--primary-strong);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: calc(0.7rem - 3px);
}

.nav-item-admin {
  color: var(--track-publishing);
}

.nav-item-admin.active {
  border-left-color: var(--track-publishing);
  color: var(--track-publishing);
}

/* =========================
   Dashboard Tabs (legacy compat + hidden state)
   ========================= */
.dashboard-tab-content[hidden] {
  display: none !important;
}

/* =========================
   Marketplace Tab
   ========================= */
.mp-category-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mp-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 150ms;
}

.mp-chip:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.mp-chip.mp-chip-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.mp-provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.mp-provider-card {
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  padding: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 200ms, transform 200ms;
}

.mp-provider-card:hover {
  box-shadow: 0 6px 24px rgba(31, 29, 26, 0.1);
  transform: translateY(-2px);
}

.mp-provider-card.mp-provider-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.mp-provider-card-accent {
  height: 80px;
  background: linear-gradient(135deg, var(--primary), #0bae91);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-provider-card-accent-illustration {
  background: linear-gradient(135deg, var(--track-relationship), #b84d8e);
}

.mp-provider-card-accent-marketing {
  background: linear-gradient(135deg, var(--track-marketing), #d48244);
}

.mp-provider-card-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.mp-provider-card-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mp-provider-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--track-publishing));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 2px solid #fff;
  margin-top: -28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.mp-provider-type-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 0.1rem;
}

.mp-provider-type-label-illustration {
  color: var(--track-relationship);
}

.mp-provider-type-label-marketing {
  color: var(--track-marketing);
}

.mp-provider-info h4 {
  margin: 0;
  font-size: 1.1rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
}

.mp-provider-categories {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.mp-category-pill {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.mp-cat-editing { background: rgba(13, 124, 102, 0.1); color: var(--primary-strong); }
.mp-cat-illustration { background: rgba(138, 45, 111, 0.1); color: var(--track-relationship); }
.mp-cat-marketing { background: rgba(170, 74, 0, 0.1); color: var(--track-marketing); }
.mp-cat-default { background: rgba(87, 83, 78, 0.1); color: var(--track-general); }

.mp-provider-bio {
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  flex: 1;
}

.mp-provider-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--panel-border);
}

.mp-provider-exp {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* Request & Project lists */
.mp-list {
  display: grid;
  gap: 0.55rem;
}

.mp-request-item,
.mp-project-item {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 150ms;
}

.mp-request-item:hover,
.mp-project-item:hover {
  border-color: rgba(13, 124, 102, 0.25);
}

.mp-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.mp-item-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.mp-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.mp-meta-text {
  font-size: 0.82rem;
  color: var(--muted);
}

.mp-item-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0.25rem 0 0.5rem;
}

.mp-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

/* Status badges */
.mp-status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mp-status-open { background: rgba(13, 124, 102, 0.1); color: var(--primary); }
.mp-status-proposal { background: rgba(0, 95, 163, 0.1); color: var(--track-publishing); }
.mp-status-accepted { background: rgba(13, 124, 102, 0.12); color: var(--primary-strong); }
.mp-status-canceled { background: rgba(164, 48, 47, 0.1); color: var(--danger); }
.mp-status-awaiting { background: rgba(170, 74, 0, 0.1); color: var(--track-marketing); }
.mp-status-funded { background: rgba(0, 95, 163, 0.1); color: var(--track-publishing); }
.mp-status-delivered { background: rgba(105, 67, 176, 0.1); color: var(--track-learning); }
.mp-status-completed { background: rgba(13, 124, 102, 0.12); color: var(--primary-strong); }
.mp-status-default { background: rgba(87, 83, 78, 0.1); color: var(--track-general); }

/* Request detail view */
.mp-detail-view {
  display: grid;
  gap: 0.75rem;
}

.mp-back-btn {
  justify-self: start;
}

.mp-detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mp-detail-header h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.mp-detail-desc {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

.mp-detail-targets {
  padding: 0.65rem;
  background: rgba(247, 245, 239, 0.5);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.mp-target-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.mp-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--panel-border);
  font-size: 0.82rem;
}

.mp-target-status {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: capitalize;
}

.mp-section-title {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}

.mp-proposals-list {
  display: grid;
  gap: 0.5rem;
}

.mp-proposal-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.95);
}

.mp-proposal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.mp-proposal-details {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.mp-proposal-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-strong);
}

.mp-proposal-scope {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.3rem 0;
}

.mp-proposal-terms {
  margin: 0.2rem 0;
}

/* New request form */
.mp-new-request-form {
  margin-bottom: 1rem;
}

.mp-form-grid {
  display: grid;
  gap: 0.75rem;
}

.mp-form-label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}

.mp-form-input {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.95);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 150ms;
}

.mp-form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(13, 124, 102, 0.15);
}

.mp-form-row {
  display: flex;
  gap: 0.65rem;
}

.mp-form-half {
  flex: 1;
}

.mp-form-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.mp-selected-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.mp-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(13, 124, 102, 0.08);
  border: 1px solid rgba(13, 124, 102, 0.2);
  font-size: 0.82rem;
  color: var(--primary-strong);
}

.mp-chip-remove {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.mp-chip-remove:hover {
  color: var(--danger);
}

/* Loading & empty states */
.mp-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.mp-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--panel-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: mp-spin 0.7s linear infinite;
}

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

.mp-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* =========================
   Training Tab
   ========================= */
.training-empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.training-empty-icon {
  color: var(--muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.training-empty-state h3 {
  font-family: "Fraunces", Georgia, serif;
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.training-empty-state p {
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.55;
}

/* =========================
   Admin Panel
   ========================= */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--panel-border);
  margin-bottom: 1.5rem;
}

.admin-tab {
  padding: 0.6rem 1.1rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color 150ms, border-color 150ms;
}

.admin-tab:hover {
  color: var(--ink);
}

.admin-tab.admin-tab-active {
  color: var(--track-publishing);
  border-bottom-color: var(--track-publishing);
  font-weight: 600;
}

.admin-panel[hidden] {
  display: none !important;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.admin-list {
  display: grid;
  gap: 0.6rem;
}

.admin-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.admin-card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.admin-status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.admin-status-pending { background: rgba(170, 74, 0, 0.1); color: #aa4a00; }
.admin-status-approved { background: rgba(13, 124, 102, 0.1); color: var(--primary); }
.admin-status-rejected { background: rgba(164, 48, 47, 0.1); color: var(--danger); }
.admin-status-funded { background: rgba(0, 95, 163, 0.1); color: #005fa3; }
.admin-status-released { background: rgba(13, 124, 102, 0.1); color: var(--primary); }

.admin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.admin-card-categories {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.admin-card-bio {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0.25rem 0 0.4rem;
}

.admin-card-link {
  font-size: 0.83rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.admin-card-link:hover {
  text-decoration: underline;
}

.admin-review-notes {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0.3rem 0;
  padding: 0.5rem;
  background: rgba(247, 245, 239, 0.5);
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.admin-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.admin-filter-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-filter-select {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.95);
  font-family: inherit;
  font-size: 0.86rem;
  transition: border-color 150ms;
}

.admin-filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.admin-inline-form {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(247, 245, 239, 0.6);
  border: 1px solid var(--panel-border);
}

.admin-invite-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: rgba(13, 124, 102, 0.05);
  border-radius: 8px;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  border: 1px solid rgba(13, 124, 102, 0.15);
}

.admin-invite-url {
  flex: 1;
  word-break: break-all;
  color: var(--primary);
}

.admin-connect-ok {
  color: var(--primary);
  font-weight: 500;
}

.admin-connect-warning {
  color: var(--danger);
  font-weight: 500;
}

.admin-subtabs {
  margin-bottom: 1rem;
}

.admin-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-search-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.admin-accounts-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-accounts-list {
  position: sticky;
  top: 1rem;
}

.admin-account-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms;
}

.admin-account-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.admin-account-card.is-selected {
  border-color: rgba(13, 124, 102, 0.28);
  box-shadow: 0 10px 22px rgba(13, 124, 102, 0.08);
}

.admin-account-grid,
.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.9rem;
}

.admin-account-grid span,
.admin-detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.admin-account-grid strong,
.admin-detail-grid strong,
.admin-inline-list strong,
.admin-modal-label {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.admin-account-detail,
.admin-access-shell {
  display: grid;
  gap: 0.9rem;
}

.admin-detail-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 1rem 1.05rem;
  display: grid;
  gap: 0.8rem;
}

.admin-detail-card h3,
.admin-detail-card h4 {
  margin: 0;
}

.admin-inline-list {
  display: grid;
  gap: 0.4rem;
}

.admin-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: rgba(247, 245, 239, 0.85);
  border: 1px solid var(--panel-border);
  font-size: 0.75rem;
  color: var(--muted);
}

.admin-empty-state {
  border: 1px dashed var(--panel-border);
  border-radius: 14px;
  background: rgba(247, 245, 239, 0.45);
  padding: 1.2rem;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.admin-empty-state strong {
  color: var(--ink);
}

.admin-empty-state p {
  margin: 0;
  line-height: 1.5;
}

.admin-empty-state-inline {
  min-height: 160px;
  place-content: center;
}

.admin-action-groups {
  display: grid;
  gap: 0.9rem;
}

.admin-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-action-btn {
  justify-content: center;
}

.admin-audit-list {
  display: grid;
  gap: 0.6rem;
}

.admin-audit-item {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(247, 245, 239, 0.55);
  padding: 0.75rem 0.85rem;
  display: grid;
  gap: 0.35rem;
}

.admin-audit-item p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.admin-audit-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 80;
}

.admin-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 81;
  padding: 1rem;
}

.admin-modal-card {
  width: min(560px, 100%);
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.admin-modal-header,
.admin-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.admin-modal-header h3 {
  margin: 0;
}

.admin-modal-body {
  display: grid;
  gap: 0.85rem;
}

.admin-modal-section {
  display: grid;
  gap: 0.35rem;
}

.admin-modal-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-modal-input,
.admin-modal-textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
  padding: 0.6rem 0.75rem;
}

.admin-modal-textarea {
  min-height: 100px;
  resize: vertical;
}

.admin-modal-input:focus,
.admin-modal-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.admin-modal-grid {
  display: grid;
  gap: 0.35rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #8a2626;
}

/* =========================
   Provider Profile Page
   ========================= */
.pp-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  margin-bottom: 1.2rem;
  text-decoration: none;
}

.pp-back:hover {
  color: var(--ink);
  border-color: rgba(31, 29, 26, 0.25);
}

.pp-hero {
  position: relative;
  padding: 2.5rem 2rem 2rem;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  text-align: center;
  overflow: hidden;
}

.pp-hero-editing {
  background: linear-gradient(135deg, rgba(13, 124, 102, 0.14), rgba(9, 95, 78, 0.06));
}

.pp-hero-illustration {
  background: linear-gradient(135deg, rgba(138, 45, 111, 0.14), rgba(105, 67, 176, 0.06));
}

.pp-hero-marketing {
  background: linear-gradient(135deg, rgba(170, 74, 0, 0.14), rgba(170, 74, 0, 0.05));
}

.pp-hero-default {
  background: linear-gradient(135deg, rgba(87, 83, 78, 0.1), rgba(87, 83, 78, 0.04));
}

.pp-hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--track-publishing));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2.2rem;
  margin: 0 auto 1rem;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.pp-hero-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.2rem;
}

.pp-hero-tagline {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.pp-hero-bio-summary {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.55;
}

.pp-hero-location {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Profile Tabs */
.pp-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  border-bottom: 2px solid var(--panel-border);
  margin-bottom: 1.5rem;
}

.pp-tab {
  display: inline-block;
  padding: 0.65rem 1.2rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color 150ms, border-color 150ms;
}

.pp-tab:hover {
  color: var(--ink);
}

.pp-tab.pp-tab-active {
  color: var(--primary-strong);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Two-column layout */
.pp-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

.pp-main {}

.pp-section {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.pp-section-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--ink);
}

.pp-bio-full {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-line;
}

.pp-services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pp-service-tag {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(13, 124, 102, 0.08);
  color: var(--primary-strong);
  border: 1px solid rgba(13, 124, 102, 0.15);
}

.pp-detail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  font-size: 0.88rem;
  color: var(--ink);
}

.pp-detail-row svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.pp-detail-row a {
  color: var(--primary);
  text-decoration: none;
}

.pp-detail-row a:hover {
  text-decoration: underline;
}

/* Portfolio */
.pp-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.pp-portfolio-item {
  display: block;
  border: 1.5px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 150ms, box-shadow 150ms;
}

.pp-portfolio-item:hover {
  border-color: rgba(13, 124, 102, 0.3);
  box-shadow: 0 2px 8px rgba(13, 124, 102, 0.06);
}

.pp-portfolio-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.pp-portfolio-item-url {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar */
.pp-sidebar {
  position: sticky;
  top: 1.5rem;
}

.pp-sidebar-card {
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.pp-sidebar-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--track-publishing));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 auto 0.6rem;
}

.pp-sidebar-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}

.pp-available {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.82rem;
  margin: 0.25rem 0 0.75rem;
}

.pp-cta-btn {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms;
  margin-bottom: 1rem;
}

.pp-cta-btn:hover {
  background: var(--primary-strong);
}

.pp-sidebar-divider {
  height: 1px;
  background: var(--panel-border);
  margin: 0.75rem 0;
}

.pp-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.35rem 0;
  text-align: left;
}

.pp-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--primary);
}

.pp-tab-content {
  display: block;
}

.pp-tab-content[hidden] {
  display: none !important;
}

.pp-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

/* ================================================================
   Desktop Dark Chrome — scoped to Electron / ?storyrise_desktop=1
   All overrides use html.storyrise-desktop-preboot ancestor selector
   so the web app is completely unaffected.
   ================================================================ */

/* --- Custom properties — light editorial chrome --- */
html.storyrise-desktop-preboot {
  --desktop-chrome: rgba(255, 255, 255, 0.98);
  --desktop-chrome-border: rgba(14, 39, 54, 0.06);
  --desktop-chrome-text: rgba(14, 39, 54, 0.82);
  --desktop-chrome-text-muted: rgba(14, 39, 54, 0.42);
  --desktop-chrome-accent: #0d7c66;
  --desktop-chrome-accent-bg: rgba(13, 124, 102, 0.07);
  --desktop-chrome-accent-bg-strong: rgba(13, 124, 102, 0.12);
  --desktop-content-bg: #f8f8f8;
}

/* --- Body --- */
html.storyrise-desktop-preboot body {
  background: var(--desktop-chrome);
}

/* --- Sidebar: seamless light chrome --- */
html.storyrise-desktop-preboot #sidebar {
  background: var(--desktop-chrome);
  backdrop-filter: none;
  border-right: none;
}

html.storyrise-desktop-preboot .sidebar-brand {
  color: var(--desktop-chrome-text);
}

/* --- Nav items --- */
html.storyrise-desktop-preboot .nav-item {
  color: var(--desktop-chrome-text-muted);
}

html.storyrise-desktop-preboot .nav-item:hover {
  background: var(--desktop-chrome-accent-bg);
  color: var(--desktop-chrome-text);
}

html.storyrise-desktop-preboot .nav-item.active {
  background: var(--desktop-chrome-accent-bg-strong);
  color: var(--desktop-chrome-accent);
}

html.storyrise-desktop-preboot .nav-item .nav-icon {
  color: inherit;
}

/* --- Nav divider, bell, badge --- */
html.storyrise-desktop-preboot .sidebar-nav-divider {
  background: var(--desktop-chrome-border);
}

html.storyrise-desktop-preboot .nav-bell {
  color: var(--desktop-chrome-text-muted);
}

html.storyrise-desktop-preboot .nav-bell:hover {
  background: var(--desktop-chrome-accent-bg);
  color: var(--desktop-chrome-text);
}

/* --- Sidebar footer --- */
html.storyrise-desktop-preboot .sidebar-footer {
  border-top-color: var(--desktop-chrome-border);
}

html.storyrise-desktop-preboot .sidebar-email {
  color: var(--desktop-chrome-text-muted);
}

html.storyrise-desktop-preboot .sidebar-footer .btn-ghost {
  background: rgba(14, 39, 54, 0.04);
  color: var(--desktop-chrome-text-muted);
}

html.storyrise-desktop-preboot .sidebar-footer .btn-ghost:hover {
  background: rgba(14, 39, 54, 0.08);
  color: var(--desktop-chrome-text);
}

/* --- Focus mode (collapsed sidebar) --- */
html.storyrise-desktop-preboot #sidebar.sidebar-focus {
  background: var(--desktop-chrome);
}

/* --- Desktop: icon-only slim sidebar --- */
html.storyrise-desktop-preboot {
  --sidebar-width: 54px;
}

html.storyrise-desktop-preboot #sidebar {
  width: 54px;
  padding: 0.6rem 0.35rem;
  align-items: center;
  overflow: visible;
}

/* Show only the quill mark, hide the "Storyrise" text.
   The SVG viewBox is "0 0 186 44" — the quill mark occupies ~x:0-30, y:0-37.
   We render the SVG at natural height so the mark is large, then clip with overflow. */
html.storyrise-desktop-preboot .sidebar-brand {
  overflow: hidden;
  min-height: auto;
  margin: 0 0 0.25rem 0;
  padding: 0.35rem 0;
  justify-content: flex-start;   /* keep quill mark at left edge of clip */
  width: 42px;
  align-self: center;
}
html.storyrise-desktop-preboot .sidebar-brand .storyrise-logo {
  width: auto;
  height: 44px;
  flex-shrink: 0;
  margin-left: 4px;              /* center the ~30px mark in the 42px container */
  overflow: visible;
}
html.storyrise-desktop-preboot .sidebar-brand .storyrise-logo text {
  display: none;
}

html.storyrise-desktop-preboot .nav-label { display: none; }
html.storyrise-desktop-preboot .sidebar-nav-divider {
  width: 24px;
  margin: 0.15rem auto;
}
html.storyrise-desktop-preboot .sidebar-spacer { flex: 1 1 auto; }

html.storyrise-desktop-preboot .nav-item {
  justify-content: center;
  padding: 0.5rem;
  border-radius: 10px;
  width: auto;
  gap: 0;
}

html.storyrise-desktop-preboot .nav-bell {
  justify-content: center;
  padding: 0.5rem;
}
html.storyrise-desktop-preboot .nav-bell .notif-badge {
  left: 50%;
  top: 0;
  transform: translateX(2px);
}

html.storyrise-desktop-preboot .sidebar-footer {
  width: 100%;
  padding: 0.3rem 0 0;
  border-top-color: var(--desktop-chrome-border);
}
html.storyrise-desktop-preboot .sidebar-email { display: none; }
html.storyrise-desktop-preboot .sidebar-footer .btn-ghost {
  font-size: 0;
  padding: 0.45rem;
  min-width: 0;
  justify-content: center;
  border-radius: 10px;
}
/* Show a door/exit icon via SVG for the logout button */
html.storyrise-desktop-preboot .sidebar-footer .btn-ghost::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

/* --- Content area: seamless with chrome --- */
html.storyrise-desktop-preboot #viewContainer {
  background: var(--desktop-content-bg);
  border-radius: 0;
}

html.storyrise-desktop-preboot [data-view] {
  color: var(--ink);
}

/* --- View titles --- */
html.storyrise-desktop-preboot .view-title {
  color: var(--ink);
}

/* -----------------------------------------------
   Desktop Settings Page — flat sections, no glass
   ----------------------------------------------- */
html.storyrise-desktop-preboot .settings-section.panel {
  background: transparent;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 1.2rem 0;
  border-bottom: 1px solid rgba(31, 29, 26, 0.10);
}

html.storyrise-desktop-preboot .settings-section.panel:last-child {
  border-bottom: none;
}

html.storyrise-desktop-preboot .settings-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.8rem;
}

html.storyrise-desktop-preboot .settings-section label {
  font-weight: 500;
  color: var(--ink);
}

/* Desktop buttons — squared, not pills */
html.storyrise-desktop-preboot .settings-section .btn {
  border-radius: 6px;
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
}

html.storyrise-desktop-preboot .settings-section .btn-ghost {
  background: transparent;
  border: 1px solid rgba(31, 29, 26, 0.20);
  color: var(--ink);
}

html.storyrise-desktop-preboot .settings-section .btn-ghost:hover {
  background: rgba(31, 29, 26, 0.06);
}

/* Desktop form inputs — squared to match buttons */
html.storyrise-desktop-preboot .settings-section select,
html.storyrise-desktop-preboot .settings-section input[type="text"],
html.storyrise-desktop-preboot .settings-section input[type="time"] {
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(31, 29, 26, 0.18);
}

/* -----------------------------------------------
   Desktop Progress Page — aligned dividers/buttons
   ----------------------------------------------- */
html.storyrise-desktop-preboot .perf-metrics-bar {
  border-bottom-color: rgba(31, 29, 26, 0.10);
}

html.storyrise-desktop-preboot .perf-section {
  border-bottom-color: rgba(31, 29, 26, 0.10);
}

html.storyrise-desktop-preboot .perf-readiness {
  border-color: var(--primary);
}

html.storyrise-desktop-preboot .perf-readiness strong {
  color: var(--primary);
}

html.storyrise-desktop-preboot .perf-stat-value {
  color: var(--ink);
}

html.storyrise-desktop-preboot .perf-stat-label {
  color: var(--muted);
}

html.storyrise-desktop-preboot .perf-section-head h3 {
  color: var(--ink);
}

html.storyrise-desktop-preboot .perf-billing-inline h3 {
  color: var(--ink);
}

html.storyrise-desktop-preboot .perf-page .btn {
  border-radius: 6px;
}

html.storyrise-desktop-preboot .perf-page .btn-ghost {
  background: transparent;
  border: 1px solid rgba(31, 29, 26, 0.20);
  color: var(--ink);
}

html.storyrise-desktop-preboot .perf-page .btn-ghost:hover {
  background: rgba(31, 29, 26, 0.06);
}

/* -----------------------------------------------
   Desktop Color Harmony (shell ↔ writing-v2)
   ----------------------------------------------- */

/* Write view: transparent so writing-v2's own bg takes over */
html.storyrise-desktop-preboot [data-view="write"] {
  background: transparent;
}

/* Write topbar: seamless with light chrome, thin editorial rule */
html.storyrise-desktop-preboot .write-topbar {
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(14, 39, 54, 0.1);
}

/* Desktop topbar: compact save status so nav modes get priority */
html.storyrise-desktop-preboot .write-topbar .v2-topbar-save {
  flex: 0 1 auto;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.storyrise-desktop-preboot .write-topbar .v2-topbar-actions {
  flex: 0 0 auto;
}

/* Dashboard banner: use dark chrome instead of separate dark gray */
html.storyrise-desktop-preboot .dash-banner {
  background: var(--desktop-chrome);
}

/* -----------------------------------------------
   Desktop Sidebar Consolidation
   ----------------------------------------------- */

/* Hide web-only nav items in desktop */
html.storyrise-desktop-preboot [data-nav="dashboard"],
html.storyrise-desktop-preboot [data-nav="tasks"],
html.storyrise-desktop-preboot [data-nav="settings"],
html.storyrise-desktop-preboot .nav-bell {
  display: none;
}

/* Desktop action nav items — slightly smaller for visual hierarchy */
html.storyrise-desktop-preboot .nav-item[data-desktop-action] {
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
}

/* =========================
   Mobile: < 768px
   ========================= */
@media (max-width: 768px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  #appShell {
    grid-template-columns: 1fr;
    padding-bottom: 60px;
  }

  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    padding: 0.4rem 0.5rem;
    border-right: none;
    border-top: 1px solid var(--panel-border);
    z-index: 50;
    justify-content: space-around;
    gap: 0;
  }

  .sidebar-brand,
  .sidebar-spacer,
  .sidebar-footer,
  .sidebar-nav-divider,
  .nav-label {
    display: none;
  }

  .nav-item {
    flex-direction: column;
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
    gap: 0.15rem;
    justify-content: center;
    align-items: center;
    border-left: none !important;
    padding-left: 0.5rem !important;
  }

  .nav-item.active {
    border-left: none;
    border-bottom: 2px solid var(--primary);
    border-radius: 0;
    padding-left: 0.5rem;
  }

  .nav-item-admin.active {
    border-bottom-color: var(--track-publishing);
  }

  .nav-bell .nav-label {
    display: none;
  }

  .notif-badge {
    top: -2px;
    left: 20px;
  }

  [data-view] {
    padding: 1.2rem;
  }

  [data-view="dashboard"] {
    padding-top: 0;
  }

  .write-topbar {
    padding: 0.35rem 0.5rem;
  }

  .write-topbar .v2-topbar-row {
    gap: 0.35rem;
  }

  .write-topbar .v2-editor-topbar-center {
    width: 100%;
  }

  .write-topbar .v2-topbar-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .onboard-cards-grid {
    grid-template-columns: 1fr;
  }

  .metric-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .readiness-ring {
    margin: 0 auto;
  }

  /* Dashboard banner responsive */
  .dash-banner {
    margin: 0 -1.2rem;
    padding: 1.5rem 1.2rem 0;
  }

  .dash-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .dash-nav::-webkit-scrollbar {
    display: none;
  }

  .dash-nav-link {
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    font-size: 0.86rem;
  }

  .dash-content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Marketplace responsive */
  .mp-provider-grid {
    grid-template-columns: 1fr;
  }

  .mp-form-row {
    flex-direction: column;
  }

  /* Performance tab responsive */
  .perf-metrics-bar {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .perf-stat-membership {
    margin-left: 0;
  }

  .perf-bottom-row {
    flex-direction: column;
  }

  .perf-billing-inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Training tab responsive */
  .dash-training-grid {
    grid-template-columns: 1fr;
  }

  /* Admin responsive */
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-accounts-layout {
    grid-template-columns: 1fr;
  }

  .admin-accounts-list {
    position: static;
  }

  .admin-account-grid,
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-search-row,
  .admin-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  /* Provider profile responsive */
  .pp-layout {
    grid-template-columns: 1fr;
  }

  .pp-sidebar {
    position: static;
  }

  .pp-hero {
    padding: 2rem 1.2rem 1.5rem;
  }

  .pp-hero-name {
    font-size: 1.3rem;
  }

  .pp-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .pp-tabs::-webkit-scrollbar {
    display: none;
  }

  .pp-portfolio-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .mp-provider-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-training-grid {
    grid-template-columns: repeat(2, 1fr);
  }

}

@media (max-width: 480px) {
  .onboard-summary {
    flex-direction: column;
    align-items: center;
  }

  .metric-row {
    flex-direction: column;
  }

  .mp-provider-card-footer {
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr;
  }
}
