/* LeoWegner — component primitives.
 *
 * The vocabulary every screen composes from. Matches the Claude Design remix
 * (app-onboarding-remix) component primitives. Extends tokens.css — requires
 * the palette/type tokens defined there.
 *
 * Pattern: one class per component, modifiers as --suffix. No inline styles in
 * templates; no per-page CSS files for anything expressible here.
 *
 * Contents:
 *   1. Utilities         .mono .serif .eyebrow .rule .stack .row .container
 *   2. Typography        .display, headings (editorial)
 *   3. Buttons           .btn + variants (.btn--ink, --gold, --outline, --ghost, --soft)
 *   4. Tags              .tag + tones
 *   5. Cards             .card (.card--ink inverse), .card--surface
 *   6. Sections          .section + __head/__eyebrow/__title/__meta
 *   7. Stats & progress  .stat-card, .progress + __fill
 *   8. Course patterns   .inprog-row, .rec-card
 *   9. Controls          .iconbtn, .seg (segmented), .field, .input
 *  10. Mascot            .mascot, .mascot--badge
 *  11. Placeholder       .placeholder (striped)
 */

/* ================================================================= 1. UTILITIES */

.mono {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.mono--sm { font-size: 10.5px; letter-spacing: 0.1em; }

.serif  { font-family: var(--font-serif); }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-deep);
    margin: 0 0 .6em;
}

/* Thin hairline — horizontal separator */
.rule {
    border: 0;
    height: 1px;
    background: var(--rule);
    margin: 0;
}

/* Vertical stacking primitives. Use instead of ad-hoc <br> / margins. */
.stack      { display: flex; flex-direction: column; gap: 14px; }
.stack--sm  { gap: 8px; }
.stack--md  { gap: 14px; }
.stack--lg  { gap: 22px; }
.stack--xl  { gap: 32px; }

.row              { display: flex; align-items: center; gap: 12px; }
.row--between     { justify-content: space-between; }
.row--baseline    { align-items: baseline; }
.row--wrap        { flex-wrap: wrap; }

/* Containers — existing shell.css already defines .container / .container-wide /
   .reading; we re-declare the same widths here so this file is self-sufficient
   once shell.css is retired. */
.container        { max-width: 1120px; margin: 0 auto; padding: 0 48px; }
/* Both spellings resolve to the same rule — historical BEM drift, not worth
   a big template-rename PR. Without this alias the .container-wide users
   (topbar, footer, course_list, error pages) get ZERO gutter and content
   hugs the viewport edge. */
.container--wide,
.container-wide   { max-width: 1200px; margin: 0 auto; padding: 0 48px; }
.reading          { max-width: 680px;  margin: 0 auto; padding: 0 48px; }

/* Phones: tighten up the gutter so narrow screens don't feel cramped. */
@media (max-width: 560px) {
    .container,
    .container--wide,
    .container-wide,
    .reading { padding: 0 24px; }
}

/* ================================================================= 2. TYPOGRAPHY */

.display {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(44px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Editorial H1 — used on every hero (home, course detail, legal, lesson cover). */
.h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 .5em;
}
.h1 em { color: var(--gold-deep); font-style: italic; }

.h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 .5em;
}

.h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 .4em;
}

.lead {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 19px;
    line-height: 1.45;
    color: var(--muted);
    margin: 0 0 1.4em;
    max-width: 46ch;
}

/* ================================================================= 3. BUTTONS */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--ink);
    color: var(--bg);
    font-family: inherit;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0;
    cursor: pointer;
    text-decoration: none;
    transition: transform .08s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:active:not([disabled]) { transform: scale(0.98); }
.btn[disabled], .btn--disabled { opacity: 0.45; cursor: not-allowed; }

.btn--lg  { padding: 18px 28px; font-size: 17px; letter-spacing: -0.01em; border-radius: 16px; }
.btn--sm  { padding: 10px 16px; font-size: 13px; border-radius: 10px; }
.btn--full { width: 100%; }

/* Variants */
.btn--ink      { background: var(--ink);           color: var(--bg); }
/* Gold button: white-on-gold was 3.22:1 (WCAG fail). Ink-on-gold is
 * 5.58:1 — keeps the accent visible while the label stays legible. */
.btn--gold     { background: var(--gold);          color: var(--ink); }
.btn--gold:hover { background: var(--gold-deep); color: #fff; }
.btn--outline  { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-2); }
.btn--outline:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn--ghost    { background: transparent;          color: var(--ink); }
.btn--ghost:hover { background: var(--bg-2); }
.btn--soft     { background: var(--bg-2);          color: var(--ink); }
.btn--soft:hover { background: var(--bg-3); }
.btn--danger   { background: var(--err);           color: #fff; }

[data-theme="dark"] .btn--gold    { color: var(--ink); }
[data-theme="dark"] .btn--outline { color: var(--text); }
[data-theme="dark"] .btn--ghost   { color: var(--text); }
[data-theme="dark"] .btn--soft    { color: var(--text); }

/* ================================================================= 4. TAGS */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--bg-2);
    color: var(--text);   /* theme-aware — --ink-2 is fixed-dark and goes invisible on dark bg-2 */
}
.tag--gold       { background: var(--gold-wash);                 color: var(--gold-deep); }
.tag--sage       { background: rgba(106, 122, 85, 0.12);         color: var(--sage); }
.tag--terracotta { background: rgba(179, 90, 62, 0.12);          color: var(--terracotta); }
.tag--outline    { background: transparent; color: var(--text);  box-shadow: inset 0 0 0 1px var(--rule-2); }
.tag--ink        { background: var(--ink);                       color: var(--bg); }

/* ================================================================= 5. CARDS */

/* Surface card — used for stat tiles, in-progress rows, rec cards, daily reading. */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: inset 0 0 0 1px var(--rule);
}
.card--sm   { padding: 14px; border-radius: 18px; }
.card--tight{ padding: 12px; }
.card--pad  { padding: 22px; }

/* Inverse / hero card — "Today" block on home, the onboarding welcome, etc. */
.card--ink {
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--radius-xl);
    padding: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: none;
}
.card--ink .eyebrow { color: var(--gold); opacity: 0.9; }
.card--ink::before {
    content: "";
    position: absolute;
    right: -30px; top: -30px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217,165,87,0.18), transparent 70%);
    pointer-events: none;
}

.card--link { cursor: pointer; transition: border-color .15s ease, transform .08s ease; }
.card--link:hover { box-shadow: inset 0 0 0 1px var(--rule-2); }
.card--link:active { transform: translateY(1px); }

/* ================================================================= 6. SECTIONS */

/* Use padding-top/bottom (NOT the 3-value shorthand) so these can combine
   with a container class on the same element — the shorthand would zero
   horizontal padding and override the container's gutter. */
.section        { padding-top: 40px; padding-bottom: 16px; }
.section--tight { padding-top: 24px; padding-bottom: 8px; }

.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section__eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-deep);
    margin: 0 0 6px;
}
.section__title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0;
}
.section__meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

/* ================================================================= 7. STATS & PROGRESS */

.stat-card {
    background: var(--surface);
    border-radius: 18px;
    padding: 14px 14px 12px;
    box-shadow: inset 0 0 0 1px var(--rule);
}
.stat-card__label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.stat-card__value {
    font-family: var(--font-serif);
    font-size: 28px;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-top: 6px;
}
.stat-card__unit {
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--muted);
    margin-left: 5px;
}
.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Linear progress — 4 px hairline, ink fill by default, gold via --tone-gold. */
.progress {
    height: 4px;
    border-radius: 999px;
    background: var(--bg-3);
    overflow: hidden;
}
.progress--thin { height: 3px; }
.progress--thick { height: 6px; }
.progress__fill {
    height: 100%;
    width: 0;
    background: var(--ink);
    transition: width .4s ease;
}
.progress--gold .progress__fill { background: var(--gold); }
.card--ink .progress          { background: rgba(255,255,255,0.12); }
.card--ink .progress__fill    { background: var(--gold); }

/* ================================================================= 8. COURSE PATTERNS */

/* In-progress row — book icon, title, sub, progress bar, chevron. */
.inprog-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--rule);
    text-align: left;
    cursor: pointer;
    width: 100%;
    color: var(--text);
    text-decoration: none;
    font: inherit;
}
.inprog-row__icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--gold-wash);
    color: var(--gold-deep);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.inprog-row__body  { flex: 1; min-width: 0; }
.inprog-row__title {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text);
}
.inprog-row__sub {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inprog-row .progress { margin-top: 8px; }
.inprog-row__chevron { color: var(--muted); flex-shrink: 0; }

/* Recommended card — tall, with tinted header strip + title + meta. */
.rec-card {
    flex: 0 0 240px;
    background: var(--surface);
    border-radius: 20px;
    border: 0;
    box-shadow: inset 0 0 0 1px var(--rule);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
}
.rec-card__hero {
    height: 100px;
    background: var(--gold-wash);
    display: flex;
    align-items: flex-end;
    padding: 12px;
}
.rec-card--sage .rec-card__hero       { background: rgba(106, 122, 85, 0.14); }
.rec-card--terracotta .rec-card__hero { background: rgba(179, 90, 62, 0.12); }
.rec-card__body  { padding: 14px 14px 16px; }
.rec-card__title {
    font-family: var(--font-serif);
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 8px;
}
.rec-card__meta {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

/* Horizontal scroll row of cards (no scrollbar). */
.scroll-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: none;
}
.scroll-row::-webkit-scrollbar { display: none; }

/* Horizontal-scroll arrows — injected by main.js around every
   .scroll-row. Auto-hide when there's nothing to scroll on that
   side (JS toggles .is-visible). Mobile-only; on desktop we rely
   on trackpad / shift-wheel scrolling. */
.scroll-row-wrap { position: relative; }
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border: 1px solid var(--rule-2);
    border-radius: 50%;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 3;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.scroll-arrow.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.scroll-arrow:active { transform: translateY(-50%) scale(.94); }
.scroll-arrow--left  { left: 4px; }
.scroll-arrow--right { right: 4px; }
@media (min-width: 901px) {
    /* Desktop: trackpad + wheel scroll is enough. Don't clutter
       the layout with arrows when users have a mouse. */
    .scroll-arrow { display: none; }
}

/* ================================================================= 9. CONTROLS */

.iconbtn {
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 0;
    background: var(--bg-2);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.iconbtn:hover       { background: var(--bg-3); }
.iconbtn--glass      { background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule); }
.iconbtn--ink        { background: var(--ink); color: var(--bg); }
.iconbtn--sm         { width: 32px; height: 32px; }
.iconbtn--lg         { width: 48px; height: 48px; }

/* Segmented control (EN/ES, Light/Dark style). */
.seg {
    display: inline-flex;
    background: var(--bg-2);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.seg__btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}
.seg__btn[aria-pressed="true"],
.seg__btn.is-active {
    background: var(--ink);
    color: var(--bg);
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.input {
    font-family: inherit;
    font-size: 15px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--rule-2);
    transition: box-shadow .15s ease;
}
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }
.input::placeholder { color: var(--muted-2); }

/* ================================================================= 10. MASCOT */

.mascot        { width: 120px; height: 120px; object-fit: contain; }
.mascot--hero  { width: 220px; height: 220px; }
.mascot--badge { width: 40px;  height: 40px;  object-fit: contain; }
.mascot--sm    { width: 28px;  height: 28px;  object-fit: contain; }

/* ================================================================= LAYOUT PATTERNS */

/* Landing hero — 2-col grid, text + mascot image. Collapses on narrow. */
.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 64px;
    align-items: center;
}
.hero-grid__text .display { max-width: 14ch; }
.hero-grid__text .lead    { max-width: 46ch; }
.hero-grid__image {
    width: 100%;
    max-width: 440px;
    /* The mascot is a full illustration with hat, ears, beard — a
       circular crop chops the ears off, which is what the iPhone
       screenshot flagged. Let the image stand on its own. */
    height: auto;
    object-fit: contain;
    justify-self: center;
}
@media (max-width: 820px) {
    .hero-grid { grid-template-columns: 1fr; gap: 32px; }
    .hero-grid__image { max-width: 280px; order: -1; }
}

/* Category grid — auto-fit tiles, minimum width 220 px. */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.category-tile       { display: flex; flex-direction: column; gap: 10px; padding: 20px; text-decoration: none; color: var(--text); }
.category-tile:hover { box-shadow: inset 0 0 0 1px var(--gold); }
.category-tile__icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--gold-wash);
    color: var(--gold-deep);
    display: grid; place-items: center;
    font-size: 20px;
}
.category-tile__desc {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

/* ================================================================= EDITOR (/leo-manage/) */

.staff-bar {
    background: var(--ink);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    z-index: 50;
    position: relative;
}
.staff-bar__inner {
    display: flex;
    align-items: center;
    gap: 18px;
    /* Longhand top/bottom only — `padding: 8px 0` shorthand would zero
       out left/right and clobber the 48 px gutter that .container--wide
       (on the same element) is providing. Leave left/right untouched. */
    padding-top: 8px;
    padding-bottom: 8px;
}
.staff-bar__label {
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.18em;
    text-decoration: none;          /* Now an <a> — strip the browser default underline. */
    transition: opacity .15s;
}
.staff-bar__label:hover {
    opacity: 0.82;
}
.staff-bar__link,
.staff-bar__quiet {
    /* --bg flips to near-black in dark mode, making the links vanish on the
       fixed-dark staff-bar background. --text-ink is the always-light token
       (paired with --ink); use it explicitly so the bar stays readable in
       both themes. */
    color: var(--text-ink);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity .15s;
}
.staff-bar__link:hover,
.staff-bar__quiet:hover {
    opacity: 1;
    color: var(--gold);
}
.staff-bar__quiet { opacity: 0.55; }
.staff-bar__spacer { flex: 1; }
.staff-bar [aria-current="page"] { color: var(--gold); opacity: 1; }
/* Codification alarm pill — un-codified DB courses / drifted .md files. */
.staff-bar__alarm {
    color: #ffd45a;
    background: rgba(255, 130, 0, 0.18);
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85em;
    text-decoration: none;
    transition: background .15s;
}
.staff-bar__alarm:hover {
    background: rgba(255, 130, 0, 0.32);
    color: #fff;
}

/* Split vertical-only padding so it doesn't clobber the horizontal gutter
   coming from .container--wide on the same element. */
.editor-wrap { padding-top: 64px; padding-bottom: 96px; }

.editor-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rule);
}
.editor-nav {
    display: flex;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.editor-nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}
.editor-nav a:hover { color: var(--text); }  /* theme-aware; --ink is fixed-dark */
.editor-nav a[aria-current="page"] {
    color: var(--gold-deep);
    border-bottom-color: var(--gold);
}

.editor-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 56px;
}
.editor-tile {
    padding: 22px;
    min-height: 160px;
}
.editor-tile--readonly { opacity: 0.75; }
/* Warning state — used by the Codification tile when un-codified
   courses or drifted files exist. Subtle amber to draw the eye
   without being alarming on every page load. */
.editor-tile--warn {
    border-color: rgba(255, 130, 0, 0.55);
    background: rgba(255, 130, 0, 0.08);
}
.editor-tile--warn .editor-tile__count { color: #b35a00; }
.editor-tile__count {
    font-family: var(--font-serif);
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.editor-tile__label {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-deep);
}
.editor-tile__hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.editor-section { margin-top: 36px; }
.editor-bullets { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.editor-bullets a { color: var(--gold-deep); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; text-decoration: none; }
.editor-bullets a:hover { color: var(--text); }
.editor-hint { font-size: 13px; color: var(--muted); font-style: italic; }

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.editor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--rule);
}
.editor-table th,
.editor-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}
.editor-table tr:last-child td { border-bottom: 0; }
.editor-table th {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg-2);
}
.editor-table__id {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    width: 1%;    /* shrink-to-fit for short IDs like '308' */
}
/* Numeric / badge columns: hug their content so the flexible Title column
   keeps all remaining width. `width: 1%` + nowrap is the canonical trick. */
.editor-table th.col-narrow,
.editor-table td.col-narrow { width: 1%; white-space: nowrap; }

/* Visibility badges stack vertically rather than wrap mid-word when the
   column narrows. gap keeps them breathing. */
.editor-table td.col-badges {
    width: 1%;
    white-space: nowrap;
}
.editor-table td.col-badges .tag { display: inline-block; margin-bottom: 3px; }
.editor-table td .tag + .tag { margin-left: 6px; }

/* Actions column: keep `Manage · Edit · View` on one line and shrink-to-fit. */
.editor-table td.col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-size: 13px;
}

/* Images-status column — plain counts (pending / staging / approved),
   not pills. Single horizontal strip; clicking links into the
   per-course image admin. */
.editor-table td.col-images,
.editor-table th.col-images { width: 1%; white-space: nowrap; }
.image-counts {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    color: var(--muted);
}
.image-counts:hover { color: var(--text); }
.image-counts__pending  { color: #8a4a07; }
.image-counts__staging  { color: #6b5300; }
.image-counts__approved { color: #1f5a2b; }
.image-counts__empty    { color: var(--muted); opacity: 0.6; }
[data-theme="dark"] .image-counts__pending  { color: #ffb74d; }
[data-theme="dark"] .image-counts__staging  { color: #fff3cd; }
[data-theme="dark"] .image-counts__approved { color: #a5d6a7; }

.editor-table a { color: var(--gold-deep); text-decoration: none; }
.editor-table a:hover { text-decoration: underline; }

.editor-crumbs {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}
.editor-crumbs a { color: var(--muted); text-decoration: none; }
.editor-crumbs a:hover { color: var(--text); }

.editor-course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Editor form primitives — used on course-edit, lesson-edit, course-import. */
.editor-form {
    max-width: 720px;
    margin: 16px 0 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.editor-field { display: flex; flex-direction: column; gap: 6px; }
.editor-field > label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.editor-field input[type="text"],
.editor-field input[type="number"],
.editor-field input[type="url"],
.editor-field input[type="email"],
.editor-field select,
.editor-field textarea,
.editor-field input[type="file"] {
    font-family: var(--font-sans);
    font-size: 15px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--rule-2);
    background: var(--surface);
    color: var(--text);   /* theme-aware; --ink is fixed-dark and renders invisible in night mode */
    width: 100%;
}
.editor-field textarea {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
}
.editor-field textarea.editor-json {
    font-family: var(--font-mono);
    font-size: 12.5px;
    min-height: 320px;
}
.editor-field input:focus,
.editor-field textarea:focus,
.editor-field select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-wash);
}
.editor-field input[type="checkbox"] {
    width: auto;
    accent-color: var(--gold);
    margin-right: 8px;
}
.editor-field__help {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}
.editor-field__err {
    font-size: 12px;
    color: var(--err);
    margin: 0;
}
.editor-form__actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* Import-result box. */
.editor-result {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border-left: 3px solid var(--gold);
    background: var(--gold-wash);
}
.editor-result--ok  { border-left-color: var(--ok); background: rgba(75,122,77,0.08); }
.editor-result--err { border-left-color: var(--err); background: rgba(163,62,58,0.08); }
.editor-result__output {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-2);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 10px;
    color: var(--ink-2);
}

/* ================================================================= 11. PLACEHOLDER */

/* Striped diagonal — used for imagery slots before real assets arrive. */
.placeholder {
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(
            -45deg,
            var(--bg-2) 0 10px,
            rgba(26, 22, 18, 0.05) 10px 20px
        );
}
.placeholder--gold {
    background:
        repeating-linear-gradient(
            -45deg,
            var(--gold-wash) 0 10px,
            rgba(184, 134, 61, 0.12) 10px 20px
        );
}
.placeholder__label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--rule);
}
