:root {
  --navy: #233163;
  --navy-2: #18203a;
  --navy-3: #36447c;
  --coral: #f05a41;
  --coral-dark: #d84a34;
  --coral-pale: #fff2ef;
  --ink: #18203a;
  --muted: #687087;
  --soft: #f5f7fc;
  --line: #e4e8f1;
  --white: #fff;
  --shadow: 0 24px 70px rgba(29, 42, 90, .11);
  --shadow-soft: 0 10px 32px rgba(29, 42, 90, .08);
  --radius: 22px;
  color-scheme: light;
  font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #f7f8fc; color: var(--ink); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.topbar {
  height: 76px;
  padding: 0 clamp(22px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(225,229,239,.9);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; }
.brand-logo { width: 40px; height: 40px; display: block; flex: 0 0 auto; object-fit: contain; }
.brand-copy { display: flex; align-items: baseline; gap: 5px; letter-spacing: -.02em; }
.brand-copy strong { font-size: 18px; }
.brand-copy small { color: var(--coral); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.brand.light { color: #fff; }

.topbar-actions, .user-menu { display: flex; align-items: center; }
.topbar-actions { gap: 22px; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; color: #247a61; background: #ecf9f4; border: 1px solid #d1f0e3; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; }
.privacy-pill svg { width: 16px; height: 16px; }
.user-menu { gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--navy), var(--navy-3)); font-size: 12px; font-weight: 800; box-shadow: 0 5px 16px rgba(35,49,99,.2); }
.user-copy { display: grid; line-height: 1.2; min-width: 120px; }
.user-copy strong { font-size: 12px; }
.user-copy small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.logout-link { color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; padding: 8px; }
.logout-link:hover { color: var(--coral); }

main { width: min(1440px, 100%); margin: 0 auto; }
.hero { padding: clamp(48px, 6vw, 86px) clamp(22px, 6vw, 88px) 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 60px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 370px; height: 370px; border: 90px solid rgba(240,90,65,.045); border-radius: 50%; right: -175px; top: -210px; pointer-events: none; }
.hero-copy { max-width: 720px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow i { width: 19px; height: 2px; background: currentColor; border-radius: 3px; }
.eyebrow.light { color: #ff9684; }
.hero h1 { margin: 17px 0 18px; color: var(--navy); font-size: clamp(38px, 4.5vw, 66px); line-height: .99; letter-spacing: -.052em; }
.hero h1 span { color: var(--coral); }
.hero p { margin: 0; max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.65; }

.steps { list-style: none; margin: 0; padding: 0 0 5px; display: flex; align-items: center; flex: 0 0 auto; }
.steps li { display: flex; align-items: center; gap: 10px; position: relative; min-width: 128px; }
.steps li:not(:last-child)::after { content: ""; width: 32px; height: 1px; background: var(--line); margin: 0 15px; }
.steps li > span { width: 31px; height: 31px; border: 1px solid var(--line); background: #fff; color: #98a0b5; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; transition: .25s ease; }
.steps li div { display: grid; line-height: 1.2; }
.steps li strong { font-size: 11px; color: #7b8398; }
.steps li small { color: #a2a9ba; font-size: 9px; margin-top: 3px; }
.steps li.active > span, .steps li.done > span { background: var(--coral); border-color: var(--coral); color: #fff; box-shadow: 0 5px 15px rgba(240,90,65,.25); }
.steps li.active strong, .steps li.done strong { color: var(--navy); }
.steps li.done > span { font-size: 0; }
.steps li.done > span::after { content: "✓"; font-size: 12px; }

.workspace { padding: 0 clamp(22px, 6vw, 88px) 90px; }
.upload-workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .7fr); gap: 22px; }
.panel { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.upload-panel, .settings-panel { padding: clamp(24px, 3vw, 38px); }
.panel-heading { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 28px; }
.panel-heading.compact { margin-bottom: 20px; }
.panel-index { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--coral); background: var(--coral-pale); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.panel-heading h2 { margin: 0; color: var(--navy); font-size: 18px; letter-spacing: -.02em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.dropzone { min-height: 295px; border: 1.5px dashed #cdd3e2; border-radius: 18px; background: linear-gradient(145deg, #fafbfe, #f5f7fc); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: border-color .2s, transform .2s, background .2s, box-shadow .2s; outline: none; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragging { border-color: var(--coral); background: var(--coral-pale); transform: translateY(-2px); box-shadow: 0 15px 35px rgba(240,90,65,.08); }
.upload-icon { width: 62px; height: 62px; display: grid; place-items: center; color: var(--coral); border-radius: 20px; background: #fff; box-shadow: 0 10px 25px rgba(35,49,99,.1); margin-bottom: 18px; }
.upload-icon svg { width: 29px; height: 29px; }
.dropzone strong { color: var(--navy); font-size: 16px; }
.dropzone p { margin: 7px 0 14px; color: var(--muted); font-size: 12px; }
.dropzone p span { color: var(--coral); font-weight: 700; }
.dropzone small { color: #9aa2b7; font-size: 10px; }
.selected-file { min-height: 96px; display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid #dce1eb; background: var(--soft); border-radius: 16px; }
.file-type { width: 54px; height: 54px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--coral), #fa785f); border-radius: 14px; font-size: 10px; font-weight: 900; box-shadow: 0 8px 17px rgba(240,90,65,.22); }
.file-copy { display: grid; min-width: 0; flex: 1; }
.file-copy strong { color: var(--navy); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-copy small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.icon-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: #fff; color: #8e96aa; cursor: pointer; }
.icon-button:hover { color: var(--coral); }

.settings-panel { display: flex; flex-direction: column; }
.always-removed { display: grid; gap: 9px; padding: 16px; border-radius: 14px; background: #f2faf7; color: #39745f; margin-bottom: 10px; }
.always-removed span { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650; }
.always-removed svg { width: 14px; height: 14px; stroke-width: 2.5; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle-row > span { display: grid; }
.toggle-row strong { font-size: 12px; color: var(--navy); }
.toggle-row small { color: var(--muted); font-size: 9px; margin-top: 4px; line-height: 1.35; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i { width: 39px; height: 22px; padding: 3px; border-radius: 99px; background: #d8dce7; transition: .2s; flex: 0 0 auto; }
.toggle-row i::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(27,35,62,.25); transition: transform .2s; }
.toggle-row input:checked + i { background: var(--navy); }
.toggle-row input:checked + i::after { transform: translateX(17px); }
.toggle-row input:focus-visible + i { outline: 3px solid rgba(240,90,65,.25); }
.mode-notice { margin-top: 16px; padding: 12px; border: 1px solid #f5d9a6; background: #fff9ed; border-radius: 12px; color: #8b641e; display: flex; align-items: flex-start; gap: 9px; font-size: 9.5px; line-height: 1.45; }
.mode-notice svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; }

.primary-button, .secondary-button, .back-button, .microsoft-button { border: 0; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; transition: transform .18s, box-shadow .18s, background .18s, opacity .18s; }
.primary-button { min-height: 50px; padding: 0 20px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--coral), #f47760); box-shadow: 0 10px 24px rgba(240,90,65,.24); }
.settings-panel > .primary-button { margin-top: auto; width: 100%; }
.primary-button svg { width: 18px; height: 18px; }
.primary-button:hover:not(:disabled), .microsoft-button:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(240,90,65,.3); }
.primary-button:disabled { cursor: not-allowed; opacity: .38; box-shadow: none; }
.processing-caption { margin: 10px 0 0; text-align: center; color: #9aa2b4; font-size: 9px; line-height: 1.4; }

.processing-card { margin: 20px clamp(22px, 6vw, 88px) 100px; padding: clamp(35px, 5vw, 60px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); text-align: center; display: grid; place-items: center; }
.processing-orbit { width: 78px; height: 78px; position: relative; display: grid; place-items: center; margin-bottom: 23px; }
.processing-orbit::before { content: ""; width: 55px; height: 55px; border-radius: 18px; background: var(--navy); box-shadow: 0 12px 25px rgba(35,49,99,.22); }
.processing-orbit span { position: absolute; width: 72px; height: 72px; border: 2px solid transparent; border-top-color: var(--coral); border-right-color: rgba(240,90,65,.25); border-radius: 50%; animation: orbit 1.1s linear infinite; }
.processing-orbit i { position: absolute; width: 20px; height: 20px; border: 3px solid #fff; border-right-color: transparent; border-radius: 50%; animation: orbit .8s linear infinite reverse; }
@keyframes orbit { to { transform: rotate(360deg); } }
.processing-card h2 { margin: 10px 0 8px; color: var(--navy); font-size: 22px; }
.processing-card p { margin: 0; color: var(--muted); font-size: 12px; }
.progress-track { margin-top: 30px; width: min(410px, 90%); height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-track i { display: block; width: 12%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--coral), #ff927f); transition: width .65s ease; }

.result-workspace { padding: 45px clamp(22px, 4vw, 62px) 100px; }
.result-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.result-toolbar > div:first-child { display: grid; justify-items: start; }
.back-button { background: none; padding: 0; color: var(--muted); font-size: 10px; margin-bottom: 12px; }
.back-button:hover { color: var(--coral); }
.back-button svg { width: 15px; }
.result-kicker { color: var(--coral); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.result-toolbar h2 { margin: 5px 0 0; color: var(--navy); font-size: clamp(24px, 3vw, 36px); letter-spacing: -.04em; }
.toolbar-actions { display: flex; gap: 10px; }
.secondary-button { min-height: 48px; padding: 0 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); box-shadow: 0 6px 18px rgba(35,49,99,.06); }
.secondary-button:hover { border-color: #c9cfdd; transform: translateY(-1px); }
.primary-button.export { min-height: 48px; }

.result-grid { display: grid; grid-template-columns: 315px minmax(0, 1fr); gap: 22px; align-items: start; }
.editor-panel { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow-soft); position: sticky; top: 98px; }
.privacy-result { display: flex; gap: 12px; padding: 14px; background: #f1faf6; border: 1px solid #dcf2e8; border-radius: 14px; }
.privacy-check { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; background: #3aaa7d; color: #fff; border-radius: 50%; }
.privacy-check svg { width: 16px; stroke-width: 2.5; }
.privacy-result strong { color: #25694f; font-size: 10px; line-height: 1.25; }
.privacy-result p { margin: 4px 0 0; color: #5e8475; font-size: 8.5px; line-height: 1.4; }
.note-editor { display: grid; margin-top: 22px; }
.note-editor > span { display: grid; }
.note-editor strong { color: var(--navy); font-size: 12px; }
.note-editor small { color: var(--muted); font-size: 9px; margin-top: 4px; line-height: 1.4; }
.note-editor textarea { width: 100%; resize: vertical; min-height: 150px; margin-top: 11px; padding: 13px; color: var(--ink); border: 1px solid #dce1ec; border-radius: 12px; background: #fafbfe; font-size: 11px; line-height: 1.55; outline: none; transition: border-color .2s, box-shadow .2s; }
.note-editor textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(240,90,65,.11); background: #fff; }
.note-editor > i { color: #a0a7b8; font-size: 8px; font-style: normal; text-align: right; margin-top: 5px; }
.edit-hint { margin-top: 17px; padding: 13px 0; display: flex; gap: 11px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.edit-hint svg { flex: 0 0 auto; width: 17px; color: var(--coral); }
.edit-hint strong { color: var(--navy); font-size: 10px; }
.edit-hint p { margin: 3px 0 0; color: var(--muted); font-size: 8.5px; line-height: 1.45; }
.source-meta { margin: 18px 0 0; display: grid; gap: 10px; }
.source-meta div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.source-meta dt { color: #9299aa; font-size: 8.5px; }
.source-meta dd { margin: 0; color: var(--navy); font-size: 9px; font-weight: 750; text-align: right; }

.document-stage { min-width: 0; padding: clamp(18px, 3vw, 42px); border-radius: 20px; background: #e9ecf4; border: 1px solid #dfe3ec; overflow: auto; }
.paper { width: min(794px, 100%); min-height: 1123px; margin: 0 auto; padding: 56px 56px 48px; background: #fff; box-shadow: 0 18px 45px rgba(28,38,76,.15); color: #18203a; font-family: Arial, sans-serif; position: relative; }
.paper::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--navy); }
.paper-topline { position: absolute; top: 20px; left: 56px; right: 56px; display: flex; justify-content: space-between; color: var(--navy); font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.paper-top { display: grid; grid-template-columns: 1.55fr 1fr; margin-top: 7px; }
.paper-note, .paper-identity { min-height: 126px; padding: 19px; border: 1px solid #e8eaf1; }
.paper-note { background: var(--coral-pale); border-color: #ffddd6; }
.paper-identity { background: var(--soft); }
.paper-label { display: block; color: var(--coral); font-size: 7px; font-weight: 800; letter-spacing: .13em; margin-bottom: 9px; }
.paper-note .note-value { font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.paper-note .note-empty { color: #9299ab; font-style: italic; }
.paper h1 { margin: 0 0 6px; color: var(--navy); font-size: 21px; line-height: 1.08; letter-spacing: -.03em; }
.paper-role { color: var(--muted); font-size: 10px; line-height: 1.35; }
.paper-location { margin-top: 10px; color: var(--muted); font-size: 8px; }
.paper-section { margin-top: 28px; }
.paper-section h2 { margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid #e7e9ef; color: var(--navy); font-size: 14px; position: relative; }
.paper-section h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 95px; height: 3px; background: var(--coral); }
.paper-summary { font-size: 10.5px; line-height: 1.65; }
.paper-job, .paper-education { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 18px; padding: 10px 0 13px; }
.paper-job + .paper-job { border-top: 1px solid #f0f1f5; }
.paper-date { color: var(--coral); font-size: 8.5px; font-weight: 800; line-height: 1.4; }
.paper-job h3, .paper-education h3 { margin: 0; font-size: 11.5px; }
.paper-company { margin-top: 3px; color: var(--muted); font-size: 9px; font-style: italic; }
.paper-job ul, .paper-list { margin: 7px 0 0; padding-left: 16px; }
.paper-job li, .paper-list li { padding: 2px 0; font-size: 9.3px; line-height: 1.48; }
.paper-skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.paper-skill { padding: 7px 5px; background: var(--soft); border-radius: 4px; color: var(--navy); text-align: center; font-size: 8.5px; line-height: 1.2; }
.paper-footer { margin-top: 35px; padding-top: 9px; border-top: 1px solid #e7e9ef; color: #8b92a4; font-size: 7px; text-align: center; }
[contenteditable="true"] { border-radius: 3px; outline: none; transition: background .15s, box-shadow .15s; }
[contenteditable="true"]:hover { background: rgba(240,90,65,.07); box-shadow: 0 0 0 3px rgba(240,90,65,.07); }
[contenteditable="true"]:focus { background: #fff6f3; box-shadow: 0 0 0 3px rgba(240,90,65,.15); }
.preview-caption { display: flex; align-items: center; justify-content: center; gap: 7px; color: #6c7489; font-size: 9px; margin: 17px 0 0; }
.preview-caption svg { width: 14px; color: #3aaa7d; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translateX(-50%); min-width: min(440px, calc(100vw - 32px)); max-width: 600px; padding: 13px 14px 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #fff; background: var(--navy-2); border-radius: 12px; box-shadow: 0 15px 45px rgba(18,25,50,.3); font-size: 11px; animation: toast-in .25s ease-out; }
.toast.error { background: #a6382a; }
.toast.success { background: #247a61; }
.toast button { border: 0; background: transparent; color: currentColor; font-size: 20px; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

.login-body { min-height: 100vh; background: var(--navy); }
.login-layout { width: 100%; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr); }
.login-intro { padding: clamp(35px, 6vw, 90px); display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: var(--navy); position: relative; overflow: hidden; }
.login-intro::before, .login-intro::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.login-intro::before { width: 480px; height: 480px; border: 100px solid rgba(255,255,255,.035); left: -280px; bottom: -260px; }
.login-intro::after { width: 350px; height: 350px; border: 70px solid rgba(240,90,65,.11); right: -230px; top: -210px; }
.login-intro > * { position: relative; z-index: 1; }
.login-intro h1 { margin: 17px 0 20px; max-width: 690px; font-size: clamp(44px, 5.7vw, 76px); line-height: .98; letter-spacing: -.055em; }
.login-intro > div p { max-width: 600px; margin: 0; color: #cbd1e3; font-size: 16px; line-height: 1.7; }
.login-intro ul { list-style: none; margin: 50px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 25px 35px; color: #dfe3f0; font-size: 10px; }
.login-intro li { display: flex; align-items: center; gap: 9px; }
.login-intro li span { color: #ff927f; font-weight: 800; }
.login-card { background: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(45px, 8vw, 120px); }
.microsoft-icon, .microsoft-mini { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.microsoft-icon { width: 47px; height: 47px; margin-bottom: 35px; }
.microsoft-mini { width: 17px; height: 17px; gap: 1.5px; }
.microsoft-icon i:nth-child(1), .microsoft-mini i:nth-child(1) { background: #f25022; }
.microsoft-icon i:nth-child(2), .microsoft-mini i:nth-child(2) { background: #7fba00; }
.microsoft-icon i:nth-child(3), .microsoft-mini i:nth-child(3) { background: #00a4ef; }
.microsoft-icon i:nth-child(4), .microsoft-mini i:nth-child(4) { background: #ffb900; }
.login-card h2 { margin: 13px 0 10px; color: var(--navy); font-size: clamp(30px, 3.2vw, 44px); letter-spacing: -.045em; }
.login-card > p { margin: 0 0 30px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.microsoft-button { width: 100%; min-height: 56px; padding: 0 20px; border-radius: 13px; color: #fff; background: var(--navy); box-shadow: 0 10px 25px rgba(35,49,99,.22); }
.microsoft-button > svg { margin-left: auto; }
.login-footnote { margin-top: 24px; color: #9299ac; font-size: 9px; line-height: 1.55; }
.login-error { width: 100%; margin: -12px 0 20px; padding: 13px; border: 1px solid #ffd4cb; border-radius: 10px; color: #a6382a; background: var(--coral-pale); font-size: 10px; line-height: 1.5; }

.error-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--soft); }
.error-card { width: min(480px, 100%); padding: 45px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.error-code { width: 58px; height: 58px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: var(--coral-pale); color: var(--coral); font-size: 28px; font-weight: 800; }
.error-card h1 { color: var(--navy); margin: 0; }
.error-card p { color: var(--muted); line-height: 1.6; margin-bottom: 28px; }

@media (max-width: 1100px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .steps { align-self: stretch; justify-content: space-between; }
  .steps li { min-width: 0; }
  .upload-workspace { grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); }
  .result-grid { grid-template-columns: 280px minmax(640px, 1fr); }
  .document-stage { overflow-x: auto; }
  .paper { width: 760px; }
}

@media (max-width: 820px) {
  .topbar { height: 68px; }
  .privacy-pill, .user-copy { display: none; }
  .hero { padding-top: 42px; }
  .hero h1 br { display: none; }
  .steps { overflow-x: auto; padding-bottom: 8px; }
  .steps li:not(:last-child)::after { width: 18px; margin: 0 9px; }
  .upload-workspace { grid-template-columns: 1fr; }
  .settings-panel > .primary-button { margin-top: 25px; }
  .result-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions button { flex: 1; }
  .result-grid { grid-template-columns: 1fr; }
  .editor-panel { position: static; }
  .document-stage { padding: 16px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: 55vh; gap: 80px; }
  .login-card { min-height: 45vh; padding: 50px clamp(25px, 10vw, 90px); }
}

@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .brand-copy small, .logout-link { display: none; }
  .hero, .workspace, .result-workspace { padding-left: 16px; padding-right: 16px; }
  .hero { padding-bottom: 30px; }
  .hero h1 { font-size: 39px; }
  .steps li div { display: none; }
  .steps li { gap: 0; flex: 1; }
  .steps li:not(:last-child)::after { flex: 1; width: auto; }
  .panel { border-radius: 18px; }
  .upload-panel, .settings-panel { padding: 21px; }
  .dropzone { min-height: 245px; }
  .result-toolbar h2 { font-size: 27px; }
  .toolbar-actions { flex-direction: column-reverse; }
  .document-stage { margin-left: -16px; margin-right: -16px; border-radius: 0; }
  .paper { transform-origin: top left; }
  .login-intro { padding: 32px 24px 50px; }
  .login-intro h1 { font-size: 43px; }
  .login-intro ul { display: grid; }
}

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

@media print {
  .topbar, .hero, .editor-panel, .result-toolbar, .preview-caption { display: none !important; }
  body, .document-stage { background: #fff; }
  .result-workspace { padding: 0; }
  .result-grid { display: block; }
  .paper { box-shadow: none; width: 100%; }
}
