/* Thư viện DTU Online — giao diện "thẻ thư viện": giấy ngà, mực đậm, đỏ đô Duy Tân, gỗ ấm */
:root {
  --paper: #fbf9f5; --paper-2: #f2ede5; --paper-3: #e9e2d7;
  --ink: #1d1916; --ink-2: #5b524a; --ink-3: #8a8077;
  --line: #e0d8cc; --maroon: #8c1d2f; --maroon-2: #6c1222; --maroon-soft: #f5e6e8;
  --wood: #b07a46; --gold: #b8924f; --ok: #2f7d4f; --warn: #b5651d; --blue: #2c40a3;
  --glass: rgba(251, 249, 245, .94);
  --f-ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px; --shadow: 0 10px 30px rgba(40, 24, 16, .18), 0 1px 0 rgba(255,255,255,.6) inset;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: #e9eef1; color: var(--ink); font: 14px/1.45 var(--f-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; }
#app { position: fixed; inset: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- Màn hình chờ & đăng nhập ---------- */
.screen { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; overflow: auto;
  padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#loading { background: var(--paper); }
.loader { display: grid; gap: 14px; justify-items: center; text-align: center; }
.loader .crest { width: 64px; height: 64px; border: 3px solid var(--maroon); border-radius: 6px; display: grid; place-items: center; color: var(--maroon); font: 800 18px var(--f-ui); letter-spacing: .06em; }
.loader .bar { width: 220px; height: 3px; background: var(--paper-3); overflow: hidden; border-radius: 2px; }
.loader .bar i { display: block; width: 40%; height: 100%; background: var(--maroon); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.loader p { margin: 0; color: var(--ink-2); }

#auth { background: radial-gradient(1200px 700px at 80% 0%, rgba(176,122,70,.20), transparent 60%), linear-gradient(180deg, rgba(29,25,22,.55), rgba(29,25,22,.72)); backdrop-filter: blur(3px); }
.auth-wrap { width: min(1040px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; align-items: start; }
.auth-brand { color: #fff; padding-top: 18px; min-width: 0; }
.eyebrow { font: 600 11px/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; }
.auth-brand .eyebrow { color: #e8c99a; }
.auth-brand h1 { font: 800 clamp(34px, 5vw, 58px)/1.02 var(--f-ui); letter-spacing: -.02em; margin: 14px 0 14px; text-wrap: balance; }
.auth-brand h1 em { font-style: normal; color: #f1d3a3; }
.auth-brand p { max-width: 46ch; color: rgba(255,255,255,.82); margin: 0 0 22px; font-size: 15px; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; max-width: 460px; border-top: 1px solid rgba(255,255,255,.18); }
.rules li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.9); }
.rules b { font: 600 13px var(--f-mono); color: #f1d3a3; font-variant-numeric: tabular-nums; }

.auth-card { background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--maroon); color: #fff; }
.card-head .eyebrow { color: rgba(255,255,255,.75); }
.card-head strong { font: 700 15px var(--f-ui); }
.card-no { font: 500 12px var(--f-mono); color: rgba(255,255,255,.8); }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 12px 10px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--maroon); border-bottom-color: var(--maroon); background: var(--paper); }
.form { padding: 18px; display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.field input:focus, .field select:focus { border-color: var(--maroon); outline: none; box-shadow: 0 0 0 3px var(--maroon-soft); }
.field small { color: var(--ink-3); font-size: 11.5px; }
.form-error { color: #b42318; font-weight: 600; margin: 0; min-height: 1.2em; font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 14px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.btn.primary:hover { background: var(--maroon-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Dựng nhân vật ---------- */
.builder { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: start; }
.preview { position: relative; background: linear-gradient(180deg, #efe8dd, #e2d7c6); border-radius: 10px; aspect-ratio: 3/4; overflow: hidden; max-width: 100%; }
.preview canvas { width: 100%; height: 100%; display: block; }
.preview .turn { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--ink-2); }
.opts { display: grid; gap: 10px; max-height: 420px; overflow: auto; padding-right: 4px; min-width: 0; }
.opt h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--maroon); }
.outfit-card { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.outfit-card .chip { border-radius: 8px; text-align: left; display: flex; align-items: center; gap: 8px; }
.outfit-card .dot { width: 18px; height: 18px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.me-card { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: calc(12px + env(safe-area-inset-left, 0px)); background: var(--glass); border-radius: 12px; box-shadow: var(--shadow); width: 272px; overflow: hidden; }
.me-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.me-badge { width: 36px; height: 36px; border-radius: 8px; background: var(--maroon); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.me-name { font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font: 500 11.5px var(--f-mono); color: var(--ink-3); }
.me-pts { margin-left: auto; text-align: right; }
.me-pts b { display: block; font: 800 22px/1 var(--f-ui); color: var(--maroon); font-variant-numeric: tabular-nums; }
.me-pts span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.me-meta { display: flex; gap: 0; border-top: 1px solid var(--line); font-size: 12px; }
.me-meta div { flex: 1; padding: 6px 10px; border-right: 1px solid var(--line); color: var(--ink-2); }
.me-meta div:last-child { border-right: 0; }
.me-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }

.top-right { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); display: grid; gap: 8px; justify-items: end; }
.stats { display: flex; gap: 6px; }
.pill { background: var(--glass); border-radius: 999px; padding: 6px 11px; box-shadow: var(--shadow); font-size: 12.5px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill.full .dot { background: #c0392b; }
.map-wrap { background: var(--glass); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; }
#minimap { display: block; width: 156px; height: 180px; cursor: crosshair; border-radius: 4px; }
.map-wrap .cap { font-size: 10.5px; color: var(--ink-3); display: flex; justify-content: space-between; margin-top: 4px; }

.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 4px; background: var(--glass); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); }
.dock button { border: 0; background: transparent; border-radius: 10px; padding: 7px 11px; display: grid; justify-items: center; gap: 2px; min-width: 64px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.dock button .ic { font-size: 19px; line-height: 1; }
.dock button:hover, .dock button[aria-pressed="true"] { background: var(--paper-3); color: var(--ink); }
.dock .badge { position: absolute; }

#context { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.ctx { background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 600; box-shadow: var(--shadow); display: inline-flex; gap: 8px; align-items: center; }
.ctx kbd { font: 600 11px var(--f-mono); background: rgba(255,255,255,.18); border-radius: 4px; padding: 2px 6px; }

#activity { position: absolute; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--glass); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 8px; width: min(440px, calc(100vw - 600px)); min-width: 300px; }
.act-row { display: flex; align-items: center; gap: 10px; }
.act-title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-time { font: 600 13px var(--f-mono); color: var(--maroon); font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: var(--paper-3); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--wood), var(--maroon)); width: 0; transition: width .5s linear; }
.act-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.paused { color: var(--warn); font-weight: 600; font-size: 12px; }

/* Chat */
#chat { position: absolute; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 340px; background: var(--glass); border-radius: 12px; box-shadow: var(--shadow); display: grid; grid-template-rows: auto 1fr auto; height: 300px; overflow: hidden; }
#chat.min { height: auto; grid-template-rows: auto; }
#chat.min .chat-log, #chat.min .chat-form { display: none; }
.chat-tabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; align-items: center; }
.chat-tabs button.tab { border: 0; background: transparent; border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; position: relative; }
.chat-tabs button.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.chat-tabs .unread { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px; background: var(--maroon); color: #fff; border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center; }
.chat-tabs .toggle { margin-left: auto; border: 0; background: transparent; color: var(--ink-3); padding: 2px 6px; }
.chat-log { overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; min-height: 0; }
.msg { overflow-wrap: anywhere; }
.msg .who { font-weight: 700; color: var(--maroon); cursor: pointer; }
.msg .who.me { color: var(--blue); }
.msg time { color: var(--ink-3); font: 500 10.5px var(--f-mono); margin-right: 4px; }
.msg.sys { color: var(--ink-2); font-style: italic; font-size: 12px; }
.chat-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }

/* Bảng chức năng */
.panel { position: absolute; z-index: 20; right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: min(420px, calc(100vw - 24px)); background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 800 18px/1.15 var(--f-ui); text-wrap: balance; }
.panel-head .eyebrow { color: var(--maroon); margin-bottom: 4px; }
.panel-head .x { margin-left: auto; border: 0; background: var(--paper-2); width: 32px; height: 32px; border-radius: 8px; font-size: 18px; line-height: 1; flex: none; }
.panel-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.panel-tabs button { border: 0; background: transparent; padding: 8px 10px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.panel-tabs button[aria-selected="true"] { color: var(--maroon); border-bottom-color: var(--maroon); }
.panel-body { overflow-y: auto; padding: 12px 16px 18px; min-height: 0; }
.list { display: grid; gap: 0; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item .code { font: 600 11px var(--f-mono); color: var(--gold); background: #1d1916; border-radius: 4px; padding: 3px 6px; min-width: 48px; text-align: center; }
.item .t { font-weight: 600; line-height: 1.3; min-width: 0; }
.item .s { font-size: 12px; color: var(--ink-3); }
.item .ic { font-size: 22px; width: 32px; text-align: center; }
.note { background: var(--paper-2); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 12.5px; margin: 8px 0 12px; }
.note b { color: var(--ink); }
.greet { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.greet .av { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.greet .bub { background: var(--paper-2); border-radius: 4px 12px 12px 12px; padding: 9px 12px; }
.hist { font-variant-numeric: tabular-nums; }
.hist .plus { color: var(--ok); font-weight: 700; }
.hist .minus { color: #b42318; font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.big-actions .btn { padding: 12px; flex-direction: column; gap: 3px; white-space: normal; text-align: center; }
.big-actions .btn small { font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.big-actions .btn.primary small { color: rgba(255,255,255,.75); }
.empty { color: var(--ink-3); padding: 18px 0; text-align: center; }
.help h3 { font-size: 13px; margin: 16px 0 6px; letter-spacing: .06em; text-transform: uppercase; color: var(--maroon); }
.help table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.help td:last-child { text-align: right; font: 600 12.5px var(--f-mono); white-space: nowrap; padding-left: 10px; }

/* Hộp thoại & thông báo */
#modal { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(29,25,22,.45); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.dialog { background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; width: min(400px, 100%); display: grid; gap: 12px; text-align: center; }
.dialog h3 { margin: 0; font: 800 20px var(--f-ui); }
.dialog p { margin: 0; color: var(--ink-2); }
.dialog .stamp { justify-self: center; font: 800 34px var(--f-ui); color: var(--maroon); border: 3px solid var(--maroon); border-radius: 10px; padding: 4px 14px; transform: rotate(-4deg); }
#toasts { position: absolute; z-index: 50; top: calc(70px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(460px, 92vw); }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; font-size: 13px; animation: pop .25s ease-out; max-width: 100%; }
.toast.ok { background: var(--ok); }
.toast.warn { background: var(--warn); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
#net-status { position: absolute; z-index: 45; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); right: 12px; background: var(--warn); color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.demo-tag { position: absolute; z-index: 11; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); font-size: 11px; color: var(--ink-2); background: rgba(251,249,245,.8); padding: 3px 10px; border-radius: 999px; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Màn hình hẹp ---------- */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding-top: 0; }
  .auth-brand p, .rules { display: none; }
  #activity { width: calc(100vw - 24px); min-width: 0; top: auto; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .builder { grid-template-columns: 1fr; }
  .preview { aspect-ratio: 4/3; max-height: 220px; }
  .row2 { grid-template-columns: 1fr; }
  .me-card { width: calc(100vw - 150px); }
  .me-meta { display: none; }
  #minimap { width: 104px; height: 120px; }
  .map-wrap .cap { display: none; }
  .stats { flex-direction: column; align-items: flex-end; }
  .dock { left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); transform: none; justify-content: space-between; }
  .dock button { min-width: 0; padding: 6px 4px; flex: 1; }
  .dock button .lb { font-size: 10px; }
  #chat { width: calc(100vw - 24px); height: 220px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  #context { bottom: calc(320px + env(safe-area-inset-bottom, 0px)); }
  #chat.min ~ #context { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
  .panel { left: 8px; right: 8px; width: auto; top: calc(8px + env(safe-area-inset-top, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Phiên bản 2: vai trò, tài khoản, thủ thư ---------- */
.lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 10px; font-weight: 600; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--maroon); color: #fff; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; min-width: 0; font-family: var(--f-mono); letter-spacing: .12em; }
.cred { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px dashed var(--maroon); border-radius: 10px; overflow: hidden; }
.cred > div { padding: 10px 8px; display: grid; gap: 4px; background: var(--maroon-soft); }
.cred > div + div { border-left: 2px dashed var(--maroon); }
.cred span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.cred b { font: 700 26px/1.1 var(--f-mono); letter-spacing: .12em; color: var(--maroon); user-select: all; }
.check { display: flex; gap: 8px; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; cursor: pointer; }
.form .check { justify-content: flex-start; }
.check input { width: 18px; height: 18px; accent-color: var(--maroon); }
.lib-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.lib-chip { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 10px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; font-weight: 700; }
.lib-chip small { grid-column: 2; font-weight: 500; font-size: 11.5px; color: var(--ink-3); }
.lib-chip .st { grid-row: span 2; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.lib-chip .st.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(47,125,79,.18); }
.lib-chip[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(44,64,163,.18); }
.pending { border: 1px solid #e8c99a; background: #fbf3e6; border-radius: 9px; padding: 8px 10px; margin-bottom: 10px; display: grid; gap: 4px; }
.pending .eyebrow { color: var(--warn); }
.prow { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.prow span { min-width: 0; overflow-wrap: anywhere; }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; margin-bottom: 8px; background: #fff; }
.req-top { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.req-what { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 600; }
.req-warn { color: #b42318; font-size: 12.5px; font-weight: 600; }
.req-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; color: #fff; background: var(--blue); }
.tag.return { background: var(--ok); } .tag.buy { background: var(--gold); }
.req .code, .req-what .code { font: 600 11px var(--f-mono); color: var(--gold); background: #1d1916; border-radius: 4px; padding: 3px 6px; }
.admin-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.admin-bar input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.filters { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.cat-row { grid-template-columns: auto 1fr auto; }
.cat-row input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fff; font-weight: 600; }
.panel-body textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; font: 12.5px/1.4 var(--f-mono); resize: vertical; }
.panel-body code { font: 12px var(--f-mono); background: var(--paper-3); padding: 1px 4px; border-radius: 4px; }
.errs { margin: 4px 0 0; padding-left: 18px; color: #b42318; font-size: 12.5px; }
.rb { display: inline-block; font: 700 9.5px/1 var(--f-ui); letter-spacing: .04em; color: #fff; padding: 3px 4px; border-radius: 3px; margin-right: 4px; vertical-align: 1px; }
.rb.lib { background: var(--blue); } .rb.lec { background: var(--gold); }
.dock button { position: relative; }
.dock-badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--maroon); color: #fff; font: 700 11px/18px var(--f-ui); text-align: center; }
@media (max-width: 640px) {
  .filters { grid-template-columns: 1fr; }
  .lib-pick { grid-template-columns: 1fr; }
  .cred b { font-size: 21px; }
}
@media (max-width: 640px) { .demo-tag { display: none; } }
