:root {
  color-scheme: light;
  --ink: #101629;
  --ink-soft: #28314b;
  --paper: #f7f3e8;
  --paper-bright: #fffdf8;
  --line: #d8d3c6;
  --muted: #5a5f69;
  --coral: #ff8b5f;
  --coral-dark: #a93f20;
  --aqua: #7ee0d0;
  --blue: #4867d8;
  --shadow: 0 18px 50px rgba(16, 22, 41, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input { font: inherit; }
button { color: inherit; }
.app-frame { min-height: 100vh; }
.topbar {
  min-height: 68px;
  padding: 0 3.5vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  color: #fff;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: #fff; text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; position: relative; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.35); font-family: Georgia, serif; font-size: 20px; }
.brand-mark span { position: absolute; right: -5px; bottom: -7px; color: var(--coral); font-family: system-ui; font-size: 15px; font-weight: 900; }
.privacy-note { display: flex; align-items: center; gap: 9px; font-size: .83rem; color: rgba(255,255,255,.72); }
.privacy-note strong { color: var(--aqua); margin-right: 5px; font-weight: 700; }
.shield { color: var(--aqua); font-size: 10px; transform: rotate(45deg); }
.text-button { justify-self: end; border: 0; background: transparent; color: #fff; padding: 10px 0; cursor: pointer; font-weight: 650; border-bottom: 1px solid rgba(255,255,255,.45); }
.text-button:hover { color: var(--coral); border-color: var(--coral); }
main { width: min(1520px, 94vw); margin: 0 auto; }
.intro { padding: 34px 0 24px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 40px; align-items: end; }
.eyebrow, .section-label { margin: 0 0 6px; color: var(--coral-dark); text-transform: uppercase; font-size: .72rem; line-height: 1.2; font-weight: 850; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 780px; margin-bottom: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 4vw, 4.3rem); line-height: .98; font-weight: 500; letter-spacing: -.045em; }
.intro-copy { max-width: 620px; margin-bottom: 4px; color: var(--ink-soft); font-size: 1.02rem; }
.workbench { display: grid; grid-template-columns: minmax(250px, .78fr) minmax(420px, 1.45fr) minmax(290px, .88fr); gap: 12px; align-items: stretch; }
.panel { background: var(--paper-bright); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.panel-heading { min-height: 85px; display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 1.02rem; line-height: 1.2; letter-spacing: -.015em; }
.panel-heading .section-label { margin-bottom: 3px; color: var(--muted); font-size: .65rem; }
.step-number { font: italic 1.55rem/1 Georgia, serif; color: var(--coral-dark); }
.import-panel, .settings-panel { display: flex; flex-direction: column; }
.dropzone { margin: 18px; min-height: 210px; padding: 26px 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1.5px dashed #9da1a9; background: #fbfaf5; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--coral-dark); background: #fff4ed; transform: translateY(-2px); }
.dropzone:focus-within { outline: 3px solid var(--coral-dark); outline-offset: 3px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-icon { color: var(--blue); margin-bottom: 10px; }
.drop-title { font-weight: 800; }
.drop-help { color: var(--muted); font-size: .92rem; }
.linkish { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.drop-limit { margin-top: 16px; color: var(--muted); font-size: .72rem; }
.file-list { padding: 0 18px 16px; }
.empty-files { padding: 14px 0; display: flex; flex-direction: column; gap: 4px; color: var(--muted); border-top: 1px solid var(--line); }
.empty-files small { font-size: .76rem; }
.file-item { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; background: #f1f4ff; border: 1px solid #cfd6ef; }
.file-icon { width: 36px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--blue); font-size: .72rem; font-weight: 900; border-radius: 2px 8px 2px 2px; }
.file-meta { min-width: 0; }
.file-meta strong, .file-meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta strong { font-size: .87rem; }
.file-meta span { color: var(--muted); font-size: .73rem; }
.finding-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 6px; }
.finding-filters label { display: grid; gap: 3px; color: var(--muted); font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.finding-filters select { min-width: 92px; padding: 5px 6px; color: var(--ink); background: var(--paper-bright); border: 1px solid var(--line); font: inherit; font-size: .68rem; text-transform: none; letter-spacing: 0; }
.remove-file { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 7px; font-size: 1.1rem; }
.local-proof { margin-top: auto; padding: 15px 18px; display: flex; gap: 10px; background: var(--ink); color: #fff; }
.proof-icon { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; background: var(--aqua); color: var(--ink); font-weight: 900; border-radius: 50%; }
.local-proof .proof-icon { color: var(--ink); }
.local-proof strong, .local-proof span { display: block; }
.local-proof strong { font-size: .82rem; }
.local-proof span { color: rgba(255,255,255,.65); font-size: .72rem; }
.preview-panel { display: flex; flex-direction: column; }
.preview-heading { position: relative; }
.status-badge { margin-left: auto; padding: 5px 8px; color: #6e4519; background: #ffe8b0; border: 1px solid #e7c36c; font-size: .68rem; font-weight: 760; white-space: nowrap; }
.document-stage { position: relative; flex: 1; min-height: 460px; padding: 28px; overflow: hidden; background: #e9e8e2; }
.stage-grid { position: absolute; inset: 0; opacity: .25; background-image: linear-gradient(#a8abb2 1px, transparent 1px), linear-gradient(90deg, #a8abb2 1px, transparent 1px); background-size: 24px 24px; mask-image: linear-gradient(to bottom, black, transparent 90%); }
.empty-preview { position: relative; z-index: 1; min-height: 395px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.empty-preview p { max-width: 360px; color: var(--muted); text-align: center; font-size: .91rem; }
.paper-stack { position: relative; width: 182px; height: 230px; }
.paper-back, .paper-front { position: absolute; inset: 0; background: var(--paper-bright); border: 1px solid #c4c1b8; box-shadow: 0 12px 28px rgba(16,22,41,.14); }
.paper-back { transform: rotate(5deg) translate(12px, -2px); background: #e7e3d9; }
.paper-front { padding: 27px 22px; transform: rotate(-2deg); }
.paper-front span { display: block; }
.paper-kicker { width: 35%; height: 5px; background: var(--coral); margin-bottom: 16px; }
.paper-title { width: 88%; height: 12px; background: var(--ink); margin-bottom: 7px; }
.paper-title.short { width: 55%; }
.paper-image { height: 74px; margin: 22px 0 16px; background: linear-gradient(135deg, #6d78a7, #bbc4e6); }
.paper-line { width: 100%; height: 4px; margin-bottom: 8px; background: #b6b3ad; }
.paper-line.short { width: 65%; }
.analysis-view { position: relative; z-index: 1; min-height: 405px; display: grid; grid-template-columns: 1.08fr .92fr; gap: 24px; align-items: center; }
.page-preview { width: min(100%, 290px); aspect-ratio: .72; justify-self: end; background: #fff; box-shadow: 0 16px 35px rgba(16,22,41,.2); transform: rotate(-1.2deg); overflow: hidden; }
.native-preview { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.preview-pages { display: flex; gap: 8px; width: min(100%, 290px); margin: 16px auto 0; overflow-x: auto; padding: 2px 2px 8px; }
.preview-page-button { flex: 0 0 42px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper-bright); cursor: pointer; }
.preview-page-button[aria-current="page"] { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(232,90,69,.18); }
.preview-page-button:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
.preview-page-button img { display: block; width: 100%; aspect-ratio: .72; object-fit: contain; background: #fff; }
.preview-band { height: 26%; display: grid; place-items: center; color: var(--paper); background: var(--ink); font: 700 3.3rem/1 Georgia, serif; }
.preview-content { padding: 9% 10%; }
.preview-overline { color: var(--coral-dark); text-transform: uppercase; font-size: .58rem; font-weight: 800; letter-spacing: .12em; }
.preview-content strong { display: block; margin: 6px 0 17px; font: 600 1.2rem/1.08 Georgia, serif; overflow-wrap: anywhere; }
.preview-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preview-columns span { height: 50px; background: repeating-linear-gradient(to bottom, #c4c6ca 0 2px, transparent 2px 7px); }
.preview-photo { height: 75px; margin-top: 14px; background: linear-gradient(135deg, var(--aqua), #4b6caa); }
.inspection-card { padding: 18px; background: rgba(255,253,248,.93); border: 1px solid var(--line); box-shadow: 0 12px 25px rgba(16,22,41,.08); }
.inspection-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: .77rem; font-weight: 800; }
.status-chip { padding: 3px 7px; color: #146351; background: #d8f7ef; }
.inspection-card dl { margin: 10px 0; }
.inspection-card dl div { padding: 7px 0; display: flex; justify-content: space-between; gap: 12px; }
.inspection-card dt { color: var(--muted); font-size: .76rem; }
.inspection-card dd { margin: 0; text-align: right; font-size: .77rem; font-weight: 730; }
.inspection-card p { margin: 10px 0 0; color: var(--muted); font-size: .72rem; }
.finding-list { margin: 13px 0 0; padding: 10px 0 0; display: grid; gap: 7px; border-top: 1px solid var(--line); list-style: none; }
.finding-list li { display: grid; grid-template-columns: 8px 1fr; gap: 7px; align-items: start; color: var(--ink-soft); font-size: .68rem; line-height: 1.25; }
.finding-list li::before { content: ''; width: 7px; height: 7px; margin-top: 3px; background: var(--aqua); border-radius: 50%; }
.finding-list li.warning::before { background: #f0bd56; }
.finding-list li.error::before { background: #e85a45; }
.finding-list strong { display: block; font-size: .69rem; }
.finding-list span { display: block; color: var(--muted); }
.preservation-row { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line); }
.preservation-row > div { min-width: 0; padding: 14px; display: flex; align-items: center; gap: 9px; border-right: 1px solid var(--line); }
.preservation-row > div:last-child { border-right: 0; }
.quality-mark { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; font-family: Georgia, serif; font-weight: 700; border-radius: 50%; }
.quality-mark.excellent { color: #075f50; background: #c8f2e9; }
.quality-mark.good { color: #6e4519; background: #ffe4a0; }
.quality-mark.neutral { color: #4b5368; background: #e8ebf2; font-family: system-ui, sans-serif; font-size: .65rem; }
.preservation-row p { min-width: 0; margin: 0; }
.preservation-row strong, .preservation-row span { display: block; }
.preservation-row strong { font-size: .75rem; }
.preservation-row p span { color: var(--muted); font-size: .66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.output-options { margin: 0; padding: 16px 18px 0; border: 0; display: grid; gap: 8px; }
.format-option { position: relative; min-height: 59px; padding: 9px 36px 9px 9px; display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; background: #fbfaf5; border: 1px solid var(--line); cursor: pointer; transition: border .16s, background .16s; }
.format-option:hover { border-color: #8f96a9; }
.format-option:focus-within { outline: 3px solid var(--coral-dark); outline-offset: 2px; }
.format-option.selected { background: #f1f4ff; border-color: #8799dc; }
.format-option.disabled { cursor: not-allowed; opacity: .55; }
.format-option.disabled .checkmark { display: none; }
.format-option input { position: absolute; opacity: 0; }
.format-icon { width: 38px; height: 40px; display: grid; place-items: center; color: #fff; font-size: .65rem; font-weight: 900; }
.format-icon.pdf { background: #b73121; }
.format-icon.ppt { background: #c94d32; font-size: 1rem; }
.format-icon.svg { color: var(--ink); background: var(--aqua); }
.format-icon.doc { background: #2e62ba; font-size: 1rem; }
.format-option strong, .format-option small { display: block; }
.format-option strong { font-size: .82rem; }
.format-option small { color: var(--muted); font-size: .7rem; }
.checkmark { position: absolute; right: 12px; width: 19px; height: 19px; display: none; place-items: center; color: #fff; background: var(--blue); border-radius: 50%; font-size: .72rem; }
.format-option.selected .checkmark { display: grid; }
.strategy-block { padding: 16px 18px; }
.setting-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .78rem; font-weight: 780; }
.info-button { width: 20px; height: 20px; padding: 0; border: 1px solid #9a9ea8; background: transparent; color: var(--muted); border-radius: 50%; font: italic 700 .7rem Georgia, serif; cursor: help; }
.segment-control { display: grid; grid-template-columns: repeat(3,1fr); background: #e5e4df; padding: 3px; }
.segment-control button { padding: 8px 3px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 720; }
.segment-control button[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: 0 3px 8px rgba(16,22,41,.2); }
.advanced-options { margin: 0 18px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-options summary { list-style: none; padding: 12px 0; display: flex; justify-content: space-between; cursor: pointer; font-size: .78rem; font-weight: 780; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary span { color: var(--muted); font-weight: 500; }
.option-list { padding: 0 0 12px; display: grid; gap: 8px; }
.option-list label { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .73rem; }
.option-list input { accent-color: var(--blue); }
.font-input-block { margin: 0 18px 14px; padding: 10px 12px; border: 1px dashed var(--line); background: rgba(255,255,255,.45); }
.font-input-block label { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; color: var(--ink-soft); font-size: .73rem; font-weight: 760; }
.font-input-block label small { color: var(--muted); font-weight: 500; }
.font-input-block input { display: block; width: 100%; margin-top: 7px; font-size: .7rem; color: var(--ink-soft); }
.font-input-block p { margin: 7px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.primary-action { margin: auto 18px 10px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; border: 0; background: var(--coral); color: var(--ink); cursor: pointer; font-weight: 850; box-shadow: 5px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s, opacity .15s; }
.primary-action:not(:disabled):hover { transform: translate(2px,2px); box-shadow: 3px 3px 0 var(--ink); }
.primary-action:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.cancel-action { margin: 0 18px 10px; padding: 6px 0; color: var(--muted); background: transparent; border: 0; font: inherit; font-size: .72rem; text-decoration: underline; cursor: pointer; }
.conversion-progress { display: grid; gap: 6px; margin: 0 18px 12px; color: var(--muted); font-size: .72rem; }
.progress-bar { height: 6px; overflow: hidden; background: var(--paper); border: 1px solid rgba(22,27,47,.18); border-radius: 999px; }
.progress-bar span { display: block; width: 0; height: 100%; background: var(--aqua); transition: width .2s ease; }
.completed-outputs { margin: 0 18px 12px; padding: 12px; border: 1px solid var(--line); background: var(--paper-bright); }
.completed-outputs-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.completed-outputs h3 { margin: 0; font-size: .8rem; }
.completed-outputs-heading span { color: var(--muted); font-size: .66rem; }
.completed-outputs ul { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.completed-outputs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .72rem; }
.completed-outputs li span { color: var(--muted); }
.completed-outputs a { color: var(--ink); font-weight: 800; text-decoration-thickness: 2px; }
.action-note { margin: 0 18px 17px; color: var(--muted); font-size: .68rem; line-height: 1.4; }
.format-guide { margin: 52px 0 40px; border-top: 3px solid var(--ink); }
.guide-heading { padding: 25px 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: end; }
.guide-heading h2 { margin: 0; font: 500 clamp(1.8rem,3vw,2.8rem)/1 Georgia, serif; letter-spacing: -.035em; }
.guide-heading > p { max-width: 520px; margin: 0; color: var(--muted); }
.guide-table { background: var(--paper-bright); border: 1px solid var(--line); }
.guide-row { min-height: 58px; padding: 0 18px; display: grid; grid-template-columns: 1fr 1fr 1fr 1.4fr; align-items: center; gap: 14px; border-top: 1px solid var(--line); }
.guide-row:first-child { border-top: 0; }
.guide-header { min-height: 38px; color: var(--muted); background: #eeece5; text-transform: uppercase; font-size: .65rem; font-weight: 800; letter-spacing: .09em; }
.guide-row > span { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .8rem; }
.meter { width: 35px; height: 5px; display: inline-block; background: #c6c7c8; }
.meter.high { background: var(--aqua); }
.meter.mid { background: #f0bd56; }
.meter.low { background: #c6c7c8; }
footer { min-height: 70px; padding: 0 3.5vw; display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.65); background: var(--ink); font-size: .75rem; }
footer span:first-child { color: #fff; font-weight: 800; }
dialog { width: min(560px, calc(100vw - 32px)); padding: 32px; color: var(--ink); background: var(--paper-bright); border: 1px solid var(--ink); box-shadow: 12px 12px 0 var(--coral); }
dialog::backdrop { background: rgba(16,22,41,.74); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 12px; font: 500 2.2rem/1 Georgia, serif; }
dialog > p:not(.eyebrow) { color: var(--muted); }
dialog ol { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 16px; }
dialog li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; }
dialog li > span { width: 29px; height: 29px; display: grid; place-items: center; color: #fff; background: var(--ink); border-radius: 50%; font-weight: 800; }
dialog li p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.dialog-close { position: absolute; top: 12px; right: 14px; padding: 4px 10px; border: 0; background: transparent; cursor: pointer; font-size: 1.8rem; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(390px, calc(100vw - 48px)); padding: 14px 18px; color: #fff; background: var(--ink); border-left: 5px solid var(--aqua); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

@media (max-width: 1160px) {
  .workbench { grid-template-columns: .85fr 1.3fr; }
  .settings-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .settings-panel .panel-heading { grid-column: 1 / -1; }
  .output-options { grid-row: span 3; }
  .primary-action { align-self: end; margin-top: 20px; }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  .privacy-note { display: none; }
  .text-button { font-size: .8rem; }
  main { width: min(94vw, 660px); }
  .intro { padding-top: 28px; grid-template-columns: 1fr; gap: 18px; }
  h1 { font-size: clamp(2.2rem, 12vw, 3.5rem); }
  .workbench { grid-template-columns: 1fr; }
  .settings-panel { grid-column: auto; display: flex; }
  .settings-panel .panel-heading { width: 100%; }
  .document-stage { min-height: 430px; padding: 18px; }
  .analysis-view { grid-template-columns: 1fr 1fr; gap: 12px; }
  .guide-heading { grid-template-columns: 1fr; gap: 14px; }
  .guide-row { grid-template-columns: 1fr 1fr 1fr; }
  .guide-row > *:last-child { display: none; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
}
@media (max-width: 470px) {
  .brand > span:last-child { font-size: .9rem; }
  .status-badge { display: none; }
  .analysis-view { grid-template-columns: 1fr; padding: 4px 10px; }
  .page-preview { width: 170px; justify-self: center; }
  .inspection-card { width: 100%; }
  .preservation-row { grid-template-columns: 1fr; }
  .preservation-row > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .preservation-row > div:last-child { border-bottom: 0; }
  .guide-row { grid-template-columns: .8fr 1.2fr; }
  .guide-row > *:nth-child(3) { display: none; }
  dialog { padding: 27px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
