/* PDF Studio — light and dark themes share one set of tokens. */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --hover: #eceff3;
  --line: #e3e6eb;
  --line-2: #d3d7de;
  --text: #1d2330;
  --text-2: #5b6474;
  --text-3: #8a93a3;
  --accent: #0f8f82;
  --accent-2: #0b7a6f;
  --accent-soft: #e0f3f0;
  --accent-text: #0b6f65;
  --danger: #d9434b;
  --ok: #1f9d63;
  --stage: #e6e8ec;
  --shadow: 0 1px 2px rgba(20, 28, 40, .06), 0 4px 16px rgba(20, 28, 40, .06);
  --shadow-lg: 0 12px 40px rgba(20, 28, 40, .18);
  --tile-edit: #e7f0ff; --tile-edit-fg: #3867d6;
  --tile-convert: #fff1e4; --tile-convert-fg: #d9730d;
  --tile-organize: #f1ebff; --tile-organize-fg: #7c4ddb;
  --tile-optimize: #e0f3f0; --tile-optimize-fg: #0f8f82;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16181d;
  --surface: #1e2128;
  --surface-2: #23262e;
  --surface-3: #2a2e37;
  --hover: #2c3039;
  --line: #2f333c;
  --line-2: #3c414c;
  --text: #e8eaef;
  --text-2: #a4abb8;
  --text-3: #767e8c;
  --accent: #2bb3a3;
  --accent-2: #3cc4b4;
  --accent-soft: rgba(43, 179, 163, .16);
  --accent-text: #5fd3c4;
  --danger: #f06369;
  --ok: #3cc083;
  --stage: #111317;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, .55);
  --tile-edit: rgba(88, 140, 255, .16); --tile-edit-fg: #8fb0ff;
  --tile-convert: rgba(255, 153, 51, .15); --tile-convert-fg: #ffad5c;
  --tile-organize: rgba(160, 120, 255, .16); --tile-organize-fg: #bca0ff;
  --tile-optimize: rgba(43, 179, 163, .16); --tile-optimize-fg: #5fd3c4;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { padding: 0; width: 34px; height: 28px; border-radius: 8px; cursor: pointer; background: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type=color]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 5px; }
input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--accent); box-shadow: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); box-shadow: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.ic { display: block; flex: none; }
.view { display: none; height: 100%; }
.view.active { display: flex; }
.hidden { display: none !important; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--text-2); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.vsep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; display: inline-block; }
.brand-mark { display: inline-flex; }
.brand-mark.sm svg { width: 22px; height: 22px; }

/* ---------- Home ---------- */
#home { flex-direction: column; }
.appbar { height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-ver { font-size: 11.5px; color: var(--text-3); background: var(--surface-3); padding: 2px 7px; border-radius: 999px; }
.appbar-actions { display: flex; align-items: center; gap: 6px; }
.ghost-btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: var(--text-2); }
.ghost-btn:hover { background: var(--hover); color: var(--text); }
.home-scroll { flex: 1; overflow: auto; }
.home-inner { max-width: 1120px; margin: 0 auto; padding: 26px 32px 48px; }
.hero { display: flex; align-items: center; gap: 30px; background: var(--surface); border: 1.5px dashed var(--line-2); border-radius: 18px; padding: 30px 36px; box-shadow: var(--shadow); transition: border-color .15s, background .15s; }
.hero-copy { flex: 1; min-width: 0; }
.hero h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 700; }
.hero p { margin: 0 0 20px; color: var(--text-2); line-height: 1.55; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-open { display: inline-flex; align-items: center; gap: 9px; background: var(--accent); color: #fff; font-weight: 600; font-size: 14.5px; border-radius: 10px; height: 42px; padding: 0 20px; box-shadow: 0 2px 8px rgba(15, 143, 130, .3); transition: background .15s; }
.btn-open:hover { background: var(--accent-2); }
.btn-soft { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-3); color: var(--text); font-weight: 500; font-size: 14.5px; border-radius: 10px; height: 42px; padding: 0 18px; }
.btn-soft:hover { background: var(--hover); }
.hero-art { position: relative; width: 190px; height: 150px; flex: none; }
.sheet { position: absolute; width: 104px; height: 136px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.sheet.s3 { left: 70px; top: 10px; transform: rotate(9deg); background: var(--surface-3); }
.sheet.s2 { left: 44px; top: 6px; transform: rotate(3deg); background: var(--surface-2); }
.sheet.s1 { left: 20px; top: 4px; transform: rotate(-5deg); padding: 16px 14px; display: flex; flex-direction: column; gap: 7px; }
.sheet.s1 i { display: block; height: 5px; border-radius: 3px; background: var(--line-2); }
.sheet.s1 i.short { width: 60%; }
.sheet.s1 b { display: block; height: 16px; border-radius: 4px; background: var(--accent-soft); border: 1.5px solid var(--accent); }
.sheet.s1 u { display: block; height: 10px; width: 55%; margin-top: 4px; border-bottom: 2px solid var(--accent); border-radius: 0 0 40% 40%; }
.block { margin-top: 30px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.block-head h2 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.search { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; color: var(--text-3); width: 240px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; background: none; padding: 7px 0; flex: 1; min-width: 0; box-shadow: none !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chips button { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; font-weight: 500; }
.chips button:hover { color: var(--text); border-color: var(--line-2); }
.chips button.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; }
.tool-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card .label { font-size: 14px; font-weight: 600; line-height: 1.3; min-width: 0; }
.tool-card .sub { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-top: 2px; }
.tile { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.tile-edit { background: var(--tile-edit); color: var(--tile-edit-fg); }
.tile-convert { background: var(--tile-convert); color: var(--tile-convert-fg); }
.tile-organize { background: var(--tile-organize); color: var(--tile-organize-fg); }
.tile-optimize { background: var(--tile-optimize); color: var(--tile-optimize-fg); }
.tool-empty { grid-column: 1 / -1; padding: 26px; text-align: center; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.link-btn { color: var(--accent-text); font-size: 13px; font-weight: 500; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }
.recent-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recent-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) 170px 90px 36px; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.recent-item + .recent-item { border-top: 1px solid var(--line); }
.recent-item:hover { background: var(--surface-2); }
.recent-item .doc-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.recent-item .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .fdir { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .when, .recent-item .size { font-size: 12.5px; color: var(--text-2); }
.recent-item .size { text-align: right; }
.recent-item .rm { width: 30px; height: 30px; opacity: 0; }
.recent-item:hover .rm { opacity: 1; }
.recent-more { display: block; width: 100%; padding: 10px; border-top: 1px solid var(--line); color: var(--accent-text); font-weight: 500; font-size: 13px; }
.recent-more:hover { background: var(--surface-2); }
.recent-empty { padding: 30px; text-align: center; color: var(--text-3); }

/* ---------- Editor ---------- */
#editor { flex-direction: column; }
.ed-top { height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); gap: 10px; }
.ed-top-left, .ed-top-right { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.ed-top-mid { display: flex; gap: 2px; background: var(--surface-3); border-radius: 10px; padding: 2px; }
.ed-top-mid .icon-btn { width: 32px; height: 30px; }
.ed-top-right { justify-content: flex-end; }
.ed-top-left .brand-mark { margin: 0 4px 0 2px; }
.ed-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-title .dirty { color: var(--accent); margin-left: 6px; font-size: 10px; vertical-align: 2px; }
.btn-quiet { padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; }
.btn-quiet:hover { background: var(--hover); color: var(--text); }
.btn-save { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff; font-weight: 600; padding: 0 16px; height: 34px; border-radius: 9px; margin-left: 2px; }
.btn-save:hover { background: var(--accent-2); }
.ed-body { flex: 1; min-height: 0; display: flex; }
.rail { width: 64px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.rail-sep { width: 28px; height: 1px; background: var(--line); margin: 6px 0; flex: none; }
.tool { width: 54px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px; border-radius: 10px; color: var(--text-2); flex: none; }
.tool em { font-style: normal; font-size: 10.5px; font-weight: 500; }
.tool:hover { background: var(--hover); color: var(--text); }
.tool.active { background: var(--accent-soft); color: var(--accent-text); }
.thumbs-pane { width: 184px; flex: none; background: var(--surface-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.thumbs-pane.collapsed { display: none; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.pane-count { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 8px; letter-spacing: 0; font-weight: 600; }
.thumbs-actions { display: flex; justify-content: space-around; padding: 6px 4px; border-top: 1px solid var(--line); background: var(--surface); }
.thumbs-actions .icon-btn { width: 30px; height: 30px; }
.thumbs { flex: 1; overflow: auto; padding: 10px 0 24px; }
.thumb { margin: 0 auto 14px; width: 140px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 8px 0 6px; border-radius: 10px; }
.thumb:hover { background: var(--hover); }
.thumb .tc { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); outline: 2px solid transparent; outline-offset: 3px; border-radius: 2px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb .tc canvas { display: block; }
.thumb.active { background: var(--accent-soft); }
.thumb.active .tc { outline-color: var(--accent); }
.thumb span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.thumb.active span { color: var(--accent-text); }
.thumb.drag-over-before .tc { box-shadow: 0 -4px 0 var(--accent); }
.thumb.drag-over-after .tc { box-shadow: 0 4px 0 var(--accent); }
.stage { flex: 1; min-width: 0; position: relative; display: flex; }
.viewer { flex: 1; min-width: 0; overflow: auto; background: var(--stage); position: relative; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 24px 40px 90px; min-width: min-content; }
.page-wrap { position: relative; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 6px 20px rgba(0,0,0,.10); background: #fff; border-radius: 2px; }
.dock { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 5; }
.dock .icon-btn { width: 30px; height: 30px; }
#zoom-select { width: 100px; padding: 4px 6px; border-color: transparent; background: var(--surface-3); }
.page-ind { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; padding-right: 6px; white-space: nowrap; }
.page-ind input { width: 48px; padding: 3px 6px; text-align: center; background: var(--surface-3); border-color: transparent; }
.page-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; }
.page-inner canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.overlay { position: absolute; inset: 0; }
.viewer[data-tool="text"] .overlay { cursor: text; }
.viewer[data-tool="rect"] .overlay, .viewer[data-tool="ellipse"] .overlay, .viewer[data-tool="line"] .overlay,
.viewer[data-tool="arrow"] .overlay, .viewer[data-tool="highlight"] .overlay, .viewer[data-tool="pen"] .overlay { cursor: crosshair; }
.viewer[data-tool="place"] .overlay { cursor: copy; }
.obj { position: absolute; }
.viewer[data-tool="select"] .obj { cursor: move; }
.obj svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.obj.highlight { mix-blend-mode: multiply; }
.obj img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.obj.text { white-space: pre; line-height: 1.25; padding: 0; outline: none; min-width: 4px; }
.obj.text.editing { cursor: text; user-select: text; -webkit-user-select: text; outline: 1px dashed var(--accent); outline-offset: 2px; }
.obj.text:empty::before { content: '\200b'; }
.sel-box { position: absolute; border: 1px solid var(--accent); pointer-events: none; }
.sel-box.multi { border-style: dashed; }
.handle { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fff; border: 1.5px solid var(--accent); border-radius: 2px; pointer-events: auto; z-index: 3; }
.handle.nw, .handle.se { cursor: nwse-resize; }
.handle.ne, .handle.sw { cursor: nesw-resize; }
.handle.n, .handle.s { cursor: ns-resize; }
.handle.e, .handle.w { cursor: ew-resize; }
.handle.pt { border-radius: 50%; cursor: move; }
.draft { position: absolute; pointer-events: none; }
.marquee { position: absolute; border: 1px dashed var(--accent); background: var(--accent-soft); pointer-events: none; }
.page-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 12px; }

/* ---------- Properties panel ---------- */
.props { width: 264px; flex: none; background: var(--surface); border-left: 1px solid var(--line); overflow: auto; padding: 16px 16px 30px; }
.props h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 0 0 12px; font-weight: 650; }
.props h3 ~ h3 { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.prop { margin-bottom: 14px; }
.prop > label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.prop-row { display: flex; align-items: center; gap: 8px; }
.prop-row select { flex: 1; min-width: 0; }
.prop-row input[type=number] { width: 70px; }
.prop-row input[type=range] { flex: 1; }
.prop .val { font-size: 12px; color: var(--text-2); width: 38px; text-align: right; }
.kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 6px 0; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-row .k { color: var(--text-3); }
.kv-row .v { text-align: right; word-break: break-all; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { width: 36px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--text-2); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.swatch.none { background: linear-gradient(135deg, #fff 44%, #d9434b 44%, #d9434b 56%, #fff 56%); }
.swatch:hover { transform: scale(1.15); }
.props .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.props .hint { font-size: 12.5px; color: var(--text-3); line-height: 1.55; margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-2); padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.sig-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.sig-item { position: relative; background: #fff; border-radius: 10px; height: 58px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1.5px solid var(--line); }
.sig-item:hover { border-color: var(--accent); }
.sig-item img { max-width: 90%; max-height: 46px; }
.sig-item .del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); color: var(--surface); display: none; align-items: center; justify-content: center; }
.sig-item:hover .del { display: flex; }

/* ---------- Modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; min-width: 440px; max-width: 760px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px 22px; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 8px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; }
.modal-foot .btn { min-width: 84px; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field input[type=text], .field input[type=number], .field select, .field textarea { width: 100%; }
.field .row input[type=number] { width: 90px; }
.radio-list label { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 6px; line-height: 1.4; cursor: pointer; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.radio-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-list small { display: block; color: var(--text-3); }
.file-list { border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow: auto; min-height: 60px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.file-item:last-child { border-bottom: 0; }
.file-item .fn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fs { color: var(--text-3); font-size: 12px; }
.file-empty { padding: 18px; text-align: center; color: var(--text-3); }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; border-radius: 3px; }
.progress-text { font-size: 13px; color: var(--text-2); }
.sig-tabs { display: inline-flex; gap: 2px; margin-bottom: 14px; background: var(--surface-3); padding: 3px; border-radius: 10px; }
.sig-tabs button { padding: 6px 14px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.sig-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.sig-pad { background: #fff; border: 1px solid var(--line-2); border-radius: 12px; width: 600px; height: 220px; display: block; cursor: crosshair; touch-action: none; }
.sig-typed { background: #fff; color: #111; border: 1px solid var(--line-2); border-radius: 12px; width: 600px; height: 220px; display: flex; align-items: center; justify-content: center; font-size: 64px; overflow: hidden; white-space: nowrap; }
.sig-opts { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; color: var(--text-2); }
.sig-opts .swatch { border-radius: 50%; }
.guide h3 { margin: 18px 0 6px; font-size: 14px; }
.guide h3:first-child { margin-top: 4px; }
.guide p, .guide li { color: var(--text-2); line-height: 1.6; }
.guide kbd { background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; font-size: 12px; color: var(--text); font-family: inherit; }
.pdf-pw { width: 100%; }

/* ---------- Toasts / overlays ---------- */
#toast-root { pointer-events: none; position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 14px; align-items: center; max-width: 620px; font-weight: 500; border-left: 4px solid transparent; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast a { color: var(--accent-2); cursor: pointer; text-decoration: underline; pointer-events: auto; }
[data-theme="dark"] .toast a { color: var(--accent-text); filter: brightness(.7); }
#drop-overlay { position: fixed; inset: 10px; border-radius: 18px; background: var(--accent-soft); border: 2.5px dashed var(--accent); display: none; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; color: var(--accent-text); z-index: 90; pointer-events: none; backdrop-filter: blur(3px); }
#drop-overlay.on { display: flex; }
.busy-back { position: fixed; inset: 0; background: rgba(15, 20, 30, .3); z-index: 70; display: flex; align-items: center; justify-content: center; }
.busy { background: var(--surface); border: 1px solid var(--line); padding: 18px 24px; border-radius: 14px; min-width: 300px; box-shadow: var(--shadow-lg); }

#print-root { display: none; }
@media print {
  @page { margin: 0; }
  html, body { overflow: visible; height: auto; background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root img { display: block; width: 100%; page-break-after: always; break-after: page; }
}
