/* Scan to PDF (copied from the Runemic Scan app; .tool renamed .stool, tools.css has .tool). The look comes from runemic.com's site.css (tokens, Geist, header, buttons, cards, .seg tabs, footer),
   loaded first from https://runemic.com/assets/css/site.css; this file only adds what the app needs, on those tokens.
   Interface chrome is monochrome, as on the rest of Runemic. */

/* ───────── app pages (body.app) */
.app { font-size: 14px; line-height: 1.5; }
.app .wrap--app { max-width: 1040px; padding: 28px 24px 72px; }
.app h1 { font-size: 1.75rem; letter-spacing: -0.03em; margin: 0; }
.app h2 { font-size: 1.0625rem; letter-spacing: -0.015em; margin: 0; }
.app p { margin: 0; }
.app .card { padding: 20px; }
.app .card p { color: inherit; }
.muted, .app .card p.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.nowrap { flex-wrap: nowrap; }
.stack { display: grid; gap: 14px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt0 { margin-top: 6px; }
.ok { color: var(--teal); }
.warn { color: #b45309; } [data-theme="dark"] .warn { color: #fbbf24; }
a.plain { color: inherit; text-decoration: none; }
.scroll { overflow-x: auto; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* buttons: a plain .btn is the outline button; danger is red text */
.app .btn:not(.btn--primary) { background: var(--bg); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-xs); }
.app .btn:not(.btn--primary):hover { background: var(--surface-2); }
.app .btn--danger, .app .btn--danger:hover { color: var(--danger); }
.app label.btn { cursor: pointer; }

/* inputs */
.app input, .app select, .app textarea { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: transparent; color: var(--ink); font: 400 .875rem var(--font); min-width: 0; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.app select { background: var(--bg); }
.app input::placeholder { color: var(--muted); }
.app input:focus, .app select:focus, .app textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }
.app input[type="checkbox"] { height: auto; box-shadow: none; }
.app label { display: grid; gap: 6px; font-size: .8125rem; font-weight: 500; color: var(--ink); }
.app .grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* tabs: site.css .seg */
.app .seg { display: inline-flex; max-width: 100%; overflow-x: auto; margin: 20px 0 18px; }
.app .seg button { white-space: nowrap; flex: none; cursor: pointer; background: none; }

/* tables */
.app table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.app th { text-align: left; height: 40px; padding: 0 10px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.app td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.app tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.app td input { width: 100%; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.app td.num, .app .big, .app strong.num { font-family: var(--mono); font-size: .8125rem; }
td.qty { width: 70px; }
.big { font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.app .big { font-family: var(--font); font-size: 2rem; }

/* status pills */
.app .pill { display: inline-flex; align-items: center; gap: 6px; }
.app .pill::before { content: ""; border-radius: 999px; background: var(--line-strong); }
.app .pill--open::before { background: #16a34a; }
.app .pill--closed::before { background: var(--ink); }

/* receipt list and editor */
.card--click { cursor: pointer; transition: border-color .15s; }
.card--click:hover { border-color: var(--line-strong); }
.thumb { width: 96px; height: 124px; object-fit: cover; object-position: top; border-radius: var(--radius-md); border: 1px solid var(--line); cursor: zoom-in; background: var(--surface-2); }
.claims { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.claim { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: .78rem; font-weight: 500; }
.claim button { width: 20px; height: 20px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1; }
.claim button:hover { background: var(--line); color: var(--ink); }
.app .claims select { height: 28px; padding: 0 8px; font-size: .8rem; }
.chk { display: inline-flex !important; grid-auto-flow: column; flex-direction: row; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .85rem; font-weight: 500; cursor: pointer; background: var(--bg); }
.chk input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.chk:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.rate { display: flex; gap: 6px; } .rate input { flex: 1 1 0; width: 0; min-width: 0; } .rate .btn { flex: none; }
.link-box { display: flex; gap: 6px; margin-top: 8px; }
.link-box input { flex: 1; font-size: .8rem; font-family: var(--mono); }

/* a contact's page: items with share buttons */
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item__name { font-weight: 500; overflow-wrap: anywhere; }
.shares { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.shares button { min-width: 44px; height: 36px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 500 .9rem var(--font); cursor: pointer; box-shadow: var(--shadow-xs); }
.shares button:hover { background: var(--surface-2); }
.shares button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.shares button[disabled] { opacity: .35; cursor: not-allowed; }
.shares__q { width: 100%; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; grid-column: 1 / -1; display: flex; }
.bar i { display: block; height: 100%; }
.bar .me { background: var(--ink); }
.bar .oth { background: var(--muted); opacity: .4; }

/* toast and dialogs */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius-md); background: var(--ink); color: var(--bg); font-size: .875rem; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow-md); }
dialog { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 0; max-width: min(92vw, 900px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); }
dialog img { display: block; max-width: 100%; max-height: 86vh; }
dialog::backdrop { background: rgb(0 0 0 / .55); }
.form-dlg { width: min(92vw, 440px); padding: 24px; }
.form-dlg label > input, .form-dlg select { width: 100%; }

/* (the header is the tools site's) */

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .app .wrap--app { padding: 20px 16px 64px; }
  .app h1 { font-size: 1.5rem; }
  .big, .app .big { font-size: 1.7rem; }
  .header-actions .who { display: none; }
}

/* ───────── home page: the receipt next to who had what */
.split-show { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; width: min(940px, 100% - 32px); margin: clamp(32px, 5vh, 56px) auto 0; text-align: left; position: relative; z-index: 1; }
.split-show .card { padding: 20px; }
.receipt-paper { font: 400 .8125rem/1.7 var(--mono); color: var(--ink); background: var(--bg); }
.receipt-paper__shop { font-weight: 600; text-align: center; letter-spacing: .04em; }
.receipt-paper__meta { text-align: center; color: var(--muted); margin-bottom: 10px; }
.receipt-paper__line { display: flex; justify-content: space-between; gap: 12px; }
.receipt-paper__line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-paper__rule { border-top: 1px dashed var(--line-strong); margin: 8px 0; }
.receipt-paper__total { font-weight: 600; }
.read-note { display: flex; align-items: center; gap: 8px; margin-top: 12px; font: 500 .75rem var(--font); color: var(--muted); }
.read-note::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: #16a34a; }
.who-had { display: grid; gap: 0; font-size: .875rem; }
.who-had__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.who-had__head h3 { margin: 0; font-size: 1rem; }
.who-had__row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.who-had__row:first-of-type { border-top: 0; }
.who-had__item { font-weight: 500; }
.who-had__eur { font: 400 .8125rem var(--mono); color: var(--muted); }
.who-had .claims { grid-column: 1 / -1; }
.who-had__sum { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); font-size: .8125rem; }
.who-had__sum b { font: 500 .8125rem var(--mono); }
.home .steps-grid { counter-reset: s; }
.home .step-card { padding: 24px; }
.home .step-card h3 { margin: 14px 0 6px; }
.home .step-card p { margin: 0; font-size: .9375rem; }
.home .step-card::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font: 500 .75rem var(--mono); color: var(--ink); }
.home .facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.home .facts .card { padding: 24px; }
.home .facts h3 { margin-bottom: 6px; }
.home .facts p { margin: 0; font-size: .9375rem; }
.home .split-cta { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 32px; flex-wrap: wrap; }
.home .split-cta h2 { margin: 0 0 6px; }
.home .split-cta p { margin: 0; }
@media (max-width: 860px) {
  .split-show { grid-template-columns: 1fr; }
  .home .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .home .facts { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .home .grid--4 { grid-template-columns: 1fr; } }

/* fixes on top of site.css */
.app .header-actions { margin-left: auto; }
.app label.btn { display: inline-flex; color: var(--ink); font-size: .875rem; }
.app label.btn--primary, .app label.btn--primary:hover { color: var(--on-brand); }
.app .seg button { display: inline-flex; align-items: center; }
.home .split-cta > div:first-child { text-align: left; }
#editor { margin-top: 18px; }

/* waiting while a photo is read: the photo with a scan line, steps, time; placeholder rows in the items table */
.reading { display: flex; gap: 20px; align-items: flex-start; }
.reading__photo { position: relative; flex: none; width: 112px; aspect-ratio: 3 / 4; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.reading__photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.reading__scan { position: absolute; left: 0; right: 0; top: 0; height: 28%; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--teal) 30%, transparent)); border-bottom: 2px solid var(--teal); animation: split-scan 2.4s ease-in-out infinite alternate; }
@keyframes split-scan { from { transform: translateY(-100%); } to { transform: translateY(357%); } }
.reading__body { flex: 1; min-width: 0; display: grid; gap: 12px; }
.reading__time { font: 500 .8125rem var(--mono); color: var(--muted); }
.reading__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .875rem; }
.reading__steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.reading__steps li::before { content: ""; display: grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: 11px; line-height: 1; }
.reading__steps li.is-done { color: var(--ink); }
.reading__steps li.is-done::before { content: "✓"; background: var(--ink); border-color: var(--ink); color: var(--bg); }
.reading__steps li.is-now { color: var(--ink); font-weight: 500; }
.reading__steps li.is-now::before { border-color: var(--line-strong); border-top-color: var(--ink); animation: split-spin .8s linear infinite; }
@keyframes split-spin { to { transform: rotate(360deg); } }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 35%, var(--bg)) 50%, var(--surface-2) 70%); background-size: 220% 100%; animation: split-shimmer 1.5s linear infinite; }
.skel--s { width: 26px; } .skel--m { width: 60px; margin-left: auto; } .skel--l { width: 72%; } .skel--left { margin-left: 0; }
.skel-row td { height: 46px; }
@keyframes split-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.app .pill--reading::before { background: var(--teal); animation: split-pulse 1.2s ease-in-out infinite; }
.app .pill--failed { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.app .pill--failed::before { background: var(--danger); }
@keyframes split-pulse { 50% { opacity: .25; } }
.callout--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.app input:disabled, .app select:disabled { opacity: .6; cursor: not-allowed; }
@media (max-width: 640px) { .reading { gap: 14px; } .reading__photo { width: 76px; } }
@media (prefers-reduced-motion: reduce) {
  .reading__scan { display: none; }
  .skel, .reading__steps li.is-now::before, .app .pill--reading::before { animation: none; }
}
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width .25s linear; }
.app .card.reading { display: flex; flex-direction: row; } @media (max-width: 480px) { .app .card.reading { flex-direction: column; } .reading__photo { display: none; } }

/* ───────── Runemic Scan */
.toolbar input[type="search"] { flex: 1 1 260px; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 500 .8125rem var(--font); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.app .doc-card { display: grid; padding: 0; overflow: hidden; }
.doc-card__thumb { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; }
.doc-card__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.doc-card__body { display: grid; gap: 4px; padding: 12px 14px 14px; }
.doc-card__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match { color: var(--ink-2); background: color-mix(in srgb, var(--accent-soft) 60%, transparent); border-radius: 4px; padding: 2px 4px; overflow-wrap: anywhere; }
.empty-card { padding: 40px 24px !important; text-align: center; display: grid; gap: 10px; justify-items: center; }
.center { justify-content: center; }
.app .btn svg { width: 16px; height: 16px; }
.grid--doc { grid-template-columns: 2fr 1fr !important; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.app .page-card { padding: 8px; display: grid; gap: 6px; }
.page-card__img { display: block; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 3 / 4; }
.page-card__img img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.page-card__bar { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.page-card__tools { display: flex; gap: 4px; justify-content: space-between; }
.app .btn--xs { width: 30px; height: 28px; font-size: .8rem; display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.app .btn--xs.danger { color: var(--danger); }
.app .btn--xs:disabled { opacity: .35; cursor: default; }
.page-card.is-reading .page-card__img { outline: 2px solid var(--teal); outline-offset: 1px; }
.app .pill--done::before { background: #16a34a; }
.app .pill--none { color: var(--muted); }
.reading-box { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.text-card textarea { width: 100%; min-height: 160px; height: auto; padding: 10px 12px; font: 400 .875rem/1.6 var(--mono); resize: vertical; }
.text-card h3 { margin: 0; font-size: .95rem; }
.scanner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; align-items: start; }
.app .scanner .card { display: grid; gap: 10px; padding: 14px; }
.scanner canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: var(--radius-md); background: var(--surface-2); }
#crop { touch-action: none; cursor: crosshair; }
#result { box-shadow: var(--shadow-sm); border: 1px solid var(--line); max-height: 62vh; width: auto; }
.app .seg--filters { margin: 0; display: flex; flex-wrap: wrap; }
.seg--filters button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }
@media (max-width: 760px) { .scanner { grid-template-columns: 1fr; } .grid--doc { grid-template-columns: 1fr !important; } .docs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* home: photo → scan → text */
.scan-show { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: min(1040px, 100% - 32px); margin: clamp(32px, 5vh, 56px) auto 0; position: relative; z-index: 1; text-align: left; }
.scan-show figure { margin: 0; padding: 14px; display: grid; gap: 10px; align-content: start; }
.scan-show figcaption { font: 500 .8125rem var(--font); color: var(--muted); }
.scan-show__frame { position: relative; display: block; border-radius: 10px; overflow: hidden; background: #3b3a36; aspect-ratio: 4 / 3; }
.scan-show__frame img { position: absolute; width: 78%; left: 11%; top: 12%; transform: rotate(-6deg) skewX(-3deg); box-shadow: 0 10px 24px rgb(0 0 0 / .35); }
.scan-show__frame i { position: absolute; width: 14px; height: 14px; border-radius: 99px; background: #fff; border: 3px solid var(--teal); transform: translate(-50%, -50%); }
.scan-show__frame .c1 { left: 9%; top: 18%; } .scan-show__frame .c2 { left: 85%; top: 9%; } .scan-show__frame .c3 { left: 92%; top: 80%; } .scan-show__frame .c4 { left: 15%; top: 90%; }
.scan-show__scan img { border-radius: 6px; border: 1px solid var(--line); filter: grayscale(1) contrast(1.35) brightness(1.08); background: #fff; }
.scan-show__text pre { margin: 0; padding: 12px; border-radius: 8px; background: var(--surface-2); font: 400 .72rem/1.55 var(--mono); white-space: pre-wrap; color: var(--ink); max-height: 250px; overflow: hidden; }
.scan-show__formats { display: flex; flex-wrap: wrap; gap: 6px; }
.scan-show__formats b { font: 500 .75rem var(--font); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.home .facts--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .scan-show { grid-template-columns: 1fr; } .home .facts--3 { grid-template-columns: 1fr; } }
/* "Flatten curves" in the scanner: on (default) shows as selected */
#scan-flat[aria-pressed="true"], #scan-auto[aria-pressed="true"], #scan-full[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }
#scan-flat[aria-pressed="false"] { text-decoration: line-through; opacity: .7; }
/* the free pages left, beside "Read the text" */
.read-row { gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.read-row [data-usage] { text-align: right; }

/* ───────── 2026-11 redesign: start page (no account), tiles, thumbnail grid, document with a text panel, compare slider */
.app .btn--lg { height: 48px; padding: 0 22px; font-size: 1rem; border-radius: var(--radius); }
.app .btn--lg svg { width: 20px; height: 20px; }
.center-text { text-align: center; }
.app-top { align-items: center; margin-bottom: 18px; }
.app-top .seg { margin: 0; }

/* the start (signed out): one big place to take a picture or drop photos, like squoosh.app */
.start { display: grid; gap: 22px; justify-items: center; padding: clamp(8px, 4vh, 40px) 0 8px; }
.drop { width: 100%; max-width: 660px; box-sizing: border-box; display: grid; justify-items: center; gap: 14px; padding: 44px 28px; text-align: center; border: 2px dashed var(--line-strong); border-radius: 24px; background: var(--surface); transition: border-color .15s, background .15s; }
.drop h1 { font-size: 2rem; }
.drop p { max-width: 440px; font-size: 1rem; }
.drop__icon { width: 80px; height: 80px; display: grid; place-items: center; border-radius: 22px; background: var(--surface-2); color: var(--ink); }
.drop__icon svg { width: 40px; height: 40px; }
.is-dragging .drop, .is-dragging .lib__main { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 6%, var(--surface)); }
.samples { display: grid; gap: 10px; justify-items: center; }
.sample { display: grid; justify-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font: 500 .8125rem var(--font); cursor: pointer; padding: 4px; border-radius: var(--radius); }
.sample img { width: 96px; height: 72px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow-sm); transition: transform .15s; }
.sample:hover img { transform: translateY(-2px); }
.sample:hover { color: var(--ink); }

/* the scan preview */

.compare { position: relative; display: block; margin: 0 auto; max-width: 100%; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); line-height: 0; user-select: none; touch-action: pan-y; }
.compare canvas { display: block; max-width: 100%; height: auto; }
.scanner .compare canvas { max-height: 62vh; width: auto; }

/* documents (signed in): the grid look */
.docs { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important; gap: 20px 16px !important; }
.app .doc-card { border: 0; background: none; box-shadow: none; gap: 10px; overflow: visible; }
.app .doc-card .doc-card__thumb { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow-xs); transition: box-shadow .15s, transform .15s; }
.app .doc-card:hover .doc-card__thumb { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.doc-card__count { position: absolute; right: 8px; bottom: 8px; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font: 500 .6875rem/1.6 var(--font); color: var(--muted); }
.app .doc-card .doc-card__body { padding: 0 2px; }
.doc-card__meta { display: flex; align-items: center; gap: 6px; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 99px; background: var(--line-strong); }
.dot--done { background: #16a34a; }
.fab { display: none; }
@media (max-width: 640px) {
  .docs { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #view-list { padding-bottom: 72px; }
  .fab { display: flex; position: fixed; left: 0; right: 0; bottom: 18px; z-index: 30; justify-content: center; align-items: center; gap: 12px; pointer-events: none; }
  .fab label { pointer-events: auto; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgb(0 0 0 / .22); }
  .fab__main { height: 56px; padding: 0 28px; gap: 10px; border-radius: 99px; background: var(--brand); color: var(--on-brand) !important; font: 600 1.0625rem var(--font) !important; }
  .fab__alt { width: 50px; height: 50px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
  .fab svg { width: 22px; height: 22px; }
}

/* one document: pages on the left; reading, the text and downloads on the right */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.doc__side .btn { justify-content: center; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.doc__side .text-card { padding: 12px; }
.doc__side .text-card textarea { min-height: 140px; }
@media (min-width: 1100px) { .app .wrap--app { max-width: 1180px; } }
@media (max-width: 860px) { .doc { grid-template-columns: 1fr; } }
.compare { width: fit-content; }
@media (max-width: 640px) { .app .seg--filters { flex-wrap: nowrap; overflow-x: auto; } }

/* the library (signed in, like a file app): a sidebar, Recent, then a list or a grid */
.lib { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 32px; align-items: start; padding-top: 8px; }
.lib__side { position: sticky; top: 16px; display: grid; gap: 18px; }
.lib__actions { display: grid; gap: 8px; }
.lib__actions .btn { justify-content: center; gap: 8px; }
.lib__actions svg, .lib__item svg, .lib__search svg { width: 17px; height: 17px; flex: none; }
.lib__nav { display: grid; gap: 2px; }
.lib__folders { display: grid; gap: 2px; }
.lib__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: 500 .875rem var(--font); text-align: left; cursor: pointer; }
.lib__item > span:nth-of-type(1) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib__item:hover { background: var(--surface-2); }
.lib__item[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.lib__n { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.lib__label { margin: 12px 10px 4px; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lib__usage { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.lib__usage .lib__label { margin: 0; }
.lib__usage .btn { justify-self: start; margin-left: -10px; }
.progress--thin { height: 5px; }
.progress--thin i { background: var(--teal); }
.lib__main { min-width: 0; gap: 26px !important; border-radius: var(--radius-xl); transition: background .15s; }
.app label.lib__search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--muted); font-weight: 400; }
.lib__search input { flex: 1; border: 0 !important; background: none !important; box-shadow: none !important; padding: 0 !important; height: 100%; outline: none; }
.lib__search:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.lib__h { font-size: 1rem; margin: 0; }
.lib__bar select { height: 36px; }
.look-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.look-toggle .icon-btn { width: 36px; height: 34px; border: 0; border-radius: 0; background: none; color: var(--muted); }
.look-toggle .icon-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.look-toggle svg { width: 15px; height: 15px; }
.recent { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.recent__card { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); transition: box-shadow .15s; }
.recent__card:hover { box-shadow: var(--shadow-md); }
.recent__thumb { display: block; height: 120px; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--line); }
.recent__thumb img, .rows__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.recent__body { display: grid; gap: 2px; padding: 10px 12px; }
.recent__body strong { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows { display: grid; border-top: 1px solid var(--line); }
.rows__head, .rows__row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 56px 120px 104px 132px; gap: 12px; align-items: center; padding: 0 8px; }
.rows__head { height: 36px; font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.rows__row { min-height: 60px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: .875rem; }
.rows__row:hover { background: var(--surface); }
.rows__name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rows__thumb { flex: none; width: 32px; height: 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.rows__title { display: grid; min-width: 0; }
.rows__title strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows__meta { display: none; }
.rows__state { display: flex; align-items: center; gap: 8px; }
.rows__c { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 860px) {
  .lib { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lib__side, .lib__nav { min-width: 0; }
  .lib__side { position: static; gap: 12px; }
  .lib__actions { display: none; }
  .lib__nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .lib__folders { display: contents; }
  .lib__label { display: none; }
  .lib__item { width: auto; flex: none; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; }
  .lib__item svg { display: none; }
  .lib__item[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .lib__item[aria-pressed="true"] .lib__n { color: inherit; opacity: .7; }
  .lib__usage { order: 3; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 10px 12px; }
  .lib__usage > .lib__label, .lib__usage .progress { display: none; }
  .lib__usage .btn { margin: 0; }
  .recent { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rows__head { display: none; }
  .rows__row { grid-template-columns: minmax(0, 1fr) auto; padding: 0 2px; }
  .rows__row > .rows__c, .rows__state .rows__c { display: none; }
  .rows__meta { display: block; }
}
@media (max-width: 860px) { .lib__side { display: flex; flex-direction: column; } .lib__usage { order: 0; } }
@media (max-width: 640px) { #view-list { padding-bottom: 80px; } }
.is-dragging .lib__main { background: color-mix(in srgb, var(--teal) 6%, transparent); outline: 2px dashed var(--teal); outline-offset: 6px; }

#how { max-width: 820px; margin-inline: auto; }

/* the end of a scan without an account: just the downloads (like a file tool's done page) */
.done { display: grid; justify-items: center; gap: 16px; padding: 24px 0 8px; text-align: center; }
.done__h { margin: 0 0 8px; font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.02em; }
.done__main { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 560px; }
.done__back { flex: none; width: 52px; height: 52px; border-radius: 99px; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; cursor: pointer; }
.done__back svg { width: 22px; height: 22px; }
.app .btn.done__pdf { flex: 1; height: 72px; border-radius: 14px; font-size: 1.375rem; font-weight: 600; justify-content: center; gap: 12px; }
.app .btn.done__pdf svg { width: 26px; height: 26px; flex: none; }
.want-dlg .row { justify-content: center; }
.app .btn.done__jpg { width: 100%; max-width: 494px; margin-left: 66px; height: 48px; justify-content: center; font-size: 1rem; }
.done__orig { margin: -4px 0 0 66px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.done__pages { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; max-width: 760px; }
.done__pages canvas { height: 150px; width: auto; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-sm); background: #fff; }
.done__text { display: grid; gap: 12px; width: 100%; max-width: 560px; padding: 18px 20px; text-align: left; }
.done__formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.done__formats .btn { justify-content: center; }
.want-dlg { max-width: 440px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 24px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow-lg, 0 20px 50px rgb(0 0 0 / .25)); }
.want-dlg::backdrop { background: rgb(0 0 0 / .35); }
.want-dlg h2 { margin: 0; font-size: 1.25rem; }
.want-dlg p { margin: 0; }
@media (max-width: 640px) {
  .app .btn.done__pdf { height: 60px; font-size: 1.125rem; }
  .app .btn.done__jpg { margin-left: 0; }
  .done__orig { margin-left: 0; }
  .done__back { width: 46px; height: 46px; }
  .done__pages canvas { height: 110px; }
}

/* the scanner: pages down the side (drag to reorder, × to remove, + to add); one place for the page, showing the
   scan, or the photo and its corners while adjusting; looks as small previews and a toolbar ending in ✓ */
.scan2 { display: grid; gap: 14px; }
.scan2__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan2__body { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; align-items: start; }
.rail { position: sticky; top: 12px; display: grid; gap: 14px; justify-items: center; }
.rail__pages { display: flex; flex-direction: column; gap: 12px; width: 100%; max-height: calc(100vh - 220px); overflow-y: auto; padding: 10px 10px 6px; margin: -10px -10px 0; box-sizing: content-box; scrollbar-width: thin; }
.rail__page { position: relative; display: grid; place-items: center; height: 120px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: box-shadow .15s; }
.rail__page.is-on { border-color: var(--brand); box-shadow: 0 0 0 1.5px var(--brand); }
.rail__img { display: grid; place-items: center; width: 100%; height: 100%; pointer-events: none; }
.rail__img canvas { max-width: 100%; max-height: 106px; border-radius: 3px; box-shadow: var(--shadow-xs); }
.rail__n { position: absolute; left: 6px; bottom: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: var(--bg); font: 600 .6875rem/20px var(--font); text-align: center; pointer-events: none; }
.rail__x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 99px; border: 2px solid var(--bg); background: var(--ink); color: var(--bg); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .12s; }
.rail__x svg { width: 12px; height: 12px; }
.rail__page:hover .rail__x, .rail__page:focus-within .rail__x, .rail__page.is-on .rail__x { opacity: 1; }
@media (hover: none) { .rail__x { opacity: 1; } }
.rail__page.is-busy::after { content: ""; position: absolute; top: 8px; left: 8px; width: 14px; height: 14px; border-radius: 99px; border: 2px solid color-mix(in srgb, var(--teal) 30%, transparent); border-top-color: var(--teal); animation: rail-spin .8s linear infinite; }
@keyframes rail-spin { to { transform: rotate(360deg); } }
.rail__page.is-dragging { z-index: 5; cursor: grabbing; box-shadow: var(--shadow-md); opacity: .92; transition: none; }
.rail__page.is-before { box-shadow: 0 -4px 0 -1px var(--teal); }
.rail__page.is-after { box-shadow: 0 4px 0 -1px var(--teal); }
.adder { position: relative; }
.adder__plus { position: relative; width: 52px; height: 52px; border-radius: 99px; border: 0; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgb(0 0 0 / .18); }
.adder__plus svg { width: 22px; height: 22px; }
.adder__n { position: absolute; top: -5px; left: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: var(--teal); color: #fff; border: 2px solid var(--bg); font: 600 .6875rem/18px var(--font); text-align: center; }
.adder__menu { position: absolute; left: calc(100% + 10px); top: 0; z-index: 20; display: grid; gap: 8px; min-width: 170px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow-md); }
.adder__menu[hidden] { display: none; }
.app label.adder__opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--ink); }
.app label.adder__opt:hover { background: var(--surface-2); }
.adder__opt svg { width: 18px; height: 18px; }
.sstage { display: grid; gap: 14px; min-width: 0; }
.sstage__view { display: grid; place-items: center; min-height: 320px; padding: 16px; border-radius: var(--radius-xl); background: var(--surface-2); }
.sstage__view[hidden] { display: none; }
.sstage__view .compare { background: none; box-shadow: var(--shadow-md); border-radius: 4px; }
.sstage__view .compare canvas { max-height: 56vh; width: auto; max-width: 100%; }
#stage-edit canvas { max-width: 100%; touch-action: none; border-radius: 6px; }
.sstage__tools { display: grid; gap: 12px; justify-items: center; }
.sstage__tools[hidden] { display: none; }
.sstage__tools .row { justify-content: center; }
.looks { display: flex; gap: 10px; overflow-x: auto; max-width: 100%; padding: 2px; scrollbar-width: none; }
.look { flex: none; display: grid; gap: 4px; justify-items: center; width: 76px; padding: 4px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: 500 .75rem var(--font); color: var(--ink-2); }
.look canvas { width: 64px; height: 64px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.look[aria-pressed="true"] { color: var(--ink); }
.look[aria-pressed="true"] canvas { outline: 2.5px solid var(--brand); outline-offset: 1px; }
.look span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-xs); }
.stool { display: grid; gap: 3px; justify-items: center; min-width: 76px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: 500 .75rem var(--font); color: var(--ink-2); }
.stool svg { width: 22px; height: 22px; }
.stool:hover { background: var(--surface-2); color: var(--ink); }
.stool--ok { min-width: 64px; height: 52px; margin-left: 8px; place-items: center; background: var(--teal); color: #fff; }
.stool--ok:hover { background: var(--teal); color: #fff; filter: brightness(1.1); }
.stool--ok svg { width: 26px; height: 26px; }
:root[data-theme="dark"] .stool--ok { color: #0a0a0a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stool--ok { color: #0a0a0a; } }
#scan-peek { user-select: none; -webkit-user-select: none; touch-action: none; }
@media (max-width: 760px) {
  .scan2 { gap: 10px; }
  .scan2__bar #scan-save { display: none; }
  .scan2__body { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .rail { position: static; grid-template-columns: minmax(0, 1fr) auto; align-items: center; max-height: none; overflow: visible; padding: 8px 0 0; order: 2; }
  .rail__pages { flex-direction: row; overflow-x: auto; padding: 8px 4px 4px; scrollbar-width: none; }
  .rail__page { flex: none; width: 64px; height: 84px; padding: 4px; }
  .rail__img canvas { max-height: 74px; }
  .rail__x { top: -7px; right: -7px; width: 24px; height: 24px; }
  .rail__page.is-before { box-shadow: -4px 0 0 -1px var(--teal); }
  .rail__page.is-after { box-shadow: 4px 0 0 -1px var(--teal); }
  .adder__plus { width: 48px; height: 48px; }
  .adder__menu { left: auto; right: 0; top: auto; bottom: calc(100% + 10px); }
  .sstage__view { min-height: 0; padding: 10px; }
  .sstage__view .compare canvas { max-height: 40vh; }
  .look { width: 64px; } .look canvas { width: 52px; height: 52px; }
  .sstage { gap: 10px; }
  .toolbar { width: 100%; justify-content: space-between; border-radius: 14px; }
  .stool { min-width: 0; flex: 1; padding: 6px 4px; }
  .stool--ok { flex: none; width: 60px; margin-left: 4px; }
}

/* the account menu in the header (Settings, Admin, Sign out) and the small menus */
.acct { position: relative; }
.acct__btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 99px; background: none; color: var(--ink); cursor: pointer; font: 500 .875rem var(--font); }
.acct__btn:hover, .acct__btn[aria-expanded="true"] { background: var(--surface-2); }
.acct__btn svg { width: 16px; height: 16px; color: var(--muted); }
.acct__av { width: 30px; height: 30px; border-radius: 99px; background: var(--teal); color: #fff; display: grid; place-items: center; font: 600 .75rem var(--font); }
.acct .who { color: var(--ink); max-width: 180px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 2px; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow-md); }
.menu[hidden] { display: none; }
.menu--wide { min-width: 260px; }
.menu form { margin: 0; }
.app .menu__item { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 .875rem var(--font); text-decoration: none; text-align: left; cursor: pointer; }
.app .menu__item:hover { background: var(--surface-2); }
.menu__item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.app .menu__item--danger, .app .menu__item--danger svg { color: #b42318; }
.app .menu__field { display: grid; gap: 6px; padding: 8px 10px 10px; font-size: .8125rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.settings-top { align-items: center; gap: 16px; margin: 8px 0 4px; }
.settings-top h1 { margin: 0; font-size: 1.5rem; }
#view-settings { max-width: 720px; }

/* the open document: a workspace across the whole width */
.app main:has(> #view-doc:not([hidden])) { max-width: none; padding: 0; }
.dw { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; height: calc(100dvh - var(--hdr, 57px)); min-height: 560px; border-top: 0; }
.dw[hidden] { display: none; }
.dw__docs { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.app .dw__all { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: 500 .875rem var(--font); cursor: pointer; text-align: left; }
.dw__all svg, .dw__back svg { width: 18px; height: 18px; }
.dw__all:hover { background: var(--surface); }
.dw__list { overflow-y: auto; flex: 1; padding: 6px 0; }
.dw__doc { display: flex; align-items: center; gap: 12px; padding: 8px 16px; color: var(--ink); border-left: 2px solid transparent; }
.dw__doc:hover { background: var(--surface); }
.dw__doc.is-on { background: var(--surface-2); border-left-color: var(--ink); }
.dw__doc-img { flex: none; width: 32px; height: 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.dw__doc-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.dw__doc-t { display: grid; min-width: 0; }
.dw__doc-t strong { font-size: .875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.dw__bar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.dw__back { display: none; }
.app input.dw__title { flex: 0 1 auto; width: auto; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: none; box-shadow: none; font: 600 1.0625rem var(--font); color: var(--ink); field-sizing: content; max-width: 50%; }
.app input.dw__title:hover { border-color: var(--line); }
.app input.dw__title:focus { border-color: var(--line-strong); background: var(--bg); }
.dw__meta { font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.dw__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.dw__actions .btn svg { width: 16px; height: 16px; }
.dw__actions .icon-btn svg { width: 18px; height: 18px; }
.dw__stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 24px; }
.dw__page { display: grid; place-items: center; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; min-height: 0; }
.dw__page[hidden] { display: none; }
.dw__page img { display: block; max-height: 100%; max-width: 100%; width: auto; height: auto; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .10); }
.dw__strip { display: flex; gap: 10px; justify-content: center; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--bg); overflow-x: auto; }
.dw__thumb { position: relative; flex: none; width: 48px; height: 64px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.dw__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 5px; display: block; pointer-events: none; }
.dw__thumb.is-on { border: 2px solid var(--ink); }
.dw__thumb .rail__x { width: 22px; height: 22px; top: -8px; right: -8px; }
.dw__thumb .rail__x svg { width: 10px; height: 10px; }
.dw__thumb:hover .rail__x, .dw__thumb.is-on .rail__x { opacity: 1; }
.dw__n { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font: 600 .6875rem/16px var(--font); color: var(--muted); text-align: center; box-sizing: border-box; pointer-events: none; }
.dw__n.is-read { color: #0f6b3a; border-color: #9fd3b4; }
.dw__thumb.is-on .dw__n { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dw__thumb.is-dragging { z-index: 5; cursor: grabbing; box-shadow: var(--shadow-md); }
.dw__thumb.is-before { box-shadow: -5px 0 0 -2px var(--teal); }
.dw__thumb.is-after { box-shadow: 5px 0 0 -2px var(--teal); }
.dw__thumb.is-busy::after { content: ""; position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; border-radius: 99px; border: 2px solid color-mix(in srgb, var(--teal) 30%, transparent); border-top-color: var(--teal); animation: rail-spin .8s linear infinite; }
.dw__side { display: flex; flex-direction: column; border-left: 1px solid var(--line); min-height: 0; background: var(--bg); }
.dw__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.dw__head h2 { margin: 0; font-size: .9375rem; }
.dw__state { font-size: .8125rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dw__state.is-done { color: #0f6b3a; }
.dw__state.is-done::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: #16a34a; }
.dw__text { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; overflow-y: auto; }
.dw__text textarea { flex: 1; min-height: 180px; resize: none; font: .8125rem/1.6 var(--mono, ui-monospace, monospace); }
.dw__text .btn--primary, .dw__text .btn--ghost { justify-content: center; }
.dw__dl { display: grid; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.dw__dl h2 { margin: 0; font-size: .8125rem; color: var(--muted); font-weight: 600; }
.dw__dl .btn { justify-content: center; }
@media (max-width: 1100px) { .dw { grid-template-columns: minmax(0, 1fr) 340px; } .dw__docs { display: none; } .dw__back { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; } }
@media (max-width: 760px) {
  .dw { grid-template-columns: minmax(0, 1fr); height: auto; }
  .dw__main { min-height: 70vh; }
  .dw__stage { height: 56vh; padding: 14px; }
  .dw__side { border-left: 0; border-top: 1px solid var(--line); }
  .dw__text textarea { min-height: 220px; }
  .dw__meta { display: none; }
  .app input.dw__title { max-width: none; flex: 1; }
  .dw__actions .btn span, .dw__actions .btn { font-size: .8125rem; }
}
@media (min-width: 761px) { html:has(#view-doc:not([hidden])), html:has(#view-doc:not([hidden])) body { overflow: hidden; } }
.dw__stage { overflow: hidden; }
@media (hover: none) { .dw__thumb .rail__x { opacity: 0; } .dw__thumb.is-on .rail__x { opacity: 1; } }
@media (max-width: 760px) { .dw__addt { display: none; } #doc-add { width: 40px; padding: 0; justify-content: center; } }

/* the pages: a column on the left on a computer (like the scanner), a strip under the page on a phone */
.dw { grid-template-columns: 116px minmax(0, 1fr) 360px; grid-template-areas: "rail main side"; }
.dw__main { grid-area: main; } .dw__side { grid-area: side; }
.dw__strip { grid-area: rail; flex-direction: column; justify-content: flex-start; align-items: center; gap: 20px; padding: 16px 0 24px; border-top: 0; border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.dw__thumb { width: 72px; height: 96px; }
.dw__thumb.is-before { box-shadow: 0 -6px 0 -3px var(--teal); }
.dw__thumb.is-after { box-shadow: 0 6px 0 -3px var(--teal); }
.dw__back { display: grid; place-items: center; width: 36px; height: 36px; margin-left: -6px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.dw__back:hover { background: var(--surface-2); }
@media (max-width: 1100px) { .dw { grid-template-columns: 96px minmax(0, 1fr) 320px; } .dw__thumb { width: 60px; height: 80px; } }
@media (max-width: 760px) {
  .dw { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "rail" "side"; }
  .dw__strip { flex-direction: row; justify-content: center; gap: 12px; padding: 12px 16px 16px; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .dw__thumb { width: 52px; height: 70px; }
  .dw__thumb.is-before { box-shadow: -6px 0 0 -3px var(--teal); }
  .dw__thumb.is-after { box-shadow: 6px 0 0 -3px var(--teal); }
}
@media (max-width: 760px) { .dw__stage { height: auto; padding: 12px; } .dw__page { height: auto; } .dw__page img { max-height: 58vh; } .dw__main { min-height: 0; } }
.app .dw__del { color: #b42318; }
.app .dw__del svg { width: 18px; height: 18px; }
.lib__credits { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.lib__credits:hover { border-color: var(--line-strong); }
.lib__credits .lib__label { margin: 0; }
.lib__credits strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .lib__credits { order: 3; grid-template-columns: auto 1fr; align-items: baseline; padding: 10px 12px; } .lib__credits .small { display: none; } }
.meter { display: grid; gap: 6px; }
.meter .progress--thin { height: 8px; }
/* delete is always red: the document's trash button (also on hover) and the × on a page */
.app .icon-btn.dw__del, .app .icon-btn.dw__del:hover { color: #d92d20; }
.app .icon-btn.dw__del:hover { background: #fef3f2; border-color: #fecdca; }
.app .rail__x { background: #d92d20; color: #fff; }
.app .rail__x:hover { background: #b42318; }
.compare.is-peek { box-shadow: none; }
.compare.is-peek canvas { background: transparent; }
/* beside each scanned page, a small copy of the photo as taken */
.dw { grid-template-columns: 150px minmax(0, 1fr) 360px; }
.dw__thumb.has-orig { width: 120px; height: 112px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--bg); }
.dw__thumb.has-orig img { border-radius: 3px; }
.dw__thumb .dw__orig { object-fit: cover; object-position: center; opacity: .9; }
@media (max-width: 1100px) { .dw { grid-template-columns: 130px minmax(0, 1fr) 320px; } .dw__thumb.has-orig { width: 104px; } }
@media (max-width: 760px) { .dw { grid-template-columns: minmax(0, 1fr); } .dw__thumb.has-orig { width: 92px; } }
/* the page always fits the space between the bar and the bottom of the window, however tall (a long receipt) */
@media (min-width: 761px) {
  .dw__stage { position: relative; display: block; padding: 0; }
  .dw__page { position: absolute; inset: 24px; width: auto; height: auto; display: block; }
  .dw__page img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; background: none; box-shadow: none; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .08)) drop-shadow(0 8px 20px rgb(0 0 0 / .10)); }
}
.dw__thumb.has-orig { grid-template-rows: minmax(0, 1fr); }
.dw__thumb.has-orig img { height: 100%; min-height: 0; }
.dw__thumb img { object-fit: cover; object-position: top; }
.dw__thumb { overflow: visible; }
.dw__thumb > img:first-child { overflow: hidden; }
/* a small trash can on each document (asks first) */
.rows__row { cursor: pointer; }
.app .doc-trash { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; opacity: .55; transition: opacity .12s, color .12s, background-color .12s; }
.doc-trash svg { width: 17px; height: 17px; }
.rows__row:hover .doc-trash, .doc-card:hover .doc-trash, .doc-trash:focus-visible { opacity: 1; }
.app .doc-trash:hover { color: #d92d20; background: #fef3f2; }
@media (hover: none) { .app .doc-trash { opacity: .8; } }
.app .doc-card { position: relative; cursor: pointer; }
.doc-card .doc-trash { position: absolute; top: 6px; right: 6px; z-index: 2; background: var(--bg); box-shadow: var(--shadow-xs); }

/* selecting documents: a box on each, select all at the top, and a bar with what can be done with them */
.app input.sel { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.rows__row.is-sel { background: color-mix(in srgb, var(--teal) 7%, var(--bg)); }
.doc-card .sel { position: absolute; top: 10px; left: 10px; z-index: 2; }
.doc-card.is-sel .doc-card__thumb { outline: 2px solid var(--ink); outline-offset: 2px; }
.rows__acts { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.rows__acts .doc-trash { opacity: .55; }
.app .doc-dl { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 7px; border-radius: 7px; color: var(--muted); font: 500 .75rem var(--font); text-decoration: none; opacity: .75; }
.doc-dl svg { width: 15px; height: 15px; }
.app .doc-dl:hover { color: var(--ink); background: var(--surface-2); opacity: 1; }
.doc-dl.is-off { opacity: .3; cursor: default; }
.app .doc-dl.is-off:hover { background: none; color: var(--muted); }
.rows__row:hover .doc-dl:not(.is-off) { opacity: 1; }
.tag { flex: none; margin-left: 4px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .75rem; white-space: nowrap; }
.selbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 8px 6px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); flex-wrap: wrap; }
.selbar[hidden], .lib__bar[hidden] { display: none; }
.selbar__n { font-weight: 600; font-size: .875rem; }
.selbar__acts { display: flex; gap: 6px; flex-wrap: wrap; }
.app .selbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); box-shadow: none; gap: 6px; }
.app .selbar .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.selbar .btn svg { width: 16px; height: 16px; }
.app .selbar .sel-del { color: #fda29b; }
.selbar .menu { color: var(--ink); }
@media (max-width: 860px) {
  .rows__row { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
  .doc-dl__t { display: none; }
  .rows__acts .doc-dl { padding: 0 5px; }
  .selbar .btn span { display: none; }
}
.pref { display: grid; gap: 6px; }
.app .pref__seg { margin: 0; width: fit-content; max-width: 100%; }
/* the documents list: the first page as scanned and the photo as taken, side by side */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 100%; height: 100%; }
.pair img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; min-width: 0; }
.pair .pair__photo { object-position: center; }
.rows__thumb:has(.pair) { width: 76px; height: 50px; }
.recent__thumb .pair, .doc-card__thumb .pair { gap: 3px; }
/* the home page's last section: what signing in gives, centred like the questions above */
.keep-cta { max-width: 820px; margin: 0 auto; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 40px 24px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); }
.keep-cta h2 { margin: 0; }
.keep-cta p { margin: 0; max-width: 560px; }
.keep-cta .btn { margin-top: 6px; }

/* ───────── tools.runemic.com: the scanner inside a tool page */
.scanapp { margin-top: 8px; }
.scanapp .drop__h { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0; }
.txt { display: grid; gap: 12px; text-align: left; }
.txt__box { display: grid; gap: 12px; }
.txt__pages { display: grid; gap: 12px; }
.txtpage { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.txtpage__head { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.txtpage .ttext { min-height: 200px; max-height: 60vh; }
.scanapp .start { padding-top: 0; }
.scanapp .drop { max-width: none; }
@media (max-width: 640px) {
  .scanapp .drop { padding: 24px 16px; gap: 10px; }
  .scanapp .drop__icon { display: none; }
  .scanapp .drop__h { font-size: 1.25rem; }
}
