/* Layout: home = upload hero + template shelf; editor = top bar / toolbars / thumbs | pages | form panel */
:root {
  --ink: #0e1b33;
  --ink-2: #33415c;
  --muted: #64708a;
  --paper: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #d9dfe9;
  --accent: #d7193f;
  --accent-ink: #ffffff;
  --accent-soft: #fde9ed;
  --navy: #13254b;
  --navy-2: #1d3466;
  --sel: #2f5bea;
  --sel-soft: #e6ecff;
  --ok: #138a52;
  --shadow: 0 1px 2px rgba(14, 27, 51, .06), 0 6px 20px rgba(14, 27, 51, .08);
  --radius: 10px;
  --font: "Plus Jakarta Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7ecf5; --ink-2: #c3cbdb; --muted: #8e99b1; --paper: #0f1626; --surface: #172138;
    --surface-2: #1c2842; --line: #2b3854; --accent: #ef3a5d; --accent-soft: #3a1823; --navy: #0b1530;
    --navy-2: #172a55; --sel: #6e8dff; --sel-soft: #22305a; --ok: #3ccf8a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e7ecf5; --ink-2: #c3cbdb; --muted: #8e99b1; --paper: #0f1626; --surface: #172138;
  --surface-2: #1c2842; --line: #2b3854; --accent: #ef3a5d; --accent-soft: #3a1823; --navy: #0b1530;
  --navy-2: #172a55; --sel: #6e8dff; --sel-soft: #22305a; --ok: #3ccf8a; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 26px; height: 26px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- home ---------- */
#home { min-height: 100%; display: flex; flex-direction: column; }
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(16px, 4vw, 40px); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--navy); position: relative; overflow: hidden; flex: none; }
.brand-mark::before { content: ""; position: absolute; left: 7px; top: 6px; width: 13px; height: 17px; background: #fff; border-radius: 2px; }
.brand-mark::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 11px; height: 11px; background: var(--accent); border-radius: 50%; }
.brand small { font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.home-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(20px, 5vw, 48px) clamp(16px, 4vw, 32px) 64px; display: flex; flex-direction: column; gap: 40px; }
.home-main h1 { font-size: clamp(28px, 5vw, 40px); letter-spacing: -.03em; margin: 0; text-align: center; text-wrap: balance; }
.drop { background: var(--navy); border-radius: 14px; padding: 12px; }
.drop-inner { border: 2px dashed rgba(255, 255, 255, .35); border-radius: 10px; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px 16px; color: #fff; text-align: center; }
.drop.over .drop-inner { border-color: #fff; background: rgba(255, 255, 255, .06); }
.drop-files { display: flex; gap: 6px; }
.drop-files span { width: 40px; height: 52px; border-radius: 4px; background: #fff; position: relative; opacity: .95; }
.drop-files span:nth-child(1) { transform: rotate(-8deg) translateY(4px); opacity: .55; }
.drop-files span:nth-child(3) { transform: rotate(8deg) translateY(4px); opacity: .55; }
.drop-files span:nth-child(2)::after { content: "PDF"; position: absolute; left: 4px; right: 4px; bottom: 7px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; text-align: center; border-radius: 2px; padding: 1px 0; }
.choose { display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; background: #fff; color: #0e1b33; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.choose button { border: 0; background: transparent; padding: 0 22px; height: 54px; font-weight: 800; letter-spacing: .03em; display: flex; align-items: center; gap: 10px; color: #0e1b33; }
.choose button + button { border-left: 1px solid #e3e7ef; padding: 0 16px; }
.choose button:hover { background: #f2f4f8; }
.drop-hint { font-size: 14px; opacity: .8; }
.drop-menu { position: relative; }
.privacy { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: center; color: var(--muted); font-size: 13px; }
.privacy span { display: inline-flex; align-items: center; gap: 6px; }
.privacy .ic { color: var(--ok); }

.shelf-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.shelf-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.shelf-head p { margin: 4px 0 0; color: var(--muted); }
.shelf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0; transition: transform .12s, box-shadow .12s; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--muted); }
.tcard .thumb { aspect-ratio: 3 / 3.4; background: var(--surface-2); display: flex; align-items: flex-start; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--line); padding: 12px 12px 0; }
.tcard .thumb canvas { width: 100%; height: auto; box-shadow: 0 1px 6px rgba(0, 0, 0, .15); background: #fff; }
.tcard .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.tcard .meta b { font-size: 14px; }
.tcard .meta small { color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--sel-soft); color: var(--sel); width: max-content; letter-spacing: .02em; }
.chip.team { background: var(--accent-soft); color: var(--accent); }
.tcard-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tdel { border: 0; background: transparent; color: var(--muted); padding: 4px; border-radius: 6px; }
.tdel:hover { color: var(--accent); background: var(--accent-soft); }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; color: var(--muted); background: var(--surface); line-height: 1.6; }
.empty b { color: var(--ink); }

/* ---------- editor ---------- */
#editor { height: 100%; display: flex; flex-direction: column; background: var(--paper); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px; }
.fname { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 260px; }
.fname input { border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 6px; font-weight: 600; min-width: 0; width: 100%; text-overflow: ellipsis; }
.fname input:hover, .fname input:focus { border-color: var(--line); background: var(--surface-2); }
.tabs { display: flex; gap: 6px; margin: 0 auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 99px; border: 0; background: var(--surface-2); font-weight: 700; color: var(--ink); white-space: nowrap; }
.tab:hover { background: var(--line); }
.tab.on { background: var(--navy); color: #fff; }
.top-right { display: flex; align-items: center; gap: 6px; }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: 8px 0 0 8px; }
.split .btn:last-child { border-radius: 0 8px 8px 0; border-left: 1px solid rgba(255, 255, 255, .3); width: 34px; padding: 0; }

.toolrow { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.toolrow .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; flex: none; }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 11px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; font-weight: 600; white-space: nowrap; flex: none; color: var(--ink); }
.tool:hover { border-color: var(--muted); }
.tool.on { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); }
.tool.mini { padding: 0 9px; }
.tool .caret { margin-left: -2px; margin-right: -4px; padding: 0 2px; display: inline-flex; height: 100%; align-items: center; }
.tool.toggle.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.glyph { font-weight: 800; font-size: 16px; width: 18px; text-align: center; line-height: 1; }

.propbar-wrap { display: flex; justify-content: center; padding: 8px 12px 0; pointer-events: none; position: absolute; left: 0; right: 0; z-index: 20; }
.propbar { pointer-events: auto; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px 6px; max-width: 100%; overflow-x: auto; }
.propbar .grp { display: flex; align-items: center; gap: 4px; padding: 0 6px; border-right: 1px solid var(--line); flex: none; }
.propbar .grp:last-child { border-right: 0; }
.propbar label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.propbar select, .propbar input[type=number] { height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 6px; }
.propbar input[type=number] { width: 58px; font-variant-numeric: tabular-nums; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); padding: 0; overflow: hidden; position: relative; background: var(--surface); flex: none; }
.swatch input { position: absolute; inset: -6px; width: 44px; height: 44px; border: 0; padding: 0; cursor: pointer; opacity: 0; }
.swatch i { position: absolute; inset: 4px; border-radius: 50%; }
.swatch.none i { background: linear-gradient(135deg, transparent 45%, var(--accent) 45%, var(--accent) 55%, transparent 55%), var(--surface); border: 1px solid var(--line); }
.pb { height: 32px; min-width: 32px; padding: 0 7px; border-radius: 6px; border: 1px solid transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ink); }
.pb:hover { background: var(--surface-2); }
.pb.on { background: var(--sel-soft); color: var(--sel); }
.pb.danger:hover { background: var(--accent-soft); color: var(--accent); }
.nonebtn { font-size: 11px; font-weight: 700; color: var(--muted); }

.work { flex: 1; display: flex; min-height: 0; position: relative; }
.side { width: 168px; flex: none; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 10px 30px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.th { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.th.cur { border-color: var(--sel); background: var(--sel-soft); }
.th canvas { width: 118px; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); display: block; }
.th .tn { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.th .tacts { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); display: none; gap: 2px; background: var(--surface); border-radius: 7px; box-shadow: var(--shadow); padding: 2px; }
.th:hover .tacts { display: flex; }
.th .tacts button { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 5px; display: grid; place-items: center; color: var(--ink-2); }
.th .tacts button:hover { background: var(--surface-2); }
.th.drag-over { border-color: var(--accent); border-style: dashed; }
.addpg { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--sel-soft); color: var(--sel); display: grid; place-items: center; margin: 2px 0 6px; }
.addpg:hover { background: var(--sel); color: #fff; }

.viewer { flex: 1; overflow: auto; position: relative; padding: 64px 24px 90px; display: flex; flex-direction: column; align-items: center; gap: 22px; min-width: 0; }
.viewer.pan, .viewer.pan * { cursor: grab !important; }
.pwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.page { position: relative; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 4px 16px rgba(14, 27, 51, .1); }
.page.cur { box-shadow: 0 0 0 2px var(--sel), 0 4px 16px rgba(14, 27, 51, .1); }
.layer { position: absolute; left: 0; top: 0; }
.layer .bg { position: absolute; left: 0; top: 0; }
.layer .canvas-container { position: absolute !important; left: 0; top: 0; }
.plabel { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.croptag { position: absolute; top: 6px; left: 6px; background: var(--navy); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; pointer-events: none; opacity: .8; }

.pager { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; z-index: 15; }
.pager .pb { font-weight: 600; }
.pager .num { font-variant-numeric: tabular-nums; padding: 0 8px; white-space: nowrap; }
.pager .zv { min-width: 56px; font-variant-numeric: tabular-nums; }
.pager .vsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.panel { width: 320px; flex: none; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.panel-foot .btn { flex: 1; }
.pg-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin-top: 4px; }
.fld { display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 8px; border: 1px solid transparent; }
.fld.cur { border-color: var(--sel); background: var(--sel-soft); }
.fld > label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; }
.fld input[type=text], .fld input[type=date], .fld textarea, .fld select, .inp { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 8px 10px; min-height: 38px; }
.fld textarea { resize: vertical; min-height: 60px; }
.fld .row { display: flex; gap: 6px; align-items: center; }
.fld .row > * { min-width: 0; }
.fld .chk { justify-content: flex-start; display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.fld .chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.bfield { border: 1px solid var(--line); border-radius: 9px; padding: 10px; display: flex; flex-direction: column; gap: 7px; background: var(--surface-2); }
.bfield.cur { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.bfield .row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bfield .inp { min-height: 34px; padding: 6px 8px; font-size: 13px; }
.bfield .top { display: flex; gap: 6px; align-items: center; }
.bfield .top .inp { font-weight: 700; }
.mini-label { font-size: 11px; color: var(--muted); font-weight: 700; }
.tokens { display: flex; flex-wrap: wrap; gap: 4px; }
.tokens button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; font-size: 11px; padding: 2px 8px; font-family: var(--mono); }
.tokens button:hover { border-color: var(--sel); color: var(--sel); }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.55; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.note b { color: var(--ink); }

/* organize */
.org { flex: 1; overflow: auto; padding: 24px; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; max-width: 1200px; margin: 0 auto; }
.ocard { background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; cursor: grab; }
.ocard.sel { border-color: var(--sel); background: var(--sel-soft); }
.ocard.drag-over { border-color: var(--accent); border-style: dashed; }
.ocard .cv { height: 190px; display: flex; align-items: center; justify-content: center; }
.ocard canvas { max-width: 140px; max-height: 190px; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .18); }
.ocard .ck { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; accent-color: var(--sel); }
.ocard .acts { display: flex; gap: 2px; }
.ocard .acts button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-2); }
.ocard .acts button:hover { background: var(--surface-2); }
.ocard .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* menus, modal, toast */
.menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 200px; display: flex; flex-direction: column; }
.menu button { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 7px; text-align: left; font-weight: 600; color: var(--ink); }
.menu button:hover { background: var(--surface-2); }
.menu button.on { color: var(--sel); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.scrim { position: fixed; inset: 0; background: rgba(9, 16, 32, .5); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100% - 24px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal.wide { max-width: 640px; }
.modal-head { padding: 16px 18px 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.f { display: flex; flex-direction: column; gap: 5px; }
.f > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 9px; }
.segs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px; font-weight: 700; color: var(--muted); }
.segs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.sigpad { width: 100%; height: 190px; border: 1px dashed var(--muted); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.siglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.sigitem { position: relative; border: 1px solid var(--line); border-radius: 9px; background: #fff; height: 74px; display: flex; align-items: center; justify-content: center; padding: 6px; cursor: pointer; }
.sigitem:hover { border-color: var(--sel); }
.sigitem img { max-height: 100%; max-width: 100%; }
.sigitem .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #eef1f6; color: #33415c; display: grid; place-items: center; }
.colors { display: flex; gap: 6px; }
.colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.colors button.on { border-color: var(--sel); }
.typed-prev { height: 90px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; font-family: "Dancing Script", cursive; font-size: 44px; color: #0b1f6b; overflow: hidden; white-space: nowrap; }
.cropbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 25; background: var(--navy); color: #fff; border-radius: 10px; padding: 8px; display: flex; gap: 6px; align-items: center; box-shadow: var(--shadow); flex-wrap: wrap; justify-content: center; }
.cropbar span { padding: 0 6px; font-weight: 600; }
.placing { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 25; background: var(--navy); color: #fff; border-radius: 99px; padding: 7px 8px 7px 16px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); font-weight: 600; }
.placing img { height: 26px; background: #fff; border-radius: 4px; padding: 1px 4px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 90; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.busy { position: fixed; inset: 0; z-index: 95; background: rgba(9, 16, 32, .35); display: flex; align-items: center; justify-content: center; }
.busy div { background: var(--surface); padding: 16px 22px; border-radius: 12px; font-weight: 700; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 3s !important; } }

.mobile-only { display: none !important; }
.tab .ts { display: none; }
@media (max-width: 1100px) { .tab .tl { display: none; } .tab { padding: 0 12px; } }
@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .desk-only { display: none !important; }
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .tab { flex: 1; justify-content: center; height: 36px; padding: 0 6px; gap: 6px; }
  .tab .ts { display: inline; font-size: 12.5px; }
  .tab .ic { width: 16px; height: 16px; }
  .fname { flex: 1 1 0; min-width: 40px; }
  .top-right { gap: 2px; }
  .top-right .btn.icon { width: 34px; }
  .toolrow { justify-content: flex-start; padding: 6px 8px; }
  .side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 30; box-shadow: var(--shadow); }
  .viewer { padding: 60px 8px 90px; }
  .panel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 62%; z-index: 40; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); }
  .pager { bottom: 10px; }
  .pager .desk-zoom { display: none; }
  .split .btn:first-child span { display: none; }
}
@media (max-width: 480px) { .f2 { grid-template-columns: 1fr; } .choose button { padding: 0 16px; } }
