/* Zerokriya PDF — phone first. One column, big targets (48 px+), the page never jumps. */
:root {
  --brand: #4f46e5; --brand-dark: #3730a3; --brand-soft: #eef0ff;
  --ink: #0f172a; --dim: #55607a; --line: #e3e6f0; --bg: #f6f7fc; --card: #fff;
  --ok: #0d9488; --ok-soft: #e3f7f4; --warn: #d97706; --warn-soft: #fff4dc; --bad: #dc2626; --bad-soft: #fdecec;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 17px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 120px; }
a { color: var(--brand); }
.top { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; padding: 10px 16px;
  text-decoration: none; color: var(--ink); font-size: 19px; }
.brand b { color: var(--brand); }
.foot { text-align: center; color: var(--dim); font-size: 14px; padding: 24px 16px 40px; }
.foot p { margin: 4px 0; }

/* home */
.hero { padding: 18px 2px 8px; }
.hero h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
.hero p { margin: 0; color: var(--dim); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding: 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); }
.tile:active { transform: scale(.98); }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; }
.tile .ic svg { width: 24px; height: 24px; stroke: var(--brand); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile b { font-size: 17px; }
.tile small { color: var(--dim); font-size: 14px; line-height: 1.3; }
.tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.tag { font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.soon { margin-top: 14px; color: var(--dim); font-size: 14px; text-align: center; }

/* tool screens */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; color: var(--dim); text-decoration: none; font-size: 16px; }
.tool h1 { font-size: 24px; margin: 0 0 4px; }
.tool .lead { color: var(--dim); margin: 0 0 16px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.step h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 0 0 10px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; padding: 12px 18px;
  border: 0; border-radius: 14px; font: inherit; font-weight: 700; font-size: 18px; cursor: pointer;
  background: var(--brand); color: #fff; -webkit-tap-highlight-color: transparent; }
.btn:active { background: var(--brand-dark); }
.btn[disabled] { background: #c7cbe0; cursor: default; }
.btn.light { background: var(--brand-soft); color: var(--brand-dark); }
.btn.small { min-height: 48px; font-size: 16px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.pick input { display: none; }
label.field { display: block; font-weight: 600; margin: 4px 0 6px; }
input[type=text], input[type=password], select { width: 100%; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 17px; background: #fff; color: var(--ink); }
input[type=text]:focus, input[type=password]:focus, select:focus { outline: none; border-color: var(--brand); }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; cursor: pointer; }
.choice input { width: 22px; height: 22px; accent-color: var(--brand); }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* file list */
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.files li { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.files .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .meta { color: var(--dim); font-size: 13px; }
.ib { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--bg); font-size: 20px; cursor: pointer; color: var(--ink); flex: none; }
.ib:active { background: var(--brand-soft); }

/* pages */
.pages { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.pg { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.pg.gone { opacity: .35; }
.pg .thumb { aspect-ratio: 1 / 1.3; display: grid; place-items: center; background: var(--bg); border-radius: 8px; overflow: hidden; }
.pg img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .2s; }
.pg .num { font-size: 13px; color: var(--dim); margin: 6px 0; }
.pg .acts { display: flex; justify-content: center; gap: 4px; }

/* result + messages */
.note { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); margin: 10px 0; }
.note.ok { background: var(--ok-soft); color: #0b5f58; }
.note.warn { background: var(--warn-soft); color: #8a4b02; }
.note.bad { background: var(--bad-soft); color: #991b1b; }
.badge { display: inline-block; font-weight: 700; padding: 4px 10px; border-radius: 99px; font-size: 15px; }
.badge.ok { background: var(--ok-soft); color: #0b5f58; }
.badge.near { background: var(--warn-soft); color: #8a4b02; }
.preview { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 70vh; background: var(--bg); }
.preview img { display: block; width: 100%; }
.busy { display: flex; align-items: center; gap: 10px; color: var(--dim); min-height: 48px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: s 1s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
.history { margin: 8px 0 0; padding-left: 20px; color: var(--dim); font-size: 15px; }

/* the main action stays in thumb reach */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246,247,252,.96); border-top: 1px solid var(--line); z-index: 6; }
.dock .in { max-width: 640px; margin: 0 auto; }

@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
  .pages { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 32px; }
}

/* [hidden] must win over display rules above */
[hidden] { display: none !important; }
/* long file names shrink with "…" instead of pushing the page sideways */
.files { grid-template-columns: minmax(0, 1fr); }
.files li, .pages .pg { min-width: 0; }
.pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html, body { overflow-x: hidden; }
.pg .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pg .acts .ib { width: 100%; }
.strip { margin-top: 10px; }
.strip small { display: block; color: var(--dim); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 4px; }
.strip img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
details.whole { margin-top: 12px; }
details.whole summary { min-height: 48px; display: flex; align-items: center; color: var(--brand); font-weight: 600; cursor: pointer; }

/* tap-to-edit viewer */
.tool:has(.viewer:not(:empty)) { max-width: 900px; }
.filebar { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-height: 48px; color: var(--dim); font-size: 15px; }
.filebar .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filebar .link { color: var(--brand); font-weight: 600; white-space: nowrap; cursor: pointer; padding: 12px 0; display: inline-block; }
.hint { text-align: center; color: var(--brand-dark); background: var(--brand-soft); border-radius: 12px; padding: 10px; margin: 4px 0 12px; font-weight: 600; }
.viewer { display: grid; gap: 14px; }
.page { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.18); min-height: 200px; }
.page img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.words { position: absolute; inset: 0; }
.word { position: absolute; padding: 0; margin: 0; border: 0; background: transparent; cursor: text; border-radius: 2px; -webkit-tap-highlight-color: transparent; }
.word:hover, .word:focus-visible { background: rgba(79,70,229,.12); outline: 1px solid rgba(79,70,229,.45); }
.word.editing { background: #fff; }
.editbox { position: absolute; z-index: 3; margin: 0; padding: 0 2px; border: 0; outline: 2px solid var(--brand); border-radius: 2px;
  background: #fff; color: #000; line-height: 1; min-height: 0; box-shadow: 0 2px 10px rgba(79,70,229,.35); }
.pnum { position: absolute; right: 8px; bottom: 6px; font-size: 12px; color: var(--dim); background: rgba(255,255,255,.85); padding: 1px 6px; border-radius: 6px; }
.pagemsg { position: absolute; left: 8px; right: 8px; top: 8px; }
.pagebusy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.35); z-index: 4; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 7;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(15,23,42,.18);
  background: var(--ink); color: #fff; }
.toast.ok { background: #0b5f58; } .toast.warn { background: #8a4b02; } .toast.bad { background: #991b1b; }
/* the edit box must look like the word itself, not like a form field */
input.editbox { min-height: 0; padding: 0 1px; border: 0; border-radius: 2px; font-size: inherit; line-height: 1; width: auto; }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom .ib { width: 44px; height: 40px; font-size: 22px; font-weight: 700; }
.zoom span { min-width: 48px; text-align: center; font-weight: 600; color: var(--ink); font-size: 15px; }
.viewer { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.viewer .page { width: calc(var(--zoom, 1) * 100%); }
.filebar { flex-wrap: wrap; }
.reading { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; z-index: 4; white-space: nowrap; }
.pagebusy { gap: 10px; grid-auto-flow: column; align-content: center; justify-content: center; }
.pagebusy .busytext { background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; }
/* word colours: what kind of edit to expect (owner idea, 18 Oct 2026) */
.word.q-g { background: rgba(16,185,129,.16); box-shadow: inset 0 -2px 0 rgba(16,185,129,.75); }
.word.q-y { background: rgba(245,158,11,.20); box-shadow: inset 0 -2px 0 rgba(217,119,6,.85); }
.word.q-r { background: rgba(239,68,68,.16); box-shadow: inset 0 -2px 0 rgba(220,38,38,.8); cursor: not-allowed; }
.viewer.noq .word { background: transparent; box-shadow: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14px; color: var(--dim); margin: -4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 18px; height: 12px; border-radius: 3px; }
.legend i.q-g { background: rgba(16,185,129,.35); } .legend i.q-y { background: rgba(245,158,11,.45); } .legend i.q-r { background: rgba(239,68,68,.4); }
.legend .lgt { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }
.legend .lgt input { width: 20px; height: 20px; accent-color: var(--brand); }

/* every tappable thing looks like a button (owner, 18 Oct 2026) */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; margin: 6px 0 10px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 600; text-decoration: none; }
.back:active { background: var(--brand-soft); }
.ib { background: #fff; border: 1.5px solid var(--line); box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.ib:active { background: var(--brand-soft); border-color: var(--brand); }
.zoom .ib { width: 48px; height: 44px; }
.btn.small.opener { width: auto; min-height: 44px; padding: 8px 14px; font-size: 15px; }
.filebar .pick { margin-left: auto; }
.filebar { gap: 10px; }
.toggle { margin-left: auto; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--dim); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.toggle.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.legend .lgt { display: none; }
/* the hint is information, not a button */
.hint { background: none; padding: 4px 0; text-align: left; color: var(--dim); font-weight: 600; }

/* ---------- scanner app (/app) ---------- */
body.appmode main { padding-bottom: 110px; }
body.appmode:not([data-tab=tools]) .foot, body[data-tab]:not([data-tab=tools]) .about { display: none; }
.appcard { display: grid; gap: 6px; margin-top: 16px; padding: 16px; border-radius: var(--r); text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7c3aed); }
.appcard span:not(.btn) { opacity: .9; font-size: 15px; }
.appcard .btn { background: #fff; color: var(--brand-dark); width: auto; justify-self: start; min-height: 44px; padding: 8px 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; border-radius: 14px;
  color: var(--dim); text-decoration: none; font-size: 12px; font-weight: 600; }
.tab .svg svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--brand); background: var(--brand-soft); }
.tab-scan .svg { background: var(--brand); color: #fff; border-radius: 16px; padding: 6px 14px; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.tab-scan.on { background: none; }
.apphead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-top: 6px; }
.apphead h1 { font-size: 24px; margin: 6px 0 10px; }
.empty { text-align: center; padding: 30px 8px; display: grid; gap: 12px; justify-items: center; }
.empty-art .svg svg { width: 72px; height: 72px; stroke: var(--brand); fill: none; stroke-width: 1.6; }
.empty h2 { margin: 0; } .empty p { margin: 0; color: var(--dim); }
.empty .btn, .empty .pick { width: 100%; max-width: 360px; }
.doclist { display: grid; gap: 10px; }
.doccard { display: flex; align-items: center; gap: 12px; padding: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.doccard:active { background: var(--brand-soft); }
.dthumb { width: 56px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--bg); flex: none; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.dthumb img { max-width: 100%; max-height: 100%; }
.dinfo { flex: 1; min-width: 0; display: grid; } .dinfo b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dinfo small { color: var(--dim); }
.chev { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; border: 1.5px solid var(--line); font-size: 22px; color: var(--dim); }
.tile .chev { display: none; }
.docname { font-size: 22px; margin: 4px 0 2px; word-break: break-word; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 72px; justify-content: center; padding: 8px; background: #fff;
  border: 1.5px solid var(--line); border-radius: 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer; }
.act:active { background: var(--brand-soft); border-color: var(--brand); }
.act .ai { font-size: 22px; line-height: 1; color: var(--brand); }
.act.danger .ai, .act.danger { color: var(--bad); }
.pagesview { display: grid; gap: 12px; }
.remind { background: var(--warn-soft); border: 1.5px solid #f3c77a; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.remind p { margin: 6px 0 10px; color: #6b3d02; }
/* camera */
body.scanning { overflow: hidden; } body.scanning .tabbar { display: none; }
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; display: flex; flex-direction: column; }
.camview { position: relative; flex: 1; display: flex; }
.camview video, .camview .ov { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scantop { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: linear-gradient(#000a, #0000); z-index: 2; }
.scanhint { font-size: 14px; opacity: .9; margin: 0; }
.scanbar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000c); z-index: 2; }
.sbtn { min-height: 48px; min-width: 88px; padding: 8px 14px; border-radius: 14px; border: 1.5px solid #ffffff55; background: #ffffff1f; color: #fff; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sbtn input { display: none; } .sbtn[disabled] { opacity: .45; }
.sbtn.primary { background: var(--brand); border-color: var(--brand); }
.sbtn .count { background: #fff; color: var(--brand-dark); border-radius: 99px; padding: 0 8px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: #ffffff33; box-shadow: 0 0 0 3px #0006; cursor: pointer; flex: none; }
.shutter:active { background: #fff; } .shutter input { display: none; }
.cropview { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 12px 120px; gap: 10px; }
.cropcv { max-width: 100%; max-height: 100%; touch-action: none; border-radius: 6px; }
.review { position: absolute; inset: 0; overflow: auto; background: var(--bg); color: var(--ink); padding: 70px 16px 40px; }
.review .scantop { background: var(--bg); position: fixed; }
.review .sbtn { color: var(--brand-dark); background: #fff; border-color: var(--line); }
.modes { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.modebtn { min-height: 44px; padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 700; color: var(--dim); cursor: pointer; }
.modebtn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.revpages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.revpage { position: relative; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; }
.revpage img { width: 100%; display: block; border-radius: 4px; }
.revacts { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }

/* ---------- one app on every page: tab bar at the bottom (phone) or on the left (computer) ---------- */
body.withtabs { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body.withtabs .dock { bottom: calc(68px + env(safe-area-inset-bottom)); padding-bottom: 12px; }
.lead { color: var(--dim); margin: 0 0 12px; }
.about { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 16px; color: var(--ink); }
.about h2 { font-size: 19px; margin: 22px 0 8px; }
.about h3 { font-size: 16px; margin: 14px 0 4px; }
.about p, .about li { color: var(--dim); font-size: 16px; margin: 0 0 6px; }
.about ol { padding-left: 22px; margin: 0; }
.about .grid { margin-top: 8px; }
.about .tile { min-height: 0; }
@media (min-width: 900px) {
  body.withtabs { padding-bottom: 0; padding-left: 104px; }
  .tabbar { top: 0; right: auto; width: 104px; grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; gap: 8px;
    padding: 76px 8px 16px; border-top: 0; border-right: 1px solid var(--line); }
  .tab { min-height: 72px; }
  body.withtabs .dock { bottom: 0; left: 104px; }
  body.appmode main, body.appmode .about { max-width: 980px; }
  body.appmode .grid { grid-template-columns: repeat(3, 1fr); }
  .brand { max-width: none; padding-left: 24px; }
}
@media (min-width: 1200px) { body.appmode .grid { grid-template-columns: repeat(4, 1fr); } }
/* a tile is tapped like a button: it shows a chevron (owner rule: anything you tap looks tappable) */
.tile { position: relative; }
.tile .chev { display: grid; position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; font-size: 20px; }
/* no empty band between the tool and its how-to text; the fixed button bar needs room only at the very end */
body.withtabs main { flex: none; padding-bottom: 16px; }
body.withtabs:not(.appmode) .about { padding-bottom: 120px; }
body.withtabs:not(.appmode) .foot { padding-bottom: 130px; margin-top: -110px; }
a.btn { text-decoration: none; }
/* tile size follows how often people search for the tool */
.tile.size-xl, .tile.size-l { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; }
.tile.size-xl { min-height: 132px; background: linear-gradient(135deg, var(--brand), #7c3aed); border-color: transparent; color: #fff; }
.tile.size-xl .ic { width: 56px; height: 56px; background: #ffffff26; flex: none; }
.tile.size-xl .ic svg { stroke: #fff; width: 30px; height: 30px; }
.tile.size-xl b { font-size: 21px; } .tile.size-xl small { color: #ffffffd9; font-size: 15px; }
.tile.size-xl .chev { background: #fff; color: var(--brand-dark); border-color: #fff; }
.tile.size-l { min-height: 88px; }
.tile.size-l .ic { flex: none; }
.tile.size-xl .chev, .tile.size-l .chev { position: static; margin-left: auto; flex: none; }
@media (min-width: 900px) { body.appmode .grid .tile.size-xl, body.appmode .grid .tile.size-l { grid-column: span 2; } }
.about .tile.size-xl, .about .tile.size-l { grid-column: auto; flex-direction: column; align-items: flex-start; min-height: 0; background: var(--card); color: var(--ink); }
.about .tile .ic { background: var(--brand-soft); } .about .tile .ic svg { stroke: var(--brand); width: 24px; height: 24px; }
.about .tile small { color: var(--dim); font-size: 14px; } .about .tile b { font-size: 17px; }
.about .tile .chev { position: absolute; background: none; color: var(--dim); border-color: var(--line); }
.about .sizes { display: flex; flex-wrap: wrap; gap: 8px; } .about .sizes .btn { width: auto; }
label.check { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-top: 8px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; cursor: pointer; }
label.check input { width: 22px; height: 22px; accent-color: var(--brand); }
label.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
/* sign */
.sigprev { min-height: 64px; display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; padding: 8px; }
.sigprev img { max-height: 70px; max-width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sigpages { display: grid; gap: 14px; }
.sigpage { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; touch-action: manipulation; cursor: crosshair; }
.sigpage > img { width: 100%; height: 100%; display: block; }
.sigpage .pgno { position: absolute; left: 8px; top: 8px; background: #0009; color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.sigmark { position: absolute; border: 2px dashed var(--brand); border-radius: 6px; touch-action: none; cursor: move; background: #4f46e50d; }
.sigmark img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sigx { position: absolute; right: -14px; top: -14px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-weight: 700; cursor: pointer; }
.sigsize { position: absolute; right: -10px; bottom: -10px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; cursor: nwse-resize; }
.padov { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); }
.padbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.padbar .btn { width: auto; }
.padarea { position: relative; flex: 1; max-height: 340px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; }
.padcv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.padline { position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1.5px dashed #c5cad8; pointer-events: none; }

/* Install button (server rule 20 Oct 2026): in the top bar on every screen (owner 20 Oct 2026: at the top, not in
   the middle); hidden only in the installed app. Tap opens Chrome's install directly; steps only when none is offered. */
.topin { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; padding-right: 16px; }
.topin .brand { flex: 1; min-width: 0; margin: 0; }
.btn.install { flex: none; width: auto; min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn.install[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 75vh; overflow: auto; border-radius: var(--r) var(--r) 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); text-align: left; color: var(--ink); }
.steps { margin: 10px 0 16px; padding-left: 22px; } .steps li { margin: 8px 0; }
/* Edit PDF: what a tap does (Change / Add text / Delete), in thumb reach above Undo + Download */
.editdock .modes { display: flex; gap: 6px; margin-bottom: 8px; }
.modebtn { flex: 1; min-width: 0; min-height: 44px; padding: 6px 4px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.modebtn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.editdock .row .btn { min-height: 48px; font-size: 16px; }
body.editdocked main { padding-bottom: 150px; }
body.editdocked .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
body.withtabs.editdocked .toast { bottom: calc(220px + env(safe-area-inset-bottom)); }
.viewer[data-mode=add] .words { cursor: crosshair; }
/* add mode: words must not catch taps, or the phone snaps a tap on blank space beside a word onto the word */
.viewer[data-mode=add] .word { pointer-events: none; }
.viewer[data-mode=delete] .word:not(.q-r) { cursor: pointer; }
.viewer[data-mode=delete] .word:not(.q-r):hover { background: rgba(239,68,68,.22); outline: 1px solid rgba(220,38,38,.6); }
input.addbox::placeholder { color: #94a3b8; }
/* Rewrite mode: paragraphs outlined, words out of the way; the panel to rewrite one */
.blk { position: absolute; display: none; padding: 0; margin: 0; border: 0; border-radius: 3px; background: rgba(79,70,229,.06);
  outline: 1.5px dashed rgba(79,70,229,.75); outline-offset: 1px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.viewer[data-mode=rewrite] .blk { display: block; }
.viewer[data-mode=rewrite] .word { pointer-events: none; background: transparent; box-shadow: none; }
.blk:hover, .blk:focus-visible { background: rgba(79,70,229,.14); }
.editdock .modebtn { font-size: 14px; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(15,23,42,.22); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet .in { max-width: 640px; margin: 0 auto; display: grid; gap: 8px; }
.sheet b { font-size: 17px; }
.sheet .meta { margin: 0; color: var(--dim); font-size: 14px; }
.sheetbox { width: 100%; box-sizing: border-box; min-height: 96px; font: inherit; font-size: 16px; line-height: 1.45; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; resize: none; color: var(--ink); background: #fff; }
.sheetbox:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
body.sheetopen .dock { visibility: hidden; }

/* ---------- viewer (v3.22): any PDF or picture, full screen; bars hide while reading ---------- */
body.viewing { overflow: hidden; } body.viewing .tabbar, body.viewing .top { display: none; }
body.viewing .toast { z-index: 1100; bottom: calc(92px + env(safe-area-inset-bottom)); }
body.viewing .modal { z-index: 1100; }
.vw { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #e8eaf1; color: var(--ink); --barfg: var(--ink); --barbg: rgba(255,255,255,.94); }
.vw[data-look=night] { background: #121418; --barfg: #e7e9ee; --barbg: rgba(26,28,34,.94); }
.vw[data-look=night] canvas { filter: invert(.9) hue-rotate(180deg); }
.vw[data-look=paper] { background: #e9e1d2; }
.vw[data-look=paper] canvas { filter: sepia(.38) brightness(.98) contrast(.98); }
.vwtop { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px; background: var(--barbg); color: var(--barfg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(0,0,0,.08); transition: transform .22s ease; }
.vwtitle { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.vwtitle b { font-size: 16px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vwtitle small { font-size: 12.5px; opacity: .7; }
.vwib { flex: none; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 12px; border: 1.5px solid rgba(127,127,127,.35); background: rgba(127,127,127,.12);
  color: var(--barfg); font: inherit; font-size: 19px; font-weight: 700; cursor: pointer; display: inline-grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.vwib:active { background: rgba(79,70,229,.2); }
.vwib[hidden] { display: none; }
.vwback { font-size: 28px; line-height: 1; padding-bottom: 3px; }
.vwdesk { display: none; } @media (pointer: fine) { .vwdesk { display: inline-grid; } }
.vwfind { position: absolute; top: calc(60px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 3; display: flex; gap: 6px; align-items: center; padding: 6px 8px 8px; background: var(--barbg); color: var(--barfg); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.vwfind[hidden] { display: none; }
.vwfind input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); font: inherit; font-size: 16px; }
.vwfcount { flex: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.vwscroll { position: relative; flex: 1; overflow: auto; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: calc(68px + env(safe-area-inset-top)) 0 calc(96px + env(safe-area-inset-bottom)); }
.vw.finding .vwscroll { padding-top: calc(124px + env(safe-area-inset-top)); }
.vwpages { margin: 0 auto; display: flex; flex-direction: column; gap: calc(10px * var(--z, 1)); padding: 0 0 8px; will-change: transform; }
.vwpage { position: relative; width: 100%; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.12), 0 6px 18px rgba(15,23,42,.08); border-radius: 3px; overflow: hidden;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.vw[data-look=night] .vwpage { background: #1c1e23; box-shadow: none; }
.vwpage::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(127,127,127,.10) 50%, transparent 70%); background-size: 220% 100%; animation: vwshine 1.2s linear infinite; }
.vwpage.drawn::before { display: none; }
@keyframes vwshine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.vwbase { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .18s; }
.vwpage.drawn .vwbase { opacity: 1; }
.vwsharp { position: absolute; display: block; pointer-events: none; }
.vwhits { position: absolute; inset: 0; pointer-events: none; }
.vwhits i { position: absolute; background: rgba(250,204,21,.42); outline: 1px solid rgba(202,138,4,.6); border-radius: 2px; }
.vwhits i.cur { background: rgba(249,115,22,.5); outline: 2px solid #ea580c; }
.vwloading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 60px 0; color: var(--dim); }
.vwpill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 3; min-height: 36px; padding: 6px 14px;
  border-radius: 99px; border: 0; background: rgba(15,23,42,.78); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: bottom .22s ease; }
.vwpill[hidden] { display: none; }
.vwbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--barbg); color: var(--barfg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -1px 0 rgba(0,0,0,.08); transition: transform .22s ease; }
.vwact { min-width: 0; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px;
  border-radius: 14px; border: 1.5px solid rgba(127,127,127,.3); background: rgba(127,127,127,.1); color: var(--barfg); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.vwact:active { background: rgba(79,70,229,.2); border-color: var(--brand); }
.vwai { font-size: 20px; line-height: 1.1; }
.vw.immersive .vwtop { transform: translateY(-110%); }
.vw.immersive .vwbar { transform: translateY(110%); }
.vw.immersive .vwpill { bottom: calc(16px + env(safe-area-inset-bottom)); }
.vw.immersive .vwfind { display: none; }
.vwmsg { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 24px; }
.vwmsg[hidden] { display: none; }
.vwmsg > p, .vwpw { max-width: 360px; width: 100%; background: #fff; color: var(--ink); border-radius: 16px; padding: 18px; box-shadow: 0 6px 24px rgba(15,23,42,.15); margin: 0; }
.vwpw { display: grid; gap: 10px; } .vwpw p { margin: 0; color: var(--dim); font-size: 15px; }
.vwtip { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 4; background: rgba(15,23,42,.8); color: #fff; padding: 8px 16px; border-radius: 99px; font-size: 15px; font-weight: 600; pointer-events: none; }
.vwtip[hidden] { display: none; }
.vwsheet { position: absolute; inset: 0; z-index: 5; background: rgba(15,23,42,.4); display: flex; align-items: flex-end; }
.vwsheet .in { width: 100%; max-width: 640px; margin: 0 auto; background: #fff; color: var(--ink); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.vwsheet input { width: 100%; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; font-size: 18px; }

/* ---------- documents: folders, cards with a ⋯ button, long press ---------- */
.docbtns { margin: 2px 0 12px; } .docbtns .pick { display: block; } .docbtns .btn { min-height: 48px; font-size: 16px; }
.docsearch { width: 100%; min-height: 48px; padding: 8px 14px; margin-bottom: 12px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; background: #fff; }
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.doccard, .foldercard { display: flex; align-items: center; gap: 6px; padding: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink);
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.doccard:active, .foldercard:active { background: var(--brand-soft); }
.docmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; padding: 2px; -webkit-touch-callout: none; }
.docmain img { -webkit-user-drag: none; pointer-events: none; }
.dthumb.pic { width: 64px; height: 64px; } .dthumb.pic img { width: 100%; height: 100%; object-fit: cover; }
.nothumb { font-size: 13px; font-weight: 800; color: var(--dim); }
.dinfo b { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fico { font-size: 30px; line-height: 1; flex: none; }
.morebtn { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; display: grid; place-items: center; padding: 0; }
.morebtn:active { background: var(--brand-soft); border-color: var(--brand); }
.btn.morebtn { width: 48px; min-height: 48px; flex: none; }
.backbtn { width: auto; display: inline-flex; padding: 8px 16px; margin: 4px 0 10px; text-decoration: none; }
.folderhead { display: flex; align-items: center; gap: 10px; } .folderhead h1 { flex: 1; min-width: 0; }
.emptyfolder, .presstip { text-align: center; margin: 16px 4px; color: var(--dim); }
.appsheet { max-height: 85vh; }
.appsheet .in { display: grid; gap: 10px; }
.sheethead { display: flex; align-items: center; gap: 12px; } .sheethead .dthumb { width: 48px; height: 60px; }
.sheetlabel { margin: 6px 0 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); }
.toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.toolbtn { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px 4px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; line-height: 1.15; }
.toolbtn:active { background: var(--brand-soft); border-color: var(--brand); }
.toolbtn .ti { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); font-size: 18px; font-weight: 800; }
.toolbtn .ti svg { width: 20px; height: 20px; stroke: var(--brand); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.actgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.actgrid .act { min-height: 64px; }
.folderopts { display: grid; gap: 8px; max-height: 45vh; overflow: auto; }
.folderopt { min-height: 50px; padding: 10px 14px; text-align: left; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.folderopt.on { border-color: var(--brand); background: var(--brand-soft); }
.keepbtn { margin-top: 10px; text-decoration: none; }
/* app menus sit above everything (the Help button steps aside while one is open) */
.modal.appmodal { z-index: 1100; }
.docbtns .btn { font-size: 15px; padding: 10px 12px; }
