:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6673;
  --line: #d8dee7;
  --panel: #ffffff;
  --bg: #f5f7fa;
  --brand: #0f766e;
  --brand-strong: #0b5d57;
  --warn: #9a6700;
  --danger: #b42318;
  --ok: #137333;
}

* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
body { margin: 0; background: var(--bg); color: var(--ink); }
body { overflow-x: hidden; }
html.domain-home-root,
html.domain-home-root body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body.domain-home {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
a { color: var(--brand-strong); }
img { max-width: 100%; height: auto; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { min-height: 58px; display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.brand { font-weight: 750; color: var(--ink); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav a, .button, button { min-height: 38px; border-radius: 6px; border: 1px solid var(--line); padding: 8px 12px; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; }
.button.primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.danger, button.danger { border-color: #f3b7b1; color: var(--danger); }
main.wrap { padding: 24px 0 56px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.metric { display: grid; gap: 4px; }
.metric strong { font-size: 1.6rem; }
.muted { color: var(--muted); }
.flash { border: 1px solid var(--line); border-left: 4px solid var(--brand); background: #fff; padding: 12px; border-radius: 6px; margin-bottom: 16px; }
.flash.error { border-left-color: var(--danger); }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: .88rem; }
.status.ok { color: var(--ok); border-color: #b7dfc2; background: #f0fff4; }
.status.warn { color: var(--warn); border-color: #efd081; background: #fff8e5; }
.status.error { color: var(--danger); border-color: #f3b7b1; background: #fff1f0; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; background: #fff; }
textarea { min-height: 110px; resize: vertical; }
.inline-check { display: flex; grid-auto-flow: column; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 500; }
.inline-check input { width: auto; min-height: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #eef3f7; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.page-heading h1 { margin: 2px 0 8px; }
.eyebrow { margin: 0; color: var(--brand-strong); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.workflow-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.workflow-strip span { min-height: 38px; display: grid; place-items: center; padding: 8px; background: #f8fbfa; color: #285b56; font-weight: 750; font-size: .88rem; text-align: center; }
.admin-flow { grid-template-columns: 1fr; }
.admin-section { display: grid; gap: 16px; }
.section-title { display: flex; gap: 12px; align-items: flex-start; }
.section-title h2 { margin: 0 0 3px; }
.section-title p { margin: 0; }
.step-badge { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800; box-shadow: 0 8px 18px rgba(15, 118, 110, .18); }
.info-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.info-list div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fafc; }
.info-list dt { color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; }
.info-list dd { margin: 4px 0 0; font-weight: 750; }
.social-current { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.social-current p { margin: 0; }
.viewer { display: grid; gap: 12px; min-height: calc(100dvh - 58px); }
.page-shell { aspect-ratio: 3 / 4; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.page-shell img { width: 100%; height: 100%; object-fit: contain; }
.pdf-shell { aspect-ratio: 4 / 5; min-height: 560px; }
.pdf-shell object { width: 100%; height: 100%; border: 0; display: block; }
.pdf-fallback { display: grid; gap: 10px; place-items: center; text-align: center; padding: 24px; }
.reader-shell { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; min-height: calc(100dvh - 132px); padding-bottom: env(safe-area-inset-bottom); }
.reader-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reader-toolbar button, .reader-toolbar a { min-width: 42px; }
.reader-stage { min-height: 0; overflow: hidden; display: grid; place-items: center; background: #e7ebef; border: 1px solid var(--line); border-radius: 8px; touch-action: pan-x pan-y pinch-zoom; }
.reader-arrow { display: none; }
.reader-page-indicator { display: none; }
.flip-book { width: min(100%, 1280px); height: min(74dvh, 860px); max-height: calc(100dvh - 245px); }
.flip-page { background: #f9fafb; display: grid; place-items: center; overflow: hidden; }
.flip-page img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.page-skeleton { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); background: linear-gradient(90deg, #eef1f4, #f8fafc, #eef1f4); }
.thumb-panel { display: none; gap: 8px; max-height: 180px; overflow: auto; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.thumb-panel.is-open { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
.thumb-panel button { height: auto; padding: 4px; display: grid; gap: 4px; place-items: center; }
.thumb-panel img { width: 72px; aspect-ratio: 3 / 4; object-fit: contain; background: #f5f7fa; }
.reader-footer { color: var(--muted); font-size: .9rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reader-footer a { color: inherit; }
.clean-main { width: 100%; padding: 0; }
main.wrap.clean-main { padding: 0; width: 100%; height: 100dvh; }
.clean-viewer { min-height: 100dvh; gap: 0; }
.clean-viewer .reader-shell { height: 100dvh; min-height: 100dvh; grid-template-rows: minmax(0, 1fr) auto; gap: 0; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
.clean-viewer .reader-stage { border: 0; border-radius: 0; background: #edf1f4; }
.clean-viewer .flip-book { width: min(100%, 1460px); height: calc(100dvh - 76px); max-height: none; }
.clean-viewer .reader-footer { align-items: center; justify-content: center; min-height: 36px; gap: 18px; text-align: center; background: #0f766e; border-top: 1px solid rgba(255,255,255,.16); padding: 8px 12px; color: rgba(255,255,255,.88); }
.domain-viewer { height: 100dvh; min-height: 100dvh; gap: 0; }
.domain-viewer .reader-shell { height: 100dvh; min-height: 100dvh; grid-template-rows: minmax(0, 1fr) auto; gap: 0; padding: 0; }
.domain-viewer .reader-toolbar { background: transparent; padding: 0; gap: 6px; align-items: center; min-height: 0; overflow: visible; flex-wrap: nowrap; scrollbar-width: thin; }
.domain-viewer .reader-toolbar button,
.domain-viewer .reader-toolbar a,
.domain-viewer .reader-toolbar .status { flex: 0 0 auto; min-height: 34px; border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.96); color: #111827; white-space: nowrap; }
.domain-viewer .reader-toolbar .primary { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }
.domain-viewer .reader-toolbar button.is-active { background: #0f766e !important; color: #fff !important; border-color: #0f766e !important; }
.domain-viewer .reader-toolbar-bottom { justify-content: flex-end; }
.domain-viewer .reader-toolbar .icon-download,
.footer-whatsapp { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; display: grid; place-items: center; border-radius: 8px; overflow: hidden; }
.domain-viewer .reader-toolbar .icon-download img,
.footer-whatsapp img { width: 22px; height: 22px; display: block; object-fit: contain; }
.footer-whatsapp { flex: 0 0 auto; background: #16a085; border: 1px solid rgba(255,255,255,.22); box-shadow: 0 8px 18px rgba(0,0,0,.16); }
.domain-viewer .reader-stage { position: relative; border: 0; border-radius: 0; background: var(--reader-bg-color, #eaf4ef); align-items: start; isolation: isolate; }
.domain-viewer .reader-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(circle at 18% 12%, rgba(255,255,255,.72), transparent 28%), radial-gradient(circle at 84% 76%, rgba(183,214,70,.22), transparent 30%), linear-gradient(115deg, rgba(15,118,110,.22), rgba(255,255,255,.78) 46%, rgba(183,214,70,.2)), var(--viewer-backdrop, none); background-size: cover; background-position: center; opacity: .95; }
.domain-viewer.viewer-bg-image .reader-stage::before { filter: blur(12px); transform: scale(1.04); opacity: .88; }
.domain-viewer.viewer-bg-off .reader-stage { background: #f4f7f9; }
.domain-viewer.viewer-bg-off .reader-stage::before { display: none; }
.domain-viewer.viewer-bg-preset-fresh .reader-stage::before { background-image: radial-gradient(circle at 12% 16%, rgba(255,255,255,.8), transparent 28%), linear-gradient(115deg, rgba(15,118,110,.26), rgba(221,247,225,.78) 48%, rgba(138,194,64,.22)); }
.domain-viewer.viewer-bg-preset-soft .reader-stage::before { background-image: radial-gradient(circle at 18% 14%, rgba(255,255,255,.82), transparent 30%), linear-gradient(115deg, rgba(255,255,255,.7), rgba(232,238,231,.88) 50%, rgba(15,118,110,.12)); }
.domain-viewer.viewer-bg-preset-neutral .reader-stage::before { background-image: radial-gradient(circle at 18% 12%, rgba(255,255,255,.72), transparent 28%), linear-gradient(115deg, rgba(226,232,240,.86), rgba(255,255,255,.72) 48%, rgba(203,213,225,.82)); }
.domain-viewer .reader-arrow { position: absolute; top: 50%; z-index: 4; display: grid; place-items: center; width: clamp(46px, 4.4vw, 64px); height: clamp(46px, 4.4vw, 64px); min-height: 0; padding: 0; border: 1px solid rgba(255,255,255,.9); border-radius: 999px; background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(244,248,246,.88)); color: transparent; box-shadow: 0 16px 36px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255,255,255,.98); transform: translateY(-50%); backdrop-filter: blur(10px); transition: opacity .16s ease, visibility .16s ease, transform .18s ease, box-shadow .18s ease, background .18s ease; }
.domain-viewer .reader-arrow::before,
.domain-viewer .reader-arrow::after { content: ""; position: absolute; left: 50%; top: 50%; width: clamp(4px, .35vw, 5px); height: clamp(18px, 1.7vw, 24px); border-radius: 999px; background: #0f5d57; transform-origin: 50% 50%; }
.domain-viewer .reader-arrow-prev::before { transform: translate(-58%, -84%) rotate(42deg); }
.domain-viewer .reader-arrow-prev::after { transform: translate(-58%, -16%) rotate(-42deg); }
.domain-viewer .reader-arrow-next::before { transform: translate(-42%, -84%) rotate(-42deg); }
.domain-viewer .reader-arrow-next::after { transform: translate(-42%, -16%) rotate(42deg); }
.domain-viewer .reader-arrow.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.domain-viewer .reader-arrow:hover { background: #fff; box-shadow: 0 18px 42px rgba(15, 23, 42, .22), inset 0 1px 0 rgba(255,255,255,1); transform: translateY(-50%) scale(1.04); }
.domain-viewer .reader-arrow:active { transform: translateY(-50%) scale(.98); }
.domain-viewer .reader-arrow:focus-visible { outline: 3px solid rgba(15,118,110,.28); outline-offset: 3px; }
.domain-viewer .reader-arrow-prev { left: clamp(10px, 2vw, 30px); }
.domain-viewer .reader-arrow-next { right: clamp(10px, 2vw, 30px); }
.footer-whatsapp:hover { background: #128c7e; }
.footer-whatsapp:focus-visible { outline: 3px solid rgba(255,255,255,.32); outline-offset: 2px; }
.domain-viewer .flip-book { width: min(100%, 1450px); height: 100%; max-height: none; }
.domain-viewer .flip-book.stf__parent { height: 100%; align-self: start; }
.domain-viewer .flip-page img { touch-action: pan-x pan-y pinch-zoom; user-select: none; }
.domain-viewer.is-zoomed .reader-stage { overflow: auto; place-items: start center; overscroll-behavior: contain; }
.domain-viewer.is-zoomed .reader-arrow { opacity: 0; visibility: hidden; pointer-events: none; }
.reader-page-indicator { position: absolute; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 6px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(15, 118, 110, .9); color: #fff; font-size: .86rem; font-weight: 750; letter-spacing: .01em; box-shadow: 0 12px 28px rgba(15, 23, 42, .18); transform: translateX(-50%); backdrop-filter: blur(8px); pointer-events: none; }
.domain-viewer .reader-footer { align-items: center; justify-content: space-between; width: 100vw; max-width: 100vw; min-height: 48px; gap: 16px; text-align: left; background: #0f766e; border-top: 1px solid rgba(255,255,255,.16); padding: 6px 12px max(6px, env(safe-area-inset-bottom)); color: rgba(255,255,255,.9); box-shadow: 0 -10px 24px rgba(15, 23, 42, .08); flex-wrap: nowrap; overflow: hidden; }
.reader-footer-copy { display: flex; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 8px 18px; min-width: 0; overflow: hidden; }
.reader-footer-copy span,
.reader-footer-copy a { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-footer-actions { position: fixed; right: 12px; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.domain-viewer .reader-footer .reader-toolbar > *,
.domain-viewer .reader-footer .reader-toolbar a.button { flex: 0 0 auto !important; width: auto !important; min-width: 34px !important; max-width: none !important; grid-column: auto !important; }
.domain-viewer .reader-footer .reader-toolbar [data-zoom-reset] { min-width: 58px !important; }
.domain-viewer .reader-footer a,
.clean-viewer .reader-footer a { color: #ffffff; text-decoration-color: rgba(255,255,255,.42); text-underline-offset: 3px; }
.domain-viewer .reader-footer a:hover,
.clean-viewer .reader-footer a:hover { text-decoration-color: #ffffff; }
.processing-panel { display: grid; gap: 10px; }
.progress-bar { height: 12px; border-radius: 999px; background: #e1e7ee; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: var(--progress, 0%); background: var(--brand); transition: width .2s ease; }

body.reader-fullscreen { overflow: hidden; }
body.reader-fullscreen .topbar,
body.reader-fullscreen .reader-footer,
body.reader-fullscreen .viewer > h1,
body.reader-fullscreen .viewer > p { display: none; }
body.reader-fullscreen main.wrap { width: 100%; padding: 8px; }
body.reader-fullscreen .reader-shell { min-height: calc(100dvh - 16px); }
body.reader-fullscreen .flip-book { height: calc(100dvh - 88px); max-height: none; }

@media (max-width: 1024px) {
  body.domain-home.mobile-auto-fullscreen main.wrap.clean-main { padding: 0; height: 100dvh; }
  body.domain-home.mobile-auto-fullscreen .reader-shell { height: 100dvh; min-height: 100dvh; grid-template-rows: minmax(0, 1fr) auto; padding: 0; }
  body.domain-home.mobile-auto-fullscreen .reader-footer { display: flex; }
  body.domain-home.mobile-auto-fullscreen .reader-stage { min-height: 0; background: #f4f7f9; }
  body.domain-home.mobile-auto-fullscreen .reader-stage::before { display: none; }
  body.domain-home.mobile-auto-fullscreen .flip-book,
  body.domain-home.mobile-auto-fullscreen .flip-book.stf__parent { height: auto; max-height: none; align-self: start; }
}

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

@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .page-heading { display: grid; }
  .workflow-strip { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .topbar .wrap { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .pdf-shell { min-height: 620px; aspect-ratio: auto; }
  .viewer { min-height: 100dvh; }
  .reader-shell { min-height: calc(100dvh - 120px); }
  .reader-stage { width: 100%; border-radius: 0; margin-inline: 0; border-left: 0; border-right: 0; overflow: hidden; }
  .flip-book { width: min(100%, calc(100vw - 64px)) !important; height: calc(100dvh - 300px); max-height: none; margin-inline: auto; }
  .reader-toolbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 100%; overflow: hidden; }
  .reader-toolbar button, .reader-toolbar a, .reader-toolbar .status { width: 100%; min-height: 34px; min-width: 0; padding: 6px 6px; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
  .reader-toolbar a.button { grid-column: span 2; }
  .viewer h1 { font-size: 1.8rem; line-height: 1.12; }
  .clean-main { width: 100%; }
  .clean-viewer .reader-shell { padding: 0 0 max(8px, env(safe-area-inset-bottom)); }
  .clean-viewer .reader-stage { margin: 0; }
  .clean-viewer .flip-book { width: min(100%, calc(100vw - 10px)) !important; height: calc(100dvh - 92px); }
  .clean-viewer .reader-footer { font-size: .82rem; gap: 8px; padding: 7px 8px; }
  .domain-viewer .reader-shell { grid-template-rows: minmax(0, 1fr) auto; padding-bottom: 0; }
  .domain-viewer .reader-toolbar {
    display: flex !important;
    background: transparent;
    padding: 0;
    overflow: visible;
    width: auto;
    max-width: 100%;
  }
  .domain-viewer .reader-toolbar > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    text-align: center;
  }
  .domain-viewer .reader-toolbar [data-zoom-reset] { grid-column: auto !important; }
  .domain-viewer .reader-toolbar .icon-download { grid-column: auto !important; width: 34px !important; min-width: 34px !important; }
  .domain-viewer .flip-book { width: min(100%, calc(100vw - 14px)) !important; height: 100%; min-height: 0; }
  .domain-viewer .reader-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
    min-height: 54px;
    justify-content: space-between;
    font-size: .78rem;
    line-height: 1.25;
    gap: 8px;
    padding: 7px 10px max(7px, env(safe-area-inset-bottom));
    padding-right: 220px;
    white-space: normal;
  }
  .domain-viewer .reader-arrow {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.82);
  }
  .domain-viewer .reader-arrow::before,
  .domain-viewer .reader-arrow::after { width: 3px; height: 15px; }
  .domain-viewer .reader-arrow-prev { left: 4px; }
  .domain-viewer .reader-arrow-next { right: 4px; }
  .reader-page-indicator { bottom: 8px; min-height: 28px; padding: 5px 10px; font-size: .76rem; }
  .reader-footer-copy { justify-content: flex-start; gap: 1px 10px; }
  .reader-footer-copy a { flex-shrink: 2; }
  .reader-footer-actions { gap: 5px; min-width: max-content; position: fixed; right: 8px; bottom: max(7px, env(safe-area-inset-bottom)); z-index: 20; transform: none; }
  .footer-whatsapp,
  .domain-viewer .reader-toolbar .icon-download { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
  .footer-whatsapp img,
  .domain-viewer .reader-toolbar .icon-download img { width: 20px; height: 20px; }
  .domain-viewer .reader-footer span,
  .domain-viewer .reader-footer a {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .domain-viewer .reader-footer-copy { flex: 1 1 0 !important; max-width: calc(100% - 214px); }
  .domain-viewer .reader-footer .reader-footer-copy { display: none !important; }
  .domain-viewer .reader-footer { padding-right: 8px; justify-content: flex-start; }
  .reader-footer-actions { position: static !important; left: auto; right: auto; bottom: auto; justify-content: flex-start; }
  .domain-viewer .reader-footer-actions { flex: 0 0 auto !important; }
  .domain-viewer .reader-footer .reader-toolbar { display: flex !important; width: auto !important; max-width: none !important; }
  .domain-viewer .reader-footer .reader-toolbar > *,
  .domain-viewer .reader-footer .reader-toolbar a.button {
    flex: 0 0 auto !important;
    width: 30px !important;
    min-width: 30px !important;
    max-width: none !important;
    grid-column: auto !important;
  }
  .domain-viewer .reader-footer .reader-toolbar [data-zoom-reset] { width: 46px !important; min-width: 46px !important; }
  article[data-magazine-viewer]:not(.domain-viewer) .reader-toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  article[data-magazine-viewer]:not(.domain-viewer) .reader-toolbar > * {
    grid-column: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .domain-viewer .reader-shell { padding-bottom: 0; }
  .domain-viewer .reader-toolbar {
    display: flex !important;
    justify-content: flex-end;
    gap: 6px;
    padding: 0;
    overflow: visible;
    width: 100%;
    max-width: 100vw;
  }
  .domain-viewer .reader-toolbar > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .domain-viewer .reader-toolbar .icon-download { grid-column: auto !important; width: 36px !important; min-width: 36px !important; }
  .domain-viewer .flip-book,
  .domain-viewer .flip-book.stf__parent { height: auto; min-height: 0; }
}

@media (max-width: 480px) {
  .domain-viewer .reader-toolbar,
  article[data-magazine-viewer] .reader-toolbar { width: auto !important; max-width: 100% !important; padding: 0 !important; }
  .domain-viewer .reader-toolbar > *,
  article[data-magazine-viewer] .reader-toolbar > * {
    grid-column: auto !important;
    width: 100% !important;
  }
  .domain-viewer .reader-toolbar .icon-download { grid-column: auto !important; width: 32px !important; min-width: 32px !important; }
  .domain-viewer .reader-footer .reader-toolbar > *,
  .domain-viewer .reader-footer .reader-toolbar a.button {
    width: auto !important;
    width: 28px !important;
    min-width: 28px !important;
  }
  .domain-viewer .reader-footer .reader-toolbar [data-zoom-reset] { width: 42px !important; min-width: 42px !important; }
  .domain-viewer .reader-toolbar button,
  .domain-viewer .reader-toolbar a,
  .domain-viewer .reader-toolbar .status {
    min-height: 32px;
    padding: 4px 4px;
    font-size: .76rem;
  }
  .footer-whatsapp,
  .domain-viewer .reader-toolbar .icon-download { width: 28px !important; min-width: 28px !important; height: 32px; min-height: 32px; }
  .footer-whatsapp img,
  .domain-viewer .reader-toolbar .icon-download img { width: 18px; height: 18px; }
  .domain-viewer .reader-footer .reader-footer-copy { display: none !important; }
  .domain-viewer .reader-footer { padding-right: 8px; justify-content: flex-end; }
  .reader-footer-actions { left: 8px; right: 8px; justify-content: flex-end; }
  .domain-viewer .reader-footer { padding-right: 206px; }
  .domain-viewer .reader-shell { padding-bottom: 0; }
  .domain-viewer .flip-book,
  .domain-viewer .flip-book.stf__parent { height: auto; min-height: 0; }
}

@media (max-width: 360px) {
  .domain-viewer .reader-footer { display: grid; grid-template-columns: 1fr auto; }
  .reader-footer-copy { font-size: .72rem; }
  .domain-viewer .reader-toolbar button,
  .domain-viewer .reader-toolbar a,
  .domain-viewer .reader-toolbar .status { padding-inline: 5px; }
}

/* Final reader controls: fast, touch-friendly, and stable across viewports. */
.domain-viewer .reader-footer {
  width: 100vw;
  max-width: 100vw;
  min-height: 58px;
  padding: 8px 14px max(8px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.domain-viewer .reader-footer-copy {
  max-width: calc(100vw - 300px);
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
}

.domain-viewer .reader-footer-copy span,
.domain-viewer .reader-footer-copy a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-viewer .reader-footer-actions {
  position: fixed;
  right: 16px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-viewer .reader-toolbar {
  display: flex !important;
  align-items: center;
  gap: 8px;
  width: auto !important;
  max-width: none !important;
  overflow: visible;
}

.domain-viewer .reader-footer-actions button,
.domain-viewer .reader-footer-actions a {
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.96);
  color: #0f172a;
  box-shadow: 0 8px 20px rgba(0,0,0,.14);
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
}

.domain-viewer .reader-footer-actions [data-zoom-reset] {
  width: 62px !important;
  min-width: 62px !important;
  font-size: .9rem;
}

.domain-viewer .reader-footer-actions .footer-whatsapp {
  position: fixed;
  right: 22px;
  bottom: 82px;
  width: 60px !important;
  min-width: 60px !important;
  height: 60px !important;
  min-height: 60px !important;
  border-radius: 999px;
  background: #18a999;
  border-color: rgba(255,255,255,.55);
  box-shadow: 0 18px 38px rgba(15,23,42,.24);
}

.domain-viewer .reader-footer-actions .footer-whatsapp:hover {
  background: #12b886;
}

.domain-viewer .reader-footer-actions img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

@media (min-width: 761px) and (max-width: 1024px) {
  .domain-viewer .reader-footer-copy { max-width: calc(100vw - 280px); }
  .domain-viewer .reader-footer-actions { right: 12px; }
  .domain-viewer .reader-footer-actions button,
  .domain-viewer .reader-footer-actions a {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
  }
  .domain-viewer .reader-footer-actions [data-zoom-reset] {
    width: 64px !important;
    min-width: 64px !important;
  }
}

@media (max-width: 760px) {
  .domain-viewer .reader-footer {
    min-height: 62px;
    justify-content: center;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }
  .domain-viewer .reader-footer-copy {
    display: none !important;
  }
  .domain-viewer .reader-footer-actions {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    width: 100%;
    justify-content: center;
    gap: 8px;
  }
  .domain-viewer .reader-footer-actions .footer-whatsapp {
    position: static !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.16);
  }
  .domain-viewer .reader-footer-actions button,
  .domain-viewer .reader-footer-actions a {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 12px;
  }
  .domain-viewer .reader-footer-actions [data-zoom-reset] {
    width: 68px !important;
    min-width: 68px !important;
  }
}

/* Final polish: homogeneous controls and visible WhatsApp mark. */
.domain-viewer .reader-footer-actions .footer-whatsapp {
  background: #25d366 !important;
  border: 3px solid #ffffff !important;
  color: #ffffff !important;
}

.domain-viewer .reader-footer-actions .footer-whatsapp img {
  width: 30px !important;
  height: 30px !important;
}

.domain-viewer .reader-footer-actions button,
.domain-viewer .reader-footer-actions .button {
  width: 52px !important;
  min-width: 52px !important;
  height: 52px !important;
  min-height: 52px !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #0f172a !important;
}

.domain-viewer .reader-footer-actions [data-zoom-reset] {
  width: 64px !important;
  min-width: 64px !important;
  font-size: .88rem !important;
}

@media (min-width: 761px) {
  .domain-viewer .reader-footer-actions .footer-whatsapp {
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
    border-radius: 999px !important;
    animation: whatsappPulse 2.8s ease-in-out infinite;
  }
}

@media (max-width: 760px) {
  .domain-viewer .reader-footer-actions {
    gap: 10px !important;
  }
  .domain-viewer .reader-footer-actions .footer-whatsapp,
  .domain-viewer .reader-footer-actions button,
  .domain-viewer .reader-footer-actions .button {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    border-radius: 11px !important;
  }
  .domain-viewer .reader-footer-actions [data-zoom-reset] {
    width: 70px !important;
    min-width: 70px !important;
    font-size: .88rem !important;
  }
}

@keyframes whatsappPulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 18px 38px rgba(15,23,42,.22), 0 0 0 0 rgba(37,211,102,.3); }
  50% { transform: translateY(-3px) scale(1.04); box-shadow: 0 22px 44px rgba(15,23,42,.26), 0 0 0 10px rgba(37,211,102,0); }
}

@media (prefers-reduced-motion: reduce) {
  .domain-viewer .reader-footer-actions .footer-whatsapp { animation: none !important; }
}

/* Desktop/tablet control refinement. */
@media (min-width: 761px) {
  .domain-viewer .reader-footer {
    min-height: 56px;
    padding-block: 6px;
  }

  .domain-viewer .reader-footer-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .domain-viewer .reader-footer-actions button,
  .domain-viewer .reader-footer-actions .button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 9px !important;
    border: 1px solid rgba(15, 23, 42, .08) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12) !important;
    font-size: .95rem !important;
  }

  .domain-viewer .reader-footer-actions .icon-download img {
    width: 22px !important;
    height: 22px !important;
  }

  .domain-viewer .reader-footer-actions [data-zoom-reset] {
    width: 66px !important;
    min-width: 66px !important;
    font-size: .86rem !important;
    font-weight: 800;
  }
}
