:root {
  color-scheme: light;
  --white: #fff;
  --paper: #f4f5f7;
  --ink: #191b20;
  --muted: #5b626f;
  --line: #e3e6ec;
  --accent: #0025bc;
  --red: #f90101;
  --violet: #790672;
  --bar-h: 76px;
  --bottom-h: 67px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--white); }
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr) var(--bottom-h); overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; inset: 8px auto auto 8px; z-index: 20; padding: 10px; background: white; color: var(--accent); }
.bar { display: flex; align-items: center; gap: 20px; padding: 0 25px; border-bottom: 1px solid var(--line); z-index: 4; background: white; }
.brand { background: none; border: 0; border-radius: 5px; padding: 0; flex: none; display: grid; place-items: center; }
.brand img { width: 62px; height: 54px; object-fit: contain; display: block; }
.bar-title { padding: 2px 0 2px 20px; border-left: 1px solid var(--line); font-size: 15px; font-weight: 630; letter-spacing: -.24px; line-height: 1.25; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { border: 1px solid transparent; border-radius: 9px; background: transparent; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; flex: none; gap: 8px; transition: background .18s, color .18s, box-shadow .18s; }
.icon-btn svg, .finder svg { width: 18px; height: 18px; flex: none; }
.icon-btn:not(:disabled):hover { background: #f0f2f6; }
.icon-btn:active:not(:disabled) { background: #e7eafa; color: var(--accent); }
.icon-btn:disabled { color: #aab0bc; }
.panel-toggle[aria-expanded="true"] { background: #edf0f7; color: var(--accent); }
.search-trigger { width: auto; padding: 0 13px; border-color: var(--line); font-size: 13px; font-weight: 550; }
.workspace { min-height: 0; min-width: 0; display: flex; position: relative; }
.panel { width: 302px; background: white; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; flex: none; z-index: 3; }
.panel-top { display: flex; align-items: center; gap: 8px; padding: 21px 17px 0; }
.tabs { border-radius: 10px; background: #f2f3f6; padding: 3px; display: flex; flex: 1; }
.tabs button { flex: 1; min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 630; padding: 0 7px; }
.tabs button[aria-selected="true"] { background: white; color: var(--ink); box-shadow: 0 1px 3px #24282c20; }
.close-panel { height: 38px; width: 32px; }
.finder { margin: 16px 17px 12px; display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); padding: 0 10px; border-radius: 9px; color: var(--muted); }
.finder > span { display: flex; }
.finder input { height: 38px; min-width: 0; width: 100%; border: 0; background: none; font-size: 14px; outline: none; }
.finder:focus-within { border-color: #7789d7; box-shadow: 0 0 0 2px #0025bc13; }
.panel-scroll { overflow: auto; flex: 1; padding: 0 13px 16px; overscroll-behavior: contain; scrollbar-width: thin; }
.nav-list { display: grid; gap: 3px; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; text-align: left; min-height: 39px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: none; font-size: 13px; line-height: 1.24; }
.nav-row:hover, .thumb:hover { background: #f2f4f8; }
.nav-row[aria-current="page"], .thumb[aria-current="page"] { background: #edf1fc; color: #0023a4; }
.nav-row .folio { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; flex: none; }
.nav-row[aria-current="page"] .folio { color: #1739b7; }
.nav-group-heading { font-size: 11px; letter-spacing: .045em; text-transform: uppercase; color: var(--muted); font-weight: 640; margin: 15px 10px 5px; }
.nav-group-heading:first-child { margin-top: 9px; }
.nav-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.35; }
.no-results { margin: 18px 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.thumb-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.thumb { display: grid; gap: 6px; text-align: left; align-content: start; border: 1px solid transparent; border-radius: 9px; padding: 6px; background: transparent; min-width: 0; }
.thumb img { display: block; width: 100%; aspect-ratio: 17 / 22; object-fit: contain; border: 1px solid var(--line); background: white; }
.thumb span { font-size: 11px; min-height: 2.6em; color: var(--muted); }
.thumb[aria-current="page"] { border-color: #d1d9f8; }
.scrim { display: none; }
.reader { flex: 1; min-width: 0; min-height: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 33%, #fafbfc 0%, #eef0f4 100%); }
.viewport { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.viewport:focus-visible { outline-offset: -3px; }
.arena { display: grid; place-items: center; min-width: 100%; min-height: 100%; width: max-content; height: max-content; padding: var(--inset-v, 26px) var(--inset-h, 64px); }
.book { background: white; isolation: isolate; position: relative; display: flex; width: var(--book-w, 0px); height: var(--book-h, 0px); perspective: 2200px; box-shadow: 0 17px 42px #20293929, 0 2px 5px #2029391c, 0 0 0 1px #333f4e12; touch-action: pan-y; }
.book[data-zoom] { touch-action: auto; }
.book:empty { box-shadow: none; }
.leaf { width: var(--leaf-w); height: 100%; background: white; position: relative; flex: none; overflow: hidden; }
.leaf > img, .face > img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.document-link { position: absolute; display: block; border: 0; border-radius: 2px; background: transparent; }
.document-link:hover { background: #0025bc12; }
.document-link:focus-visible { background: #0025bc16; outline-offset: 0; }
.spine { pointer-events: none; position: absolute; inset: 0 auto 0 50%; width: 13px; transform: translateX(-50%); z-index: 1; background: linear-gradient(90deg, transparent, #38414f11 44%, #38414f22 50%, #38414f0e 57%, transparent); }
.turn { position: absolute; top: 0; width: var(--leaf-w); height: 100%; z-index: 2; transform-style: preserve-3d; pointer-events: none; }
.turn.forward { right: 0; transform-origin: left center; }
.turn.backward { left: 0; transform-origin: right center; }
.face { position: absolute; inset: 0; background: white; backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }
.face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,#19203668,transparent 61%); opacity: var(--shade, .2); }
.turn.backward .face::after { background: linear-gradient(270deg,#19203668,transparent 61%); }
.cast-shadow { position: absolute; z-index: 1; inset: 0 50% 0 0; pointer-events: none; background: linear-gradient(270deg,#15203348,transparent 80%); }
.cast-shadow.backward { inset: 0 0 0 50%; background: linear-gradient(90deg,#15203348,transparent 80%); }
.stage-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: #ffffffdf; border-color: #dce1eb; border-radius: 50%; box-shadow: 0 3px 14px #2d395314; width: 41px; height: 41px; }
.stage-arrow.prev { left: 16px; }
.stage-arrow.next { right: 16px; }
.stage-arrow:disabled { opacity: .37; box-shadow: none; }
.reader.zoomed .stage-arrow { display: none; }
.overlay-loader, .load-error { position: absolute; inset: auto auto 12px 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); white-space: nowrap; border-radius: 24px; padding: 8px 13px; box-shadow: 0 2px 9px #18304a17; background: #fff; color: var(--muted); border: 1px solid var(--line); font-size: 12px; z-index: 3; }
.overlay-loader span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #dce2fb; border-top-color: var(--accent); animation: spin .68s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-error { border-radius: 10px; inset: 45% auto auto 50%; white-space: normal; color: var(--ink); }
.load-error button { border: 0; padding: 6px; background: transparent; color: var(--accent); font-weight: 650; }
.bottom { background: white; display: grid; grid-template-columns: 1fr auto 1fr; padding: 0 22px; gap: 9px; align-items: center; border-top: 1px solid var(--line); z-index: 4; }
.controls { grid-column: 2; grid-row: 1; display: flex; gap: 15px; align-items: center; justify-content: center; }
.group { display: flex; align-items: center; gap: 2px; }
.zoom-actions { padding-left: 13px; border-left: 1px solid var(--line); }
.go { display: flex; align-items: center; gap: 7px; padding: 0 6px; white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.go input { text-align: center; padding: 0 3px; width: 37px; height: 29px; font-size: 13px; font-weight: 650; border: 1px solid var(--line); background: #f8f9fb; border-radius: 6px; }
.go input[aria-invalid="true"] { border-color: #af1244; }
.page-total { color: var(--muted); }
.zoom-value { border: 0; background: none; border-radius: 7px; font-size: 12px; font-weight: 600; padding: 7px 3px; min-width: 44px; }
.zoom-value:hover { background: #f0f2f6; }
.status { grid-row: 1; display: flex; align-items: center; gap: 7px; color: #515775; font-size: 11px; line-height: 1.25; }
.status > span:first-child { border-radius: 50%; flex: none; width: 7px; height: 7px; background: #790672; box-shadow: 0 0 0 3px #79067214; }
.bottom-right { grid-column: 3; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.mode { color: var(--muted); font-size: 12px; text-align: right; }
.whatsapp {
  display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  background: #25d366; color: #0b2014; text-decoration: none;
  white-space: nowrap; font-size: 13px; font-weight: 650;
  box-shadow: 0 2px 7px #122c211f;
  animation: whatsapp-in .32s ease-out both;
  transition: background-color .16s ease;
}
.whatsapp:hover { background-color: #1dcc60; }
@keyframes whatsapp-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 651px) and (max-width: 880px) {
  .has-whatsapp .mode { display: none; }
}
@media (max-width: 1049px) {
  .panel { position: absolute; inset: 0 auto 0 0; width: min(354px, 92vw); box-shadow: 8px 0 30px #14203529; }
  .scrim { display: block; border: 0; position: absolute; inset: 0; background: #15213846; z-index: 2; }
}
@media (max-width: 650px) {
  :root { --bar-h: 62px; --bottom-h: calc(77px + env(safe-area-inset-bottom, 0px)); }
  .bar { padding: 0 10px; gap: 8px; }
  .bar-title { font-size: 13px; padding-left: 8px; }
  .brand img { width: 49px; height: 44px; }
  .bar-actions { gap: 1px; }
  .bar-actions .icon-btn { width: 36px; height: 42px; border-color: transparent; padding: 0; }
  .search-trigger span { display: none; }
  .stage-arrow { display: none; }
  .bottom { grid-template-columns: 1fr; grid-template-rows: 46px auto; justify-items: center; gap: 0; padding: 0 6px env(safe-area-inset-bottom,0px); }
  .app.approved { --bottom-h: calc(54px + env(safe-area-inset-bottom, 0px)); }
  .approved .bottom { grid-template-rows: 1fr; }
  .bottom .controls { grid-column: 1; grid-row: 1; gap: 8px; }
  .bottom .status { grid-row: 2; grid-column: 1; padding-bottom: 7px; }
  .mode { display: none; }
  .bottom-right { display: none; }
  .app.has-whatsapp { --bottom-h: calc(98px + env(safe-area-inset-bottom, 0px)); }
  .has-whatsapp .bottom { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 46px 1fr; gap: 0 8px; padding-inline: 12px; }
  .has-whatsapp .bottom .controls { grid-column: 1 / -1; }
  .has-whatsapp .bottom .status { justify-self: start; padding: 0; }
  .has-whatsapp .bottom-right { display: flex; grid-column: 2; grid-row: 2; }
  .zoom-actions { padding-left: 7px; }
  .group .icon-btn { width: 39px; height: 43px; }
  .panel-top { padding-top: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
  .overlay-loader span { animation-duration: 2s; }
  .whatsapp { animation: none; }
}
.app:fullscreen { background: white; height: 100%; }
