/* DocuFun design system. System fonts only. Light + dark. */
:root {
  --bg: #f7f6f3;
  --bg-2: #efede8;
  --surface: #ffffff;
  --ink: #17161d;
  --ink-2: #44434f;
  --muted: #696875;
  --line: #e4e2dc;
  --line-2: #d4d1c9;
  --brand: #5b4cf0;
  --brand-ink: #4436d8;
  --brand-soft: #eeecfe;
  --brand-soft-on: #d9d4ff;
  --accent: #ff8a5b;
  --focus: #5b4cf0;
  --mark: #ffe58a;
  --mark-on: #ffb938;
  --shadow: 0 1px 2px rgb(20 20 30 / .04), 0 8px 24px -12px rgb(20 20 30 / .10);
  --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --c-blue: #2f6fed; --c-green: #1d9150; --c-orange: #e0611f; --c-sky: #1689c2; --c-teal: #0f8a7e; --c-indigo: #4f46e5;
  --c-purple: #8448d6; --c-slate: #586174; --c-amber: #b07905; --c-rose: #cf3c63; --c-stone: #85745c; --c-red: #d33a3a;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111115; --bg-2: #18181e; --surface: #1b1b22; --ink: #eeeef3; --ink-2: #c5c5d0; --muted: #9b9aa9; --line: #2b2b35; --line-2: #3a3a46;
  --brand: #7e72ff; --brand-ink: #aaa2ff; --brand-soft: #24214a; --brand-soft-on: #3a3478; --focus: #9d94ff; --mark: #6b5a12; --mark-on: #a8840f;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
  --c-blue: #6b9bff; --c-green: #4cc382; --c-orange: #ff8c55; --c-sky: #50b8ea; --c-teal: #3cc2b4; --c-indigo: #8f89ff;
  --c-purple: #b28aff; --c-slate: #a0a9bb; --c-amber: #e7b23a; --c-rose: #ff7a9c; --c-stone: #c4b296; --c-red: #ff7070;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: var(--brand-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
.ic { width: 20px; height: 20px; flex: none; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Header */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top-in { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 19px; letter-spacing: -.02em; }
.brand b { color: var(--brand-ink); font-weight: 750; }
.mark { width: 32px; height: 32px; }
.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; padding: 8px 10px; border-radius: 10px; }
.nav a:hover { background: var(--bg-2); color: var(--ink); }
@media (max-width: 520px) { .nav a:first-child { display: none; } .nav a { padding: 8px 8px; } }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
[data-theme-toggle] .ic:last-child { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .ic:first-child { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .ic:last-child { display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--line-2); background: var(--bg-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: transparent; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }

/* Hero */
.hero { text-align: center; padding: 56px 0 28px; }
.hero-sm { padding: 24px 0 24px; }
.hero h1 { font-size: clamp(34px, 6.4vw, 60px); font-weight: 760; letter-spacing: -.035em; margin-bottom: 16px; }
.hero-sm h1 { font-size: clamp(30px, 5vw, 46px); }
.hl { color: var(--brand-ink); }
.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); max-width: 640px; margin: 0 auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; margin: 0 0 16px; }
.eyebrow .ic { width: 16px; height: 16px; }
.eyebrow-pill { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--muted); padding-top: 20px; }
.crumbs a { color: var(--muted); }

/* Drop zone */
.drop { margin: 8px auto 0; max-width: 820px; border-radius: var(--r-lg); background: var(--surface); border: 1.5px dashed var(--line-2); box-shadow: var(--shadow); transition: border-color .15s, background .15s, transform .15s; }
.drop-inner { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px 28px; }
@media (min-width: 720px) { .drop-inner { padding: 56px 32px 32px; } }
.drop-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 16px; }
.drop-icon .ic { width: 28px; height: 28px; }
.drop-h { font-size: 22px; margin-bottom: 6px; }
.drop-sub { color: var(--muted); font-size: 15px; max-width: 460px; margin-bottom: 22px; }
.drop-foot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 20px 0 0; }
.drop-foot .ic { width: 15px; height: 15px; }
body.is-dragging .drop { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.01); }
.dragmask { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; background: color-mix(in srgb, var(--brand) 14%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.dragmask div { padding: 18px 26px; border-radius: 16px; background: var(--surface); border: 2px dashed var(--brand); font-weight: 650; color: var(--brand-ink); box-shadow: var(--shadow); }
body.is-dragging .dragmask { display: grid; }

/* Sections */
.section-h { font-size: 24px; font-weight: 720; margin-bottom: 18px; }
.formats, .faq-sec, .related { margin-top: 72px; }
.formats .section-h, .faq-sec .section-h { text-align: center; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.related .chips { justify-content: flex-start; }
.chip { --c: var(--c-slate); display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 650; text-decoration: none; letter-spacing: .02em; }
.chip:hover { border-color: var(--c); }
.chip.is-current { background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-color: var(--c); }
.chip-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.ftag { --c: var(--c-slate); display: inline-grid; place-items: center; min-width: 46px; height: 26px; padding: 0 8px; border-radius: 8px; font: 750 12px/1 var(--font); letter-spacing: .04em; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.chip-blue, .ftag-blue { --c: var(--c-blue); } .chip-green, .ftag-green { --c: var(--c-green); } .chip-orange, .ftag-orange { --c: var(--c-orange); }
.chip-sky, .ftag-sky { --c: var(--c-sky); } .chip-teal, .ftag-teal { --c: var(--c-teal); } .chip-indigo, .ftag-indigo { --c: var(--c-indigo); }
.chip-purple, .ftag-purple { --c: var(--c-purple); } .chip-slate, .ftag-slate { --c: var(--c-slate); } .chip-amber, .ftag-amber { --c: var(--c-amber); }
.chip-rose, .ftag-rose { --c: var(--c-rose); } .chip-stone, .ftag-stone { --c: var(--c-stone); } .chip-red, .ftag-red { --c: var(--c-red); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 28px; }
.fcard { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.fcard:hover { border-color: var(--line-2); transform: translateY(-1px); }
.fcard .ftag { margin-bottom: 8px; }
.fcard-t { font-weight: 620; font-size: 15px; line-height: 1.3; }
.fcard-x { font: 12px/1.4 var(--mono); color: var(--muted); }
.pitch { display: grid; gap: 14px; margin-top: 72px; }
@media (min-width: 760px) { .pitch { grid-template-columns: repeat(3, 1fr); } }
.pitch-item { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.pitch-item h3 { font-size: 18px; margin: 14px 0 6px; }
.pitch-item p { color: var(--ink-2); margin: 0; font-size: 15px; }
.pitch-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-ink); }
.appcard { margin-top: 72px; display: grid; gap: 24px; padding: 28px; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--accent) 12%, var(--surface))); border: 1px solid var(--line); }
@media (min-width: 820px) { .appcard { grid-template-columns: 1.2fr 1fr; align-items: center; padding: 40px; } }
.appcard h2 { font-size: clamp(24px, 3.4vw, 32px); }
.appcard p { color: var(--ink-2); margin: 0; }
.appcard .eyebrow { margin-bottom: 12px; color: var(--brand-ink); }
.appcard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.appcard-list li { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 78%, transparent); font-weight: 550; font-size: 15px; }
.appcard-list .ic { color: var(--brand-ink); }
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 18px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 620; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); margin: -4px 0 16px; }
.cols { display: grid; gap: 40px; margin-top: 64px; }
@media (min-width: 860px) { .cols { grid-template-columns: 1fr 1fr; gap: 56px; } }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks .ic { color: var(--c-green); margin-top: 3px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 16px; }
.steps li { counter-increment: s; position: relative; padding-left: 48px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 750; }
.steps h3 { font-size: 16px; margin: 4px 0 2px; }
.steps p { color: var(--ink-2); margin: 0; font-size: 15px; }

/* Prose pages */
.prose { max-width: 720px; margin: 0 auto; padding: 40px 0 24px; }
.prose h1 { font-size: clamp(32px, 5vw, 44px); letter-spacing: -.03em; }
.prose h2 { font-size: 21px; margin-top: 36px; }
.prose p, .prose li { color: var(--ink-2); }
.prose .meta { color: var(--muted); font-size: 14px; }
.callout { display: flex; gap: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--brand-soft); color: var(--ink) !important; }
.callout .ic { color: var(--brand-ink); margin-top: 2px; }

/* Footer */
.foot { margin-top: 96px; border-top: 1px solid var(--line); background: var(--bg-2); padding: 48px 0 24px; font-size: 14px; }
.foot-in { display: grid; gap: 32px; grid-template-columns: 1fr 1fr; }
@media (min-width: 860px) { .foot-in { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.foot-brand { grid-column: 1 / -1; }
@media (min-width: 860px) { .foot-brand { grid-column: auto; } }
.foot-brand p { color: var(--muted); margin-top: 12px; max-width: 280px; }
.foot-nav h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.foot-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-nav a { color: var(--ink-2); text-decoration: none; }
.foot-nav a:hover { color: var(--ink); text-decoration: underline; }
.foot-legal { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.foot-legal p { margin: 0; }

/* ---------- Viewer ---------- */
.viewer { margin: 8px auto 0; max-width: 1200px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: clip; }
.viewer:focus { outline: none; }
body.has-doc .drop { display: none; }
body.has-doc .hero { padding-bottom: 16px; }
.vbar { position: sticky; top: 64px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.vtitle { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 200px; }
.vname { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vmeta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.vactions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vbtn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.vbtn:hover { color: var(--ink); border-color: var(--line-2); background: var(--bg-2); }
.vbtn .ic { width: 17px; height: 17px; }
.vbtn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.vbtn-icon { width: 36px; padding: 0; justify-content: center; }
@media (max-width: 600px) { .vbtn .lbl { display: none; } .vbtn { width: 36px; padding: 0; justify-content: center; } }
.vsearch { display: flex; align-items: center; gap: 6px; width: 100%; order: 10; }
.vsearch[hidden] { display: none; }
.vsearch input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font: 15px var(--font); }
.vsearch input:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.vsearch output { font-size: 13px; color: var(--muted); min-width: 56px; text-align: center; }
.vtabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.vtab { flex: none; height: 32px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); font: 600 13.5px var(--font); cursor: pointer; }
.vtab:hover { background: var(--bg-2); }
.vtab[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.vbody { position: relative; min-height: 240px; background: var(--bg-2); }
.vnote { margin: 0; padding: 10px 16px; font-size: 13.5px; color: var(--ink-2); background: color-mix(in srgb, var(--c-amber) 12%, var(--surface)); border-bottom: 1px solid var(--line); }
.vloading { display: grid; place-items: center; gap: 12px; padding: 80px 16px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.verror { padding: 56px 20px; text-align: center; max-width: 520px; margin: 0 auto; }
.verror h3 { font-size: 19px; }
.verror p { color: var(--ink-2); }
.verror code { font: 13px var(--mono); color: var(--muted); }
mark.hit { background: var(--mark); color: inherit; border-radius: 2px; padding: 0; }
mark.hit.is-on { background: var(--mark-on); outline: 2px solid var(--mark-on); }

/* Paper (docx, odt, rtf, md): always a light sheet, like printed paper */
.paper-wrap { padding: 16px 8px; }
@media (min-width: 720px) { .paper-wrap { padding: 32px 24px; } }
.paper { max-width: 816px; margin: 0 auto; background: #fff; color: #1d1d22; padding: 28px 20px; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / .08), 0 6px 24px -10px rgb(0 0 0 / .18); font: 15.5px/1.6 var(--font); overflow-wrap: anywhere; color-scheme: light; }
@media (min-width: 720px) { .paper { padding: 64px 72px; } }
.paper a { color: #2c4fd6; }
.paper p { margin: 0 0 .7em; min-height: 1em; }
.paper h1, .paper h2, .paper h3, .paper h4, .paper h5, .paper h6 { margin: 1.1em 0 .45em; line-height: 1.25; color: #111; }
.paper h1 { font-size: 1.9em; } .paper h2 { font-size: 1.5em; } .paper h3 { font-size: 1.25em; } .paper h4 { font-size: 1.1em; }
.paper .title { font-size: 2.3em; font-weight: 700; letter-spacing: -.02em; margin-bottom: .2em; }
.paper .subtitle { font-size: 1.25em; color: #555; }
.paper > :first-child { margin-top: 0; }
.paper img { max-width: 100%; height: auto; vertical-align: middle; }
.paper table { border-collapse: collapse; margin: .6em 0 1.1em; max-width: 100%; }
.paper .tbl-scroll { overflow-x: auto; max-width: 100%; }
.paper td, .paper th { border: 1px solid #c9c9cf; padding: 5px 8px; vertical-align: top; min-width: 24px; }
.paper td p, .paper th p { margin: 0 0 .25em; }
.paper th { background: #f3f3f6; text-align: left; }
.paper ul, .paper ol { margin: 0 0 .7em; padding-left: 1.6em; }
.paper li { margin: .15em 0; }
.paper li > p { margin: 0; }
.paper li > ul, .paper li > ol { margin: .15em 0 0; }
.paper blockquote { margin: .8em 0; padding: .2em 1em; border-left: 4px solid #d8d6f7; color: #444; }
.paper pre { background: #f5f5f7; border-radius: 8px; padding: 12px 14px; overflow-x: auto; font: 13.5px/1.55 var(--mono); }
.paper code { font: .9em var(--mono); background: #f2f2f5; padding: .1em .35em; border-radius: 4px; }
.paper pre code { background: none; padding: 0; }
.paper hr { border: 0; border-top: 1px solid #ddd; margin: 1.6em 0; }
.paper hr.pagebreak { border-top: 2px dashed #d2d2da; margin: 2.4em -8px; }
.paper .task { list-style: none; margin-left: -1.4em; }
.paper .task input { margin-right: .5em; }
.paper .footnotes { margin-top: 2em; padding-top: 1em; border-top: 1px solid #ddd; font-size: .88em; color: #444; }
.paper .hdrftr { color: #777; font-size: .85em; border-bottom: 1px dashed #e2e2e8; margin-bottom: 1.5em; padding-bottom: .5em; }
.paper .hdrftr.ftr { border-bottom: 0; border-top: 1px dashed #e2e2e8; margin: 2em 0 0; padding: .5em 0 0; }
.paper .tab { display: inline-block; width: 2.5em; }
.md-src { margin: 0; }

/* Sheets */
.sheet-scroll { overflow: auto; max-height: 75vh; background: var(--surface); }
.sheet { border-collapse: separate; border-spacing: 0; font: 13.5px/1.4 var(--font); color: var(--ink); }
.sheet th, .sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 9px; white-space: pre-wrap; vertical-align: top; max-width: 480px; overflow: hidden; text-overflow: ellipsis; }
.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-2); color: var(--muted); font-weight: 600; font-size: 12px; text-align: center; }
.sheet tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg-2); color: var(--muted); font-weight: 500; font-size: 12px; text-align: right; min-width: 44px; }
.sheet thead th:first-child { left: 0; z-index: 3; }
.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet td.bool { text-align: center; }
.sheet td.err { color: var(--c-red); }
.sheet td.b { font-weight: 700; }
.sheet td.i { font-style: italic; }
.csv .sheet thead th { color: var(--ink); text-align: left; font-size: 13px; cursor: pointer; user-select: none; }
.csv .sheet thead th:first-child { cursor: default; }
.csv .sheet thead th[aria-sort="ascending"]::after { content: " ↑"; }
.csv .sheet thead th[aria-sort="descending"]::after { content: " ↓"; }

/* Slides */
.slides { padding: 16px 8px 24px; display: grid; gap: 18px; justify-items: center; }
@media (min-width: 720px) { .slides { padding: 28px 24px; } }
.slide-box { width: 100%; max-width: 1000px; }
.slide-num { font-size: 12.5px; color: var(--muted); margin: 0 0 6px 2px; }
.slide-frame { position: relative; width: 100%; overflow: hidden; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / .1), 0 8px 26px -12px rgb(0 0 0 / .3); background: #fff; color-scheme: light; }
.slide { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; color: #000; overflow: hidden; font-family: var(--font); }
.slide .shp { position: absolute; display: flex; flex-direction: column; overflow: visible; }
.slide .shp p { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.15; }
.slide .shp img { width: 100%; height: 100%; display: block; }
.slide table { border-collapse: collapse; width: 100%; height: 100%; }
.slide td { border: 1px solid #fff; padding: 4px 6px; vertical-align: top; }
.slides-nav { display: flex; align-items: center; gap: 8px; }

/* Code / text */
.code { display: grid; grid-template-columns: auto 1fr; background: var(--surface); font: 13.5px/1.6 var(--mono); overflow: auto; max-height: 78vh; }
.code .gutter { padding: 12px 10px 12px 14px; text-align: right; color: var(--muted); user-select: none; border-right: 1px solid var(--line); background: var(--bg-2); white-space: pre; position: sticky; left: 0; }
.code pre { margin: 0; padding: 12px 16px; white-space: pre; color: var(--ink); tab-size: 4; }
.code.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code.wrap .gutter { display: none; }
.code.wrap { grid-template-columns: 1fr; }
.tk-c { color: var(--muted); font-style: italic; } .tk-s { color: var(--c-green); } .tk-k { color: var(--c-purple); font-weight: 600; } .tk-n { color: var(--c-orange); }

/* JSON / XML tree */
.tree { padding: 14px 16px; background: var(--surface); font: 13.5px/1.7 var(--mono); overflow: auto; max-height: 78vh; color: var(--ink); }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dashed var(--line); }
.tree > ul { padding-left: 0; border: 0; }
.tree li { white-space: pre-wrap; overflow-wrap: anywhere; }
.tree details > summary { cursor: pointer; list-style: none; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary::before { content: "▸"; display: inline-block; width: 14px; color: var(--muted); transition: transform .12s; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree .k { color: var(--c-blue); } .tree .s { color: var(--c-green); } .tree .n { color: var(--c-orange); } .tree .b { color: var(--c-purple); } .tree .z { color: var(--muted); }
.tree .cnt { color: var(--muted); font-size: 12px; margin-left: 6px; }
.tree .tag { color: var(--c-rose); } .tree .attr { color: var(--c-amber); } .tree .av { color: var(--c-green); }
.tree .leaf { padding-left: 14px; }

/* ZIP list */
.ziplist { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
.ziplist th, .ziplist td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ziplist th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; background: var(--bg-2); }
.ziplist td.sz, .ziplist th.sz { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ziplist td.dt { color: var(--muted); white-space: nowrap; }
.ziplist .path { color: var(--muted); }
.ziplist .nm { overflow-wrap: anywhere; }
.ziplist .acts { display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) { .ziplist .dt { display: none; } }
.zipback { margin: 12px; }

/* EPUB reader */
.reader { display: grid; grid-template-rows: auto 1fr auto; background: var(--bg-2); }
.reader-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.reader-bar select { height: 36px; max-width: min(360px, 100%); border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 14px var(--font); padding: 0 8px; flex: 1 1 180px; }
.reader iframe { width: 100%; height: 78vh; border: 0; display: block; background: #fff; }
.reader-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { height: 34px; min-width: 36px; padding: 0 10px; border: 0; background: var(--surface); color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }

/* PDF + images */
.pdfwrap iframe { width: 100%; height: 80vh; border: 0; display: block; background: #fff; }
.pdfnote { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; padding: 10px 14px; font-size: 14px; color: var(--ink-2); background: var(--surface); border-bottom: 1px solid var(--line); }
.imgwrap { display: grid; place-items: center; padding: 24px; min-height: 300px; background-image: linear-gradient(45deg, var(--line) 25%, transparent 25%), linear-gradient(-45deg, var(--line) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--line) 75%), linear-gradient(-45deg, transparent 75%, var(--line) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.imgwrap img { max-width: 100%; max-height: 78vh; box-shadow: var(--shadow); }

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

/* Print: only the opened document */
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000; }
  body.has-doc > *:not(main), body.has-doc main > *:not(#viewer), .vbar, .vtabs, .vnote, .reader-bar, .reader-foot, .slide-num, .slides-nav, .gutter, .zipback, .pdfnote { display: none !important; }
  .viewer { border: 0; box-shadow: none; border-radius: 0; margin: 0; max-width: none; }
  .vbody, .paper-wrap, .slides { background: #fff !important; padding: 0 !important; }
  .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .sheet-scroll, .code, .tree { max-height: none; overflow: visible; }
  .sheet thead th, .sheet tbody th { position: static; }
  .slide-box { break-inside: avoid; page-break-inside: avoid; }
  .slide-frame { box-shadow: none; border: 1px solid #ccc; }
  .tree details { display: block; }
  .reader iframe { height: auto; min-height: 100vh; }
}
.vbtn.vbtn-text { width: auto; padding: 0 11px; }

/* Legal pages */
.prose h3 { font-size: 17px; margin-top: 24px; }
.prose .summary { padding: 16px 20px 16px 40px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.prose .summary li { color: var(--ink); }
