/* ==========================================================================
   PDFDad — tools.css
   Shared styles for all 30 tool pages: layout, dropzone, file list,
   options panel, progress, results, thumbnail grid, canvas previews.
   ========================================================================== */

/* ==========================================================================
   1. TOOL PAGE LAYOUT
   ========================================================================== */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6);
  padding-bottom: var(--sp-8);
}
@media (min-width: 1024px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-7); align-items: start; }
  .tool-aside { position: sticky; top: calc(var(--header-h) + var(--sp-5)); }
}
@media (max-width: 1023px) {
  .tool-aside { display: none; }
}

.tool-head { padding-block: var(--sp-3) var(--sp-6); }
.tool-head .tool-title { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.tool-head .tool-ico { width: 56px; height: 56px; }
.tool-head .tool-ico svg { width: 28px; height: 28px; }
.tool-head h1 { font-size: var(--fs-3xl); }
.tool-head .lead { font-size: var(--fs-lg); color: var(--text-muted); max-width: 68ch; }

/* The workspace card holds upload → options → action → result */
.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.workspace-section { padding: var(--sp-6); }
.workspace-section + .workspace-section { border-top: 1px solid var(--border); }
@media (max-width: 479px) { .workspace-section { padding: var(--sp-4); } }

.workspace-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: var(--sp-4);
}
.workspace-title .num {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: var(--r-full);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 11px;
  letter-spacing: 0;
}

/* ==========================================================================
   2. DROPZONE
   ========================================================================== */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3);
  min-height: 250px;
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  background: var(--bg-elevated);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease-out),
              background-color var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-out);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); background: var(--surface-hover); }
.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.008);
}
.dropzone.is-dragover .dz-ico { transform: scale(1.12) translateY(-4px); }
.dropzone[hidden] { display: none; }

.dz-ico {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: var(--r-xl);
  background: var(--primary-soft);
  color: var(--primary);
  transition: transform var(--t-slow) var(--ease-spring);
}
.dz-ico svg { width: 30px; height: 30px; stroke-width: 1.7; }
.dz-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-strong); }
.dz-sub { font-size: var(--fs-sm); color: var(--text-muted); max-width: 46ch; }
.dz-or { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.dz-formats {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center;
  margin-top: var(--sp-2);
}
.dz-formats span {
  font-size: var(--fs-xs); font-family: var(--font-mono);
  padding: 2px var(--sp-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-muted);
}
/* The whole zone is the control; the native input stays out of the layout. */
.dropzone input[type="file"],
.hero-drop input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   3. FILE LIST
   ========================================================================== */
.file-list { display: grid; gap: var(--sp-3); }
.file-list:empty { display: none; }

.file-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              opacity var(--t-fast) var(--ease-out);
}
.file-item.is-dragging { opacity: 0.4; border-style: dashed; }
.file-item.is-drop-target { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

.file-handle {
  cursor: grab; color: var(--text-faint);
  padding: var(--sp-1);
  border-radius: var(--r-sm);
  touch-action: none;
}
.file-handle:active { cursor: grabbing; }
.file-handle:hover { color: var(--text); background: var(--surface-hover); }

.file-thumb {
  width: 46px; height: 60px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background:
    repeating-conic-gradient(var(--canvas-checker-a) 0% 25%, var(--canvas-checker-b) 0% 50%) 50% / 12px 12px;
  object-fit: contain;
  overflow: hidden;
}
.file-thumb.is-loading { background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.file-meta { flex: 1; min-width: 0; }
.file-meta strong {
  display: block;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta span { font-size: var(--fs-xs); color: var(--text-muted); }
.file-actions { display: flex; gap: var(--sp-1); flex: none; }
.file-actions .btn-icon { width: 34px; height: 34px; }

/* ==========================================================================
   4. OPTIONS PANEL
   ========================================================================== */
.options { display: grid; gap: var(--sp-5); }
.option-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.option-group { display: grid; gap: var(--sp-2); }
.option-group > .label { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.option-group .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.option-group[hidden] { display: none; }

/* Segmented radio control */
.segmented {
  display: flex; flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.segmented label {
  flex: 1 1 auto;
  position: relative;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:hover { color: var(--text); }
.segmented input:checked + span,
.segmented label:has(input:checked) { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Card-style radio (quality presets) */
.radio-cards { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.radio-card {
  position: relative;
  display: block;
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.radio-card input { position: absolute; opacity: 0; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.radio-card strong { display: block; font-size: var(--fs-sm); margin-bottom: 2px; }
.radio-card span { font-size: var(--fs-xs); color: var(--text-muted); }

/* Position picker (3x3 grid) */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 132px;
  padding: 4px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  aspect-ratio: 1 / 1.1;
}
.pos-grid label {
  position: relative;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.pos-grid label:hover { border-color: var(--primary); }
.pos-grid input { position: absolute; opacity: 0; width: 0; height: 0; }
.pos-grid label:has(input:checked) { background: var(--primary); border-color: var(--primary); }
.pos-grid label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Range with value readout */
.range-row { display: flex; align-items: center; gap: var(--sp-3); }
.range-row output {
  min-width: 7ch; text-align: right; white-space: nowrap;
  font-family: var(--font-mono); font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.color-row { display: flex; align-items: center; gap: var(--sp-3); }
.color-row input[type="color"] { width: 54px; flex: none; }

/* ==========================================================================
   5. PAGE THUMBNAIL GRID
   ========================================================================== */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: var(--sp-3);
  max-height: 560px;
  overflow-y: auto;
  padding: var(--sp-1);
}
@media (max-width: 479px) { .page-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }

.page-thumb {
  position: relative;
  display: flex; flex-direction: column;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.page-thumb:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.page-thumb[aria-pressed="true"],
.page-thumb.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.page-thumb.is-removed { opacity: 0.32; filter: grayscale(1); }
.page-thumb.is-dragging { opacity: 0.4; }
.page-thumb.is-drop-target { border-color: var(--primary); border-style: dashed; }
.page-thumb:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.page-thumb canvas, .page-thumb img {
  width: 100%; height: auto; display: block;
  background: #fff;
  transition: transform var(--t-base) var(--ease-out);
}
.page-thumb[data-rot="90"]  canvas, .page-thumb[data-rot="90"]  img { transform: rotate(90deg) scale(0.72); }
.page-thumb[data-rot="180"] canvas, .page-thumb[data-rot="180"] img { transform: rotate(180deg); }
.page-thumb[data-rot="270"] canvas, .page-thumb[data-rot="270"] img { transform: rotate(270deg) scale(0.72); }

.page-thumb .pt-skel { aspect-ratio: 1 / 1.414; background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.page-thumb .pt-num {
  padding: 3px;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.page-thumb .pt-tools {
  position: absolute; top: 4px; right: 4px;
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}
.page-thumb:hover .pt-tools,
.page-thumb:focus-within .pt-tools { opacity: 1; }
.page-thumb .pt-tools button {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  color: var(--text-muted);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.page-thumb .pt-tools button:hover { color: var(--text); background: var(--surface); }
.page-thumb .pt-tools button.danger:hover { color: var(--danger); border-color: var(--danger); }
.page-thumb .pt-badge {
  position: absolute; top: 4px; left: 4px;
  padding: 1px 6px;
  font-size: 10px; font-weight: var(--fw-bold);
  border-radius: var(--r-full);
  background: var(--primary); color: var(--text-on-primary);
}

.grid-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.grid-toolbar .count { margin-left: auto; font-size: var(--fs-sm); color: var(--text-muted); }

/* ==========================================================================
   6. CANVAS PREVIEW + CROP / SIGN / REDACT OVERLAY
   ========================================================================== */
.canvas-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    repeating-conic-gradient(var(--canvas-checker-a) 0% 25%, var(--canvas-checker-b) 0% 50%) 50% / 16px 16px;
  box-shadow: var(--shadow);
  touch-action: none;
}
.canvas-stage > canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.canvas-wrap { display: flex; justify-content: center; }

.overlay-layer { position: absolute; inset: 0; cursor: crosshair; }

.crop-box {
  position: absolute;
  border: 2px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  cursor: move;
}
.crop-handle {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.crop-handle[data-h="nw"] { top: -8px; left: -8px;  cursor: nwse-resize; }
.crop-handle[data-h="ne"] { top: -8px; right: -8px; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { bottom: -8px; left: -8px;  cursor: nesw-resize; }
.crop-handle[data-h="se"] { bottom: -8px; right: -8px; cursor: nwse-resize; }

.redact-box {
  position: absolute;
  background: #000;
  border: 1px solid var(--danger);
  cursor: move;
}
.redact-box button {
  position: absolute; top: -10px; right: -10px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 12px; line-height: 1;
  border: 2px solid var(--surface);
}

.sign-item {
  position: absolute;
  border: 1px dashed var(--primary);
  cursor: move;
  background: transparent;
}
.sign-item img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sign-item .sz {
  position: absolute; right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  background: var(--primary);
  border: 2px solid #fff; border-radius: 3px;
  cursor: nwse-resize;
}
.sign-item .rm {
  position: absolute; top: -10px; right: -10px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 12px; line-height: 1;
  border: 2px solid var(--surface);
}

.sig-pad {
  width: 100%;
  aspect-ratio: 3 / 1;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  cursor: crosshair;
  touch-action: none;
}

.page-nav {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.page-nav input { width: 68px; text-align: center; }

/* ==========================================================================
   7. ACTION BAR + PROGRESS
   ========================================================================== */
.action-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
@media (max-width: 479px) {
  .action-bar { padding: var(--sp-4); }
  .action-bar .btn-run { width: 100%; }
}
.action-bar .btn-run { min-width: 200px; }
.action-bar .hint { font-size: var(--fs-xs); color: var(--text-muted); flex: 1 1 200px; }

.progress-wrap { display: grid; gap: var(--sp-2); width: 100%; }
.progress-wrap[hidden] { display: none; }
.progress-head { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-muted); }
.progress-head b { color: var(--text); font-variant-numeric: tabular-nums; }
.progress-track {
  height: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), hsl(calc(var(--brand-h) + 40) var(--brand-s) calc(var(--brand-l) + 5%)));
  border-radius: var(--r-full);
  transition: width 220ms var(--ease-out);
}
.progress-fill.is-indeterminate {
  width: 40% !important;
  animation: indet 1.2s var(--ease-out) infinite;
}
@keyframes indet {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

/* ==========================================================================
   8. RESULT PANEL
   ========================================================================== */
.result[hidden] { display: none; }
.result {
  padding: var(--sp-6);
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--success-soft), transparent 60%);
}
.result-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.result-head .ok {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-full);
  background: var(--success); color: #fff;
  animation: pop 420ms var(--ease-spring);
}
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.result-head h2 { font-size: var(--fs-lg); }
.result-head p { font-size: var(--fs-sm); color: var(--text-muted); }

.result-stats {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.result-stat { flex: 1 1 130px; }
.result-stat b { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; color: var(--text-strong); }
.result-stat span { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.result-stat.good b { color: var(--success); }

.result-files { display: grid; gap: var(--sp-2); max-height: 320px; overflow-y: auto; margin-bottom: var(--sp-4); }
.result-file {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.result-file .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-file .size { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }

.result-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.next-tools { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.next-tools p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); }
.next-tools .chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.result-preview {
  margin-bottom: var(--sp-4);
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  max-height: 320px; overflow-y: auto;
  padding: var(--sp-1);
}
.result-preview img, .result-preview canvas {
  width: 110px; height: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   9. ERROR / ALERT PANEL
   ========================================================================== */
.alert[hidden] { display: none; }
.alert {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  margin-top: var(--sp-4);
}
.alert svg { flex: none; width: 20px; height: 20px; color: var(--danger); margin-top: 2px; }
.alert strong { display: block; color: var(--danger); font-size: var(--fs-sm); margin-bottom: 2px; }
.alert p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); }
.alert .btn { align-self: flex-start; }
.alert-warning { border-color: var(--warning); background: var(--warning-soft); }
.alert-warning svg, .alert-warning strong { color: var(--warning); }

/* Password prompt for encrypted files */
.pw-prompt[hidden] { display: none; }
.pw-prompt {
  padding: var(--sp-4);
  margin-top: var(--sp-4);
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  border-radius: var(--r-md);
  display: grid; gap: var(--sp-3);
}
.pw-prompt .row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pw-prompt input { flex: 1 1 200px; }

/* ==========================================================================
   10. HOW IT WORKS / RELATED / TOOL FAQ
   ========================================================================== */
.tool-section { margin-top: var(--sp-8); }
.tool-section > h2 { font-size: var(--fs-xl); margin-bottom: var(--sp-5); }

.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-3); }
.related-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none; color: var(--text);
  transition: transform var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.related-card:hover { transform: translateY(-2px); border-color: var(--cat-color, var(--primary)); box-shadow: var(--shadow); color: var(--text); }
.related-card .tool-ico { width: 36px; height: 36px; }
.related-card .tool-ico svg { width: 19px; height: 19px; }
.related-card strong { font-size: var(--fs-sm); display: block; }
.related-card span { font-size: var(--fs-xs); color: var(--text-muted); }

/* Honesty note about approximate results */
.fidelity-note {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
  background: var(--info-soft);
  border: 1px solid color-mix(in srgb, var(--info) 32%, transparent);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.fidelity-note svg { flex: none; width: 20px; height: 20px; color: var(--info); margin-top: 2px; }
.fidelity-note strong { color: var(--info); }
.fidelity-note p { color: var(--text-muted); margin: 0; }

/* ==========================================================================
   11. TOAST
   ========================================================================== */
.toast-host {
  position: fixed;
  left: 50%; bottom: var(--sp-5);
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: grid; gap: var(--sp-2);
  width: min(420px, calc(100vw - var(--sp-6)));
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toastIn 300ms var(--ease-out);
}
.toast.is-leaving { animation: toastOut 220ms var(--ease-out) forwards; }
.toast svg { flex: none; width: 18px; height: 18px; }
.toast-success svg { color: var(--success); }
.toast-error   svg { color: var(--danger); }
.toast-info    svg { color: var(--info); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(14px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   12. SKELETONS + EMPTY STATES
   ========================================================================== */
.skeleton {
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: var(--r-md);
}
.skel-card { height: 168px; }
.skel-line { height: 12px; margin-bottom: var(--sp-2); }

.empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-muted); }
.empty-state .ico {
  width: 56px; height: 56px; margin: 0 auto var(--sp-4);
  display: grid; place-items: center;
  border-radius: var(--r-xl);
  background: var(--bg-sunken);
  color: var(--text-faint);
}
.empty-state h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); color: var(--text); }
.empty-state p { font-size: var(--fs-sm); max-width: 44ch; margin-inline: auto; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .file-thumb.is-loading, .page-thumb .pt-skel,
  .progress-fill.is-indeterminate, .result-head .ok, .toast { animation: none; }
  .progress-fill.is-indeterminate { width: 100% !important; }
}
