/* ============================================================
   ConvertICO OCR core - styles (added 2026-10-12)
   Image to Text, Screenshot to Text, Image to Word, Image to Excel,
   OCR PDF - all built on /_ocr_tool.php + /scripts/ocr-core/.
   Page parts under .ocr-page (the .tool-container), tool UI under
   .ocr (#ocrTool). One colour per page: --ocr-accent; shades come
   from color-mix(). Light default, dark via [data-theme="dark"].
   Single colours, no gradients, no 4px side borders.
   Header, footer, FAQ, related pills and steps come from custom_styles.css.
   ============================================================ */
.ocr-page, .ocr {
    --o-c: var(--ocr-accent, #3399cc);
    --o-strong: color-mix(in srgb, var(--o-c) 70%, #000);
    --o-soft: color-mix(in srgb, var(--o-c) 9%, transparent);
    --o-soft2: color-mix(in srgb, var(--o-c) 16%, transparent);
    --o-line-c: color-mix(in srgb, var(--o-c) 42%, transparent);
    --o-go: color-mix(in srgb, var(--o-c) 78%, #000);
    --o-go-hover: color-mix(in srgb, var(--o-c) 64%, #000);
    --o-card: var(--bg-elevated, #fff);
    --o-sunk: var(--card-tertiary, #f1f5f9);
    --o-open: var(--card-secondary, #f8f9fa);
    --o-line: var(--border-color, #e2e8f0);
    --o-t1: var(--text-primary, #1e293b);
    --o-t2: var(--text-secondary, #555);
    --o-muted: var(--text-muted, #64748b);
    --o-stage: #eef1f5;
    --o-ok: #2f855a; --o-ok-soft: rgba(51, 153, 102, 0.12);
    --o-warn: #b45309; --o-warn-soft: rgba(217, 119, 6, 0.12);
    --o-bad: #c23b3b; --o-bad-soft: rgba(230, 78, 78, 0.1);
    --o-info: #2b7fae; --o-info-soft: rgba(51, 153, 204, 0.1);
    --o-sel: rgba(51, 153, 204, 0.32);
    --o-low: rgba(245, 158, 11, 0.85);
    --o-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
[data-theme="dark"] .ocr-page, [data-theme="dark"] .ocr {
    --o-c: color-mix(in srgb, var(--ocr-accent, #3399cc) 68%, #fff);
    --o-strong: var(--o-c);
    --o-soft: color-mix(in srgb, var(--o-c) 12%, transparent);
    --o-soft2: color-mix(in srgb, var(--o-c) 20%, transparent);
    --o-line-c: color-mix(in srgb, var(--o-c) 45%, transparent);
    --o-go: color-mix(in srgb, var(--ocr-accent, #3399cc) 82%, #000);
    --o-go-hover: color-mix(in srgb, var(--ocr-accent, #3399cc) 70%, #000);
    --o-sunk: #172033;
    --o-open: #1a2438;
    --o-stage: #0f172a;
    --o-ok: #4ade80; --o-ok-soft: rgba(74, 222, 128, 0.1);
    --o-warn: #fbbf24; --o-warn-soft: rgba(251, 191, 36, 0.1);
    --o-bad: #f87171; --o-bad-soft: rgba(248, 113, 113, 0.1);
    --o-info: #60a5fa; --o-info-soft: rgba(96, 165, 250, 0.1);
    --o-sel: rgba(96, 165, 250, 0.38);
}

.ocr-page.tool-container { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.ocr [hidden], .ocr-page [hidden] { display: none !important; }
.ocr button { font: inherit; width: auto; }
.ocr-page .faq-question { font: inherit; width: 100%; }
.ocr svg { flex-shrink: 0; }

/* ---------- breadcrumbs + title ---------- */
.ocr-page .ocr-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0 0 1.1rem; padding: 0; list-style: none; font-size: 0.8rem; color: var(--o-muted); }
.ocr-page .ocr-crumbs li { display: inline-flex; align-items: center; gap: 0.3rem; }
.ocr-page .ocr-crumbs li + li::before { content: '/'; color: var(--o-line); }
.ocr-page .ocr-crumbs a { color: var(--o-muted); text-decoration: none; }
.ocr-page .ocr-crumbs a:hover { color: var(--o-strong); text-decoration: underline; }
.ocr-page .tool-header { text-align: center; margin-bottom: 1.75rem; }
.ocr-page .tool-title-row { display: flex; align-items: center; justify-content: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.ocr-page .ocr-title-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--o-c); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
[data-theme="dark"] .ocr-page .ocr-title-icon { color: #0b1e33; }
.ocr-page .ocr-title-icon svg { width: 30px; height: 30px; display: block; }
.ocr-page .tool-title { margin: 0; font-size: 2rem; font-weight: 700; color: var(--o-c); line-height: 1.2; }
.ocr-page .tool-description { max-width: 900px; margin: 0 auto; font-size: 1.05rem; line-height: 1.65; color: var(--o-t2); }
.ocr-page .tool-description a { color: var(--o-strong); font-weight: 500; }

/* ---------- cards, buttons ---------- */
.ocr .ocr-card { background: var(--o-card); border: 1px solid var(--o-line); border-radius: 20px; padding: 1.25rem; box-shadow: var(--shadow-sm); margin-bottom: 1.25rem; }
.ocr .ocr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0.6rem 1.1rem;
    border-radius: 12px; border: 1px solid transparent; font-size: 0.95rem; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ocr .ocr-btn svg { width: 18px; height: 18px; }
.ocr .ocr-go { background: var(--o-go); color: #fff; }
.ocr .ocr-go:hover:not(:disabled) { background: var(--o-go-hover); color: #fff; }
.ocr .ocr-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ocr .ocr-btn-ghost { background: var(--o-sunk); color: var(--o-t2); border-color: var(--o-line); }
.ocr .ocr-btn-ghost:hover:not(:disabled) { color: var(--o-t1); border-color: var(--o-line-c); }
.ocr .ocr-btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.85rem; border-radius: 10px; }
.ocr .ocr-btn-sm svg { width: 16px; height: 16px; }
.ocr .ocr-link-btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0; border: none; background: none; cursor: pointer; color: var(--o-strong); font-size: 0.82rem; font-weight: 600; }
.ocr .ocr-link-btn:hover { text-decoration: underline; }
.ocr .ocr-link-btn svg { width: 15px; height: 15px; }
.ocr .ocr-x { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 8px; background: none; color: var(--o-muted); cursor: pointer; padding: 0; }
.ocr .ocr-x:hover { background: rgba(100, 116, 139, 0.12); color: var(--o-t1); }
.ocr .ocr-x svg { width: 17px; height: 17px; }
.ocr .ocr-caption { display: block; margin: 0 0 0.45rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--o-muted); }
.ocr .ocr-hint { margin: 0.55rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--o-muted); overflow-wrap: anywhere; }
.ocr .ocr-hint:empty { display: none; }
.ocr .ocr-hint a { color: var(--o-strong); font-weight: 600; }
.ocr .ocr-hint svg { width: 14px; height: 14px; vertical-align: -2px; }
.ocr .ocr-muted { color: var(--o-muted); font-weight: 400; }
.ocr .ocr-h { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 1rem; font-weight: 700; color: var(--o-t1); }
.ocr .ocr-h svg { width: 18px; height: 18px; color: var(--o-c); }
.ocr .ocr-empty { display: flex; align-items: center; gap: 0.5rem; padding: 1.2rem; border: 1px dashed var(--o-line); border-radius: 12px; color: var(--o-muted); font-size: 0.9rem; margin: 0; }
.ocr .ocr-empty svg { width: 18px; height: 18px; }

/* ---------- logo loader ---------- */
.ocr .ocr-loader { display: block; width: 44px; height: 44px; overflow: visible; --cico-outer: #f2534e; --cico-outer-soft: #f8d3d1; --cico-mid: #31ae77; --cico-mid-soft: #d0e7dd; --cico-inner: #2b9edb; }
[data-theme="dark"] .ocr .ocr-loader { --cico-outer-soft: rgba(242, 83, 78, 0.22); --cico-mid-soft: rgba(49, 174, 119, 0.22); }
.ocr .ocr-loader circle { fill: none; stroke-width: 72; transform-box: fill-box; transform-origin: center; }
.ocr .ocr-loader .bp { stroke: var(--cico-outer-soft); }
.ocr .ocr-loader .gp { stroke: var(--cico-mid-soft); }
.ocr .ocr-loader .b { stroke: var(--cico-outer); stroke-linecap: round; stroke-dasharray: 35.3 100; animation: ocrSpinL 1.3s linear infinite; }
.ocr .ocr-loader .g { stroke: var(--cico-mid); stroke-linecap: round; stroke-dasharray: 75.8 100; animation: ocrSpinR 2.1s linear infinite; }
.ocr .ocr-loader .r { stroke: var(--cico-inner); animation: ocrBreathe 1.3s ease-in-out infinite; }
@keyframes ocrSpinL { from { transform: rotate(117deg); } to { transform: rotate(-243deg); } }
@keyframes ocrSpinR { from { transform: rotate(36deg); } to { transform: rotate(396deg); } }
@keyframes ocrBreathe { 50% { transform: scale(0.9); } }
@media (prefers-reduced-motion: reduce) { .ocr .ocr-loader .b { animation-duration: 4s; } .ocr .ocr-loader .g { animation-duration: 6s; } .ocr .ocr-loader .r { animation: none; } }

/* ---------- error, note, toast ---------- */
.ocr .ocr-error, .ocr .ocr-note { display: flex; align-items: flex-start; gap: 0.7rem; margin: 0 0 1rem; padding: 0.9rem 1rem; border-radius: 12px; color: var(--o-t1); }
.ocr .ocr-error { border: 1px solid rgba(230, 78, 78, 0.35); background: var(--o-bad-soft); }
.ocr .ocr-note { border: 1px solid rgba(51, 153, 204, 0.35); background: var(--o-info-soft); font-size: 0.92rem; line-height: 1.55; }
.ocr .ocr-error > svg { width: 20px; height: 20px; color: #e64e4e; margin-top: 2px; }
.ocr .ocr-note > svg { width: 19px; height: 19px; color: var(--o-info); margin-top: 2px; }
.ocr .ocr-error > div, .ocr .ocr-note > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ocr .ocr-error p { margin: 0; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.ocr .ocr-error p + p { margin-top: 0.3rem; color: var(--o-muted); font-size: 0.86rem; }
.ocr .ocr-error a { color: var(--o-bad); font-weight: 600; }
.ocr .ocr-note a { color: var(--o-strong); font-weight: 600; }
.ocr .ocr-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9500; padding: 0.6rem 1.1rem; border-radius: 999px; background: #1e293b; color: #fff; font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow-md); max-width: calc(100vw - 32px); text-align: center; }
[data-theme="dark"] .ocr .ocr-toast { background: #e2e8f0; color: #0f172a; }

/* ---------- start: drop zone ---------- */
.ocr .ocr-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.45rem; min-height: 220px; padding: 1.5rem;
    border: 2px dashed var(--o-line-c); border-radius: 16px; background: var(--o-soft); text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s, min-height 0.2s;
}
.ocr .ocr-drop:hover, .ocr .ocr-drop.is-over, .ocr .ocr-drop:focus-visible { background: var(--o-soft2); border-color: var(--o-c); outline: none; }
.ocr .ocr-drop-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--o-card); border: 1px solid var(--o-line); display: flex; align-items: center; justify-content: center; color: var(--o-c); margin-bottom: 0.3rem; }
.ocr .ocr-drop-icon svg { width: 30px; height: 30px; }
.ocr .ocr-drop strong { font-size: 1.1rem; color: var(--o-t1); }
.ocr .ocr-drop > span { font-size: 0.88rem; color: var(--o-muted); }
.ocr .ocr-drop-link { color: var(--o-strong); text-decoration: underline; }
.ocr .ocr-drop-paste { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem !important; flex-wrap: wrap; justify-content: center; }
.ocr .ocr-drop-paste svg { width: 14px; height: 14px; }
.ocr .ocr-start.is-compact .ocr-drop { min-height: 96px; flex-direction: row; flex-wrap: wrap; gap: 0.3rem 0.8rem; padding: 0.9rem 1.2rem; }
.ocr .ocr-start.is-compact .ocr-drop-icon { width: 40px; height: 40px; border-radius: 12px; margin: 0; }
.ocr .ocr-start.is-compact .ocr-drop-icon svg { width: 22px; height: 22px; }
.ocr .ocr-start.is-compact .ocr-drop strong { font-size: 0.98rem; }
.ocr .ocr-start.is-compact .ocr-drop-paste, .ocr .ocr-start.is-compact .ocr-under { display: none; }
.ocr .ocr-paste-row { display: flex; justify-content: center; margin-top: 0.9rem; }
.ocr .ocr-url { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; padding: 0.3rem 0.35rem 0.3rem 0.75rem; border: 1px solid var(--o-line); border-radius: 12px; background: var(--o-sunk); }
.ocr .ocr-url-label { display: inline-flex; color: var(--o-muted); }
.ocr .ocr-url-label svg { width: 17px; height: 17px; }
.ocr .ocr-url input { flex: 1; min-width: 0; border: none; background: none; color: var(--o-t1); font: inherit; font-size: 0.9rem; padding: 0.45rem 0; outline: none; box-shadow: none; margin: 0; }
.ocr .ocr-url input::placeholder { color: var(--o-muted); }
.ocr .ocr-url:focus-within { border-color: var(--o-c); }
.ocr .ocr-under { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.ocr .ocr-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--o-sunk); border: 1px solid var(--o-line); font-size: 0.78rem; font-weight: 600; color: var(--o-t2); }
.ocr .ocr-pill svg { width: 14px; height: 14px; color: var(--o-c); }
.ocr .ocr-samples { margin-left: auto; font-size: 0.82rem; color: var(--o-muted); display: inline-flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: center; }

/* ---------- strip of files ---------- */
.ocr .ocr-strip-wrap { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.ocr .ocr-strip { display: flex; gap: 0.45rem; overflow-x: auto; padding: 2px 2px 0.45rem; flex: 1; min-width: 0; scrollbar-width: thin; }
.ocr .ocr-chip-file { position: relative; display: inline-flex; align-items: center; gap: 0.45rem; max-width: 230px; padding: 0.3rem 0.4rem 0.3rem 0.3rem; border-radius: 10px; border: 1px solid var(--o-line); background: var(--o-sunk); color: var(--o-t2); cursor: pointer; font-size: 0.8rem; flex-shrink: 0; }
.ocr .ocr-chip-file:focus-visible { outline: 2px solid var(--o-c); outline-offset: 1px; }
.ocr .ocr-chip-file.is-active { border-color: var(--o-c); background: var(--o-soft2); color: var(--o-t1); }
.ocr .ocr-chip-file.is-skipped { opacity: 0.45; }
.ocr .ocr-chip-img { width: 30px; height: 30px; border-radius: 6px; background: var(--o-card) center / cover no-repeat; border: 1px solid var(--o-line); flex-shrink: 0; }
.ocr .ocr-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ocr .ocr-chip-conf { font-size: 0.72rem; font-weight: 700; color: var(--o-muted); font-variant-numeric: tabular-nums; }
.ocr .ocr-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: none; border-radius: 6px; background: none; color: var(--o-muted); cursor: pointer; padding: 0; }
.ocr .ocr-chip-x:hover { background: rgba(100, 116, 139, 0.15); color: var(--o-t1); }
.ocr .ocr-chip-x svg { width: 14px; height: 14px; }
.ocr .ocr-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--o-line); }
.ocr .ocr-dot.is-ok { background: #339966; }
.ocr .ocr-dot.is-warn { background: #d97706; }
.ocr .ocr-dot.is-fail, .ocr .ocr-dot.is-empty { background: #e64e4e; }
.ocr .ocr-dot.is-work { background: var(--o-c); animation: ocrPulse 0.9s ease-in-out infinite; }
.ocr .ocr-dot.is-skip { background: transparent; border: 1px dashed var(--o-muted); }
@keyframes ocrPulse { 50% { opacity: 0.3; } }

/* ---------- work grid ---------- */
.ocr .ocr-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ocr .ocr-grid > * { min-width: 0; }
.ocr .ocr-left { position: sticky; top: 12px; }
.ocr .ocr-stagebar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; min-height: 36px; }
.ocr .ocr-stage-name { font-size: 0.84rem; color: var(--o-t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ocr .ocr-stage-name .ocr-muted { font-size: 0.78rem; }
.ocr .ocr-tools { display: inline-flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }
.ocr .ocr-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 260px; max-height: 560px; padding: 12px; border-radius: 14px; background: var(--o-stage); border: 1px solid var(--o-line); overflow: hidden; }
.ocr .ocr-frame { --fh: 536px; position: relative; width: min(100%, calc(var(--fh) * var(--ar, 1))); aspect-ratio: var(--ar, 1); line-height: 0; user-select: none; -webkit-user-select: none; touch-action: pan-y pinch-zoom; }
.ocr .ocr-frame .ocr-view { display: block; width: 100%; height: 100%; object-fit: contain; box-shadow: 0 1px 6px rgba(15, 23, 42, 0.15); background: #fff; }
.ocr .ocr-frame.is-crop { cursor: crosshair; touch-action: none; }
.ocr .ocr-frame.is-select { cursor: text; }
.ocr .ocr-boxes { position: absolute; inset: 0; pointer-events: none; }
.ocr .ocr-w { position: absolute; border-radius: 2px; }
.ocr .ocr-frame.is-select .ocr-w { outline: 1px solid color-mix(in srgb, var(--o-c) 28%, transparent); }
.ocr .ocr-w.is-low { box-shadow: inset 0 -2px 0 var(--o-low); background: rgba(245, 158, 11, 0.14); }
.ocr .ocr-w.is-sel { background: var(--o-sel); outline: 1px solid var(--o-c) !important; }
.ocr .ocr-crop { position: absolute; border: 2px solid var(--o-c); box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.42); pointer-events: none; border-radius: 2px; }
.ocr .ocr-rubber { position: absolute; border: 1.5px dashed var(--o-c); background: var(--o-soft2); pointer-events: none; }
.ocr .ocr-rubber.is-crop { background: transparent; border-style: solid; }
.ocr .ocr-stage-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--o-stage) 70%, transparent); }
.ocr .ocr-stagehint { margin: 0.55rem 0 0; font-size: 0.8rem; color: var(--o-muted); line-height: 1.5; }
.ocr .ocr-stagehint svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.ocr .ocr-low-key { display: inline-block; padding: 0 0.35rem; border-radius: 4px; background: rgba(245, 158, 11, 0.16); box-shadow: inset 0 -2px 0 var(--o-low); color: var(--o-t1); font-weight: 600; }

/* ---------- segmented buttons ---------- */
.ocr .ocr-segs { display: inline-flex; border: 1px solid var(--o-line); border-radius: 10px; overflow: hidden; background: var(--o-sunk); max-width: 100%; }
.ocr .ocr-segs button { display: inline-flex; align-items: center; gap: 0.3rem; border: none; background: none; padding: 0.4rem 0.7rem; font-size: 0.8rem; font-weight: 600; color: var(--o-t2); cursor: pointer; min-height: 34px; white-space: nowrap; }
.ocr .ocr-segs button + button { border-left: 1px solid var(--o-line); }
.ocr .ocr-segs button svg { width: 15px; height: 15px; }
.ocr .ocr-segs button.is-active { background: var(--o-soft2); color: var(--o-strong); }
.ocr .ocr-segs button:hover { color: var(--o-t1); }
.ocr .ocr-segs-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.ocr .ocr-segs-wrap button { justify-content: center; border-left: none !important; border-top: 1px solid var(--o-line); margin-top: -1px; box-shadow: 1px 0 0 var(--o-line); }
.ocr .ocr-segs-ic button span { display: inline; }

/* ---------- settings panel ---------- */
.ocr .ocr-block { background: var(--o-card); border: 1px solid var(--o-line); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 0.875rem; }
.ocr .ocr-presets { padding: 0.85rem 1rem; }
.ocr .ocr-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ocr .ocr-chips:empty { display: none; }
.ocr .ocr-user-presets { margin-top: 0.4rem; }
.ocr .ocr-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--o-line); background: var(--o-sunk); color: var(--o-t2); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.ocr .ocr-chip svg { width: 14px; height: 14px; color: var(--o-c); }
.ocr .ocr-chip:hover { border-color: var(--o-line-c); color: var(--o-t1); }
.ocr .ocr-chip.is-active { background: var(--o-soft2); border-color: var(--o-c); color: var(--o-strong); }
.ocr .ocr-uchip { padding: 0; overflow: hidden; }
.ocr .ocr-uchip button { display: inline-flex; align-items: center; gap: 0.35rem; border: none; background: none; color: inherit; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 0.35rem 0.3rem 0.35rem 0.7rem; }
.ocr .ocr-uchip .ocr-uchip-x { padding: 0.35rem 0.5rem 0.35rem 0.2rem; color: var(--o-muted); }
.ocr .ocr-uchip .ocr-uchip-x:hover { color: var(--o-bad); }
.ocr .ocr-uchip .ocr-uchip-x svg { width: 13px; height: 13px; color: inherit; }
.ocr .ocr-main-label { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.55rem; font-size: 0.95rem; font-weight: 700; color: var(--o-t1); }
.ocr .ocr-main-label svg { width: 18px; height: 18px; color: var(--o-c); }
.ocr .ocr-select { position: relative; }
.ocr .ocr-select select { width: 100%; appearance: none; -webkit-appearance: none; min-height: 46px; padding: 0.55rem 2.4rem 0.55rem 0.85rem; border-radius: 12px; border: 1px solid var(--o-line); background: var(--o-sunk); color: var(--o-t1); font: inherit; font-size: 0.97rem; font-weight: 600; cursor: pointer; margin: 0; }
.ocr .ocr-select select:focus { outline: none; border-color: var(--o-c); box-shadow: 0 0 0 3px var(--o-soft2); }
.ocr .ocr-select > svg { position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--o-muted); pointer-events: none; }
.ocr .ocr-select-sm select { min-height: 38px; font-size: 0.86rem; font-weight: 500; border-radius: 10px; }
.ocr .ocr-select option { background: var(--o-card); color: var(--o-t1); }
.ocr .ocr-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.ocr .ocr-qchip { padding: 0.22rem 0.6rem; border-radius: 999px; border: 1px solid var(--o-line); background: none; color: var(--o-t2); font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.ocr .ocr-qchip:hover { border-color: var(--o-line-c); color: var(--o-t1); }
.ocr .ocr-qchip.is-active { background: var(--o-soft2); border-color: var(--o-c); color: var(--o-strong); }
.ocr .ocr-lang2 { margin-top: 0.75rem; }
.ocr .ocr-lang2 label { display: block; margin-bottom: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--o-t2); }

/* compact one-line option rows (ConvertICO standard, image-resizer pattern) */
.ocr .ocr-options { background: var(--o-card); border: 1px solid var(--o-line); border-radius: 14px; overflow: hidden; margin-bottom: 0.875rem; }
.ocr .ocr-row + .ocr-row { border-top: 1px solid var(--o-line); }
.ocr .ocr-row-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.9rem; min-height: 52px; background: none; border: none; cursor: pointer; text-align: left; color: var(--o-t1); transition: background-color 0.15s ease; }
.ocr .ocr-row-head:hover, .ocr .ocr-row.open .ocr-row-head, .ocr .ocr-row.open .ocr-row-body { background: var(--o-open); }
.ocr .ocr-row-head:focus-visible { outline: 2px solid var(--o-c); outline-offset: -2px; }
.ocr .ocr-row-left { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; }
.ocr .ocr-row-left > svg { width: 17px; height: 17px; color: var(--o-c); }
.ocr .ocr-row-text { display: flex; flex-direction: column; min-width: 0; }
.ocr .ocr-row-title { font-size: 0.87rem; font-weight: 700; color: var(--o-t1); }
.ocr .ocr-row-hint { font-size: 0.74rem; color: var(--o-muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr .ocr-row-right { display: inline-flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.ocr .ocr-value { font-size: 0.76rem; font-weight: 700; color: var(--o-strong); background: var(--o-soft2); border-radius: 6px; padding: 0.15rem 0.5rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr .ocr-chevron { width: 17px; height: 17px; color: var(--o-muted); transition: transform 0.2s ease; }
.ocr .ocr-row.open .ocr-chevron { transform: rotate(180deg); }
.ocr .ocr-row-body { padding: 0.2rem 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; animation: ocrReveal 0.18s ease; }
.ocr .ocr-row-body .ocr-hint { margin: 0; }
@keyframes ocrReveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.ocr .ocr-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--o-t2); }
.ocr .ocr-field input { min-height: 40px; padding: 0.45rem 0.7rem; border-radius: 10px; border: 1px solid var(--o-line); background: var(--o-card); color: var(--o-t1); font: inherit; font-size: 0.9rem; margin: 0; }
.ocr .ocr-field input:focus { outline: none; border-color: var(--o-c); box-shadow: 0 0 0 3px var(--o-soft2); }

/* switches - must beat the global checkbox restyle in custom_styles.css */
.ocr .ocr-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; cursor: pointer; padding: 0.15rem 0; }
.ocr .ocr-switch-text { display: flex; flex-direction: column; min-width: 0; }
.ocr .ocr-switch-text strong { font-size: 0.85rem; font-weight: 600; color: var(--o-t1); }
.ocr .ocr-switch-text small { font-size: 0.74rem; color: var(--o-muted); line-height: 1.35; }
.ocr .ocr-switch { position: relative; display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }
.ocr .ocr-switch input[type="checkbox"] {
    position: absolute !important; left: 0 !important; top: 50% !important; width: 40px !important; height: 24px !important; margin: -12px 0 0 0 !important;
    opacity: 0 !important; z-index: 2; cursor: pointer; border: none !important; background: none !important; -webkit-appearance: none !important; appearance: none !important; box-shadow: none !important;
}
.ocr .ocr-switch input[type="checkbox"]::after, .ocr .ocr-switch input[type="checkbox"]::before { content: none !important; display: none !important; }
.ocr .ocr-switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: color-mix(in srgb, var(--o-muted) 35%, transparent); transition: background 0.18s; }
.ocr .ocr-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s; }
.ocr .ocr-switch input:checked + .ocr-switch-track { background: var(--o-go); }
.ocr .ocr-switch input:checked + .ocr-switch-track::after { transform: translateX(16px); }
.ocr .ocr-switch input:focus-visible + .ocr-switch-track { outline: 2px solid var(--o-c); outline-offset: 2px; }
.ocr .ocr-switch-state { width: 26px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; color: var(--o-muted); }

.ocr .ocr-stale { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--o-warn-soft); border: 1px solid rgba(217, 119, 6, 0.35); color: var(--o-t1); font-size: 0.84rem; font-weight: 600; }
.ocr .ocr-stale svg { width: 16px; height: 16px; color: var(--o-warn); }
.ocr .ocr-go-row { display: flex; }
.ocr .ocr-go-big { width: 100% !important; min-height: 52px; font-size: 1.02rem; border-radius: 14px; }
.ocr .ocr-save-preset { margin-top: 0.6rem; text-align: center; }

/* ---------- results ---------- */
.ocr .ocr-out-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.ocr .ocr-verdict { display: flex; align-items: flex-start; gap: 0.7rem; min-width: 0; flex: 1 1 320px; }
.ocr .ocr-verdict strong { display: block; font-size: 1.12rem; color: var(--o-t1); margin-bottom: 0.1rem; }
.ocr .ocr-verdict span:not(.ocr-verdict-ic) { display: block; font-size: 0.88rem; color: var(--o-t2); line-height: 1.5; }
.ocr .ocr-verdict-ic { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ocr .ocr-verdict-ic svg { width: 22px; height: 22px; }
.ocr .ocr-verdict-ic.is-ok { background: var(--o-ok-soft); color: var(--o-ok); }
.ocr .ocr-verdict-ic.is-warn { background: var(--o-warn-soft); color: var(--o-warn); }
.ocr .ocr-verdict-ic.is-bad { background: var(--o-bad-soft); color: var(--o-bad); }
.ocr .ocr-verdict-ic.is-wait { background: var(--o-sunk); color: var(--o-muted); }
.ocr .ocr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.ocr .ocr-kpis:empty { display: none; }
.ocr .ocr-kpi { padding: 0.6rem 0.8rem; border-radius: 12px; background: var(--o-sunk); border: 1px solid var(--o-line); min-width: 0; }
.ocr .ocr-kpi span { display: block; font-size: 0.72rem; color: var(--o-muted); font-weight: 600; }
.ocr .ocr-kpi strong { display: block; font-size: 1.1rem; color: var(--o-t1); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ocr .ocr-viewbar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.ocr .ocr-viewtools { display: inline-flex; gap: 0.2rem; }
.ocr .ocr-findbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.ocr .ocr-findbar input { flex: 1 1 150px; min-width: 0; min-height: 36px; padding: 0.35rem 0.65rem; border-radius: 10px; border: 1px solid var(--o-line); background: var(--o-card); color: var(--o-t1); font: inherit; font-size: 0.86rem; margin: 0; }
.ocr .ocr-findbar input:focus { outline: none; border-color: var(--o-c); }
.ocr .ocr-findbar .ocr-muted { font-size: 0.8rem; }
.ocr .ocr-textwrap textarea {
    display: block; width: 100%; min-height: 260px; max-height: 70vh; resize: vertical; box-sizing: border-box; margin: 0;
    padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--o-line); background: var(--o-sunk); color: var(--o-t1);
    font-family: var(--o-mono); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ocr .ocr-textwrap textarea:focus { outline: none; border-color: var(--o-c); box-shadow: 0 0 0 3px var(--o-soft2); background: var(--o-card); }
.ocr .ocr-textwrap textarea:read-only { cursor: default; }
.ocr .ocr-table-name { display: flex; align-items: center; gap: 0.4rem; margin: 0.9rem 0 0.4rem; font-size: 0.86rem; font-weight: 700; color: var(--o-t1); }
.ocr .ocr-table-name svg { width: 16px; height: 16px; color: var(--o-c); }
.ocr .ocr-table-scroll { overflow: auto; max-height: 520px; border: 1px solid var(--o-line); border-radius: 12px; background: var(--o-card); }
.ocr .ocr-table { border-collapse: collapse; font-size: 0.86rem; min-width: 100%; }
.ocr .ocr-table th, .ocr .ocr-table td { border: 1px solid var(--o-line); padding: 0.4rem 0.6rem; text-align: left; color: var(--o-t1); white-space: pre-wrap; min-width: 64px; }
.ocr .ocr-table thead th { position: sticky; top: 0; background: var(--o-sunk); color: var(--o-muted); font-size: 0.72rem; font-weight: 700; text-align: center; z-index: 1; }
.ocr .ocr-table tbody th { background: var(--o-sunk); color: var(--o-muted); font-size: 0.72rem; font-weight: 700; width: 36px; min-width: 36px; text-align: center; }
.ocr .ocr-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ocr .ocr-table tr.is-head td { font-weight: 700; background: var(--o-soft); }
.ocr .ocr-table td:focus { outline: 2px solid var(--o-c); outline-offset: -2px; background: var(--o-card); }
.ocr .ocr-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding: 0.55rem 0.75rem; border-radius: 12px; background: var(--o-soft); border: 1px solid var(--o-line-c); font-size: 0.85rem; color: var(--o-t1); }
.ocr .ocr-selbar > span { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* action bar + menus + next */
.ocr .ocr-actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--o-line); }
.ocr .ocr-spacer { flex: 1 1 auto; }
.ocr .ocr-menu-wrap { position: relative; }
.ocr .ocr-caret { width: 15px !important; height: 15px !important; margin-left: -0.1rem; }
.ocr .ocr-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 50; min-width: 250px; padding: 0.35rem; border-radius: 12px; border: 1px solid var(--o-line); background: var(--o-card); box-shadow: var(--shadow-md); }
.ocr .ocr-actionbar > .ocr-menu-wrap:first-of-type .ocr-menu { right: auto; left: 0; }
.ocr .ocr-menu button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.55rem 0.7rem; border: none; border-radius: 8px; background: none; color: var(--o-t1); font-size: 0.88rem; font-weight: 600; cursor: pointer; text-align: left; }
.ocr .ocr-menu button small { margin-left: auto; padding-left: 0.6rem; font-weight: 400; font-size: 0.74rem; color: var(--o-muted); }
.ocr .ocr-menu button:hover { background: var(--o-soft); }
.ocr .ocr-menu svg { width: 16px; height: 16px; color: var(--o-c); }
.ocr .ocr-next { margin-top: 1rem; }
.ocr .ocr-next:empty { display: none; }
.ocr .ocr-next-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ocr .ocr-next-link { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.85rem; border-radius: 10px; border: 1px solid var(--o-line); background: var(--o-sunk); color: var(--o-t1); font-size: 0.86rem; font-weight: 600; text-decoration: none; }
.ocr .ocr-next-link:hover { border-color: var(--o-c); color: var(--o-strong); }
.ocr .ocr-next-link svg { width: 16px; height: 16px; color: var(--o-c); }

/* ---------- recent ---------- */
.ocr .ocr-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.ocr .ocr-recent-head .ocr-muted { font-size: 0.78rem; }
.ocr .ocr-recent-list { display: grid; gap: 0.45rem; }
.ocr .ocr-recent-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: 12px; border: 1px solid var(--o-line); background: var(--o-sunk); min-width: 0; }
.ocr .ocr-recent-thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--o-card) center / cover no-repeat; border: 1px solid var(--o-line); flex-shrink: 0; }
.ocr .ocr-recent-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ocr .ocr-recent-meta strong { font-size: 0.86rem; color: var(--o-t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr .ocr-recent-meta span { font-size: 0.74rem; color: var(--o-muted); }
.ocr .ocr-recent-meta em { font-style: normal; font-size: 0.78rem; color: var(--o-t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr .ocr-recent-act { display: inline-flex; flex-shrink: 0; }

/* ---------- progress overlay (compress-gif standard) ---------- */
.ocr .ocr-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ocr .ocr-progress { min-width: 340px; max-width: 440px; width: 100%; padding: 1.5rem 1.4rem 1.2rem; border-radius: 18px; background: var(--o-card); border: 1px solid var(--o-line); box-shadow: var(--shadow-lg); text-align: center; }
.ocr .ocr-stages { display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.ocr .ocr-stage-dot { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border-radius: 50%; background: var(--o-sunk); color: var(--o-muted); border: 1px solid var(--o-line); transition: background 0.2s, color 0.2s; }
.ocr .ocr-stage-dot svg { width: 20px; height: 20px; }
.ocr .ocr-stage-dot.active { background: var(--o-go); color: #fff; border-color: var(--o-go); }
.ocr .ocr-stage-dot.done { background: #339966; color: #fff; border-color: #339966; }
.ocr .ocr-stage-line { width: 28px; height: 2px; background: var(--o-line); }
.ocr .ocr-stage-line.done { background: #339966; }
.ocr .ocr-progress-title { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 700; color: var(--o-t1); min-height: 1.5em; }
.ocr .ocr-progress-sub { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--o-muted); min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr .ocr-bar { height: 8px; border-radius: 999px; background: var(--o-sunk); overflow: hidden; }
.ocr .ocr-bar span { display: block; height: 100%; width: 0; background: var(--o-go); border-radius: 999px; transition: width 0.3s ease; }
.ocr .ocr-pct { margin: 0.45rem 0 0.8rem; font-size: 0.95rem; font-weight: 700; color: var(--o-t1); font-variant-numeric: tabular-nums; }

/* ---------- info section (below the tool) ---------- */
.ocr-page .ocr-info { margin-top: 2rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.ocr-page .ocr-info > * { min-width: 0; }
.ocr-page .ocr-info .info-card { background: var(--bg-elevated, #fff); border: 1px solid var(--o-line); border-radius: var(--radius-md, 12px); padding: 1.4rem 1.5rem; box-shadow: none; }
.ocr-page .ocr-info .info-card h2 { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.9rem; font-size: 1.25rem; color: var(--o-t1); }
.ocr-page .ocr-info .info-card h2 svg { width: 22px; height: 22px; color: var(--o-c); flex-shrink: 0; }
.ocr-page .ocr-info .info-card p, .ocr-page .ocr-info .info-card li { color: var(--o-t2); line-height: 1.65; font-size: 0.97rem; }
.ocr-page .ocr-info .info-card p { margin: 0.8rem 0 0; }
.ocr-page .ocr-info .info-card h2 + p { margin-top: 0; }
.ocr-page .ocr-info .info-card p + ul, .ocr-page .ocr-info .info-card ul + p, .ocr-page .ocr-info .info-card .ocr-table-wrap + p { margin-top: 0.8rem; }
.ocr-page .ocr-info a { color: var(--o-strong); font-weight: 500; }
.ocr-page .ocr-info ul, .ocr-page .ocr-info ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.ocr-page .ocr-info .faq-list { display: block; }
.ocr-page .ocr-info .ocr-table-wrap { overflow-x: auto; border: 1px solid var(--o-line); border-radius: 10px; }
.ocr-page .ocr-info .ocr-itable { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
.ocr-page .ocr-info .ocr-itable th, .ocr-page .ocr-info .ocr-itable td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--o-line); color: var(--o-t2); vertical-align: top; }
.ocr-page .ocr-info .ocr-itable th { background: var(--o-sunk); color: var(--o-t1); font-weight: 700; font-size: 0.82rem; }
.ocr-page .ocr-info .ocr-itable tr:last-child td { border-bottom: none; }
.ocr-page .ocr-info .ocr-itable td:first-child { font-weight: 700; color: var(--o-t1); white-space: nowrap; }
.ocr-page .faq-card .faq-question svg { width: 18px; height: 18px; flex-shrink: 0; }
.ocr-page .ocr-noscript { padding: 1rem; border: 1px dashed var(--o-line); border-radius: 12px; color: var(--o-t2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .ocr .ocr-grid { grid-template-columns: minmax(0, 1fr); }
    .ocr .ocr-left { position: static; }
    .ocr .ocr-stage { max-height: 420px; min-height: 200px; }
    .ocr .ocr-frame { --fh: 396px; }
}
@media (max-width: 600px) {
    .ocr-page.tool-container { padding: 1.1rem 16px; }
    .ocr-page .tool-title { font-size: 1.6rem; }
    .ocr-page .ocr-title-icon { width: 46px; height: 46px; border-radius: 13px; }
    .ocr-page .ocr-title-icon svg { width: 25px; height: 25px; }
    .ocr-page .tool-description { font-size: 0.98rem; }
    .ocr .ocr-card { padding: 1rem; border-radius: 16px; }
    .ocr .ocr-drop { min-height: 180px; }
    .ocr .ocr-samples { margin-left: 0; }
    .ocr .ocr-pill:nth-of-type(n+3) { display: none; }
    .ocr .ocr-segs-ic button span { display: none; }
    .ocr .ocr-stage { padding: 8px; }
    .ocr .ocr-block { padding: 0.85rem 0.9rem; }
    .ocr .ocr-row-head { padding: 0.55rem 0.75rem; }
    .ocr .ocr-row-body { padding: 0.2rem 0.75rem 0.85rem; }
    .ocr .ocr-value { max-width: 92px; }
    .ocr .ocr-progress { min-width: 0; }
    .ocr .ocr-actionbar > .ocr-btn, .ocr .ocr-actionbar > .ocr-menu-wrap { flex: 1 1 40%; }
    .ocr .ocr-actionbar .ocr-btn { padding: 0.55rem 0.6rem; font-size: 0.88rem; }
    .ocr .ocr-actionbar > .ocr-go { order: -1; flex-basis: 100%; }
    .ocr .ocr-recent-head .ocr-muted { display: none; }
    .ocr .ocr-actionbar .ocr-menu-wrap .ocr-btn { width: 100%; }
    .ocr .ocr-spacer { display: none; }
    .ocr .ocr-menu { left: 0; right: auto; min-width: 0; width: max(100%, 240px); }
    .ocr .ocr-actionbar > .ocr-menu-wrap:nth-of-type(2) .ocr-menu { left: auto; right: 0; }
    .ocr .ocr-textwrap textarea { min-height: 220px; font-size: 0.86rem; }
    .ocr .ocr-recent-act .ocr-x:nth-child(2) { display: none; }
}
