    /* ============================ ADMIN PANEL ============================
       Modern "graphite / ember" scheme — deep neutral charcoal with a warm
       ember-glow at the corners so the coral accent still owns the surface,
       but the base reads clean & premium instead of muddy wine.
         graphite base → clearly-lifted cards → coral orange accent → amber highlights
       per-kind tags: jade · amber · rose · violet
    */
    :root{
      --adm-bg:        #0d0e13;                    /* deep graphite (near-black, slight cool undertone) */
      --adm-bg-glow:   radial-gradient(ellipse 55% 45% at 100% 0%,  rgba(255,133,88,.10), transparent 62%),
                       radial-gradient(ellipse 60% 45% at 0% 100%,  rgba(251,191,36,.055), transparent 65%),
                       radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255,255,255,.025), transparent 70%);
      --adm-panel:     #14161e;                    /* topbar + sidebar — one step above bg */
      --adm-card:      #1a1d27;                    /* cards — cleanly lifted (~+8 luminance) */
      --adm-card-hi:   #232735;                    /* card hover / active state */
      --adm-border:    rgba(255,255,255,.06);      /* neutral, low-noise separator */
      --adm-border-hi: rgba(255,140,90,.30);       /* warm ember on hover/focus */
      --adm-text:      #f2f4f8;                    /* crisp near-white primary text */
      --adm-muted:     #8b93a4;                    /* neutral cool-gray, no wine muddiness */
      --adm-accent:    #ff8a5b;                    /* coral ember (slightly brighter than before) */
      --adm-accent-2:  #fbbf24;                    /* amber gold — kept as brand highlight */
      --adm-success:   #34d399;
      --adm-warning:   #fbbf24;
      --adm-danger:    #f87186;
      --k-writing:     #34d399;
      --k-reading:     #f59e0b;
      --k-listening:   #f87186;
      --k-articles:    #c084fc;
    }

    /* ---- "admin mode": hide every trace of the public site ---- */
    body.admin-mode > header,
    body.admin-mode > footer,
    body.admin-mode > .aurora,
    body.admin-mode > .wrap,
    body.admin-mode > section,
    body.admin-mode > .overlay:not(#adminOverlay){
      display:none !important;
    }
    /* also kill the body's grain texture and any decorative pseudo-elements
       so the admin background stays clean even if you scroll. */
    body.admin-mode::after,
    body.admin-mode::before{ display:none !important; }
    /* Pause the homepage's auto-running animations while we're in the dashboard
       (the band-checker demo loops every ~5 s in the background) */
    body.admin-mode .checker,
    body.admin-mode .topic-list,
    body.admin-mode #toast{ visibility:visible; }

    /* NEVER give <body> a scrollable `overflow` here (it used to be `overflow:auto`).
       Any ancestor whose overflow is scroll/auto/hidden becomes the scrollport for
       every `position:sticky` descendant — so the pinned topbar and the sidebar rail
       "stuck" to a box that itself never scrolls, i.e. they scrolled away with the
       page. That is the exact trap already documented on <body> in 00-base.css.
       `clip` contains stray horizontal overflow WITHOUT creating a scroll container. */
    body.admin-mode{ overflow-x:clip; overflow-y:visible; background:var(--adm-bg); }
    body.admin-mode #adminOverlay{
      position:static; background:transparent; backdrop-filter:none;
      display:block; padding:0; place-items:initial;
      /* THE DASHBOARD WOULD NOT SCROLL WITHOUT THESE TWO.
         42-responsive-system.css gives EVERY `.overlay` `overflow-y:auto` +
         `overscroll-behavior:contain`, so a tall modal scrolls inside its own
         scrim instead of dragging the page behind it. Correct for a modal —
         but in admin-mode this element is not a modal, it IS the page, and the
         reset above only undid position/display/padding.
         So it stayed a scroll container (`overflow-y:auto`) whose content
         exactly fits it (scrollHeight === clientHeight, i.e. nothing to
         scroll), and `contain` then refused to chain the wheel up to the
         document. Every trackpad swipe landed on a box that could not move and
         would not pass the gesture on: the panel was scrollable by layout and
         frozen in the hand. Measured: 2279px of content, 900px viewport, zero
         scroll.
         `visible` also keeps this from becoming the scrollport for the sticky
         topbar and rail — the same trap documented on <body> just above. */
      overflow:visible; overscroll-behavior:auto;
    }
    /* HARD GUARANTEE: the admin panel's container may never paint outside admin
       mode. `#adminOverlay` carries `.open` for as long as the panel is mounted,
       and at least one path drops `body.admin-mode` WITHOUT clearing it — a
       non-admin logging in on a tab that was showing the panel (05-auth-otp.js
       toggles the class directly instead of calling closeAdmin()). The moment
       admin-mode goes, the base `.overlay` rules take over and this becomes what
       they describe: `position:fixed; inset:0`, a 70%-black scrim with a 6px
       backdrop blur at z-index 100, `overflow-y:auto` + `overscroll-behavior:
       contain`. The student then gets the whole site dimmed, blurred,
       unscrollable AND unclickable (elementFromPoint at screen centre returns
       the overlay), with no way back but a reload.
       Declarative on purpose: the JS cleanup is fixed too, but this is the rule
       that makes a future missed path impossible rather than merely unlikely. */
    body:not(.admin-mode) #adminOverlay{ display:none !important; }
    body.admin-mode #adminOverlay .admin-modal{
      width:100%; height:auto; min-height:100vh;
      max-width:none; max-height:none;
      border-radius:0; border:none; animation:none;
      background:var(--adm-bg-glow), var(--adm-bg);
      /* full-bleed and square-cornered — there is nothing left to clip, and the
         modal's `overflow:hidden` would break the sticky chrome (see above). */
      overflow-x:clip; overflow-y:visible;
    }
    .admin-link{ cursor:pointer; opacity:.5; transition:opacity .2s; }
    .admin-link:hover{ opacity:1; color:var(--lime); }

    .admin-modal{
      width:min(960px, 96vw); height:min(720px, 92vh);
      max-height:none; display:flex; flex-direction:column;
      padding:0;
      background:var(--adm-bg-glow), var(--adm-bg);
      border:1px solid var(--adm-border); border-radius:18px;
      overflow:hidden; animation:rise .35s forwards;
    }
    .admin-modal *{ font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; }

    /* ---- topbar ---- */
    .adm-top{
      display:flex; align-items:center; justify-content:space-between; gap:14px;
      padding:14px 22px; background:var(--adm-panel);
      border-bottom:1px solid var(--adm-border);
      position:sticky; top:0; z-index:5;
    }
    body.admin-mode .adm-top{
      backdrop-filter:blur(14px);
      background:var(--adm-panel);
    }
    .adm-brand{ display:flex; align-items:center; gap:10px; font-weight:800; font-size:17px; color:var(--adm-text); }
    .adm-brand-mark{
      width:34px; height:34px; border-radius:9px;
      background:linear-gradient(135deg, #ff7849, #fbbf24);
      display:grid; place-items:center; color:#fff; font-size:16px; font-weight:800;
      box-shadow:0 0 18px rgba(255,120,73,.45);
    }
    .adm-brand-sub{ font-size:13px; color:var(--adm-accent-2); font-weight:700; letter-spacing:.8px; text-transform:uppercase; }
    .adm-top-right{ display:flex; align-items:center; gap:12px; }

    /* "Back to site" button — only shown when admin is the active page */
    .adm-back{
      display:none; align-items:center; gap:6px;
      background:transparent; border:1px solid var(--adm-border);
      color:var(--adm-text); font-weight:600; font-size:15px;
      padding:7px 13px; border-radius:9px; cursor:pointer;
      transition:border-color .15s, background .15s;
    }
    .adm-back:hover{ border-color:var(--adm-border-hi); background:rgba(255,120,73,.08); }
    body.admin-mode .adm-back{ display:inline-flex; }
    .adm-user-info{ text-align:right; line-height:1.2; }
    .adm-user-name{ font-size:15px; font-weight:700; color:var(--adm-text); }
    .adm-user-id{ font-size:13px; color:var(--adm-muted); }
    .adm-logout{
      background:transparent; border:1px solid var(--adm-border); color:var(--adm-muted);
      padding:6px 12px; border-radius:9px; cursor:pointer; font-size:14px; font-weight:600;
      transition:color .2s, border-color .2s;
    }
    .adm-logout:hover{ color:var(--adm-danger); border-color:rgba(248,113,113,.4); }

    /* Phones: the topbar is four blocks of text fighting over ~340px, and at the
       larger type they all wrapped — "Bandly / Admin", "Abdulloh / Tutor", "Sign
       / out" — turning a 70px bar into 190px of pinned chrome (the rail parks
       under it, so that height is stolen from every page). Drop what is
       repeated elsewhere: the wordmark is already the page you are on, and the
       Telegram id is on the Admins page. */
    @media (max-width:760px){
      .adm-top{ padding:10px 14px; gap:10px; }
      .adm-brand{ font-size:15px; gap:8px; min-width:0; }
      .adm-brand > span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
      .adm-brand-sub{ display:none; }
      .adm-user-id{ display:none; }
      .adm-user-name{
        font-size:14px; max-width:34vw;
        white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
      }
      .adm-logout{ white-space:nowrap; padding:6px 10px; font-size:13px; }
      .adm-top-right{ gap:8px; }
    }

    /* ---- two-column shell: sidebar + main ---- */
    .adm-shell{ display:grid; grid-template-columns:230px 1fr; flex:1; overflow:hidden; align-items:start; }
    body.admin-mode .adm-shell{
      /* same reason as .admin-modal above: a scrollable overflow here would
         become the sticky scrollport and unpin the rail. */
      overflow-x:clip; overflow-y:visible;
    }
    .adm-side{
      background:var(--adm-panel); border-right:1px solid var(--adm-border);
      padding:14px 10px 20px; display:flex; flex-direction:column; gap:2px;
      /* In admin-mode the body scrolls, so the sidebar would scroll away with
         the page. Pin it to the viewport so it stays visible. */
      position:sticky; top:0; height:100vh; overflow-y:auto;
    }
    /* Full-page admin: the document is the scroller and .adm-top is pinned at
       the very top, so the rail parks flush underneath it — not at top:0, where
       it would slide under the topbar (z-index 5) and lose its first tab, and
       not at a full 100vh, which would push its last tab below the fold.
       --adm-top-h is measured off .adm-top by 04-admin.js; 71px is the desktop
       height and only matters for the frame before that runs. */
    body.admin-mode .adm-side{
      top:var(--adm-top-h, 71px);
      height:calc(100vh - var(--adm-top-h, 71px));
      height:calc(100dvh - var(--adm-top-h, 71px));
      z-index:3;                       /* below the topbar, above scrolled content */
    }
    /* sidebar section labels — group related tabs together */
    .adm-side-section{
      font-size:12.5px; color:var(--adm-muted); font-weight:800;
      text-transform:uppercase; letter-spacing:1px;
      padding:14px 14px 8px;
    }
    .adm-side-section:first-child{ padding-top:6px; }
    .adm-side hr{
      border:none; height:1px; background:var(--adm-border);
      margin:10px 4px;
    }

    .adm-tab{
      display:flex; align-items:center; gap:11px;
      background:transparent; border:none; cursor:pointer;
      padding:11px 13px; border-radius:11px;
      color:var(--adm-muted); font-size:16.5px; font-weight:600;
      text-align:left; transition:background .2s, color .2s, transform .15s;
      position:relative; overflow:hidden;
      text-decoration:none;            /* anchors don't get the default underline */
    }
    .adm-tab:hover, .adm-tab:focus{ text-decoration:none; }
    .adm-tab::before{
      content:""; position:absolute; left:0; top:8px; bottom:8px; width:3px;
      background:linear-gradient(180deg, #ff7849, #fbbf24); border-radius:3px;
      opacity:0; transform:translateX(-3px); transition:opacity .2s, transform .2s;
    }
    .adm-tab:hover{
      background:rgba(255,120,73,.07); color:var(--adm-text);
      transform:translateX(2px);
    }
    .adm-tab.active{
      background:linear-gradient(90deg, rgba(255,120,73,.16), rgba(251,191,36,.04));
      color:var(--adm-text);
    }
    .adm-tab.active::before{ opacity:1; transform:translateX(0); }

    /* gradient-tinted icon square inside the sidebar tab */
    .adm-tab-ico{
      width:34px; height:34px; border-radius:8px;
      display:grid; place-items:center; flex-shrink:0;
      background:rgba(255,255,255,.04);
      color:var(--adm-muted);
      transition:background .2s, color .2s;
    }
    .adm-tab-ico svg{ width:16px; height:16px; stroke-width:1.8; }
    .adm-tab:hover .adm-tab-ico, .adm-tab.active .adm-tab-ico{ color:var(--adm-text); }
    .adm-tab.active .adm-tab-ico{
      background:linear-gradient(135deg, #ff7849, #fbbf24);
      color:#14080d;
      box-shadow:0 4px 12px -4px rgba(255,120,73,.5);
    }

    .adm-tab .adm-tab-badge{
      margin-left:auto; background:rgba(255,255,255,.06); color:var(--adm-muted);
      font-size:13px; font-weight:800; padding:2px 8px; border-radius:99px;
      min-width:22px; text-align:center;
    }
    .adm-tab.active .adm-tab-badge{
      background:rgba(20,8,13,.18); color:var(--adm-text);
    }

    /* Mobile: the rail becomes a slide-in DRAWER — see 41-admin-mobile.css,
       which owns every ≤760px rule for the shell and is loaded last.
       This used to collapse the rail into a horizontal scrolling strip. With 12
       tabs that showed about two at a time, gave no sense of what else existed,
       and had to drop the group labels and badges to fit — so the one thing a
       phone admin needs most, knowing where they are and what they can reach,
       was the thing it removed. Only the shell's single-column switch stays
       here; the drawer's own positioning lives with the rest of the phone pass. */
    @media (max-width:760px){
      .admin-modal{ height:96vh; }
      .adm-shell{ grid-template-columns:1fr; }
    }

    /* phones: stack the fixed label|field editor grids (a 160–200px label column
       leaves almost nothing for the input at ~360px) and tighten content padding. */
    @media (max-width:600px){
      .adm-main{ padding:16px 14px; }
      .adm-grid-2,
      .rd-imp-step2-grid{ grid-template-columns:1fr !important; }
    }

    .adm-main{ background:var(--adm-bg); overflow-y:auto; padding:22px 26px; }
    .adm-section{ display:none; }
    .adm-section.active{ display:block; animation:fadeIn .25s ease; }

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

    /* ============================ READING ADMIN (rebuild) ============================
       One reading "mock resource" per visit. Empty state → builder with
       collapsible passage cards, rich-text passage content, and a question
       type dropdown. Distinct teal palette so the section feels its own. */
    :root{
      --rd-primary:        #11A37F;
      --rd-primary-hi:     #0E8A6C;
      --rd-primary-soft:   rgba(17,163,127,.10);
      --rd-primary-ring:   rgba(17,163,127,.22);
      --rd-text:           #15202B;
      --rd-muted:          #5B6B78;
      --rd-line:           #E4E8EC;
      --rd-line-hi:        #C9D2DA;
      --rd-card:           #FFFFFF;
      --rd-card-tint:      #F8FAFB;
      --rd-danger:         #E0533D;
      --rd-danger-soft:    rgba(224,83,61,.10);
      /* The danger twin of --rd-primary-ring. 21-admin-listening.css hangs the
         Remove button's hover ring on this; it was never declared, so that
         box-shadow was invalid at computed-value time and the ring simply
         never appeared. */
      --rd-danger-ring:    rgba(224,83,61,.22);
      --rd-focus-ring:     rgba(17,163,127,.30);
    }
    [data-theme="dark"]{
      --rd-text:           #E6EEF5;
      --rd-muted:          #94A3B0;
      --rd-line:           #29333E;
      --rd-line-hi:        #3A4754;
      --rd-card:           #1A2129;
      --rd-card-tint:      #141A21;
      --rd-primary-soft:   rgba(17,163,127,.18);
      --rd-focus-ring:     rgba(17,163,127,.45);
    }

    .rd-root{ color:var(--rd-text); }

    /* ---- AI Content Import modal ---- */
    .rd-imp-overlay{
      position:fixed; inset:0; z-index:1000;
      background:rgba(0,0,0,.55); backdrop-filter:blur(4px);
      display:flex; align-items:center; justify-content:center;
      padding:24px; animation:fadeIn .15s ease;
    }
    .rd-imp-modal{
      width:min(720px, 100%); max-height:88vh;
      background:var(--rd-card); border:1px solid var(--rd-line);
      border-radius:16px; box-shadow:0 24px 60px rgba(0,0,0,.45);
      display:flex; flex-direction:column; overflow:hidden;
      color:var(--rd-text);
      animation:rise .25s ease;
    }
    @keyframes rise{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
    .rd-imp-head{
      display:flex; align-items:center; justify-content:space-between;
      padding:18px 22px; border-bottom:1px solid var(--rd-line);
    }
    .rd-imp-title{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:22px; color:var(--rd-text);
    }
    .rd-imp-body{
      padding:22px; overflow-y:auto; flex:1;
    }
    .rd-imp-foot{
      display:flex; justify-content:flex-end; gap:10px;
      padding:16px 22px; border-top:1px solid var(--rd-line);
      background:var(--rd-card-tint);
    }
    /* Step indicator */
    .rd-imp-steps{
      display:flex; align-items:center; gap:10px; flex-wrap:wrap;
      margin-bottom:18px;
    }
    .rd-imp-step{ display:inline-flex; align-items:center; gap:8px; opacity:.55; }
    .rd-imp-step.active{ opacity:1; }
    .rd-imp-step.done{ opacity:1; }
    .rd-imp-step-n{
      width:30px; height:30px; border-radius:999px;
      display:inline-flex; align-items:center; justify-content:center;
      background:var(--rd-card-tint); border:1px solid var(--rd-line);
      color:var(--rd-muted); font-weight:700; font-size:15px;
    }
    .rd-imp-step.active .rd-imp-step-n{ background:var(--rd-primary); color:#fff; border-color:var(--rd-primary); }
    .rd-imp-step.done .rd-imp-step-n{ background:var(--rd-primary-soft); color:var(--rd-primary); border-color:var(--rd-primary-ring); }
    .rd-imp-step-l{ font-weight:700; font-size:16px; color:var(--rd-text); }
    .rd-imp-step:not(.active):not(.done) .rd-imp-step-l{ color:var(--rd-muted); }
    .rd-imp-step-sep{ color:var(--rd-muted); }
    .rd-imp-intro{ color:var(--rd-muted); font-size:16.5px; margin:0 0 16px 0; line-height:1.55; }

    /* Drop zone */
    .rd-imp-drop{
      display:flex; flex-direction:column; align-items:center; justify-content:center;
      padding:46px 20px; min-height:180px;
      border:1.5px dashed var(--rd-line-hi); border-radius:14px;
      background:var(--rd-card-tint);
      cursor:pointer; transition:border-color .12s, background .12s;
    }
    .rd-imp-drop:hover, .rd-imp-drop.drag{
      border-color:var(--rd-primary); background:var(--rd-primary-soft);
    }
    /* Visual children of the drop zone — keep them out of drag-event routing
       so the <label> reliably owns dragenter/dragover/dragleave/drop. Without
       this, dragleave fires every time the cursor crosses from one child div
       to another, killing the `.drag` highlight and confusing the drop. */
    .rd-imp-drop > *{ pointer-events:none; }
    .rd-imp-drop-ico{ color:var(--rd-muted); margin-bottom:10px; }
    .rd-imp-drop-title{
      font-weight:700; font-size:18px; color:var(--rd-text); margin-bottom:4px;
    }
    .rd-imp-drop-sub{ color:var(--rd-muted); font-size:15.5px; }
    .rd-imp-file-row{
      display:inline-flex; align-items:center; gap:10px;
      margin-top:14px; padding:8px 14px;
      background:var(--rd-card); border:1px solid var(--rd-line); border-radius:10px;
    }
    .rd-imp-file-name{ font-weight:600; color:var(--rd-text); }
    .rd-imp-file-size{ color:var(--rd-muted); font-size:15px; }

    /* ---- Dedicated HTML-import modal (separate from PDF/AI flow) ---- */
    .rd-imp-html-hint{
      margin:0 0 16px 0; padding:12px 14px;
      background:var(--rd-card-tint);
      border:1px dashed var(--rd-line-hi);
      border-radius:12px;
      color:var(--rd-text); font-size:15px; line-height:1.55;
    }
    .rd-imp-html-hint strong{ color:var(--rd-text); font-weight:700; }
    .rd-imp-html-hint em{ color:var(--rd-primary); font-style:normal; font-weight:600; }
    .rd-imp-html-files{
      display:flex; flex-direction:column; gap:8px;
      margin-top:14px;
    }
    .rd-imp-html-file{
      display:flex; align-items:center; gap:12px;
      padding:10px 12px;
      background:var(--rd-card-tint);
      border:1px solid var(--rd-line);
      border-radius:10px;
      transition:border-color .12s, background .12s;
    }
    .rd-imp-html-file:hover{ border-color:var(--rd-line-hi); }
    .rd-imp-html-file-num{
      display:inline-flex; align-items:center; justify-content:center;
      width:30px; height:30px; border-radius:50%;
      background:var(--rd-primary); color:#fff;
      font-weight:700; font-size:15px; flex-shrink:0;
    }
    .rd-imp-html-file-name{
      flex:1; min-width:0;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
      font-size:15.5px; font-weight:600;
      color:var(--rd-text);
    }
    .rd-imp-html-file-size{
      color:var(--rd-muted); font-size:14px;
      font-variant-numeric:tabular-nums;
    }
    .rd-imp-html-file-tag{
      padding:3px 9px;
      background:var(--rd-primary-soft);
      color:var(--rd-primary);
      border:1px solid var(--rd-primary-ring);
      border-radius:999px;
      font-size:13px; font-weight:700; letter-spacing:.3px;
      white-space:nowrap;
    }
    .rd-imp-html-file-remove{
      width:24px; height:24px;
      display:inline-flex; align-items:center; justify-content:center;
      background:transparent; border:1px solid transparent;
      color:var(--rd-muted); cursor:pointer;
      border-radius:6px; font-size:20px; line-height:1;
      transition:color .12s, background .12s, border-color .12s;
    }
    .rd-imp-html-file-remove:hover{
      color:var(--rd-danger, #E0533D);
      background:var(--rd-card);
      border-color:var(--rd-line);
    }
    .rd-imp-html-counter{
      text-align:center; font-size:14px;
      color:var(--rd-muted); margin-top:10px;
    }
    .rd-imp-html-error{
      margin-top:14px; padding:11px 14px;
      background:var(--rd-danger-soft, rgba(224,83,61,.12));
      border:1px solid var(--rd-danger-ring, rgba(224,83,61,.45));
      border-radius:10px;
      color:var(--rd-danger, #E0533D);
      font-size:15px; line-height:1.5;
    }
    .rd-imp-html-error-title{ font-weight:700; margin-bottom:2px; }

    /* Mode toggle — "Just play it" vs "Parse & edit" */
    .rd-imp-html-mode{
      display:grid; grid-template-columns:1fr 1fr;
      gap:8px; margin:0 0 14px 0;
      padding:6px; border:1px solid var(--rd-line); border-radius:12px;
      background:var(--rd-card-tint);
    }
    .rd-imp-html-mode-btn{
      display:block; text-align:left;
      padding:10px 12px; border-radius:9px;
      border:1px solid transparent;
      background:transparent; color:var(--rd-muted);
      cursor:pointer; font:inherit;
      transition:background .12s, border-color .12s, color .12s;
    }
    .rd-imp-html-mode-btn:hover{
      background:var(--rd-card); border-color:var(--rd-line);
      color:var(--rd-text);
    }
    .rd-imp-html-mode-btn.active{
      background:var(--rd-card); border-color:var(--rd-primary);
      color:var(--rd-text);
      box-shadow:0 0 0 3px var(--rd-primary-soft);
    }
    .rd-imp-html-mode-title{
      font-weight:700; font-size:15.5px;
      margin-bottom:2px;
    }
    .rd-imp-html-mode-btn.active .rd-imp-html-mode-title{ color:var(--rd-primary); }
    .rd-imp-html-mode-sub{
      font-size:14px; line-height:1.4; color:var(--rd-muted);
    }

    /* Raw HTML admin view (kind=raw_html test) */
    .rd-raw-banner{
      margin:14px 0; padding:14px 16px;
      background:var(--rd-primary-soft);
      border:1px solid var(--rd-primary-ring);
      border-radius:12px;
    }
    .rd-raw-banner-title{
      font-weight:800; font-size:16px; color:var(--rd-primary);
      margin-bottom:4px;
    }
    .rd-raw-banner-body{
      font-size:15px; line-height:1.5; color:var(--rd-text);
    }
    .rd-raw-list{
      display:flex; flex-direction:column; gap:8px;
      margin:12px 0;
      background:var(--rd-card-tint);
      border-radius:12px;
      padding:6px;
    }
    .rd-raw-card{
      display:flex; align-items:center; gap:14px;
      padding:12px 14px;
      background:var(--rd-card);
      border:0;
      border-radius:8px;
      transition:background .12s;
    }
    .rd-raw-card:hover{ background:var(--rd-primary-soft); }
    .rd-raw-card-num{
      display:inline-flex; align-items:center; justify-content:center;
      width:36px; height:36px; border-radius:50%;
      background:var(--rd-primary); color:#fff;
      font-weight:700; font-size:16px; flex-shrink:0;
    }
    .rd-raw-card-body{ flex:1; min-width:0; }
    .rd-raw-card-title{
      font-weight:700; font-size:17px; color:var(--rd-text);
      margin-bottom:2px;
    }
    .rd-raw-card-meta{
      font-size:14px; color:var(--rd-muted);
    }
    .rd-raw-empty{
      padding:24px; text-align:center; color:var(--rd-muted);
      font-size:15px;
    }

    /* Page-select step — two-column layout */
    .rd-imp-step2-toolbar{
      display:flex; gap:8px; margin-bottom:6px; align-items:center;
    }
    .rd-imp-range-input{
      flex:1; min-width:0; box-sizing:border-box;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:10px;
      padding:9px 12px; font:inherit; font-size:15.5px;
      transition:border-color .15s, box-shadow .15s;
    }
    .rd-imp-range-input:focus{
      outline:none; border-color:var(--rd-primary);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }
    .rd-imp-helper{
      color:var(--rd-muted); font-size:15px; margin:0 0 12px 0;
    }
    .rd-imp-step2-grid{
      display:grid; grid-template-columns: 200px 1fr; gap:14px;
      max-height:50vh;
    }
    @media (max-width:720px){ .rd-imp-step2-grid{ grid-template-columns:1fr; } }
    .rd-imp-pages{
      display:flex; flex-direction:column; gap:8px;
      max-height:50vh; overflow-y:auto; padding-right:4px;
    }
    .rd-imp-page{
      display:flex; align-items:flex-start; gap:8px;
      padding:8px 10px; border:1.5px solid var(--rd-line); border-radius:10px;
      background:var(--rd-card); cursor:pointer;
      transition:border-color .12s, background .12s, transform .1s;
    }
    .rd-imp-page:hover{ border-color:var(--rd-primary-ring); }
    .rd-imp-page.checked{ border-color:var(--rd-primary); }
    .rd-imp-page.focus{ background:var(--rd-primary-soft); box-shadow:0 0 0 3px var(--rd-primary-soft); }
    .rd-imp-page input[type=checkbox]{
      accent-color:var(--rd-primary); margin:4px 0 0 0; flex-shrink:0;
    }
    .rd-imp-page-thumb{
      flex:1; min-width:0; display:flex; flex-direction:column; gap:4px;
    }
    .rd-imp-page-thumb-text{
      font-size:13px; line-height:1.4; color:var(--rd-muted);
      max-height:48px; overflow:hidden;
      display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
    }
    .rd-imp-page-thumb-num{
      font-weight:800; font-size:15px; color:var(--rd-text); align-self:flex-end;
    }
    .rd-imp-preview-pane{
      border:1px solid var(--rd-line); border-radius:10px;
      background:var(--rd-card); overflow-y:auto;
      max-height:50vh; padding:14px 16px;
    }
    .rd-imp-preview-label{
      font-weight:700; color:var(--rd-muted); font-size:14.5px;
      text-transform:uppercase; letter-spacing:.4px; margin-bottom:10px;
      text-align:center;
    }
    .rd-imp-preview-text{
      color:var(--rd-text); font-size:15.5px; line-height:1.6;
      white-space:pre-wrap;
    }
    .rd-imp-step2-foot{
      margin-top:10px; color:var(--rd-muted); font-size:15px;
    }
    .rd-imp-processing-note{
      color:var(--rd-muted); font-size:15px; margin-top:4px; text-align:center; max-width:360px;
    }

    /* Review step — detected passages + question groups */
    .rd-imp-review-grid{
      display:grid; grid-template-columns:0.9fr 1.1fr; gap:16px;
      align-items:start;
    }
    @media (max-width:760px){ .rd-imp-review-grid{ grid-template-columns:1fr; } }
    .rd-imp-section-h{
      font-weight:700; font-size:15px; text-transform:uppercase;
      color:var(--rd-muted); letter-spacing:.4px; margin:4px 0 10px 0;
    }
    .rd-imp-passages-col, .rd-imp-groups-col{
      display:flex; flex-direction:column; gap:10px;
      max-height:55vh; overflow-y:auto; padding-right:4px;
    }
    .rd-imp-passage-card{
      display:flex; gap:12px; align-items:center;
      padding:10px 12px; background:var(--rd-card);
      border:1px solid var(--rd-line); border-radius:10px;
    }
    .rd-imp-passage-num{
      width:34px; height:34px; flex-shrink:0;
      display:inline-flex; align-items:center; justify-content:center;
      border-radius:50%; background:var(--rd-primary-soft);
      color:var(--rd-primary); font-weight:700; font-size:16px;
    }
    .rd-imp-passage-body{ flex:1; min-width:0; }
    .rd-imp-passage-title{
      font-weight:700; color:var(--rd-text); font-size:16px;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    }
    .rd-imp-passage-meta{ color:var(--rd-muted); font-size:14.5px; margin-top:2px; }
    .rd-imp-group{
      border:1px solid var(--rd-line); border-radius:10px;
      background:var(--rd-card); padding:10px 12px;
    }
    .rd-imp-group-head{
      display:flex; align-items:center; gap:8px; flex-wrap:wrap;
      margin-bottom:8px;
    }
    .rd-imp-group-range{
      font-weight:800; font-size:15px; color:var(--rd-text);
      background:var(--rd-primary-soft); padding:2px 8px; border-radius:6px;
    }
    .rd-imp-group-passage{
      font-weight:600; font-size:14px; color:var(--rd-muted);
    }
    .rd-imp-group-wl{
      font-size:14px; color:var(--rd-muted); margin-left:auto;
      font-style:italic;
    }
    .rd-imp-conf{
      font-size:13px; text-transform:uppercase; letter-spacing:.4px;
      font-weight:800; padding:2px 7px; border-radius:5px;
    }
    .rd-imp-conf-high{   background:#e8f5e9; color:#256029; }
    .rd-imp-conf-medium{ background:#fff7e0; color:#7a5300; }
    .rd-imp-conf-low{    background:#fde2e1; color:#871612; }
    .rd-imp-group-body{ display:flex; flex-direction:column; gap:6px; }
    .rd-imp-group-fields{
      display:grid; grid-template-columns:1fr 1fr; gap:8px;
    }
    @media (max-width:520px){ .rd-imp-group-fields{ grid-template-columns:1fr; } }
    .rd-imp-group-field{ display:flex; flex-direction:column; gap:4px; }
    .rd-imp-group-label{
      font-size:14px; color:var(--rd-muted); font-weight:600;
    }
    .rd-imp-type-select{
      width:100%; padding:8px 10px; font:inherit; font-size:16px;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:8px;
    }
    .rd-imp-type-select:focus{
      outline:none; border-color:var(--rd-primary);
      box-shadow:0 0 0 3px var(--rd-primary-soft);
    }
    .rd-imp-warns{
      margin:6px 0 0 0; padding:0; list-style:none;
      font-size:14px; color:#871612;
    }
    .rd-imp-warns li{
      padding:2px 0 2px 16px; position:relative;
    }
    .rd-imp-warns li::before{
      content:"⚠"; position:absolute; left:0; top:1px;
    }
    .rd-imp-diag{
      background:#fff7e0; border:1px solid #f0d089;
      color:#7a5300; padding:8px 12px; border-radius:8px;
      margin-bottom:12px; font-size:15px;
    }
    .rd-imp-pill{
      display:inline-block; padding:2px 8px; border-radius:10px;
      font-size:13.5px; font-weight:700; margin-left:8px;
      text-transform:uppercase; letter-spacing:.4px;
    }
    .rd-imp-pill.ok{   background:#e8f5e9; color:#256029; }
    .rd-imp-pill.warn{ background:#fde2e1; color:#871612; }

    /* ---- Content summary row inside each group ---- */
    .rd-imp-group-summary{
      display:flex; flex-wrap:wrap; align-items:center; gap:6px;
      padding:6px 0 2px;
    }
    .rd-imp-content-meta{
      font-size:14px; font-weight:600; color:var(--rd-muted);
      background:var(--rd-card-tint); border:1px solid var(--rd-line);
      padding:2px 8px; border-radius:10px; white-space:nowrap;
    }
    .rd-imp-ans-row{ display:flex; flex-wrap:wrap; gap:4px; }
    .rd-imp-ans-chip{
      display:inline-flex; align-items:center; gap:3px;
      font-size:13.5px; border-radius:5px; overflow:hidden;
      border:1px solid var(--rd-line);
    }
    .rd-imp-ans-q{
      padding:2px 5px; background:var(--rd-line);
      color:var(--rd-muted); font-weight:700; font-size:13px;
    }
    .rd-imp-ans-v{
      padding:2px 6px 2px 4px; background:var(--rd-card-tint);
      color:var(--rd-text); font-weight:600;
    }
    .rd-imp-no-ans{
      font-size:14px; color:var(--rd-danger); font-style:italic;
    }

    /* ---- Edit button — full-width at bottom of group body ---- */
    .rd-imp-edit-btn{
      display:block; width:100%; margin-top:8px;
      padding:7px 12px; font:inherit; font-size:15px; font-weight:600;
      text-align:center; cursor:pointer;
      background:var(--rd-card-tint); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:7px;
      transition:background .15s, border-color .15s, color .15s;
    }
    .rd-imp-edit-btn:hover{ background:var(--rd-primary-soft); color:var(--rd-primary); border-color:var(--rd-primary-ring); }
    .rd-imp-edit-btn.active{ background:var(--rd-primary-soft); color:var(--rd-primary); border-color:var(--rd-primary-ring); }
    .rd-imp-group-editing{ border-color:var(--rd-primary-ring) !important; }

    /* ---- Inline edit panel ---- */
    .rd-imp-edit-panel{
      border-top:1px solid var(--rd-line); padding:14px 16px 10px;
      display:flex; flex-direction:column; gap:12px;
      /* --rd-card-tint, not --rd-bg: there is no --rd-bg in this palette (see
         the :root block above), and an undefined custom property with no
         fallback makes the WHOLE declaration invalid at computed-value time —
         so this panel was painting `transparent`, not a recessed surface. The
         inputs inside it are --rd-card, so the panel behind them is the tint,
         same pairing as .rd-imp-edit-btn. */
      background:var(--rd-card-tint);
    }
    .rd-imp-edit-section{ display:flex; flex-direction:column; gap:5px; }
    .rd-imp-edit-label{
      font-size:14px; font-weight:700; color:var(--rd-muted); text-transform:uppercase; letter-spacing:.4px;
    }
    .rd-imp-edit-hint{ font-weight:400; text-transform:none; letter-spacing:0; }
    .rd-imp-edit-ta{
      width:100%; box-sizing:border-box;
      padding:8px 10px; font:inherit; font-size:15px; line-height:1.5;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:8px;
      resize:vertical;
    }
    .rd-imp-edit-ta:focus{ outline:none; border-color:var(--rd-primary); box-shadow:0 0 0 3px var(--rd-primary-soft); }
    .rd-imp-edit-ta-body{ font-family:monospace; font-size:14.5px; }
    .rd-imp-edit-answers{ display:flex; flex-direction:column; gap:5px; }
    .rd-imp-edit-answer-row{ display:flex; align-items:center; gap:8px; }
    .rd-imp-edit-q-label{
      font-size:14px; font-weight:700; color:var(--rd-muted); min-width:30px; text-align:right;
    }
    .rd-imp-edit-answer-in,
    .rd-imp-edit-answer-sel{
      flex:1; max-width:260px; padding:5px 8px; font:inherit; font-size:15px;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:6px;
    }
    .rd-imp-edit-answer-in:focus,
    .rd-imp-edit-answer-sel:focus{ outline:none; border-color:var(--rd-primary); box-shadow:0 0 0 3px var(--rd-primary-soft); }
    .rd-imp-edit-actions{
      display:flex; gap:8px; align-items:center; padding-top:2px;
    }
    .rd-imp-edit-save{
      padding:6px 16px; font:inherit; font-size:15.5px; font-weight:700;
      background:var(--rd-primary); color:#fff; border:none; border-radius:7px; cursor:pointer;
      transition:opacity .15s;
    }
    .rd-imp-edit-save:hover{ opacity:.88; }
    .rd-imp-edit-cancel{
      padding:6px 14px; font:inherit; font-size:15.5px; font-weight:600;
      background:transparent; color:var(--rd-muted);
      border:1px solid var(--rd-line); border-radius:7px; cursor:pointer;
    }
    .rd-imp-edit-cancel:hover{ color:var(--rd-text); border-color:var(--rd-muted); }

    /* Processing step */
    .rd-imp-processing{
      display:flex; flex-direction:column; align-items:center; justify-content:center;
      padding:40px 20px; gap:12px;
    }
    .rd-imp-spinner{
      width:46px; height:46px; border-radius:50%;
      border:3px solid var(--rd-line); border-top-color:var(--rd-primary);
      animation:spin 1s linear infinite;
    }
    @keyframes spin{ to{ transform:rotate(360deg); } }
    .rd-imp-processing-title{ font-weight:700; color:var(--rd-text); font-size:18px; }
    .rd-imp-processing-sub{ color:var(--rd-muted); font-size:16px; }

    /* ---- List view ---- */
    .rd-list-page{ animation:fadeIn .25s ease; }
    .rd-list-toolbar{
      display:flex; gap:12px; align-items:center;
      margin-bottom:18px; flex-wrap:wrap;
    }
    .rd-list-search{
      position:relative; flex:1; min-width:220px;
      display:flex; align-items:center;
    }
    .rd-list-search .rd-ic{
      position:absolute; left:14px; top:50%; transform:translateY(-50%);
      color:var(--rd-muted); pointer-events:none;
    }
    .rd-root .rd-list-search-input,
    .admin .rd-root input.rd-list-search-input{
      width:100%; box-sizing:border-box; margin:0;
      padding:12px 14px 12px 40px;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:12px;
      font:inherit; font-size:16.5px;
      transition:border-color .15s, box-shadow .15s;
    }
    .rd-root .rd-list-search-input:focus,
    .admin .rd-root input.rd-list-search-input:focus{
      outline:none; border-color:var(--rd-primary);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }
    .rd-list-grid{ display:flex; flex-direction:column; gap:10px; }
    .rd-list-card{
      display:flex; align-items:center; justify-content:space-between;
      gap:14px; padding:18px 22px;
      background:var(--rd-card); border:1px solid var(--rd-line); border-radius:14px;
      color:var(--rd-text); text-decoration:none;
      transition:border-color .18s, transform .18s cubic-bezier(.3,.7,.4,1), box-shadow .18s, background .18s;
    }
    .rd-list-card:hover{
      border-color:var(--rd-primary);
      box-shadow:0 8px 22px -8px var(--rd-primary-soft), 0 0 0 4px var(--rd-primary-soft);
      transform:translateY(-2px);
      background:var(--rd-card-tint);
    }
    .rd-list-card:active{ transform:translateY(0); box-shadow:0 0 0 4px var(--rd-primary-soft); }
    .rd-list-card-name{ transition:color .18s; }
    .rd-list-card:hover .rd-list-card-name{ color:var(--rd-primary); }
    .rd-list-card-name{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:20px; color:var(--rd-text);
      flex:1; min-width:0;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    }
    .rd-list-card-actions{ display:flex; align-items:center; gap:6px; }
    .rd-list-empty{
      padding:30px; text-align:center; color:var(--rd-muted); font-size:16px;
      border:1.5px dashed var(--rd-line); border-radius:14px;
      background:var(--rd-card-tint);
    }

    /* ---- Builder head ---- */
    .rd-builder-head{
      margin-bottom:18px;
    }
    .rd-back-link{
      display:inline-flex; align-items:center; gap:6px;
      color:var(--rd-muted); text-decoration:none;
      font-size:16px; font-weight:600;
      padding:6px 0; margin-bottom:8px;
      transition:color .12s;
    }
    .rd-back-link:hover{ color:var(--rd-primary); }
    .rd-builder-head-row{
      display:flex; align-items:center; justify-content:space-between; gap:14px;
      flex-wrap:wrap;
    }
    .rd-builder-title{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:30px; color:var(--rd-text);
      margin:0; flex:1; min-width:0;
      overflow:hidden; text-overflow:ellipsis;
      cursor:text;
      padding:2px 8px; margin-left:-8px; border-radius:8px;
      transition:background .12s, box-shadow .12s;
    }
    .rd-builder-title:hover{ background:var(--rd-card-tint); }
    .rd-builder-title.editing{
      background:var(--rd-card); outline:none;
      box-shadow:0 0 0 3px var(--rd-primary-soft);
    }

    /* ---- Export menu ---- */
    .rd-export-anchor{ position:relative; display:inline-block; }
    .rd-export-menu{
      position:absolute; top:calc(100% + 6px); right:0;
      min-width:220px;
      background:var(--rd-card); border:1px solid var(--rd-line);
      border-radius:12px; box-shadow:0 18px 38px rgba(0,0,0,.18);
      padding:6px; z-index:60;
      animation:fadeIn .12s ease;
    }
    .rd-export-menu[hidden]{ display:none; }
    .rd-export-item{
      display:flex; flex-direction:column; align-items:flex-start;
      width:100%; padding:10px 12px;
      background:transparent; border:none; border-radius:8px;
      color:var(--rd-text); cursor:pointer;
      text-align:left; font:inherit;
      transition:background .12s;
    }
    .rd-export-item:hover{ background:var(--rd-primary-soft); }
    .rd-export-item-name{ font-weight:700; font-size:16px; color:var(--rd-text); }
    .rd-export-item:hover .rd-export-item-name{ color:var(--rd-primary); }
    .rd-export-item-sub{ font-size:14.5px; color:var(--rd-muted); margin-top:2px; }

    /* ---- Buttons (shared) ---- */
    .rd-btn{
      display:inline-flex; align-items:center; justify-content:center; gap:8px;
      padding:11px 18px; border-radius:12px; border:1px solid transparent;
      font-family:inherit; font-weight:600; font-size:16.5px; line-height:1;
      cursor:pointer;
      transition:transform .15s cubic-bezier(.3,.7,.4,1), background .18s, border-color .18s, box-shadow .18s, color .18s;
      white-space:nowrap;
      text-decoration:none;
    }
    a.rd-btn,
    a.rd-btn:hover,
    a.rd-btn:focus,
    a.rd-btn:visited{ text-decoration:none; }
    .rd-btn:hover{ transform:translateY(-1px); }
    .rd-btn:active{ transform:translateY(0); }
    .rd-btn:focus-visible{ outline:none; box-shadow:0 0 0 4px var(--rd-focus-ring); }
    .rd-btn-primary{ background:var(--rd-primary); color:#fff; }
    .rd-btn-primary:hover{
      background:var(--rd-primary-hi);
      box-shadow:0 6px 18px -6px var(--rd-primary);
    }
    .rd-btn-ghost{
      background:var(--rd-card); color:var(--rd-text);
      border-color:var(--rd-line);
    }
    .rd-btn-ghost:hover{
      border-color:var(--rd-primary); background:var(--rd-primary-soft);
      color:var(--rd-primary);
    }
    .rd-btn-danger{
      background:transparent; color:var(--rd-danger); border-color:transparent;
    }
    .rd-btn-danger:hover{ background:var(--rd-danger-soft); }
    .rd-btn-sm{ padding:8px 13px; font-size:15.5px; border-radius:10px; }
    .rd-ic{ width:16px; height:16px; flex-shrink:0; display:inline-block; vertical-align:middle; }

    /* ---- Empty state ---- */
    .rd-empty{
      border:1.5px dashed var(--rd-line-hi);
      border-radius:18px; padding:74px 24px;
      background:var(--rd-card-tint);
      text-align:center;
      animation:fadeIn .35s ease;
    }
    .rd-empty-title{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:28px; color:var(--rd-text);
      margin:0 0 26px 0;
    }
    .rd-empty-actions{
      display:inline-flex; gap:14px; flex-wrap:wrap; justify-content:center;
    }

    /* ---- Builder ---- */
    .rd-builder{ animation:fadeIn .25s ease; }
    .rd-passage-list{ display:flex; flex-direction:column; gap:14px; }

    /* ---- Passage card (collapsible) ---- */
    .rd-passage{
      background:var(--rd-card);
      border:1px solid var(--rd-line);
      border-radius:14px;
      transition:border-color .18s, box-shadow .18s, transform .18s cubic-bezier(.3,.7,.4,1);
    }
    .rd-passage:not(.open):hover{
      border-color:var(--rd-primary);
      box-shadow:0 6px 16px -8px var(--rd-primary-soft);
      transform:translateY(-1px);
    }
    .rd-passage.open{
      border-color:var(--rd-primary);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }
    .rd-passage-head{
      display:flex; align-items:center; justify-content:space-between;
      padding:18px 22px; cursor:pointer; user-select:none;
      gap:14px;
    }
    .rd-passage-title{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:21px; color:var(--rd-text);
      letter-spacing:.2px;
    }
    .rd-passage.open .rd-passage-title{ color:var(--rd-primary); }
    .rd-passage-head-right{ display:flex; align-items:center; gap:10px; color:var(--rd-muted); }
    .rd-chev{
      width:20px; height:20px; transition:transform .25s ease;
      color:var(--rd-muted);
    }
    .rd-passage.open .rd-chev{ transform:rotate(180deg); color:var(--rd-primary); }
    .rd-passage-body{
      padding:6px 22px 22px 22px;
      border-top:1px solid var(--rd-line);
    }

    /* ---- Form field ---- */
    .rd-field{ margin-top:18px; }
    .rd-field:first-child{ margin-top:6px; }
    .rd-label{
      display:block; font-weight:700; font-size:16.5px; color:var(--rd-text);
      margin-bottom:8px;
    }
    .rd-label .rd-req{ color:var(--rd-danger); margin-left:2px; }
    /* Inputs — bump specificity past the global .admin select/input/textarea rules. */
    .rd-root .rd-input,
    .rd-root .rd-textarea,
    .admin .rd-root input[type=text].rd-input,
    .admin .rd-root textarea.rd-textarea{
      width:100%; box-sizing:border-box; margin:0;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:10px;
      padding:12px 14px; font-family:inherit; font-size:16.5px;
      transition:border-color .15s, box-shadow .15s;
    }
    .rd-root .rd-input::placeholder,
    .rd-root .rd-textarea::placeholder,
    .rd-root .rd-rte[data-placeholder]:empty::before{
      color:var(--rd-muted); opacity:.75;
    }
    .rd-root .rd-rte[data-placeholder]:empty::before{
      content:attr(data-placeholder); pointer-events:none;
    }
    .rd-root .rd-input:focus,
    .rd-root .rd-textarea:focus,
    .rd-root .rd-rte:focus,
    .admin .rd-root input[type=text].rd-input:focus,
    .admin .rd-root textarea.rd-textarea:focus{
      outline:none; border-color:var(--rd-primary); background:var(--rd-card);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }

    /* ---- Rich text editor ---- */
    .rd-rte-wrap{
      border:1px solid var(--rd-line); border-radius:10px;
      background:var(--rd-card); overflow:hidden;
      transition:border-color .15s, box-shadow .15s;
    }
    .rd-rte-wrap:focus-within{
      border-color:var(--rd-primary);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }
    .rd-rte-toolbar{
      display:flex; align-items:center; gap:2px; flex-wrap:wrap;
      padding:6px 8px;
      background:var(--rd-card-tint);
      border-bottom:1px solid var(--rd-line);
    }
    .rd-rte-tb-sep{
      width:1px; align-self:stretch; background:var(--rd-line); margin:4px 4px;
    }
    .rd-tb-btn{
      display:inline-flex; align-items:center; justify-content:center;
      min-width:36px; height:36px; padding:0 6px;
      background:transparent; border:1px solid transparent; border-radius:7px;
      color:var(--rd-text); cursor:pointer; font:inherit; font-size:16px;
      transition:background .12s, border-color .12s;
    }
    .rd-tb-btn:hover{ background:var(--rd-card); border-color:var(--rd-line); }
    .rd-tb-btn.active{
      background:var(--rd-primary-soft); border-color:var(--rd-primary-ring);
      color:var(--rd-primary);
    }
    .rd-tb-btn svg{ width:16px; height:16px; }
    /* Format dropdown (Paragraph / Heading 1-3) */
    .rd-fmt{ position:relative; display:inline-flex; }
    .rd-fmt-trigger{
      display:inline-flex; align-items:center; gap:6px;
      height:36px; padding:0 8px 0 12px; margin:0;
      background:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:7px;
      font:inherit; font-size:15.5px; line-height:1; cursor:pointer;
      transition:background .12s, border-color .12s;
    }
    .rd-fmt-trigger:hover{ background:var(--rd-card-tint); border-color:var(--rd-line-hi); }
    .rd-fmt-trigger-label{ min-width:64px; text-align:left; }
    .rd-fmt-trigger-chev{ width:14px; height:14px; color:var(--rd-muted); }
    .rd-fmt-menu{
      position:absolute; top:calc(100% + 6px); left:0;
      min-width:220px;
      background:var(--rd-card); border:1px solid var(--rd-line);
      border-radius:10px; box-shadow:0 14px 30px rgba(0,0,0,.18);
      padding:6px; z-index:30;
      animation:fadeIn .12s ease;
    }
    .rd-fmt-menu[hidden]{ display:none; }
    .rd-fmt-item{
      display:flex; align-items:center; gap:8px;
      width:100%; padding:8px 10px;
      background:transparent; border:none; border-radius:7px;
      color:var(--rd-text); cursor:pointer;
      font:inherit; text-align:left;
      transition:background .1s;
    }
    .rd-fmt-item:hover{ background:var(--rd-card-tint); }
    .rd-fmt-check{
      display:inline-flex; width:16px; height:16px; flex-shrink:0;
      color:var(--rd-primary);
    }
    .rd-fmt-check svg{ width:16px; height:16px; }
    .rd-fmt-text{ flex:1; line-height:1.25; }
    .rd-fmt-p  .rd-fmt-text{ font-size:16px; font-weight:500; }
    .rd-fmt-h1 .rd-fmt-text{ font-size:24px; font-weight:800; letter-spacing:-.01em; }
    .rd-fmt-h2 .rd-fmt-text{ font-size:20px; font-weight:800; letter-spacing:-.01em; }
    .rd-fmt-h3 .rd-fmt-text{ font-size:17.5px; font-weight:700; }

    .rd-tb-btn--float{
      width:auto; padding:0 12px; font-weight:600; font-size:15.5px; gap:6px;
    }
    .rd-rte{
      min-height:170px;
      padding:14px 16px;
      font-family:inherit; font-size:16.5px; line-height:1.6; color:var(--rd-text);
      outline:none; overflow-y:auto; max-height:520px;
    }
    .rd-rte p{ margin:0 0 10px 0; }
    .rd-rte p:last-child{ margin-bottom:0; }
    .rd-rte h1, .rd-rte h2, .rd-rte h3{ font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; margin:14px 0 8px 0; }
    .rd-rte ul, .rd-rte ol{ padding-left:24px; margin:8px 0; }
    .rd-rte table{ border-collapse:collapse; margin:10px 0; }
    .rd-rte table td, .rd-rte table th{
      border:1px solid var(--rd-line-hi); padding:6px 10px;
    }
    .rd-rte img{ max-width:100%; height:auto; border-radius:6px; }

    /* ---- Questions sub-section ---- */
    .rd-q-section{ margin-top:24px; padding-top:20px; border-top:1px solid var(--rd-line); }
    .rd-q-title{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; font-size:20px; color:var(--rd-text);
      margin:0 0 14px 0;
    }
    .rd-q-empty{
      text-align:center; padding:14px 0 18px 0;
      color:var(--rd-muted); font-size:16px;
    }
    .rd-q-list{ display:flex; flex-direction:column; gap:12px; }
    .rd-q-add-row{ display:flex; justify-content:center; padding:16px 0 4px 0; }

    /* ---- Question card ---- */
    .rd-q-card{
      background:var(--rd-card);
      border:1px solid var(--rd-line);
      border-radius:14px;
      transition:border-color .18s, box-shadow .18s, transform .18s cubic-bezier(.3,.7,.4,1);
    }
    .rd-q-card:not(.open):hover{
      border-color:var(--rd-primary);
      box-shadow:0 6px 16px -8px var(--rd-primary-soft);
      transform:translateY(-1px);
    }
    .rd-q-card.open{
      border-color:var(--rd-primary);
      box-shadow:0 0 0 4px var(--rd-primary-soft);
    }
    .rd-q-head{
      display:flex; align-items:center; justify-content:space-between;
      padding:12px 16px; cursor:pointer; user-select:none; gap:14px;
    }
    .rd-q-head-left{
      display:flex; align-items:center; gap:12px; min-width:0; flex:1;
    }
    .rd-q-head-num{
      flex:0 0 auto;
      min-width:38px; height:34px;
      display:inline-flex; align-items:center; justify-content:center;
      padding:0 10px;
      font-weight:800; font-size:16px;
      color:var(--rd-primary);
      background:var(--rd-primary-soft);
      border-radius:8px;
      font-variant-numeric:tabular-nums;
    }
    .rd-q-head-type{
      flex:0 0 auto;
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:700; font-size:14px;
      color:var(--rd-muted);
      text-transform:uppercase;
      letter-spacing:.4px;
      padding:3px 10px;
      border:1px solid var(--rd-line);
      border-radius:999px;
      background:var(--rd-card-tint);
      white-space:nowrap;
    }
    .rd-q-card.open .rd-q-head-type{
      color:var(--rd-primary);
      border-color:var(--rd-primary);
      background:var(--rd-primary-soft);
    }
    .rd-q-head-snippet{
      flex:1; min-width:0;
      color:var(--rd-text);
      font-size:16px;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    }
    .rd-q-head-empty{
      color:var(--rd-muted);
      font-style:italic;
    }
    /* Legacy class — kept so older callers don't break */
    .rd-q-head-range{ color:var(--rd-muted); font-size:16px; }
    .rd-q-head-right{ display:flex; align-items:center; gap:8px; color:var(--rd-muted); }
    .rd-q-edit-btn{
      padding:6px 14px;
      font-weight:600; font-size:15px;
      color:var(--rd-text);
      background:transparent;
      border:1px solid var(--rd-line);
      border-radius:8px;
      cursor:pointer;
      transition:border-color .15s, color .15s, background .15s;
    }
    .rd-q-edit-btn:hover{
      border-color:var(--rd-primary);
      color:var(--rd-primary);
      background:var(--rd-primary-soft);
    }
    .rd-q-card.open .rd-q-edit-btn{
      border-color:var(--rd-primary);
      color:var(--rd-primary);
    }
    .rd-q-card.open .rd-q-head .rd-chev{ transform:rotate(180deg); color:var(--rd-primary); }
    .rd-q-body{ padding:6px 18px 18px 18px; border-top:1px solid var(--rd-line); }

    /* Two-column form / preview split */
    .rd-q-split{ display:grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap:22px; padding-top:12px; }
    @media (max-width:980px){ .rd-q-split{ grid-template-columns:1fr; } }
    .rd-q-form{ display:flex; flex-direction:column; gap:14px; }
    .rd-q-field{ display:flex; flex-direction:column; }
    .rd-q-help{ margin-top:6px; color:var(--rd-muted); font-size:15px; }
    .rd-field-err{
      margin-top:6px; color:var(--rd-danger); font-size:15px;
      display:flex; align-items:center; gap:6px;
    }
    .rd-field-err::before{ content:'⚠'; font-weight:700; }
    .rd-q-section-head{
      display:flex; align-items:center; justify-content:space-between;
      margin-bottom:8px; gap:10px;
    }
    .rd-q-empty-box{
      border:1.5px dashed var(--rd-line-hi);
      border-radius:10px; padding:18px;
      text-align:center; color:var(--rd-muted); font-size:16px;
      background:var(--rd-card-tint);
    }

    /* Word bank chips */
    .rd-wb-list{ display:flex; flex-wrap:wrap; gap:8px; }
    .rd-wb-chip{
      display:inline-flex; align-items:center; gap:4px;
      background:var(--rd-card-tint); border:1px solid var(--rd-line);
      border-radius:8px; padding:2px 4px 2px 10px;
    }
    .rd-wb-input{
      background:transparent; border:none; color:var(--rd-text);
      font:inherit; font-size:16px; padding:6px 4px; min-width:90px; width:120px;
      outline:none;
    }
    .rd-wb-del{
      display:inline-flex; align-items:center; justify-content:center;
      width:22px; height:22px; padding:0;
      background:transparent; border:none; border-radius:5px;
      color:var(--rd-muted); cursor:pointer;
    }
    .rd-wb-del svg{ width:12px; height:12px; }
    .rd-wb-del:hover{ background:var(--rd-danger-soft); color:var(--rd-danger); }

    /* Correct answers per-gap list */
    .rd-ca-list{ display:flex; flex-direction:column; gap:8px; }
    .rd-ca-row{
      display:flex; align-items:center; gap:10px;
    }
    .rd-ca-num{
      flex:0 0 auto;
      width:40px; height:40px;
      display:inline-flex; align-items:center; justify-content:center;
      background:var(--rd-card-tint); border:1px solid var(--rd-line);
      border-radius:8px;
      color:var(--rd-text); font:inherit; font-weight:700; font-size:16px;
    }
    .rd-ca-row .rd-input{ flex:1; min-width:0; }
    .rd-root .rd-ca-select,
    .admin .rd-root select.rd-ca-select{
      width:100%; box-sizing:border-box; margin:0;
      background-color:var(--rd-card); color:var(--rd-text);
      border:1px solid var(--rd-line); border-radius:10px;
      padding:11px 14px; font-family:inherit; font-size:16.5px;
      appearance:none; -webkit-appearance:none; -moz-appearance:none;
      background-image:linear-gradient(45deg, transparent 50%, var(--rd-muted) 50%),
                       linear-gradient(135deg, var(--rd-muted) 50%, transparent 50%);
      background-position:calc(100% - 18px) 18px, calc(100% - 13px) 18px;
      background-size:5px 5px; background-repeat:no-repeat;
      color-scheme: light dark;
    }

    /* ---- Sub-question rows (TFNG / YNNG / MC one) ---- */
    .rd-sub-row{
      padding:14px 16px;
      border:1px solid var(--rd-line); border-radius:12px;
      background:var(--rd-card);
      margin-bottom:10px;
      transition:border-color .12s;
    }
    .rd-sub-row:hover{ border-color:var(--rd-line-hi); }
    .rd-sub-head{
      display:flex; align-items:center; gap:10px; margin-bottom:10px;
    }
    .rd-sub-num{
      flex:0 0 auto; min-width:32px; height:32px;
      display:inline-flex; align-items:center; justify-content:center;
      font-weight:800; font-size:16px; color:var(--rd-muted);
    }
    .rd-sub-head .rd-input{ flex:1; min-width:0; }

    /* Vertical radio rows for TFNG / YNNG */
    .rd-sub-opts{
      display:flex; flex-direction:column; gap:8px;
      padding-left:38px;
    }
    .rd-sub-opt{
      display:inline-flex; align-items:center; gap:10px;
      padding:8px 12px; border:1px solid var(--rd-line); border-radius:10px;
      background:var(--rd-card-tint); cursor:pointer;
      transition:border-color .12s, background .12s;
      font-size:16px; color:var(--rd-text);
    }
    .rd-sub-opt:hover{ border-color:var(--rd-primary-ring); }
    .rd-sub-opt.checked{
      border-color:var(--rd-primary);
      background:var(--rd-primary-soft);
      color:var(--rd-primary); font-weight:700;
    }
    .rd-sub-opt input[type=radio]{ accent-color:var(--rd-primary); }

    /* MC option rows (one and many) */
    .rd-mc-opts{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
    .rd-mc-opt-row{
      display:flex; align-items:center; gap:8px;
    }
    .rd-mc-opt-row .rd-input{ flex:1; min-width:0; }
    .rd-mc-opt-radio, .rd-mc-opt-cbox{
      display:inline-flex; align-items:center; gap:6px;
      width:42px; min-width:42px;
      padding:8px 10px; border:1px solid var(--rd-line); border-radius:8px;
      background:var(--rd-card-tint); cursor:pointer;
      font-weight:700; color:var(--rd-muted);
    }
    .rd-mc-opt-radio.checked, .rd-mc-opt-cbox.checked{
      background:var(--rd-primary-soft); border-color:var(--rd-primary); color:var(--rd-primary);
    }
    .rd-mc-opt-radio input, .rd-mc-opt-cbox input{
      accent-color:var(--rd-primary);
    }

    /* Preview radio + checkbox dots */
    .rd-pv-opt{ display:flex; align-items:center; gap:8px; margin-bottom:6px; color:var(--rd-text); font-size:16px; }
    .rd-pv-radio, .rd-pv-checkbox{
      width:14px; height:14px; border:2px solid var(--rd-line-hi);
      display:inline-block; flex-shrink:0;
    }
    .rd-pv-radio{ border-radius:50%; }
    .rd-pv-checkbox{ border-radius:3px; }
    .rd-pv-stmt{ display:flex; gap:10px; margin-bottom:14px; }
    .rd-pv-stmt-num{ font-weight:800; color:var(--rd-text); flex:0 0 auto; }
    .rd-pv-stmt-body{ flex:1; min-width:0; }
    .rd-pv-stmt-text{ color:var(--rd-text); margin-bottom:6px; }
    .rd-pv-empty{ color:var(--rd-muted); font-size:15px; font-style:italic; }

    /* ---- Matching features ---- */
    .rd-mf-cols{
      display:grid; grid-template-columns:1fr 1fr; gap:18px;
    }
    @media (max-width:720px){ .rd-mf-cols{ grid-template-columns:1fr; } }
    .rd-mf-list{ display:flex; flex-direction:column; gap:8px; }
    .rd-mf-row{
      display:flex; align-items:center; gap:8px;
    }
    .rd-mf-row .rd-input{ flex:1; min-width:0; }

    .rd-mf-grid{
      width:100%; border-collapse:collapse;
      border:1px solid var(--rd-line); border-radius:10px; overflow:hidden;
    }
    .rd-mf-grid th, .rd-mf-grid td{
      border:1px solid var(--rd-line);
      text-align:center;
      padding:8px 10px;
      font-size:16px;
    }
    .rd-mf-grid thead th{
      background:var(--rd-card-tint);
      font-weight:800; color:var(--rd-text);
    }
    .rd-mf-grid .rd-mf-rowhead{
      background:var(--rd-card-tint);
      font-weight:700; color:var(--rd-text);
      text-align:left; padding-left:14px;
      width:48px;
    }
    .rd-mf-grid td{ padding:6px; }
    .rd-mf-cell{
      width:36px; height:36px; padding:0;
      display:inline-flex; align-items:center; justify-content:center;
      background:transparent; border:1px solid var(--rd-line); border-radius:6px;
      color:var(--rd-text); cursor:pointer;
      font:inherit; font-weight:800; font-size:20px;
      transition:background .12s, border-color .12s, color .12s;
    }
    .rd-mf-cell:hover{ background:var(--rd-card-tint); border-color:var(--rd-primary-ring); }
    .rd-mf-cell.checked{
      background:var(--rd-primary); border-color:var(--rd-primary); color:#fff;
    }

    /* Preview panel. This `sticky` never actually fired while an `overflow:hidden`
       ancestor was swallowing it (see .adm-shell); now that it does, `top:10px`
       would park it 61px UNDER the pinned topbar, so it clears it the same way
       the sidebar does. */
    .rd-q-preview-col{ position:sticky; top:calc(var(--adm-top-h, 71px) + 10px); align-self:start; }
    .rd-q-preview-head{
      display:flex; align-items:center; gap:8px;
      color:var(--rd-muted); font-weight:700; margin-bottom:8px;
    }
    .rd-q-preview{
      border:1px solid var(--rd-line); border-radius:12px;
      background:var(--rd-card-tint);
      padding:16px 18px;
      min-height:200px;
    }
    .rd-q-preview--empty{
      display:flex; align-items:center; justify-content:center;
      text-align:center; color:var(--rd-muted);
    }
    .rd-q-preview-empty .rd-q-preview-emoji{ font-size:30px; margin-bottom:6px; }
    .rd-pv-head{
      display:flex; align-items:center; justify-content:space-between;
      gap:10px; padding-bottom:10px; margin-bottom:10px;
      border-bottom:1px solid var(--rd-line);
    }
    .rd-pv-range{ font-weight:800; color:var(--rd-text); font-size:17px; }
    .rd-pv-type{
      display:inline-block; padding:4px 10px; border-radius:999px;
      background:var(--rd-card); color:var(--rd-muted);
      border:1px solid var(--rd-line); font-size:14.5px; font-weight:600;
    }
    .rd-pv-prompt{
      color:var(--rd-text); line-height:1.55; font-size:16.5px;
      margin-bottom:12px; font-weight:500;
    }
    /* Preserve admin formatting (bold/italic/paragraphs) inside the prompt */
    .rd-pv-prompt p{ margin:0 0 8px 0; }
    .rd-pv-prompt p:last-child{ margin-bottom:0; }
    .rd-pv-prompt b, .rd-pv-prompt strong{ font-weight:700; }
    .rd-pv-prompt i, .rd-pv-prompt em{ font-style:italic; }
    .rd-pv-prompt u{ text-decoration:underline; }
    .rd-pv-prompt h1, .rd-pv-prompt h2, .rd-pv-prompt h3{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
      font-weight:800; margin:8px 0 4px 0; line-height:1.3;
    }
    .rd-pv-prompt h1{ font-size:20px; }
    .rd-pv-prompt h2{ font-size:18px; }
    .rd-pv-prompt h3{ font-size:17px; }
    .rd-pv-prompt ul, .rd-pv-prompt ol{ padding-left:20px; margin:6px 0; }
    .rd-pv-body{ color:var(--rd-text); line-height:1.85; font-size:16.5px; }
    .rd-pv-body .rd-pv-input{ min-width:48px; }
    /* Word/Google-Docs paste often includes inline styles like
       `line-height:1.33px`, `position:absolute`, weird text-indent, and
       hard-coded font-family. Those collapse the visible text into an
       overlapping smear in the preview. Force-reset them so the admin
       sees clean rendering regardless of where the content came from. */
    .rd-pv-prompt *,
    .rd-pv-body *{
      line-height:inherit !important;
      position:static !important;
      text-indent:0 !important;
      font-family:inherit !important;
    }
    /* Same defense on the exam-side rendering so the student preview matches.
       NOTE: explicitly EXCLUDE iframes AND the loading veil — raw-mode plays an
       iframe inside .reading-passage and lays a .ex-raw-veil loading overlay on
       top, and both need position:absolute to fill the panel. A blanket
       `* { position:static !important }` on .reading-passage was leaving the
       iframe at its 150px intrinsic height with a dark gap above the sticky
       footer, and would likewise collapse the veil to content height. */
    body.exam-mode #reading-exam .ex-q-prompt *:not(iframe):not(.ex-raw-veil),
    body.exam-mode #reading-exam .reading-passage *:not(iframe):not(.ex-raw-veil){
      line-height:inherit !important;
      position:static !important;
    }
    /* HTML content inside the preview (tables, lists, headings) needs a
       sensible default look — passages and table_completion bodies pass
       through full HTML structure. */
    .rd-pv-body table{
      border-collapse:collapse; margin:8px 0; width:100%;
    }
    .rd-pv-body table td, .rd-pv-body table th{
      border:1px solid var(--rd-line-hi);
      padding:6px 10px; text-align:left; vertical-align:top;
    }
    .rd-pv-body table th{
      background:var(--rd-card-tint); font-weight:700;
    }
    .rd-pv-body ul, .rd-pv-body ol{ padding-left:22px; margin:6px 0; }
    .rd-pv-body h1, .rd-pv-body h2, .rd-pv-body h3{
      margin:10px 0 6px 0;
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:800;
    }
    .rd-pv-body p{ margin:0 0 8px 0; }
    .rd-pv-bank{
      display:flex; flex-wrap:wrap; gap:6px; padding:10px;
      background:var(--rd-card); border:1px solid var(--rd-line); border-radius:8px;
      margin-bottom:10px;
    }
    .rd-pv-bank-chip{
      padding:4px 10px; background:var(--rd-primary-soft); color:var(--rd-primary);
      border-radius:6px; font-size:15px; font-weight:600;
    }
    .rd-pv-input{
      display:inline-block; min-width:60px; padding:2px 8px; margin:0 4px;
      background:var(--rd-card); border:1px solid var(--rd-primary-ring);
      border-radius:6px; color:var(--rd-text); font:inherit; font-size:15.5px;
      vertical-align:baseline;
    }
    select.rd-pv-input{ padding-right:24px; }

    /* ---- Bottom toolbar ---- */
    .rd-toolbar{
      display:flex; align-items:center; justify-content:flex-end;
      gap:12px; margin-top:18px; flex-wrap:wrap;
    }
    .rd-toolbar-spacer{ flex:1; }

    /* ---- Add Passage Question dropdown ---- */
    .rd-qmenu-anchor{ position:relative; display:inline-block; }
    .rd-qmenu{
      position:absolute;
      /* Open UPWARD from the button so the 13-item list never gets cut off
         at the bottom of the viewport. */
      bottom:calc(100% + 8px); left:50%; transform:translateX(-50%);
      min-width:280px; max-height:60vh; overflow-y:auto;
      background:var(--rd-card); border:1px solid var(--rd-line);
      border-radius:12px; box-shadow:0 -18px 38px rgba(0,0,0,.14);
      padding:6px; z-index:50;
      animation:fadeIn .15s ease;
    }
    .rd-qmenu[hidden]{ display:none; }
    .rd-qmenu-item{
      display:block; width:100%; text-align:left;
      padding:11px 14px; border-radius:8px;
      background:transparent; border:none; cursor:pointer;
      font:inherit; font-size:16.5px; font-weight:600; color:var(--rd-text);
      transition:background .12s, color .12s;
    }
    .rd-qmenu-item:hover{ background:var(--rd-primary-soft); color:var(--rd-primary); }

    /* ---- Icon button (used in passage card header) ---- */
    .rd-icon-btn{
      display:inline-flex; align-items:center; justify-content:center;
      width:36px; height:36px; padding:0;
      background:transparent; border:1px solid transparent; border-radius:8px;
      color:var(--rd-muted); cursor:pointer;
      transition:background .12s, border-color .12s, color .12s;
    }
    .rd-icon-btn .rd-ic{ width:16px; height:16px; }
    .rd-icon-btn:hover{ background:var(--rd-card-tint); border-color:var(--rd-line); color:var(--rd-text); }
    .rd-icon-btn--danger:hover{
      background:var(--rd-danger-soft); border-color:var(--rd-danger);
      color:var(--rd-danger);
    }

    .adm-section h4{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:28px; font-weight:800;
      margin-bottom:4px; color:var(--adm-text);
      display:flex; align-items:center; gap:10px;
    }
    .adm-section-sub{ color:var(--adm-muted); font-size:17px; margin-bottom:18px; }

    /* tools row: refresh + sort sit next to each section title */
    .adm-section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; gap:12px; flex-wrap:wrap; }
    .adm-section-head .adm-section-text{ flex:1; min-width:200px; }
    .adm-section-head .adm-section-text h4{ margin-bottom:2px; }
    .adm-section-head .adm-section-text .adm-section-sub{ margin-bottom:0; }
    .adm-section-tools{ display:flex; align-items:center; gap:8px; }
    .adm-icon-btn{
      background:var(--adm-card); border:1px solid var(--adm-border);
      color:var(--adm-muted); padding:8px 12px; border-radius:9px; cursor:pointer;
      font-size:16px; font-weight:600; transition:all .15s;
      display:inline-flex; align-items:center; gap:6px;
    }
    .adm-icon-btn:hover{ color:var(--adm-text); border-color:var(--adm-border-hi); background:var(--adm-card-hi); }
    .adm-icon-btn.spinning .adm-ico{ animation:spin 1s linear infinite; }
    @keyframes spin{ to{ transform:rotate(360deg); } }

    /* ---- stats cards ---- */
    .adm-kpi-grid{
      display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
      gap:12px; margin-bottom:20px;
    }
    .adm-kpi{
      background:var(--adm-card); border:1px solid var(--adm-border);
      border-radius:14px; padding:16px 18px;
      transition:border-color .15s, transform .15s;
    }
    .adm-kpi:hover{ border-color:var(--adm-border-hi); }
    .adm-kpi-label{ font-size:13px; color:var(--adm-muted); text-transform:uppercase; letter-spacing:.6px; font-weight:700; }
    .adm-kpi-num{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:36px; font-weight:800;
      line-height:1; margin-top:8px;
      background:linear-gradient(135deg, #ff7849, #fbbf24);
      -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
    }
    .adm-kpi-delta{ font-size:14px; margin-top:6px; color:var(--adm-muted); }
    .adm-kpi.accent .adm-kpi-num{ background:linear-gradient(135deg, #ff7849, #fb7185); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
    .adm-kpi.green  .adm-kpi-num{ background:linear-gradient(135deg, #6ee7b7, #34d399); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
    .adm-kpi.blue   .adm-kpi-num{ background:linear-gradient(135deg, #fbbf24, #f59e0b); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
    .adm-kpi.amber  .adm-kpi-num{ background:linear-gradient(135deg, #c084fc, #a78bfa); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }

    /* ---- form panel ---- */
    .adm-panel-box{
      background:var(--adm-panel); border:1px solid var(--adm-border);
      border-radius:14px; padding:18px; margin-bottom:16px;
    }
    .adm-panel-box h5{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:17px;
      margin-bottom:14px; color:var(--adm-text); font-weight:700;
    }

    .adm-field{ margin-bottom:12px; }
    .adm-field label{
      display:block; font-size:13px; font-weight:700; color:var(--adm-muted);
      text-transform:uppercase; letter-spacing:.5px; margin-bottom:5px;
    }
    .admin select,
    .admin input[type=text],
    .admin input[type=number],
    .admin input[type=password],
    .admin textarea{
      width:100%; padding:12px 14px; border-radius:10px; margin:0;
      background:var(--adm-card); border:1px solid var(--adm-border); color:var(--adm-text);
      font-size:17px; outline:none;
      transition:border-color .15s, background .15s;
    }
    .admin textarea{ height:96px; resize:vertical; min-height:80px; font-size:17px; line-height:1.55; }
    .admin select:focus, .admin input:focus, .admin textarea:focus{
      border-color:var(--adm-accent); background:var(--adm-bg);
    }
    .adm-grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
    /* Four fields on one line only while there is room for them. These used to
       be an inline `grid-template-columns:1fr 1fr 1fr 1fr` in index.html, which
       at a 1100px window left each field ~116px — narrower than the word
       "Intermediate", so the <select>s truncated their own values. Steps down
       4 → 2 → 1 rather than auto-fit, which would land on an orphaned 3.
       `align-items:end` keeps the inputs on one line when a longer label (e.g.
       "Start (s or m:ss)") wraps and its neighbours' don't. */
    .adm-grid-4{
      display:grid; gap:12px; align-items:end;
      grid-template-columns:repeat(4, minmax(0, 1fr));
    }
    @media (max-width:980px){ .adm-grid-4{ grid-template-columns:repeat(2, minmax(0,1fr)); } }
    @media (max-width:560px){ .adm-grid-4{ grid-template-columns:1fr; } }
    /* Field + two inline checkboxes: the checkboxes drop under the field rather
       than crushing it once the row can't hold all three. */
    .adm-grid-opts{
      display:grid; gap:16px; align-items:center;
      grid-template-columns:1fr auto auto;
    }
    @media (max-width:820px){
      .adm-grid-opts{ grid-template-columns:1fr; gap:10px; }
      .adm-grid-opts label{ justify-content:flex-start; }
    }

    /* Premium grant — user-search results dropdown */
    .adm-grant-results{
      margin-top:6px;
      border:1px solid var(--adm-border);
      border-radius:10px;
      overflow:hidden;
      background:var(--adm-card);
    }
    .adm-grant-result{
      display:block; width:100%; text-align:left;
      padding:9px 12px;
      background:transparent; border:0; border-bottom:1px solid var(--adm-border);
      color:var(--adm-text); font-size:15.5px; cursor:pointer;
      transition:background .12s;
    }
    .adm-grant-result:last-child{ border-bottom:0; }
    .adm-grant-result:hover{ background:var(--adm-bg); }
    @media (max-width:520px){ .adm-grid-2{ grid-template-columns:1fr; } }

    .adm-btn{
      background:linear-gradient(135deg, #ff7849, #fb923c);
      color:#fff; border:none;
      padding:11px 18px; border-radius:10px; font-weight:700; font-size:16px;
      cursor:pointer; transition:filter .15s, transform .1s, box-shadow .2s;
      display:inline-flex; align-items:center; gap:7px;
      box-shadow:0 4px 14px -4px rgba(255,120,73,.6);
    }
    .adm-btn:hover{ filter:brightness(1.08); box-shadow:0 8px 22px -6px rgba(255,120,73,.7); }
    .adm-btn:active{ transform:translateY(1px); }
    .adm-btn.full{ width:100%; justify-content:center; }
    .adm-btn.ghost{ background:transparent; border:1px solid var(--adm-border); color:var(--adm-text); box-shadow:none; }
    .adm-btn.ghost:hover{ background:rgba(255,120,73,.06); box-shadow:none; }

    /* ---- file upload (article import) ---- */
    .adm-file{
      display:flex; align-items:center; gap:12px;
      padding:14px 16px;
      background:linear-gradient(135deg, rgba(255,120,73,.06), rgba(251,191,36,.04));
      border:1px dashed var(--adm-border-hi); border-radius:12px;
      cursor:pointer; transition:background .15s, border-color .15s;
    }
    .adm-file:hover{ background:linear-gradient(135deg, rgba(255,120,73,.12), rgba(251,191,36,.06)); border-color:var(--adm-accent); }
    .adm-file input[type=file]{ display:none; }
    .adm-file-ico{
      width:46px; height:46px; border-radius:10px;
      background:linear-gradient(135deg, #ff7849, #fbbf24);
      display:grid; place-items:center; font-size:22px; flex-shrink:0;
      box-shadow:0 4px 12px -4px rgba(255,120,73,.5);
    }
    .adm-file-text{ flex:1; }
    .adm-file-title{ font-weight:700; font-size:16px; color:var(--adm-text); margin-bottom:2px; }
    .adm-file-sub{ font-size:14.5px; color:var(--adm-muted); }
    .adm-file.busy{ opacity:.7; pointer-events:none; }
    .adm-file.busy .adm-file-ico{ animation:spin 1s linear infinite; }

    /* ---- speaking import panel — navy/gold identity, distinct from the orange article tools ---- */
    .adm-panel-speaking{
      border-color:rgba(201,168,76,.4);
      background:linear-gradient(135deg, rgba(27,58,92,.10), rgba(201,168,76,.05));
    }
    .adm-panel-speaking #aSpkFileLabel{
      background:linear-gradient(135deg, rgba(27,58,92,.10), rgba(201,168,76,.06));
      border-color:rgba(201,168,76,.45);
    }
    .adm-panel-speaking #aSpkFileLabel:hover{
      background:linear-gradient(135deg, rgba(27,58,92,.16), rgba(201,168,76,.10));
      border-color:rgba(201,168,76,.7);
    }
    .adm-panel-speaking #aSpkFileIco{
      background:linear-gradient(135deg, #1b3a5c, #c9a84c);
      box-shadow:0 4px 12px -4px rgba(27,58,92,.6);
    }

    /* ---- speaking review-before-publish card ---- */
    .adm-spk-review{
      margin-top:14px; padding:16px;
      border-radius:14px;
      border:1px solid rgba(201,168,76,.45);
      background:linear-gradient(135deg, rgba(27,58,92,.12), rgba(201,168,76,.06));
      box-shadow:0 10px 30px -16px rgba(27,58,92,.7);
      animation:spkReviewIn .28s cubic-bezier(.2,.7,.3,1) both;
    }
    @keyframes spkReviewIn{
      from{ opacity:0; transform:translateY(8px) scale(.99); }
      to  { opacity:1; transform:none; }
    }
    .adm-spk-review-head{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }
    .adm-spk-review-ico{
      width:44px; height:44px; border-radius:11px; flex-shrink:0;
      display:grid; place-items:center; font-size:21px;
      background:linear-gradient(135deg, #1b3a5c, #c9a84c);
      box-shadow:0 4px 12px -4px rgba(27,58,92,.6);
    }
    .adm-spk-review-title{ font-weight:800; font-size:17px; color:var(--adm-text); }
    .adm-spk-review-sub{ font-size:14.5px; color:var(--adm-muted); margin-top:1px; }
    .adm-spk-chips{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:14px; }
    .adm-spk-chip{
      font-size:13.5px; font-weight:700; letter-spacing:.3px;
      padding:4px 9px; border-radius:999px;
      color:#f3e2ab; background:rgba(201,168,76,.16);
      border:1px solid rgba(201,168,76,.40);
    }
    .adm-spk-review .adm-field{ margin-bottom:10px; }
    .adm-spk-review-actions{
      display:flex; align-items:center; gap:10px; margin-top:6px;
    }
    .adm-spk-review-actions .adm-btn{
      background:linear-gradient(135deg, #1b3a5c, #2f5d8a);
      box-shadow:0 4px 14px -4px rgba(27,58,92,.6);
    }
    .adm-spk-review-actions .adm-btn:hover{ box-shadow:0 8px 22px -6px rgba(27,58,92,.7); }
    .adm-spk-review-actions .adm-btn:disabled{ opacity:.6; cursor:default; filter:none; }

    /* ---- managed article sub-sections (Speaking vs Standard) ---- */
    .adm-sub{ margin-top:22px; }
    .adm-sub-head{
      display:flex; align-items:baseline; flex-wrap:wrap; gap:8px;
      padding-bottom:8px; margin-bottom:12px;
      border-bottom:1px solid var(--adm-border);
    }
    .adm-sub-head h5{
      margin:0; font-size:17px; font-weight:800; color:var(--adm-text);
      display:flex; align-items:center; gap:8px;
    }
    .adm-sub-count{
      font-size:14px; font-weight:700; color:var(--adm-muted);
      background:var(--adm-card); border:1px solid var(--adm-border);
      border-radius:999px; padding:1px 9px; min-width:22px; text-align:center;
    }
    .adm-sub-note{ margin:0; font-size:14.5px; color:var(--adm-muted); flex-basis:100%; }

    /* speaking row tag in the managed lists */
    .adm-tag-speaking{
      color:#fff;
      background:linear-gradient(135deg, #1b3a5c, #c9a84c);
      border:none;
    }

    /* ---- Articles workspace switcher (Speaking vs Standard) ---- */
    .adm-artswitch{
      /* minmax(0,1fr), not 1fr: a bare `1fr` track has an AUTO minimum, so it
         refuses to shrink below its content and the switcher overflowed its own
         card once the labels got bigger. */
      position:relative; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:6px;
      padding:6px; margin-bottom:22px;
      background:var(--adm-card); border:1px solid var(--adm-border);
      border-radius:16px;
      box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
    }
    .adm-artswitch-ind{
      position:absolute; top:6px; bottom:6px; left:6px;
      width:calc(50% - 9px); border-radius:12px; z-index:0;
      transition:left .36s cubic-bezier(.34,1.4,.5,1), background .3s, box-shadow .3s;
    }
    .adm-artswitch[data-active="speaking"] .adm-artswitch-ind{
      left:6px;
      background:linear-gradient(135deg, #1b3a5c, #c9a84c);
      box-shadow:0 8px 22px -8px rgba(27,58,92,.85);
    }
    .adm-artswitch[data-active="standard"] .adm-artswitch-ind{
      left:calc(50% + 3px);
      background:linear-gradient(135deg, #ff7849, #fbbf24);
      box-shadow:0 8px 22px -8px rgba(255,120,73,.7);
    }
    .adm-artswitch-btn{
      position:relative; z-index:1;
      display:flex; align-items:center; gap:11px;
      padding:13px 15px; border:none; background:transparent;
      border-radius:12px; cursor:pointer; text-align:left;
      color:var(--adm-muted);
      transition:color .25s, transform .12s;
    }
    .adm-artswitch-btn:hover{ color:var(--adm-text); }
    .adm-artswitch-btn:active{ transform:scale(.985); }
    .adm-artswitch-btn.active{ color:#fff; }
    .adm-artswitch-ico{
      font-size:23px; line-height:1; flex-shrink:0;
      filter:grayscale(.25); transition:transform .3s, filter .3s;
    }
    .adm-artswitch-btn.active .adm-artswitch-ico{ transform:scale(1.14); filter:none; }
    .adm-artswitch-text{ display:flex; flex-direction:column; line-height:1.2; flex:1; min-width:0; }
    .adm-artswitch-label{
      font-weight:800; font-size:17px;
      white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    }
    .adm-artswitch-desc{
      font-size:13.5px; margin-top:2px; opacity:.8;
      white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    }
    .adm-artswitch-btn.active .adm-artswitch-desc{ color:rgba(255,255,255,.85); opacity:1; }
    .adm-artswitch-count{
      flex-shrink:0; font-size:14px; font-weight:800;
      min-width:22px; text-align:center; padding:2px 8px; border-radius:99px;
      transition:background .25s, color .25s, border-color .25s;
    }
    .adm-artswitch-btn:not(.active) .adm-artswitch-count{
      background:var(--adm-bg); color:var(--adm-muted); border:1px solid var(--adm-border);
    }
    .adm-artswitch-btn.active .adm-artswitch-count{
      background:rgba(255,255,255,.20); color:#fff; border:1px solid rgba(255,255,255,.22);
    }
    @media (max-width:560px){
      /* Side by side, each half is ~140px — not enough for "Speaking" plus its
         icon and count, so both labels ellipsised down to "Speak…" / "Stand…".
         Stacked they get the full width and stay readable. The sliding
         indicator has to become a horizontal band to match. */
      .adm-artswitch{ grid-template-columns:1fr; }
      .adm-artswitch-ind{
        left:6px; right:6px; width:auto; top:6px; height:calc(50% - 9px); bottom:auto;
        transition:top .36s cubic-bezier(.34,1.4,.5,1), background .3s, box-shadow .3s;
      }
      .adm-artswitch[data-active="speaking"] .adm-artswitch-ind{ top:6px; left:6px; }
      .adm-artswitch[data-active="standard"] .adm-artswitch-ind{ top:calc(50% + 3px); left:6px; }
      .adm-artswitch-desc{ display:none; }
      .adm-artswitch-btn{ gap:9px; padding:12px; }
    }

    /* the two focused panes — only one shown, cross-faded on switch */
    .adm-artpane[hidden]{ display:none !important; }
    .adm-artpane{ animation:artPaneIn .34s cubic-bezier(.2,.7,.3,1) both; }
    @keyframes artPaneIn{
      from{ opacity:0; transform:translateY(10px); }
      to  { opacity:1; transform:none; }
    }
    @media (prefers-reduced-motion:reduce){
      .adm-artswitch-ind{ transition:left .01s, background .2s; }
      .adm-artpane{ animation:none; }
    }

    /* Task 1 image drop-zone — larger, dashed border, drag-over feedback.
       Built ON TOP of .adm-file so the existing icon/text layout still works. */
    #t1ImageLabel{
      padding:26px 22px;
      flex-direction:row;
      border-width:2px; border-style:dashed;
      position:relative;
      transition:background .2s, border-color .2s, box-shadow .2s, transform .15s;
    }
    #t1ImageLabel .adm-file-ico{
      width:58px; height:58px; font-size:26px;
      box-shadow:0 6px 18px -4px rgba(255,120,73,.55);
    }
    #t1ImageLabel .adm-file-title{ font-size:17px; }
    #t1ImageLabel .adm-file-sub{ font-size:15px; }
    #t1ImageLabel::after{
      content:"Drop · click · paste";
      position:absolute; right:18px; top:50%; transform:translateY(-50%);
      font-size:12.5px; font-weight:800; letter-spacing:1.4px;
      color:var(--adm-muted); text-transform:uppercase; opacity:.55;
      border:1px solid var(--adm-border-hi); padding:4px 10px; border-radius:99px;
      pointer-events:none;
    }
    #t1ImageLabel:hover{
      transform:translateY(-1px);
      box-shadow:0 10px 24px -12px rgba(255,120,73,.35);
    }
    #t1ImageLabel.is-drag{
      background:linear-gradient(135deg, rgba(255,120,73,.18), rgba(251,191,36,.10));
      border-color:#ff7849;
      box-shadow:0 0 0 4px rgba(255,120,73,.18);
    }
    #t1ImageLabel.is-drag::after{
      content:"Drop to upload";
      background:#ff7849; color:#fff; border-color:#ff7849; opacity:1;
    }

    /* ---- CEFR / filter pill buttons (writing tasks + article levels) ---- */
    .adm-pills{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
    .adm-pill{
      background:var(--adm-card); border:1px solid var(--adm-border); color:var(--adm-muted);
      padding:7px 14px; border-radius:99px; cursor:pointer;
      font-size:15px; font-weight:700; transition:all .15s;
    }
    .adm-pill:hover{ color:var(--adm-text); border-color:var(--adm-border-hi); }
    .adm-pill.active{
      background:linear-gradient(135deg, #ff7849, #fbbf24); color:#14080d;
      border-color:transparent;
    }
    /* per-level tag for articles */
    .adm-tag.cefr-c2{ background:#fb7185; color:#fff; }
    .adm-tag.cefr-c1{ background:#fbbf24; }
    .adm-tag.cefr-b2{ background:#6ee7b7; }
    .adm-tag.cefr-b1{ background:#60a5fa; color:#fff; }

    /* ---- search bar (clean SVG icon via CSS mask — picks up theme colour) ---- */
    .adm-search{ position:relative; margin-bottom:12px; }
    .adm-search::before{
      content:''; position:absolute; left:13px; top:50%; transform:translateY(-50%);
      width:16px; height:16px;
      background-color:var(--adm-muted);
      -webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") center/contain no-repeat;
              mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") center/contain no-repeat;
      pointer-events:none; opacity:.8;
    }
    /* higher specificity than .admin input[type=text] above, so the icon clears */
    .admin .adm-search input,
    .adm-search input[type=text]{ padding-left:42px; }

    /* ---- content list rows ---- */
    .adm-list{ display:flex; flex-direction:column; gap:8px; }
    .adm-row{
      background:var(--adm-card); border:1px solid var(--adm-border); border-radius:12px;
      padding:14px;
      transition:border-color .18s, transform .18s, box-shadow .18s, background .18s;
    }
    .adm-row:hover{
      border-color:var(--adm-border-hi);
      transform:translateY(-2px);
      background:var(--adm-card-hi);
      box-shadow:0 12px 28px -16px rgba(0,0,0,.75);
    }
    .adm-row-top{
      display:flex; align-items:center; gap:8px; margin-bottom:8px; flex-wrap:wrap;
    }
    .adm-tag{
      font-size:12px; font-weight:800; padding:3px 8px; border-radius:6px;
      text-transform:uppercase; letter-spacing:.5px; color:#14080d;
    }
    .adm-tag.t1{ background:linear-gradient(135deg, #6ee7b7, #34d399); }
    .adm-tag.t2{ background:linear-gradient(135deg, #fbbf24, #f59e0b); }
    .adm-tag.lvl-easy   { background:#6ee7b7; }
    .adm-tag.lvl-medium { background:#fbbf24; }
    .adm-tag.lvl-hard   { background:#fb7185; color:#fff; }
    .adm-tag.locked     { background:rgba(255,120,73,.12); color:var(--adm-muted); border:1px solid var(--adm-border); }
    .adm-tag.free       { background:#6ee7b7; }

    .adm-row-cat{ font-size:15px; color:var(--adm-muted); font-weight:600; }
    .adm-row-date{ font-size:14px; color:var(--adm-muted); margin-left:auto; opacity:.7; }
    .adm-row-q{ color:var(--adm-text); font-size:16.5px; line-height:1.55; margin-bottom:10px; }
    .adm-row-q small{ display:block; color:var(--adm-muted); font-size:15px; margin-top:4px; }

    .adm-row-actions{ display:flex; gap:6px; }
    .adm-action{
      background:transparent; border:1px solid var(--adm-border);
      color:var(--adm-muted); cursor:pointer; padding:6px 11px; border-radius:8px;
      font-size:14px; font-weight:600; transition:all .15s;
      display:inline-flex; align-items:center; gap:5px;
    }
    .adm-action:hover{ color:var(--adm-text); background:rgba(255,255,255,.05); border-color:var(--adm-border-hi); transform:translateY(-1px); }
    .adm-action:active{ transform:translateY(0); }
    .adm-action.danger:hover{ color:var(--adm-danger); background:rgba(248,113,113,.08); border-color:rgba(248,113,113,.4); }
    .adm-action.save{ background:var(--adm-success); border-color:var(--adm-success); color:#0a0b10; }
    .adm-action.save:hover{ background:#22c987; }

    /* Always-visible CEFR level picker on each article row (works for both
       Speaking and Standard articles — saves the moment you change it). */
    .adm-quick-level{
      display:inline-flex; align-items:center; gap:4px;
      border:1px solid var(--adm-border); border-radius:8px;
      padding:2px 6px 2px 9px; transition:all .15s;
      font-size:12px; font-weight:800; letter-spacing:.05em;
      text-transform:uppercase; color:var(--adm-muted);
    }
    .adm-quick-level:hover{ border-color:var(--adm-border-hi); color:var(--adm-text); }
    .adm-quick-level select{
      background:transparent; border:0; outline:none; cursor:pointer;
      color:var(--adm-text); font-size:14px; font-weight:700; padding:4px 2px;
    }
    .adm-quick-level select option{ background:var(--adm-card); color:var(--adm-text); }

    /* inline edit mode */
    .adm-row.editing .adm-row-q{ display:none; }
    .adm-row .adm-edit{ display:none; }
    .adm-row.editing .adm-edit{ display:block; margin-bottom:10px; }
    .adm-row .adm-edit > *{ margin-bottom:8px; }

    /* ---- users table ---- */
    .adm-users-table{
      width:100%; border-collapse:separate; border-spacing:0;
      background:var(--adm-card); border:1px solid var(--adm-border);
      border-radius:12px; overflow:hidden; font-size:15px;
    }
    .adm-users-table th{
      text-align:left; padding:10px 14px; font-size:13px; font-weight:700;
      color:var(--adm-muted); text-transform:uppercase; letter-spacing:.5px;
      background:var(--adm-panel); border-bottom:1px solid var(--adm-border);
    }
    .adm-users-table td{
      padding:11px 14px; border-bottom:1px solid var(--adm-border); color:var(--adm-text);
    }
    .adm-users-table tr:last-child td{ border-bottom:none; }
    .adm-users-table .badge{
      font-size:12px; padding:2px 7px; border-radius:6px; font-weight:700;
      background:var(--adm-accent); color:#fff; text-transform:uppercase; letter-spacing:.5px;
    }

    /* ---- Writing — import preview modal ---- */
    .wi-modal{
      width:min(840px, 95vw); max-height:90vh;
      display:flex; flex-direction:column; padding:28px;
    }
    .wi-modal h3{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:24px;
      margin-bottom:14px;
    }
    .wi-modal > *:last-child{ margin-top:auto; }
    .wi-prompt{
      background:rgba(0,0,0,.25); border:1px solid var(--glass-line); border-radius:12px;
      padding:14px 16px; margin-bottom:10px;
    }
    .wi-prompt-head{
      display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;
    }
    .wi-prompt .wi-num{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:800; font-size:14.5px;
      color:var(--muted);
      background:rgba(255,255,255,.04); border:1px solid var(--glass-line);
      padding:3px 9px; border-radius:99px; letter-spacing:.4px;
    }
    .wi-prompt label{
      display:block; font-size:13px; font-weight:700; color:var(--muted);
      text-transform:uppercase; letter-spacing:.5px; margin-bottom:5px; margin-top:8px;
    }
    .wi-prompt input, .wi-prompt textarea{
      width:100%; padding:10px 12px; border-radius:9px; margin:0;
      background:rgba(0,0,0,.30); border:1px solid var(--glass-line); color:var(--text);
      font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; font-size:16px; outline:none;
    }
    .wi-prompt input:focus, .wi-prompt textarea:focus{ border-color:var(--lime); }
    .wi-prompt textarea{ min-height:70px; resize:vertical; }
    .wi-prompt .wi-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
    @media (max-width:520px){ .wi-prompt .wi-row{ grid-template-columns:1fr; } }

    /* ---- Writing — sub-nav + task cards + image preview ---- */
    .writing-panel{ display:block; }
    .writing-panel[hidden]{ display:none; }
    [data-writing-nav]{ margin-bottom:18px; }
    [data-writing-nav] .adm-pill{ text-decoration:none; }

    .writing-card{
      background:var(--adm-card); border:1px solid var(--adm-border); border-radius:14px;
      padding:0; margin-bottom:10px; overflow:hidden;
      transition:border-color .15s, box-shadow .15s;
      display:grid; grid-template-columns:160px 1fr; gap:0;
    }
    .writing-card.task2{ grid-template-columns:1fr; }
    .writing-card:hover{ border-color:var(--adm-border-hi); box-shadow:0 6px 18px -8px rgba(0,0,0,.4); }
    .writing-card .wc-thumb{
      background:rgba(255,255,255,.03); display:grid; place-items:center; padding:8px;
      min-height:120px; border-right:1px solid var(--adm-border);
    }
    .writing-card .wc-thumb img{
      max-width:100%; max-height:180px; border-radius:8px; display:block;
    }
    .writing-card .wc-thumb.empty{
      color:var(--adm-muted); font-size:30px; opacity:.5;
    }
    .writing-card .wc-body{ padding:14px 16px; min-width:0; }
    .writing-card .wc-top{
      display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:8px;
    }
    .writing-card .wc-title{
      font-weight:700; color:var(--adm-text); font-size:16.5px;
    }
    .writing-card .wc-cat{
      font-size:13px; font-weight:700; padding:3px 9px; border-radius:99px;
      background:rgba(255,120,73,.10); color:var(--adm-accent); border:1px solid rgba(255,120,73,.25);
    }
    .writing-card .wc-date{ font-size:13.5px; color:var(--adm-muted); margin-left:auto; opacity:.75; }
    .writing-card .wc-prompt{
      color:var(--adm-text); font-size:16px; line-height:1.55;
      display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
      overflow:hidden; text-overflow:ellipsis; margin-bottom:10px;
    }
    .writing-card .wc-prompt.expanded{ -webkit-line-clamp:unset; }
    .writing-card .wc-actions{ display:flex; gap:6px; flex-wrap:wrap; }

    /* image preview tile in the form */
    #t1ImagePreview{ position:relative; }
    #t1ImagePreview .wc-px-rm{
      position:absolute; top:14px; right:14px;
      background:rgba(0,0,0,.7); color:#fff; border:none; cursor:pointer;
      width:32px; height:32px; border-radius:50%; font-size:18px; line-height:1;
    }
    #t1ImagePreview .wc-px-meta{
      font-size:13px; color:var(--adm-muted); margin-top:6px; opacity:.7;
    }

    /* mobile: stack the writing card thumb on top */
    @media (max-width:560px){
      .writing-card{ grid-template-columns:1fr; }
      .writing-card .wc-thumb{ border-right:none; border-bottom:1px solid var(--adm-border); }
    }

    /* ---- Sample answer cards ---- */
    .sample-card{
      background:var(--adm-card); border:1px solid var(--adm-border); border-radius:14px;
      padding:14px 16px; margin-bottom:10px;
      transition:border-color .15s, box-shadow .15s;
    }
    .sample-card:hover{ border-color:var(--adm-border-hi); box-shadow:0 6px 18px -8px rgba(0,0,0,.4); }
    .sample-card .sc-top{
      display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px;
    }
    .sample-card .sc-band{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:14px; font-weight:800;
      padding:4px 11px; border-radius:99px; letter-spacing:.5px;
      background:linear-gradient(135deg, #6ee7b7, #34d399); color:#14080d;
    }
    .sample-card .sc-band.plus{
      background:linear-gradient(135deg, #fbbf24, #f59e0b);
    }
    .sample-card .sc-tasktype{
      font-size:12.5px; font-weight:800; padding:3px 9px; border-radius:6px;
      text-transform:uppercase; letter-spacing:.5px;
      background:rgba(255,255,255,.06); color:var(--adm-muted); border:1px solid var(--adm-border);
    }
    .sample-card .sc-tasksnip{
      font-size:14.5px; color:var(--adm-muted); font-style:italic;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; min-width:0;
    }
    .sample-card .sc-tasksnip.orphan{ color:#fb7185; font-style:normal; }
    .sample-card .sc-date{ font-size:13px; color:var(--adm-muted); opacity:.7; }
    .sample-card .sc-essay{
      color:var(--adm-text); font-size:16px; line-height:1.6; margin-bottom:10px;
      display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical;
      overflow:hidden; text-overflow:ellipsis;
    }
    .sample-card .sc-essay.expanded{ -webkit-line-clamp:unset; }
    .sample-card .sc-notes{
      font-size:15px; color:var(--adm-muted); background:rgba(255,255,255,.03);
      border-left:3px solid var(--adm-accent); padding:8px 12px; border-radius:0 8px 8px 0;
      margin-bottom:10px;
    }
    .sample-card .sc-actions{ display:flex; gap:6px; flex-wrap:wrap; }
    .sample-card .sc-expand-btn{
      background:none; border:none; color:var(--adm-accent); cursor:pointer;
      font-size:14.5px; font-weight:600; padding:0; margin-bottom:8px;
    }

    /* ---- Vocab Quiz item rows (in the quiz form) ---- */
    .vq-item{
      background:var(--adm-card); border:1px solid var(--adm-border); border-radius:12px;
      padding:14px; margin-bottom:10px; position:relative;
    }
    .vq-item-head{
      display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;
    }
    .vq-item-num{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:800; font-size:15px;
      color:var(--adm-muted);
      background:rgba(255,255,255,.04); border:1px solid var(--adm-border);
      padding:3px 9px; border-radius:99px; letter-spacing:.4px;
    }
    .vq-item .vq-options{
      display:flex; flex-direction:column; gap:6px; margin-top:8px;
    }
    .vq-opt{
      display:flex; align-items:center; gap:10px;
      background:rgba(255,255,255,.02); border:1px solid var(--adm-border);
      padding:8px 12px; border-radius:9px;
      transition:border-color .15s, background .15s;
    }
    .vq-opt:has(input[type=radio]:checked){
      background:rgba(110,231,183,.10);
      border-color:rgba(110,231,183,.45);
    }
    .vq-opt input[type=radio]{
      accent-color:var(--adm-success);
      width:16px; height:16px; cursor:pointer;
    }
    .vq-opt input[type=text]{
      flex:1; background:transparent; border:none; padding:4px 0;
      color:var(--adm-text); font-size:16.5px; outline:none;
    }
    .vq-opt input[type=text]:focus{ background:transparent; }
    .vq-opt-letter{
      font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:800; font-size:14px;
      color:var(--adm-muted); width:18px; text-align:center;
    }
    .vq-opt:has(input[type=radio]:checked) .vq-opt-letter{ color:var(--adm-success); }
    .vq-correct-hint{ font-size:13.5px; color:var(--adm-muted); margin-top:4px; opacity:.8; }

    /* List card row for quizzes — slightly richer than other lists */
    .adm-row.vq-row .adm-row-q b{ font-size:17.5px; }
    .adm-row.vq-row .adm-row-q small{ display:flex; gap:14px; flex-wrap:wrap; margin-top:6px; }
    .adm-tag.status-draft    { background:rgba(255,255,255,.10); color:var(--adm-muted); border:1px solid var(--adm-border); }
    .adm-tag.status-published{ background:#6ee7b7; }

    /* empty state */
    .adm-empty{
      text-align:center; padding:36px 16px; color:var(--adm-muted); font-size:15.5px;
      background:var(--adm-card); border-radius:12px; border:1px dashed var(--adm-border);
    }
    .adm-empty .adm-empty-ico{ font-size:36px; display:block; margin-bottom:8px; opacity:.6; }

    /* ----- Premium grant: quick-pick duration chips ----- */
    .adm-preset-row{ display:flex; flex-wrap:wrap; gap:8px; }
    .adm-preset{
      appearance:none; cursor:pointer; font:inherit; font-weight:700; font-size:15px;
      padding:8px 14px; border-radius:999px;
      background:var(--adm-card); color:var(--adm-text);
      border:1px solid var(--adm-border); transition:all .15s ease;
    }
    .adm-preset:hover{ border-color:var(--adm-border-hi); background:var(--adm-card-hi); transform:translateY(-1px); }
    .adm-preset.is-active{
      background:linear-gradient(135deg, var(--adm-accent), #ff9a6b);
      border-color:transparent; color:#1a0d08;
      box-shadow:0 4px 14px rgba(255,120,73,.35);
    }
    .adm-preset--life{ border-style:dashed; color:var(--adm-accent-2); }
    .adm-preset--life.is-active{
      background:linear-gradient(135deg, var(--adm-accent-2), #fcd34d);
      color:#241a02; box-shadow:0 4px 14px rgba(251,191,36,.35);
    }

    /* ----- Premium row: live countdown timer ----- */
    .adm-prem-countdown{
      display:inline-flex; align-items:center; gap:7px;
      margin:8px 0 2px; padding:6px 12px; border-radius:10px;
      font-size:15px; font-weight:600; color:var(--adm-muted);
      background:rgba(255,120,73,.07); border:1px solid var(--adm-border);
    }
    .adm-prem-countdown b{
      color:var(--adm-text); font-weight:800; font-size:17px;
      font-variant-numeric:tabular-nums; letter-spacing:.3px;
    }
    .adm-prem-countdown.is-soon{
      color:#fcd34d; background:rgba(251,191,36,.10); border-color:rgba(251,191,36,.3);
    }
    .adm-prem-countdown.is-soon b{ color:#fde68a; }
    .adm-prem-countdown.is-expired{
      color:#f5a3a3; background:rgba(239,68,68,.08); border-color:rgba(239,68,68,.25);
    }
    .adm-prem-countdown.is-expired b{ color:#fca5a5; }
    .adm-prem-countdown.is-lifetime{
      color:var(--adm-accent-2); background:rgba(251,191,36,.08); border-color:rgba(251,191,36,.22);
    }
    .adm-prem-countdown.is-lifetime b{ color:#fde68a; }

    /* ========================= PREMIUM USER CARD =========================
       Replaces the generic .adm-row for /admin/premium. The old card led with a
       status tag and repeated the plan three times (tag + countdown +
       "Expires: Never (lifetime)"), so the one thing an admin scans for — WHO
       this is — was the least prominent element. Now: initials disc → name →
       quiet meta, with plan state and the two destructive-ish actions parked on
       the right. `--pu` is the per-state accent, set once on [data-state]. */
    .adm-pu{
      --pu:#8ea0c0;
      display:grid; grid-template-columns:auto minmax(0,1fr) auto;
      gap:14px; align-items:center;
      padding:14px 16px; margin-bottom:10px;
      background:var(--adm-card); border:1px solid var(--adm-border);
      border-radius:14px;
      transition:border-color .2s, background .2s, transform .2s;
    }
    .adm-pu:hover{ border-color:var(--adm-border-hi); background:var(--adm-card-hi); }
    .adm-pu[data-state="life"]   { --pu:#34d399; }
    .adm-pu[data-state="active"] { --pu:#60a5fa; }
    .adm-pu[data-state="soon"]   { --pu:#fbbf24; }
    .adm-pu[data-state="expired"]{ --pu:#f87171; }

    /* Initials disc — the row's visual anchor, tinted by plan state. */
    .adm-pu-ava{
      width:46px; height:46px; flex:0 0 42px; border-radius:12px;
      display:grid; place-items:center;
      font-size:16px; font-weight:800; letter-spacing:.5px;
      color:var(--pu);
      background:color-mix(in srgb, var(--pu) 16%, transparent);
      border:1px solid color-mix(in srgb, var(--pu) 34%, transparent);
    }
    .adm-pu-main{ min-width:0; }
    .adm-pu-name{
      font-size:17.5px; font-weight:800; color:var(--adm-text);
      display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; line-height:1.25;
    }
    .adm-pu-handle{ font-size:15px; font-weight:600; color:var(--adm-muted); }
    .adm-pu-meta{
      margin-top:3px; font-size:14.5px; color:var(--adm-muted);
      display:flex; align-items:center; flex-wrap:wrap; gap:0 8px;
    }
    /* dot separator as an element so it never orphans on a wrapped line */
    .adm-pu-sep{
      display:inline-block; width:3px; height:3px; border-radius:50%;
      background:currentColor; opacity:.5; margin:0 1px;
    }
    /* inline-flex, not block: a full-width note read as an empty input field and
       made cards with a note noticeably taller than those without. */
    .adm-pu-note{
      margin-top:6px; font-size:14.5px; color:var(--adm-muted);
      display:inline-flex; align-items:center; gap:6px; max-width:100%;
      padding:3px 9px 3px 7px; border-radius:7px;
      background:color-mix(in srgb, var(--adm-muted) 9%, transparent);
      border:1px solid color-mix(in srgb, var(--adm-muted) 14%, transparent);
      white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    }
    .adm-pu-note span{ flex:0 0 auto; font-size:13px; opacity:.8; }
    .adm-pu-side{ display:flex; flex-direction:column; align-items:flex-end; gap:9px; }
    /* Re-style the countdown pill inside the card (the timer still targets
       `.adm-prem-countdown[data-expiry]`, so this is purely cosmetic). */
    .adm-pu .adm-prem-countdown{
      margin:0; padding:5px 11px; border-radius:99px;
      font-size:14.5px; white-space:nowrap;
      color:var(--pu);
      background:color-mix(in srgb, var(--pu) 13%, transparent);
      border-color:color-mix(in srgb, var(--pu) 30%, transparent);
    }
    .adm-pu .adm-prem-countdown b{ color:var(--pu); font-size:15px; }
    .adm-pu-acts{ display:flex; gap:7px; }
    .adm-pu-btn{
      font-family:inherit; font-size:14.5px; font-weight:700; cursor:pointer;
      padding:7px 13px; border-radius:9px;
      color:var(--adm-text); background:transparent;
      border:1px solid var(--adm-border);
      transition:background .18s, border-color .18s, color .18s;
    }
    .adm-pu-btn:hover{ background:var(--adm-card-hi); border-color:var(--adm-border-hi); }
    .adm-pu-btn.is-danger{ color:#f87171; border-color:rgba(248,113,113,.3); }
    .adm-pu-btn.is-danger:hover{ color:#fff; background:#dc2626; border-color:#dc2626; }

    /* Tablet/phone: the side column can't sit beside a shrinking name column —
       drop it to its own full-width row under the identity block. */
    @media (max-width:760px){
      .adm-pu{ grid-template-columns:auto minmax(0,1fr); row-gap:11px; }
      .adm-pu-side{
        grid-column:1 / -1;
        flex-direction:row; align-items:center; justify-content:space-between;
        flex-wrap:wrap; gap:9px;
      }
      .adm-pu-acts{ flex:1 1 auto; justify-content:flex-end; }
    }
    @media (max-width:420px){
      .adm-pu-acts{ flex:1 1 100%; }
      .adm-pu-btn{ flex:1 1 0; text-align:center; }
    }

