/*
 * F10P component library — plain, token-driven CSS (see tokens.css). No build
 * step. Loaded after app.css in base.html. Light BEM-ish naming
 * (block__element, block--modifier). Components with Datastar wiring carry a
 * note describing the signal they react to; the markup lives in templates.
 *
 * Authored in Phase 0 of the faithful rebuild so every later surface composes
 * from these instead of hand-rolling one-off styles.
 */

/* --- Buttons -------------------------------------------------------------- */
/* Two CTA tiers: neutral (--accent, default) and brand cyan (--accent-brand,
   featured CTAs only — the original uses cyan sparingly for impact). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: transform var(--transition), opacity var(--transition),
    background var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-1px); opacity: 1; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled,
.btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; transform: none; pointer-events: none; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--brand { background: var(--accent-brand); color: var(--accent-brand-ink); }
.btn--brand:hover { background: var(--accent-brand-hover); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--outline { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--outline:hover { background: var(--surface-2); border-color: var(--ink-muted); }
.btn--danger { background: var(--error); color: #fff; }

/* Animated spinner for loading buttons and async states */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.btn--sm { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn--xs { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 4px var(--space-2); font-size: var(--text-xs); height: 28px; line-height: 1; border-radius: var(--radius-sm); }
.btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--text-lg); }
.btn--pill { border-radius: var(--radius-pill); }
.btn--block { display: flex; width: 100%; }

/* --- Theme toggle (global Auto/Light/Dark; wired to the base.html head script) -
   Three icon buttons (monitor / sun / moon — the PDF reader's glyphs) in a pill;
   the active one (aria-pressed) reads as a raised chip. */
.theme-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
.theme-toggle__opt {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.theme-toggle__opt svg { width: 16px; height: 16px; display: block; }
.theme-toggle__opt:hover { color: var(--ink); }
.theme-toggle__opt[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.theme-toggle__opt:focus-visible { outline: none; box-shadow: var(--ring); }

/* Footer placement: a row under the brand mission paragraph. The icons are
   self-evident, so there's no visible label (the group's aria-label covers a11y). */
.site-footer__theme { display: flex; margin-top: var(--space-5); }

/* Cross-fade the light/dark token swap. __setTheme() adds .theme-transition to
   <html> only for the moment of the switch (removed ~350ms later), so surfaces,
   text, and borders ease between themes without slowing hover states or animating
   the initial paint. Skipped entirely under prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transition,
  html.theme-transition * {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, fill 0.3s ease !important;
  }
}

/* --- Badges & pills ------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-muted);
  /* A badge is a single-line label — never let its text wrap into a blob. */
  white-space: nowrap;
}
.badge--brand { background: var(--accent-brand); color: var(--accent-brand-ink); }
.badge--gold { background: var(--gold-bg); color: var(--gold); }
.badge--ink { background: var(--accent); color: var(--accent-ink); }

/* Genre/category chips; .pill--active driven by a Datastar signal via data-class. */
.pill {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.pill:hover { background: var(--surface-2); }
.pill--active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* --- Tabs ----------------------------------------------------------------- */
/* Active tab tracked by a Datastar signal ($tab); panels are SSE-swapped. */
.tabs__list {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}
.tabs__tab {
  font: inherit;
  font-weight: 600;
  color: var(--ink-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.tabs__tab:hover { color: var(--ink); }
.tabs__tab--active { color: var(--ink); border-bottom-color: var(--accent-brand); }

/* --- Modal ---------------------------------------------------------------- */
/* Shown/hidden by a Datastar signal via data-show — no JS for the common case. */
.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
}
.modal__panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.2s ease-out;
}
.modal__head,
.modal__actions {
  display: flex;
  align-items: center;
  padding: var(--space-5);
}
.modal__head { justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: var(--text-lg); }
.modal__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.modal__actions { justify-content: flex-end; gap: var(--space-3); border-top: 1px solid var(--border); }
.modal__close { background: none; border: none; cursor: pointer; color: var(--ink-muted); font-size: var(--text-lg); }
@keyframes modal-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* --- Forms ---------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form__group { display: flex; flex-direction: column; gap: var(--space-2); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form__label { font-size: var(--text-sm); font-weight: 600; }
.form__input,
.form__select,
.form__textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form__textarea { min-height: 120px; resize: vertical; }
.form__input:focus,
.form__select:focus,
.form__textarea:focus { outline: none; border-color: var(--accent-brand); box-shadow: var(--ring); }
.form__hint { font-size: var(--text-xs); color: var(--ink-muted); }
.form__error { font-size: var(--text-sm); color: var(--error); }
.form__field-wrapper { position: relative; width: 100%; }
.form__field-wrapper .form__textarea { padding-bottom: calc(var(--space-4) + 0.8rem); }
.form__char-counter {
  position: absolute;
  right: calc(var(--space-3) + 6px);
  bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  pointer-events: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: var(--surface);
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  opacity: 0.85;
}
.form__file {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--transition);
}
.form__file:hover { border-color: var(--ink-muted); }
/* Replace the browser-default "Choose File" chrome with an intentional button
   (applies to every file input — settings avatar, upload cover/PDF, blog cover). */
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600;
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); border-color: var(--ink-muted); }
/* Style Django-rendered widgets inside .form without per-widget classes, so
   {{ form }} / {{ field }} pick up the look automatically. */
.form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]),
.form textarea,
.form select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  width: 100%;
}
.form input:focus,
.form textarea:focus,
.form select:focus { outline: none; border-color: var(--accent-brand); box-shadow: var(--ring); }

/* Native <select> chevron — one custom arrow for every dropdown.
   The OS-default arrow is inconsistent and jams against the right edge; replace
   it with an inline-SVG chevron set at a comfortable inset, with padding-right
   reserving room so the value never collides with it. The %23888 grey reads on
   both light and dark surfaces, and background-color stays whatever each base
   rule set (these declarations only touch background-image/position/size). */
.filters__select,
.form__select,
.form select,
.settings__panel select,
.upload-select,
.upload-field > select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 12px;
  padding-right: calc(var(--space-6) + var(--space-2));
  cursor: pointer;
}


/* --- Auth card (login / signup) ------------------------------------------ */
/* Cloned from the OLD (site)/login + /signup (one shared design). In-chrome,
   centered 440px card; theme-responsive (the OLD used styled-jsx over the shared
   theme vars). Token map: card-bg→surface, foreground→ink, text-secondary→
   ink-muted, border-light→border, accent-foreground→accent-ink. Inputs/labels
   are styled by element WITHIN .auth-card (mirroring the OLD's scoped jsx) so
   Django's default widgets pick up the look without per-field classes. */
.auth-page { display: flex; flex-direction: column; align-items: center; padding: 4rem 1rem 2rem; }
.auth-content { width: 100%; max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 2rem; }
.auth-head h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.auth-head p { color: var(--ink-muted); font-size: 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem; box-shadow: var(--shadow-md); }

/* Fields (styled by element to mirror the OLD's scoped jsx) */
.auth-field { margin-bottom: 1.25rem; }
.auth-field label { display: block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); margin-bottom: 0.5rem; }
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"] { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 1rem; font-family: inherit; transition: border-color var(--transition), box-shadow var(--transition); }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 6%, transparent); }
.auth-card input::placeholder { color: var(--ink-muted); }
.auth-hint { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 0.4rem; line-height: 1.4; }
.auth-error { color: var(--error); font-size: 0.85rem; text-align: center; background: color-mix(in srgb, var(--error) 10%, transparent); padding: 0.75rem; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--error) 20%, transparent); margin-bottom: 1.5rem; }
.auth-field .auth-error { text-align: left; background: none; border: none; padding: 0; margin: 0.4rem 0 0; }

/* Custom checkbox (the signup terms agreement) */
.auth-check { display: flex; align-items: flex-start; gap: 0.75rem; cursor: pointer; }
.auth-check input { display: none; }
.auth-check__box { flex-shrink: 0; width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); transition: background var(--transition), border-color var(--transition); }
.auth-check__box svg { opacity: 0; }
.auth-check input:checked + .auth-check__box { background: var(--accent); border-color: var(--accent); }
.auth-check input:checked + .auth-check__box svg { opacity: 1; }
.auth-check__label { font-size: 0.9rem; color: var(--ink-muted); line-height: 1.4; }
.auth-check__label a { color: var(--accent-brand); font-weight: 600; }

/* Signup terms spacing */
.auth-terms { margin: 1.5rem 0 2rem; }

/* Submit */
.auth-submit { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem; border: none; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1rem; cursor: pointer; transition: background var(--transition); }
.auth-submit:hover { background: var(--accent-hover); }

/* Footer cross-link */
.auth-foot { text-align: center; margin-top: 2rem; font-size: 0.95rem; color: var(--ink-muted); }
.auth-foot a { color: var(--accent-brand); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* --- Writer card tweaks --------------------------------------------------- */
.card__media--square { aspect-ratio: 1 / 1; }
.role-label { color: var(--accent-brand); font-weight: 600; text-transform: uppercase; font-size: var(--text-xs); letter-spacing: 0.04em; }

/* --- Marketplace ("Find a Reviewer") ------------------------------------- */
/* Cloned faithfully from the old Next.js page, which renders LIGHT regardless
   of the OS dark theme: a navy hero, a light-grey page, and white cards. Every
   colour here is therefore an explicit literal constant, NOT a theme token —
   mapping these to --surface/--ink would resurrect the "dark card" bug. */
.marketplace-page { background: #f9fafb; min-height: 100vh; }
/* The old app widens the shared container to 1400px just for this 4-col grid. */
.marketplace-page .container { max-width: 1400px; }

/* Hero: full-bleed navy panel with a faint cyan radial glow + a white search box. */
.market-hero { position: relative; overflow: hidden; background: #0f172a; color: #fff; padding: 5rem 0 6rem; text-align: center; }
.market-hero::before { content: ""; position: absolute; top: -50%; left: 50%; transform: translateX(-50%); width: 100%; height: 200%; background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, rgba(15, 23, 42, 0) 60%); pointer-events: none; }
.market-hero__content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.market-hero__title { font-family: var(--font-display); font-weight: 700; font-size: 3rem; color: #fff; line-height: var(--leading-tight); margin-bottom: 1rem; }
.market-hero__lead { font-size: 1.1rem; color: #94a3b8; line-height: 1.6; margin-bottom: 3rem; }
.market-search { display: flex; align-items: center; width: 100%; max-width: 600px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 8px; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); }
.market-search__icon { color: #94a3b8; margin-left: 12px; flex-shrink: 0; }
.market-search input { flex: 1; min-width: 0; border: none; background: transparent; padding: 12px 16px; font-size: 1rem; color: #0f172a; }
.market-search input::placeholder { color: #94a3b8; }
.market-search input:focus { outline: none; }
.market-search__btn { background: #06b6d4; color: #fff; border: none; padding: 10px 24px; border-radius: 8px; font-weight: 600; font-size: 1rem; cursor: pointer; transition: background var(--transition); }
.market-search__btn:hover { background: #0891b2; }

/* Filter bar: sticky white strip — price slider + genre pills (all live). */
.market-filterbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid #e2e8f0; }
.market-filterbar__inner { display: flex; align-items: center; height: 70px; gap: 2rem; }
.market-price { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; font-weight: 600; color: #475569; }
.market-range { width: 120px; accent-color: #06b6d4; cursor: pointer; }
.market-tags { display: flex; gap: 8px; margin-left: auto; overflow-x: auto; padding-bottom: 2px; }
.market-pill { background: #fff; border: 1px solid #e2e8f0; padding: 6px 16px; border-radius: 100px; color: #475569; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all var(--transition); }
.market-pill:hover { background: #f8fafc; border-color: #cbd5e1; }
.market-pill--active { background: #e0f2fe; color: #0284c7; border-color: #e0f2fe; }
@media (max-width: 1024px) {
  .market-filterbar__inner { height: auto; align-items: flex-start; overflow-x: auto; padding: 1rem 0; }
}

/* Grid. */
.market-grid-section { padding-top: 3rem; padding-bottom: 4rem; }
.reviewers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; margin-bottom: 4rem; }
.no-results { grid-column: 1 / -1; text-align: center; padding: 4rem; color: #64748b; }
.clear-filters-btn { margin-top: 1rem; background: none; border: none; color: #06b6d4; font-weight: 600; cursor: pointer; }

/* Reviewer card: cover banner + rating badge, overlapping avatar, info, footer. */
.service-card { display: flex; flex-direction: column; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); transition: transform var(--transition), box-shadow var(--transition); }
.service-card:hover { transform: translateY(-4px); border-color: #d1d5db; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.service-card__banner { position: relative; height: 110px; background: #f3f4f6; }
.service-card__banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.service-card__rating { position: absolute; top: 10px; right: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; background: #fff; color: #111827; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.service-card__rating svg { color: #f59e0b; }
.service-card__body { position: relative; flex: 1; display: flex; flex-direction: column; padding: 0 20px 20px; }
.service-card__avatar { margin-top: -36px; margin-bottom: 12px; width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #fff; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.service-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.service-card__info { flex: 1; }
.service-card__name { font-size: 1.15rem; font-weight: 800; color: #111827; letter-spacing: -0.01em; margin-bottom: 2px; }
.service-card__subtitle { font-size: 0.85rem; font-weight: 600; color: #00b5ff; margin-bottom: 12px; }
.service-card__bio { font-size: 0.85rem; color: #6b7280; line-height: 1.5; margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.service-card__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.service-card__tag { background: #f3f4f6; color: #4b5563; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; padding: 4px 10px; border-radius: 4px; }
.service-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 20px; border-top: 1px solid #f3f4f6; }
.service-card__price-label { display: block; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #9ca3af; margin-bottom: 2px; }
.service-card__price { font-size: 1.2rem; font-weight: 800; color: #111827; line-height: 1; }
.service-card__unit { font-size: 0.8rem; font-weight: 400; color: #6b7280; }
.service-card__view { background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; transition: all var(--transition); }
.service-card__view:hover { background: #000; transform: translateY(-1px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }

/* --- Reviewer detail (marketplace_detail) -------------------------------- */
.reviewer { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.reviewer__hero { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--space-8); align-items: center; background: var(--surface-2); border-radius: var(--radius-hero); padding: var(--space-6); }
.reviewer__portrait { position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.reviewer__portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.reviewer__badges { position: absolute; top: var(--space-3); left: var(--space-3); display: flex; gap: var(--space-2); }
.reviewer__name { font-size: var(--text-3xl); line-height: var(--leading-tight); margin: var(--space-2) 0; }
.reviewer__name-accent { color: var(--accent-brand); }
.reviewer__meta { color: var(--ink-muted); margin-bottom: var(--space-4); }
.reviewer__bio { line-height: var(--leading-normal); margin-bottom: var(--space-5); max-width: 56ch; }
.reviewer__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.reviewer__bar { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-6); margin: var(--space-5) 0 var(--space-8); }
.reviewer__bar-item { display: flex; flex-direction: column; gap: 2px; }
.reviewer__bar-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.reviewer__bar-value { font-weight: 600; }
.reviewer__bar-link { margin-left: auto; font-weight: 600; color: var(--accent-brand); }
.svc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.svc-item { display: flex; flex-direction: column; gap: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-5); transition: transform var(--transition), box-shadow var(--transition); }
.svc-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); opacity: 1; }
.svc-item--current { border-color: var(--accent-brand); box-shadow: 0 0 0 1px var(--accent-brand); }
.svc-item__name { font-size: var(--text-lg); }
.svc-item__desc { line-height: var(--leading-normal); flex: 1; }
.svc-item__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-2); }

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

/* --- Profile header (writer profile sidebar) ----------------------------- */
.profile-head { display: flex; flex-direction: column; gap: var(--space-3); }
/* Large rectangular portrait (image-forward) — replaces the small round avatar
   in the writer-profile sidebar. Grayscale settles to colour on hover. */
.profile-portrait { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-sm); }
.profile-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(100%); transition: filter var(--transition-slow); }
.profile-portrait:hover img { filter: grayscale(0%); }
.profile-head__name { font-size: var(--text-xl); }
.profile-head__role { color: var(--accent-brand); font-weight: 600; }
/* 3-up stat row (Scripts · Rating · Reads), ruled top and bottom. */
.profile-stats { display: flex; justify-content: space-between; gap: var(--space-3); text-align: center; padding: var(--space-4) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.profile-stat { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.profile-stat__value { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.profile-stat__label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
/* Bio with a left accent rule (the original's styled bio). */
.profile-bio { padding-left: var(--space-3); border-left: 3px solid var(--accent-brand); }

/* Prominent link cards (IMDb, Website) */
.profile-featured-links { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
.profile-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.profile-link-card:hover {
  border-color: var(--border-hover, var(--accent-brand));
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.profile-link-card__left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.profile-link-card__label { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-link-card__icon { color: var(--ink-muted); flex-shrink: 0; }
.profile-link-card__arrow { color: var(--ink-muted); flex-shrink: 0; transition: transform var(--transition), color var(--transition); }
.profile-link-card:hover .profile-link-card__arrow { color: var(--ink); transform: translate(2px, -2px); }

/* Social media icon row */
.profile-social-icons { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-1) 0; }
.profile-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  transition: color var(--transition), background var(--transition), transform var(--transition);
  text-decoration: none;
}
.profile-social-icon:hover {
  color: var(--ink);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.profile-socials { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); }
.profile-socials a { color: var(--ink-muted); }

/* --- Tables --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th,
.table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.table th { font-weight: 700; color: var(--ink-muted); text-transform: uppercase; font-size: var(--text-xs); letter-spacing: 0.04em; }
.table__num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }

/* --- Pagination ----------------------------------------------------------- */
.pagination { display: flex; gap: var(--space-2); align-items: center; justify-content: center; margin-top: var(--space-6); }
.pagination__item {
  min-width: 2.25rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  background: var(--surface);
}
.pagination__item--active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pagination__ellipsis { color: var(--ink-muted); padding: 0 var(--space-1); }

/* --- Load More (used on discover, writers) -------------------------------- */
.load-more-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: var(--space-8);
  margin-bottom: var(--space-6);
}

.btn--load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn--load-more:hover {
  background: var(--surface-2);
  border-color: var(--border-strong, var(--ink-muted));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.btn--load-more:active {
  transform: translateY(0);
}


/* --- Avatar --------------------------------------------------------------- */
.avatar { border-radius: 50%; object-fit: cover; object-position: top; background: var(--surface-2); flex-shrink: 0; }
.avatar--sm { width: 32px; height: 32px; }
.avatar--md { width: 48px; height: 48px; }
.avatar--lg { width: 96px; height: 96px; }

/* --- Carousel (CSS scroll-snap, no JS) ------------------------------------ */
.carousel { position: relative; }
.carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: var(--space-5);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: var(--space-3);
  scrollbar-width: thin;
}
.carousel__track > * { scroll-snap-align: start; }
.carousel__arrows { display: flex; gap: var(--space-2); }
.arrow-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.arrow-btn:hover { background: var(--surface-2); }

/* --- Breadcrumbs ---------------------------------------------------------- */
.breadcrumbs { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--ink-muted); margin-bottom: var(--space-4); }
.breadcrumbs__sep { opacity: 0.5; }

/* --- Dropdown (Datastar $open signal + data-show) ------------------------- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  padding: var(--space-2);
  z-index: 50;
}
.dropdown__item { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.dropdown__item:hover { background: var(--surface-2); }

/* --- Hero (Script of the Week) — home banner, ported from the old --------- */
.hero {
  position: relative;
  height: 500px;
  border-radius: var(--radius-hero);          /* 24px */
  overflow: hidden;
  margin: var(--space-6) 0 var(--space-8);     /* 2rem 0 3rem */
  display: flex;
  align-items: center;
  color: #fff;
}
/* The background is a link covering the whole banner; the image fills it. */
.hero__bg { position: absolute; inset: 0; z-index: 1; display: block; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
}
.hero__content { position: relative; z-index: 2; max-width: 650px; padding: var(--space-8); }
.hero__headline { display: block; color: inherit; }
.hero__headline:hover { opacity: 1; }
/* Translucent frosted pill (NOT the cyan brand badge the new app used). */
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-5);
}
/* SANS, heavy, tight — the old hero title is NOT serif/italic. */
.hero__title {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 800;
  font-size: 3.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: var(--space-4);
}
.hero__logline { font-size: 1.1rem; line-height: 1.6; opacity: 0.9; margin-bottom: var(--space-6); max-width: 90%; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero__actions { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
/* Ensure the standardized save button (.btn--ghost / .btn--primary) remains visible 
   on the dark hero image in Light mode by forcing inverted (light) colors. */
.hero .hero__actions .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.hero .hero__actions .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}
.hero__actions .btn--primary {
  background: #fff;
  color: #111;
}
.hero__actions .btn--primary:hover {
  background: rgba(255, 255, 255, 0.9);
}
@media (max-width: 1024px) {
  .hero { height: auto; min-height: 420px; }
  .hero__title { font-size: 2.5rem; }
  .hero__content { padding: var(--space-6); }
}

/* --- Home page (category bar, trending, freshly generated, staff picks) --- */
.home-page { padding-bottom: var(--space-8); }

/* Category bar: fixed pills (filter trending) on the left, "view all" right. */
.category-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); margin-bottom: var(--space-8); }
.categories { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.cat-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.cat-btn:not(.cat-btn--active):hover { background: var(--border); }
.cat-btn--active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.view-all { font-size: 0.9rem; color: var(--ink-muted); font-weight: 500; white-space: nowrap; }

/* Trending header arrows. */
.nav-arrows { display: flex; gap: var(--space-2); }
.arrow-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.arrow-btn:hover:not(:disabled) { background: var(--surface-2); }
.arrow-btn:disabled { opacity: 0.5; cursor: default; }

/* On the home page the section heading is a touch smaller and its link muted. */
.home-page .section-header h2 { font-size: 1.5rem; font-weight: 700; }
.home-page .section-header__link { color: var(--ink-muted); }

/* Trending grid — one row of four. */
.script-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8);
  color: var(--ink-muted);
  font-size: 1.1rem;
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

/* Freshly Written — smaller horizontal cards (thumb left, text right) in two rows of 4. */
.fresh-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.fresh-card {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  align-items: stretch;
  background: var(--surface);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
  /* Prevent long titles from expanding this grid item beyond its 1fr share. */
  min-width: 0;
  overflow: hidden;
}
.fresh-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 1;
}
.fresh-thumb {
  width: 60px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.fresh-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fresh-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}
.fresh-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.fresh-desc {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fresh-meta {
  display: flex;
  gap: var(--space-3);
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 600;
  margin-top: var(--space-1);
}
.fresh-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Staff Picks — big Editor's Choice card beside a 2×2 grid of mini posters. */
.staff-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.editor-card { display: block; min-height: 500px; color: inherit; }
.editor-card:hover { opacity: 1; }
.editor-content-wrapper { position: relative; display: block; width: 100%; height: 100%; min-height: 500px; border-radius: 20px; overflow: hidden; }
.editor-content-wrapper > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.editor-card:hover .editor-content-wrapper > img { transform: scale(1.04); }
.editor-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 2.5rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
}
.editor-badge {
  align-self: flex-start;
  background: var(--accent-brand);
  color: var(--accent-brand-ink);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}
.editor-overlay h3 { font-size: 2rem; line-height: 1.1; color: #fff; margin-bottom: var(--space-2); }
.editor-overlay p { font-size: 1rem; line-height: 1.5; opacity: 0.8; max-width: 90%; margin-bottom: var(--space-5); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.editor-user { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; font-size: 0.9rem; }
.user-icon { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid #fff; background: rgba(255, 255, 255, 0.2); }
.user-icon img { width: 100%; height: 100%; object-fit: cover; }
.user-details { display: flex; flex-direction: column; }
.user-role { font-size: 0.75rem; opacity: 0.8; font-weight: 400; }

.staff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.mini-card { display: flex; flex-direction: column; gap: var(--space-3); color: inherit; }
.mini-card:hover { opacity: 1; }
.mini-img { position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: #f0f0f0; }
.mini-img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.mini-card:hover .mini-img img { transform: scale(1.05); }
.mini-content h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.1rem; }
.mini-content p { font-size: 0.85rem; color: var(--ink-muted); }

@media (max-width: 1024px) {
  .script-grid { grid-template-columns: 1fr 1fr; }
  .fresh-grid { grid-template-columns: repeat(2, 1fr); }
  .staff-layout { grid-template-columns: 1fr; }
}

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

/* --- Sidebar layout (profile / settings / pro) --------------------------- */
.layout--sidebar { padding-top: var(--space-6); display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: var(--space-8); align-items: start; }
@media (max-width: 820px) { .layout--sidebar { grid-template-columns: 1fr; } }
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}
.sidebar__profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.sidebar__profile-avatar {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.sidebar__profile-avatar:hover,
.sidebar__profile-avatar:focus-visible {
  border-color: var(--accent-brand);
  transform: scale(1.03);
  box-shadow: var(--shadow-sm);
  outline: none;
}
.sidebar__profile-avatar img,
.sidebar__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.sidebar__avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: 50%;
  gap: 2px;
  pointer-events: none;
}
.sidebar__profile-avatar:hover .sidebar__avatar-overlay,
.sidebar__profile-avatar:focus-visible .sidebar__avatar-overlay {
  opacity: 1;
}
.sidebar__avatar-overlay-text {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sidebar__avatar-input,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.sidebar__profile-info {

  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sidebar__profile-name {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sidebar__profile-handle {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 2px;
}

.sidebar__section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: var(--space-2) var(--space-3) var(--space-1);
  margin-top: var(--space-1);
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  transition: all var(--transition);
}
.sidebar__item svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.75;
  transition: opacity var(--transition), color var(--transition);
}
.sidebar__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.sidebar__item:hover svg {
  opacity: 1;
  color: var(--ink);
}
.sidebar__item--active {
  background: color-mix(in srgb, var(--accent-brand) 12%, transparent);
  color: var(--accent-brand);
}
.sidebar__item--active svg {
  opacity: 1;
  color: var(--accent-brand);
}
.sidebar__item--danger {
  color: var(--danger, #dc2626);
}
.sidebar__item--danger:hover {
  background: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent);
  color: var(--danger, #dc2626);
}
.sidebar__item--danger svg {
  color: var(--danger, #dc2626);
}

/* --- Section block (carousel/rail header) -------------------------------- */
/* Vertical margins only — shorthand `margin: X 0` would reset left/right to 0 and
   clobber `.container`'s `margin: 0 auto`, pinning the section left above 1200px. */
.section-block { margin-top: var(--space-8); margin-bottom: var(--space-8); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-5); }
.section-header h2 { font-size: var(--text-xl); }
.section-header__link { font-size: var(--text-sm); font-weight: 600; color: var(--accent-brand); }

/* --- Stat tiles ----------------------------------------------------------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.stat-tile__value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: 1; }
.stat-tile__label { font-size: var(--text-sm); color: var(--ink-muted); margin-top: var(--space-2); }
.stat-tile--gold .stat-tile__value { color: var(--gold); }
.stat-tile--brand .stat-tile__value { color: var(--accent-brand); }

/* --- Skeleton / loading (pairs with Datastar data-indicator) ------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
[data-loading] { opacity: 0.6; transition: opacity var(--transition); }

/* --- Reader (full-screen PDF island shell) ------------------------------- */
/* A standalone 100vh app the old build renders OUTSIDE its (site) chrome (the
   shared header/footer are blanked via base.html blocks). Colours are the old
   reader's own hardcoded constants — deliberately NOT the site theme tokens —
   so light is the default with a real in-page dark-mode toggle (.--dark). The
   reader uses the system font stack the old app sets for this surface. */
body.reader-fullscreen { overflow: hidden; }
/* <pdf-reader> renders the stage, toasts and footer; display: contents puts them in .reader-app's column. */
pdf-reader { display: contents; }

.reader-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #F3F4F6;
  color: #1F2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  max-width: 100vw;
}

/* Header */
.reader-app__header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 20;
  flex-shrink: 0;
  gap: 1rem;
}
.reader-app__left { display: flex; align-items: center; gap: 1rem; min-width: 0; flex: 1; overflow: hidden; }
.reader-app__back {
  display: flex;
  color: #6B7280;
  padding: 8px;
  border-radius: 8px;
  background: #F3F4F6;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.reader-app__back:hover { background: #E5E7EB; color: #111827; opacity: 1; }
.reader-app__title-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.reader-app__title-info h1 {
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: normal;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-app__draft-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: #F3F4F6;
  color: #6B7280;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #E5E7EB;
  width: fit-content;
}
.reader-app__author { font-size: 0.75rem; color: #9CA3AF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.reader-app__right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; justify-content: flex-end; }
.reader-app__icon-btn {
  display: flex;
  color: #6B7280;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.reader-app__icon-btn:hover { background: #F3F4F6; color: #111827; }
.reader-app__icon-btn--active { color: var(--gold); }
.reader-app__icon-btn--active:hover { background: var(--gold-bg); color: var(--gold); }

/* Body + scrollable PDF stage */
.reader-app__body { flex: 1; display: flex; overflow: hidden; position: relative; }
.reader-app__stage {
  flex: 1;
  background: #F3F4F6;
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 3rem 1rem 8rem;
  position: relative;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}
.reader-app__pdf-wrapper { position: relative; margin-bottom: 2rem; }
.reader-app__canvas-box {
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.05);
  display: flex;
}
.reader-app__canvas-box canvas { display: block; max-width: 100%; height: auto; }
.reader-app__empty { text-align: center; color: #6B7280; padding: 4rem 2rem; }
.reader-app__empty h3 { font-family: inherit; color: #1F2937; margin-bottom: 0.5rem; }

/* Floating tool rail (right of the page) */
.reader-app__tools {
  position: absolute;
  right: -60px;
  top: 40%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 8px;
}
.reader-app__tools button {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 8px;
  color: #4B5563;
  cursor: pointer;
  display: flex;
  transition: background 0.2s, color 0.2s;
}
.reader-app__tools button:hover { background: #F3F4F6; color: #111827; }
.reader-app__tools-btn--on { color: #F59E0B; }
.reader-app__tools-btn--on:hover { background: #FEF3C7; color: #D97706; }

/* Footer */
.reader-app__footer {
  height: 50px;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
  color: #374151;
  flex-shrink: 0;
}
.reader-app__foot-left { display: flex; align-items: center; gap: 1rem; }
.reader-app__foot-center { display: flex; align-items: center; gap: 1rem; flex: 1; justify-content: center; max-width: 400px; }
.reader-app__foot-right { display: flex; align-items: center; gap: 1rem; }
.reader-app__timeline { flex: 1; height: 4px; background: #F3F4F6; border-radius: 2px; position: relative; overflow: hidden; }
.reader-app__progress { height: 100%; width: 0; background: #00B5FF; border-radius: 2px; transition: width 0.3s; }
.reader-app__timeline-label { font-size: 0.65rem; font-weight: 700; color: #9CA3AF; letter-spacing: 0.05em; }
.reader-app__nav-icon {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: background 0.2s, color 0.2s;
}
.reader-app__nav-icon:hover { background: #F3F4F6; color: #111827; }
.reader-app__nav-icon:disabled { opacity: 0.5; cursor: not-allowed; }
.reader-app__nav-icon:disabled:hover { background: none; color: #6B7280; }
.reader-app__page-btn {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm, 4px);
  display: flex;
  align-items: center;
  transition: background 0.2s;
}
.reader-app__page-btn:hover { background: #F3F4F6; }
.reader-app__page, .reader-app__zoom { font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.reader-app__divider { width: 1px; height: 16px; background: #E5E7EB; }

/* Dark mode — connected to website theme (:root[data-theme="dark"], OS auto, and $dark) */
:root[data-theme="dark"] .reader-app,
.reader-app--dark { background: #111827; color: #F3F4F6; }
:root[data-theme="dark"] .reader-app .reader-app__header,
:root[data-theme="dark"] .reader-app .reader-app__footer,
.reader-app--dark .reader-app__header,
.reader-app--dark .reader-app__footer { background: #1F2937; border-color: #374151; color: #F3F4F6; }
:root[data-theme="dark"] .reader-app .reader-app__back,
.reader-app--dark .reader-app__back { background: #374151; color: #9CA3AF; border-color: #4B5563; }
:root[data-theme="dark"] .reader-app .reader-app__draft-badge,
.reader-app--dark .reader-app__draft-badge { background: #374151; color: #9CA3AF; border-color: #4B5563; }
:root[data-theme="dark"] .reader-app .reader-app__back:hover,
.reader-app--dark .reader-app__back:hover { background: #4B5563; color: #fff; }
:root[data-theme="dark"] .reader-app .reader-app__title-info h1,
.reader-app--dark .reader-app__title-info h1 { color: #F3F4F6; }

:root[data-theme="dark"] .reader-app .reader-app__icon-btn,
:root[data-theme="dark"] .reader-app .reader-app__nav-icon,
.reader-app--dark .reader-app__icon-btn,
.reader-app--dark .reader-app__nav-icon { color: #9CA3AF; }
:root[data-theme="dark"] .reader-app .reader-app__icon-btn:hover,
:root[data-theme="dark"] .reader-app .reader-app__nav-icon:hover,
.reader-app--dark .reader-app__icon-btn:hover,
.reader-app--dark .reader-app__nav-icon:hover { background: #374151; color: #fff; }
:root[data-theme="dark"] .reader-app .reader-app__stage,
.reader-app--dark .reader-app__stage { background: #111827; }
:root[data-theme="dark"] .reader-app .reader-app__canvas-box,
.reader-app--dark .reader-app__canvas-box { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5); }
:root[data-theme="dark"] .reader-app .reader-app__canvas-box canvas,
.reader-app--dark .reader-app__canvas-box canvas { filter: invert(0.9) hue-rotate(180deg) brightness(1.2) contrast(1.1); }
:root[data-theme="dark"] .reader-app .reader-app__tools,
.reader-app--dark .reader-app__tools { background: #1F2937; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); border-color: #374151; }
:root[data-theme="dark"] .reader-app .reader-app__tools button,
.reader-app--dark .reader-app__tools button { color: #9CA3AF; }
:root[data-theme="dark"] .reader-app .reader-app__tools button:hover,
.reader-app--dark .reader-app__tools button:hover { background: #374151; color: #fff; }
:root[data-theme="dark"] .reader-app .reader-app__tools-btn--on,
.reader-app--dark .reader-app__tools-btn--on { color: #FBBF24; }
:root[data-theme="dark"] .reader-app .reader-app__tools-btn--on:hover,
.reader-app--dark .reader-app__tools-btn--on:hover { background: #4B5563; }
:root[data-theme="dark"] .reader-app .reader-app__timeline,
.reader-app--dark .reader-app__timeline { background: #374151; }
:root[data-theme="dark"] .reader-app .reader-app__divider,
.reader-app--dark .reader-app__divider { background: #374151; }

.reader-app .theme-toggle {
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 3px;
  display: inline-flex;
  gap: 2px;
}
.reader-app .theme-toggle__opt {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #6B7280;
  cursor: pointer;
}
.reader-app .theme-toggle__opt:hover {
  background: #E5E7EB;
  color: #111827;
}
.reader-app .theme-toggle__opt[aria-pressed="true"] {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

:root[data-theme="dark"] .reader-app .theme-toggle,
.reader-app--dark .theme-toggle {
  background: #374151;
  border: 1px solid #4B5563;
}
:root[data-theme="dark"] .reader-app .theme-toggle__opt,
.reader-app--dark .theme-toggle__opt {
  color: #9CA3AF;
}
:root[data-theme="dark"] .reader-app .theme-toggle__opt:hover,
.reader-app--dark .theme-toggle__opt:hover {
  background: #4B5563;
  color: #fff;
}
:root[data-theme="dark"] .reader-app .theme-toggle__opt[aria-pressed="true"],
.reader-app--dark .theme-toggle__opt[aria-pressed="true"] {
  background: #111827;
  color: #fff;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .reader-app { background: #111827; color: #F3F4F6; }
  :root:not([data-theme="light"]) .reader-app .reader-app__header,
  :root:not([data-theme="light"]) .reader-app .reader-app__footer { background: #1F2937; border-color: #374151; color: #F3F4F6; }
  :root:not([data-theme="light"]) .reader-app .reader-app__back,
  :root:not([data-theme="light"]) .reader-app .reader-app__draft-badge { background: #374151; color: #9CA3AF; border-color: #4B5563; }
  :root:not([data-theme="light"]) .reader-app .reader-app__back:hover { background: #4B5563; color: #fff; }
  :root:not([data-theme="light"]) .reader-app .reader-app__title-info h1 { color: #F3F4F6; }

  :root:not([data-theme="light"]) .reader-app .reader-app__icon-btn,
  :root:not([data-theme="light"]) .reader-app .reader-app__nav-icon { color: #9CA3AF; }
  :root:not([data-theme="light"]) .reader-app .reader-app__icon-btn:hover,
  :root:not([data-theme="light"]) .reader-app .reader-app__nav-icon:hover { background: #374151; color: #fff; }
  :root:not([data-theme="light"]) .reader-app .reader-app__stage { background: #111827; }
  :root:not([data-theme="light"]) .reader-app .reader-app__canvas-box { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5); }
  :root:not([data-theme="light"]) .reader-app .reader-app__canvas-box canvas { filter: invert(0.9) hue-rotate(180deg) brightness(1.2) contrast(1.1); }
  :root:not([data-theme="light"]) .reader-app .reader-app__tools { background: #1F2937; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); border-color: #374151; }
  :root:not([data-theme="light"]) .reader-app .reader-app__tools button { color: #9CA3AF; }
  :root:not([data-theme="light"]) .reader-app .reader-app__tools button:hover { background: #374151; color: #fff; }
  :root:not([data-theme="light"]) .reader-app .reader-app__tools-btn--on { color: #FBBF24; }
  :root:not([data-theme="light"]) .reader-app .reader-app__tools-btn--on:hover { background: #4B5563; }
  :root:not([data-theme="light"]) .reader-app .reader-app__timeline { background: #374151; }
  :root:not([data-theme="light"]) .reader-app .reader-app__divider { background: #374151; }
  :root:not([data-theme="light"]) .reader-app .theme-toggle {
    background: #374151;
    border: 1px solid #4B5563;
  }
  :root:not([data-theme="light"]) .reader-app .theme-toggle__opt {
    color: #9CA3AF;
  }
  :root:not([data-theme="light"]) .reader-app .theme-toggle__opt:hover {
    background: #4B5563;
    color: #fff;
  }
  :root:not([data-theme="light"]) .reader-app .theme-toggle__opt[aria-pressed="true"] {
    background: #111827;
    color: #fff;
    box-shadow: none;
  }
}

:root[data-theme="dark"] .reader-app .reader-app__page-btn:hover,
.reader-app--dark .reader-app__page-btn:hover { background: #374151; color: #fff; }

/* Mobile PDF reader optimizations (screens <= 640px) */
@media (max-width: 640px) {
  .reader-app {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .reader-app__header {
    height: 52px;
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .reader-app__left {
    gap: 0.5rem;
  }
  .reader-app__back {
    padding: 6px;
  }
  .reader-app__title-info h1 {
    font-size: 0.875rem;
  }
  .reader-app__author {
    font-size: 0.7rem;
  }
  .reader-app__right {
    gap: 0.5rem;
  }
  .reader-app .theme-toggle__opt {
    width: 26px;
    height: 26px;
  }

  /* Stage padding on mobile — maximize script reading area */
  .reader-app__stage {
    padding: 0.75rem 0.5rem 3.5rem;
  }
  .reader-app__pdf-wrapper {
    margin-bottom: 0.75rem;
  }

  /* Footer on mobile */
  .reader-app__footer {
    height: auto;
    min-height: 48px;
    padding: 0.4rem 0.75rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    gap: 0.5rem;
  }
  .reader-app__foot-left {
    gap: 0.25rem;
  }
  .reader-app__nav-icon {
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .reader-app__page-btn {
    padding: 6px 8px;
    min-height: 40px;
    background: #F3F4F6;
  }
  .reader-app__foot-center {
    gap: 0.5rem;
    flex: 1;
    max-width: none;
  }
  .reader-app__timeline-label {
    display: none;
  }
  .reader-app__timeline {
    height: 6px;
    border-radius: 3px;
  }
  .reader-app__foot-right {
    display: none;
  }

  :root[data-theme="dark"] .reader-app .reader-app__page-btn,
  .reader-app--dark .reader-app__page-btn {
    background: #374151;
  }

  /* Centered milestone toast on mobile */
  .milestone-toast {
    max-width: 90vw;
    white-space: normal;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: 20px;
  }
}


/* --- Achievement & Reading Milestones (Centered Toasts) ---------- */
.milestone-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 10000;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff !important;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-full, 9999px);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25), 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(245, 158, 11, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  margin: 0;
  box-sizing: border-box;
}

.milestone-toast--active {
  animation: achievement-pop 4s ease forwards;
}

.milestone-toast--page10 {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3), 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(245, 158, 11, 0.25);
}

.milestone-toast--page100 {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(56, 189, 248, 0.25);
}

.milestone-toast--completed {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35), 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(34, 197, 94, 0.25);
}

.milestone-toast--resumed {
  border-color: var(--brand, #00b5ff);
  box-shadow: 0 0 0 1px rgba(0, 181, 255, 0.25), 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 181, 255, 0.15);
}

@keyframes achievement-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  10%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  18%  { transform: translate(-50%, -50%) scale(0.98); }
  25%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
}

.milestone-toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.milestone-toast__title {
  font-size: var(--text-base, 1rem);
  font-weight: 700;
  letter-spacing: 0.015em;
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1.3;
}

.milestone-toast__title span {
  color: #ffffff !important;
}

.milestone-toast__label,
.milestone-toast__sub {
  display: none;
}

/* --- Comment / review row ------------------------------------------------- */
.comment { display: flex; gap: var(--space-3); padding: var(--space-3) 0; }
.comment .avatar { flex-shrink: 0; }
.comment p { margin-top: var(--space-1); }
.comment__reply-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color var(--transition-fast);
  outline: none;
}
.comment__reply-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}
.comment__delete-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color var(--transition-fast);
  outline: none;
}
.comment__delete-btn:hover {
  color: var(--error, #e53935);
  text-decoration: underline;
}


/* --- Blog index: featured hero ------------------------------------------- */
.blog { padding-top: var(--space-5); padding-bottom: var(--space-8); }
.blog-hero {
  position: relative;
  display: block;
  height: 440px;
  border-radius: var(--radius-hero);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-6);
  color: #fff;
}
.blog-hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.blog-hero__overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.82) 100%); }
.blog-hero__content { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-3); padding: var(--space-8); max-width: 720px; }
.blog-hero__title { font-family: var(--font-serif); font-size: var(--text-3xl); line-height: var(--leading-tight); margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.blog-hero__excerpt { font-size: var(--text-lg); line-height: var(--leading-normal); opacity: 0.92; max-width: 600px; margin: 0; }
/* The hero content is a column flex; without this the badge (a flex item) would
   stretch to the full content width instead of hugging its label. The .btn below
   needs the same treatment. */
.blog-hero .badge { align-self: flex-start; }
.blog-hero .btn { align-self: flex-start; margin-top: var(--space-2); }

/* --- Blog index: tab pills + search -------------------------------------- */
.blog-tabs { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.blog-tabs__nav { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.blog-tabs__search { min-width: 220px; padding: var(--space-2) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font: inherit; }
.blog-tabs__search:focus-visible { outline: none; box-shadow: var(--ring); }
.blog__filter-note { color: var(--ink-muted); margin: 0 0 var(--space-5); }
.blog__filter-note strong { color: var(--ink); }

/* --- Blog post card (grid item) ------------------------------------------ */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-8) var(--space-6); margin-bottom: var(--space-8); }
.post-card { display: flex; flex-direction: column; }
.post-card__media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: var(--space-4); background: var(--surface-2); transition: transform var(--transition), box-shadow var(--transition); }
.post-card__media:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.post-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.post-card__media:hover .post-card__img { transform: scale(1.03); }
.post-card__tag { position: absolute; top: var(--space-3); left: var(--space-3); background: var(--surface); color: var(--ink); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm); }
.post-card__body { display: flex; flex-direction: column; }
.post-card__meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); margin-bottom: var(--space-2); }
.post-card__dot { color: var(--border); }
.post-card__title { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.3; margin: 0 0 var(--space-2); }
.post-card__title a { color: var(--ink); transition: color var(--transition); }
.post-card__title a:hover { color: var(--accent-brand); }
.post-card__excerpt { color: var(--ink-muted); line-height: var(--leading-normal); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Newsletter marquee --------------------------------------------------- */
.newsletter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  flex-wrap: wrap;
  background: radial-gradient(circle at top right, #1a1a1a, #000);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin: var(--space-8) 0;
  color: #fff;
}
.newsletter__copy {
  flex: 1 1 320px;
}
.newsletter__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-3);
}
.newsletter__desc {
  color: rgba(255, 255, 255, 0.85);
  line-height: var(--leading-normal);
  margin: 0;
}
.newsletter__form-wrap {
  flex: 1 1 320px;
  min-width: 0;
}
.newsletter__form {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}
.newsletter__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  color: #fff;
  font: inherit;
  font-size: var(--text-sm);
  box-sizing: border-box;
}
.newsletter__input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.newsletter__input:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.newsletter__form .btn {
  flex-shrink: 0;
  white-space: nowrap;
  height: 44px;
  padding: 0 var(--space-5);
  font-size: var(--text-sm);
  box-sizing: border-box;
}
.newsletter__success {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(0, 181, 255, 0.12);
  border: 1px solid var(--accent-brand);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: #fff;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.newsletter__success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--accent-brand);
  color: #000;
  font-weight: 700;
  font-size: var(--text-xs);
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .newsletter {
    padding: var(--space-6) var(--space-5);
    gap: var(--space-5);
  }
  .newsletter__copy {
    flex: 1 1 100%;
  }
  .newsletter__form-wrap {
    flex: 1 1 100%;
    width: 100%;
  }
}
@media (max-width: 480px) {
  .newsletter {
    padding: var(--space-6) var(--space-4);
  }
  .newsletter__title {
    font-size: var(--text-xl);
  }
  .newsletter__form {
    gap: var(--space-2);
  }
  .newsletter__form .btn {
    padding: 0 var(--space-4);
  }
}
@media (max-width: 360px) {
  .newsletter__form {
    flex-direction: column;
  }
  .newsletter__form .btn {
    width: 100%;
  }
}

/* --- Blog post detail ----------------------------------------------------- */
.blog-post { padding-bottom: var(--space-8); }
.blog-post__header { padding: var(--space-8) var(--space-4) var(--space-6); }
.blog-post__meta { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-muted); margin-bottom: var(--space-5); }
.blog-post__back { font-weight: 600; }
.blog-post__back:hover { color: var(--accent-brand); }
.blog-post__title { font-family: var(--font-serif); font-size: var(--text-3xl); line-height: var(--leading-tight); max-width: 900px; margin: 0 0 var(--space-6); }
.blog-post__author { display: flex; align-items: center; gap: var(--space-3); }
.blog-post__author-name { font-weight: 600; color: var(--ink); }
.blog-post__cover { aspect-ratio: 21 / 9; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); margin-bottom: var(--space-8); }
.blog-post__cover img { width: 100%; height: 100%; object-fit: cover; }
.blog-post__body { max-width: 720px; margin: 0 auto; }
.blog-post__tags { max-width: 720px; margin: var(--space-8) auto 0; padding-top: var(--space-5); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--space-3); }
.blog-post__tag { padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--ink-muted); transition: color var(--transition), border-color var(--transition); }
.blog-post__tag:hover { color: var(--accent-brand); border-color: var(--accent-brand); }

/* --- Rendered Markdown prose --------------------------------------------- */
.markdown { font-size: var(--text-lg); line-height: 1.7; color: var(--ink); }
.markdown > :first-child { margin-top: 0; }
.markdown h2 { font-family: var(--font-display); font-size: var(--text-xl); margin: var(--space-8) 0 var(--space-4); }
.markdown h3 { font-family: var(--font-display); font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-3); }
.markdown p { margin: 0 0 var(--space-5); }
.markdown ul, .markdown ol { margin: 0 0 var(--space-5); padding-left: var(--space-6); }
.markdown li { margin-bottom: var(--space-2); }
.markdown blockquote { border-left: 4px solid var(--accent-brand); padding-left: var(--space-5); margin: var(--space-6) 0; font-style: italic; color: var(--ink-muted); }
.markdown a { color: var(--accent-brand); text-decoration: underline; text-underline-offset: 2px; }
.markdown code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: var(--radius-sm); font-size: 0.9em; }
.markdown img { max-width: 100%; height: auto; border-radius: var(--radius-md); }

/* --- Blog author dashboard ("Content" CMS list) -------------------------- */
/* Reconstructed from the OLD /blog/dashboard SOURCE (its live page throws a data
   error). In-chrome page, theme-responsive. Everything is scoped under
   .blog-dash with .bd-* names so the OLD's generic class names never collide
   with global ones; the search/type/status filters swap #blog-rows over SSE. */
.blog-dash { padding-top: var(--space-6); padding-bottom: var(--space-8); }
.blog-dash__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.blog-dash__title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; }
.blog-dash__new { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 0.9rem; transition: opacity var(--transition); }
.blog-dash__new:hover { opacity: 0.9; }

/* Stat cards — plain (card surface + border), hover-lift */
.blog-dash__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 2.5rem; }
.bd-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition); }
.bd-stat:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.bd-stat__label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.5rem; }
.bd-stat__value { font-size: 2.5rem; font-weight: 600; line-height: 1; }

/* Filter bar — search (icon) + type + status selects */
.blog-dash__filters { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.bd-search { position: relative; flex: 1; min-width: 300px; }
.bd-search__icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-muted); pointer-events: none; }
.bd-search__input { width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 0.9rem; }
.bd-search__input:focus { outline: none; border-color: var(--accent); }
.bd-select { appearance: none; -webkit-appearance: none; padding: 0.6rem 2.5rem 0.6rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background-color: var(--surface); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem; font-size: 0.85rem; font-weight: 500; color: var(--ink-muted); cursor: pointer; min-width: 130px; }
.bd-select:hover { border-color: var(--ink-muted); color: var(--ink); }
.bd-select:focus { outline: none; border-color: var(--accent); color: var(--ink); }

/* Table */
.bd-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.bd-row { display: grid; grid-template-columns: 80px 3fr 2fr 1.5fr 1.5fr 50px; align-items: center; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.bd-row:first-child { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }
.bd-row:last-child { border-bottom: none; border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.bd-row:hover { background: var(--bg); }
.bd-row__thumb { width: 60px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.bd-row__title { font-size: 1rem; font-weight: 600; color: var(--ink); }
.bd-row__title:hover { color: var(--accent); }
.bd-row__type { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.25rem; }
.bd-author { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.bd-author__avatar { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 600; color: var(--ink-muted); }
.bd-author__name { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-status { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.bd-status__dot { width: 6px; height: 6px; border-radius: 50%; }
.bd-status--published { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.bd-status--published .bd-status__dot { background: var(--success); }
.bd-status--draft { background: var(--surface-2); color: var(--ink-muted); }
.bd-status--draft .bd-status__dot { background: var(--ink-muted); }
.bd-row__date { font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }

/* Per-row ⋮ actions dropdown (Datastar-toggled, transparent backdrop closes it) */
.bd-actions { position: relative; justify-self: center; }
.bd-actions__trigger { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 50%; background: transparent; color: var(--ink-muted); cursor: pointer; }
.bd-actions__trigger:hover { background: var(--surface-2); color: var(--ink); }
.bd-actions__menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 160px; display: flex; flex-direction: column; padding: 0.35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.bd-actions__item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.85rem; color: var(--ink); }
.bd-actions__item:hover { background: var(--surface-2); }
.bd-backdrop { position: fixed; inset: 0; z-index: 20; }

/* Pagination footer (count is real; controls presentational — one page) */
.bd-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border); color: var(--ink-muted); font-size: 0.9rem; }
.bd-pages { display: flex; gap: 0.5rem; }
.bd-page { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-muted); font-size: 0.85rem; }
.bd-page--active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bd-empty { padding: 3rem; text-align: center; color: var(--ink-muted); }

/* --- Blog write — full-screen admin composer (rich-editor island) --------
   Cloned from the OLD Next.js /blog/write: a full-screen app shell with its
   OWN fixed top nav and NO site chrome (header/footer blanked in the template,
   same trick as the reader/pro dashboard). Theme-responsive like the OLD (it
   used the shared tokens), so it follows the OS: light by default, dark under
   OS dark. Every selector is scoped under .write-admin so the OLD's generic
   class names (.type-card/.wpanel/.wrow…) never collide with the global ones.
   --wnav is the fixed-nav height; BOTH columns clear it — the OLD left its
   sidebar's first panel header hidden behind the fixed nav (a layout bug),
   fixed here by offsetting the sidebar too. */
body.write-fullscreen { overflow-x: hidden; }
.write-admin { --wnav: 65px; color: var(--ink); background: var(--bg); }

/* Fixed top nav (brand + dashboard link | status + preview + publish + avatar) */
.write-admin .wnav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; height: var(--wnav); padding: 0 2rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.write-admin .wnav__group { display: flex; align-items: center; gap: 1rem; }
.write-admin .wnav__brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.write-admin .wnav__divider { width: 1px; height: 24px; background: var(--border); }
.write-admin .wnav__back { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--ink-muted); }
.write-admin .wnav__back:hover { color: var(--ink); }
.write-admin .wnav__status { font-size: 0.8rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.write-admin .wnav__preview { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.write-admin .wnav__preview:hover { background: var(--surface-2); }
.write-admin .wnav__publish { padding: 0.5rem 1.5rem; border: none; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.write-admin .wnav__publish:hover { background: var(--accent-hover); }
.write-admin .wnav__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--ink-muted); font-weight: 600; font-size: 0.8rem; }

/* Two-column body, offset below the fixed nav */
.write-admin .wbody { display: flex; min-height: 100vh; padding-top: var(--wnav); }
.write-admin .wmain { flex: 1; min-width: 0; padding: 2rem 4rem 4rem; }
.write-admin .wside { width: 400px; flex-shrink: 0; position: sticky; top: var(--wnav); align-self: flex-start; height: calc(100vh - var(--wnav)); overflow-y: auto; display: flex; flex-direction: column; gap: 2rem; padding: 2rem; background: var(--surface); border-left: 1px solid var(--border); }

/* Section labels + title input */
.write-admin .wlabel { display: block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.5rem; }
.write-admin .write__title { width: 100%; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.3; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); margin-bottom: 1.75rem; transition: border-color var(--transition), box-shadow var(--transition); }
.write-admin .write__title:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.write-admin .write__title::placeholder { color: var(--ink-muted); opacity: 0.5; }

/* Content-type selector — native radios styled as cards (selected via :has) */
.write-admin .wtypes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.write-admin .wtypes__label { grid-column: 1 / -1; margin-bottom: -0.5rem; }
.write-admin .type-card { position: relative; display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); }
.write-admin .type-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.write-admin .type-card:has(.type-card__radio:checked) { border-color: var(--accent); background: var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.write-admin .type-card__radio { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.write-admin .type-card__icon { width: 24px; height: 24px; color: var(--accent); }
.write-admin .type-card__title { font-weight: 600; font-size: 1rem; }
.write-admin .type-card__desc { font-size: 0.8rem; line-height: 1.4; color: var(--ink-muted); }

/* Editor: the <rich-editor> component (Quill, snow theme) dressed as the write surface */
.write-admin rich-editor { display: block; }
.write-admin rich-editor .ql-toolbar.ql-snow { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--surface); font-family: inherit; }
.write-admin rich-editor .ql-toolbar.ql-snow .ql-formats { margin-right: 0.5rem; }
.write-admin rich-editor .ql-snow.ql-toolbar button { width: 32px; height: 32px; padding: 6px; border-radius: var(--radius-sm); transition: background 0.1s; }
.write-admin rich-editor .ql-snow.ql-toolbar button:hover { background: var(--border); }
.write-admin rich-editor .ql-snow .ql-stroke { stroke: var(--ink-muted); }
.write-admin rich-editor .ql-snow .ql-fill { fill: var(--ink-muted); }
.write-admin rich-editor .ql-snow.ql-toolbar button:hover .ql-stroke, .write-admin rich-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--ink); }
.write-admin rich-editor .ql-snow.ql-toolbar button:hover .ql-fill, .write-admin rich-editor .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--ink); }
.write-admin rich-editor .ql-container.ql-snow { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-md) var(--radius-md); background: var(--surface); font-family: var(--font-body); font-size: 1.1rem; }
.write-admin rich-editor .ql-editor { min-height: 500px; padding: 2rem; line-height: 1.7; color: var(--ink); }
.write-admin rich-editor .ql-editor.ql-blank::before { left: 2rem; right: 2rem; font-style: normal; color: var(--ink-muted); opacity: 0.6; }
.write-admin .write__source { display: none; }
.write-admin .weditor-hint { margin-top: 1rem; font-style: italic; color: var(--ink-muted); }

/* Sidebar panels (Datastar-collapsible) */
.write-admin .wpanel { border-bottom: 1px solid var(--border); padding-bottom: 2rem; }
.write-admin .wpanel:last-child { border-bottom: none; padding-bottom: 0; }
.write-admin .wpanel__head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0; border: none; background: none; cursor: pointer; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.write-admin .wpanel__head:hover { color: var(--ink); }
.write-admin .wpanel__chev { flex-shrink: 0; transition: transform var(--transition); }
.write-admin .wpanel__chev.open { transform: rotate(180deg); }
.write-admin .wpanel__body { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1rem; }

/* Publishing rows */
.write-admin .wrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.9rem; }
.write-admin .wrow__label { color: var(--ink); font-weight: 500; }
.write-admin .wstatus { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.write-admin .wstatus__dot { width: 8px; height: 8px; border-radius: 50%; background: orange; }
.write-admin .wrow__value { font-weight: 600; color: var(--accent); text-align: right; }
.write-admin .wrow select { border: none; background: transparent; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--accent); text-align: right; outline: none; cursor: pointer; }
.write-admin .wrow select option { color: var(--ink); background: var(--surface); }
.write-admin .wpublish { width: 100%; padding: 1rem; border: none; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; transition: background var(--transition); }
.write-admin .wpublish:hover { background: var(--accent-hover); }

/* SEO / categorization / featured-media fields */
.write-admin .wfield-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--ink); margin-bottom: 0.5rem; }
.write-admin .wpanel__body .form__input, .write-admin .wpanel__body .form__textarea, .write-admin .wselect { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font-family: inherit; font-size: 0.9rem; }
.write-admin .wpanel__body .form__input:focus, .write-admin .wpanel__body .form__textarea:focus, .write-admin .wselect:focus { outline: none; border-color: var(--accent); }
.write-admin .wslug { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); font-family: monospace; font-size: 0.85rem; color: var(--ink-muted); }
.write-admin .wslug__editable { color: var(--ink); font-weight: 600; border-bottom: 1px dashed var(--ink-muted); }
.write-admin .wslug__pencil { margin-left: auto; flex-shrink: 0; color: var(--ink-muted); }
.write-admin .wdrop { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2rem; border: 2px dashed var(--border); border-radius: var(--radius-md); text-align: center; color: var(--ink-muted); cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.write-admin .wdrop:hover { border-color: var(--accent); background: var(--bg); }
.write-admin .wdrop span { font-size: 0.8rem; font-weight: 600; }
.write-admin .wdrop input[type="file"] { display: none; }

@media (max-width: 900px) {
  .write-admin .wmain { padding: 2rem; }
  .write-admin .wside { display: none; }
  .write-admin .wtypes { grid-template-columns: repeat(2, 1fr); }
  .write-admin .write__title { font-size: var(--text-2xl); }
}

@media (max-width: 800px) {
  .blog-hero__title { font-size: var(--text-2xl); }
  .blog-dash__stats { grid-template-columns: 1fr; }
  .bd-row { grid-template-columns: 60px 1fr auto 40px; }
  .bd-row .bd-author, .bd-row__date { display: none; }
}

/* --- Settings (tabbed) ---------------------------------------------------- */
.settings { padding-top: var(--space-5); padding-bottom: var(--space-8); }
.settings__head { margin-bottom: var(--space-5); }
.settings__panels { min-width: 0; }
.settings__panel { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-6); }
.settings__panel--flush { padding: 0; overflow: hidden; }
.settings__panel-title { margin: 0 0 var(--space-5); font-size: var(--text-lg); }
.settings__panel .form__group { margin-bottom: var(--space-4); }
.settings__panel .form__input, .settings__panel .form__textarea, .settings__panel .form__select, .settings__panel input, .settings__panel textarea { width: 100%; }
/* Toggle rows: label on the left, an iOS-style switch on the right. */
/* Cap the row so the switch sits a tidy distance from its label instead of being
   marooned at the far edge of a wide panel. */
.settings__toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); max-width: 30rem; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.settings__toggle:last-of-type { border-bottom: none; margin-bottom: var(--space-4); }

/* iOS-style toggle switch — only checkboxes inside a .settings__toggle row become
   one (so a ClearableFileInput's "Clear" checkbox stays a plain checkbox). */
.settings__toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 24px; flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--border);
  position: relative; cursor: pointer;
  transition: background var(--transition);
}
.settings__toggle input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.settings__toggle input[type="checkbox"]:checked { background: var(--accent-brand); }
.settings__toggle input[type="checkbox"]:checked::after { transform: translateX(20px); }
.settings__toggle input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ring); }

/* Circular avatar preview above the profile's file input. */
.avatar-edit { display: flex; align-items: center; gap: var(--space-4); margin-bottom: 0; }
.avatar-edit__img { flex-shrink: 0; width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--surface-2); border: 1px solid var(--border); }
.avatar-edit__controls { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }

/* Settings forms: group fields into titled sections with a responsive 2-col grid
   so the panel reads as a structured form, not one tall stack of full-width boxes. */
.settings__section { border: 0; padding: 0; margin: 0; }
.settings__section + .settings__section { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.settings__section-title { margin: 0 0 var(--space-4); padding: 0; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-5); }
.form-grid .form__group { margin-bottom: 0; }
.form__group--full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Save row: the action button plus a dirty-state "unsaved" hint (Datastar-driven). */
.settings__actions { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.settings__dirty { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--accent-brand); }
.settings__dirty::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* A transient saved/notice banner. */
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
  max-height: 120px;
  overflow: hidden;
}
.flash--dismissed {
  opacity: 0 !important;
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
.flash--success {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}
.flash--info {
  background: color-mix(in srgb, var(--accent-brand) 14%, transparent);
  color: var(--accent-brand);
  border: 1px solid color-mix(in srgb, var(--accent-brand) 35%, transparent);
}
.flash--error,
.flash--danger {
  background: color-mix(in srgb, var(--danger, #dc2626) 14%, transparent);
  color: var(--danger, #dc2626);
  border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 35%, transparent);
}
.flash__close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: bold;
  line-height: 1;
  padding: 0 var(--space-1);
  margin-left: auto;
}
.flash__close:hover {
  opacity: 1;
}

/* --- Avatar Cropper Modal ------------------------------------------------- */
.crop-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  max-width: 420px;
  width: 92vw;
  box-shadow: var(--shadow-hover);
  margin: auto;
}
.crop-modal:not([open]) {
  display: none !important;
}
.crop-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.crop-modal__card {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.crop-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.crop-modal__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}
.crop-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: var(--space-1);
}
.crop-modal__close:hover {
  color: var(--ink);
}
.crop-canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #111111;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  touch-action: none;
}
.crop-stage {
  /* Cropper.js fills its parent, so the stage needs a height of its own */
  height: 340px;
}
.crop-modal__help {
  font-size: var(--text-xs);
  margin: 0;
}
.crop-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  color: var(--ink-muted);
}
.crop-slider {
  flex: 1;
  accent-color: var(--accent-brand);
  cursor: pointer;
}
.crop-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* --- Inbox (2-pane: conversation list + thread) -------------------------- */
.inbox { display: grid; grid-template-columns: 320px 1fr; min-height: 520px; }
.inbox__list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 600px; }
.inbox__row { display: flex; gap: var(--space-3); width: 100%; text-align: left; padding: var(--space-4); border: none; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.inbox__row:hover { background: var(--surface-2); }
.inbox__row--active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent-brand); }
.inbox__row-main { min-width: 0; flex: 1; }
.inbox__row-top { display: flex; align-items: center; gap: var(--space-2); }
.inbox__sender { font-weight: 600; }
.inbox__dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--accent-brand); margin-left: auto; flex-shrink: 0; }
.inbox__subject { font-size: var(--text-sm); margin-top: 2px; }
.inbox__preview { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.inbox__chat { display: flex; flex-direction: column; max-height: 600px; }
.inbox__chat-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border); }
.inbox__chat-name { font-weight: 600; }
.inbox__messages { flex: 1; overflow-y: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.inbox__compose { display: flex; gap: var(--space-3); padding: var(--space-4); border-top: 1px solid var(--border); }
.inbox__compose .form__input { flex: 1; }
.inbox__placeholder { display: flex; align-items: center; justify-content: center; flex: 1; }

/* Chat bubbles: incoming left/neutral, mine right/brand. */
.bubble { max-width: 75%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-2); align-self: flex-start; }
.bubble--me { align-self: flex-end; background: var(--accent-brand); color: var(--accent-brand-ink); }
.bubble p { margin: 0; }
.bubble__time { display: block; font-size: var(--text-xs); opacity: 0.7; margin-top: var(--space-1); }

@media (max-width: 700px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox__list { max-height: 240px; }
}

/* --- Analytics (server-rendered CSS charts) ------------------------------ */
.analytics { padding-top: var(--space-5); padding-bottom: var(--space-8); }
.analytics__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.analytics__head h1 { margin: var(--space-2) 0 var(--space-1); }
.analytics__ranges { display: flex; gap: var(--space-2); }
.analytics__table { margin-top: var(--space-6); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin: var(--space-6) 0; }
.chart-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-5); }
.chart-card__title { margin: 0 0 var(--space-4); font-size: var(--text-lg); }
.chart-card__sub { margin: -0.5rem 0 var(--space-4); font-size: var(--text-sm); }

/* Reader-mix horizontal meters. */
.meter { margin-bottom: var(--space-4); }
.meter:last-child { margin-bottom: 0; }
.meter__head { display: flex; justify-content: space-between; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.meter__track { height: 10px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.meter__fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width var(--transition); }
.meter__fill--community { background: var(--accent-brand); }
.meter__fill--pro { background: var(--gold); }
.meter__fill--ai { background: #8b5cf6; }
.meter__fill--anonymous { background: var(--ink-muted); }

/* Retention vertical bar chart. */
.bars { display: flex; align-items: flex-end; gap: var(--space-2); height: 180px; padding-top: var(--space-4); }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: var(--space-2); }
.bars__bar { width: 100%; min-height: 2px; background: var(--accent-brand); border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: height var(--transition); }
.bars__label { font-size: var(--text-xs); color: var(--ink-muted); }

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

/* --- Marketing + legal pages --------------------------------------------- */
.page { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.page-hero { text-align: center; max-width: 760px; margin: 0 auto var(--space-8); }
.page-hero__eyebrow { font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-brand); }
.page-hero__title { font-family: var(--font-serif); font-size: var(--text-3xl); line-height: var(--leading-tight); margin: var(--space-3) 0; }
.page-hero__lead { font-size: var(--text-lg); color: var(--ink-muted); line-height: var(--leading-normal); }
.prose { max-width: 720px; margin: 0 auto; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-5); margin: var(--space-6) 0; }
.feature { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-5); }
.feature__title { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.feature__body { color: var(--ink-muted); line-height: var(--leading-normal); margin: 0; }

/* CSS-only FAQ accordions (native <details>). */
.accordion { max-width: 720px; margin: 0 auto; }
.accordion__cat { font-family: var(--font-display); font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-3); }
.accordion details { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); margin-bottom: var(--space-3); overflow: hidden; }
.accordion summary { cursor: pointer; padding: var(--space-4); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; color: var(--ink-muted); font-size: var(--text-lg); }
.accordion details[open] summary::after { content: "−"; }
.accordion details[open] summary { border-bottom: 1px solid var(--border); }
.accordion__answer { padding: var(--space-4); color: var(--ink-muted); line-height: var(--leading-normal); margin: 0; }

/* --- Editorial marketing motifs (why-f10p / ai-manifesto / resources) ----- */
/* Centred hero with an optional oversized ghosted backdrop word, a serif
   display title, a cyan underline divider and a pull-quote — the original's
   "premium editorial" language. */
.editorial { padding-top: var(--space-6); padding-bottom: var(--space-8); }
.editorial-hero { position: relative; text-align: center; max-width: 1160px; margin: 0 auto var(--space-6); padding: var(--space-10) var(--space-4) var(--space-6); }
.editorial-hero__ghost { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; font-family: var(--font-serif); font-weight: 700; font-size: clamp(4rem, 10.6vw, 8.5rem); line-height: 1; color: var(--ink); opacity: 0.10; white-space: nowrap; pointer-events: none; z-index: 0; user-select: none; }
.editorial-hero > :not(.editorial-hero__ghost) { position: relative; z-index: 1; }
.editorial-hero__title { font-family: var(--font-serif); font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; margin: var(--space-4) 0; color: var(--ink); }
.editorial-hero__title em { font-style: italic; color: inherit; }
.eyebrow-pill { display: inline-flex; align-items: center; gap: var(--space-1); background: color-mix(in srgb, var(--accent-brand) 14%, transparent); color: var(--accent-brand); padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-divider { width: 60px; height: 2px; background: var(--accent-brand); border: none; margin: var(--space-5) auto; }
.pull-quote { font-family: var(--font-serif); font-style: italic; font-size: var(--text-xl); line-height: 1.4; color: var(--ink-muted); max-width: 720px; margin: 0 auto; }
.pull-quote em { color: inherit; font-style: italic; font-weight: normal; }

/* Icon-led section heading. */
.icon-heading { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); font-size: var(--text-xl); margin: var(--space-8) 0 var(--space-4); }
.icon-heading__glyph { color: var(--accent-brand); }

/* Numbered narrative sections ("01 — Exposure"). */
.narrative { max-width: 820px; margin: var(--space-8) auto 0; }
.narrative__item { display: grid; grid-template-columns: auto 1fr; gap: var(--space-5); align-items: baseline; padding: var(--space-5) 0; border-bottom: 1px solid var(--border); }
.narrative__item:last-child { border-bottom: none; }
.narrative__num { font-family: var(--font-serif); font-style: italic; font-size: var(--text-2xl); color: var(--accent-brand); line-height: 1; }
.narrative__title { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.narrative__body { color: var(--ink-muted); line-height: var(--leading-normal); margin: 0; }

/* Editorial guardrail/feature cards with a round icon. */
.icon-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-5); margin: var(--space-6) 0; }
.icon-card { display: flex; gap: var(--space-4); align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-5); }
.icon-card__icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent-brand) 12%, transparent); color: var(--accent-brand); }
.icon-card__title { font-size: var(--text-base); margin: 0 0 var(--space-1); }
.icon-card__body { color: var(--ink-muted); line-height: var(--leading-normal); margin: 0; font-size: var(--text-sm); }

/* Editorial Team & Leadership cards */
.team-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  margin: var(--space-6) 0 var(--space-10);
}
.team-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-6);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.team-card:hover {
  border-color: color-mix(in srgb, var(--accent-brand) 40%, var(--border));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}
.team-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.team-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-brand) 12%, transparent);
  color: var(--accent-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  flex-shrink: 0;
  border: 1px solid var(--border);
  object-fit: cover;
  overflow: hidden;
}
.team-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.team-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 var(--space-1);
  color: var(--ink);
}
.team-card__role {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-brand);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}
.team-card__body {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  flex-grow: 1;
}
.team-card__body p {
  margin: 0 0 var(--space-3);
}
.team-card__body p:last-child {
  margin-bottom: 0;
}
.team-card__footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.team-card__linkedin {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.team-card__linkedin:hover {
  color: var(--accent-brand);
}
.team-card__linkedin svg {
  flex-shrink: 0;
}

/* --- Resources Grid Layout --- */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-6);
  margin: var(--space-6) 0;
}
.resources-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle, #f1f5f9);
  border-radius: 16px;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition-slow);
}
.resources-card:hover {
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.04), 0 8px 8px -6px rgba(0, 0, 0, 0.04);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent-brand) 30%, var(--border-subtle, #f1f5f9));
}
.resources-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.resources-card__icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f0f9ff;
  color: #0284c7;
  transition: background var(--transition), color var(--transition);
}
:root[data-theme="dark"] .resources-card__icon-wrapper,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .resources-card__icon-wrapper {
    background: #0c4a6e;
    color: #38bdf8;
  }
}
.resources-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  margin: 0;
}
.resources-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.resources-item {
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}
.resources-item:last-child {
  border-bottom: none;
}
.resources-item__title {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
}
.resources-link {

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.125rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
  transition: color var(--transition), padding-left var(--transition);
}
.resources-link:hover {
  color: var(--accent-brand-hover, #0098d4);
  padding-left: 2px;
}
.resources-link__arrow {
  color: var(--ink-muted);
  opacity: 0.35;
  transition: transform var(--transition), color var(--transition), opacity var(--transition);
}
.resources-link:hover .resources-link__arrow {
  transform: translateX(6px);
  color: var(--accent-brand);
  opacity: 1;
}
.resources-card--masterclass {
  background: linear-gradient(rgba(15, 23, 42, 0.45), rgba(15, 23, 42, 0.95)), url('../img/typewriter_bg.jpg') no-repeat center center / cover;
  border: 1px solid #1e293b;
  color: #ffffff;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 350px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.resources-card--masterclass:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
}
.masterclass-badge {
  align-self: flex-start;
  background: #0ea5e9;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: auto;
}
.masterclass-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  margin: var(--space-4) 0 var(--space-2);
}
.masterclass-desc {
  color: #94a3b8;
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0 0 var(--space-6);
}
.masterclass-cta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: #38bdf8;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: color var(--transition), gap var(--transition);
}
.masterclass-cta:hover {
  color: #7dd3fc;
  gap: calc(var(--space-2) + 4px);
}


.cta-banner { text-align: center; background: radial-gradient(circle at top right, #1a1a1a, #000); color: #fff; border-radius: var(--radius-lg); padding: var(--space-8); margin: var(--space-8) auto 0; max-width: 900px; }

.cta-banner h2 { font-family: var(--font-serif); font-style: italic; font-size: var(--text-2xl); margin: 0 0 var(--space-3); }
.cta-banner p { color: rgba(255,255,255,0.85); margin: 0 0 var(--space-5); }

/* Footer — ported from the original (brand + 4 link columns + legal/socials row). */
.site-footer { background: var(--bg); border-top: 1px solid var(--border); margin-top: var(--space-8); padding: var(--space-8) 0; color: var(--ink-muted); font-size: var(--text-sm); }
.site-footer__top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: var(--space-8); margin-bottom: var(--space-8); }
.site-footer__brand { max-width: 320px; }
.site-footer__brand .logo-wrapper { display: inline-block; margin-bottom: var(--space-5); }
.site-footer__brand .site-logo { height: 32px; width: auto; }
.site-footer__mission { line-height: var(--leading-normal); color: var(--ink-muted); margin: 0; }
.site-footer__mission strong { color: var(--ink); }
.site-footer__heading { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); font-weight: 700; margin: 0 0 var(--space-5); }
.site-footer__col ul { list-style: none; margin: 0; padding: 0; }
.site-footer__col li { margin-bottom: var(--space-3); }
.site-footer__col a { color: var(--ink); }
.site-footer__col a:hover { color: var(--accent); }
.site-footer__bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-4); padding-top: var(--space-6); border-top: 1px solid var(--border); }
.site-footer__legal { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-5); }
.site-footer__legal a { color: inherit; }
.site-footer__legal a:hover { color: var(--accent-brand); }
.site-footer__build { font-family: var(--font-mono); font-size: 0.75em; opacity: 0.6; }
.site-footer__divider { opacity: 0.3; }
.site-footer__socials { display: flex; gap: var(--space-5); }
.site-footer__socials a { color: var(--ink-muted); display: inline-flex; transition: color var(--transition); }
.site-footer__socials a:hover { color: var(--accent-brand); }

@media (max-width: 900px) {
  .site-footer__top { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
  .site-footer__brand { grid-column: 1 / -1; max-width: 100%; }
  .site-footer__bottom { flex-direction: column; align-items: flex-start; }
}

/* --- Upload (writer dashboard) ------------------------------------------- */
/* Cloned from the old Next.js upload page. That page actually renders its card
   interiors UNSTYLED (its <style jsx> is scoped to the parent component while the
   card markup lives in child components — a styled-jsx scope bug), so we render
   the source's INTENDED design instead. Colours map old->new theme tokens
   (--card-bg->--surface, --background->--bg, --foreground->--ink, etc.) so the
   page tracks the OS scheme exactly like the old; a few intentional hardcoded
   constants (the dark "Generate" gradient, the light blue file-selected chip) are
   kept literal, as in the original. Namespaced .upload-* to avoid colliding with
   the existing .card / .section-header / .btn-primary blocks. */
.upload-page { padding-top: var(--space-6); padding-bottom: 6rem; background: var(--bg); }

.upload-header { text-align: center; margin-bottom: var(--space-8); }
.upload-header h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: var(--space-2); }
.upload-header p { color: var(--ink-muted); font-size: 1.1rem; }

.upload-grid { display: grid; grid-template-columns: 340px 1fr; gap: var(--space-8); margin-bottom: var(--space-6); align-items: start; }
.upload-sidebar { display: flex; flex-direction: column; gap: var(--space-6); }

/* Card shell (one per section). */
.upload-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: var(--space-6); box-shadow: var(--shadow-sm); }
.upload-card__title { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); color: var(--ink); }
.upload-card__title h2 { font-size: 1.25rem; margin: 0; }
.upload-card__title svg { color: var(--accent); }   /* the original's icon-accent */

/* Visual Identity — 2:3 vertical screenplay poster dropzone */
.upload-cover {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: var(--cover-ratio);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.upload-cover:hover { border-color: var(--ink-muted); box-shadow: var(--shadow-md); }
.upload-cover__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload-cover__placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-4); color: var(--ink-muted); text-align: center; }
.upload-cover__area { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); font-size: 0.875rem; font-weight: 500; cursor: pointer; color: var(--ink); }
.upload-cover__area svg { color: var(--ink-muted); }
.upload-cover__area input { display: none; }   /* hidden file input the label opens */
.upload-cover__hint { font-size: 0.75rem; color: var(--ink-muted); text-align: center; margin-top: var(--space-2); }

/* AI Cover quick button */
.upload-cover__ai-row { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); margin-bottom: var(--space-1); }
.upload-cover__ai-btn { display: inline-flex; align-items: center; gap: var(--space-2); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 14px; font-size: var(--text-xs); font-weight: 500; color: var(--ink-muted); cursor: pointer; transition: all var(--transition-fast); }
.upload-cover__ai-btn:hover { border-color: var(--accent-brand); color: var(--ink); background: var(--surface-2); }

/* AI Script Analysis Card (separated by clean gap) */
.upload-ai-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.upload-ai-card--active {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 1px var(--accent-brand), var(--shadow-sm);
}
.upload-ai-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.upload-ai-card__title { display: flex; align-items: center; gap: var(--space-2); color: var(--ink); margin-bottom: 0; }
.upload-ai-card__title h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.upload-ai-card__price {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-brand);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}
.upload-ai-card__desc { font-size: var(--text-xs); color: var(--ink-muted); line-height: 1.5; margin: 0; }

.upload-addon-active-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-top: var(--space-2);
  border: 1px solid #bbf7d0;
}

.upload-cart-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.upload-cart-summary__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
}
.upload-cart-summary__chip {
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.upload-cart-summary__chip--promo {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
  color: var(--success);
}

.upload-promo-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.upload-promo-strip__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.upload-promo-box {
  display: flex;
  align-items: center;
}

.upload-promo-input-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px 4px 3px var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.upload-promo-input-wrap:focus-within {
  border-color: var(--accent-brand);
  box-shadow: var(--ring);
  background: var(--surface);
}

.upload-promo-icon {
  display: flex;
  align-items: center;
  color: var(--ink-muted);
  margin-right: var(--space-2);
  flex-shrink: 0;
}

.upload-promo-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink);
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0;
}

.upload-promo-input::placeholder {
  color: var(--ink-muted);
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.upload-promo-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.upload-promo-btn:hover {
  background: var(--accent-brand);
  color: var(--accent-brand-ink);
  border-color: var(--accent-brand);
}

.upload-promo-status {
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.upload-promo-status__msg {
  font-weight: 500;
}

.upload-promo-status--success {
  color: var(--success);
}

.upload-promo-status--error {
  color: var(--error);
}




/* Fields. */
.upload-field { margin-bottom: var(--space-5); }
.upload-field__label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: var(--space-2); color: var(--ink); }
.upload-req { color: var(--error); }
.upload-error { font-size: var(--text-sm); color: var(--error); margin-top: var(--space-1); }
/* Base text inputs (direct children only, so the tag/password/file inputs keep
   their own treatment). */
.upload-field > input,
.upload-field > textarea {
  width: 100%;
  height: 46px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.upload-field > select,
.upload-select {
  width: 100%;
  height: 46px;
  padding: var(--space-3) var(--space-8) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.upload-field > textarea { min-height: 90px; height: auto; resize: vertical; }
.upload-field > input:hover,
.upload-field > select:hover,
.upload-field > textarea:hover,
.upload-select:hover {
  background: var(--surface-2);
  border-color: var(--ink-muted);
}
.upload-field > input:focus,
.upload-field > select:focus,
.upload-field > textarea:focus,
.upload-select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent-brand);
  box-shadow: var(--ring);
}
.upload-field > select option,
.upload-select option {
  background-color: var(--surface);
  color: var(--ink);
  padding: var(--space-2);
}


.upload-row { display: flex; gap: var(--space-5); }
.upload-row .upload-field { flex: 1; }
.upload-row--top { align-items: flex-start; }
.upload-field--small { flex: 0 0 100px; }

/* PDF dropzone + the selected-file chip */
.upload-drop {
  position: relative;
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}

.upload-drop:hover {
  background: var(--surface-2);
  border-color: var(--ink-muted);
}

.upload-drop input[type="file"],
.upload-drop__input {
  display: none !important;
}

.upload-drop__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-muted);
  cursor: pointer;
  padding: var(--space-4) var(--space-2);
  text-align: center;
}

.upload-drop__icon {
  color: var(--accent-brand);
  margin-bottom: 2px;
}

.upload-drop__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink);
}

.upload-drop__sub {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.upload-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: #0369a1;
  gap: var(--space-3);
}

.upload-selected__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.upload-selected__icon {
  color: #0284c7;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-selected__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.upload-selected__name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-selected__meta {
  font-size: var(--text-xs);
  color: #64748b;
  margin-top: 2px;
}

.upload-selected__replace-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: #0284c7;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.upload-selected__replace-btn:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

/* Collaborator / Co-Writer selection and live search dropdown */
/* Collaborator / Co-Writer selection and live search */
.collaborator-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: 46px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.collaborator-chip:hover {
  border-color: var(--border-emphasis, var(--ink-muted));
}

.collaborator-chip__main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.collaborator-chip__avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  object-fit: cover;
  object-position: top;
  background: var(--surface-2);
  flex-shrink: 0;
}

.collaborator-chip__name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaborator-chip__handle {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaborator-chip__badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-brand) 12%, transparent);
  color: var(--accent-brand);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.collaborator-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.collaborator-chip__remove:hover {
  background: color-mix(in srgb, var(--error, #ef4444) 12%, transparent);
  color: var(--error, #ef4444);
}

.collaborator-search-box {
  position: relative;
  width: 100%;
}

.collaborator-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.collaborator-search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-muted);
  pointer-events: none;
}

.collaborator-search-input {
  width: 100%;
  height: 46px;
  padding: var(--space-3) var(--space-4) var(--space-3) 40px !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.collaborator-search-input:hover {
  background: var(--surface-2);
  border-color: var(--ink-muted);
}

.collaborator-search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent-brand);
  box-shadow: var(--ring);
}

.collaborator-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  padding: var(--space-1);
}

.collaborator-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.collaborator-result-item {
  margin: 0;
  padding: 0;
}

.collaborator-result-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background var(--transition-fast);
}

.collaborator-result-btn:hover {
  background: var(--surface-2);
}

.collaborator-result-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.collaborator-result-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  object-fit: cover;
  object-position: top;
  background: var(--surface-2);
  flex-shrink: 0;
}

.collaborator-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.collaborator-result-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaborator-result-meta {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaborator-result-add {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-brand);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-brand) 10%, transparent);
  transition: all var(--transition-fast);
}

.collaborator-result-btn:hover .collaborator-result-add {
  background: var(--accent-brand);
  color: var(--accent-brand-ink);
}

.collaborator-no-results {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* Privacy toggle. */
.upload-privacy { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.upload-privacy__option { position: relative; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); transition: background var(--transition), border-color var(--transition); }
.upload-privacy__option:hover { background: var(--surface-2); }
.upload-privacy__option.is-active { background: var(--surface); border-color: var(--accent); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.upload-privacy__text { display: flex; flex-direction: column; }
.upload-privacy__name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.upload-privacy__desc { font-size: 0.75rem; color: var(--ink-muted); }
.upload-privacy__indicator { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }

/* Genre tags (the "+ Add Tag" reveal + the inline input). */
.upload-tags { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.upload-tag { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: 100px; font: inherit; font-size: 0.85rem; }
.upload-tag--add { border: 1px dashed var(--ink-muted); background: transparent; color: var(--ink-muted); cursor: pointer; }
.upload-tag--add:hover { border-color: var(--accent-brand); color: var(--accent-brand); }
.upload-tags .upload-taginput { width: 150px; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 0.85rem; background: var(--bg); color: var(--ink); }
.upload-tags .upload-taginput:focus { outline: none; border-color: var(--accent-brand); box-shadow: var(--ring); }

/* Private-script password with a reveal toggle. */
.upload-pw { position: relative; display: flex; align-items: center; }
/* The old page highlights the password input with an --accent border (it maps
   to white in dark / near-black in light), not the cyan focus accent. */
.upload-pw__input { width: 100%; padding: var(--space-3); padding-right: 40px; border: 1px solid var(--accent); border-radius: 8px; font: inherit; font-size: 0.95rem; background: var(--bg); color: var(--ink); }
.upload-pw__input:focus { outline: none; box-shadow: var(--ring); }
.upload-pw__toggle { position: absolute; right: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 4px; background: none; border: none; color: var(--ink-muted); cursor: pointer; }
.upload-pw__toggle:hover { color: var(--ink); }
.upload-hint { font-size: 0.75rem; color: var(--ink-muted); margin-top: var(--space-2); }

/* Get Professional Coverage — horizontally scrolling reviewer rail. */
.upload-market { margin-bottom: 4rem; }
.upload-market__head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.upload-market__head h2 { font-size: 1.75rem; margin: 0; }
.upload-market__opt { font-size: 0.8em; font-weight: 400; color: var(--ink); }
.upload-reviewers { display: flex; gap: var(--space-5); overflow-x: auto; padding-bottom: var(--space-4); }
.upload-reviewer { flex: 0 0 280px; display: flex; flex-direction: column; background: var(--surface); border: 2px solid transparent; border-radius: 12px; padding: var(--space-5); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); transition: transform var(--transition), box-shadow var(--transition); }
.upload-reviewer:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); }
.upload-reviewer__avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--border); margin-bottom: var(--space-4); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.upload-reviewer__avatar img { width: 100%; height: 100%; object-fit: cover; }
.upload-reviewer__info { flex: 1; }
.upload-reviewer__info h3 { font-size: 1.1rem; margin-bottom: var(--space-1); }
.upload-reviewer__role { font-size: 0.85rem; color: var(--ink-muted); margin-bottom: var(--space-3); }
.upload-reviewer__rating { display: flex; align-items: center; gap: var(--space-1); font-weight: 700; font-size: 0.9rem; margin-bottom: var(--space-3); }
.upload-reviewer__tags { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-4); }
.upload-reviewer__tags span { background: var(--border); color: var(--ink-muted); padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.upload-reviewer__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--border); }
.upload-reviewer__price { font-weight: 700; font-size: 1.1rem; }
.upload-reviewer__select { background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-4); border-radius: 6px; font-size: 0.85rem; font-weight: 600; transition: opacity var(--transition); }
.upload-reviewer__select:hover { opacity: 0.9; }
.upload-reviewers__empty { flex: 1; padding: var(--space-6) 0; }

/* Action bar. */
.upload-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-2);
  flex-wrap: wrap;
}
.upload-actions__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.upload-actions__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}
.upload-actions__cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.upload-actions__cancel:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.upload-actions__submit {
  min-height: 44px;
  padding: 0.75rem 1.75rem;
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), opacity var(--transition-fast), box-shadow var(--transition-fast);
}
.upload-actions__submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  .upload-grid { grid-template-columns: 1fr; }
  .upload-cover { max-width: 300px; margin: 0 auto var(--space-5); }
}
@media (max-width: 640px) {
  .upload-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .upload-actions__left {
    justify-content: center;
  }
  .upload-actions__right {
    width: 100%;
    flex-direction: column-reverse;
  }
  .upload-actions__cancel,
  .upload-actions__submit {
    width: 100%;
    text-align: center;
  }
}

/* --- Studio (Writers Studio — the creator dashboard) --------------------- */
/* Cloned from the old Next.js /studio (WriterDashboard). The old renders on the
   theme tokens (light default, flips dark with the OS), so this does too: colours
   map old->new (--card-bg->--surface, --foreground->--ink, --text-secondary->
   --ink-muted, --border-light->--border, --accent stays --accent). A handful of
   the old's hardcoded CONSTANTS are kept literal — the saturated pastel stat-icon
   chips, the light-green "Live" badge, the navy promo gradient and the cyan
   "Analyze" button — exactly as the original draws them in both themes.
   Namespaced .studio-* to avoid colliding with the generic .sidebar / .badge /
   .section-header blocks. */
.studio-page { padding: 40px 0 80px; background: var(--bg); min-height: 100vh; }

/* Header */
.studio-header { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-5); margin-bottom: 40px; }
.studio-header__titles h1 { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); margin-bottom: var(--space-2); }
.studio-header__titles p { color: var(--ink-muted); font-size: 1.1rem; }
/* "Upload" — the old's btn-dark: a solid --accent pill that flips with the theme. */
.studio-upload-btn { flex-shrink: 0; background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1.25rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; text-decoration: none; transition: transform var(--transition), opacity var(--transition); }
.studio-upload-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Stats row */
.studio-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); margin-bottom: 40px; }
.studio-stat { display: flex; align-items: center; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: var(--space-6); box-shadow: var(--shadow-sm); }
.studio-stat__icon { flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
/* Pastel chips — constants from the old (kept literal across both themes). */
.studio-stat__icon--purple { background: #f5f3ff; color: #7c3aed; }
.studio-stat__icon--blue { background: #eff6ff; color: #3b82f6; }
.studio-stat__icon--gold { background: #fffbeb; color: #d97706; }
.studio-stat__icon--teal { background: #f0fdfa; color: #0d9488; }
.studio-stat__label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--ink-muted); margin-bottom: var(--space-1); }
.studio-stat__value { font-size: 1.5rem; font-weight: 700; color: var(--ink); }

/* Two-column layout: manuscripts panel + sidebar */
.studio-grid { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-6); align-items: flex-start; }

/* Manuscripts panel */
.studio-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.studio-panel__header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-6); border-bottom: 1px solid var(--border); }
.studio-panel__header h2 { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.studio-search { display: flex; align-items: center; gap: var(--space-2); width: 240px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.studio-search svg { flex-shrink: 0; color: var(--ink-muted); }
.studio-search input { width: 100%; background: transparent; border: none; outline: none; font: inherit; font-size: 0.875rem; color: var(--ink); }

/* Manuscript rows */
.studio__list { min-height: 400px; }
.studio-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 16px var(--space-5); border-bottom: 1px solid var(--border); transition: background var(--transition); }
.studio-row:last-child { border-bottom: none; }
.studio-row:hover { background: var(--bg); }
.studio-row__visual { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-width: 0; }
.studio-row__cover { flex-shrink: 0; width: 44px; height: 60px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.studio-row__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.studio-row__info { min-width: 0; flex: 1; }
.studio-row__title-wrap { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 3px; flex-wrap: wrap; }
.studio-row__info h3 { font-size: 0.975rem; font-weight: 700; color: var(--ink); margin: 0; }
.studio-row__info h3 a { color: var(--ink); text-decoration: none; }
.studio-row__info h3 a:hover { color: var(--accent-brand); }
.studio-row__meta { font-size: 0.8125rem; color: var(--ink-muted); }

/* "Live" status badge — a light-green constant from the old. */
.studio-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; background: #f0fdf4; color: #16a34a; border-radius: 100px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.studio-badge__dot { width: 5px; height: 5px; background: #16a34a; border-radius: 50%; }

/* Row actions */
.studio-row__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.studio-action { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink-muted); font-size: 0.775rem; font-weight: 500; font-family: inherit; cursor: pointer; line-height: normal; text-decoration: none; white-space: nowrap; transition: color var(--transition), background var(--transition), border-color var(--transition); }
.studio-action:hover { color: var(--ink); background: var(--bg); border-color: var(--ink-muted); }
.studio-action--danger:hover { color: var(--error); border-color: var(--error); background: var(--surface-2); }
.studio-action--locked { border-style: dashed; }
.studio-action--locked:hover { color: var(--accent-brand); border-color: var(--accent-brand); border-style: solid; background: color-mix(in srgb, var(--accent-brand) 8%, transparent); }
.studio-action--icon-only { padding: 5px 8px; }
.studio-action svg { flex-shrink: 0; }

.analysis-select-card--selected {
  border-color: var(--accent-brand) !important;
  box-shadow: 0 0 0 1px var(--accent-brand), var(--shadow-sm);
  background: color-mix(in srgb, var(--accent-brand) 4%, var(--surface)) !important;
}

/* Studio Analyze Multi-Script Order Grid */
.analysis-order-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-8);
  align-items: start;
}

.analysis-order-summary {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (max-width: 800px) {
  .analysis-order-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .analysis-order-summary {
    position: static;
    top: auto;
  }
}

/* Empty / no-match states */

.studio-empty {
  padding: var(--space-8) var(--space-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.studio-empty__icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}
.studio-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--space-2);
}
.studio-empty p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  max-width: 440px;
  line-height: 1.5;
  margin: 0 0 var(--space-5);
}
.studio-empty__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  width: 100%;
  max-width: 600px;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  text-align: left;
}
.studio-empty__step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.studio-empty__step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.studio-empty__step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.studio-empty__step-text strong {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--ink);
}
.studio-empty__step-text span {
  font-size: 0.775rem;
  color: var(--ink-muted);
  line-height: 1.35;
}
.studio-empty__step-text a {
  color: var(--accent-brand);
  text-decoration: none;
}
.studio-empty__step-text a:hover {
  text-decoration: underline;
}
.studio-nomatch {
  padding: 60px 40px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

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


/* Sidebar */
.studio-sidebar { display: flex; flex-direction: column; gap: var(--space-5); }
.studio-side-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: var(--space-6); }
.studio-side-card h3 { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 20px; }
/* Promo — a navy gradient constant from the old (identical in both themes). */
.studio-side-card--promo { background: linear-gradient(135deg, #001524 0%, #002b4d 100%); border: none; color: #fff; }
.studio-side-card--promo h3 { font-size: 1.125rem; margin-bottom: 12px; color: #fff; }
.studio-side-card--promo p { font-size: 0.875rem; line-height: 1.6; color: #94a3b8; margin-bottom: 20px; }
.studio-analyze { width: 100%; padding: 10px; background: #00aed6; color: #fff; border: none; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; transition: opacity var(--transition); }
.studio-analyze:hover { opacity: 0.9; }

/* Recent activity */
.studio-activity { display: flex; flex-direction: column; gap: 20px; }
.studio-activity__item { display: flex; gap: var(--space-3); }
.studio-activity__icon { flex-shrink: 0; line-height: 0; margin-top: 2px; }
.studio-activity__icon--check { color: #10b981; }
.studio-activity__icon--msg { color: #00aed6; }
.studio-activity__icon--star { color: var(--gold, #f59e0b); }
.studio-activity__icon--heart { color: #f43f5e; }
.studio-activity__icon--eye { color: var(--accent-brand, #3b82f6); }
.studio-activity__text p { font-size: 0.875rem; color: var(--ink); margin-bottom: 2px; }
.studio-activity__text span { font-size: 0.75rem; color: var(--ink-muted); }

@media (max-width: 900px) {
  .studio-stats { grid-template-columns: repeat(2, 1fr); }
  .studio-grid { grid-template-columns: 1fr; }
  .studio-row { flex-wrap: wrap; }
}

/* --- Upload Success / Congratulations page -------------------------------- */
.upload-success {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--space-8) var(--space-6);
}

.upload-success__inner {
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 5rem;
  align-items: center;
}

/* Left column */
.upload-success__left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: calc(-1 * var(--space-6));
}

.upload-success__check {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.upload-success__headline {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.upload-success__sub {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-6);
  max-width: 380px;
  line-height: 1.5;
}

/* Share link input pill box */
.upload-success__share {
  width: 100%;
  max-width: 480px;
  margin-bottom: var(--space-6);
}

.upload-success__share-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.upload-success__link-icon {
  color: #0284c7;
  flex-shrink: 0;
}

.upload-success__url-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-success__copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: #00a0dc;
  background: linear-gradient(135deg, #00adef 0%, #0093d5 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 2px 6px rgba(0, 160, 220, 0.25);
}

.upload-success__copy-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.upload-success__copy-btn:active {
  transform: translateY(0);
}

/* Secondary Action Links */
.upload-success__actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-left: 2px;
}

.upload-success__action-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--transition);
}

.upload-success__action-link svg {
  color: var(--ink);
}

.upload-success__action-link:hover {
  color: var(--accent-brand);
}

.upload-success__action-link:hover svg {
  color: var(--accent-brand);
}

.upload-success__dot {
  color: var(--border);
  font-size: 1.2rem;
  line-height: 1;
  user-select: none;
}

/* Right column — tilted white physical card */
.upload-success__right {
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.upload-success__card {
  width: 350px;
  background: var(--surface);
  padding: 14px;
  border-radius: 24px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.08);
  transform: rotate(4deg);
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.upload-success__card:hover {
  transform: rotate(2deg) scale(1.02);
  box-shadow: 0 35px 80px -15px rgba(0, 0, 0, 0.24);
}

.upload-success__card-image-wrap {
  width: 100%;
  aspect-ratio: var(--cover-ratio);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
}

.upload-success__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-success__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-muted);
}

.upload-success__card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.84) 0%, rgba(0,0,0,0.4) 65%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upload-success__card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38bdf8;
}

.upload-success__card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
  line-height: 1.15;
  text-transform: uppercase;
}

.upload-success__card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 8px 6px 8px;
}

.upload-success__card-meta-left,
.upload-success__card-meta-right {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .upload-success__inner {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .upload-success__left {
    margin-top: 0;
  }
  .upload-success__right {
    display: none;
  }
}

/* --- Checkout (Stripe-style purchase card) ------------------------------- */
/* Cloned from the old Next.js /checkout. The old renders on the theme tokens
   (light default, flips dark with the OS), so this does too: colours map
   old->new (--card-bg->--surface, --foreground->--ink, --text-secondary->
   --ink-muted, --border-light->--border, --background->--bg). The cyan accents
   (#00d4ff checkbox/border/focus; #00a3d9/#0093c2 submit button) and the Stripe
   drop-shadow are CONSTANTS kept literal in both themes, exactly as the original
   draws them — same call the studio block makes for its cyan "Analyze" button.
   Namespaced .checkout-* to avoid colliding with the generic .form / .badge. */
.checkout-page { min-height: 100vh; background: var(--bg); padding: 64px 16px; font-family: var(--font-body); }

/* Header */
.checkout-header { text-align: center; margin-bottom: var(--space-6); }
.checkout-header h1 { font-size: 2rem; font-weight: 700; color: var(--ink); margin-bottom: var(--space-2); }
.checkout-header p { color: var(--ink-muted); font-size: 1.1rem; }

/* Card */
.checkout-container { max-width: 500px; margin: 0 auto; }
/* The Stripe drop-shadow is a literal constant (kept across both themes). */
.checkout-card { background: var(--surface); border-radius: 8px; box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07); padding: var(--space-6); }

/* Service section */
.checkout-section { margin-bottom: var(--space-5); }
.checkout-section h2 { font-size: 1.25rem; font-weight: 600; color: var(--ink); margin-bottom: var(--space-2); }
.checkout-sub { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: var(--space-5); }
.checkout-services { display: flex; flex-direction: column; gap: var(--space-4); }
.checkout-service { display: flex; align-items: center; padding: var(--space-4); border: 1px solid var(--border); border-radius: 6px; }
/* Selected row: cyan border (constant) + a subtle cyan tint of the surface. The
   old hardcodes background:#F0FBFF here, which renders the --ink title/price
   near-invisible under OS dark (a real bug); the surface tint keeps both legible
   in either theme while matching the old's light-mode look (≈ #F0FBFF on white). */
.checkout-service--selected { border-color: #00d4ff; background: color-mix(in srgb, #00d4ff 8%, var(--surface)); }
.checkout-service__check { margin-right: var(--space-4); line-height: 0; }
.checkout-checkbox { display: block; width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 4px; }
.checkout-checkbox--checked { background: #00d4ff; border-color: #00d4ff; }
.checkout-service__info { flex: 1; min-width: 0; }
.checkout-service__name { display: block; font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.checkout-service__desc { display: block; color: var(--ink-muted); font-size: 0.85rem; }
.checkout-service__price { padding-left: var(--space-4); font-weight: 700; color: var(--ink); }

/* Order total — bg is --border-light (the old's grey tray) -> --border here. */
.checkout-total { background: var(--border); padding: var(--space-4); border-radius: 6px; margin-top: var(--space-5); }
.checkout-total__row { display: flex; justify-content: space-between; align-items: center; }
.checkout-total__label { color: var(--ink-muted); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.checkout-total__amount { font-size: 1.5rem; font-weight: 700; color: var(--ink); }

/* Divider with centred "PAYMENT DETAILS" caption between two hairlines. */
.checkout-divider { display: flex; align-items: center; margin: var(--space-6) 0; color: var(--ink-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.checkout-divider::before, .checkout-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.checkout-divider span { padding: 0 var(--space-4); }

/* Payment form */
.checkout-field { margin-bottom: var(--space-4); }
.checkout-field-row { display: flex; gap: var(--space-4); }
.checkout-field-row .checkout-field { flex: 1; }
.checkout-form label { display: block; color: var(--ink-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-bottom: var(--space-2); letter-spacing: 0.05em; }
.checkout-form input { width: 100%; padding: var(--space-3); border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); transition: border-color var(--transition), box-shadow var(--transition); }
/* Focus ring uses the literal cyan to match the old (not the brand token). */
.checkout-form input:focus { outline: none; border-color: #00d4ff; box-shadow: 0 0 0 1px #00d4ff; }
.checkout-input-icon { position: relative; }
.checkout-input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); }
.checkout-input-icon input { padding-left: 2.5rem; }

/* Submit — solid cyan button (constants), Stripe drop-shadow. */
.checkout-submit { width: 100%; padding: var(--space-4); background: #00a3d9; color: #fff; border: none; border-radius: 6px; font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-4); box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08); transition: background var(--transition); }
.checkout-submit:hover { background: #0093c2; }
.checkout-submit svg { flex-shrink: 0; }

/* Trust footer */
.checkout-secure { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-6); color: var(--ink-muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.checkout-secure svg { flex-shrink: 0; }

/* Confirmation card (checkout_done — no old counterpart; reuses the card look). */
.checkout-confirm { text-align: center; }
.checkout-confirm__icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); margin-bottom: var(--space-4); }
.checkout-confirm h1 { font-size: 1.75rem; font-weight: 700; color: var(--ink); margin-bottom: var(--space-2); }
.checkout-confirm__sub { color: var(--ink-muted); font-size: 0.95rem; margin: 0 auto var(--space-5); max-width: 36ch; }
.checkout-confirm__summary { text-align: left; border: 1px solid var(--border); border-radius: 6px; padding: var(--space-4); margin-bottom: var(--space-5); }
.checkout-confirm__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.checkout-confirm__row + .checkout-confirm__row { margin-top: var(--space-3); }
.checkout-confirm__row span { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.checkout-confirm__row--muted span { color: var(--ink-muted); font-weight: 500; font-size: 0.85rem; }
.checkout-confirm__amount { font-weight: 700; }
.checkout-confirm__btn { text-decoration: none; margin-top: 0; }

/* --- Pro dashboard (reviewer/provider workspace) ------------------------- */
/* Cloned from the OLD Next.js /pro/dashboard — a full-screen 3-column app shell
   (no site chrome). The OLD renders on the theme tokens (light default, flips
   dark with the OS), so this does too: old->new (--background->--bg,
   --card-bg->--surface, --foreground->--ink, --text-secondary->--ink-muted,
   --border-light->--border, --accent/--accent-foreground unchanged). The
   editorial CONSTANTS are kept literal in both themes: brand blue #2563EB, golds
   #C29559/#D4AF37, slate #2D3748, the #F0F9FF active-nav fill with fixed #111
   text, the #FFE8D6/#D97706 avatar, and the pastel queue badges. EVERY rule is
   scoped under .dashboard-wrapper so the old's generic class names never collide
   with the global .sidebar/.badge/.btn-primary/.avatar (the scope out-specifies
   them and survives the SSE morph, which keeps the ancestor in place). */
body.pro-dash-fullscreen { overflow-x: hidden; }

.dashboard-wrapper { display: grid; grid-template-columns: 260px 1fr 320px; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font-body); }

/* Sidebar */
.dashboard-wrapper .sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 2rem 1.5rem; position: sticky; top: 0; height: 100vh; }
.dashboard-wrapper .brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 3rem; padding-left: 0.5rem; }
.dashboard-wrapper .brand-text { display: flex; flex-direction: column; line-height: 1; }
.dashboard-wrapper .brand-title { font-weight: 900; font-size: 1.5rem; letter-spacing: -0.05em; line-height: 1; color: var(--ink); font-family: var(--font-body); }
.dashboard-wrapper .brand-subtitle { font-size: 0.65rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; font-weight: 600; }
.dashboard-wrapper .nav-menu { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.dashboard-wrapper .nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border: none; background: none; border-radius: 8px; color: var(--ink-muted); font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: all 0.2s; text-align: left; }
.dashboard-wrapper .nav-item:hover { background: var(--border); color: var(--ink); }
/* Active pill: a fixed light-blue fill with fixed dark text (constant). */
.dashboard-wrapper .nav-item.active { background: #f0f9ff; color: #111; font-weight: 600; }
.dashboard-wrapper .nav-item svg { flex-shrink: 0; }
.dashboard-wrapper .profile-section { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.dashboard-wrapper .profile-card { display: flex; align-items: center; gap: 0.75rem; }
.dashboard-wrapper .avatar { width: 40px; height: 40px; background: #ffe8d6; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #d97706; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.dashboard-wrapper .avatar img { width: 100%; height: 100%; object-fit: cover; }
.dashboard-wrapper .profile-name { font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.dashboard-wrapper .profile-role { font-size: 0.75rem; color: var(--ink-muted); }

/* Main stage */
.dashboard-wrapper .main-stage { padding: 3rem 4rem; overflow-y: auto; }
.dashboard-wrapper .page-header { margin-bottom: 3rem; }
.dashboard-wrapper .page-header h1 { font-family: var(--font-display); font-size: 2.5rem; color: var(--ink); margin-bottom: 0.5rem; font-weight: 700; letter-spacing: -0.03em; }
.dashboard-wrapper .page-header p { color: var(--ink-muted); font-size: 1.1rem; }
.dashboard-wrapper .highlight-text { color: #2563eb; font-weight: 600; }

/* Workspace queue */
.dashboard-wrapper .queue-list { display: flex; flex-direction: column; gap: 1.5rem; }
.dashboard-wrapper .queue-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; display: flex; align-items: center; gap: 1.5rem; transition: all 0.2s ease; }
.dashboard-wrapper .queue-card:hover { border-color: var(--ink-muted); box-shadow: 0 4px 20px -5px rgba(0,0,0,0.05); transform: translateY(-2px); }
.dashboard-wrapper .card-thumb { width: 80px; height: 100px; background: var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; overflow: hidden; }
.dashboard-wrapper .card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dashboard-wrapper .card-details { flex: 1; min-width: 0; }
.dashboard-wrapper .card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.dashboard-wrapper .badge { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; padding: 0.25rem 0.75rem; border-radius: 100px; letter-spacing: 0.05em; }
.dashboard-wrapper .badge.in-progress { background: #ecfdf5; color: #047857; }
.dashboard-wrapper .badge.reserved { background: #f3f4f6; color: #4b5563; }
.dashboard-wrapper .badge.new-assignment { background: #fff7ed; color: #c2410c; }
.dashboard-wrapper .time-left { font-size: 0.75rem; color: var(--ink-muted); display: flex; align-items: center; gap: 0.35rem; }
.dashboard-wrapper .queue-card h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--ink); }
.dashboard-wrapper .meta-row { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--ink-muted); font-weight: 500; }
.dashboard-wrapper .meta-item { display: flex; align-items: center; gap: 0.4rem; }
.dashboard-wrapper .meta-splitter { color: var(--border); }
.dashboard-wrapper .card-actions { display: flex; flex-direction: column; gap: 0.5rem; min-width: 100px; }
.dashboard-wrapper .btn-primary { background: var(--accent); color: var(--accent-ink); border: none; padding: 0.6rem 1.2rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; transform: none; }
.dashboard-wrapper .btn-primary:hover { opacity: 0.9; transform: none; }
.dashboard-wrapper .btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); padding: 0.6rem 1.2rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.dashboard-wrapper .btn-secondary:hover { background: var(--bg); }
.dashboard-wrapper .btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }
.dashboard-wrapper .btn-text { color: #2563eb; font-size: 0.9rem; font-weight: 600; background: none; border: none; cursor: pointer; }
.dashboard-wrapper .empty-queue-notice { text-align: center; padding: 4rem 1rem; color: var(--ink-muted); display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }

/* Business rail */
.dashboard-wrapper .business-rail { background: var(--bg); border-left: 1px solid var(--border); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 2rem; height: 100vh; overflow-y: auto; position: sticky; top: 0; }
.dashboard-wrapper .rail-section { display: flex; flex-direction: column; }
.dashboard-wrapper .rail-header, .dashboard-wrapper .earnings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.dashboard-wrapper .rail-header h4, .dashboard-wrapper .earnings-header h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 700; margin: 0; }
.dashboard-wrapper .earnings-card { background: var(--surface); color: var(--ink); padding: 1.5rem; border-radius: 16px; position: relative; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.dashboard-wrapper .balance-display { display: flex; align-items: flex-start; margin-top: 0.5rem; line-height: 1; color: var(--ink); }
.dashboard-wrapper .currency { font-size: 1.5rem; margin-top: 0.2rem; opacity: 0.5; font-weight: 500; }
.dashboard-wrapper .amount { font-size: 3rem; font-weight: 700; letter-spacing: -0.03em; font-family: var(--font-display); }
.dashboard-wrapper .balance-label { font-size: 0.8rem; color: var(--ink-muted); margin-bottom: 2rem; font-weight: 500; }
.dashboard-wrapper .earnings-metrics { display: flex; justify-content: space-between; margin-bottom: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.dashboard-wrapper .metric { display: flex; flex-direction: column; }
.dashboard-wrapper .metric-val { font-size: 1rem; font-weight: 600; color: var(--ink); }
.dashboard-wrapper .metric-label { font-size: 0.7rem; color: var(--ink-muted); }
.dashboard-wrapper .text-green { color: #10b981; }
.dashboard-wrapper .mini-chart { display: flex; align-items: flex-end; justify-content: space-between; height: 40px; gap: 4px; opacity: 0.8; }
.dashboard-wrapper .bar { flex: 1; background: var(--border); border-radius: 2px; transition: all 0.3s; }
.dashboard-wrapper .bar:hover { background: var(--ink); }
.dashboard-wrapper .service-suite { background: var(--surface); padding: 1.5rem; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.dashboard-wrapper .service-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.dashboard-wrapper .service-item { background: var(--bg); padding: 1rem; border-radius: 12px; border: 1px solid var(--border); transition: opacity 0.2s; }
.dashboard-wrapper .service-item.inactive { opacity: 0.6; }
.dashboard-wrapper .service-main { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.dashboard-wrapper .service-info h5 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; color: var(--ink); }
.dashboard-wrapper .service-price { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); }
.dashboard-wrapper .service-meta { font-size: 0.7rem; color: var(--ink-muted); font-weight: 500; }
.dashboard-wrapper .toggle-btn { background: none; border: none; padding: 0; cursor: pointer; color: #2563eb; line-height: 0; }
.dashboard-wrapper .text-blue { color: #2563eb; }
.dashboard-wrapper .text-gray { color: var(--ink-muted); }
.dashboard-wrapper .icon-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--ink-muted); cursor: pointer; }
.dashboard-wrapper .icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.dashboard-wrapper .availability-card { margin-top: 0.5rem; }
.dashboard-wrapper .availability-card h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); margin-bottom: 0.75rem; }
.dashboard-wrapper .availability-toggle { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.75rem; }
.dashboard-wrapper .capacity-bar { height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; margin-bottom: 0.5rem; }
.dashboard-wrapper .capacity-fill { height: 100%; background: #2563eb; border-radius: 100px; }
.dashboard-wrapper .capacity-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-muted); font-weight: 500; }

/* Rail footer */
.dashboard-wrapper .rail-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.dashboard-wrapper .rail-links { display: flex; gap: 1rem; font-size: 0.7rem; color: var(--ink-muted); }
.dashboard-wrapper .rail-links a:hover { color: var(--ink); text-decoration: underline; }

/* Manuscripts tab */
.dashboard-wrapper .manuscripts-content { display: flex; flex-direction: column; gap: 2rem; min-height: 100%; }
.dashboard-wrapper .manu-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.dashboard-wrapper .serif-title { font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.dashboard-wrapper .manu-subtitle { color: var(--ink-muted); font-size: 1rem; font-weight: 500; font-family: var(--font-body); }
.dashboard-wrapper .gold-text { color: #c29559; font-weight: 600; }
.dashboard-wrapper .manu-controls { display: flex; align-items: center; gap: 1rem; }
.dashboard-wrapper .search-input { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); padding: 0.6rem 1rem; border-radius: 8px; width: 240px; gap: 0.5rem; color: var(--ink-muted); }
.dashboard-wrapper .search-input input { border: none; outline: none; font-size: 0.9rem; width: 100%; background: transparent; color: var(--ink); font-family: inherit; }
.dashboard-wrapper .icon-btn-plain { background: transparent; border: none; color: var(--ink-muted); cursor: pointer; transition: color 0.2s; padding: 0.5rem; line-height: 0; }
.dashboard-wrapper .icon-btn-plain:hover { color: var(--ink); }
.dashboard-wrapper .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.dashboard-wrapper .stat-box { background: var(--surface); border: 1px solid var(--border); padding: 1.5rem; border-radius: 4px; display: flex; flex-direction: column; gap: 0.5rem; }
.dashboard-wrapper .stat-label { font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.dashboard-wrapper .stat-value { font-size: 2.2rem; font-weight: 700; color: var(--ink); line-height: 1; font-family: var(--font-display); }
.dashboard-wrapper .stat-value.gold { color: #d4af37; }
.dashboard-wrapper .manu-list-container { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; }
.dashboard-wrapper .manu-list-header { display: flex; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; text-transform: uppercase; align-items: center; }
.dashboard-wrapper .manu-c-doc { flex: 0 0 60px; }
.dashboard-wrapper .manu-c-title { flex: 2; }
.dashboard-wrapper .manu-c-meta { flex: 1.5; }
.dashboard-wrapper .manu-c-date { flex: 1; }
.dashboard-wrapper .manu-c-rating { flex: 0 0 80px; text-align: center; }
.dashboard-wrapper .manu-c-link { flex: 1; text-align: right; }
.dashboard-wrapper .manu-row { display: flex; padding: 1.5rem; border-bottom: 1px solid var(--border); align-items: center; transition: background 0.1s; }
.dashboard-wrapper .manu-row:last-child { border-bottom: none; }
.dashboard-wrapper .manu-row:hover { background: var(--bg); }
.dashboard-wrapper .doc-icon { width: 40px; height: 56px; background: var(--border); display: flex; align-items: center; justify-content: center; color: var(--ink-muted); border-radius: 4px; overflow: hidden; position: relative; }
.dashboard-wrapper .doc-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.dashboard-wrapper .serif-title-sm { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--ink); margin-bottom: 0.2rem; }
.dashboard-wrapper .writer-name { font-size: 0.85rem; color: var(--ink-muted); font-style: italic; }
.dashboard-wrapper .meta-primary { display: block; font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.dashboard-wrapper .meta-sub { display: block; font-size: 0.7rem; color: var(--ink-muted); font-weight: 600; text-transform: uppercase; margin-top: 2px; }
.dashboard-wrapper .col-date { font-size: 0.9rem; color: var(--ink-muted); }
.dashboard-wrapper .rating-badge { background: var(--border); color: var(--ink); font-weight: 700; padding: 0.25rem 0.6rem; font-size: 0.9rem; border-radius: 4px; }
.dashboard-wrapper .coverage-link { display: inline-flex; align-items: center; gap: 0.5rem; text-align: right; font-size: 0.7rem; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.2; }
.dashboard-wrapper .manu-empty { padding: 3rem; text-align: center; color: var(--ink-muted); font-size: 0.9rem; }
.dashboard-wrapper .manu-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.9rem; color: var(--ink-muted); }
.dashboard-wrapper .page-controls { display: flex; }
.dashboard-wrapper .page-btn { background: var(--surface); border: 1px solid var(--border); padding: 0.5rem 0.75rem; font-size: 0.85rem; color: var(--ink-muted); cursor: pointer; margin-left: -1px; }
.dashboard-wrapper .page-btn:first-child { border-radius: 4px 0 0 4px; }
.dashboard-wrapper .page-btn:last-child { border-radius: 0 4px 4px 0; }
.dashboard-wrapper .page-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); z-index: 1; }
.dashboard-wrapper .page-btn:hover:not(.active) { background: var(--bg); }

/* Earnings tab */
.dashboard-wrapper .flex-header { display: flex; justify-content: space-between; align-items: flex-end; }
.dashboard-wrapper .display-title { font-family: var(--font-display); font-size: 2.5rem; font-weight: 900; line-height: 1; margin-bottom: 0.5rem; color: var(--ink); }
.dashboard-wrapper .subtitle { font-size: 1rem; color: var(--ink-muted); max-width: 400px; line-height: 1.5; }
.dashboard-wrapper .payout-widget { text-align: right; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; }
.dashboard-wrapper .payout-info { display: flex; flex-direction: column; }
.dashboard-wrapper .payout-info .label { font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; }
.dashboard-wrapper .payout-info .value { font-family: var(--font-display); font-size: 2rem; font-weight: 900; color: var(--ink); }
/* Slate "WITHDRAW" button — a constant from the old (both themes). */
.dashboard-wrapper .btn-dark { background: #2d3748; color: #fff; border: none; border-radius: 4px; padding: 0.6rem 1rem; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; text-transform: uppercase; letter-spacing: 0.02em; cursor: pointer; }
.dashboard-wrapper .btn-dark:hover { opacity: 0.9; }
.dashboard-wrapper .section-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); margin-top: 1rem; }
.dashboard-wrapper .section-title-italic { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-style: italic; color: var(--ink); }
.dashboard-wrapper .btn-text-sm { background: none; border: none; font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; cursor: pointer; }
.dashboard-wrapper .btn-text-sm:hover { color: var(--ink); }
.dashboard-wrapper .tx-card { display: flex; align-items: center; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-bottom: none; gap: 1rem; }
.dashboard-wrapper .tx-card:first-child { border-radius: 8px 8px 0 0; }
.dashboard-wrapper .tx-card:last-child { border-radius: 0 0 8px 8px; border-bottom: 1px solid var(--border); }
.dashboard-wrapper .tx-icon-box { width: 48px; height: 48px; background: var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--ink-muted); flex-shrink: 0; }
.dashboard-wrapper .tx-main { flex: 1; min-width: 0; }
.dashboard-wrapper .tx-main h4 { font-weight: 700; font-size: 1rem; color: var(--ink); margin: 0; }
.dashboard-wrapper .tx-sub { font-size: 0.7rem; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.dashboard-wrapper .tx-meta { width: 140px; display: flex; flex-direction: column; gap: 0.2rem; }
.dashboard-wrapper .tx-date { font-size: 0.85rem; color: var(--ink-muted); }
.dashboard-wrapper .tx-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; display: flex; align-items: center; gap: 0.3rem; }
.dashboard-wrapper .tx-status.paid { color: #10b981; }
.dashboard-wrapper .tx-status.completed { color: #3b82f6; }
.dashboard-wrapper .dot { width: 6px; height: 6px; border-radius: 50%; }
.dashboard-wrapper .dot.green { background: #10b981; }
.dashboard-wrapper .dot.blue { background: #3b82f6; }
.dashboard-wrapper .tx-amount { text-align: right; min-width: 100px; }
.dashboard-wrapper .amount-val { display: block; font-family: var(--font-display); font-weight: 900; font-size: 1.2rem; color: var(--ink); }
.dashboard-wrapper .amount-val.muted { color: var(--ink-muted); }
.dashboard-wrapper .tx-fee { font-size: 0.75rem; color: var(--ink-muted); }

/* Earnings rail */
.dashboard-wrapper .simple-card { background: var(--surface); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); display: flex; flex-direction: column; gap: 1.5rem; }
.dashboard-wrapper .italic-header { font-family: var(--font-display); font-weight: 700; font-style: italic; font-size: 1.1rem; color: var(--ink); margin: 0; }
.dashboard-wrapper .doc-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem; background: var(--bg); border-radius: 6px; margin-bottom: 0.5rem; }
.dashboard-wrapper .doc-item:last-child { margin-bottom: 0; }
.dashboard-wrapper .doc-info { display: flex; flex-direction: column; }
.dashboard-wrapper .doc-title { font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.dashboard-wrapper .doc-sub { font-size: 0.7rem; color: var(--ink-muted); }
.dashboard-wrapper .doc-action { line-height: 0; color: var(--ink-muted); }
.dashboard-wrapper .setting-group { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 0.5rem; }
.dashboard-wrapper .setting-group:last-of-type { border-bottom: none; padding-bottom: 0; }
.dashboard-wrapper .group-label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.dashboard-wrapper .bank-card { display: flex; align-items: center; gap: 0.75rem; }
.dashboard-wrapper .bank-icon { width: 32px; height: 32px; background: #edf2f7; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #4a5568; flex-shrink: 0; }
.dashboard-wrapper .bank-name { display: block; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.dashboard-wrapper .bank-type { font-size: 0.75rem; color: var(--ink-muted); }
.dashboard-wrapper .schedule-row { display: flex; justify-content: space-between; align-items: center; }
.dashboard-wrapper .schedule-val { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.dashboard-wrapper .link-btn { background: none; border: none; font-size: 0.7rem; font-weight: 700; color: #c29559; cursor: pointer; letter-spacing: 0.05em; }
.dashboard-wrapper .payout-notice { font-size: 0.8rem; background: var(--bg); padding: 1rem; border-radius: 4px; color: var(--ink-muted); line-height: 1.4; }

/* Services tab editor */
.dashboard-wrapper .services-content { display: flex; flex-direction: column; gap: 2rem; width: 100%; max-width: 900px; margin: 0 auto; }
.dashboard-wrapper .breadcrumbs { font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.dashboard-wrapper .breadcrumbs .current { color: var(--ink); }
.dashboard-wrapper .header-actions { display: flex; gap: 1rem; align-items: center; }
.dashboard-wrapper .btn-ghost { background: none; border: 1px solid var(--border); color: var(--ink-muted); font-size: 0.8rem; font-weight: 700; padding: 0.7rem 1.25rem; border-radius: 6px; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.02em; }
.dashboard-wrapper .btn-ghost:hover { background: var(--border); color: var(--ink); border-color: var(--ink-muted); }
.dashboard-wrapper .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.dashboard-wrapper .btn-primary-sc { background: var(--accent); color: var(--accent-ink); border: none; padding: 0.7rem 1.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.02em; }
.dashboard-wrapper .btn-primary-sc:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.dashboard-wrapper .btn-primary-sc.disabled { opacity: 0.7; cursor: not-allowed; }
.dashboard-wrapper .services-list-editor { display: flex; flex-direction: column; gap: 1.5rem; }
.dashboard-wrapper .service-editor-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.02); transition: box-shadow 0.2s; }
.dashboard-wrapper .service-editor-card:hover { box-shadow: 0 8px 16px rgba(0,0,0,0.04); }
.dashboard-wrapper .service-editor-card.is-inactive { opacity: 0.7; }
.dashboard-wrapper .card-header-row { display: flex; align-items: center; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.dashboard-wrapper .drag-handle { cursor: grab; opacity: 0.5; color: var(--ink-muted); line-height: 0; }
.dashboard-wrapper .drag-handle:hover { opacity: 1; }
.dashboard-wrapper .service-card-title { flex: 1; font-family: var(--font-display); font-size: 1.5rem; font-style: italic; font-weight: 700; color: var(--ink); margin: 0; }
.dashboard-wrapper .card-controls { display: flex; align-items: center; gap: 1rem; }
.dashboard-wrapper .toggle-wrapper { cursor: pointer; line-height: 0; }
.dashboard-wrapper .editor-grid { display: grid; grid-template-columns: 2fr 2fr; gap: 1.5rem; row-gap: 1.5rem; margin-bottom: 1.5rem; }
.dashboard-wrapper .input-group label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.dashboard-wrapper .input-std { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; color: var(--ink); background: var(--surface); transition: border-color 0.2s; font-family: inherit; }
.dashboard-wrapper .input-std:focus { border-color: #2563eb; outline: none; }
.dashboard-wrapper .input-with-icon, .dashboard-wrapper .input-with-suffix { position: relative; display: flex; align-items: center; }
.dashboard-wrapper .input-with-icon > span { position: absolute; left: 1rem; color: var(--ink-muted); font-weight: 600; }
.dashboard-wrapper .input-with-icon input { padding-left: 2rem; }
.dashboard-wrapper .input-with-suffix input { padding-right: 3.5rem; }
.dashboard-wrapper .input-with-suffix .suffix { position: absolute; right: 1rem; font-size: 0.75rem; font-weight: 700; color: var(--ink-muted); }
.dashboard-wrapper .description-area { margin-top: 1rem; }
.dashboard-wrapper .label-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.dashboard-wrapper .label-row label { font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.dashboard-wrapper .helper { font-size: 0.7rem; font-style: italic; color: var(--ink-muted); }
.dashboard-wrapper .textarea-std { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; line-height: 1.5; color: var(--ink); background: var(--surface); min-height: 100px; resize: vertical; font-family: inherit; }
.dashboard-wrapper .textarea-std:focus { border-color: #2563eb; outline: none; }
.dashboard-wrapper .add-service-btn-large { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 3rem; background: var(--surface); border: 2px dashed var(--border); border-radius: 12px; color: var(--ink-muted); cursor: pointer; transition: all 0.2s; }
.dashboard-wrapper .add-service-btn-large:hover { border-color: var(--ink-muted); color: var(--ink); background: var(--bg); }
.dashboard-wrapper .add-service-btn-large span { font-family: var(--font-display); font-size: 1.5rem; font-style: italic; color: inherit; }

/* Services rail */
.dashboard-wrapper .availability-row { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.9rem; }
.dashboard-wrapper .margin-y-1 { margin: 1.5rem 0; }
.dashboard-wrapper .capacity-label-row { margin-bottom: 0.5rem; }
.dashboard-wrapper .so-label { font-size: 0.65rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.dashboard-wrapper .capacity-fill-gold { height: 100%; background: #d4af37; border-radius: 100px; }
.dashboard-wrapper .capacity-footer { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-muted); }
.dashboard-wrapper .rail-note { font-size: 0.75rem; font-style: italic; color: var(--ink-muted); line-height: 1.4; }
.dashboard-wrapper .policy-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-wrapper .policy-item { display: flex; gap: 0.75rem; align-items: flex-start; }
.dashboard-wrapper .policy-item svg { flex-shrink: 0; margin-top: 2px; }
.dashboard-wrapper .text-gold { color: #d4af37; }
.dashboard-wrapper .policy-title { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.dashboard-wrapper .policy-sub { font-size: 0.75rem; color: var(--ink-muted); }
.dashboard-wrapper .btn-outline-full { width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--ink); font-size: 0.7rem; font-weight: 700; padding: 0.6rem; border-radius: 4px; letter-spacing: 0.05em; cursor: pointer; transition: background 0.2s; text-transform: uppercase; }
.dashboard-wrapper .btn-outline-full:hover { background: var(--bg); border-color: var(--ink-muted); }
.dashboard-wrapper .simple-card.flat { border: none; box-shadow: none; padding: 0; background: transparent; gap: 0.5rem; }
.dashboard-wrapper .micro-header { font-size: 0.65rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.1em; margin-bottom: 0.5rem; text-transform: uppercase; }
.dashboard-wrapper .rail-text { font-size: 0.8rem; color: var(--ink-muted); font-style: italic; line-height: 1.5; }

/* Responsive */
@media (max-width: 1200px) { .dashboard-wrapper { grid-template-columns: 240px 1fr 280px; } }
@media (max-width: 1024px) {
  .dashboard-wrapper { grid-template-columns: 80px 1fr 260px; }
  .dashboard-wrapper .brand-text, .dashboard-wrapper .nav-item span, .dashboard-wrapper .profile-info { display: none; }
  .dashboard-wrapper .nav-item { justify-content: center; }
  .dashboard-wrapper .main-stage { padding: 2rem; }
  .dashboard-wrapper .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
  .dashboard-wrapper { grid-template-columns: 1fr; }
  .dashboard-wrapper .sidebar, .dashboard-wrapper .business-rail { display: none; }
}

/* --- 404 error page (page-404) ------------------------------------------- */
/*
 * A single centred column — no card, no backdrop blobs.  Design intent:
 * let the site chrome (nav + footer) do the framing.  The page itself is
 * just well-spaced type, a screenplay excerpt, a search bar, and tiles.
 * All values reference tokens; nothing is hardcoded.
 */
.page-404 {
  padding: var(--space-8) 0 var(--space-8);
  min-height: 68vh;
  display: flex;
  align-items: center;
}

.page-404__inner {
  width: 100%;
  max-width: 660px;           /* narrower column → more editorial focus */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* ---- Hero typography ---- */
.page-404__hero {
  text-align: center;
}

.page-404__eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-brand);
  margin-bottom: var(--space-3);
}

.page-404__headline {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: var(--space-4);
}

.page-404__headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ink-muted);
}

.page-404__sub {
  font-size: var(--text-lg);
  color: var(--ink-muted);
  line-height: var(--leading-normal);
  max-width: 480px;
  margin: 0 auto;
}

/* ---- Screenplay excerpt ---- */
.page-404__script {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.page-404__script-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.page-404__traffic-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.page-404__traffic-dot--red    { background: #ff5f57; }
.page-404__traffic-dot--yellow { background: #febc2e; }
.page-404__traffic-dot--green  { background: #28c840; }

.page-404__script-filename {
  margin-left: 6px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.page-404__script-body {
  padding: var(--space-5) var(--space-6);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.page-404__script-body p { margin: 0; }

/* Screen direction keywords */
.page-404__sc {
  font-weight: 700;
  color: var(--accent-brand);
  letter-spacing: 0.05em;
}

/* Scene heading */
.page-404__slug {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Character action */
.page-404__action {
  font-style: italic;
  color: var(--ink-muted);
}

/* ---- Search ---- */
.page-404__search {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.page-404__search-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-muted);
}

.page-404__search-row {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px 5px 5px 14px;
  gap: var(--space-2);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.page-404__search-row:focus-within {
  border-color: var(--accent-brand);
  box-shadow: var(--ring);
}

.page-404__search-icon {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.page-404__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  color: var(--ink);
  padding: var(--space-2) 0;
}

.page-404__search-input:focus { outline: none; }

.page-404__search-input::placeholder { color: var(--ink-muted); }

/* ---- Primary CTAs ---- */
.page-404__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}

.page-404__actions .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---- Shortcut tiles ---- */
.page-404__tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  border-top: 1px solid var(--border);
  padding-top: var(--space-8);
}

.page-404__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition);
}

.page-404__tile svg { color: var(--accent-brand); flex-shrink: 0; }

.page-404__tile:hover {
  background: var(--surface-2);
  border-color: var(--accent-brand);
  color: var(--ink);
  opacity: 1;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 560px) {
  .page-404__tiles { grid-template-columns: repeat(2, 1fr); }
  .page-404__headline { font-size: 2.4rem; }
  .page-404__actions { flex-direction: column; align-items: stretch; }
  .page-404__actions .btn { justify-content: center; }
}

.scene-404 {
  position: relative;
  padding: var(--space-12) 0 var(--space-16);
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.scene-404__ambient-glow {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(0, 181, 255, 0.15) 0%, rgba(0, 181, 255, 0) 65%);
  pointer-events: none;
  z-index: 0;
}

.scene-404__card {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  padding: var(--space-10) var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Clapperboard Slate Badge */
.scene-404__clapper {
  display: inline-block;
  width: 140px;
  margin-bottom: var(--space-6);
  background: #111;
  color: #fff;
  border-radius: var(--radius-md);
  border: 2px solid #222;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  transform: rotate(-3deg);
  transition: transform var(--transition);
}
.scene-404__clapper:hover {
  transform: rotate(0deg) scale(1.05);
}

.scene-404__clapper-top {
  display: flex;
  height: 18px;
  background: #111;
  border-bottom: 2px solid #333;
}
.scene-404__clapper-top .stripe {
  flex: 1;
  background: #111;
  transform: skewX(-20deg);
}
.scene-404__clapper-top .stripe:nth-child(even) {
  background: #fff;
}

.scene-404__clapper-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 4px;
  padding: 8px 10px;
  text-align: center;
  background: #181818;
}
.scene-404__slate-label {
  font-family: "Courier New", monospace;
  font-size: 8px;
  font-weight: 700;
  color: #888;
  letter-spacing: 0.1em;
}
.scene-404__slate-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: var(--accent-brand);
}

/* Titles */
.scene-404__title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
}
.scene-404__title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-brand);
}

.scene-404__subtitle {
  font-size: var(--text-lg);
  color: var(--ink-muted);
  max-width: 520px;
  margin: 0 auto var(--space-8);
  line-height: var(--leading-normal);
}

/* Screenplay Box */
.scene-404__screenplay {
  max-width: 580px;
  margin: 0 auto var(--space-8);
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: left;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}
.scene-404__screenplay-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.scene-404__screenplay-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.scene-404__screenplay-bar .dot.red { background: #ff5f56; }
.scene-404__screenplay-bar .dot.yellow { background: #ffbd2e; }
.scene-404__screenplay-bar .dot.green { background: #27c93f; }

.scene-404__screenplay-bar .title {
  margin-left: 6px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  color: #8b949e;
  letter-spacing: 0.05em;
}

.scene-404__screenplay-text {
  padding: var(--space-5) var(--space-6);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #c9d1d9;
}
.scene-404__screenplay-text .keyword {
  color: var(--accent-brand);
  font-weight: bold;
}
.scene-404__screenplay-text .slugline {
  color: #f0883e;
  font-weight: bold;
}

/* Search Bar */
.scene-404__search-bar {
  position: relative;
  max-width: 520px;
  margin: 0 auto var(--space-8);
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.scene-404__search-bar:focus-within {
  border-color: var(--accent-brand);
  box-shadow: 0 0 20px rgba(0, 181, 255, 0.25);
  background: var(--surface);
}
.scene-404__search-bar .icon {
  color: var(--ink-muted);
  margin-right: 10px;
  flex-shrink: 0;
}
.scene-404__search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: var(--text-base);
  color: var(--ink);
  padding: var(--space-2) 0;
}
.scene-404__search-bar input:focus {
  outline: none;
}

/* Actions */
.scene-404__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
  flex-wrap: wrap;
}

/* Navigation Grid */
.scene-404__nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  text-align: left;
}
.scene-404__nav-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}
.scene-404__nav-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-brand);
  background: var(--surface);
}
.scene-404__nav-card .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--accent-brand);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.scene-404__nav-card .nav-info h4 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.scene-404__nav-card .nav-info p {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin: 0;
}

/* --- Orders Dashboard ---------------------------------------------------- */
.orders-page {
  padding: var(--space-8) var(--space-4);
  max-width: 720px;
  margin: 0 auto;
}
.orders-header {
  margin-bottom: var(--space-6);
  text-align: left;
}
.orders-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-1);
}
.orders-header p {
  color: var(--ink-muted);
  font-size: var(--text-base);
}
.orders-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.order-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.order-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-brand);
}
.order-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.order-item__id {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
}
.order-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.order-item__date {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
.order-item__products {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.order-product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}
.order-product__name {
  color: var(--ink);
  font-weight: 500;
}
.order-product__price {
  font-weight: 700;
  color: var(--ink);
}
.order-item__manuscript {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.order-item__manuscript:hover {
  background: color-mix(in srgb, var(--accent-brand) 5%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent-brand) 20%, transparent);
}
.order-item__manuscript svg {
  color: var(--accent-brand);
  flex-shrink: 0;
}
.order-item__manuscript-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.order-item__manuscript-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.order-item__manuscript-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  transition: color var(--transition);
}
.order-item__manuscript:hover .order-item__manuscript-link {
  color: var(--accent-brand);
}
.order-item__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  margin-top: var(--space-4);
}
.order-item__footer-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-muted);
}
.order-item__total {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--ink);
}
.order-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}
.order-badge--paid {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: var(--success);
}
.order-badge--refunded {
  background: color-mix(in srgb, var(--error) 10%, var(--surface));
  color: var(--error);
}
.order-badge--failed {
  background: color-mix(in srgb, var(--error) 10%, var(--surface));
  color: var(--error);
}
.order-badge--pending {
  background: color-mix(in srgb, var(--gold) 10%, var(--surface));
  color: var(--gold);
}
.orders-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.orders-empty p {
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}

/* Sidebar summaries on orders page */
.order-summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.order-summary-box h3 {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin: 0 0 var(--space-4);
}
.order-summary-box__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.order-summary-box__item-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  display: block;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.order-summary-box__item-val {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--ink);
}

.order-marketplace-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.order-marketplace-box h4 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.order-marketplace-box p {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: var(--leading-normal);
  margin: 0;
}
.order-marketplace-box .btn {
  text-align: center;
  text-decoration: none;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-1);
}

/* ==========================================================================
   Homepage Curation Center
   ========================================================================== */
.curation-page {
  padding: var(--space-8) 0 var(--space-12);
}

.curation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.curation-header__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--accent-brand);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.curation-header__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
}

.curation-header__subtitle {
  font-size: var(--text-base);
  color: var(--ink-muted);
  margin: 0;
  max-width: 650px;
}

.curation-header__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Slots Grid */
.curation-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.curation-slot-card--wide {
  grid-column: 1 / -1;
}

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

.curation-slot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: border-color var(--transition);
}

.curation-slot-card--empty {
  border-style: dashed;
  background: var(--surface-2);
}

.curation-slot-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.curation-slot-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-brand);
}

.curation-slot-card__heading {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.curation-slot-item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  flex: 1;
}

.curation-slot-item__cover {
  width: 72px;
  height: 104px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.curation-slot-item__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.curation-slot-item__body {
  flex: 1;
  min-width: 0;
}

.curation-slot-item__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 2px;
}

.curation-slot-item__title a {
  color: var(--ink);
  text-decoration: none;
}

.curation-slot-item__title a:hover {
  color: var(--accent-brand);
}

.curation-slot-item__writer {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  margin: 0 0 var(--space-1);
}

.curation-slot-item__meta {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin: 0 0 var(--space-2);
}

.curation-slot-item__logline {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: var(--leading-relaxed);
  margin: 0;
}

.curation-slot-item__actions {
  flex-shrink: 0;
}

.curation-slot-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-6) var(--space-4);
  flex: 1;
}

.curation-slot-empty__text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 var(--space-1);
}

.curation-slot-empty__hint {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* Staff Picks Shelf Pills */
.curation-staff-picks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.curation-staff-pick-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.curation-staff-pick-pill__img {
  width: 32px;
  height: 48px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}

.curation-staff-pick-pill__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.curation-staff-pick-pill__title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.curation-staff-pick-pill__writer {
  font-size: 11px;
  color: var(--ink-muted);
}

.curation-staff-pick-pill__remove {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 50%;
  transition: color var(--transition);
}

.curation-staff-pick-pill__remove:hover {
  color: var(--accent-danger, #ef4444);
}

/* Curation Filter Bar */
.curation-library-section {
  margin-top: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  padding: 0;
}

.curation-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: nowrap;
}

.curation-search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 40px;
  gap: var(--space-3);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.curation-search-box:focus-within {
  background: var(--surface);
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.curation-search-box__icon {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.curation-search-box__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  outline: none;
  height: 100%;
}

.curation-search-box__input::placeholder {
  color: var(--ink-muted);
}

.curation-filter-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.curation-genre-select {
  font: inherit;
  height: 40px;
  width: 145px;
  min-width: 130px;
  max-width: 160px;
  flex-shrink: 0;
  padding: 0 var(--space-4) 0 var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.curation-genre-select:focus {
  outline: none;
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.curation-tabs {
  display: inline-flex;
  background: var(--surface-2);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  height: 40px;
  align-items: center;
  flex-shrink: 0;
}

.curation-tab {
  background: transparent;
  border: none;
  padding: 0 var(--space-3);
  height: 100%;
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.curation-tab--active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .curation-filter-bar {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
  }
  .curation-search-box {
    min-width: 100%;
  }
  .curation-filter-controls {
    width: 100%;
    justify-content: space-between;
  }
  .curation-genre-select {
    flex: 1;
    max-width: none;
  }
}

/* Curation Table */
.curation-table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.curation-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.curation-table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.curation-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.curation-table th.text-center,
.curation-table td.text-center {
  text-align: center;
}

.curation-table th.text-right,
.curation-table td.text-right {
  text-align: right;
}

.curation-th--script,
.curation-cell--script {
  min-width: 200px;
}

.curation-th--genre,
.curation-cell--genre {
  width: 110px;
  white-space: nowrap;
}

.curation-th--pages,
.curation-cell--pages {
  width: 65px;
  white-space: nowrap;
}

.curation-th--reads,
.curation-cell--reads {
  width: 65px;
  white-space: nowrap;
}

.curation-th--status,
.curation-cell--status {
  width: 200px;
  min-width: 180px;
}

.curation-th--actions,
.curation-cell--actions {
  width: 420px;
  min-width: 420px;
  white-space: nowrap;
}

.curation-script-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.curation-pages-val {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink);
}

.curation-reads-val {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink);
}

.curation-row:last-child td {
  border-bottom: none;
}

.curation-row--promoted {
  background: rgba(var(--accent-brand-rgb, 14, 165, 233), 0.03);
}

.curation-row__thumb {
  width: 36px;
  height: 52px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.curation-row__script-details {
  display: flex;
  flex-direction: column;
}

.curation-row__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.curation-row__title:hover {
  color: var(--accent-brand);
}

.curation-row__writer {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.curation-status-badges {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
}

.curation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}

.curation-badge--week {
  background: #fef3c7;
  color: #b45309;
}

:root[data-theme="dark"] .curation-badge--week {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.curation-badge--editor {
  background: #ede9fe;
  color: #6d28d9;
}

:root[data-theme="dark"] .curation-badge--editor {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

.curation-badge--staff {
  background: #e0f2fe;
  color: #0369a1;
}

:root[data-theme="dark"] .curation-badge--staff {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}

.curation-badge--section {
  background: #f0fdf4;
  color: #166534;
}

:root[data-theme="dark"] .curation-badge--section {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.curation-badge__remove {
  background: transparent;
  border: none;
  padding: 0 0 0 var(--space-1);
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: currentColor;
  opacity: 0.65;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.curation-badge__remove:hover {
  opacity: 1;
  color: var(--accent-danger, #ef4444);
}

.curation-btn-group {
  display: inline-flex;
  gap: var(--space-2);
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
}

.curation-section-select {
  height: 28px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0 var(--space-2);
  cursor: pointer;
  outline: none;
  max-width: 140px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.curation-section-select:hover {
  border-color: var(--accent-brand);
  background: var(--surface);
}

.btn--active-week {
  background: #f59e0b;
  color: #fff;
  border: 1px solid #d97706;
}

.btn--active-editor {
  background: #8b5cf6;
  color: #fff;
  border: 1px solid #7c3aed;
}

.btn--active-staff {
  background: #0284c7;
  color: #fff;
  border: 1px solid #0369a1;
}

.btn--active-section {
  background: #16a34a;
  color: #fff;
  border: 1px solid #15803d;
}

.btn--outline-danger {
  background: transparent;
  color: var(--accent-danger, #ef4444);
  border: 1px solid var(--accent-danger, #ef4444);
}

.btn--outline-danger:hover {
  background: var(--accent-danger, #ef4444);
  color: #fff;
}

.curation-empty-table {
  text-align: center;
  padding: var(--space-8);
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

/* Custom Curated Sections Panel */
.curation-sections-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.curation-sections-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.curation-sections-panel__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.curation-sections-panel__header-actions {
  flex-shrink: 0;
}

/* Expandable Create Section Drawer */
.curation-create-section-drawer {
  margin-bottom: var(--space-5);
  animation: fadeIn 0.2s ease-in-out;
}

.curation-create-section-card {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.curation-create-section-card .form__input {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  color: var(--ink);
}

.curation-create-section-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

@media (max-width: 768px) {
  .curation-create-section-card__grid {
    grid-template-columns: 1fr;
  }
}

.curation-create-section-card__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.curation-sections-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.curation-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.curation-section-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.curation-section-card__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
}

.curation-section-card__subtitle {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin: 0;
}

/* Homepage Curated Section Header & Subtitle */
.section-header--editorial {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-4);
}

.section-header__title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.section-header__title-group h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: var(--leading-tight);
}

.section-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-muted);
  line-height: 1.45;
  margin: 0;
  max-width: 680px;
  letter-spacing: 0.01em;
}

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

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

/* ==========================================================================
   Screenplay Analysis Memo (Screen & Print)
   ========================================================================== */

.analysis-page {
  padding: var(--space-6) 0 var(--space-8);
  background: var(--bg);
  min-height: calc(100vh - 120px);
}

.analysis-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.analysis-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  color: var(--ink-muted);
}

.analysis-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.analysis-nav__link:hover {
  color: var(--ink);
}

.analysis-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.analysis-header__badge-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.analysis-header__title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.analysis-header__byline {
  font-size: var(--text-base);
  color: var(--ink-muted);
  margin-bottom: var(--space-5);
}

.analysis-meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.analysis-meta-strip__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.analysis-meta-strip__label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.analysis-meta-strip__val {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.analysis-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.analysis-memo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .analysis-header {
    padding: var(--space-6) var(--space-8);
  }
  .analysis-memo {
    padding: var(--space-6) var(--space-8);
  }
}

.analysis-memo__content {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
}

.analysis-memo__content > :first-child,
.analysis-memo__content h2:first-of-type {
  margin-top: 0;
}

.analysis-memo__content h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.analysis-memo__content p {
  margin: 0 0 var(--space-4);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.75;
}

.analysis-memo__content p:last-child {
  margin-bottom: 0;
}

/* Suppress raw markdown final question heading/paragraph since desk box prominently features it */
.analysis-memo__content [id*="final-revision-question"],
.analysis-memo__content [id*="final-revision-question"] + p {
  display: none !important;
}

.analysis-desk-box {
  margin-top: var(--space-6);
  background: color-mix(in srgb, var(--accent-brand) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent-brand) 30%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  text-align: center;
}

.analysis-desk-box__badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-brand);
  margin-bottom: var(--space-2);
}

.analysis-desk-box__question {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
}

.analysis-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  max-width: 540px;
  margin: var(--space-6) auto;
  box-shadow: var(--shadow-sm);
}

.analysis-status-card__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
}

.analysis-status-card h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.analysis-status-card p {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.analysis-status-card--error h2 {
  color: var(--error);
}

/* Screen utility */
.print-only {
  display: none !important;
}

/* ==========================================================================
   Hollywood Studio Story Department Memo Print Stylesheet
   Formats coverage/diagnostic reports for professional physical print & PDF export
   ========================================================================== */
@media print {
  @page {
    size: letter portrait;
    margin: 0.65in 0.75in 0.75in 0.75in;
  }

  /* Force background rendering for badges and dividers */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Suppress interactive browser chrome, headers, and footers */
  header.navbar,
  .navbar,
  footer.site-footer,
  .site-footer,
  .messages-container,
  .analysis-nav,
  .analysis-actions-bar,
  .analysis-header__badge-row,
  .theme-control,
  #theme-toggle {
    display: none !important;
  }

  /* Reset document canvas to flat print page */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
    line-height: 1.5 !important;
  }

  .analysis-page {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
  }

  .analysis-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-only {
    display: block !important;
  }

  /* Authentic studio story department letterhead */
  .print-letterhead {
    display: block !important;
    border-bottom: 2pt solid #000000 !important;
    padding-bottom: 6pt !important;
    margin-bottom: 14pt !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  .print-letterhead__top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    margin-bottom: 3pt !important;
  }

  .print-letterhead__logo {
    font-family: var(--font-display), -apple-system, sans-serif !important;
    font-size: 15pt !important;
    font-weight: 900 !important;
    letter-spacing: 0.1em !important;
    color: #000000 !important;
  }

  .print-letterhead__dept {
    font-size: 8pt !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: #333333 !important;
  }

  .print-letterhead__confidential {
    font-size: 7.5pt !important;
    font-weight: 700 !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: #555555 !important;
  }

  /* Stripped memo manifest header */
  .analysis-header {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 14pt 0 !important;
    background: transparent !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  .analysis-header__title {
    font-family: var(--font-serif), Georgia, serif !important;
    font-size: 20pt !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    color: #000000 !important;
    margin-bottom: 3pt !important;
  }

  .analysis-header__byline {
    font-size: 10pt !important;
    color: #333333 !important;
    margin-bottom: 10pt !important;
  }

  /* 5-column meta ledger strip */
  .analysis-meta-strip {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8pt !important;
    padding: 6pt 0 !important;
    margin-bottom: 14pt !important;
    border-top: 1.5pt solid #000000 !important;
    border-bottom: 1pt solid #000000 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .analysis-meta-strip__label {
    font-size: 7pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #555555 !important;
    margin-bottom: 1pt !important;
  }

  .analysis-meta-strip__val {
    font-size: 9pt !important;
    font-weight: 700 !important;
    color: #000000 !important;
  }

  .status-val--completed {
    color: #000000 !important;
  }

  /* Document body */
  .analysis-memo {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .analysis-memo__content {
    font-family: var(--font-body), -apple-system, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.5 !important;
    color: #000000 !important;
  }

  .analysis-memo__content h2 {
    font-family: var(--font-display), -apple-system, sans-serif !important;
    font-size: 11pt !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: #000000 !important;
    margin-top: 14pt !important;
    margin-bottom: 4pt !important;
    padding-bottom: 2pt !important;
    border-bottom: 0.75pt solid #000000 !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .analysis-memo__content h2:first-of-type {
    margin-top: 0 !important;
  }

  /* Explicit section page-breaks between major memo movements */
  .analysis-memo__content [id*="story-map"],
  .analysis-memo__content [id*="breakdown"],
  .analysis-memo__content [id*="priorities"],
  .analysis-memo__content #complete-screenplay-story-map,
  .analysis-memo__content #three-act-breakdown-and-setuppayoff,
  .analysis-memo__content #three-priorities-for-the-next-draft,
  .analysis-memo__content .print-break-before {
    break-before: page !important;
    page-break-before: always !important;
  }

  .analysis-memo__content p {
    font-size: 10pt !important;
    line-height: 1.5 !important;
    margin: 0 0 6pt 0 !important;
    color: #000000 !important;
    orphans: 3 !important;
    widows: 3 !important;
  }

  /* Taped-Above-Desk Callout Box */
  .analysis-desk-box {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 16pt !important;
    margin-bottom: 12pt !important;
    border: 1.5pt solid #000000 !important;
    background: #f8f8f8 !important;
    border-radius: 4pt !important;
    padding: 10pt 14pt !important;
    text-align: center !important;
  }

  .analysis-desk-box__badge {
    font-size: 7.5pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    color: #000000 !important;
    margin-bottom: 3pt !important;
  }

  .analysis-desk-box__question {
    font-family: var(--font-serif), Georgia, serif !important;
    font-style: italic !important;
    font-size: 11pt !important;
    line-height: 1.45 !important;
    color: #000000 !important;
    margin: 0 !important;
  }

  /* Document Confidential Footer */
  .print-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 18pt !important;
    padding-top: 6pt !important;
    border-top: 0.5pt solid #999999 !important;
    font-size: 7.5pt !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: #666666 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* ==========================================================================
   Cookie Consent Banner (Google Consent Mode v2 Compliant)
   ========================================================================== */
cookie-banner:not(:defined) {
  display: none;
}

.cookie-banner {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  max-width: 440px;
  width: calc(100% - var(--space-8));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4) var(--space-5);
  z-index: 1000;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.cookie-banner--visible {
  opacity: 1;
  transform: translateY(0);
}

.cookie-banner__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cookie-banner__content {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.cookie-banner__icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.cookie-banner__text {
  flex: 1;
}

.cookie-banner__title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.cookie-banner__desc {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--ink-muted);
  margin: 0;
}

.cookie-banner__link {
  color: var(--accent-brand);
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  align-items: center;
}

.cookie-banner__btn {
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-4);
}

@media (max-width: 640px) {
  .cookie-banner {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    width: auto;
  }
}

