/* ============================================================================
   aw-studio.css — the CMS Studio pane (/admin/cms?v=studio).
   Loaded by awLib/tpl/admin/layout.tpl, after aw-components.css.

   Every colour is a token from aw-tokens.css. Nothing here is hardcoded hex —
   the Studio previews the design system, so it must not contradict it.

   ONE MEANING PER COLOUR, and the whole pane depends on it:
     --aw-accent  (gold)  = SHARED content. A block reaching this page through a
                            pgs/secs CSV, so an edit lands on other pages too.
     --aw-warning         = stranded / not rendered. Stored and invisible.
     --aw-primary         = the current selection.
   Nothing else may use gold.

   @created 2026-08-16  (CMS Studio phase 1)
   ============================================================================ */

.stu { --stu-rail: 268px; }

/* ─── shell: rail + stage, mirroring the layout the Studio edits ──────────── */
.stu-wrap { display: flex; align-items: stretch; gap: 0;
            min-height: calc(100vh - 190px); margin: -12px -16px -64px; }

.stu-rail {
    flex: 0 0 var(--stu-rail); background: var(--aw-dark); color: var(--aw-text-on-dark-2);
    overflow-y: auto; max-height: calc(100vh - 96px); position: sticky; top: 86px;
    border-inline-end: 1px solid rgba(0,0,0,.28);
}
.stu-stage { flex: 1; min-width: 0; display: flex; flex-direction: column;
             background: var(--aw-bg-subtle); }

/* ─── rail panes ─────────────────────────────────────────────────────────── */
.stu-railhead {
    padding: 9px 13px 7px; font-family: var(--aw-font-mono); font-size: 10.5px;
    letter-spacing: .11em; text-transform: uppercase; color: var(--aw-text-inactive);
    border-bottom: 1px solid rgba(255,255,255,.07); position: sticky; top: 0;
    background: var(--aw-dark); z-index: 3;
}
.stu-pane { border-bottom: 1px solid rgba(255,255,255,.07); }
.stu-pane > summary {
    list-style: none; cursor: pointer; padding: 9px 13px; display: flex;
    align-items: center; gap: 8px; font-size: 13px; font-weight: 600; user-select: none;
}
.stu-pane > summary::-webkit-details-marker { display: none; }
.stu-pane > summary:hover { background: var(--aw-hover-light); }
.stu-pane[open] > summary { background: var(--aw-hover-light); }
.stu-pane > summary i:first-child { width: 17px; text-align: center; color: var(--aw-primary-light); }
.stu-pane .n {
    margin-inline-start: auto; font-family: var(--aw-font-mono); font-size: 10.5px;
    background: rgba(255,255,255,.1); padding: 0 6px; border-radius: 9px;
    color: var(--aw-text-inactive);
}
.stu-panein { padding: 7px 10px 12px; background: var(--aw-dark-deep); }

/* ─── tier switch ────────────────────────────────────────────────────────── */
.stu-tiers { display: flex; gap: 4px; margin-bottom: 8px; }
.stu-tiers a {
    flex: 1; background: rgba(255,255,255,.07); border: 1px solid transparent;
    color: var(--aw-text-inactive); border-radius: 5px; padding: 4px 2px;
    font-size: 10.5px; text-align: center; text-decoration: none;
    font-family: var(--aw-font-mono);
}
.stu-tiers a:hover { background: rgba(255,255,255,.14); }
.stu-tiers a.on { background: var(--aw-primary-dark); color: var(--aw-text-on-dark);
                  border-color: var(--aw-primary); }
.stu-tiers a b { display: block; font-size: 12.5px; font-family: var(--aw-font); }

/* ─── tree ───────────────────────────────────────────────────────────────── */
.stu-tree { font-size: 13px; }
.stu-node {
    display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px;
    color: var(--aw-text-on-dark-2); text-decoration: none;
}
.stu-node:hover { background: var(--aw-hover-light); color: var(--aw-text-on-dark); }
.stu-node.on { background: var(--aw-primary-dark); color: var(--aw-text-on-dark); }
.stu-node.off { opacity: .5; }
.stu-node .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-kind {
    font-family: var(--aw-font-mono); font-size: 9px; letter-spacing: .04em; padding: 1px 4px;
    border-radius: 3px; background: rgba(255,255,255,.13); color: var(--aw-text-inactive);
    flex: 0 0 auto;
}
.stu-node.on .stu-kind { background: rgba(255,255,255,.25); color: var(--aw-text-on-dark); }
.stu-cnt { font-family: var(--aw-font-mono); font-size: 10px; color: var(--aw-text-inactive); }
.stu-src { font-size: 9.5px; font-family: var(--aw-font-mono); padding: 0 4px; border-radius: 3px; }
.stu-src-tpl { background: rgba(52,152,219,.28); color: #9ed0f0; }
.stu-src-hnd { background: rgba(243,156,18,.24); color: #f3c06a; }

/* ─── rail chips (macros, blocks, shelf) ─────────────────────────────────── */
.stu-chip {
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.11);
    border-radius: var(--aw-radius-sm); padding: 6px 8px; font-size: 12.5px; margin-bottom: 5px;
}
.stu-chip .t { display: flex; align-items: center; gap: 6px; }
.stu-chip .t b { flex: 1; font-weight: 600; overflow: hidden;
                 text-overflow: ellipsis; white-space: nowrap; }
.stu-chip .meta {
    font-family: var(--aw-font-mono); font-size: 10px; color: var(--aw-text-inactive);
    margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stu-chip.shadow { opacity: .55; }
.stu-note { font-size: 11.5px; color: var(--aw-text-inactive); padding: 5px 2px; }

/* ─── inspector ──────────────────────────────────────────────────────────── */
.stu-insp {
    background: rgba(26,188,156,.09); border: 1px solid rgba(26,188,156,.35);
    border-radius: var(--aw-radius-sm); padding: 9px;
}
.stu-fields { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px;
              font-size: 12px; align-items: baseline; }
.stu-fields dt {
    font-family: var(--aw-font-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .05em; color: var(--aw-text-inactive); margin: 0;
}
.stu-fields dd { margin: 0; font-family: var(--aw-font-mono); font-size: 11.5px;
                 overflow-wrap: anywhere; }
.stu-warn-shared { color: var(--aw-accent); font-size: 11.5px; margin-bottom: 6px; }

/* ─── toolbar ────────────────────────────────────────────────────────────── */
.stu-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 8px 13px;
    background: var(--aw-card-bg); border-bottom: 1px solid var(--aw-border); flex: 0 0 auto;
}
.stu-crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.stu-crumb .sl { font-family: var(--aw-font-mono); font-size: 12px; color: var(--aw-text-muted); }
.stu-crumb .sep { color: var(--aw-text-inactive); }
.stu-seg { display: inline-flex; background: var(--aw-hover-subtle);
           border-radius: 6px; padding: 2px; gap: 2px; }
.stu-seg a {
    border: 0; background: none; padding: 3px 9px; border-radius: 4px; font-size: 12px;
    color: var(--aw-text-muted); font-family: var(--aw-font-mono); text-decoration: none;
}
.stu-seg a.on { background: var(--aw-card-bg); color: var(--aw-text);
                box-shadow: var(--aw-shadow-1); font-weight: 600; }
.stu-lab {
    font-family: var(--aw-font-mono); font-size: 10px; letter-spacing: .09em;
    text-transform: uppercase; color: var(--aw-text-inactive);
}

/* ─── notes banner ───────────────────────────────────────────────────────── */
.stu-notes { padding: 8px 13px 0; display: flex; flex-direction: column; gap: 5px; }
.stu-msg {
    font-size: 12.5px; padding: 6px 10px; border-radius: var(--aw-radius-sm);
    border-inline-start: 3px solid var(--aw-info); background: var(--aw-bg-subtle);
    color: var(--aw-text-muted);
}
.stu-msg-warn  { border-inline-start-color: var(--aw-warning); }
.stu-msg-error { border-inline-start-color: var(--aw-error); }

/* ─── canvas + frame ─────────────────────────────────────────────────────── */
.stu-canvas {
    flex: 1; overflow: auto; padding: 16px 16px 26px; display: flex; justify-content: center;
    background:
        radial-gradient(circle at 1px 1px, var(--aw-border-mid) 1px, transparent 0) 0 0/16px 16px,
        var(--aw-bg-subtle);
}
/* Pure geometry: the frame is a fixed px width scaled down to fit. Forced LTR because an RTL
   admin would otherwise lay the oversized box out from its right edge and the transform origin
   would land off-screen. The frame carries its own dir for the page being previewed. */
.stu-fit { position: relative; direction: ltr; }
.stu-frame {
    transform-origin: top left; background: var(--aw-card-bg); border-radius: 8px;
    box-shadow: var(--aw-shadow-3); overflow: hidden; border: 1px solid var(--aw-border);
}

/* ─── bands ──────────────────────────────────────────────────────────────── */
/* Hatched = chrome the layout renders. Not a drop target, ever. */
.stu-band {
    position: relative; display: flex; align-items: center; padding: 0 16px; gap: 10px;
    font-size: 13px; border-bottom: 1px solid var(--aw-border);
    background-image: repeating-linear-gradient(135deg,
        var(--aw-hover-dark) 0 6px, transparent 6px 12px);
    background-color: var(--aw-hover-subtle);
}
.stu-bname {
    font-family: var(--aw-font-mono); font-size: 10.5px; letter-spacing: .08em;
    text-transform: uppercase; color: var(--aw-text-inactive);
}
.stu-bsrc  { font-family: var(--aw-font-mono); font-size: 10.5px; color: var(--aw-info); }
.stu-bspec { font-family: var(--aw-font-mono); font-size: 10.5px;
             color: var(--aw-text-inactive); margin-inline-start: auto; }
.band-nav { background-color: var(--aw-primary); }
.band-nav .stu-bname, .band-nav .stu-bspec { color: rgba(255,255,255,.82); }
.band-nav .stu-bsrc { color: var(--aw-text-on-dark); }
.band-bottom { background-color: var(--aw-dark); }
.band-bottom .stu-bname, .band-bottom .stu-bspec { color: rgba(255,255,255,.6); }
.band-bottom .stu-bsrc { color: var(--aw-text-on-dark-3); }

/* ─── main band: chrome columns beside the page column ───────────────────── */
.stu-main { display: flex; align-items: stretch; min-height: 300px; }
.stu-col { display: flex; flex-direction: column; min-width: 0; }
.stu-col-chrome {
    flex: 0 0 28%; border-inline-end: 1px solid var(--aw-border);
    background-image: repeating-linear-gradient(135deg,
        var(--aw-hover-dark) 0 6px, transparent 6px 12px);
    background-color: var(--aw-hover-subtle); padding: 9px;
}
.stu-col-page { flex: 1; }
.stu-colhead {
    font-family: var(--aw-font-mono); font-size: 10px; letter-spacing: .08em;
    text-transform: uppercase; color: var(--aw-text-inactive); margin-bottom: 6px;
}

/* ─── slots ──────────────────────────────────────────────────────────────── */
.stu-regions { display: flex; align-items: stretch; flex: 1; min-height: 0; }
.stu-slot { flex: 1; padding: 9px; display: flex; flex-direction: column; gap: 8px;
            min-width: 0; border-inline-end: 1px dashed var(--aw-border); }
.stu-slot:last-child { border-inline-end: 0; }
.stu-slot-side { flex: 0 0 26%; background: var(--aw-bg-subtle); }
.stu-slot-dead { background: repeating-linear-gradient(135deg,
        rgba(243,156,18,.08) 0 6px, transparent 6px 12px); }
.stu-slothead {
    display: flex; align-items: center; gap: 6px; font-family: var(--aw-font-mono);
    font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--aw-text-inactive);
}
.stu-slothead .rule { flex: 1; height: 1px; background: var(--aw-border); }
.stu-empty {
    border: 1.5px dashed var(--aw-border); border-radius: var(--aw-radius-sm);
    padding: 14px; text-align: center; font-size: 12px; color: var(--aw-text-inactive);
}

/* ─── block cards ────────────────────────────────────────────────────────── */
.stu-blk {
    background: var(--aw-card-bg); border: 1px solid var(--aw-border);
    border-radius: var(--aw-radius-sm); padding: 7px 9px; box-shadow: var(--aw-shadow-1);
    border-inline-start: 3px solid var(--aw-text-inactive);
    color: inherit; text-decoration: none; display: block;
}
.stu-blk:hover { border-color: var(--aw-primary); }
.stu-blk.sel { border-color: var(--aw-primary);
               box-shadow: 0 0 0 2px rgba(26,188,156,.3), var(--aw-shadow-1); }
.stu-blk.off { opacity: .5; }
.stu-blk.shared { border-inline-start-color: var(--aw-accent); }
.stu-blk .r1 { display: flex; align-items: center; gap: 6px; }
.stu-blk .r1 b { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden;
                 text-overflow: ellipsis; white-space: nowrap; }
.stu-blk .rnk { font-family: var(--aw-font-mono); font-size: 10px; color: var(--aw-text-inactive); }
.stu-blk .r2 { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.stu-blk .ex { font-size: 11.5px; color: var(--aw-text-muted); margin-top: 4px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* typ colours — the left rule tells you what a block IS before you read it */
.stu-blk.typ-md, .stu-blk.typ-md_file { border-inline-start-color: var(--aw-info); }
.stu-blk.typ-html      { border-inline-start-color: #9b59b6; }
.stu-blk.typ-macro     { border-inline-start-color: var(--aw-primary); }
.stu-blk.typ-tpl       { border-inline-start-color: var(--aw-warning); }
.stu-blk.typ-block-ref { border-inline-start-color: var(--aw-accent); }
/* shared wins over typ: blast radius matters more than content kind */
.stu-blk.shared { border-inline-start-color: var(--aw-accent); }

.stu-typ {
    font-family: var(--aw-font-mono); font-size: 9.5px; text-transform: uppercase;
    letter-spacing: .05em; padding: 1px 5px; border-radius: 3px;
    background: var(--aw-hover-subtle); color: var(--aw-text-muted); flex: 0 0 auto;
}
.stu-tag {
    font-family: var(--aw-font-mono); font-size: 10px; padding: 1px 5px; border-radius: 3px;
    background: var(--aw-hover-subtle); color: var(--aw-text-muted);
}
.stu-tag-macro { background: rgba(26,188,156,.16); color: var(--aw-primary-dark); }
.stu-tag-part  { background: rgba(155,89,182,.15); color: #7d3c98; }
.stu-tag-share { background: rgba(239,192,80,.3);  color: #7a5f13; }
.stu-tag-lang  { background: rgba(52,152,219,.15); color: #1f6ea8; }
.stu-tag-acc   { background: rgba(231,76,60,.14);  color: #a5382c; }

/* Latin/numeric metadata must not be reordered by an RTL paragraph around it: `25–30px`
   renders as `30px-25` inside dir="rtl" without this. Leaf spans only — putting direction
   on a flex row would reverse its item order too. */
.stu-bname, .stu-bspec, .stu-bsrc, .stu-blk .rnk, .stu-tag, .stu-typ, .stu-crumb .sl,
.stu-chip .meta, .stu-kind, .stu-src, .stu-lab, .stu-fields dt, .stu-fields dd,
.stu-slothead > span:not(.rule), .stu-colhead
    { direction: ltr; unicode-bidi: isolate; }

/* ─── chain display ──────────────────────────────────────────────────────── */
.stu-chain { font-family: var(--aw-font-mono); font-size: 10.5px; display: flex;
             flex-wrap: wrap; gap: 4px; align-items: center; }
.stu-chain b { background: var(--aw-primary-dark); color: var(--aw-text-on-dark);
               padding: 0 5px; border-radius: 3px; font-weight: 600; }
.stu-chain s { color: var(--aw-text-inactive); text-decoration: none; opacity: .65; }
.stu-chain em { font-style: normal; color: var(--aw-warning); }

@media (max-width: 900px) {
    .stu-wrap { flex-direction: column; }
    .stu-rail { flex: 0 0 auto; max-height: none; position: static; }
    .stu-main, .stu-regions { flex-direction: column; }
    .stu-col-chrome, .stu-slot-side { flex: 0 0 auto; }
}

/* ─── phase 2: drag, drop, and write feedback ────────────────────────────── */
.stu-blk { cursor: grab; }
.stu-blk:active { cursor: grabbing; }
/* A shared block is reordered from the page that owns it — dragging it here would
   renumber a slot it does not belong to. Say so with the cursor, not just a tooltip. */
.stu-blk.shared { cursor: not-allowed; }
.stu-blk.dragging { opacity: .4; }
.stu-blk.saving { border-color: var(--aw-primary); }
.stu-blk.saving::after {
    content: ''; position: absolute; inset-inline-end: 6px; inset-block-start: 6px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--aw-primary);
    animation: stu-pulse 1s ease-in-out infinite;
}
.stu-blk { position: relative; }
@keyframes stu-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stu-blk.saving::after { animation: none; } }

.stu-slot.over { background: rgba(26,188,156,.09); box-shadow: inset 0 0 0 2px var(--aw-primary); }
.stu-slot[data-dead] { cursor: not-allowed; }
.stu-empty-drop { transition: border-color .15s; }
.stu-slot.over .stu-empty-drop { border-color: var(--aw-primary); color: var(--aw-primary-dark); }

.stu-eye {
    border: 0; background: none; cursor: pointer; color: var(--aw-text-inactive);
    font-size: 11px; padding: 2px 3px; line-height: 1; border-radius: 3px;
}
.stu-eye:hover { background: var(--aw-hover-subtle); color: var(--aw-text); }
.stu-eye[aria-pressed="false"] { color: var(--aw-warning); }

/* ─── status line ────────────────────────────────────────────────────────── */
.stu-status {
    margin: 8px 13px 0; padding: 6px 11px; border-radius: var(--aw-radius-sm);
    font-size: 12.5px; background: var(--aw-bg-subtle); color: var(--aw-text-muted);
    border-inline-start: 3px solid var(--aw-success);
}
.stu-status-error {
    border-inline-start-color: var(--aw-error); background: rgba(231,76,60,.08);
    color: var(--aw-error);
}

/* ─── inspector inputs ───────────────────────────────────────────────────── */
.stu-fields input, .stu-fields select {
    width: 100%; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.15);
    color: var(--aw-text-on-dark-2); border-radius: 4px; padding: 3px 6px;
    font-size: 11.5px; font-family: var(--aw-font-mono);
}
.stu-fields input:focus, .stu-fields select:focus {
    outline: none; border-color: var(--aw-primary); background: rgba(0,0,0,.45);
}
.stu-fields label {
    font-family: var(--aw-font-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .05em; color: var(--aw-text-inactive);
}
.stu-fields input.saving, .stu-fields select.saving { border-color: var(--aw-primary); }
.stu-fields input.bad, .stu-fields select.bad { border-color: var(--aw-error); }
.stu-ro { margin-top: 7px; opacity: .8; }

/* ─── phase 3: the live preview frame ────────────────────────────────────── */
/* The iframe is the real page at the chosen device width; the wrapper is scaled to
   fit exactly like the design-mode frame, so switching modes does not move things. */
.stu-frame-live { padding: 0; overflow: hidden; background: var(--aw-card-bg); }
.stu-frame-live iframe { display: block; border: 0; width: 100%; background: var(--aw-card-bg); }
.stu-frame-live.loading { opacity: .55; }

/* Fill=placeholder is a property of the framed page, but the operator needs to know at a
   glance which of the two they are looking at without reading the toolbar. */
.stu-seg a.on[href*="fill=placeholder"] { color: var(--aw-warning); }

/* ─── phase 4: the body editor drawer ────────────────────────────────────── */
/* Over the stage, anchored to the bottom of the viewport: the rail is 268px and a
   textarea there is a worse editor than the CRUD form it replaces. */
.stu-drawer {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 96;
    background: var(--aw-card-bg); border-top: 2px solid var(--aw-primary);
    box-shadow: 0 -8px 26px rgba(20, 35, 50, .22);
    display: flex; flex-direction: column; max-height: 62vh;
}
html[dir="rtl"] .stu-drawer { inset-inline-start: 0; }
.stu-dr-head {
    display: flex; align-items: center; gap: 9px; padding: 7px 14px;
    border-bottom: 1px solid var(--aw-border); font-size: 13px; flex: 0 0 auto;
}
.stu-dr-head b { font-weight: 650; }
.stu-dr-state { font-size: 12px; color: var(--aw-text-inactive); font-family: var(--aw-font-mono); }
.stu-dr-state.on { color: var(--aw-warning); }

.stu-dr-body { display: flex; min-height: 0; flex: 1; }
.stu-dr-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stu-dr-tabs {
    display: flex; align-items: center; gap: 3px; padding: 5px 12px;
    background: var(--aw-bg-subtle); border-bottom: 1px solid var(--aw-border);
}
.stu-dr-tabs button {
    border: 0; background: none; padding: 3px 11px; border-radius: 4px; cursor: pointer;
    font-family: var(--aw-font-mono); font-size: 12px; color: var(--aw-text-muted);
}
.stu-dr-tabs button.on {
    background: var(--aw-card-bg); color: var(--aw-text);
    box-shadow: var(--aw-shadow-1); font-weight: 600;
}
.stu-drawer textarea {
    flex: 1; min-height: 150px; border: 0; padding: 12px 14px; resize: none;
    font-family: var(--aw-font-mono); font-size: 12.5px; line-height: 1.65;
    background: var(--aw-card-bg); color: var(--aw-text); direction: ltr; text-align: start;
}
.stu-drawer textarea:focus { outline: none; }
.stu-dr-foot {
    display: flex; align-items: center; gap: 8px; padding: 7px 14px;
    border-top: 1px solid var(--aw-border); flex: 0 0 auto;
}

/* ─── insert palette ─────────────────────────────────────────────────────── */
.stu-dr-side {
    flex: 0 0 268px; border-inline-start: 1px solid var(--aw-border);
    background: var(--aw-bg-subtle); padding: 10px 12px; overflow-y: auto;
}
.stu-dr-side h5 {
    font-family: var(--aw-font-mono); font-size: 10px; letter-spacing: .09em;
    text-transform: uppercase; color: var(--aw-text-inactive); margin: 0 0 6px;
}
.stu-mac {
    border: 1px solid var(--aw-border); background: var(--aw-card-bg);
    border-radius: var(--aw-radius-sm); margin-bottom: 5px; overflow: hidden;
}
.stu-mac-h {
    display: flex; align-items: center; gap: 6px; padding: 5px 8px; cursor: pointer;
}
.stu-mac-h:hover { background: var(--aw-hover-subtle); }
.stu-mac-h code {
    flex: 1; font-family: var(--aw-font-mono); font-size: 11.5px;
    color: var(--aw-primary-dark); direction: ltr; unicode-bidi: isolate;
}
.stu-mac-n { padding: 0 8px 6px; font-size: 11px; color: var(--aw-text-inactive); }
.stu-mac-p {
    padding: 7px 8px; border-top: 1px solid var(--aw-border);
    background: var(--aw-bg-subtle); display: flex; flex-direction: column; gap: 5px;
}
.stu-mac-p label {
    display: flex; align-items: center; gap: 6px; font-size: 11.5px;
    color: var(--aw-text-muted);
}
.stu-mac-p input, .stu-mac-p select {
    margin-inline-start: auto; width: 55%; font-family: var(--aw-font-mono); font-size: 11.5px;
    padding: 2px 5px; border: 1px solid var(--aw-border-mid); border-radius: 4px;
    background: var(--aw-card-bg); color: var(--aw-text);
}

.stu-dr-toks { display: flex; flex-wrap: wrap; gap: 4px; }
.stu-tok {
    font-family: var(--aw-font-mono); font-size: 11.5px; padding: 3px 10px;
    border: 1px solid var(--aw-border-mid); border-radius: 14px; cursor: pointer;
    background: var(--aw-card-bg); color: var(--aw-text-muted);
}
.stu-tok:hover { border-color: var(--aw-primary); color: var(--aw-primary-dark); }

/* ─── shared small button ────────────────────────────────────────────────── */
.stu-btn {
    display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
    padding: 4px 11px; border-radius: 5px; cursor: pointer; text-decoration: none;
    border: 1px solid var(--aw-border-mid); background: var(--aw-card-bg);
    color: var(--aw-text-muted);
}
.stu-btn:hover { border-color: var(--aw-primary); color: var(--aw-primary-dark); }
.stu-btn-go {
    background: var(--aw-primary-dark); border-color: var(--aw-primary-dark);
    color: var(--aw-text-on-dark);
}
.stu-btn-go:hover { background: var(--aw-primary); color: var(--aw-text-on-dark); }
.stu-btn[disabled] { opacity: .55; cursor: default; }
.stu-insp-acts { display: flex; gap: 5px; margin-top: 9px; }
.stu-insp-acts .stu-btn-go { flex: 1; justify-content: center; }

@media (max-width: 900px) {
    .stu-dr-body { flex-direction: column; }
    .stu-dr-side { flex: 0 0 auto; border-inline-start: 0; border-top: 1px solid var(--aw-border); }
}

/* ─── phase 5: the media browser ─────────────────────────────────────────── */
.stu-med { display: flex; flex-direction: column; gap: 6px; }
.stu-med-bar { display: flex; gap: 5px; }
.stu-med-bar select, .stu-med-q {
    flex: 1; min-width: 0; font-family: var(--aw-font-mono); font-size: 11.5px;
    padding: 3px 6px; border: 1px solid var(--aw-border-mid); border-radius: 4px;
    background: var(--aw-card-bg); color: var(--aw-text);
}
.stu-med-crumbs {
    display: flex; flex-wrap: wrap; gap: 3px; align-items: center;
    font-family: var(--aw-font-mono); font-size: 10.5px; color: var(--aw-text-inactive);
    direction: ltr; unicode-bidi: isolate;
}
.stu-med-crumbs a { color: var(--aw-primary-dark); text-decoration: none; }
.stu-med-crumbs a:hover { text-decoration: underline; }

/* A dense grid, because the operator is scanning for one picture among sixty. */
.stu-med-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 5px;
    max-height: 210px; overflow-y: auto; padding: 2px;
}
.stu-med-dir {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; aspect-ratio: 1; border: 1px solid var(--aw-border); border-radius: var(--aw-radius-sm);
    background: var(--aw-hover-subtle); cursor: pointer; padding: 4px; overflow: hidden;
}
.stu-med-dir:hover { border-color: var(--aw-primary); }
.stu-med-dir i    { color: var(--aw-accent); font-size: 15px; }
.stu-med-dir span { font-size: 9.5px; line-height: 1.1; text-align: center;
                    overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stu-med-dir em   { font-style: normal; font-size: 9px; color: var(--aw-text-inactive); }

.stu-med-f {
    position: relative; margin: 0; aspect-ratio: 1; border: 1px solid var(--aw-border);
    border-radius: var(--aw-radius-sm); overflow: hidden; cursor: pointer;
    background: var(--aw-hover-subtle); display: flex; align-items: center; justify-content: center;
}
.stu-med-f:hover { border-color: var(--aw-primary); box-shadow: var(--aw-shadow-1); }
.stu-med-f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stu-med-kind {
    font-family: var(--aw-font-mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--aw-text-muted);
}
.stu-med-f figcaption {
    position: absolute; inset-inline: 0; inset-block-end: 0; padding: 1px 3px;
    font-size: 8.5px; line-height: 1.3; background: rgba(0,0,0,.62); color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stu-med-dim {
    position: absolute; inset-block-start: 2px; inset-inline-end: 2px;
    font-family: var(--aw-font-mono); font-size: 8px; padding: 0 3px; border-radius: 2px;
    background: rgba(0,0,0,.55); color: #fff; direction: ltr; unicode-bidi: isolate;
}
.stu-med-foot { display: flex; align-items: center; gap: 5px; }
.stu-med-foot .stu-btn { padding: 2px 9px; }
.stu-med-up {
    display: block; text-align: center; padding: 5px; font-size: 11.5px; cursor: pointer;
    border: 1px dashed var(--aw-border-mid); border-radius: var(--aw-radius-sm);
    color: var(--aw-text-muted);
}
.stu-med-up:hover { border-color: var(--aw-primary); color: var(--aw-primary-dark); }
