/* Vellafolio — app styles */
@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/assets/fonts/poppins-400.woff) format('woff'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/assets/fonts/poppins-500.woff) format('woff'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url(/assets/fonts/poppins-700.woff) format('woff'); }

:root {
  --teal: #0F766E; --teal-dark: #0B5A54; --teal-tint: #E6F2F1; --aqua: #2DD4BF;
  --coral: #F9735B; --coral-tint: #FEEDE9;
  --navy: #0F172A; --slate: #475569; --line: #D9DEE5; --cloud: #F3F4F6; --white: #FFFFFF;
  --danger: #B42318; --danger-tint: #FEF3F2; --warn-tint: #FFF8E6; --warn-line: #F2C94C;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --font: Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--navy); background: var(--cloud); }
img, svg, canvas { max-width: 100%; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.25; font-weight: 500; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--slate); }
.small { font-size: .875rem; }
.lead { font-size: 1.075rem; color: var(--slate); max-width: 62ch; }
.icon { width: 22px; height: 22px; flex: none; vertical-align: middle; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 36px; height: 36px; color: var(--teal); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* header / footer */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.brand { display: flex; }
.brand img { height: 34px; width: auto; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--navy); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.site-nav a:hover { background: var(--cloud); }
.site-footer { background: var(--white); border-top: 1px solid var(--line); margin-top: 64px; padding: 40px 0 24px; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.footer-grid img { height: 30px; width: auto; }
.footer-h { font-size: .95rem; font-weight: 500; margin: 0 0 8px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li a { color: var(--slate); text-decoration: none; display: inline-block; padding: 3px 0; font-size: .9rem; }
.footer-grid li a:hover { color: var(--teal); }
.footer-base { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--white); color: var(--navy); font: 500 .95rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 10px; }
.btn[disabled], .btn-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.is-active { background: var(--teal-tint); border-color: var(--teal); color: var(--teal-dark); }

/* home */
.hero { background: var(--white); border-bottom: 1px solid var(--line); padding: 56px 0 48px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--teal-dark); background: var(--teal-tint); padding: 6px 14px; border-radius: 999px; }
.hero h1 { max-width: 20ch; margin-top: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.section-h { font-size: 1.4rem; margin: 48px 0 16px; }
.group-h { font-size: 1rem; color: var(--slate); font-weight: 500; margin: 24px 0 12px; }
.tool-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tool-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--navy); transition: border-color .15s, box-shadow .15s; }
.tool-card:hover { border-color: var(--teal); box-shadow: var(--shadow); color: var(--navy); }
.tool-card-icon { grid-row: 1 / 3; width: 40px; height: 40px; padding: 8px; border-radius: 10px; background: var(--teal-tint); color: var(--teal); }
.tool-card-name { font-weight: 500; }
.tool-card-desc { font-size: .85rem; color: var(--slate); line-height: 1.45; }
.band { margin-top: 24px; }
.why-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.why { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.why h3 { font-size: 1.05rem; margin-top: 12px; }
.why p { color: var(--slate); margin: 0; }

/* tool page */
.tool-head { padding-top: 24px; }
.crumbs { color: var(--slate); margin-bottom: 12px; }
.crumbs a { color: var(--slate); }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--teal-dark); background: var(--teal-tint); padding: 6px 14px; border-radius: 999px; }
.tool { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 16px; box-shadow: var(--shadow); }
.notice { background: var(--warn-tint); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem; margin-bottom: 16px; }
.dropzone { border: 2px dashed #9FB7B4; border-radius: var(--radius); background: #FAFCFC; transition: background .15s, border-color .15s; }
.dropzone.is-over { background: var(--teal-tint); border-color: var(--teal); }
.dropzone-label { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 16px; text-align: center; cursor: pointer; }
.dropzone-scan { padding: 28px 16px; text-align: center; }
.scan-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 8px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-input:focus-visible + .dropzone-label .btn, .file-input:focus-visible ~ .scan-buttons .btn { outline: 3px solid var(--teal); outline-offset: 2px; }
.dropzone.is-compact .dropzone-label { flex-direction: row; justify-content: center; padding: 12px; }
.dropzone.is-compact .dropzone-label .icon-lg, .dropzone.is-compact .dropzone-label .muted { display: none; }
.tool-options { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; padding: 16px; background: var(--cloud); border-radius: var(--radius-sm); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; flex: 1 1 180px; margin: 0; border: 0; padding: 0; }
.field label, .field legend { font-size: .9rem; font-weight: 500; padding: 0; }
.field select, .field input[type=text], .field input:not([type]), .field input[type=number] { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: var(--white); color: var(--navy); }
.radio { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; min-height: 32px; }
.radio input { width: 20px; height: 20px; accent-color: var(--teal); }
.run-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
progress { width: 100%; height: 8px; margin-top: 16px; accent-color: var(--teal); }
.status { margin: 12px 0 0; min-height: 1.6em; font-weight: 500; }
.status.is-error { color: var(--danger); background: var(--danger-tint); padding: 10px 14px; border-radius: var(--radius-sm); }
.quota { margin: 4px 0 0; }
.quota.is-out { color: var(--danger); }

/* file list (merge, images) */
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.file-row.is-dragging { opacity: .5; }
.file-row .thumb { width: 48px; height: 60px; object-fit: contain; background: var(--cloud); border-radius: 6px; flex: none; }
.file-row .grow { flex: 1; min-width: 0; }
.file-row .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-row .handle { cursor: grab; color: var(--slate); touch-action: none; padding: 8px 4px; }

/* page grid (organise) */
.page-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-top: 16px; }
.page-tile { position: relative; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--white); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; touch-action: manipulation; }
.page-tile.is-selected { border-color: var(--teal); background: var(--teal-tint); }
.page-tile.is-removed { opacity: .4; }
.page-tile.is-removed .page-canvas-wrap::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 8px, rgba(180, 35, 24, .15) 8px 10px); }
.page-tile.is-dragging { opacity: .4; }
.page-tile.drop-before { box-shadow: -4px 0 0 var(--teal); }
.page-canvas-wrap { position: relative; width: 100%; height: 150px; display: flex; align-items: center; justify-content: center; }
.page-canvas-wrap canvas { max-height: 150px; max-width: 100%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; background: #fff; }
.page-num { font-size: .8rem; color: var(--slate); }
.page-actions { display: flex; gap: 4px; }
.page-actions .btn { min-height: 34px; width: 34px; padding: 0; border-radius: 8px; }
.page-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; accent-color: var(--teal); z-index: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }

/* results */
.result { margin-top: 20px; padding: 16px; background: var(--teal-tint); border-radius: var(--radius); }
.result-title { font-size: 1.15rem; }
.result-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 12px; }
.result-item { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; background: var(--white); border-radius: var(--radius-sm); padding: 12px; }
.result-preview { position: relative; width: 96px; flex: none; }
.result-preview canvas, .result-preview img { width: 96px; height: auto; max-height: 130px; object-fit: contain; box-shadow: 0 1px 3px rgba(0,0,0,.2); display: block; }
.result-meta { flex: 1 1 160px; display: flex; flex-direction: column; min-width: 0; }
.result-meta strong { overflow-wrap: anywhere; font-weight: 500; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { position: absolute; bottom: 4px; right: 4px; background: var(--navy); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 999px; }

/* reader */
.reader-bar { position: sticky; top: 64px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 16px; }
.reader-bar input { min-height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; width: 140px; }
.reader-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px 0; background: #E5E7EB; border-radius: var(--radius-sm); margin-top: 12px; overflow-x: auto; }
.reader-page { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.reader-page canvas { display: block; }
.hl { position: absolute; background: rgba(249, 115, 91, .35); border-radius: 2px; pointer-events: none; }

/* scanner */
.scan-list { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.scan-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--white); }
.crop-stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; background: #111; border-radius: 8px; overflow: hidden; }
.crop-stage canvas { display: block; width: 100%; height: auto; }
.crop-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.crop-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; touch-action: none; cursor: grab; display: flex; align-items: center; justify-content: center; }
.crop-handle::after { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--white); border: 3px solid var(--teal); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.scan-result canvas { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; background: var(--white); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; min-height: 40px; border-radius: 999px; font: 500 .85rem var(--font); color: var(--navy); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--teal); color: #fff; }

/* editor */
.ed-toolbar { position: sticky; top: 64px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 16px; }
.ed-toolbar .sep { width: 1px; height: 28px; background: var(--line); margin: 0 4px; }
.ed-toolbar input[type=color] { width: 40px; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.ed-toolbar select { min-height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 4px 8px; font: inherit; }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px 8px; background: #E5E7EB; border-radius: var(--radius-sm); margin-top: 12px; }
.ed-page { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); touch-action: pan-y; }
.ed-page canvas.base { display: block; width: 100%; height: auto; }
.ed-page canvas.ink { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-layer { position: absolute; inset: 0; }
.ed-item { position: absolute; border: 1.5px dashed transparent; touch-action: none; }
.ed-item.is-selected { border-color: var(--teal); }
.ed-item[data-type=text] { padding: 0 2px; line-height: 1.2; cursor: move; min-width: 20px; }
.ed-text { display: block; white-space: pre; outline: none; min-width: 1ch; min-height: 1.2em; }
.ed-text[contenteditable=true] { cursor: text; background: rgba(15, 118, 110, .08); }
.ed-item img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-item[data-type=rect] { background: #fff; }
.ed-item[data-type=highlight] { mix-blend-mode: multiply; }
.ed-resize { position: absolute; right: -14px; bottom: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--teal); border: 3px solid #fff; display: none; touch-action: none; cursor: nwse-resize; }
.ed-delete { position: absolute; right: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--danger); color: #fff; border: 3px solid #fff; display: none; font: 700 14px/1 var(--font); cursor: pointer; padding: 0; }
.ed-item.is-selected .ed-resize, .ed-item.is-selected .ed-delete { display: block; }
.ed-hint { font-size: .85rem; color: var(--slate); margin: 8px 0 0; }

/* dialog */
dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: min(560px, calc(100vw - 32px)); width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
.sig-pad { width: 100%; height: 200px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); touch-action: none; background: #fff; display: block; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.sig-typed { width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: 28px/1.2 "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive; }

/* content pages */
.page-head { padding-top: 40px; }
.how .steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.how .steps li { counter-increment: s; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 16px 60px; position: relative; }
.how .steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 500; }
.faq details { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; }
.faq summary { padding: 14px 16px; cursor: pointer; font-weight: 500; min-height: 44px; }
.faq details p { padding: 0 16px 14px; margin: 0; color: var(--slate); }
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 24px; }
.plan { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; }
.plan-live { border: 2px solid var(--teal); }
.plan h2 { font-size: 1.2rem; }
.price span { font-size: 2rem; font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 8px 0 20px; flex: 1; }
.plan li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: .95rem; }
.plan li .icon { color: var(--teal); margin-top: 3px; }
.prose { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 24px; margin-top: 32px; max-width: 820px; }
.prose h2 { font-size: 1.2rem; margin-top: 28px; }
.contact-card { margin-top: 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }

@media (max-width: 560px) {
  .site-nav a { padding: 10px 8px; font-size: .9rem; }
  .brand img { height: 28px; }
  .tool { padding: 14px; border-radius: 12px; }
  .hero { padding: 36px 0 32px; }
  .reader-bar, .ed-toolbar { top: 64px; }
}
@media (max-width: 300px) {
  .header-row { gap: 6px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 10px 5px; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- in-page document camera ---------- */
html.cam-open, html.cam-open body { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.cam-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; }
.cam-top .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.cam-top .btn[aria-pressed=true] { background: #FFD43B; color: #0F172A; }
.cam-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.cam-stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.cam-outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-outline polygon { fill: rgba(45,212,191,.16); stroke: #2DD4BF; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity .2s; }
.cam-outline.is-found polygon { opacity: 1; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: camflash .35s ease-out; }
@keyframes camflash { from { opacity: .85; } to { opacity: 0; } }
.cam-hint { text-align: center; margin: 0; padding: 8px 16px; font-size: .95rem; min-height: 2.4em; }
.cam-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 20px 20px; }
.cam-thumb { position: relative; width: 52px; height: 52px; border-radius: 10px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; overflow: visible; }
.cam-thumb canvas { max-width: 52px; max-height: 52px; border-radius: 6px; }
.cam-count { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: #2DD4BF; color: #0F172A; font: 700 .8rem/24px var(--font); text-align: center; padding: 0 6px; }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.cam-shutter:active { transform: scale(.94); background: #fff; }
.cam-shutter[disabled] { opacity: .5; }
.cam-done { justify-self: end; min-height: 48px; }
@media (prefers-reduced-motion: reduce) { .cam-flash.go { animation: none; } }

/* scan review */
.scan-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.scan-move { display: flex; gap: 4px; }
.scan-actions .btn { flex: 1 1 auto; }
.run-row-sticky { position: sticky; bottom: 0; z-index: 4; background: var(--white); margin: 16px -20px -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.run-row-sticky [data-run] { flex: 1 1 160px; }
.text-link { color: var(--teal); text-decoration: underline; cursor: pointer; }
@media (max-width: 560px) { .run-row-sticky { margin: 16px -14px -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); } }

.dropzone.is-collapsed { height: 0; min-height: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }

/* edit existing text */
.ed-hot { position: absolute; background: transparent; border: 0; padding: 0; margin: 0; cursor: text; border-radius: 2px; }
.ed-pages:not(.mode-edittext) .ed-hot { display: none; }
.ed-pages.mode-edittext .ed-hot { outline: 1px dashed rgba(15, 118, 110, .45); }
.ed-pages.mode-edittext .ed-hot:hover, .ed-pages.mode-edittext .ed-hot:focus-visible { outline: 2px solid var(--teal); background: rgba(15, 118, 110, .08); }
.ed-item[data-type=replace] { border: 0; padding: 0; box-shadow: 0 0 0 1.5px var(--teal); border-radius: 1px; }
.ed-item[data-type=replace] .ed-text { white-space: pre; outline: none; min-height: 0; }
.ed-item[data-type=replace] .ed-text[contenteditable=true] { background: transparent; cursor: text; }
.ed-item[data-type=replace].is-selected .ed-delete { display: block; }

.plan-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--navy); color: #fff; font-size: .7rem; font-weight: 500; letter-spacing: .02em; }
.btn.is-locked { color: var(--slate); }
.help-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 16px; }
.contact-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 16px; }
.contact-grid .contact-card { margin-top: 0; }
.contact-card h2 { font-size: 1.1rem; }
.prose ul { padding-left: 1.2em; }
.prose h2 .icon { color: var(--teal); }

/* ---------- accounts ---------- */
.btn-reset { background: none; border: 0; padding: 0; font: inherit; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1c13; color: #fff; }
.auth-wrap { max-width: 480px; padding-top: 40px; }
.auth-form { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-size: 1.6rem; margin: 0; }
.auth-form .field { min-width: 0; flex: none; }
.auth-form input:not([type=checkbox]) { min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; }
.field-check { flex-direction: row !important; align-items: flex-start; gap: 10px; }
.field-check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--teal); }
.nav-account { background: var(--teal-tint); color: var(--teal-dark) !important; }
.app { padding-top: 24px; }
.app-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.app-head h1 { font-size: 1.6rem; margin: 0; }
.storage { min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--teal); }
.tabs-nav { display: flex; gap: 4px; margin: 20px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs-nav a { padding: 12px 14px; text-decoration: none; color: var(--slate); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs-nav a[aria-current=page] { color: var(--teal-dark); border-bottom-color: var(--teal); }
.app-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.app-side { flex: 1 1 200px; max-width: 260px; display: flex; flex-direction: column; gap: 2px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.app-main { flex: 999 1 480px; min-width: 0; border-radius: var(--radius); }
.app-main.is-over { outline: 3px dashed var(--teal); outline-offset: 4px; }
.side-link { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font: inherit; color: var(--navy); cursor: pointer; min-height: 40px; }
.side-link:hover { background: var(--cloud); }
.side-link.is-on { background: var(--teal-tint); color: var(--teal-dark); font-weight: 500; }
.side-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); margin: 14px 12px 4px; }
.app-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.app-bar input[type=search] { flex: 1; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; min-width: 0; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.doc-main { display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1 1 260px; }
.doc-name { font-weight: 500; overflow-wrap: anywhere; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fav { background: none; border: 0; font-size: 1.3rem; color: var(--slate); cursor: pointer; width: 40px; height: 40px; border-radius: 8px; }
.fav.is-on { color: #B7791F; }
.empty { padding: 24px; text-align: center; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.folder-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.folder-head h2 { margin: 0 8px 0 0; font-size: 1.25rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.is-error { background: var(--danger); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-sm); }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.acct { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.acct h2 { font-size: 1.2rem; }
.acct-danger { border-color: #F3B8B2; }
.plans-compact { margin: 12px 0; }
.plans-compact .plan { padding: 16px; }
.badge-on { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--teal-tint); color: var(--teal-dark); font-weight: 500; }
.pick-list { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow: auto; display: grid; gap: 6px; }
.pick-list li { display: flex; align-items: center; gap: 8px; }
.pick-list input { width: 20px; height: 20px; accent-color: var(--teal); }
.pick-list label { flex: 1; }
dialog textarea, dialog input[type=text], dialog input[type=password], dialog input[type=date], dialog input:not([type]), dialog select { width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; }
dialog .field { margin-bottom: 12px; }

.acct .field { max-width: 420px; margin-bottom: 12px; }
.acct input { min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; }
@media (max-width: 700px) {
  .app-side { flex-direction: row; flex-basis: 100%; max-width: none; overflow-x: auto; padding: 6px; gap: 6px; scrollbar-width: none; }
  .app-side .side-h { display: none; }
  .side-link { white-space: nowrap; flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
  .app-side .btn { flex: none; white-space: nowrap; }
  .storage { min-width: 0; width: 100%; }
  .doc-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 400px) { .site-nav a { padding: 10px 6px; font-size: .85rem; } }
