/* PDF Studio — design system. Same family as akshayjohny.com: warm paper, ink, lime, electric blue. */
:root {
  --paper: #f4efe4;
  --paper-2: #ece5d6;
  --paper-3: #e3dac7;
  --card: #fbf8f1;
  --ink: #111714;
  --ink-2: #3a413d;
  --ink-3: #6c726d;
  --ink-4: #9a9d96;
  --line: rgba(17, 23, 20, .14);
  --line-2: rgba(17, 23, 20, .28);
  --lime: #c7ff38;
  --lime-2: #b7ef29;
  --blue: #3757ff;
  --blue-soft: #e4e8ff;
  --ok: #1d7a48;
  --ok-soft: #dff0e3;
  --warn: #9a6400;
  --warn-soft: #f8ecc9;
  --bad: #c0331d;
  --bad-soft: #f8dfd7;
  --display: "Helvetica Neue", Helvetica, Arial, "Nimbus Sans", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --shadow: 6px 6px 0 var(--ink);
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--lime); color: var(--ink); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.045em; line-height: .92; margin: 0 0 .4em; }
h3 { letter-spacing: -.02em; line-height: 1.1; }
em.s, .s { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--blue); letter-spacing: -.03em; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-3); }
code, .mono { font-family: var(--mono); font-size: .88em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .16em; color: var(--ink-2); }
.label .dot { display: inline-block; width: 7px; height: 7px; background: var(--blue); border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--lime); border: 2px solid var(--ink); padding: 8px 12px; font: 600 13px var(--sans); }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn { --b: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 46px; padding: 0 20px;
  border: 1px solid var(--b); background: transparent; color: var(--ink); font: 600 14px/1 var(--sans); letter-spacing: -.005em; cursor: pointer;
  text-decoration: none; white-space: nowrap; border-radius: 0; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s; }
.btn:hover { background: var(--paper-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible, .tile:focus-within, .fcard:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px; }
.btn.primary { background: var(--lime); }
.btn.primary:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); background: var(--lime); }
.btn.primary:active { transform: none; box-shadow: none; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: #24302a; }
.btn.danger { color: var(--bad); --b: color-mix(in srgb, var(--bad) 55%, transparent); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; --b: var(--bad); }
.btn.ghost { border-color: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.xl { min-height: 64px; padding: 0 34px; font-size: 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn .arr { font-family: var(--mono); font-weight: 400; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.link { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Forms ---------- */
label { display: block; font: 600 13px/1.3 var(--sans); margin: 0 0 7px; }
.hint { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 0; background: var(--card); color: var(--ink);
  font: 16px/1.35 var(--sans); transition: border-color .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 140px; resize: vertical; font: 13px/1.5 var(--mono); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.pw { position: relative; }
.pw input { padding-right: 52px; }
.pw-eye { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 46px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); }
.pw-eye:hover { color: var(--ink); }
.pw-eye svg { width: 20px; height: 20px; }
.check { display: flex; align-items: flex-start; gap: 10px; font: 500 14px/1.4 var(--sans); cursor: pointer; margin: 0; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.alert { padding: 12px 14px; margin-bottom: 16px; font-size: 14px; border: 1px solid; border-left-width: 4px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.alert.info { background: var(--blue-soft); color: var(--ink-2); border-color: var(--blue); }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { font: 800 22px/1 var(--display); letter-spacing: -.06em; text-decoration: none; margin-right: auto; display: flex; align-items: baseline; gap: 10px; }
.brand b { color: var(--blue); }
.brand small { font: 600 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a:not(.btn) { font-size: 13px; font-weight: 600; text-decoration: none; }
.nav-links a:not(.btn):hover { text-decoration: underline; text-underline-offset: 4px; }
.who { font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .nav-links .hide-sm { display: none; } .who { display: none; } .brand small { display: none; } .nav-links { gap: 10px; } }
.banner { background: var(--ink); color: var(--paper); font: 600 12px/1.4 var(--mono); letter-spacing: .06em; text-align: center; padding: 9px 16px; }
.banner.warn { background: var(--lime); color: var(--ink); }

/* ---------- Landing ---------- */
.hero { position: relative; padding: 48px 0 28px; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; min-height: calc(100vh - 150px); }
.hero h1 { font-size: clamp(50px, 6.9vw, 104px); margin: 18px 0 26px; }
.hero h1 .s { display: inline-block; }
.lede { font-size: 17px; line-height: 1.55; color: var(--ink-2); max-width: 30em; }
.hero .btn-row { margin-top: 28px; }
.hero-meta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.hero-stage { position: relative; height: min(68vh, 640px); min-height: 380px; }
.hero-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.hero-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.tag3d { position: absolute; z-index: 2; background: var(--card); border: 1px solid var(--ink); padding: 6px 9px; font: 600 10px/1 var(--mono); letter-spacing: .14em;
  text-transform: uppercase; pointer-events: none; white-space: nowrap; transition: opacity .4s; }
.tag3d i { font-style: normal; color: var(--blue); margin-right: 6px; }
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; min-height: 0; }
  .hero-stage { height: 420px; min-height: 0; order: -1; margin: -12px -16px 0; }
}
.ticker { background: var(--ink); color: var(--paper); overflow: hidden; border-block: 1px solid var(--ink); }
.ticker-track { display: flex; width: max-content; animation: tick 38s linear infinite; }
.ticker span { font: 700 12px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; padding: 15px 0; white-space: nowrap; }
.ticker span::after { content: "✦"; color: var(--lime); margin: 0 26px; }
@keyframes tick { to { transform: translateX(-50%); } }

.sec { padding: 96px 0; border-bottom: 1px solid var(--line); }
.sec-head { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-bottom: 52px; align-items: start; }
.sec-head h2 { font-size: clamp(40px, 6.4vw, 84px); margin: 0; }
@media (max-width: 760px) { .sec { padding: 64px 0; } .sec-head { grid-template-columns: 1fr; gap: 14px; margin-bottom: 34px; } }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.step { padding: 26px 26px 30px 0; border-right: 1px solid var(--line); }
.step + .step { padding-left: 26px; }
.step:last-child { border-right: 0; }
.step .n { font: 800 72px/1 var(--display); letter-spacing: -.06em; color: transparent; -webkit-text-stroke: 1px var(--ink); margin-bottom: 26px; }
.step h3 { font-size: 26px; }
.step p { color: var(--ink-2); margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } .step, .step + .step { padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); } }
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--ink); background: var(--ink); }
.fmt { padding: 26px; background: var(--card); min-height: 260px; display: flex; flex-direction: column; transition: background .2s; }
.fmt:hover { background: var(--lime); }
.fmt .ext { font: 800 58px/1 var(--display); letter-spacing: -.06em; margin-bottom: auto; }
.fmt .ext small { display: block; font: 600 10px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 10px; }
.fmt h3 { font-size: 20px; margin: 30px 0 6px; }
.fmt p { font-size: 14px; color: var(--ink-2); margin: 0; min-height: 4.5em; }
@media (max-width: 900px) { .formats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .formats { grid-template-columns: 1fr; } .fmt { min-height: 0; } .fmt .ext { margin-bottom: 18px; } }
.runway { border-top: 1px solid var(--ink); }
.run { display: grid; grid-template-columns: 70px 1fr 1.2fr 104px; gap: 18px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); }
.run .i { font: 600 12px/1 var(--mono); color: var(--ink-3); }
.run h3 { font-size: 24px; margin: 0; }
.run p { margin: 0; color: var(--ink-2); font-size: 15px; }
.run .chip { justify-self: end; }
@media (max-width: 760px) { .run { grid-template-columns: 44px 1fr; } .run p { grid-column: 2; } .run .chip { display: none; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--ink); font: 600 10px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; background: var(--card); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.chip.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.chip.lime { background: var(--lime); }
.chip.blue { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.chip.ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.faq { max-width: 860px; }
.faq details { border-bottom: 1px solid var(--line-2); }
.faq summary { list-style: none; cursor: pointer; padding: 22px 40px 22px 0; position: relative; font: 700 19px/1.3 var(--display); letter-spacing: -.02em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 18px; font: 400 26px/1 var(--mono); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); padding: 0 40px 22px 0; margin: 0; }
.cta { padding: 120px 0; text-align: left; }
.cta h2 { font-size: clamp(54px, 10vw, 140px); }
.footer { padding: 26px 0 40px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; font: 600 11px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.rv .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rv .reveal.in { opacity: 1; transform: none; }

/* ---------- Auth ---------- */
.auth { min-height: calc(100vh - 65px); display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; background: var(--ink); color: var(--paper); padding: 48px; display: flex; flex-direction: column; justify-content: flex-start; gap: 34px; overflow: hidden; }
.auth-art h2 { font-size: clamp(44px, 5.2vw, 80px); color: var(--paper); position: relative; z-index: 1; max-width: 9.5ch; }
.auth-art .s { color: var(--lime); }
.auth-art .label { color: var(--ink-4); position: relative; z-index: 1; }
.auth-art .pages { position: absolute; right: -40px; bottom: -70px; width: 380px; height: 420px; pointer-events: none; }
.auth-art .pg { position: absolute; width: 230px; height: 310px; background: var(--card); border: 1px solid var(--paper); box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.auth-art .pg:nth-child(1) { right: 120px; bottom: 60px; transform: rotate(-12deg); background: #d9d3c4; }
.auth-art .pg:nth-child(2) { right: 60px; bottom: 40px; transform: rotate(-3deg); }
.auth-art .pg:nth-child(3) { right: 0; bottom: 20px; transform: rotate(7deg); background: var(--lime); }
.auth-art .pg::before { content: ""; position: absolute; inset: 34px 26px auto; height: 120px; background: repeating-linear-gradient(to bottom, rgba(17,23,20,.32) 0 2px, transparent 2px 12px); }
.auth-side { display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 56px; margin: 14px 0 10px; }
.auth-card .btn.primary { width: 100%; margin-top: 6px; min-height: 52px; font-size: 15px; }
.auth-foot { margin-top: 20px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .auth-card h1 { font-size: 46px; } }

/* ---------- App ---------- */
.page { padding: 32px 0 80px; }
.page-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(40px, 6vw, 72px); margin: 8px 0 0; }
.card { background: var(--card); border: 1px solid var(--ink); padding: 22px; }
.card.flat { border-color: var(--line-2); }
.stack > * + * { margin-top: 22px; }

/* Upload — empty state */
.studio { position: relative; border: 1px solid var(--ink); background: var(--card); }
.pick { display: grid; place-items: center; text-align: center; padding: 72px 20px 64px; position: relative; overflow: hidden; }
.pick h2 { font-size: clamp(38px, 6vw, 76px); margin: 14px 0 12px; }
.pick p { color: var(--ink-2); max-width: 34em; margin: 0 auto 30px; }
.pick .btn.xl { box-shadow: var(--shadow); }
.pick .btn.xl:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.pick .or { margin-top: 18px; font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.pick .types { margin-top: 26px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pick::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, transparent 30%, #000 85%); -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, #000 85%); pointer-events: none; opacity: .6; }
.dropveil { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--lime) 88%, transparent); display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; }
.dropveil.on { opacity: 1; }
.dropveil div { font: 800 clamp(40px, 7vw, 96px)/1 var(--display); letter-spacing: -.05em; border: 2px dashed var(--ink); padding: 40px 50px; }

/* Upload — files chosen */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 520px; }
.files-area { padding: 22px; border-right: 1px solid var(--ink); }
.files-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.fcard { position: relative; background: var(--paper); border: 1px solid var(--line-2); padding: 10px 10px 12px; cursor: grab; user-select: none; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.fcard:hover { border-color: var(--ink); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.fcard.dragging { opacity: .35; }
.fcard.over { outline: 2px dashed var(--blue); outline-offset: 4px; }
.fthumb { aspect-ratio: 3 / 4; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.fthumb img, .fthumb canvas { max-width: 100%; max-height: 100%; display: block; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.fthumb .spin { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fname { margin-top: 9px; font: 600 12px/1.3 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta { font: 600 10px/1.4 var(--mono); letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; }
.fidx { position: absolute; top: -10px; left: -10px; width: 26px; height: 26px; background: var(--ink); color: var(--paper); font: 700 11px/26px var(--mono); text-align: center; }
.ftools { position: absolute; top: 16px; right: 16px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.fcard:hover .ftools, .fcard:focus-within .ftools { opacity: 1; }
@media (hover: none) { .ftools { opacity: 1; } }
.ftools .mv { display: none; }
@media (hover: none), (max-width: 700px) { .ftools .mv { display: grid; } }
.ftools button { width: 30px; height: 30px; border: 1px solid var(--ink); background: var(--card); cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--ink); }
.ftools button:hover { background: var(--lime); }
.ftools button.x:hover { background: var(--bad); color: #fff; }
.ftools svg { width: 15px; height: 15px; }
.fadd { border: 1px dashed var(--ink-3); background: transparent; display: grid; place-items: center; min-height: 230px; cursor: pointer; font: 600 13px var(--sans); color: var(--ink-2); padding: 10px; }
.fadd:hover { border-color: var(--ink); background: var(--paper-2); color: var(--ink); }
.fadd b { display: block; font: 300 46px/1 var(--display); margin-bottom: 8px; }
.side { padding: 22px; display: flex; flex-direction: column; gap: 4px; background: var(--paper); }
.side h3 { font-size: 26px; margin: 0 0 4px; }
.outs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 6px; }
.tile { position: relative; border: 1px solid var(--line-2); background: var(--card); padding: 12px; cursor: pointer; display: block; margin: 0; transition: border-color .15s, background .15s; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile b { display: block; font: 800 22px/1 var(--display); letter-spacing: -.05em; }
.tile span { display: block; font: 500 12px/1.3 var(--sans); color: var(--ink-3); margin-top: 5px; }
.tile::after { content: ""; position: absolute; top: 10px; right: 10px; width: 14px; height: 14px; border: 1px solid var(--ink-3); background: var(--card); }
.tile:has(input:checked) { border-color: var(--ink); background: var(--lime); }
.tile:has(input:checked)::after { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--lime); }
.tile:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.summary { display: flex; justify-content: space-between; gap: 10px; font: 600 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: auto; }
.side .btn.go { width: 100%; min-height: 60px; font-size: 17px; margin-top: 12px; box-shadow: var(--shadow); }
.side .btn.go:hover { box-shadow: 8px 8px 0 var(--ink); }
@media (max-width: 960px) {
  .workbench { grid-template-columns: 1fr; }
  .files-area { border-right: 0; border-bottom: 1px solid var(--ink); }
  .fgrid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .side .btn.go { position: sticky; bottom: 12px; }
}

/* Progress */
.run-view { padding: 34px 26px; }
.run-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.pct { font: 800 clamp(80px, 14vw, 180px)/.85 var(--display); letter-spacing: -.07em; }
.pct small { font-size: .32em; letter-spacing: -.03em; }
.bar { height: 10px; background: var(--paper-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .35s var(--ease); }
.bar.lime > i { background: var(--lime); }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.big-bar { height: 18px; border: 1px solid var(--ink); background: var(--card); margin: 26px 0 14px; }
.big-bar > i { background: var(--lime); border-right: 1px solid var(--ink); }
.run-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.run-log { margin-top: 18px; font: 500 12px/1.6 var(--mono); color: var(--ink-2); max-height: 128px; overflow: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.run-log div:first-child { color: var(--ink); font-weight: 700; }
.done-view { padding: 44px 26px; }
.done-view h2 { font-size: clamp(44px, 7vw, 92px); }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 26px; }
.dl { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--ink); background: var(--paper); padding: 18px; text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s, background .18s; }
.dl:hover { background: var(--lime); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.dl b { font: 800 34px/1 var(--display); letter-spacing: -.05em; }
.dl span { font-size: 13px; color: var(--ink-2); }

/* Lists & meters */
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--ink); background: var(--card); }
.meter { padding: 16px 18px; border-right: 1px solid var(--line-2); }
.meter:last-child { border-right: 0; }
.meter .val { font: 800 26px/1.1 var(--display); letter-spacing: -.04em; margin: 6px 0 10px; }
.list { border-top: 1px solid var(--ink); }
.doc { display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.doc-title { font: 700 17px/1.3 var(--display); letter-spacing: -.02em; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-meta { font: 600 10px/1.6 var(--mono); letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.doc .btn-row { justify-content: flex-end; gap: 6px; }
@media (max-width: 700px) { .doc { grid-template-columns: 1fr; } .doc .btn-row { justify-content: flex-start; } }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); font-size: 14px; }
.err-text { color: var(--bad); font: 500 12px/1.4 var(--sans); text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.tabs { position: sticky; top: 88px; display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.tab { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); font: 600 14px var(--sans); text-align: left; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected=true] { color: var(--ink); background: linear-gradient(90deg, var(--lime) 0 4px, transparent 4px); padding-left: 14px; }
.tab .count { background: var(--blue); color: #fff; font: 700 11px/20px var(--mono); padding: 0 7px; }
@media (max-width: 880px) { .admin-layout { grid-template-columns: 1fr; } .tabs { position: static; flex-direction: row; overflow-x: auto; border: 1px solid var(--ink); }
  .tab { flex: none; padding: 0 14px; border-bottom: 0; border-right: 1px solid var(--line-2); } .tab[aria-selected=true] { background: var(--lime); padding-left: 14px; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); border: 1px solid var(--ink); background: var(--card); }
.stat { padding: 16px 18px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.stat .val { font: 800 28px/1.1 var(--display); letter-spacing: -.05em; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.panel-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; margin: 0 0 14px; }
.panel-title h2 { font-size: 34px; margin: 0; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 600 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); background: var(--paper-2); white-space: nowrap; border-bottom-color: var(--ink); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .btn-row { flex-wrap: nowrap; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 300px; min-height: 40px; padding: 8px 11px; }
.toolbar select { width: auto; min-height: 40px; padding: 8px 36px 8px 11px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 10px 0 0; border-bottom: 1px solid var(--ink); }
.chart .col { flex: 1; display: flex; flex-direction: column-reverse; min-width: 4px; height: 100%; }
.chart .free { background: var(--ink); }
.chart .paid { background: var(--blue); }
.chart .txt { background: var(--lime); }
.legend { display: flex; gap: 16px; font: 600 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); flex-wrap: wrap; margin-bottom: 6px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; background: var(--c); border: 1px solid var(--ink); vertical-align: -1px; }
.settings-group { margin-bottom: 18px; }
.settings-group h3 { font-size: 22px; margin-bottom: 14px; }
.key-box { display: flex; gap: 8px; flex-wrap: wrap; }
.key-box > :first-child { flex: 1; min-width: 220px; }

/* ---------- Toast & dialog ---------- */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--paper); padding: 13px 16px; font-size: 14px; border-left: 6px solid var(--lime); animation: tin .25s var(--ease); }
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--lime); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
dialog { border: 1px solid var(--ink); border-radius: 0; padding: 0; background: var(--card); color: var(--ink); width: min(94vw, 500px); box-shadow: 10px 10px 0 var(--ink); }
dialog::backdrop { background: rgba(17, 23, 20, .5); backdrop-filter: blur(2px); }
.dlg-body { padding: 26px; }
.dlg-body h2 { font-size: 32px; }
.dlg-foot { padding: 14px 26px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--paper-2); }
.secret { font: 700 20px var(--mono); background: var(--lime); border: 1px solid var(--ink); padding: 14px; text-align: center; user-select: all; overflow-wrap: anywhere; }

.lab { font: 600 10px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.stats .stat:last-child { border-right: 0; }
.key-box .pw { flex: 1; min-width: 220px; }

/* ---------- v3: camera scan, background reading, document page, tools ---------- */
.btn-row.center { justify-content: center; }
.pick .or a { color: var(--blue); }
.fadd-wrap { display: grid; grid-template-rows: 1fr auto; gap: 8px; min-height: 230px; }
.fadd-wrap .fadd { min-height: 0; }
.fadd.cam { min-height: 64px; }
.fadd.cam b { font-size: 22px; margin-bottom: 2px; }
.small-check { font-size: 13px; margin: 6px 0 10px; color: var(--ink-2); }
.small-check.hidden { display: none; }
.doc-title a { color: inherit; text-decoration: none; }
.doc-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.scanner { position: fixed; inset: 0; z-index: 90; background: var(--paper); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.scan-top, .scan-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ink); background: var(--paper); }
.scan-bottom { border-top: 1px solid var(--ink); border-bottom: 0; flex-wrap: wrap; }
.scan-stage { overflow: auto; padding: 16px; display: grid; place-items: center; }
.scan-empty { text-align: center; max-width: 34em; }
.scan-empty h2 { font-size: clamp(34px, 7vw, 64px); margin: 12px 0; }
.scan-empty .btn-row { justify-content: center; margin-top: 18px; }
.scan-editor { width: 100%; max-width: 920px; display: grid; gap: 12px; }
.scan-wrap { position: relative; display: grid; place-items: center; touch-action: none; }
.scan-canvas { max-width: 100%; border: 1px solid var(--ink); background: var(--ink); }
.scan-h { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px solid var(--ink); background: var(--lime); cursor: grab; touch-action: none; padding: 0; box-shadow: 2px 2px 0 var(--ink); }
.scan-h:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.scan-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.segs { display: inline-flex; border: 1px solid var(--ink); }
.seg { border: 0; border-right: 1px solid var(--ink); background: var(--card); padding: 0 14px; min-height: 40px; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.seg:last-child { border-right: 0; }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.scan-strip { display: flex; gap: 8px; overflow-x: auto; min-height: 64px; flex: 1; align-items: center; }
.scan-thumb { position: relative; flex: none; border: 1px solid var(--ink); background: var(--card); }
.scan-thumb img { display: block; height: 64px; }
.scan-thumb span { position: absolute; left: 0; top: 0; background: var(--ink); color: var(--paper); font: 600 10px var(--mono); padding: 2px 5px; }
.scan-thumb button { position: absolute; right: -8px; top: -8px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ink); background: var(--card); cursor: pointer; line-height: 1; padding: 0; }

/* document page */
.doc-hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; }
.doc-hero h1 { font-size: clamp(34px, 5vw, 64px); margin: 12px 0 8px; overflow-wrap: anywhere; }
@media (max-width: 760px) { .doc-hero { grid-template-columns: 1fr; } }
.dtabs { display: flex; gap: 0; border: 1px solid var(--ink); background: var(--card); overflow-x: auto; }
.dtab { flex: 1 0 auto; border: 0; border-right: 1px solid var(--ink); background: transparent; padding: 14px 18px; font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; color: var(--ink-2); }
.dtab:last-child { border-right: 0; }
.dtab[aria-selected="true"] { background: var(--lime); color: var(--ink); }
.dpanel { border: 1px solid var(--ink); border-top: 0; background: var(--card); padding: clamp(16px, 3vw, 32px); }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .review { grid-template-columns: 1fr; } }
.review-img { border: 1px solid var(--line-2); background: var(--paper-2); min-height: 320px; display: grid; place-items: center; overflow: auto; max-height: 78vh; }
.review-img { place-items: start center; }
.review-img img { width: 100%; height: auto; display: block; }
.review textarea { min-height: 60vh; font: 14px/1.6 var(--mono); resize: vertical; }
.review-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pager { display: flex; gap: 6px; align-items: center; }
.pager input { width: 80px; min-height: 40px; text-align: center; }
.answer { border-left: 4px solid var(--lime); background: var(--paper); padding: 16px 18px; margin-top: 16px; white-space: pre-wrap; }
.answer a { color: var(--blue); }
.qa-hist { display: grid; gap: 14px; margin-top: 16px; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { font: 13px var(--mono); }

/* tools page */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.tool { border: 0; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: var(--card); padding: 22px; text-align: left; cursor: pointer; display: grid; gap: 8px; align-content: start; min-height: 150px; font: inherit; color: inherit; }
.tool:hover { background: var(--lime); }
.tool[aria-current="true"] { background: var(--ink); color: var(--paper); }
.tool[aria-current="true"] .muted { color: var(--ink-4); }
a.tool { text-decoration: none; color: inherit; }
.tool.studio .n { color: var(--blue); }
.tool b { font: 800 26px/1 var(--display); letter-spacing: -.05em; }
.tool .n { font: 600 11px var(--mono); letter-spacing: .14em; color: var(--ink-3); }
@media (max-width: 560px) {
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .tool { padding: 14px 12px; min-height: 0; gap: 6px; }
  .tool b { font-size: 19px; }
  .tool .muted { font-size: 12.5px; line-height: 1.35; }
  .tool .n { font-size: 10px; letter-spacing: .08em; }
}
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.pcard { position: relative; border: 1px solid var(--line-2); background: var(--card); padding: 8px; display: grid; gap: 6px; cursor: grab; }
.pcard img { width: 100%; display: block; border: 1px solid var(--line); background: #fff; }
.pcard.off { opacity: .35; }
.pcard .pn { font: 600 10px var(--mono); letter-spacing: .1em; color: var(--ink-3); }
.pcard .ptools { display: flex; gap: 4px; }
.pcard .ptools button { flex: 1; min-height: 30px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font: 600 12px var(--sans); }
.pcard.over { outline: 2px dashed var(--blue); }
.spin { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.dpanel .dl-grid { margin-top: 12px; }

@media (max-width: 640px) {
  .dtabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .dtab { border-bottom: 1px solid var(--ink); padding: 12px 8px; font-size: 11px; }
  .dtab:nth-child(2n) { border-right: 0; }
  .dtab:nth-last-child(-n+2) { border-bottom: 0; }
  .dl-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dl { padding: 14px; }
  .dl b { font-size: 26px; }
}
.uses .ext { font-size: 44px; }

/* ---------- Review: page image linked to extracted fields ---------- */
.dpanel:has(.rvw) { padding: 0; }
.rvw { display: grid; }
.rv-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--ink); background: var(--card); }
.rv-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rv-tools .segs .seg { min-height: 34px; padding: 0 12px; }
.rv-zl { display: inline-grid; place-items: center; min-width: 56px; font: 600 11px var(--mono); border-right: 1px solid var(--ink); background: var(--card); }
.rv-tools .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.rv-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); height: min(78vh, 900px); }
.rv-view { position: relative; overflow: hidden; background: #d9d3c4; background-image: radial-gradient(rgba(17,23,20,.13) 1px, transparent 1px); background-size: 14px 14px; touch-action: none; cursor: grab; outline: none; border-right: 1px solid var(--ink); }
.rv-view:focus-visible { box-shadow: inset 0 0 0 3px var(--blue); }
.rv-view:active { cursor: grabbing; }
.rv-view.drawing, .rv-view.drawing .rvb { cursor: crosshair; }
.rv-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 1px 0 var(--ink), 6px 6px 0 rgba(17,23,20,.18); background: #fff; }
.rv-stage.anim { transition: transform .25s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.rv-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.rv-boxes { position: absolute; inset: 0; }
.rv-boxes.off .rvb:not(.sel) { opacity: 0; }
.rvb { position: absolute; border: 1.5px solid rgba(55, 87, 255, .55); background: rgba(55, 87, 255, .06); cursor: pointer; transition: background .12s, border-color .12s; margin: -2px; padding: 2px; box-sizing: content-box; }
.rvb.ok { border-color: rgba(31, 122, 76, .55); background: rgba(31, 122, 76, .05); }
.rvb.check { border-color: #c77700; background: rgba(255, 176, 32, .16); }
.rvb.none { display: none; }
.rvb.extra { border: 1.5px dashed rgba(17, 23, 20, .45); background: rgba(17, 23, 20, .04); }
.rvb.tbl { background: transparent; pointer-events: none; border-style: dotted; }
.rvb.cell { border-width: 1px; }
.rvb:hover, .rvb.hov { background: rgba(199, 255, 56, .35); border-color: var(--ink); }
.rvb.sel { background: rgba(199, 255, 56, .42); border: 2px solid var(--ink); box-shadow: 0 0 0 3px var(--lime); z-index: 2; }
.rv-draw { position: absolute; border: 2px dashed var(--blue); background: rgba(55, 87, 255, .1); pointer-events: none; z-index: 4; }
.rv-status { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; align-items: center; background: var(--ink); color: var(--paper); padding: 10px 14px; font: 600 12px var(--sans); z-index: 5; max-width: calc(100% - 24px); }
.rv-status .spin { border-color: rgba(255,255,255,.3); border-top-color: var(--lime); width: 16px; height: 16px; flex: none; }
.rv-pop { position: absolute; z-index: 6; background: var(--card); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 12px; display: grid; gap: 8px; cursor: auto; }
.rv-pop textarea, .rv-pop input { min-height: 44px; font-size: 15px; }
.rv-pop-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rv-x { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.rv-q { margin: 0; padding: 8px 10px; background: var(--paper); border-left: 3px solid var(--ink-3); font-size: 14px; }
.rv-side { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; background: var(--card); }
.rv-sum { padding: 14px 16px 12px; border-bottom: 1px solid var(--line-2); }
.rv-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rv-list { overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; scroll-padding: 12px; }
.rv-card { border: 1px solid var(--line-2); background: var(--paper); padding: 10px 12px 12px; border-left: 4px solid var(--line-2); transition: border-color .12s, background .12s; }
.rv-card.s-ok { border-left-color: #1f7a4c; }
.rv-card.s-check { border-left-color: #c77700; background: #fff7e6; }
.rv-card:hover { border-color: var(--ink-3); }
.rv-card.sel { border-color: var(--ink); border-left-color: var(--lime); box-shadow: 4px 4px 0 var(--ink); background: var(--card); }
.rv-ch { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; }
.rv-k { font: 600 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.rv-st { font-size: 9px; padding: 3px 6px; }
.rv-acts { margin-left: auto; display: flex; gap: 2px; opacity: .45; }
.rv-card:hover .rv-acts, .rv-card.sel .rv-acts { opacity: 1; }
.rv-acts button { width: 26px; height: 26px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.rv-card textarea, .rv-card input { min-height: 40px; padding: 8px 10px; font-size: 14px; line-height: 1.5; resize: vertical; }
.rv-card input[type=text] { font-weight: 700; }
.rv-tablewrap { overflow-x: auto; }
.rv-table { border-collapse: collapse; width: 100%; }
.rv-table th, .rv-table td { border: 1px solid var(--line-2); padding: 0; min-width: 90px; }
.rv-table input { border: 0; min-height: 34px; padding: 6px 8px; font-size: 13px !important; font-weight: 400 !important; background: transparent; }
.rv-table th input { font-weight: 700 !important; background: var(--paper-2); }
.rv-table input:focus { background: #f7ffe0; outline: 2px solid var(--ink); outline-offset: -2px; }
.rv-addend { justify-self: start; }
.rv-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--ink); background: var(--card); }
.rv-save.on { background: #f7ffe0; }
.rv-save.on .rv-dirty { color: var(--ink); font-weight: 600; }
.rv-dirty { font-size: 13px; }
.rv-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; border-top: 1px solid var(--ink); font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); background: var(--card); }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 10px; border: 1.5px solid; }
.lg.ok { border-color: #1f7a4c; background: rgba(31,122,76,.08); }
.lg.check { border-color: #c77700; background: rgba(255,176,32,.25); }
.lg.extra { border-style: dashed; border-color: rgba(17,23,20,.5); }
@media (max-width: 900px) {
  .rv-main { grid-template-columns: 1fr; height: auto; }
  .rv-view { height: 42vh; border-right: 0; border-bottom: 1px solid var(--ink); position: sticky; top: 64px; z-index: 4; }
  .rv-side { grid-template-rows: auto auto auto; }
  .rv-list { max-height: none; overflow: visible; }
  .rv-save { position: sticky; bottom: 0; z-index: 3; }
}
.rvb.cell.in-sel { background: rgba(199,255,56,.18); border-color: rgba(17,23,20,.5); }
.rvb.tbl.sel { box-shadow: 0 0 0 2px var(--lime); background: transparent; border: 2px solid var(--ink); }
.rv-hint { margin-top: 10px; padding: 8px 10px; background: var(--card); border: 1px dashed #c77700; }
.rv-hint p { margin: 4px 0 8px; font-size: 13px; line-height: 1.5; }
.rv-hint mark { background: rgba(255,176,32,.45); color: var(--ink); padding: 0 2px; }
.rv-table input.cell-sel { background: rgba(199,255,56,.45); outline: 2px solid var(--ink); outline-offset: -2px; }
@media (max-width: 900px) {
  .rv-save { padding: 8px 10px; }
  .rv-save .rv-dirty { display: none; }
  .rv-save .btn-row { flex-wrap: nowrap; width: 100%; justify-content: space-between; gap: 6px; }
  .rv-save .btn { min-height: 40px; padding: 0 10px; font-size: 13px; }
  .rv-bar { padding: 10px; }
  .rv-legend { display: none; }
}

/* ---------- live camera scanner ---------- */
.scan-live { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.scan-cam { position: relative; background: #0b0f0d; border: 1px solid var(--ink); min-height: 0; overflow: hidden; }
.scan-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #0b0f0d; }
.scan-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(17,23,20,.82); color: var(--paper); font: 600 13px var(--sans); padding: 8px 14px; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.scan-live.flash .scan-cam::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: .75; animation: scanflash .22s ease-out forwards; }
@keyframes scanflash { to { opacity: 0; } }
.scan-camtools { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.scan-camtools > .btn-row:last-child { justify-content: flex-end; }
.scan-shutter { width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--ink); background: var(--lime); padding: 6px; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); }
.scan-shutter:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.scan-ring { --p: 0; width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(var(--ink) calc(var(--p) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.btn.dark[aria-pressed="false"] { background: transparent; color: var(--ink); }
.scan-ed { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; align-items: start; }
.scan-prevbox { border: 1px solid var(--ink); background: var(--card); padding: 10px; display: grid; gap: 8px; }
.scan-prev { width: 100%; height: auto; background: #fff; border: 1px solid var(--line-2); }
.scan-loupe { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--lime); box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 var(--ink); pointer-events: none; z-index: 3; }
@media (max-width: 700px) {
  .scan-ed { grid-template-columns: 1fr; }
  .scan-prevbox { grid-template-columns: auto 1fr; align-items: center; }
  .scan-prev { max-height: 140px; width: auto; max-width: 110px; }
  .scan-stage { padding: 8px; }
}
.scan-camtools { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.scan-camtools .btn-row { flex-wrap: nowrap; gap: 6px; }
.scan-bottom { flex-wrap: nowrap; }
.scan-bottom .scan-strip { min-width: 0; }
.scan-bottom .btn-row { flex: none; }
@media (max-width: 700px) {
  .scan-top, .scan-bottom { padding: 8px 10px; }
  .scan-camtools .btn { padding: 0 10px; min-height: 38px; font-size: 12px; }
  .scan-shutter { width: 64px; height: 64px; }
  .scan-bottom .btn { padding: 0 12px; min-height: 42px; font-size: 13px; }
  .scan-thumb img { height: 48px; }
  .scan-strip { min-height: 50px; }
}
.scan-stage { position: relative; min-width: 0; }
.scanner { grid-template-columns: minmax(0, 1fr); }
.scan-live { position: absolute; inset: 12px; width: auto; height: auto; }
@media (max-width: 700px) { .scan-live { inset: 6px; } }
.scanner { width: 100vw; height: 100vh; height: 100dvh; max-width: 100vw; }
.scan-hint { white-space: normal; text-align: center; width: max-content; }
.scan-camtools > * { min-width: 0; }

/* phone navigation menu */
.menu-btn { display: none; }
.admin-layout > * { min-width: 0; }
@media (max-width: 760px) {
  .nav .wrap { position: relative; }
  .menu-btn { display: inline-flex; order: 99; }
  .nav-links > :not(.primary):not(.menu-btn) { display: none; }
  .nav.open .nav-links > :not(.primary):not(.menu-btn):not(.who) { display: flex; }
  .nav.open .nav-links { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--paper); border-bottom: 1px solid var(--ink); padding: 8px 16px 14px; box-shadow: 0 10px 0 rgba(17,23,20,.06); }
  .nav.open .nav-links > a:not(.btn), .nav.open .nav-links > .btn { min-height: 46px; justify-content: flex-start; border: 0; border-bottom: 1px solid var(--line); padding: 0 4px; display: flex; align-items: center; font-size: 15px; }
  .nav.open .nav-links > .primary { justify-content: center; margin: 10px 0 0; border: 1px solid var(--ink); order: 98; }
  .nav.open .nav-links > .menu-btn { position: absolute; top: -50px; right: 16px; }
}

/* ---------- PDF tools v2 ---------- */
.tgroup { margin-top: 26px; }
.tgroup > .label { margin-bottom: 10px; }
.tool.studio { background: var(--paper); }
.tool.studio .n { color: var(--blue); }
.tool-wait { display: flex; gap: 10px; align-items: center; padding: 18px; border: 1px dashed var(--line-2); font-size: 14px; }
.flist { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.fitem { position: relative; border: 1px solid var(--line-2); background: var(--card); padding: 8px; display: grid; gap: 6px; align-content: start; }
.fitem .fidx { position: absolute; left: -1px; top: -1px; background: var(--ink); color: var(--paper); font: 600 11px var(--mono); padding: 3px 7px; z-index: 1; }
.fit-img { aspect-ratio: 3 / 4; background: var(--paper-2); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.fit-img img { max-width: 100%; max-height: 100%; }
.fit-name { font: 600 12px var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fitem .ptools { display: flex; gap: 4px; }
.fitem .ptools button { flex: 1; min-height: 32px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; }
.fadd-small { border-style: dashed; cursor: pointer; place-items: center; align-content: center; min-height: 160px; font: 600 13px var(--sans); color: var(--ink-2); }
.fadd-small b { font: 300 40px/1 var(--display); }
.pcard.pick { cursor: pointer; text-align: left; font: inherit; }
.pcard.pick[aria-pressed="true"].off { opacity: 1; outline: 3px solid var(--bad); outline-offset: -3px; }
.pcard.pick[aria-pressed="true"].off img { opacity: .35; }
.pcard.pick[aria-pressed="true"].on { outline: 3px solid var(--ink); outline-offset: -3px; background: var(--lime); }
.form-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.crop-wrap { position: relative; max-width: 620px; margin: 12px 0; border: 1px solid var(--ink); background: #fff; touch-action: none; user-select: none; cursor: crosshair; }
.crop-wrap img { display: block; width: 100%; }
.crop-box { position: absolute; border: 2px solid var(--blue); box-shadow: 0 0 0 9999px rgba(17,23,20,.45); cursor: move; }
.crop-h { position: absolute; width: 18px; height: 18px; background: var(--lime); border: 2px solid var(--ink); }
.crop-h.nw { left: -10px; top: -10px; cursor: nwse-resize; } .crop-h.ne { right: -10px; top: -10px; cursor: nesw-resize; }
.crop-h.sw { left: -10px; bottom: -10px; cursor: nesw-resize; } .crop-h.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.cmp-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .cmp { grid-template-columns: 1fr; } }
.cmp-text { border: 1px solid var(--line-2); background: var(--paper); padding: 12px; font-size: 14px; line-height: 1.7; max-height: 60vh; overflow: auto; margin-top: 6px; overflow-wrap: anywhere; }
.cmp-text del { background: #ffd9d4; color: #8a1c0c; text-decoration: line-through; padding: 0 2px; }
.cmp-text ins { background: #dff7c2; color: #1f5a1a; text-decoration: none; padding: 0 2px; }

/* editor */
/* ---- page editor (iLovePDF-style) ---- */
.edx { --edx-h: calc(100dvh - 92px); display: grid; grid-template-rows: auto minmax(0, 1fr); height: max(560px, var(--edx-h)); border: 1px solid var(--ink); background: var(--paper); scroll-margin-top: 72px; margin: 0 -8px; }
.edx-bar { display: flex; align-items: stretch; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--ink); background: var(--card); padding: 0 8px; }
.edx-tools { display: flex; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.edx > *, .edx-main > * { min-width: 0; }
.edx-tools::-webkit-scrollbar { display: none; }
.edx-tool { display: grid; justify-items: center; gap: 4px; min-width: 74px; padding: 9px 8px 8px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; font: 600 11.5px var(--sans); color: var(--ink-2, #3b423e); white-space: nowrap; }
.edx-tool svg { width: 22px; height: 22px; }
.edx-tool:hover { background: var(--paper); color: var(--ink); }
.edx-tool[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.edx-tool[aria-pressed="true"] svg { color: var(--blue); }
.edx-hist { display: flex; align-items: center; gap: 2px; }
.edx-ib { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; background: none; cursor: pointer; color: inherit; padding: 0; }
.edx-ib svg { width: 20px; height: 20px; }
.edx-ib:hover:not(:disabled) { background: rgba(17,23,20,.07); }
.edx-ib:disabled { opacity: .3; cursor: default; }
.edx-main { display: grid; grid-template-columns: 150px minmax(0, 1fr) 290px; min-height: 0; }
.edx-thumbs { overflow: auto; padding: 14px 18px; display: grid; gap: 14px; align-content: start; border-right: 1px solid var(--line-2); background: var(--card); }
.ed-thumb { border: 1px solid var(--line-2); background: #fff; padding: 0; cursor: pointer; position: relative; display: grid; }
.ed-thumb img { width: 100%; display: block; background: #fff; min-height: 60px; }
.ed-thumb span { text-align: center; font: 600 11px var(--mono); padding: 3px 0; background: var(--card); border-top: 1px solid var(--line); }
.ed-thumb.on { outline: 2px solid var(--blue); outline-offset: 2px; }
.edx-center { position: relative; min-width: 0; min-height: 0; background: #e8e3d8; }
.edx-view { position: absolute; inset: 0; overflow: auto; padding: 24px 20px 90px; outline: none; }
.edx-pages { display: grid; gap: 22px; justify-items: center; width: max-content; min-width: 100%; }
.edx-zoom { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; background: var(--ink); color: var(--paper); padding: 4px 6px; box-shadow: 0 6px 20px rgba(17,23,20,.25); white-space: nowrap; }
.edx-zoom .edx-ib { width: 32px; height: 32px; }
.edx-zoom .edx-ib:hover { background: rgba(255,255,255,.12); }
.edx-zoom input.edx-pin { width: 44px; min-width: 0; box-shadow: none; min-height: 30px; padding: 2px 4px; text-align: center; background: #2a312d; color: var(--paper); border: 0; font: 600 13px var(--mono); }
.edx-of { font: 600 12px var(--mono); padding: 0 6px; opacity: .8; }
.edx-sep { width: 1px; height: 20px; background: rgba(255,255,255,.25); margin: 0 6px; }
.edx-zl { min-width: 58px; min-height: 30px; background: #2a312d; color: var(--paper); border: 0; font: 600 12px var(--mono); cursor: pointer; }
.edx-side { display: grid; grid-template-rows: minmax(0, 1fr) auto; border-left: 1px solid var(--line-2); background: var(--card); min-height: 0; }
.edx-panel-body { overflow: auto; padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.edx-h { font: 700 12px var(--sans); letter-spacing: .02em; margin: 8px 0 0; }
.edx-h:first-child { margin-top: 0; font-size: 15px; }
.edx-help { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.edx-row { display: grid; grid-template-columns: 1fr 84px; gap: 8px; }
.edx-row select, .edx-panel-body > select { min-height: 38px; }
.edx-panel-body .segs { display: flex; }
.edx-panel-body .seg { flex: 1; min-height: 38px; padding: 0 8px; text-transform: none; letter-spacing: 0; font: 600 13px var(--sans); display: grid; place-items: center; }
.edx-panel-body .seg svg { width: 18px; height: 18px; }
.edx-toggles .seg { font-size: 16px; }
.edx-sw { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.edx-sw .sw { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(17,23,20,.3); cursor: pointer; padding: 0; }
.edx-sw .sw.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--blue); }
.edx-sw .sw.none { background: linear-gradient(135deg, #fff 45%, #d1242f 45% 55%, #fff 55%); }
.edx-sw input[type=color] { width: 34px; height: 30px; padding: 1px; border: 1px solid var(--line-2); background: none; cursor: pointer; }
.edx-range { display: grid; grid-template-columns: 74px 1fr 46px; gap: 8px; align-items: center; font: 600 12px var(--sans); }
.edx-rv { font: 600 11px var(--mono); text-align: right; }
.edx-objbtns { margin-top: 6px; }
.edx-count { margin: 6px 0 0; font: 600 11px var(--mono); letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.edx-foot { padding: 14px 18px 16px; border-top: 1px solid var(--line-2); display: grid; gap: 10px; }
.edx-save { width: 100%; min-height: 54px; font-size: 17px; }
.edx-out .dl-grid { margin-top: 0 !important; }
.ed-find { display: flex; gap: 8px; }
.ed-find input { min-width: 0; flex: 1; }
.ed-page { position: relative; background: #fff; box-shadow: 0 2px 12px rgba(17,23,20,.18); touch-action: none; user-select: none; -webkit-user-select: none; }
.edx[data-tool="text"] .ed-page, .edx[data-tool="date"] .ed-page { cursor: text; }
.edx[data-tool="shape"] .ed-page, .edx[data-tool="white"] .ed-page, .edx[data-tool="highlight"] .ed-page, .edx[data-tool="redact"] .ed-page, .edx[data-tool="ink"] .ed-page, .edx[data-tool="signature"] .ed-page, .edx[data-tool="initials"] .ed-page { cursor: crosshair; }
.ed-img { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-layer, .ed-blocks { position: absolute; inset: 0; pointer-events: none; }
.ed-layer > .ed-obj { pointer-events: auto; }
.ed-blk { position: absolute; border: 1px dashed rgba(55,87,255,.55); pointer-events: auto; cursor: text; }
.ed-blk:hover { border-style: solid; border-color: var(--blue); background: rgba(55,87,255,.07); }
.ed-note { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); width: min(92%, 420px); background: var(--ink); color: var(--paper); padding: 12px 14px; font-size: 13px; line-height: 1.4; display: grid; gap: 8px; z-index: 3; box-shadow: 0 6px 20px rgba(17,23,20,.3); }
.ed-note .btn { justify-self: start; }
.ed-cover { position: absolute; pointer-events: none; }
.ed-obj { position: absolute; box-sizing: border-box; }
.ed-obj.sel { outline: 1.5px dashed var(--blue); outline-offset: 3px; z-index: 2; }
.edx[data-tool="select"] .ed-obj { cursor: move; }
.edx[data-tool="select"] .ed-obj .ed-text { cursor: move; }
.edx[data-tool="select"] .ed-obj.sel .ed-text { cursor: text; }
.ed-obj.k-white { box-shadow: inset 0 0 0 1px rgba(17,23,20,.12); }
.ed-obj.ellipse { border-radius: 50%; }
.ed-obj.image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-obj svg { display: block; pointer-events: none; }
.ed-text { white-space: pre; outline: none; min-width: 1em; min-height: 1em; cursor: text; padding: 0; margin: 0; }
.ed-obj.text:not(.sel):hover { outline: 1px dashed rgba(55,87,255,.6); outline-offset: 3px; }
.ed-h { position: absolute; width: 11px; height: 11px; background: #fff; border: 2px solid var(--blue); border-radius: 50%; z-index: 3; }
.ed-h.nw { left: -9px; top: -9px; cursor: nwse-resize; } .ed-h.ne { right: -9px; top: -9px; cursor: nesw-resize; }
.ed-h.sw { left: -9px; bottom: -9px; cursor: nesw-resize; } .ed-h.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.ed-mini { position: absolute; left: 50%; top: calc(100% + 12px); transform: translateX(-50%); display: flex; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 4px 14px rgba(17,23,20,.18); z-index: 4; }
.ed-mi { width: 34px; height: 32px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; padding: 0; color: var(--ink); }
.ed-mi svg { width: 17px; height: 17px; }
.ed-mi:hover { background: var(--paper); }
.ed-grip { cursor: move; }
@media (max-width: 1100px) { .edx-main { grid-template-columns: 110px minmax(0, 1fr) 250px; } .edx-thumbs { padding: 10px; } }
@media (max-width: 820px) {
  .edx { height: auto; margin: 0 -12px; }
  .edx-main { grid-template-columns: 1fr; }
  .edx-thumbs { display: none; }
  .edx-center { height: 68dvh; }
  .edx-view { padding: 10px 8px 80px; }
  .edx-tool { min-width: 64px; padding: 8px 6px; }
  .edx-side { border-left: 0; border-top: 1px solid var(--ink); }
  .edx-panel-body { overflow: visible; }
  .edx-foot { position: sticky; bottom: 0; background: var(--card); z-index: 5; }
  .edx-zoom { bottom: 10px; }
  .edx-zoom .edx-ib[aria-label='Previous page'], .edx-zoom .edx-ib[aria-label='Next page'], .edx-zoom .edx-sep { display: none; }
  .edx-hist .edx-ib { width: 32px; }
}
.sig-dlg { border: 1px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 20px; width: min(640px, calc(100vw - 24px)); background: var(--card); }
.sig-dlg::backdrop { background: rgba(17,23,20,.5); }
.sig-dlg h2 { font-size: 28px; }
.sig-pad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed var(--ink-3); background: #fff; touch-action: none; cursor: crosshair; display: block; }

/* tool pages (like iLovePDF: one tool per page) */
.back-link { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; justify-self: start; }
.back-link:hover { color: var(--ink); text-decoration: underline; }
.tool-head { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 18px 0 8px; }
.tool-head h1 { font-size: clamp(38px, 6vw, 64px); margin: 0; }
.tool-head .muted { max-width: 34em; margin: 0; font-size: 17px; }
.tool-pick { display: grid; justify-items: center; gap: 10px; padding: 14px 0 6px; }
.tool-pick .btn.xl { min-width: min(100%, 340px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 700px) { .grid-3 { grid-template-columns: 1fr; } }
.mix-files { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; border: 1px solid var(--line-2); background: var(--card); padding: 14px; margin-bottom: 12px; }
.mix-files > div { display: grid; gap: 4px; min-width: 0; }
.mix-files b { overflow-wrap: anywhere; }
@media (max-width: 600px) { .mix-files { grid-template-columns: 1fr; } }
.blank-page { aspect-ratio: 1 / 1.414; background: #fff; border: 1px dashed var(--line-2); }
.tool-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.tool-links a { border: 1px solid var(--ink); background: var(--card); padding: 10px 14px; font: 600 14px var(--sans); color: var(--ink); text-decoration: none; }
.tool-links a:hover { background: var(--lime); }
.tool-links a.more { background: var(--ink); color: var(--paper); }
.tool-links a.more:hover { background: var(--blue); }

/* ---------- tool icons, filters, workspace, results (classic look) ---------- */
.tic { width: 40px; height: 40px; display: grid; place-items: center; background: var(--c2); color: #fff; border: 1px solid var(--ink); flex: none; }
.tic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tool .tic { margin-bottom: 4px; }
.tool-search { max-width: 520px; }
.tpill { min-height: 36px; padding: 0 14px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.tpill[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tool-none { text-align: center; padding: 24px 0; }
.tbadge { justify-self: start; font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.tool-head .tic { width: 56px; height: 56px; }
.tool-head .tic svg { width: 30px; height: 30px; }
.tool-pick.compact { padding: 0; }
.tool-pick.compact .btn.xl { min-height: 42px; font-size: 14px; padding: 0 16px; background: var(--card); }
.tool-side { border: 1px solid var(--ink); background: var(--paper); padding: 16px; }
.tool-side .tic { width: 30px; height: 30px; }
.tool-side .tic svg { width: 17px; height: 17px; }
.done .dl { background: var(--lime); }
.next-tool:hover { background: var(--lime); }
.back-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); font: 600 13px var(--sans); text-decoration: none; justify-self: start; width: max-content; }
.back-btn:hover { background: var(--lime); }
.doc-hero .back-btn { margin-bottom: 10px; }
.theme-classic .ti { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.theme-classic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lab-plain { font: 600 13px var(--sans); margin-bottom: 7px; }
.appearance .seg { flex: 1; }

/* ---------- dark mode (classic look): ink and paper swap, lime stays lime ---------- */
:root[data-theme="dark"]:not([data-ui="pro"]) {
  --paper: #101412;
  --paper-2: #171c19;
  --paper-3: #222924;
  --card: #151a17;
  --ink: #f1ede4;
  --ink-2: #cfcabe;
  --ink-3: #a29f96;
  --ink-4: #7b7a73;
  --line: rgba(241, 237, 228, .14);
  --line-2: rgba(241, 237, 228, .28);
  --blue: #8c9dff;
  --blue-soft: #1d2340;
  --ok: #6fd69c; --ok-soft: #15291d;
  --warn: #f0c060; --warn-soft: #2c2412;
  --bad: #ff8a74; --bad-soft: #321914;
  --shadow: 6px 6px 0 rgba(241, 237, 228, .9);
  color-scheme: dark;
}
/* lime surfaces always carry dark text */
:root[data-theme="dark"]:not([data-ui="pro"]) :is(.btn.primary, .tile:has(input:checked), .tool:hover, .dtab[aria-selected="true"], .dl:hover, .fmt:hover, .secret, .chip.lime, .banner.warn, .skip, .pcard.pick[aria-pressed="true"].on, .tool-links a:hover, .back-btn:hover, .next-tool:hover, .done .dl, .tab[aria-selected=true], .fadd:hover) { color: #111714; }
:root[data-theme="dark"]:not([data-ui="pro"]) :is(.tool:hover, .tile:has(input:checked), .dl:hover, .done .dl, .fmt:hover) :is(.muted, span, b, small) { color: #111714; }
:root[data-theme="dark"]:not([data-ui="pro"]) .fadd:hover { background: var(--lime); }
:root[data-theme="dark"]:not([data-ui="pro"]) ::selection { color: #111714; }
:root[data-theme="dark"]:not([data-ui="pro"]) .auth-art { background: #070908; color: #f1ede4; }
:root[data-theme="dark"]:not([data-ui="pro"]) .auth-art h2 { color: #f1ede4; }
:root[data-theme="dark"]:not([data-ui="pro"]) .auth-art .pg { border-color: #333; }
:root[data-theme="dark"]:not([data-ui="pro"]) .toast { background: #f1ede4; color: #111714; }
:root[data-theme="dark"]:not([data-ui="pro"]) .rv-view { background-color: #232823; background-image: radial-gradient(rgba(241, 237, 228, .08) 1px, transparent 1px); }
:root[data-theme="dark"]:not([data-ui="pro"]) .rv-card.s-check { background: #2c2412; }
:root[data-theme="dark"]:not([data-ui="pro"]) :is(.rv-save.on, .rv-table input:focus, .rv-table input.cell-sel) { background: #253012; color: var(--ink); }
:root[data-theme="dark"]:not([data-ui="pro"]) .rv-hint mark { background: rgba(240, 192, 96, .35); color: var(--ink); }
:root[data-theme="dark"]:not([data-ui="pro"]) .cmp-text del { background: #4b1d16; color: #ffb4a6; }
:root[data-theme="dark"]:not([data-ui="pro"]) .cmp-text ins { background: #1d3a17; color: #b6efa0; }
:root[data-theme="dark"]:not([data-ui="pro"]) .dropveil div { color: #111714; border-color: #111714; }
:root[data-theme="dark"]:not([data-ui="pro"]) .edx-center { background: #1b201d; }
:root[data-theme="dark"]:not([data-ui="pro"]) .tic { border-color: rgba(241, 237, 228, .5); }

/* shared layout for the tool workspace and results (both looks) */
.tool-filter { display: grid; justify-items: center; gap: 16px; margin: 8px 0 22px; }
.tool-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tool-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.tool-main { min-width: 0; }
.tool-side { position: sticky; top: 20px; display: grid; gap: 4px; align-content: start; }
.tool-side-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tool-side-h b { font: 650 17px var(--sans); }
.tool-side .grid-2, .tool-side .grid-3 { grid-template-columns: 1fr; }
.tool-side .tool-go { margin-top: 10px; }
.tool-side .tool-go .btn.primary { width: 100%; min-height: 54px; font-size: 17px; }
#tool-done:not(.hidden) { margin-top: 14px; }
.done { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 18px 0 6px; }
.done h2 { font-size: clamp(26px, 3vw, 34px); margin: 0; }
.done .dl-grid { margin-top: 4px !important; display: grid; justify-items: center; gap: 12px; grid-template-columns: 1fr; width: min(100%, 520px); }
.done .dl { width: 100%; align-items: center; text-align: center; }
.done-acts { justify-content: center; }
.done-next { width: 100%; max-width: 900px; margin-top: 14px; display: grid; gap: 12px; justify-items: center; }
.next-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.next-tool { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; }
.next-tool .tic { width: 30px; height: 30px; }
.next-tool .tic svg { width: 17px; height: 17px; }
.done-art { position: relative; width: 96px; height: 96px; perspective: 500px; }
.done-doc { position: absolute; left: 20px; top: 6px; width: 56px; height: 74px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 16px 30px -12px rgba(16, 24, 40, .4); transform: rotateY(-16deg) rotateX(8deg); animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.done-doc::before { content: ""; position: absolute; left: 10px; right: 10px; top: 14px; height: 30px; background: repeating-linear-gradient(to bottom, var(--line-2) 0 3px, transparent 3px 9px); }
.done-check { position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(145deg, #34d399, #059669); box-shadow: 0 8px 16px -6px #059669, inset 0 1px 0 rgba(255, 255, 255, .4); animation: pop .5s .2s cubic-bezier(.2, 1.4, .4, 1) both; }
.done-check::after { content: ""; position: absolute; left: 14px; top: 9px; width: 9px; height: 17px; border: solid #fff; border-width: 0 3.5px 3.5px 0; transform: rotate(45deg); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@media (max-width: 900px) {
  .tool-split { grid-template-columns: 1fr; }
  .tool-side { position: static; }
  .tool-side .tool-go { position: sticky; bottom: 10px; z-index: 5; }
}
.brand { align-items: center; }
.brand-logo { width: 28px; height: 28px; display: block; align-self: center; }
