/* Impact ECU Docs — reader stylesheet. Loaded after tokens.css.
   Mobile-first: phone layout by default, two columns from 900px. */

/* Light-theme status colors, darkened so they pass 4.5:1 as text on their soft
   backgrounds (.ver, .tag-new, .helpful-msg, .hist b.cur, .banner-critical, .t-count).
   The dark-theme values in tokens.css already pass. */
:root:not([data-theme="dark"]) {
  --m-ok: #1f7a49;
  --m-warn: #8a5b0a;
  --m-bad: #b8393b;
  --m-muted: #5b6a78;
}

/* ---------- shell ---------- */
.wrap { max-width: 1400px; margin: 0 auto; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--m-navy); color: var(--m-navy-ink); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 8px; }
.sp { flex: 1; }
.main:focus { outline: none; }

.util { background: var(--m-navy); color: var(--m-navy-ink); font-size: var(--fs-xs); }
.util-in { display: flex; align-items: center; gap: 14px; padding: 0 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 30px; }
.util a { color: #cfe9f5; white-space: nowrap; }
.util-brand { font-weight: 600; letter-spacing: .02em; }
.util-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599px) { .util-brand { display: none; } .util-text { flex: 1; } .util .sp { display: none; } }

.hdr { background: var(--m-paper); border-bottom: 1px solid var(--m-line); }
.hdr-in { display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 62px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--m-ink); text-decoration: none; flex: 0 1 auto; min-width: 0; }
.brand:hover { text-decoration: none; }
.hdr .logo-plate { width: 64px; flex: none; }
/* The site name is admin-editable: it may shrink and wrap on phones (two lines) and never runs under the buttons. */
.site { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: .02em; line-height: 1.05; min-width: 0; text-wrap: balance; }
.site small { display: block; font-family: var(--font-body); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--m-muted); font-weight: 600; margin-top: 4px; line-height: 1.2; }
.hdr-actions { margin-left: auto; flex: none; display: flex; align-items: center; gap: 8px; }
.hdr .hdr-search { display: none; }
@media (min-width: 900px) {
  .hdr-in { gap: 22px; padding: 0 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); min-height: 66px; }
  .site { white-space: nowrap; line-height: 1; }
  .hdr .logo-plate { width: 96px; }
  .site { font-size: 22px; }
  .site small { font-size: 11.5px; }
  .hdr .hdr-search { display: flex; flex: 1; max-width: 560px; margin-left: auto; }
  .hdr-actions { margin-left: 0; }
  .menu-btn { display: none; }
}
@media (max-width: 380px) { .site small { display: none; } }

/* search field (header, home, search page) */
.search-form { position: relative; display: flex; align-items: center; gap: 10px; height: 40px; border: 1px solid var(--m-line); border-radius: 8px; background: var(--m-bg); padding: 0 12px; color: var(--m-muted); }
.search-form:focus-within { border-color: var(--m-cyan); box-shadow: var(--m-focus); }
.search-form svg { flex: none; }
.search-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; height: 100%; font-size: var(--fs-base); color: var(--m-ink); }
.search-form input:focus { outline: none; }
.search-form input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-form kbd { font-family: var(--font-body); font-size: 11px; border: 1px solid var(--m-line); border-radius: 4px; padding: 1px 6px; background: var(--m-paper); color: var(--m-muted); }
.search-form .btn { height: 32px; min-height: 32px; margin-right: -6px; }
.bigsearch { height: 50px; padding: 0 8px 0 14px; background: var(--m-paper); }
.bigsearch .btn { height: 38px; min-height: 38px; }
.suggest { position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 45; margin: 0; padding: 6px; list-style: none; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 10px; box-shadow: var(--m-shadow); max-height: 60vh; overflow-y: auto; }
.suggest li { padding: 9px 10px; border-radius: 6px; cursor: pointer; color: var(--m-ink); font-size: var(--fs-base); display: flex; flex-direction: column; gap: 2px; }
.suggest li small { color: var(--m-muted); font-size: var(--fs-xs); }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--m-cyan-soft); color: var(--m-cyan-ink); }
.suggest li.all { color: var(--m-cyan-ink); font-weight: 600; }
.suggest mark { background: transparent; color: inherit; font-weight: 700; }

/* popovers (garage mode, revision history) */
.pop { position: absolute; z-index: 50; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 10px; box-shadow: var(--m-shadow); padding: 12px 14px; color: var(--m-ink); font: 400 var(--fs-sm)/1.45 var(--font-body); letter-spacing: 0; text-align: left; }
.pop h3 { font-size: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--m-muted); font-weight: 600; margin-bottom: 8px; }
.pop-note { margin: 8px 0 0; color: var(--m-muted); font-size: var(--fs-xs); }
.garage { position: relative; }
.garage-pop { right: 0; top: calc(100% + 8px); width: 250px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--m-line-soft); cursor: pointer; font-size: var(--fs-base); }
.switch:first-of-type { border-top: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--m-line); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + i { background: var(--m-cyan); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--m-cyan); outline-offset: 2px; }

/* banners */
.banners { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: var(--fs-sm); border: 1px solid transparent; background: var(--m-cyan-soft); color: var(--m-cyan-ink); }
.banner-warning { background: var(--m-warn-soft); color: #6d4a0a; }
.banner-critical { background: var(--m-bad-soft); color: var(--m-bad); }
:root[data-theme="dark"] .banner-warning { color: var(--m-warn); }
.banner-icon { flex: none; margin-top: 2px; }
.banner-text { flex: 1; }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }
.banner-close { flex: none; border: 0; background: transparent; color: inherit; width: 30px; height: 30px; margin: -5px -6px -5px 0; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
.banner-close:hover { opacity: 1; background: rgba(0,0,0,.06); }
@media (min-width: 900px) { .banners { padding: 12px 24px 0; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); } }

/* ---------- two-column body ---------- */
.body { display: block; }
.side { display: none; }
.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
@media (min-width: 900px) {
  .body { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
  .side { display: block; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; background: var(--m-side); border-right: 1px solid var(--m-line); padding: 18px 14px 24px; padding-left: max(14px, env(safe-area-inset-left, 0px)); scrollbar-width: thin; }
  .main { padding: 22px 34px 48px; padding-right: max(34px, env(safe-area-inset-right, 0px)); }
}
@media (min-width: 1200px) { .body { grid-template-columns: 320px minmax(0, 1fr); } .main { padding: 26px 44px 56px; padding-right: max(44px, env(safe-area-inset-right, 0px)); } }

.side-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 8px 10px; font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--m-muted); }
.side-head span { font-family: var(--font-body); font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; font-weight: 400; }
.side-foot { margin-top: 16px; padding: 12px 10px; border-top: 1px solid var(--m-line); font-size: var(--fs-xs); color: var(--m-muted); }
.side-foot b { display: block; color: var(--m-ink); font-weight: 600; margin-bottom: 2px; }
.side-more { display: block; margin-top: 6px; }

/* ---------- contents tree ---------- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree details > ul { margin-left: 14px; border-left: 1px solid var(--m-line); padding-left: 8px; }
.tree li { margin: 1px 0; }
.tree summary { list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree .t-doc a, .tree .t-sec-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; color: var(--m-ink); padding: 7px 8px; min-height: 36px; border-radius: 6px; cursor: pointer; line-height: 1.3; text-decoration: none; }
.tree .t-doc a:hover, .tree .t-sec-btn:hover { background: var(--m-paper); text-decoration: none; }
.tree .t-doc a { font-size: var(--fs-sm); }
.tree .t-title { flex: 1; min-width: 0; }
.tree .t-doc.cur > a { background: var(--m-paper); color: var(--m-cyan-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--m-cyan); }
.tree .t-doc a .ico { width: 14px; height: 16px; border: 1.5px solid currentColor; border-radius: 2px; flex: none; opacity: .55; position: relative; }
.tree .t-doc a .ico::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 1.5px; background: currentColor; box-shadow: 0 3px 0 currentColor, 0 6px 0 currentColor; }
.tree .tag-new { margin-left: auto; }
.tree .t-sec-btn { font-weight: 600; font-size: var(--fs-base); }
.tree .t-num { flex: none; width: 22px; height: 22px; border-radius: 5px; background: var(--m-navy); color: var(--m-navy-ink); font-family: var(--font-display); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tree .t-sub .t-num { background: transparent; color: var(--m-cyan-ink); border: 1px solid var(--m-line); font-size: 12px; }
.tree .t-count { font-size: var(--fs-xs); color: var(--m-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.tree .chev { width: 8px; height: 8px; border-right: 2px solid var(--m-muted); border-bottom: 2px solid var(--m-muted); transform: rotate(-45deg); transition: transform .15s; flex: none; margin-right: 3px; }
.tree details[open] > summary .chev { transform: rotate(45deg); }
.tree .t-top { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--m-line); }
.tree .t-sec-link a { display: block; padding: 5px 8px; font-size: var(--fs-xs); color: var(--m-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tree .t-sec-link a:hover { color: var(--m-cyan-ink); text-decoration: none; }

/* ---------- generic content ---------- */
.crumbs { margin-bottom: 8px; }
.crumbs [aria-current] { color: var(--m-ink); }
.page-head { margin: 8px 0 18px; }
.page-head h1, .hero-title, .sec-title, .doc-head h1, .error-card h1, .retired h1, .sent h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.005em; }
.lede { color: var(--m-muted); font-size: var(--fs-md); margin: 8px 0 0; max-width: 62ch; }
.lede a { font-weight: 600; }
.eyebrow-h { font-family: var(--font-display); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--m-muted); font-weight: 600; margin: 0 0 10px; }
.h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.h-more { font-size: var(--fs-sm); font-weight: 600; }
.home-block { margin-top: 24px; }
.empty { color: var(--m-muted); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: var(--fs-sm); margin: 0 0 14px; }
.notice svg { flex: none; margin-top: 2px; }
.notice-warn { background: var(--m-warn-soft); color: #6d4a0a; }
:root[data-theme="dark"] .notice-warn { color: var(--m-warn); }
.dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--m-muted); vertical-align: middle; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.form-alt { font-size: var(--fs-sm); color: var(--m-muted); }
.grid-2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.req { font-weight: 400; text-transform: none; letter-spacing: 0; }
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.t-num.lg { width: 30px; height: 30px; border-radius: 7px; font-size: 17px; margin-right: 10px; vertical-align: -3px; }
.t-num.sub { background: transparent; color: var(--m-cyan-ink); border: 1px solid var(--m-line); }

/* ---------- home ---------- */
.hero { padding: 6px 0 4px; }
.hero .lede { margin-bottom: 16px; }
.hero .bigsearch { margin-top: 14px; max-width: 700px; }
@media (min-width: 900px) { .hero { padding: 10px 0 8px; } .hero-title { font-size: var(--fs-2xl); } }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.qcard { background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 96px; color: var(--m-ink); text-decoration: none; }
.qcard:hover { border-color: var(--m-cyan); text-decoration: none; box-shadow: var(--m-shadow); }
.qcard b { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.05; }
.qcard span { font-size: var(--fs-xs); color: var(--m-muted); }
.qcard .qi { width: 28px; height: 28px; border-radius: 7px; background: var(--m-cyan-soft); color: var(--m-cyan-ink); display: inline-flex; align-items: center; justify-content: center; }

.seclist, .doclist { display: flex; flex-direction: column; gap: 8px; }
.secrow { display: flex; align-items: center; gap: 12px; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; padding: 12px 14px; min-height: 60px; color: var(--m-ink); text-decoration: none; }
.secrow:hover { border-color: var(--m-cyan); text-decoration: none; }
.secrow .t-num { flex: none; width: 30px; height: 30px; border-radius: 7px; background: var(--m-navy); color: var(--m-navy-ink); font-family: var(--font-display); font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.secrow .t-num.sub { background: transparent; color: var(--m-cyan-ink); border: 1px solid var(--m-line); }
.secrow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.secrow b { font-size: var(--fs-base); font-weight: 600; line-height: 1.2; }
.secrow-text > span { font-size: var(--fs-xs); color: var(--m-muted); }
.secrow .chev { width: 9px; height: 9px; border-right: 2px solid var(--m-muted); border-bottom: 2px solid var(--m-muted); transform: rotate(-45deg); flex: none; margin-right: 4px; }

.docrow { display: flex; align-items: center; gap: 12px; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; padding: 11px 14px; min-height: 60px; color: var(--m-ink); text-decoration: none; }
.docrow:hover { border-color: var(--m-cyan); text-decoration: none; }
.docrow.cur { border-color: var(--m-cyan); box-shadow: inset 3px 0 0 var(--m-cyan); }
.docrow .ico { width: 30px; height: 36px; border-radius: 5px; background: var(--m-line-soft); flex: none; position: relative; }
.docrow .ico::after { content: "PDF"; position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font: 700 9px var(--font-body); color: var(--m-muted); letter-spacing: .04em; }
.docrow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.docrow b { font-size: var(--fs-base); font-weight: 600; line-height: 1.25; }
.docrow-text > span { font-size: var(--fs-xs); color: var(--m-muted); }
.docrow .ver { flex: none; }

.recent { list-style: none; margin: 0; padding: 0; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; }
.recent li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-top: 1px solid var(--m-line-soft); }
.recent li:first-child { border-top: 0; }
.recent-title { font-weight: 600; color: var(--m-ink); flex: 1 1 200px; min-width: 0; }
.recent-meta { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--m-muted); flex-wrap: wrap; }
.recent-note { flex-basis: 100%; font-size: var(--fs-sm); color: var(--m-muted); }

/* ---------- section ---------- */
.sec-head { margin: 8px 0 20px; }
.sec-meta { color: var(--m-muted); margin: 8px 0 0; font-size: var(--fs-base); max-width: 62ch; }

/* ---------- guide ---------- */
.doc-head { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 14px; }
@media (min-width: 900px) { .doc-head { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; } }
.doc-head-text { min-width: 0; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: var(--fs-sm); color: var(--m-muted); }
.meta-item { display: inline-flex; align-items: center; gap: 10px; }
.doc-summary { margin: 8px 0 0; color: var(--m-muted); max-width: 70ch; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-actions .btn { min-height: 40px; }
@media (max-width: 599px) { .doc-actions .btn { flex: 1 1 auto; } }
.ver-wrap { position: relative; display: inline-flex; }
button.ver { cursor: pointer; height: 26px; }
button.ver:hover { filter: brightness(.95); }
.ver-state { font: 600 12px var(--font-body); letter-spacing: 0; color: inherit; }
.hist { left: 0; top: calc(100% + 8px); width: min(360px, calc(100vw - 32px)); }
.hist ol { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.hist li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--m-line-soft); font-size: var(--fs-sm); }
.hist li:first-child { border-top: 0; }
.hist li b { font-family: var(--font-display); font-size: 16px; font-variant-numeric: tabular-nums; color: var(--m-ink); }
.hist li b.cur { color: var(--m-ok); }
.hist li small { display: block; color: var(--m-muted); font-size: var(--fs-xs); margin-top: 2px; }

/* viewer */
.viewer { border: 1px solid var(--m-line); border-radius: 10px; background: var(--m-bg); overflow: clip; position: relative; }
.vbar { position: sticky; top: 0; z-index: 5; min-height: 44px; background: var(--m-paper); border-bottom: 1px solid var(--m-line); display: flex; align-items: center; gap: 8px 12px; padding: 6px 10px; font-size: var(--fs-sm); color: var(--m-muted); flex-wrap: wrap; }
.vbar .pg { display: inline-flex; align-items: center; gap: 6px; color: var(--m-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-in { width: 44px; min-height: 30px; height: 30px; text-align: center; border: 1px solid var(--m-line); border-radius: 5px; background: var(--m-bg); color: var(--m-ink); font-weight: 600; padding: 0 4px; -moz-appearance: textfield; appearance: textfield; }
.pg-in::-webkit-outer-spin-button, .pg-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pg-in:focus { outline: none; border-color: var(--m-cyan); box-shadow: var(--m-focus); }
.vstatus { flex: 1; min-width: 60px; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vstatus.bad { color: var(--m-bad); }
.vbar .zoom { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
.vbar .zoom button, .vbar .tool { height: 32px; min-width: 32px; padding: 0 8px; border: 1px solid var(--m-line); border-radius: 6px; background: var(--m-bg); color: var(--m-ink); font: 600 var(--fs-xs) var(--font-body); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.vbar .zoom button:hover { border-color: var(--m-cyan); }
.vbar .tool[aria-pressed="true"] { background: var(--m-cyan-soft); color: var(--m-cyan-ink); border-color: transparent; }
.zoom-level { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; color: var(--m-ink); font-weight: 600; }
.colors-toggle { display: none !important; }
:root[data-theme="dark"] .viewer .colors-toggle { display: inline-flex !important; }
@media (max-width: 599px) { .vbar .zoom .tool-icon { display: none; } .vstatus { display: none; } }
.pages { padding: 14px 8px 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; position: relative; min-height: 220px; outline: none; }
@media (min-width: 900px) { .pages { padding: 22px; gap: 18px; } }
.pages:focus-visible { box-shadow: inset 0 0 0 2px var(--m-cyan); }
.page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); max-width: 100%; direction: ltr;
  --user-unit: 1; --total-scale-factor: calc(var(--scale-factor, 1) * var(--user-unit)); --scale-round-x: 1px; --scale-round-y: 1px; }
.page canvas { display: block; width: 100%; height: 100%; }
.page .page-num { position: absolute; right: 8px; bottom: 8px; font: 600 11px var(--font-body); color: #62717f; background: rgba(255,255,255,.85); border-radius: 4px; padding: 2px 6px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.page.is-current .page-num, .page:hover .page-num { opacity: 1; }
.page-skeleton { position: absolute; inset: 0; background: linear-gradient(110deg, #f4f6f8 30%, #e9edf1 50%, #f4f6f8 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
:root[data-theme="dark"] .viewer:not(.show-original) .page canvas { filter: invert(.9) hue-rotate(180deg); }
:root[data-theme="dark"] .page { background: #1d2731; }
:root[data-theme="dark"] .viewer.show-original .page { background: #fff; }
:root[data-theme="dark"] .page-skeleton { background: linear-gradient(110deg, #1d2731 30%, #26323e 50%, #1d2731 70%); background-size: 200% 100%; }
.v-msg { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; text-align: center; color: var(--m-muted); font-size: var(--fs-base); }
.v-msg.bad { color: var(--m-bad); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--m-line); border-top-color: var(--m-cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer.is-full { display: flex; flex-direction: column; background: var(--m-bg); border: 0; border-radius: 0; }
.viewer.is-full .pages { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.viewer.is-full .vbar { position: static; }

/* PDF.js text layer (selection + search highlights) */
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 2; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer span { font-size: calc(var(--font-height, 10px) * var(--total-scale-factor, 1)); transform: rotate(var(--rotate, 0deg)) scaleX(var(--scale-x, 1)); }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer span[role="img"] { user-select: none; cursor: default; }
.textLayer ::selection { background: rgba(46, 184, 230, .35); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
.textLayer mark { background: rgba(255, 214, 0, .55); color: transparent; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 214, 0, .35); }
:root[data-theme="dark"] .viewer:not(.show-original) .textLayer mark { background: rgba(46, 184, 230, .45); box-shadow: none; }
.page .textLayer { pointer-events: auto; }

/* previous / next */
.doc-foot { display: grid; gap: 10px; margin-top: 18px; }
@media (min-width: 640px) { .doc-foot { grid-template-columns: 1fr 1fr; gap: 14px; } }
.pn { border: 1px solid var(--m-line); border-radius: 10px; padding: 12px 16px; background: var(--m-paper); display: flex; flex-direction: column; gap: 2px; color: var(--m-ink); text-decoration: none; min-height: 84px; }
.pn:hover { border-color: var(--m-cyan); text-decoration: none; }
.pn small { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--m-muted); font-weight: 600; }
.pn b { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.1; }
.pn-progress { font-size: var(--fs-xs); color: var(--m-muted); margin-top: auto; padding-top: 4px; }
.pn.next { text-align: right; align-items: flex-end; }
.pn.cont small { color: var(--m-cyan-ink); }
.pn.empty { border-style: dashed; color: var(--m-muted); }
.pn.empty b { color: var(--m-muted); font-size: 15px; }

/* helpful strip */
.helpful { margin-top: 16px; border-top: 1px solid var(--m-line); padding-top: 14px; font-size: var(--fs-sm); color: var(--m-muted); }
.helpful-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.helpful-row > span:first-child { font-weight: 600; color: var(--m-ink); }
.helpful .btn.sm { min-height: 34px; }
.still-stuck { flex-basis: 100%; }
@media (min-width: 900px) { .still-stuck { flex-basis: auto; } }
.helpful-comment { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.helpful-comment textarea { width: 100%; border: 1px solid var(--m-line); border-radius: 8px; background: var(--m-paper); padding: 9px 11px; font-size: var(--fs-base); color: var(--m-ink); resize: vertical; min-height: 84px; }
.helpful-comment textarea:focus { outline: none; border-color: var(--m-cyan); box-shadow: var(--m-focus); }
.helpful-comment-actions { display: flex; gap: 8px; }
.helpful-msg { margin: 10px 0 0; font-weight: 600; }
.helpful-msg.is-ok { color: var(--m-ok); }
.helpful-msg.is-bad { color: var(--m-bad); }
.helpful.is-done .helpful-row .btn[data-vote] { display: none; }

/* ---------- search ---------- */
.results-count { color: var(--m-muted); margin: 0 0 14px; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.result { background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; padding: 14px 16px; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.result-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--m-ink); }
.result-section { font-size: var(--fs-xs); color: var(--m-muted); }
.hits { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hit { display: flex; gap: 10px; align-items: baseline; font-size: var(--fs-sm); }
.hit-page { flex: none; font-weight: 700; white-space: nowrap; min-width: 62px; }
.hit-snippet { color: var(--m-muted); }
.hit-snippet mark, .zero mark { background: var(--m-warn-soft); color: var(--m-ink); border-radius: 3px; padding: 0 2px; font-weight: 600; }
:root[data-theme="dark"] .hit-snippet mark { background: #4a3a10; }
.zero h2 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 10px; }
.zero-list { margin: 0 0 14px; padding-left: 18px; color: var(--m-muted); }
.zero-list li { margin: 4px 0; }

/* ---------- what's new ---------- */
.wn-month { margin-top: 22px; }
.wn-list { list-style: none; margin: 0; padding: 0; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; }
.wn-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--m-line-soft); }
.wn-item:first-child { border-top: 0; }
.wn-date { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--m-muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.wn-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wn-title a { font-weight: 600; color: var(--m-ink); }
.wn-section { display: block; font-size: var(--fs-xs); color: var(--m-muted); margin-top: 2px; }
.wn-note { margin: 6px 0 0; font-size: var(--fs-sm); }

/* ---------- support ---------- */
.support-form { margin-top: 6px; max-width: 760px; }
.support-about { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: 8px; background: var(--m-cyan-soft); color: var(--m-cyan-ink); margin-bottom: 16px; font-size: var(--fs-sm); }
.support-about-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.support-about b { color: var(--m-ink); }
:root[data-theme="dark"] .support-about b { color: var(--m-ink); }
.field-inline .input-sm { max-width: 120px; }
.field input[type="file"] { width: 100%; font-size: var(--fs-sm); padding: 8px 0; }
.sent, .retired, .error-card { margin-top: 8px; padding: 22px 20px 24px; }
.sent-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--m-ok-soft); color: var(--m-ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.retired .pill, .error-card .pill { margin-bottom: 10px; }
.error-card .bigsearch { margin-top: 16px; max-width: 520px; }
.retired .eyebrow-h { margin-top: 22px; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--m-line); margin-top: 24px; background: var(--m-paper); padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.foot-in { padding: 18px 16px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 10px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--fs-sm); font-weight: 600; }
.foot-feed { display: inline-flex; align-items: center; gap: 4px; }
.legal { margin: 0; font-size: var(--fs-xs); color: var(--m-muted); max-width: 80ch; }
@media (min-width: 900px) { .foot { padding-bottom: 0; } .foot-in { padding: 18px 24px 26px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); } }

/* ---------- phone thumb bar ---------- */
.thumb-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--m-paper); border-top: 1px solid var(--m-line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); box-shadow: 0 -4px 16px rgba(27, 36, 48, .06); }
.thumb-bar a, .thumb-bar button, .thumb-bar > span { min-height: 52px; border: 0; background: transparent; font: 600 10.5px/1 var(--font-body); color: var(--m-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 6px 2px; border-radius: 8px; text-decoration: none; cursor: pointer; }
.thumb-bar a:hover, .thumb-bar button:hover { color: var(--m-cyan-ink); text-decoration: none; background: var(--m-bg); }
.thumb-bar svg { width: 22px; height: 22px; }
.thumb-bar .is-disabled { opacity: .4; cursor: default; }
@media (min-width: 900px) { .thumb-bar { display: none; } }
.viewer.is-full ~ .thumb-bar { display: none; }

/* ---------- bottom sheet (contents on phones) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-overlay { position: absolute; inset: 0; background: rgba(10, 16, 22, .55); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; max-height: 86dvh; background: var(--m-paper); border-radius: 16px 16px 0 0; display: flex; flex-direction: column; box-shadow: var(--m-shadow-lg); padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheet-up .2s ease-out; outline: none; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--m-line); }
.sheet-head h2 { font-size: 17px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--m-muted); }
.sheet-head h2 span { font-family: var(--font-body); font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; font-weight: 400; margin-left: 6px; }
.sheet-head .iconbtn { width: 44px; height: 44px; }
.sheet-body { overflow-y: auto; padding: 10px 12px 20px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); -webkit-overflow-scrolling: touch; }
.sheet-body .tree .t-doc a, .sheet-body .tree .t-sec-btn { min-height: 44px; }
@media (min-width: 900px) { .sheet-panel { left: auto; right: 0; top: 0; bottom: 0; width: 380px; max-height: none; border-radius: 0; } }
body.sheet-open { overflow: hidden; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; background: var(--m-navy); color: var(--m-navy-ink); padding: 10px 16px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--m-shadow); opacity: 0; transition: opacity .15s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* phones and tablets: thumb-sized controls (40px+) for the viewer toolbar, version button,
   helpful strip and banner close. Last in the file so it wins over the compact defaults above. */
@media (max-width: 899px) {
  .vbar .zoom { gap: 8px; }
  .vbar .zoom button, .vbar .tool { height: 40px; min-width: 40px; }
  .pg-in { height: 40px; min-height: 40px; width: 52px; }
  button.ver { height: auto; min-height: 32px; padding: 0 10px 0 8px; }
  .helpful .btn.sm { min-height: 40px; }
  .banner-close { width: 40px; height: 40px; margin: -10px -10px -10px 0; }
}

/* print */
@media print { .util, .hdr, .side, .thumb-bar, .sheet, .doc-actions, .helpful, .doc-foot, .foot, .vbar { display: none !important; } .main { padding: 0; } }
