/* Base compartida de estructura y controles. Cargar despues de los estilos de vista. */
:root {
    --shell-header-height:72px; --ui-action-text:.8rem; --ui-radius-control:12px; --ui-radius-panel:20px;
    --font-display:"Plus Jakarta Sans","Aptos Display","Segoe UI",Arial,sans-serif;
    --font-body:"Rubik",Aptos,"Segoe UI",Arial,sans-serif;
    --font-code:"Google Sans Code","Cascadia Code",Consolas,monospace;
}
html { scroll-padding-top:calc(var(--shell-header-height) + 16px); }
body { overflow-x:visible; }
.workspace { min-width:0; }
:focus-visible { outline:3px solid var(--data-accent-line); outline-offset:3px; }
.sidebar :focus-visible { outline-color:var(--ua-300); }
.comparison-controls,.period-controls,.pos-controls,.comparison-pos-controls,.history-controls,.admin-section-tabs { top:calc(var(--shell-header-height) + 12px); }
.config-index,.dictionary-tree-panel { top:calc(var(--shell-header-height) + 98px); }
.othala-topbar { height:auto; min-height:72px; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:16px; padding:10px 24px; }
.shell-identity,.shell-product,.shell-utilities,.shell-navigation { display:flex; align-items:center; }
.shell-identity { gap:16px; min-width:0; }
.shell-signature { display:flex; align-items:center; flex:0 0 140px; min-height:44px; }
.shell-signature img { display:block; width:140px; height:auto; max-height:38px; object-fit:contain; filter:none; }
[data-theme="dark"] .shell-signature img[data-static="true"] { filter:brightness(1.9); }
.shell-product { gap:8px; min-height:44px; color:var(--text); text-decoration:none; white-space:nowrap; }
.shell-product .rune-emblem { --rune-size:40px; --orbit-period:16s; }
.shell-product strong { font-family:var(--font-display); font-size:1rem; font-weight:650; }
.shell-admin-topbar .shell-product { min-width:0; white-space:normal; }
.shell-admin-topbar .shell-product strong { max-width:9rem; line-height:1.2; }
.shell-navigation { justify-content:center; gap:4px; }
.shell-navigation>a { display:flex; align-items:center; min-height:44px; padding:8px 12px; border-radius:12px; font-size:.8rem; font-weight:560; color:var(--muted); text-decoration:none; }
.shell-navigation>a:hover,.shell-navigation>a[aria-current] { color:var(--text); background:var(--surface); }
.shell-utilities { justify-content:flex-end; gap:8px; }
.shell-report-exit { display:flex; margin:0; flex:0 0 44px; }
.reports-login-help { color:var(--muted); font-size:.9rem; line-height:1.6; }
.othala-topbar .icon-button,.icon-button,.sidebar-collapse { min-width:44px; min-height:44px; width:44px; height:44px; border-radius:12px; }
.othala-topbar .icon-button { color:var(--text); }
.shell-menu-button { display:none; flex:0 0 44px; align-items:center; justify-content:center; }
.sidebar { overflow-y:auto; overscroll-behavior:contain; }
.sidebar .nav-item { min-height:44px; }
.sidebar-collapse { width:100%; flex-shrink:0; }
.sidebar .brand-mark { width:48px; height:48px; flex-shrink:0; background:transparent; }
.sidebar .brand-copy { color:var(--sidebar-text); text-decoration:none; }
.sidebar .brand-mark .rune-emblem { --rune-size:48px; --orbit-period:16s; }
.shell-motion-toggle { display:inline-flex; min-width:44px; min-height:44px; padding:8px 12px; align-items:center; justify-content:center; gap:8px; border:1px solid var(--line); border-radius:12px; background:transparent; color:var(--muted); font:560 .8rem var(--font-body); cursor:pointer; }
.sidebar .shell-motion-toggle { width:100%; flex-shrink:0; margin-top:12px; border-color:rgba(255,255,255,.15); color:var(--sidebar-text); }
.shell-motion-toggle .motion-play { display:none; }
[data-motion="paused"] .shell-motion-toggle .motion-pause { display:none; }
[data-motion="paused"] .shell-motion-toggle .motion-play { display:block; }
[data-motion="paused"] .rune-emblem .orbit-rotor { animation-play-state:paused; }
.shell-motion-toggle:disabled { opacity:1; cursor:default; }
.nav-branch { display:flex; align-items:center; gap:8px; width:100%; min-height:44px; padding:8px 12px; border:0; border-radius:12px; background:transparent; color:var(--sidebar-muted); font:560 .8rem var(--font-body); text-align:left; cursor:pointer; }
.nav-branch:hover { color:var(--sidebar-text); background:rgba(255,255,255,.06); }
.nav-branch::after { content:'⌄'; margin-left:auto; transition:transform .18s ease; }
.nav-branch[aria-expanded="false"]::after { transform:rotate(-90deg); }
.nav-branch[aria-disabled="true"] { cursor:default; }
.nav-branch[aria-disabled="true"]::after { content:'Actual'; font-size:.7rem; font-weight:400; }
.shell-nav-backdrop,.shell-dialog-backdrop { position:fixed; inset:0; z-index:125; background:rgba(0,0,0,.48); border:0; padding:0; }
body.has-shell-overlay { overflow:hidden; }
.shell-utilities { min-width:0; }
.shell-utilities>.theme-toggle { flex:0 0 44px; }
.shell-session { position:relative; flex:0 1 320px; min-width:0; max-width:320px; }
.othala-topbar .shell-session-toggle { display:flex; align-items:center; gap:10px; width:100%; max-width:100%; height:auto; min-height:52px; padding:8px 12px; text-align:left; font:560 .8rem var(--font-body); }
.shell-session-avatar { flex:0 0 24px; width:24px; height:24px; color:var(--muted); }
.shell-session-copy { display:flex; flex:1; flex-direction:column; gap:3px; min-width:0; line-height:1.3; }
.shell-session-name,.shell-session-title { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.shell-session-name { color:var(--text); }
.shell-session-title { color:var(--muted); font-weight:400; }
.shell-session-chevron { flex:0 0 16px; width:16px; height:16px; transition:transform .16s ease; }
.shell-session-toggle[aria-expanded="true"] .shell-session-chevron { transform:rotate(180deg); }
.shell-session-toggle[aria-expanded="true"] { border-color:var(--ua-700); }
[data-theme="dark"] .shell-session-toggle[aria-expanded="true"] { border-color:var(--ua-300); }
.shell-session-menu { position:absolute; z-index:160; right:0; top:calc(100% + 8px); width:208px; padding:8px; border:1px solid var(--line); border-radius:20px; background:var(--surface); box-shadow:0 12px 32px rgba(0,0,0,.18); }
.shell-session-menu>[role="menuitem"] { display:flex; align-items:center; min-height:44px; width:100%; padding:8px 12px; border:0; border-radius:12px; color:var(--text); background:transparent; font:560 .8rem var(--font-body); text-align:left; text-decoration:none; cursor:pointer; }
.shell-session-menu>[role="menuitem"]:hover,.shell-session-menu>[role="menuitem"]:focus-visible { background:var(--surface-2); }
.shell-session-menu>[role="separator"] { height:1px; background:var(--line); margin:8px; }
.shell-session-menu>[role="menuitem"]:last-child { color:var(--rose-700); }
[data-theme="dark"] .shell-session-menu>[role="menuitem"]:last-child { color:var(--rose-200); }
.shell-dialog { position:fixed; z-index:150; left:50%; top:50%; transform:translate(-50%,-50%); width:min(480px,calc(100% - 32px)); max-height:calc(100dvh - 32px); overflow:auto; padding:24px; border:1px solid var(--line); border-radius:20px; background:var(--surface); color:var(--text); box-shadow:0 24px 64px rgba(0,0,0,.25); }
.shell-dialog>header { position:sticky; top:-24px; display:flex; align-items:center; justify-content:space-between; gap:16px; margin:-24px -24px 16px; padding:16px 24px; background:var(--surface-2); background:color-mix(in srgb,var(--data-accent-line) 10%,var(--surface)); }
.shell-dialog h2 { margin:0; color:var(--ua-800); font:650 1.35rem var(--font-display); }
[data-theme="dark"] .shell-dialog h2 { color:var(--ua-300); }
.shell-dialog p,.shell-dialog dt { font-size:.9rem; line-height:1.6; color:var(--muted); }
.shell-dialog dd { margin:8px 0 24px; overflow-wrap:anywhere; }
.shell-dialog label { display:block; margin-top:16px; font-size:.9rem; }
.shell-dialog select { display:block; width:100%; min-height:44px; margin:8px 0; padding:8px 12px; color:var(--text); background:var(--canvas); border:1px solid var(--line); border-radius:12px; font:inherit; }
.shell-dialog .shell-checkbox { display:flex; gap:12px; align-items:center; min-height:44px; line-height:1.5; }
.shell-checkbox input { flex:0 0 20px; width:20px; height:20px; accent-color:var(--data-accent-line); }
.shell-report-actions { display:flex; justify-content:flex-end; margin:16px 0; }
.shell-action { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 16px; border:1px solid var(--line); border-radius:12px; color:var(--text); background:var(--surface); font:560 .8rem var(--font-body); cursor:pointer; }
.shell-action:hover { border-color:var(--data-accent-line); }
.report-catalog>.global-search { display:flex; margin:20px 0 24px; max-width:none; min-height:44px; }
.report-catalog>.global-search kbd { flex-shrink:0; white-space:nowrap; }
.report-catalog>.global-search input { min-width:0; font-size:1rem; }
.institutional-footer { margin-top:0; border-top:1px solid var(--line); background:var(--surface); color:var(--text); overflow:visible; }
.institutional-footer::before { display:none; }
.institutional-footer-inner { grid-template-columns:minmax(0,2fr) minmax(240px,1fr); gap:32px; padding-top:32px; padding-bottom:24px; }
.institutional-footer-lockup { flex-wrap:wrap; }
.institutional-footer-brand span,.institutional-footer-brand h2 { color:var(--text); }
.institutional-footer-brand p,.institutional-footer-legal { color:var(--muted); }
.institutional-footer .institutional-footer-legal { color:var(--muted) !important; font-size:.8rem !important; line-height:1.65; }
.institutional-footer-lockup>div:last-child>span { color:var(--text); font-size:.75rem; letter-spacing:.04em; }
.institutional-footer-column h2 { color:var(--text); border-bottom:2px solid var(--data-accent-line); padding-bottom:10px; }
.institutional-footer-column ul { gap:0; }
.institutional-footer-column a { min-height:44px; display:flex; align-items:center; color:var(--muted); font-size:.8rem; font-weight:560; }
.institutional-footer-column a:hover { color:var(--text); }
.institutional-footer-column a i { color:var(--data-accent-line); }
.institutional-footer-bottom { color:var(--muted); border-color:var(--line); gap:12px; flex-wrap:wrap; font-size:.8rem; }
.admin-login-page { display:flex; flex-direction:column; min-height:100vh; background:var(--canvas); }
.admin-login-shell { width:100%; max-width:600px; display:block; min-height:0; flex:1; padding:48px 24px; margin:0 auto; }
.admin-login-card { width:100%; padding:32px; border-radius:20px; }
.admin-login-card h1 em { color:var(--ua-700); }
[data-theme="dark"] .admin-login-card h1 em { color:var(--ua-300); }
.admin-login-card>p { font-size:1rem; }
.admin-login-card> a { display:inline-flex; align-items:center; min-height:44px; }
.admin-login-error { background:var(--surface-2); border:1px solid var(--line); color:#b5294e; font-size:.9rem; border-radius:12px; }
[data-theme="dark"] .admin-login-error { color:#ff9db7; }
.primary-admin-action,.secondary-admin-action { min-height:44px; border-radius:12px; font-size:.8rem; font-weight:560; }
@media(min-width:1021px) {
    html[data-sidebar="collapsed"] .nav-branch { display:none; }
    html[data-sidebar="collapsed"] .nav-branch-items { display:block; }
    html[data-sidebar="collapsed"] .sidebar .shell-motion-toggle { padding:8px; }
    html[data-sidebar="collapsed"] .sidebar .shell-motion-toggle span { display:none; }
}
@media(max-width:1200px) {
    .othala-topbar { grid-template-columns:minmax(0,1fr) auto; gap:0 12px; padding:8px 18px; }
    .shell-identity { grid-column:1; grid-row:1; }
    .shell-utilities { grid-column:2; grid-row:1; }
    .shell-navigation { grid-column:1 / -1; grid-row:2; justify-content:center; }
}
@media(max-width:1020px) {
    .shell-menu-button { display:inline-flex; }
    .sidebar { width:min(320px,calc(100vw - 32px)); display:none; }
    .sidebar.is-open { display:flex; transform:translateX(0); }
    .sidebar .mobile-close { margin-left:auto; flex-shrink:0; }
    .sidebar .brand-lockup { gap:10px; }
    .sidebar .brand-copy small { white-space:normal; }
    .institutional-footer-inner { grid-template-columns:1fr; }
}
@media(max-width:760px) {
    .shell-has-session .shell-identity { grid-column:1 / -1; grid-row:1; }
    .shell-has-session .shell-utilities { grid-column:1 / -1; grid-row:2; margin:8px 0; align-self:center; }
    .shell-has-session .shell-navigation { grid-row:3; }
    .shell-has-session .shell-session { flex:1; max-width:none; }
}
@media(max-width:600px) {
    .othala-topbar { padding:8px 12px; gap:0 8px; }
    .shell-identity { gap:10px; }
    .shell-admin-topbar .shell-identity { flex-wrap:wrap; row-gap:0; }
    .shell-admin-topbar .shell-utilities { align-self:start; }
    .shell-signature { flex-basis:120px; }
    .shell-signature img { width:120px; }
    .shell-product { gap:5px; }
    .shell-product strong { font-size:.9rem; }
    .shell-product .rune-emblem { --rune-size:32px; }
    .shell-utilities { gap:4px; }
    .shell-navigation { gap:0; justify-content:space-between; }
    .shell-navigation>a { padding:8px 10px; }
    .report-catalog>.global-search kbd { display:none; }
    .admin-login-shell { padding:24px 16px; }
    .admin-login-card { padding:24px; }
    .institutional-footer-inner { padding-inline:20px; }
}
@media(max-width:380px) {
    .othala-topbar { padding-inline:8px; column-gap:4px; }
    .shell-identity { gap:4px; }
    .shell-product { gap:3px; }
}
@media(prefers-reduced-motion:reduce) {
    .nav-branch::after,.sidebar,.workspace,.shell-session-chevron { transition:none; }
}
@media print {
    .othala-topbar,.shell-report-actions,.shell-dialog,.shell-dialog-backdrop,.shell-nav-backdrop,.skip-link,.shell-motion-toggle { display:none !important; }
    .rune-emblem .orbit-rotor { animation:none !important; }
    .workspace,html[data-sidebar="collapsed"] .workspace { margin-left:0; }
    .institutional-footer { background:#fff; color:#111; margin-top:16px; }
    .institutional-footer-brand span,.institutional-footer-brand h2,.institutional-footer-brand p,.institutional-footer-legal,.institutional-footer-bottom { color:#333; }
    .institutional-footer .institutional-footer-legal { color:#333 !important; }
    .institutional-footer-inner { display:block; }
    .institutional-footer-column { display:none; }
}
