/* ==========================================================================
   APOLO · Hojas inferiores y vista previa de impresión (Fase 19, v1.0)
   Solo usa los tokens de los 4 temas (tvci-themes.css): --surface, --border, --text, --muted, --accent...
   Sin reglas de prioridad forzada. Complementa tvci-ui.css (toasts .ntf y diálogos .modal--dlg ya existen allí).
   ========================================================================== */

/* ───────────── Hoja inferior ───────────── */
.sheet-veil { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .22s ease; }
.sheet-veil.is-open { opacity: 1; }
.sheet { position: fixed; z-index: 71; left: 50%; bottom: 0; width: min(640px, 100vw); max-height: 88vh; display: flex; flex-direction: column;
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong, var(--border)); border-bottom: 0;
    border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .35);
    transform: translate(-50%, calc(100% + var(--sheet-drag, 0px))); transition: transform .24s ease; padding-bottom: env(safe-area-inset-bottom, 0); }
.sheet[hidden] { display: none; }
.sheet.is-open { transform: translate(-50%, var(--sheet-drag, 0px)); }
.sheet:focus { outline: none; }
.sheet__handle { padding: 8px 0 2px; cursor: grab; touch-action: none; flex: none; }
.sheet__handle::before { content: ''; display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 4px; background: var(--border-strong, var(--border)); }
.sheet__head { display: flex; align-items: flex-start; gap: 12px; padding: 6px 16px 10px; border-bottom: 1px solid var(--border); flex: none; }
.sheet__title { margin: 0; font-size: 1rem; font-weight: 600; }
.sheet__sub { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.sheet__x { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; border-radius: var(--radius-sm); }
.sheet__x:hover { color: var(--text); background: var(--surface-2); }
.sheet__body { padding: 14px 16px; overflow: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.sheet__foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); flex: none; }
html.sheet-open { overflow: hidden; }
@media (min-width: 900px) { .sheet { bottom: 24px; border-bottom: 1px solid var(--border-strong, var(--border)); border-radius: 16px; } }

/* ───────────── Vista previa de impresión ───────────── */
.prm { border: 0; padding: 0; background: transparent; color: var(--text); width: min(980px, calc(100vw - 20px)); max-width: none; max-height: calc(100vh - 20px); }
.prm::backdrop { background: rgba(0, 0, 0, .6); }
.prm__box { background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: 14px; display: grid; grid-template-rows: auto 1fr auto; height: min(88vh, 900px); overflow: hidden; }
.prm__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.prm__title { margin: 0; font-size: .95rem; font-weight: 600; }
.prm__tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.prm__tab { min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.prm__tab:hover { border-color: var(--accent); }
.prm__tab.is-on { background: var(--btn-bg, var(--accent)); border-color: var(--btn-border, var(--accent)); color: var(--btn-text, var(--accent-ink)); }
.prm__x { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; border-radius: var(--radius-sm); }
.prm__x:hover { color: var(--text); background: var(--surface-2); }
.prm__frame { position: relative; background: var(--bg-2, var(--surface-2)); }
.prm__frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.prm__loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .875rem; pointer-events: none; background: var(--bg-2, var(--surface-2)); }
.prm__loading[hidden] { display: none; }
.prm__foot { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.prm__remember { display: inline-flex; gap: 6px; align-items: center; font-size: .8125rem; cursor: pointer; min-height: 36px; }
.prm__remember[hidden] { display: none; }
.prm__hint { flex: 1; font-size: .75rem; color: var(--muted); }
@media (max-width: 640px) {
    .prm { width: 100vw; max-height: 100vh; }
    .prm__box { height: 100vh; border-radius: 0; border: 0; }
    .prm__hint { display: none; }
    .prm__foot .btn { flex: 1 1 100%; justify-content: center; }
}

/* ───────────── Menú de impresión (desplegable) ───────────── */
.pmenu { position: relative; display: inline-block; }
.pmenu > summary { list-style: none; cursor: pointer; }
.pmenu > summary::-webkit-details-marker { display: none; }
.pmenu__list { position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); min-width: 210px; display: grid; gap: 2px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.pmenu__item { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent;
    color: var(--text); font: inherit; font-size: .8125rem; text-align: left; text-decoration: none; cursor: pointer; width: 100%; }
.pmenu__item:hover { background: var(--surface-2); }
.pmenu__sep { height: 1px; margin: 4px 2px; background: var(--border); }
