/* =====================================================================
   Admin tools styling (only visible after an admin logs in)
   ===================================================================== */
.admin-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 20px); padding: 8px 10px; background: #1d0d12; color: #fff; border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; box-shadow: 0 14px 40px rgba(0, 0, 0, .45); overflow-x: auto; scrollbar-width: none; }
.admin-bar::-webkit-scrollbar { display: none; }
.ab-user { display: flex; flex-direction: column; line-height: 1.1; padding: 0 10px 0 6px; flex: none; border-right: 1px solid rgba(255, 255, 255, .2); margin-right: 4px; }
.ab-user b { font-size: .92rem; } .ab-user small { color: var(--gold); font-size: .72rem; }
.ab { flex: none; border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .06); color: #fff; font: 700 .86rem/1 var(--font-body); padding: 9px 13px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.ab:hover { background: rgba(255, 255, 255, .16); }
.ab:disabled { opacity: .35; cursor: default; }
.ab.on, .ab.primary { background: var(--primary); border-color: var(--primary); }
.ab.attn { border-color: var(--gold); color: var(--gold); }
.ab.gold { background: var(--gold); border-color: var(--gold); color: #2a1500; }
.ab.ghost { background: transparent; }
.ab.danger { background: #a0121b; border-color: #a0121b; color: #fff; }
.ab.sm { padding: 7px 12px; font-size: .84rem; } .ab.ico { padding: 6px 9px; min-width: 32px; }
body.is-admin { padding-bottom: 84px; }
body.panel-open .admin-bar { left: calc(50% - 220px); max-width: calc(100vw - 460px); }
@media (max-width: 760px) { .admin-bar { bottom: 8px; border-radius: 14px; } body.panel-open .admin-bar { display: none; } }

/* inline editing */
body.editing { --edit: #1f8f55; }
body.editing .is-editable { outline: 1.5px dashed color-mix(in srgb, var(--edit) 70%, transparent); outline-offset: 3px; border-radius: 3px; cursor: text; min-width: 1ch; }
body.editing .is-editable:hover { outline-style: solid; }
body.editing .is-editable:focus { outline: 2px solid var(--edit); background: color-mix(in srgb, var(--edit) 10%, transparent); }
body.editing .is-editable:empty::before { content: "Click to type"; opacity: .5; }
.has-img-edit { position: relative; }
.img-edit-btn { position: absolute; z-index: 5; top: 8px; left: 8px; padding: 6px 12px; border-radius: 99px; background: #1f8f55; color: #fff; font: 700 .82rem var(--font-body); cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.poster-card.has-img-edit .img-edit-btn, .story-art.has-img-edit .img-edit-btn { top: 14px; left: 14px; }
.admin-link { cursor: pointer; }

/* side panel */
.admin-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 950; background: var(--surface); color: var(--text); box-shadow: -12px 0 40px rgba(0, 0, 0, .35); display: flex; flex-direction: column; border-left: 1px solid var(--line); font-size: .95rem; line-height: 1.45; }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--primary-dark); color: #fff; }
.ap-head h2 { margin: 0; font-size: 1.25rem; font-family: var(--font-head); color: #fff; }
.am-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.ap-body { flex: 1; overflow-y: auto; padding: 8px 14px 30px; }
.ap-foot { padding: 10px 16px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--tint); }
.grp { border-bottom: 1px solid var(--line); padding: 4px 0; }
.grp > summary { cursor: pointer; font: 700 1.02rem var(--font-body); padding: 12px 2px; list-style: revert; }
.fld { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; }
.fld > label, .list-h { font-weight: 700; font-size: .88rem; }
.fld small, .list-hint, .menu small, .theme small { color: var(--muted); font-size: .8rem; display: block; }
.fld input[type=text], .fld input[type=url], .fld input[type=number], .fld input[type=date], .fld textarea, .fld select, .admin-panel select, .admin-panel input[type=text], .am input[type=text], .am input[type=password], .am select, .am textarea, .am input[type=url] {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; }
.fld textarea, .am textarea { resize: vertical; min-height: 60px; }
.admin-panel input:focus, .admin-panel textarea:focus, .admin-panel select:focus, .am input:focus, .am textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.fld.chk, label.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; } label.chk input { width: 18px; height: 18px; flex: none; }
.img-row { display: flex; gap: 12px; align-items: flex-start; }
.thumb-box { width: 92px; height: 70px; flex: none; border-radius: 8px; background: var(--tint) repeating-linear-gradient(45deg, transparent 0 8px, rgba(0, 0, 0, .04) 8px 16px); border: 1.5px dashed var(--line); overflow: hidden; display: grid; place-items: center; }
.thumb { width: 100%; height: 100%; object-fit: cover; } .thumb:not([src]) { display: none; }
.img-ctl { flex: 1; min-width: 0; display: grid; gap: 6px; } .img-ctl > div { display: flex; gap: 6px; flex-wrap: wrap; }
.list { margin: 6px 0 18px; }
.list-h { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; } .n-badge { background: var(--tint); border-radius: 99px; padding: 0 9px; font-size: .78rem; font-weight: 700; }
.items { display: grid; gap: 6px; }
.item { border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); }
.item.dragging { opacity: .4; } .item.over { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.item > summary { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 6px; cursor: pointer; list-style: none; min-height: 46px; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary::after { content: "▾"; color: var(--muted); order: 5; }
.item[open] > summary::after { content: "▴"; }
.handle { cursor: grab; color: var(--muted); letter-spacing: -3px; padding: 0 4px; font-weight: 700; flex: none; user-select: none; }
.mini { width: 40px; height: 32px; object-fit: cover; border-radius: 5px; flex: none; }
.it-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ctl { display: inline-flex; gap: 3px; }
.admin-panel .ab, .am .ab { background: var(--tint); color: var(--text); border-color: var(--line); }
.admin-panel .ab:hover, .am .ab:hover { border-color: var(--accent); background: var(--tint); }
.admin-panel .ab.primary, .am .ab.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-panel .ab.gold, .am .ab.gold { background: var(--gold); color: #2a1500; border-color: var(--gold); }
.admin-panel .ab.danger, .am .ab.danger { background: #a0121b; color: #fff; border-color: #a0121b; }
.admin-panel .ab.ghost, .am .ab.ghost { background: transparent; }
.item-body { padding: 10px 12px 2px; border-top: 1px solid var(--line); }
.list-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; } .list-add select { width: auto; flex: 1; }
.list.gallery .items { grid-template-columns: 1fr; }
.presets { display: grid; gap: 6px; } .preset { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: 700 .9rem var(--font-body); cursor: pointer; text-align: left; } .preset:hover { border-color: var(--accent); }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); display: inline-block; }
.color-row { display: grid; grid-template-columns: 44px 1fr 92px; gap: 10px; align-items: center; margin-bottom: 8px; } .color-row input[type=color] { width: 44px; height: 36px; padding: 0; border: 1.5px solid var(--line); border-radius: 8px; background: none; cursor: pointer; } .cl { font-size: .9rem; }
.nav-row { display: flex; align-items: center; gap: 6px; padding: 6px; border: 1.5px solid var(--line); border-radius: 10px; flex-wrap: wrap; } .nav-row input[type=text] { flex: 1; min-width: 110px; } .tag { font-size: .72rem; background: var(--gold); color: #2a1500; padding: 1px 8px; border-radius: 99px; font-weight: 700; } .ico-gap { width: 32px; }
.add-page { display: flex; gap: 8px; }

/* modals */
.am-back { position: fixed; inset: 0; z-index: 1100; background: rgba(15, 4, 8, .7); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.am { width: min(520px, 100%); max-height: calc(100svh - 32px); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; font-size: .96rem; line-height: 1.5; }
.am.wide { width: min(860px, 100%); }
.am-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--primary-dark); color: #fff; } .am-head h2 { margin: 0; color: #fff; font-size: 1.35rem; }
.am-body { padding: 18px; overflow-y: auto; }
.am-form { display: grid; gap: 12px; } .am-form label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; } .am-form label.chk { display: flex; font-weight: 400; }
.am-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; } .am-actions.left { justify-content: flex-start; }
.am-err { color: #c4101c; min-height: 1.2em; margin: 0; font-weight: 700; } :root[data-mode="dark"] .am-err { color: #ff9a9a; }
.am-note { color: var(--muted); font-size: .86rem; margin: 6px 0; }
.empty { color: var(--muted); }
.chg section, .rq-sec { margin-bottom: 16px; } .chg h3, .rq h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; margin: 0 0 6px; color: var(--accent); }
.diff { list-style: none; display: grid; gap: 4px; margin: 6px 0; padding: 0; font-size: .88rem; }
.diff li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: var(--tint); }
.diff .k { flex: none; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: #e9a100; color: #2a1500; } .diff .add .k { background: #1f8f55; color: #fff; } .diff .del .k { background: #c4101c; color: #fff; }
.diff del { color: #b3261e; } .diff ins { color: #1a7f4b; text-decoration: none; font-weight: 700; } :root[data-mode="dark"] .diff del { color: #ff9a9a; } :root[data-mode="dark"] .diff ins { color: #7be0a8; }
.dthumb { height: 44px; border-radius: 6px; margin-left: auto; }
.rq { padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 14px; } .rq-note { font-style: italic; } .warn { background: #fff3cd; color: #5a4300; padding: 8px 10px; border-radius: 8px; font-size: .86rem; margin: 6px 0; }
.u-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); } .u-act { display: flex; gap: 6px; } .u-pw { display: flex; gap: 6px; width: 100%; }
.add-user { display: grid; gap: 8px; } .u-new { background: color-mix(in srgb, #1f8f55 14%, var(--bg)); border: 1.5px solid #1f8f55; border-radius: 10px; padding: 12px; margin-bottom: 14px; } .u-new pre { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 8px; user-select: all; }
.pub-steps { padding-left: 20px; display: grid; gap: 8px; }
.toast { z-index: 3000; } body.is-admin .toast { bottom: 90px; }
@media (max-width: 760px) { .admin-panel { width: 100vw; } .color-row { grid-template-columns: 44px 1fr; } .color-row input[type=text] { grid-column: 1 / -1; } }
