/* ==========================================================
   Dual PDF Manager – design system
   Charcoal header · light-grey workspace · white panels · blue selection
   ========================================================== */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hdr-1: #121418;
  --hdr-2: #1c1f26;
  --hdr-line: rgba(255, 255, 255, .07);
  --hdr-text: #e7e9ee;
  --hdr-mute: #9aa1ae;
  --ws: #e6e9ef;
  --ws-2: #dde1e8;
  --panel: #ffffff;
  --grid-bg: #f3f5f9;
  --line: #e3e7ee;
  --text: #1a1f2b;
  --mute: #6b7385;
  --blue: #2f6bff;
  --blue-2: #5b8cff;
  --blue-soft: rgba(47, 107, 255, .1);
  --violet: #7c4dff;
  --amber: #f59e0b;
  --red: #e5484d;
  --green: #18a058;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 6px 18px -6px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px -12px rgba(10, 14, 25, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --split: 50%;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--ws);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
h1, h2, h3, p { margin: 0; }

.ico {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------- Header ---------------- */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--hdr-2), var(--hdr-1));
  border-bottom: 1px solid #000;
  box-shadow: inset 0 -1px 0 var(--hdr-line), 0 4px 20px rgba(0, 0, 0, .25);
  color: var(--hdr-text);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: flex; gap: 3px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 6px 18px -4px rgba(47, 107, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark span { width: 9px; height: 16px; border-radius: 2px; background: #fff; }
.brand-mark span + span { opacity: .65; transform: translateY(2px); }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .12em; white-space: nowrap; color: #cfd4de; }
.brand-name b {
  font-weight: 800;
  background: linear-gradient(90deg, #fff, #a9c1ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tb-group { display: flex; gap: 6px; align-items: center; padding-left: 14px; border-left: 1px solid var(--hdr-line); }
.tb-export { margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 12.5px; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s, transform .12s, box-shadow .18s, color .18s;
}
.btn:not(:disabled):active { transform: translateY(1px) scale(.98); }
.btn-dark { background: #2a2e37; border-color: #363b46; color: #eef0f4; }
.btn-dark:not(:disabled):hover { background: #333845; border-color: #4a5160; }
.btn-ghost { background: transparent; color: var(--hdr-text); }
.btn-ghost:not(:disabled):hover { background: rgba(255, 255, 255, .07); }
.btn-outline { background: transparent; border-color: #3d4350; color: #e6e9ef; }
.btn-outline:not(:disabled):hover { border-color: var(--blue-2); color: #fff; background: rgba(47, 107, 255, .12); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), #4f5dff 60%, var(--violet)); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(47, 107, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 10px 24px -6px rgba(47, 107, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .25); filter: brightness(1.06); }
.btn-light { background: #f1f3f7; border-color: var(--line); color: var(--text); }
.btn-light:hover { background: #e8ebf1; }
.btn-danger { background: linear-gradient(135deg, #e5484d, #c62a47) !important; box-shadow: 0 6px 16px -6px rgba(229, 72, 77, .7) !important; }

/* Mode switch with sliding glider */
.mode-switch {
  position: relative; display: grid; grid-template-columns: repeat(3, 86px);
  padding: 3px; border-radius: 11px; background: #0d0f12; border: 1px solid #2b2f38;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  margin: 0 auto;
}
.mode-switch button {
  position: relative; z-index: 1; height: 30px; border: 0; background: none; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--hdr-mute); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  transition: color .2s;
}
.mode-switch button:hover { color: #fff; }
.mode-switch button.active { color: #fff; }
.mode-glider {
  position: absolute; top: 3px; left: 3px; width: 86px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #5468ff);
  box-shadow: 0 4px 14px -4px rgba(47, 107, 255, .8);
  transition: transform .32s var(--ease), background .32s;
}
.mode-copy .mode-glider { transform: translateX(86px); background: linear-gradient(135deg, #12a26a, #10b981); box-shadow: 0 4px 14px -4px rgba(16, 185, 129, .7); }
.mode-swap .mode-glider { transform: translateX(172px); background: linear-gradient(135deg, #f08c00, #f59e0b); box-shadow: 0 4px 14px -4px rgba(245, 158, 11, .7); }

/* ---------------- Mobile tabs ---------------- */
.mobile-tabs { display: none; }

/* ---------------- Workspace ---------------- */
.workspace {
  display: grid; grid-template-columns: var(--split) 12px 1fr;
  padding: 12px; min-height: 0;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(47, 107, 255, .07), transparent 60%),
    var(--ws);
}
.divider { cursor: col-resize; display: flex; align-items: center; justify-content: center; touch-action: none; }
.divider span {
  width: 4px; height: 56px; border-radius: 4px; background: #c2c8d3;
  transition: background .2s, height .25s var(--ease);
}
.divider:hover span, .divider.active span { background: var(--blue); height: 96px; }

/* ---------------- Panel ---------------- */
.panel {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--panel); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md); border: 1px solid #d9dee7;
  transition: box-shadow .2s, border-color .2s;
}
.panel.drop-target { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 107, 255, .18), var(--shadow-md); }
.mode-swap .panel.drop-target { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, .2), var(--shadow-md); }
.panel.file-over::after {
  content: 'Drop PDF to open'; position: absolute; inset: 8px; z-index: 30; border-radius: 12px;
  border: 2px dashed var(--blue); background: rgba(47, 107, 255, .08); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--blue);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--line);
}
.doc-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.doc-badge {
  flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 4px 10px -3px rgba(47, 107, 255, .55);
}
[data-side="R"] .doc-badge { background: linear-gradient(135deg, #0ea5e9, #2f6bff); }
.doc-text { min-width: 0; }
.doc-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { display: flex; align-items: center; gap: 7px; color: var(--mute); font-size: 12px; margin-top: 2px; font-weight: 500; }
.doc-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #b5bccb; }
.selcount { transition: color .2s; }
.selcount.has { color: var(--blue); font-weight: 700; }

.zoom-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.zoom-ctl input[type=range] { width: 92px; accent-color: var(--blue); }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--mute); transition: background .15s, color .15s;
}
.icon-btn:not(:disabled):hover { background: #eef1f6; color: var(--text); }

.panel-tools { padding: 8px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 7px; background: #fbfcfd; }
.tool-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-form {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 3px 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--mute);
  transition: border-color .15s, box-shadow .15s;
}
.mini-form:focus-within { border-color: var(--blue-2); box-shadow: 0 0 0 3px var(--blue-soft); }
.mini-form.grow { flex: 1; min-width: 150px; }
.mini-form input { border: 0; outline: 0; background: transparent; width: 90px; min-width: 0; color: var(--text); font-size: 12.5px; }
.mini-form.grow input { flex: 1; width: auto; }
.mini-form input::-webkit-inner-spin-button { display: none; }
.mini-form button {
  height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: #eef2fb; color: var(--blue);
  font-weight: 700; font-size: 12px; transition: background .15s;
}
.mini-form button:hover { background: #dfe7fb; }
.chip {
  height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-weight: 600; font-size: 12px; color: #3a4252; transition: all .15s;
}
.chip:not(:disabled):hover { border-color: var(--blue-2); color: var(--blue); }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 7px; border: 1px solid transparent; background: transparent;
  font-weight: 600; font-size: 12px; color: #3a4252; transition: all .15s;
}
.tool .ico { width: 15px; height: 15px; }
.tool:not(:disabled):hover { background: #eef2fb; color: var(--blue); }
.tool.danger:not(:disabled):hover { background: #fdecec; color: var(--red); }
.tool b { font-weight: 700; }
.sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }
.swap-only { display: none; }
.mode-swap .swap-only { display: inline-flex; }
.mode-swap .send { display: none; }

/* ---------------- Thumbnail grid (virtual) ---------------- */
.scroller {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--grid-bg);
  scrollbar-width: thin; scrollbar-color: #c3c9d4 transparent;
}
.scroller::-webkit-scrollbar { width: 10px; }
.scroller::-webkit-scrollbar-thumb { background: #c8ced8; border-radius: 10px; border: 3px solid var(--grid-bg); }
.scroller::-webkit-scrollbar-thumb:hover { background: #a9b1bf; }
.spacer { position: relative; width: 100%; }

.cell {
  position: absolute; left: 0; top: 0; border-radius: 10px; padding: 6px 6px 0;
  user-select: none; -webkit-user-select: none; cursor: grab;
  transition: background .15s, box-shadow .15s, opacity .2s;
  will-change: transform;
}
.cell:hover { background: rgba(47, 107, 255, .06); }
.thumb {
  position: relative; height: calc(var(--thumb-h) - 6px); display: flex; align-items: center; justify-content: center;
}
.thumb img {
  display: block; max-width: 100%; max-height: 100%; background: #fff; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12), 0 4px 12px -4px rgba(16, 24, 40, .2);
  opacity: 0; transition: opacity .25s, transform .2s var(--ease), box-shadow .2s;
  -webkit-user-drag: none; pointer-events: none;
}
.cell.loaded .thumb img { opacity: 1; }
.cell:hover .thumb img { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 24, 40, .12), 0 10px 22px -8px rgba(16, 24, 40, .3); }
/* skeleton while rendering */
.thumb::before {
  content: ''; position: absolute; height: 92%; aspect-ratio: 1 / 1.414; max-width: 100%; border-radius: 4px;
  background: linear-gradient(100deg, #e9edf3 30%, #f6f8fb 50%, #e9edf3 70%) 0 0 / 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
.cell.loaded .thumb::before { display: none; }
.cell.err .thumb::before { animation: none; background: repeating-linear-gradient(45deg, #fbeaea, #fbeaea 6px, #fff 6px, #fff 12px); }
@keyframes shimmer { to { background-position: -300% 0; } }

.chk {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .95); border: 1.5px solid #b9c1cf; color: transparent;
  box-shadow: var(--shadow-sm); opacity: 0; transform: scale(.85);
  transition: opacity .15s, transform .15s var(--ease), background .15s, border-color .15s;
}
.chk .ico { width: 13px; height: 13px; stroke-width: 3; }
.cell:hover .chk, .cell.selected .chk { opacity: 1; transform: none; }
.chk:hover { border-color: var(--blue); }
.cell.selected .chk { background: var(--blue); border-color: var(--blue); color: #fff; }

.cell-foot { height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 2px; }
.pno { font-weight: 700; font-size: 12px; color: #2a3140; font-variant-numeric: tabular-nums; }
.origin {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 10.5px; color: var(--mute); font-weight: 600; white-space: nowrap; overflow: hidden;
}
.origin i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.origin em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }

.cell.selected { background: rgba(47, 107, 255, .11); box-shadow: inset 0 0 0 2px var(--blue); }
.cell.selected .pno { color: var(--blue); }
.cell.drag-src { opacity: .35; }
.cell.swap-target { background: rgba(245, 158, 11, .14); box-shadow: inset 0 0 0 2px var(--amber); }
.cell.swap-target .thumb img { transform: scale(.94) rotate(-1.5deg); }
.cell.flash { animation: flash 1.5s var(--ease); }
@keyframes flash {
  0%, 40% { box-shadow: inset 0 0 0 3px var(--violet); background: rgba(124, 77, 255, .14); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.is-dragging .cell:hover { background: transparent; }
.is-dragging .cell:hover .thumb img { transform: none; }

/* insertion line */
.insert-line {
  position: absolute; left: 0; top: 0; width: 4px; border-radius: 4px; z-index: 5; pointer-events: none;
  background: var(--blue); box-shadow: 0 0 0 3px rgba(47, 107, 255, .2), 0 0 16px rgba(47, 107, 255, .6);
  opacity: 0; transition: opacity .12s;
}
.insert-line::before, .insert-line::after {
  content: ''; position: absolute; left: -4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
}
.insert-line::before { top: -6px; }
.insert-line::after { bottom: -6px; }
.insert-line.on { opacity: 1; }
.mode-copy .insert-line, .mode-copy .insert-line::before, .mode-copy .insert-line::after { background: #10b981; }
.mode-copy .insert-line { box-shadow: 0 0 0 3px rgba(16, 185, 129, .2), 0 0 16px rgba(16, 185, 129, .6); }

/* empty / loading states */
.empty-state, .loading-state {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 24px; color: var(--mute);
}
.is-empty .empty-state { display: flex; }
.is-loading .loading-state { display: flex; background: rgba(243, 245, 249, .85); backdrop-filter: blur(3px); z-index: 10; }
.is-loading .empty-state { display: none; }
.empty-art {
  position: relative; width: 84px; height: 104px; border-radius: 12px; display: grid; place-items: center;
  background: #fff; border: 2px dashed #c4cbd8; color: #b0b8c7; margin-bottom: 6px;
  animation: float 4s ease-in-out infinite;
}
.empty-art .ico { width: 34px; height: 34px; stroke-width: 1.5; }
.empty-art span {
  position: absolute; right: -10px; bottom: -10px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-weight: 800; box-shadow: var(--shadow-md);
}
@keyframes float { 50% { transform: translateY(-6px); } }
.empty-state h3 { font-size: 16px; color: var(--text); }
.empty-state p { line-height: 1.55; max-width: 300px; }
.empty-state .btn { margin-top: 8px; }
.panel.drop-target.is-empty .empty-art { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(47, 107, 255, .18); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Drag ghost ---------------- */
.ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ghost-card {
  position: relative; width: 84px; padding: 4px; border-radius: 8px; background: #fff;
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--blue); transform: rotate(-3deg);
  animation: pop .18s var(--ease);
}
.ghost.multi .ghost-card { box-shadow: var(--shadow-lg), 0 0 0 2px var(--blue), 6px 6px 0 -1px #fff, 6px 6px 0 1px #b8c6ea, 12px 12px 0 -1px #fff, 12px 12px 0 1px #ccd6ef; }
.ghost-card img { display: block; width: 100%; border-radius: 3px; }
.ghost-blank { width: 100%; aspect-ratio: 1/1.414; background: #eef1f6; border-radius: 3px; }
.ghost-count {
  position: absolute; top: -10px; right: -10px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet)); border: 2px solid #fff; box-shadow: var(--shadow-md);
}
.mode-copy .ghost-card { box-shadow: var(--shadow-lg), 0 0 0 2px #10b981; }
.mode-copy .ghost-count { background: linear-gradient(135deg, #12a26a, #10b981); }
.mode-swap .ghost-card { box-shadow: var(--shadow-lg), 0 0 0 2px var(--amber); }
.mode-swap .ghost-count { background: linear-gradient(135deg, #f08c00, #f59e0b); }
.ghost-label {
  padding: 6px 10px; border-radius: 8px; background: rgba(18, 20, 24, .92); color: #fff;
  font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-md);
}
.ghost.bad .ghost-label { background: rgba(160, 30, 40, .94); }
@keyframes pop { from { transform: scale(.7) rotate(0); opacity: 0; } }

/* ---------------- Status bar ---------------- */
.statusbar {
  display: flex; align-items: center; gap: 9px; padding: 0 16px; height: 30px;
  background: #fff; border-top: 1px solid var(--line); color: var(--mute); font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(24, 160, 88, .15); flex: none; }
#status-text { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
#status-text.pulse { animation: fadeIn .4s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } }
.status-right { margin-left: auto; display: flex; gap: 18px; }

/* ---------------- Modals ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10, 12, 18, .55); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.modal.open { opacity: 1; visibility: visible; }
.dialog {
  width: min(440px, 100%); background: #fff; border-radius: 16px; padding: 24px; box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.97); transition: transform .25s var(--ease);
}
.modal.open .dialog { transform: none; }
.dialog h3 { font-size: 17px; margin-bottom: 8px; }
.dialog p { color: var(--mute); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.ex-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 8px 20px -6px rgba(47, 107, 255, .6);
}
.ex-icon .ico { width: 22px; height: 22px; }
.working .ex-icon .ico { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.ok .ex-icon { background: linear-gradient(135deg, #12a26a, #10b981); }
.fail .ex-icon { background: linear-gradient(135deg, #e5484d, #c62a47); }
.progress { height: 8px; border-radius: 8px; background: #edf0f5; overflow: hidden; margin-top: 16px; }
.progress div {
  height: 100%; width: 0; border-radius: 8px; transition: width .25s var(--ease);
  background: linear-gradient(90deg, var(--blue), var(--violet)); background-size: 200% 100%;
}
.working .progress div { animation: bar 1.2s linear infinite; background-image: linear-gradient(90deg, var(--blue), var(--violet), var(--blue)); }
@keyframes bar { to { background-position: -200% 0; } }
.ok .progress div { background: #10b981; }
.fail .progress div { background: var(--red); }
.ex-details { margin-top: 14px; display: grid; gap: 6px; }
.ex-details div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #f6f8fb; border-radius: 8px; font-size: 12px; }
.ex-details span { color: var(--mute); }
.ex-details b { text-align: right; word-break: break-word; }

/* Preview */
.pv { padding: 16px; }
.pv-shell {
  width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: #22252c; box-shadow: var(--shadow-lg);
  transform: scale(.98); transition: transform .25s var(--ease);
}
.pv.open .pv-shell { transform: none; }
.pv:fullscreen { padding: 0; }
.pv:fullscreen .pv-shell { border-radius: 0; }
.pv-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: #17191e; border-bottom: 1px solid #000; color: #e6e9ef;
}
.pv-heading { display: flex; flex-direction: column; min-width: 0; }
.pv-heading b { font-size: 14px; }
.pv-heading small { color: #8f97a6; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pv-tools .icon-btn { color: #c3c8d2; }
.pv-tools .icon-btn:not(:disabled):hover { background: rgba(255, 255, 255, .08); color: #fff; }
.pv-tools .sep { background: #363a44; }
.pv-zoom { min-width: 48px; text-align: center; font-weight: 700; font-size: 12px; color: #c3c8d2; font-variant-numeric: tabular-nums; }
.mini-form.dark { background: #0f1114; border-color: #333844; }
.mini-form.dark input { width: 54px; color: #fff; text-align: center; }
.mini-form.dark button { background: #2a3040; color: #a9c1ff; }
.pv-stage { position: relative; flex: 1; overflow: auto; display: flex; padding: 24px; }
.pv-stage canvas { margin: auto; background: #fff; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .6); border-radius: 2px; }
.pv-stage .spinner { position: absolute; left: 50%; top: 50%; margin: -17px; display: none; }
.pv-stage.busy .spinner { display: block; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 44px; z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: 420px; padding: 10px 14px; border-radius: 10px;
  background: #1b1e25; color: #f1f3f7; font-weight: 500; box-shadow: var(--shadow-lg);
  transform: translateY(10px); opacity: 0; transition: transform .25s var(--ease), opacity .25s;
}
.toast.show { transform: none; opacity: 1; }
.toast .ico { color: #6ea0ff; }
.toast-success .ico { color: #34d399; }
.toast-error { background: #3a1418; }
.toast-error .ico { color: #ff8a8f; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1500px) {
  .tb-group .btn-ghost span { display: none; }
  .tb-group .btn-ghost { padding: 0 9px; }
}
@media (max-width: 1250px) {
  .topbar .tb-group .btn span { display: none; }
  .topbar .tb-group .btn { padding: 0 10px; }
  .status-right .hint { display: none; }
}
@media (max-width: 860px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand-name { display: none; }
  .tb-group { padding-left: 8px; }
  .mode-switch { order: 10; width: 100%; grid-template-columns: repeat(3, 1fr); }
  .mode-glider { width: calc((100% - 6px) / 3); }
  .mode-copy .mode-glider { transform: translateX(100%); }
  .mode-swap .mode-glider { transform: translateX(200%); }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 10px 0; background: var(--ws); }
  .mobile-tabs button {
    height: 36px; border-radius: 10px; border: 1px solid #d3d9e3; background: #fff; font-weight: 700; color: var(--mute);
  }
  .mobile-tabs button span { margin-left: 6px; padding: 2px 7px; border-radius: 10px; background: #eef1f6; font-size: 11px; }
  .mobile-tabs button.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--blue), var(--violet)); }
  .mobile-tabs button.active span { background: rgba(255, 255, 255, .22); }
  .workspace { grid-template-columns: 1fr; padding: 8px 10px; }
  .divider { display: none; }
  body[data-tab="L"] #panel-R, body[data-tab="R"] #panel-L { display: none; }
  .tool span { display: none; }
  .tool.send span, .tool.swap-only span { display: inline; }
  .zoom-ctl input[type=range] { width: 60px; }
  .status-right { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
