/* =============================================================================
   intranet.declar.ar — tema "Clásico" (Perfil → Apariencia)
   Es la hoja COMPLETA del diseño anterior (retículo navy, 2026-09-28): se carga
   EN LUGAR de style.css, no encima (ver includes/temas.php).

   Mismo lenguaje que la landing (declar.ar/site-theme.css) y el panel
   (panel.declar.ar, src/styles.css "plantillas de sección / retículo"):
   · Fondo #fafcff, cajas blancas, UNA línea #dadee6, tinta #12161f, navy #242c4f.
   · Retículo: las cajas van a sangre y comparten la línea de 1px (margin -1px);
     esquinas rectas, sin sombras. Los controles llevan 3px de radio.
   · Manrope en la interfaz; IBM Plex Mono en versalitas para micro-labels,
     cabeceras de tabla, estados e importes.
   · Títulos de sección grandes y livianos (300), como el panel.
   · Sin íconos (decisión del equipo): texto y glifos (› · ↑↓ ↗).
   Los nombres de tokens (--ink, --rule, --surface…) se conservan porque las
   páginas los usan inline. Referencia viva: DESIGN.md.
   ============================================================================= */

/* ── Fuentes (self-hosted) ─────────────────────────────────────────────── */
@font-face {
    font-family: 'Manrope';
    src: url('/fonts/manrope/manrope-latin.woff2') format('woff2');
    font-weight: 200 800; font-style: normal; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Manrope';
    src: url('/fonts/manrope/manrope-latin-ext.woff2') format('woff2');
    font-weight: 200 800; font-style: normal; font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/plex-mono/IBMPlexMono-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/plex-mono/IBMPlexMono-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/plex-mono/IBMPlexMono-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

/* =============================================================================
   Tokens
   ============================================================================= */
:root {
    color-scheme: light;

    /* Superficies */
    --canvas:        #fafcff;   /* fondo de la app (landing/panel --dc-bg) */
    --bg:            #fafcff;   /* fondo del área de contenido */
    --surface:       #ffffff;   /* tarjetas, tablas, controles */
    --surface-2:     #f3f6fc;   /* hover de fila, pie de caja (--dc-hover) */
    --bg-elev:       #eef2fa;   /* chips, código, activo (--dc-muted) */
    --hover:         #f3f6fc;
    --press:         #eef2fa;

    /* Tinta — grises fríos con tinte navy */
    --ink:           #12161f;   /* --dc-fg */
    --ink-2:         #3a404b;   /* --dc-body */
    --ink-3:         #555b66;   /* --dc-muted-fg */
    --ink-4:         #7a808c;   /* --dc-subtle */

    /* Líneas */
    --rule:          #dadee6;   /* --dc-border: la línea del retículo */
    --rule-soft:     #eef0f5;
    --rule-row:      #eef0f5;   /* entre filas de tabla, como el panel */
    --rule-strong:   #cdd2dc;   /* borde de controles */
    --rule-hover:    #a8b0cc;

    /* Marca */
    --marine:        #242c4f;
    --marine-2:      #1a2039;
    --marine-3:      #141a33;
    --marine-ink:    #b9c0d8;
    --marine-contrast: #ffffff;

    --accent:        #242c4f;
    --accent-hover:  #1a2039;
    --accent-soft:   #eef2fa;
    --accent-ring:   rgba(36, 44, 79, 0.18);
    --accent-100:    #eef2fa;
    --accent-200:    #dde2ef;
    --accent-300:    #b9c0d8;
    --accent-400:    #7d88ad;
    --accent-500:    #3d4874;
    --accent-600:    #1b2240;
    --accent-700:    #141a33;
    --accent-800:    #0f1428;
    --accent-900:    #0a0e1d;

    /* Estados — los mismos del panel (estado-abierto/respondido/cerrado, avisos) */
    --success:       #166534;
    --success-soft:  #f0fdf4;
    --success-line:  #bbf7d0;
    --warning:       #78350f;
    --warning-soft:  #fef9ee;
    --warning-line:  #f5d490;
    --danger:        #991b1b;
    --danger-soft:   #fef2f2;
    --danger-line:   #fecaca;
    --info:          #242c4f;
    --info-soft:     #eef0f6;
    --info-line:     #a8b0cc;

    /* Series de datos */
    --chart-1:       #242c4f;
    --chart-2:       #14704a;
    --chart-3:       #8a5a00;
    --chart-4:       #b42318;
    --chart-1-mid:   #3d4874;
    --chart-1-soft:  #7d88ad;
    --chart-track:   #e9ecf1;

    /* Tipografía */
    --font-display:  'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-sans:     'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono:     'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Geometría */
    --sidebar-w:     240px;
    --topbar-h-band: 63px;      /* franja de marca de la barra = alto de la cabecera de página */
    --topbar-h:      0px;       /* legado: lo usan algunos calc() */
    --gutter:        16px;      /* padding lateral dentro de las cajas (panel: 16px) */
    --control-h:     34px;
    --control-h-sm:  28px;
    --radius-xs:     0px;       /* badges y estados: rectos, como el panel */
    --radius-sm:     3px;       /* controles: botones, inputs */
    --radius:        3px;
    --radius-md:     3px;
    --radius-lg:     0px;       /* cajas del retículo */
    --radius-xl:     0px;
    --radius-pill:   999px;

    /* Sombras — teñidas de navy, muy bajas */
    --shadow-xs:     none;      /* el retículo no usa sombras: la línea hace el trabajo */
    --shadow-sm:     none;
    --shadow-md:     0 12px 32px -12px rgba(18, 22, 31, 0.18);
    --shadow-modal:  0 20px 48px -12px rgba(18, 22, 31, 0.24);
    --shadow-card:   var(--shadow-xs);
    --shadow-hover:  var(--shadow-sm);

    --transition:    150ms cubic-bezier(0.2, 0, 0, 1);

    /* Escala de z-index */
    --z-sticky:      20;
    --z-sidebar:     60;
    --z-overlay:     200;
    --z-toast:       400;

    /* Alias legados (estilos inline de las páginas) */
    --primary-color: var(--accent);
    --primary-dark:  var(--accent-hover);
    --secondary-color: var(--ink-2);
    --success-color: var(--success);
    --danger-color:  var(--danger);
    --warning-color: var(--warning);
    --info-color:    var(--info);
    --dark-bg:       var(--bg-elev);
    --light-bg:      var(--canvas);
    --border-color:  var(--rule);
    --text-primary:  var(--ink);
    --text-secondary: var(--ink-3);
    --text-muted:    var(--ink-4);
    --white:         var(--surface);
    --card-bg:       var(--surface);
    --card-border:   var(--rule);
    --card-border-hover: var(--rule-hover);
    --card-radius:   var(--radius-lg);
    --card-shadow:   var(--shadow-xs);
    --hover-bg:      var(--surface-2);
    --shadow:        var(--shadow-xs);
    --shadow-lg:     var(--shadow-modal);

    /* Tokens que llegaron con el estilo Apple y usan algunas páginas: acá se
       resuelven al equivalente del retículo para que nada quede sin valor. */
    --card-line:     var(--rule);
    --link:          var(--accent);
    --fill:          var(--bg-elev);
    --fill-2:        var(--surface-2);
    --row-hover:     var(--hover);
    --hover-fill:    var(--hover);
}
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }

/* =============================================================================
   Base
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; scroll-behavior: smooth; }
body {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 450;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

::selection { background: var(--accent-200); color: var(--ink); }
::placeholder { color: var(--ink-4); opacity: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(16, 24, 40, 0.16); border: 3px solid transparent; background-clip: content-box; border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(16, 24, 40, 0.30); background-clip: content-box; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 650;
    color: var(--ink);
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin: 0 0 0.5em;
    text-wrap: balance;
}
h1 { font-size: 1.5rem; letter-spacing: -0.022em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.9375rem; }
h5 { font-size: 0.875rem; }
h6 {
    font-size: 0.75rem; font-weight: 650; letter-spacing: 0.02em;
    color: var(--ink-3);
}
p { text-wrap: pretty; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.86em; }
code {
    background: var(--bg-elev); color: var(--ink-2);
    padding: 0.1em 0.38em; border-radius: var(--radius-xs);
}
pre {
    background: var(--surface-2); border: 1px solid var(--rule);
    border-radius: var(--radius-md); padding: 0.75rem 1rem; overflow-x: auto;
}
kbd {
    display: inline-flex; align-items: center;
    font-size: 0.68rem; font-weight: 500; color: var(--ink-3);
    background: var(--surface); border: 1px solid var(--rule); border-bottom-width: 2px;
    border-radius: var(--radius-xs); padding: 0 0.35rem; line-height: 1.45;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
small { font-size: 0.8125rem; }
strong, b { font-weight: 650; }

/* Sin íconos: Font Awesome no se carga; se ocultan los <i> residuales */
i[class^="fa"], i[class*=" fa-"] { display: none !important; }

/* Cifras de libro mayor en toda celda y valor */
td, th, .metric-value, .nav-badge, .kpi-value, .badge { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.text-danger    { color: var(--danger) !important; }
.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning) !important; }
.text-secondary { color: var(--ink-2) !important; }
.text-muted, .muted { color: var(--ink-3) !important; }
.mono { font-family: var(--font-mono); }
.num  { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.grayscale img { filter: grayscale(1); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

/* =============================================================================
   Shell — barra lateral del panel (franja navy + filas con línea) + retículo
   ============================================================================= */
#app-body { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--canvas);
    border-right: 1px solid var(--rule);
    z-index: var(--z-sidebar);
}
.sidebar-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* franja de marca: fondo navy y logo blanco, del mismo alto que la cabecera de página */
.sidebar-header {
    display: flex; align-items: center;
    height: var(--topbar-h-band); padding: 0 18px; flex-shrink: 0;
    background: var(--marine);
    border-bottom: 1px solid var(--marine);
}
.sidebar-brand-link { display: flex; align-items: center; height: 100%; }
.sidebar-logo-img { height: 38px; width: auto; max-width: 100%; object-fit: contain; }

/* buscador: una fila más del menú (bloque editable, no <input>: ver header.php) */
.sidebar-search {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 18px; flex-shrink: 0;
    border-bottom: 1px solid var(--rule);
    transition: background var(--transition);
}
.sidebar-search::before { content: '⌕'; color: var(--ink-4); font-size: 1rem; line-height: 1; }
.sidebar-search:focus-within { background: var(--hover); }
.sidebar-search:focus-within::before { color: var(--marine); }
.sidebar-search-input {
    flex: 1; min-width: 0; height: 100%;
    display: flex; align-items: center;
    font-size: 0.8125rem; font-weight: 500; line-height: 38px;
    color: var(--ink); outline: none; cursor: text;
    white-space: nowrap; overflow: hidden;
}
.sidebar-search-input:empty::before { content: attr(data-placeholder); color: var(--ink-4); pointer-events: none; }
.sidebar-search-input br { display: none; }
.sidebar-search-kbd { flex: none; border: 0; background: var(--hover); color: var(--ink-4); font-family: var(--font-sans); font-weight: 600; font-size: 0.625rem; border-radius: 5px; padding: 2px 6px; }
.sidebar-search:focus-within .sidebar-search-kbd { display: none; }

.sidebar-search-results { flex: 1; overflow-y: auto; }
.sidebar-nav[hidden], .sidebar-search-results[hidden] { display: none !important; }
.ssr-item {
    display: flex; flex-direction: column; gap: 1px;
    padding: 7px 18px; border-bottom: 1px solid var(--rule-soft);
    color: var(--ink); text-decoration: none;
}
.ssr-item:hover, .ssr-item.is-active { background: var(--bg-elev); box-shadow: inset 3px 0 0 var(--marine); color: var(--ink); }
.ssr-title { font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssr-sub { font-size: 0.625rem; font-weight: 500; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssr-deep .ssr-title { color: var(--marine); font-weight: 600; }
.ssr-empty { padding: 10px 18px; font-size: 0.75rem; color: var(--ink-4); }

/* navegación: como el menú del panel. Primer nivel en filas con línea; los grupos se
   pliegan (caret ›) y sus ítems van sangrados, sin líneas entre sí, colgando de una guía. */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0; scrollbar-width: none; overscroll-behavior: contain; }
.sidebar-nav::-webkit-scrollbar { width: 0; }
.sidebar-menu { list-style: none; margin: 0; padding: 0; }
.sidebar-menu li { margin: 0; }
.sidebar-menu--top > li { border-bottom: 1px solid var(--rule); }
.sidebar-menu a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    color: var(--ink-2);
    font-size: 0.8125rem; font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.sidebar-menu a:hover { background: var(--hover); color: var(--ink); }
/* dónde estás: fondo suave y barra navy a la izquierda */
.sidebar-menu a.active,
.sidebar-menu a.active:hover { background: var(--bg-elev); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--marine); }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu a[target="_blank"] .nav-label::after { content: ' ↗'; color: var(--ink-4); font-weight: 400; }

.nav-group { border-bottom: 1px solid var(--rule); }
.nav-group-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 9px 18px;
    color: var(--ink-2); text-align: left;
    font-size: 0.8125rem; font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-group-toggle:hover { background: var(--hover); color: var(--ink); }
.nav-group-toggle:focus-visible { outline: 2px solid var(--marine); outline-offset: -2px; }
.nav-group.has-active > .nav-group-toggle { color: var(--ink); font-weight: 600; }
.nav-caret {
    flex: none; width: 12px; text-align: center;
    color: var(--ink-4); font-size: 1rem; line-height: 1;
    transition: transform 180ms ease, color var(--transition);
}
.nav-group-toggle:hover .nav-caret { color: var(--ink-2); }
.nav-group.is-open > .nav-group-toggle .nav-caret { transform: rotate(90deg); }
/* abierto, el total del grupo sobra: cada ítem muestra el suyo */
.nav-group.is-open .nav-group-badge { display: none; }

.nav-sub { display: none; position: relative; padding: 0 0 8px; }
.nav-group.is-open > .nav-sub { display: block; animation: nav-sub-in 160ms ease-out; }
@keyframes nav-sub-in { from { opacity: 0; transform: translateY(-3px); } }
.nav-sub::before { content: ''; position: absolute; left: 24px; top: 0; bottom: 10px; width: 1px; background: var(--rule); }
.nav-sub a { padding: 6px 18px 6px 36px; font-size: 0.78125rem; color: var(--ink-3); }
.nav-sub a:hover { color: var(--ink); }
.nav-sub a.active, .nav-sub a.active:hover { color: var(--marine); background: var(--bg-elev); box-shadow: inset 3px 0 0 var(--marine); }

.nav-badge {
    margin-left: auto; flex: none;
    min-width: 20px; height: 18px; padding: 0 6px;
    display: inline-grid; place-items: center;
    background: var(--bg-elev); color: var(--ink-3);
    font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; line-height: 1;
}
.nav-badge--danger { background: var(--danger-soft); color: var(--danger); }

/* usuario */
.sidebar-user {
    flex-shrink: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px;
    border-top: 1px solid var(--rule);
    background: var(--surface);
}
.sidebar-avatar {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center; overflow: hidden;
    background: var(--marine); color: #fff;
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; color: var(--ink); }
.sidebar-user-meta:hover { color: var(--marine); }
.sidebar-user-name { font-size: 0.8125rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 0.6875rem; color: var(--ink-4); }
.sidebar-user-action {
    flex: none; height: 26px; padding: 0 8px;
    display: inline-grid; place-items: center;
    border-radius: var(--radius-sm);
    font-size: 0.75rem; font-weight: 600; color: var(--ink-3);
}
.sidebar-user-action:hover { background: var(--hover); color: var(--ink); }

.sidebar-scrim {
    position: fixed; inset: 0; display: none;
    background: rgba(18, 22, 31, 0.4);
    z-index: calc(var(--z-sidebar) - 1);
}
body.sidebar-open .sidebar-scrim { display: block; }

.mobile-menu-btn {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 50;
    width: 38px; height: 38px; place-items: center;
    border-radius: var(--radius-sm);
    background: var(--marine); color: #fff; border: 0;
    font-size: 1.2rem; line-height: 1;
}

/* área de contenido: arranca sobre la línea de la barra, así las cajas comparten ese borde */
.content-wrapper {
    margin-left: calc(var(--sidebar-w) - 1px);
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.main-content {
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0; min-height: 100vh;
    background: var(--bg);
}
body.is-guest .content-wrapper { margin-left: 0; }

/* ── Cabecera de página: caja blanca del alto de la franja de marca ── */
.page-top {
    position: sticky; top: 0; z-index: var(--z-sticky);
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
    min-height: var(--topbar-h-band);
    padding: 8px var(--gutter);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--rule); border-top: 0;
    margin-bottom: -1px;
}
.page-top-head { margin-right: auto; min-width: 0; }
.page-crumb {
    font-family: var(--font-mono);
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-4);
    margin-bottom: 1px;
}
.page-top-title {
    display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px;
    font-family: var(--font-display);
    font-size: 1.75rem; font-weight: 300; letter-spacing: -0.03em; line-height: 1.12;
    color: var(--ink);
}
.page-top-title small { font-size: 0.8125rem; font-weight: 400; letter-spacing: 0; color: #6b7280; }
.page-top > .btn, .page-top > a.btn, .page-top > form { flex: none; }
.page-top > form { margin: 0; }

/* =============================================================================
   Retículo — el contenido de cada sección se apila en cajas a sangre que
   comparten la línea de 1px (misma técnica que .dc-page del panel)
   ============================================================================= */
.page-container { flex: 1; display: flex; flex-direction: column; width: 100%; padding: 0; }
.main-content .page-container > * { margin: 0 0 -1px; min-width: 0; flex-shrink: 0; }

/* texto suelto entre cajas: con el mismo margen interno que las cajas */
.main-content .page-container > :is(p, h1, h2, h3, h4, h5, ul, ol, small, .muted, .text-sm, .text-xs, .form-hint, .filters-summary, .cluster) {
    margin: 0 0 -1px; padding: 10px var(--gutter);
}
.page-container > p, .page-container > small, .page-container > .muted { font-size: 0.8125rem; color: var(--ink-3); }
.page-container > :is(h2, h3) { padding-top: 16px; font-size: 0.9375rem; font-weight: 600; }

/* franjas (dc-strip): filtros, pestañas, encabezados de bloque, avisos */
.page-container > :is(.filters-bar, .filters-form, form[role="search"], .pr-filters, .clients-filters, .todo-toolbar, .section-head, .tabs, .tabs-container, .mail-tabs, .note, .info-note, .table-meta) {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 0;
    padding: 10px var(--gutter);
    margin: 0 0 -1px;
}
.page-container > :is(.tabs, .tabs-container, .mail-tabs) { padding-top: 0; padding-bottom: 0; }

/* grillas del retículo: celdas pegadas, cada caja con su borde, solapadas 1px */
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side, .dashboard-grid, .salesops-main-grid, .salesops-secondary-grid, .metrics-grid, .stats-grid, .salesops-kpis, .documents-grid, .acciones-rapidas, .pendientes-grid) {
    gap: 0; padding: 0 1px 1px 0; margin-bottom: -1px; align-items: stretch;
}
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side, .dashboard-grid, .salesops-main-grid, .salesops-secondary-grid, .metrics-grid, .stats-grid, .salesops-kpis, .documents-grid, .acciones-rapidas, .pendientes-grid) > * {
    margin: 0 -1px -1px 0 !important;
}
/* una columna del retículo que apila varias cajas */
/* una columna del retículo que apila varias cajas (o que no es caja: section/div/form sueltos) */
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side) > :is(.stack, .stack-lg, div:not([class]), section:not([class]), form:not([class])) { display: flex; flex-direction: column; gap: 0; }
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side) > :is(.stack, .stack-lg, div:not([class]), section:not([class]), form:not([class])) > * { margin: 0 0 -1px !important; }
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side) > :is(.stack, .stack-lg, div:not([class]), section:not([class]), form:not([class])) > :last-child { flex: 1; }
/* títulos sueltos dentro de esa columna: franja con línea, como .dc-strip */
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side) > :is(.stack, .stack-lg, div:not([class]), section:not([class]), form:not([class])) > .section-head,
.page-container > :is(.grid-2, .grid-3, .grid-auto, .grid-main-side) > :is(div:not([class]), section:not([class]), form:not([class])) > :is(h2, h3, h4) {
    padding: 10px var(--gutter); background: var(--surface); border: 1px solid var(--rule);
    font-size: 0.875rem; font-weight: 600; letter-spacing: 0;
}

.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-header h1, .page-header h2 { margin: 0; }

/* micro-label en versalitas mono (la voz de la landing: "HOMOLOGADO CON ARCA") */
.eyebrow, .kicker {
    font-family: var(--font-mono);
    font-size: 0.65625rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-4); margin: 0 0 6px;
}
.kicker-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; vertical-align: 1px; border-radius: 50%; background: #22c55e; }

/* versión desplegada: fija abajo, apenas visible (como el panel) */
.app-version {
    position: fixed; left: calc(var(--sidebar-w) + 10px); bottom: 4px; z-index: 1;
    font-family: var(--font-mono); font-size: 0.59375rem; letter-spacing: 0.04em;
    color: var(--ink-4); opacity: 0.5; pointer-events: none; white-space: nowrap;
}
.page-foot {
    margin-top: auto; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
    padding: 12px var(--gutter); font-size: 0.72rem; color: var(--ink-4); border-top: 1px solid var(--rule);
}
.page-foot-name { margin-right: auto; }
.page-foot a { color: var(--ink-3); }
.page-foot a:hover { color: var(--accent); }

.footer { border-top: 1px solid var(--rule); padding: 1rem var(--gutter); }
.footer-content p { margin: 0; font-size: 0.75rem; color: var(--ink-4); }

/* ── Utilidades de maquetación ── (dentro de una caja; a nivel página las toma el retículo) */
.stack   { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer  { margin-left: auto; }
.grid-2  { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3  { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.grid-2 > *, .grid-3 > *, .grid-auto > *, .grid-main-side > * { min-width: 0; margin-bottom: 0; }
@media (max-width: 1100px) { .grid-main-side { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* encabezado de bloque: título + nota + acciones, arriba de una tabla o caja */
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 20px 0 10px; }
.section-head:first-child { margin-top: 0; }
.section-head h2, .section-head h3 { margin: 0; font-size: 0.875rem; font-weight: 600; letter-spacing: 0; }
.section-head .note, .section-head small { font-size: 0.75rem; color: var(--ink-4); background: none; border: 0; padding: 0; }
.section-head > .cluster, .section-head > .btn, .section-head > form { margin-left: auto; }
.card-title { margin: 0 0 10px; font-size: 0.875rem; font-weight: 600; letter-spacing: 0; }
.card.card-flush, .card-flush { padding: 0; overflow: hidden; }
.card-flush > .table-container { border: 0; margin: 0; }
.card-foot { margin: 14px calc(-1 * var(--gutter)) -14px; padding: 10px var(--gutter); background: var(--bg); border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* cifra protagonista (saldos, totales): grande y liviana, como las cifras de la landing */
.big-number { font-size: clamp(1.9rem, 3.2vw, 2.6rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.big-number-sub { margin-top: 4px; font-size: 0.75rem; color: var(--ink-3); }

/* renglones de libro: concepto a la izquierda, importe (mono) a la derecha */
.ledger { display: flex; flex-direction: column; margin: 12px 0 0; }
.ledger-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--rule-row); font-size: 0.8125rem; color: var(--ink-2); }
.ledger-row > :last-child { font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; color: var(--ink); }
.ledger-row.total { border-bottom: 0; border-top: 1px solid var(--rule); margin-top: -1px; padding-top: 9px; font-weight: 600; color: var(--ink); }
.ledger-row.total > :last-child { font-weight: 600; }
.amount-pos { color: var(--success) !important; }
.amount-neg { color: var(--danger) !important; }

.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }

/* =============================================================================
   Botones
   ============================================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--control-h);
    padding: 0 14px;
    font-family: var(--font-sans);
    font-size: 0.8125rem; font-weight: 600; line-height: 1;
    color: var(--marine);
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    box-shadow: none;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform 80ms ease;
}
.btn:hover { background: var(--hover); border-color: var(--marine); color: var(--marine); }
.btn:active { transform: translateY(1px); background: var(--bg-elev); }
.btn:focus-visible { outline: 2px solid var(--marine); outline-offset: 2px; }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; box-shadow: none; }

.btn-primary, .btn-info {
    background: var(--marine); border-color: var(--marine); color: #fff;
}
.btn-primary:hover, .btn-info:hover { background: var(--marine-2); border-color: var(--marine-2); color: #fff; }
.btn-primary:active, .btn-info:active { background: var(--marine-3); }

.btn-secondary { background: var(--surface); color: var(--marine); }

.btn-success { background: var(--surface); border-color: var(--success); color: var(--success); }
.btn-success:hover { background: var(--success); border-color: var(--success); color: #fff; }
.btn-warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.btn-warning:hover { background: #fbecc4; border-color: #e6c77a; color: var(--warning); }

/* peligro: contenido, no un bloque rojo en cada fila */
.btn-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger.btn-solid,
.delete-guard-actions .btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.delete-guard-actions .btn-danger:hover { background: #7f1d1d; border-color: #7f1d1d; color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }

.btn-link {
    height: auto; padding: 0; border: 0; background: none; box-shadow: none;
    color: var(--accent); font-weight: 600;
}
.btn-link:hover { background: none; color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-lg { height: 40px; padding: 0 18px; font-size: 0.875rem; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-block { display: flex; width: 100%; }

/* grupo de acciones en una fila de tabla */
.action-buttons, .row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }

.btn-edit-small, .btn-remove-small, .btn-change-password {
    display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 10px;
    font-size: 0.75rem; font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
    box-shadow: var(--shadow-xs); cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.btn-edit-small:hover, .btn-change-password:hover { background: var(--hover); border-color: var(--marine); }
.btn-remove-small { color: var(--danger); border-color: var(--danger-line); }
.btn-remove-small:hover { background: var(--danger-soft); }

/* =============================================================================
   Formularios
   ============================================================================= */
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="tel"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="month"], input[type="url"],
select, textarea, .form-control, .input {
    width: 100%;
    height: var(--control-h);
    padding: 0 10px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    box-shadow: none;
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1.4;
    caret-color: var(--accent);
    transition: border-color var(--transition), box-shadow var(--transition);
}
textarea, textarea.form-control { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
select { padding-right: 6px; cursor: pointer; }
select[multiple] { height: auto; padding: 4px; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

input:hover, select:hover, textarea:hover, .form-control:hover { border-color: var(--rule-hover); }
input:focus, select:focus, textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--marine);
    box-shadow: 0 0 0 1px var(--marine);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }
input[readonly] { background: var(--surface-2); }

input[type="checkbox"], input[type="radio"] {
    width: 15px; height: 15px; margin: 0;
    accent-color: var(--marine);
    vertical-align: -2px; cursor: pointer;
}
input[type="file"] { font-size: 0.8125rem; }
input[type="color"] { height: var(--control-h); padding: 2px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--surface); }

label, .form-label {
    display: block;
    font-size: 0.75rem; font-weight: 600;
    color: var(--marine);
    margin-bottom: 4px;
}
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
    display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.form-hint, .help-text, .form-text { font-size: 0.75rem; color: var(--ink-3); margin-top: 6px; }

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.form-actions {
    display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
    padding-top: 12px; margin-top: 16px;
    border-top: 1px solid var(--rule);
}
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px 16px; }

/* grilla de formulario: campos del mismo alto, .span-2 para los anchos */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 16px; align-items: end; }
.form-grid > .form-group { margin: 0; min-width: 0; }
.form-grid > .span-2 { grid-column: span 2; }
.form-grid > .span-all { grid-column: 1 / -1; }
/* checkbox + etiqueta a la altura de un control, para alinear en una grilla */
.inline-check { display: inline-flex; align-items: center; gap: 8px; height: var(--control-h); margin: 0; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; cursor: pointer; }

/* formulario de alta en una fila: campos, checkbox y botón alineados abajo */
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-inline > .form-group { flex: 1 1 180px; min-width: 0; margin: 0; }
.form-inline > .btn, .form-inline > .inline-check { flex: none; }
@media (max-width: 640px) { .form-inline > * { flex: 1 1 100%; } }

/* ── Barras de filtros ── búsqueda que se estira + selects a su medida ───── */
/* :where() deja la especificidad en cero: una clase de página le gana sin pelear */
:where(.filters-bar, .filters-form, form[role="search"], .pr-filters, .clients-filters, .todo-toolbar) {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 0 0 12px;
}
.filters-bar select, .filters-form select, form[role="search"] select, .pr-filters select, .clients-filters select,
.filters-bar input[type="date"], .filters-form input[type="date"], form[role="search"] input[type="date"],
.filters-bar .btn, .filters-form .btn, form[role="search"] .btn { width: auto; flex: none; }
.filters-bar select, form[role="search"] select, .pr-filters select { max-width: 200px; }
.filters-bar input[type="date"], form[role="search"] input[type="date"] { width: 136px; padding-right: 4px; }
.filters-bar input[type="search"], .filters-bar input[type="text"],
.filters-form input[type="search"], .filters-form input[type="text"],
form[role="search"] input[type="search"], form[role="search"] input[type="text"] {
    flex: 1 1 220px; min-width: 200px; width: auto;
}
form[role="search"] .btn-sm, .filters-bar .btn-sm { height: var(--control-h); padding: 0 12px; font-size: 0.8125rem; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filters-summary { font-size: 0.78rem; color: var(--ink-3); }

.search-input, #clients-search-box {
    width: 100%; max-width: 480px;
    margin-bottom: 16px;
}

/* formulario de alta en una fila: etiqueta arriba, campos a la misma altura */
.form-stack { align-items: flex-end !important; gap: 12px !important; margin-bottom: 20px; }
.form-stack .fs-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-stack .fs-campo > label { margin: 0; white-space: nowrap; font-size: 0.75rem; }
.form-stack input:not([type=checkbox]):not([type=hidden]), .form-stack select { width: 100%; }
.form-stack .fs-check { display: flex; align-items: center; gap: 8px; height: var(--control-h); font-size: 0.8125rem; white-space: nowrap; }

/* =============================================================================
   Tablas
   ============================================================================= */
table { border-collapse: collapse; }
.table-container {
    background: var(--surface);
    border: 1px solid var(--rule);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}
.data-table, .table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    font-size: 0.78125rem;
}
.data-table thead th, .table thead th, .table > tr > th {
    position: relative;
    text-align: left;
    padding: 9px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.65625rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-4);
    white-space: nowrap;
}
.data-table thead th a, .table thead th a { color: inherit; white-space: nowrap; }
.data-table thead th a:hover, .table thead th a:hover { color: var(--ink); }
/* tablas ordenables (assets/js/table-sort.js): clic en el encabezado */
th.th-sortable { cursor: pointer; user-select: none; }
th.th-sortable:hover, th.th-sortable[aria-sort] { color: var(--ink); }
th.th-sortable:focus-visible { outline: 1px solid var(--ink-4); outline-offset: -1px; }
th.th-sortable::after { content: "↕"; margin-left: 5px; opacity: 0; font-family: var(--font-mono); }
th.th-sortable:hover::after { opacity: .45; }
th.th-sortable[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
th.th-sortable[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.data-table tbody td, .table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--rule-row);
    color: var(--ink-2);
    vertical-align: middle;
}
.data-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr, .table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover > td, .table tbody tr:hover > td { background: var(--hover); }
.data-table tbody td strong, .table tbody td strong { color: var(--ink); font-weight: 600; }
.data-table td .badge, .data-table td .btn { vertical-align: middle; }
.data-table .nowrap, .data-table td.nowrap { white-space: nowrap; }
/* columna de texto largo (asunto, descripción): corta en dos líneas como máximo */
.data-table td.clamp { max-width: 38ch; min-width: 22ch; }
.data-table tbody td small, .table tbody td small { color: var(--ink-4); font-size: 0.75rem; }
/* ids y códigos en tabla: mono sin chip, para no llenar la grilla de cajitas */
.data-table tbody td code, .table tbody td code {
    background: none; padding: 0; white-space: nowrap;
    font-size: 0.78rem; color: var(--ink-2);
}
.data-table tfoot td { padding: 8px 12px; border-top: 1px solid var(--rule); background: var(--bg); font-weight: 600; color: var(--ink); }
.data-table .text-right, .data-table td.num, .data-table th.num { text-align: right; }
/* importes y cantidades en mono, como .dc-table td.num del panel */
.data-table td.num { font-family: var(--font-mono); font-size: 0.75rem; white-space: nowrap; }
/* la última columna suele ser de acciones: a la derecha y sin cortar */
.data-table td:last-child .btn, .data-table td:last-child form { white-space: nowrap; }
.data-table td form { display: inline; margin: 0; }
.data-table td > .btn + .btn, .data-table td > .btn + form, .data-table td > form + .btn, .data-table td > form + form { margin-left: 6px; }
/* una tabla dentro de una tarjeta ya tiene marco */
.card .table-container, .dashboard-card .table-container, .detail-card .table-container { box-shadow: none; }

/* celda principal: nombre + renglón chico debajo (CUIT, email…) */
.cell-primary { display: flex; flex-direction: column; gap: 1px; min-width: 18ch; max-width: 40ch; }
.cell-primary > :first-child { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-primary > small, .cell-primary > .sub { color: var(--ink-4); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* columna de acciones fija a la derecha cuando la tabla scrollea */
.table-sticky-actions th:last-child, .table-sticky-actions td:last-child {
    position: sticky; right: 0; z-index: 1; width: 1%; text-align: right; white-space: nowrap;
    background: var(--surface); box-shadow: inset 1px 0 0 var(--rule-soft);
}
.table-sticky-actions thead th:last-child { background: var(--bg); }
.table-sticky-actions tbody tr:hover td:last-child { background: var(--hover); }

/* fila clickeable (navega con onclick) */
.data-table tbody tr.row-link { cursor: pointer; }
/* celda de texto largo en una línea con "…"; el texto completo va en title */
.cell-ellipsis { display: block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table td.minw { min-width: 20ch; }
/* "N resultados · Página X de Y" debajo de una tabla */
.table-meta { margin: 0; padding: 6px var(--gutter); font-size: 0.75rem; color: var(--ink-3); }

/* fila seleccionada / actual */
.data-table tbody tr.is-current > td { background: var(--accent-soft); }
/* barra de proporción dentro de una celda */
.bar-track { display: block; height: 6px; min-width: 60px; border-radius: var(--radius-pill); background: var(--chart-track); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--chart-1); }

.clients-table-col-email { font-size: 0.78rem; color: var(--ink-3); }
.clients-persona-link { color: var(--ink); }
.clients-persona-link:hover strong { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* nombre de empresa/persona: el nombre ES el link a la ficha */
a.ent-link { color: inherit; font-weight: inherit; text-decoration: none; }
a.ent-link:hover, a.ent-link:focus-visible {
    color: var(--accent);
    text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}

/* fecha relativa ("Hace 3 h") con la exacta como dato secundario */
.rel-date { white-space: nowrap; }
.rel-date small { display: block; color: var(--ink-4); font-size: 0.72rem; }

/* =============================================================================
   Tarjetas y paneles
   ============================================================================= */
.card, .panel, .box, .section-card,
.dashboard-card, .detail-card, .profile-info-card, .report-section,
.salesops-panel, .salesops-pipeline-panel, .salesops-revenue-panel,
.comentarios-widget, .email-detail-container, .plantillas-section, .plantillas-rapidas {
    background: var(--surface);
    border: 1px solid var(--rule);
    padding: 12px var(--gutter) 14px;
    margin-bottom: 16px;
}
.card-header, .salesops-inline-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: -12px calc(-1 * var(--gutter)) 12px; padding: 10px var(--gutter);
    border-bottom: 1px solid var(--rule);
}
.card-header h2, .card-header h3,
.salesops-inline-header h2, .salesops-inline-header h3 { margin: 0; font-size: 0.875rem; font-weight: 600; letter-spacing: 0; }
.salesops-inline-header p { margin: 2px 0 0; font-size: 0.78rem; color: var(--ink-3); }
.card-content { padding: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > :last-child:not(.card-foot) { margin-bottom: 0; }

.dashboard-grid, .salesops-main-grid, .salesops-secondary-grid { display: grid; gap: 16px; margin-bottom: 20px; }
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.salesops-main-grid { grid-template-columns: 2fr 1fr; }
.salesops-secondary-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dashboard-grid > *, .salesops-main-grid > *, .salesops-secondary-grid > * { margin-bottom: 0; min-width: 0; }

.salesops-panel > header { margin-bottom: 14px; }
.salesops-panel > header h2 { margin: 0; font-size: 0.875rem; font-weight: 600; }
.salesops-panel > header p { margin: 2px 0 0; font-size: 0.78rem; color: var(--ink-3); }
.salesops-panel > footer {
    margin-top: auto; padding-top: 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 0.78rem; color: var(--ink-3);
    border-top: 1px solid var(--rule-soft);
}

/* =============================================================================
   KPI — tira de métricas (pdb_kpi_card, stat-card, salesops-kpi-card)
   ============================================================================= */
.metrics-grid, .stats-grid, .salesops-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.metric-card, .stat-card, .salesops-kpi-card {
    container-type: inline-size;
    position: relative;
    min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px var(--gutter) 14px;
    background: var(--surface);
    border: 1px solid var(--rule);
}
.metric-card .metric-icon, .stat-card .stat-icon, .salesops-kpi-card > i { display: none; }
.metric-content, .stat-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

/* etiqueta arriba (en el markup viene después del valor) */
.metric-content > p, .stat-content > p, .salesops-kpi-card p {
    order: -1;
    margin: 0 0 2px;
    font-family: var(--font-mono);
    font-size: 0.65625rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-4);
    line-height: 1.4;
}
.metric-content > p small, .stat-content > p small, .metric-detail {
    display: block; margin-top: 2px;
    font-family: var(--font-sans); letter-spacing: 0; text-transform: none;
    font-size: 0.72rem; font-weight: 400; color: var(--ink-4); line-height: 1.45;
}
.metric-content h3, .stat-content h3, .salesops-kpi-card h3,
.salesops-kpi-value, .metric-value, .stat-value {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1rem, 10cqw, 1.75rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.salesops-kpi-sub { font-size: 0.72rem; color: var(--ink-4); }
/* el color va sólo donde avisa algo: un número en rojo es plata que sale */
.metric-card.danger h3 { color: var(--danger); }

/* ranking "Top N" (pdb_top_list): va a la derecha de la tira y ocupa dos filas,
   así los KPI quedan compactos a su lado en vez de estirarse a su altura */
/* fuera de la tira ancha, el ranking ocupa una fila entera */
.metrics-grid > .top-list { grid-column: 1 / -1; }
.top-list-title {
    font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4);
    margin-bottom: 6px;
}
.top-list-items { list-style: none; margin: 0; padding: 0; counter-reset: rank; font-size: 0.8125rem; }
.top-list-items li {
    counter-increment: rank;
    display: flex; align-items: baseline; gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid var(--rule-row);
}
.top-list-items li:last-child { border-bottom: 0; padding-bottom: 0; }
.top-list-items li::before {
    content: counter(rank);
    flex: none; width: 14px;
    font-family: var(--font-mono); font-size: 0.65625rem; color: var(--ink-4);
}
.top-list-items span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.top-list-items strong { flex: none; color: var(--ink); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; }
.top-list-empty { font-size: 0.8125rem; color: var(--ink-4); }

@media (min-width: 1100px) {
    /* KPI en dos columnas (2×2) y el ranking a la derecha con el alto de ambas filas */
    /* (sólo con UN ranking; con dos, cada uno ocupa su fila entera) */
    .metrics-grid:has(> .top-list):not(:has(> .top-list ~ .top-list)) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(320px, 1.1fr);
        grid-auto-flow: row dense;
    }
    .metrics-grid:not(:has(> .top-list ~ .top-list)) > .top-list { grid-column: 3; grid-row: 1 / span 2; }
    /* cantidad impar de KPI: el último ocupa las dos columnas, sin hueco */
    .metrics-grid:has(> .top-list:last-child):not(:has(> .top-list ~ .top-list)) > .metric-card:nth-last-child(2):nth-child(odd) { grid-column: 1 / span 2; }
    .metrics-grid:has(> .top-list ~ .top-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics-grid:has(> .top-list ~ .top-list) > .top-list { grid-column: auto; }
}

/* =============================================================================
   Badges, tags y chips
   ============================================================================= */
.badge, .pill, .chip {
    display: inline-flex; align-items: center; gap: 5px;
    height: 20px; padding: 0 7px;
    font-family: var(--font-mono);
    font-size: 0.625rem; font-weight: 500; line-height: 1;
    letter-spacing: 0.08em; text-transform: uppercase;
    white-space: nowrap;
    border-radius: 0;
    background: var(--bg-elev); color: var(--marine);
    border: 1px solid var(--rule);
    vertical-align: middle;
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-line); }
.badge-info, .badge-accent { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge-secondary, .badge-neutral { background: var(--bg-elev); color: var(--ink-3); border-color: var(--rule); }
/* punto de estado delante del texto */
.badge-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }

.tags-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
    font-size: 0.72rem; font-weight: 500;
    background: var(--surface); color: var(--ink-2);
    border: 1px solid var(--rule); border-radius: 0;
}

/* =============================================================================
   Alertas y avisos
   ============================================================================= */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px var(--gutter); margin-bottom: 12px;
    border: 1px solid var(--rule); border-radius: 0;
    background: var(--surface); color: var(--ink-2);
    font-size: 0.8125rem; font-weight: 500;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.alert-error, .alert-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }

.note, .info-note {
    padding: 10px var(--gutter);
    background: var(--surface); border: 1px solid var(--rule);
    font-size: 0.8125rem; color: var(--ink-3);
}

/* toasts (showErrorNotification / showSuccessNotification) */
.error-notification {
    position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast);
    width: min(380px, calc(100vw - 48px));
    padding: 12px;
    background: #fef2f2; color: #7a271a;
    border: 1px solid #f5a3a3;
    border-radius: 6px;
    box-shadow: 0 16px 36px -16px rgba(18, 22, 31, 0.3);
    transform: translateX(calc(100% + 32px)); opacity: 0;
    transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 300ms;
}
.error-notification { top: 24px; right: 24px; bottom: auto; }
.error-notification.show { transform: none; opacity: 1; }
#success-notification { background: #f0fdf4; color: #14532d; border-color: #86d9a4; }
.error-notification-content { display: flex; align-items: flex-start; gap: 8px; }
.error-notification-message { font-size: 0.8125rem; line-height: 1.45; color: inherit; }

/* =============================================================================
   Pestañas
   ============================================================================= */
.tabs, .tabs-container, .tab-list, .mail-tabs {
    display: flex; gap: 20px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab, .tab-link, .mail-tab {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    height: 38px; padding: 0 2px;
    margin-bottom: -1px;
    background: none; border: 0; border-bottom: 2px solid transparent;
    color: var(--ink-3);
    font-size: 0.8125rem; font-weight: 500;
    white-space: nowrap; cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}
.tab:hover, .tab-link:hover, .mail-tab:hover { color: var(--ink); }
.tab.active, .tab-link.active, .mail-tab.is-active { color: var(--marine); font-weight: 600; border-bottom-color: var(--marine); }
.tab-content { padding-top: 4px; }
.tab-count { font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; color: var(--ink-4); }
.tab.active .tab-count { color: var(--ink-3); }
/* lista de links a sangre dentro de una tarjeta */
.list-flush { list-style: none; margin: 0 calc(-1 * var(--gutter)); padding: 0; }
.list-flush > li > a, .list-flush > a { display: block; padding: 9px var(--gutter); border-top: 1px solid var(--rule-row); color: var(--ink); }
.list-flush > li > a:hover, .list-flush > a:hover { background: var(--hover); }

/* segmentado (vistas, rangos) */
.segmented { display: inline-flex; align-items: stretch; background: var(--surface); border: 1px solid var(--rule); }
.segmented > * {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 0;
    font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); background: var(--surface);
    transition: background var(--transition), color var(--transition);
}
.segmented > * + * { border-left: 1px solid var(--rule); }
.segmented > :hover, .segmented > .active, .segmented > [aria-pressed="true"] { background: var(--marine); color: #fff; }
.segmented > .active .tab-count, .segmented > :hover .tab-count { color: var(--marine-ink); }

/* =============================================================================
   Paginación
   ============================================================================= */
.forum-pagination, .table-pagination { margin: 0 0 -1px; padding: 8px var(--gutter); background: var(--surface); border: 1px solid var(--rule); }
.forum-pagination-nav, .forum-pagination-row { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.forum-pagination-pages { display: flex; gap: 4px; }
.pagination-btn, .pagination-num, .page-link, .pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 10px;
    font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--ink-2); background: var(--surface);
    border: 1px solid var(--rule); border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-weight: 500;
    transition: background var(--transition), border-color var(--transition);
}
.pagination-btn:hover, .pagination-num:hover, .page-link:hover, .pagination a:hover { background: var(--hover); border-color: var(--marine); color: var(--marine); }
.pagination-num--current, .pagination .active, .page-link.active { background: var(--marine); border-color: var(--marine); color: #fff; }
.pagination-btn--disabled { opacity: 0.4; pointer-events: none; }
.pagination-ellipsis { color: var(--ink-4); padding: 0 4px; }

/* =============================================================================
   Modales
   ============================================================================= */
/* Oculto por defecto: las páginas lo abren con style.display = 'block'. El
   centrado lo hace el margin:auto de .modal-content. */
.modal {
    position: fixed; inset: 0; z-index: var(--z-overlay);
    display: none;
    padding: 6vh 20px 20px;
    overflow: auto;
    background: rgba(18, 22, 31, 0.45);
}
.modal-content {
    margin: 0 auto;
    width: 100%; max-width: 540px; max-height: 88vh; overflow: auto;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 6px;
    box-shadow: var(--shadow-modal);
    animation: modal-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rule);
}
.modal-header h2, .modal-header h3 { margin: 0; font-size: 1.25rem; font-weight: 300; letter-spacing: -0.02em; }
.modal-body { padding: 16px; }
.modal-form { padding: 0 16px 16px; }
.modal-footer, .modal-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 10px 16px;
    background: var(--bg);
    border-top: 1px solid var(--rule);
}
.modal-form .modal-actions, .modal-body .modal-actions { margin: 16px -16px -16px; }
.close {
    width: 30px; height: 30px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ink-3); font-size: 1.25rem; line-height: 1;
    background: none; border: 0; cursor: pointer;
}
.close:hover { background: var(--hover); color: var(--ink); }

/* confirmación con contraseña de eliminación (footer.php) */
.delete-guard-overlay {
    position: fixed; inset: 0; z-index: calc(var(--z-overlay) + 50);
    display: none; align-items: flex-start; justify-content: center;
    padding: 14vh 20px 20px;
    background: rgba(18, 22, 31, 0.45);
}
.delete-guard-overlay.open { display: flex; }
.delete-guard-modal {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 6px;
    box-shadow: var(--shadow-modal);
    padding: 16px 16px 0;
    overflow: hidden;
    animation: modal-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.delete-guard-title { font-size: 1.25rem; font-weight: 300; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 6px; }
.delete-guard-msg { font-size: 0.8125rem; color: var(--ink-3); margin-bottom: 16px; white-space: pre-line; }
.delete-guard-field-form { margin: 0; }
.delete-guard-field { display: block; margin: 0 0 18px; font-weight: 600; }
.delete-guard-prefix { display: block; margin-bottom: 4px; font-size: 0.75rem; color: var(--marine); }
.delete-guard-field input { letter-spacing: 0.2em; }
.delete-guard-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    margin: 0 -16px; padding: 10px 16px;
    background: var(--bg); border-top: 1px solid var(--rule);
}
.delete-guard-err { margin-right: auto; font-size: 0.75rem; font-weight: 550; color: var(--danger); }

/* =============================================================================
   Estados vacíos
   ============================================================================= */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    padding: 48px 24px;
    text-align: center;
    color: var(--ink-3); font-size: 0.875rem;
    background: var(--surface);
    border: 1px solid var(--rule);
}
.empty-state i { display: none; }
.empty-state h3 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 300; letter-spacing: -0.02em; color: var(--ink); }
.empty-state p { margin: 0; max-width: 54ch; line-height: 1.5; }
.empty-state .btn { margin-top: 12px; }
td.empty, .data-table td[colspan] { color: var(--ink-4); text-align: center; padding: 28px 16px; font-size: 0.8125rem; }

/* =============================================================================
   Listas, línea de tiempo, comentarios
   ============================================================================= */
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.recent-list-item { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 3px; }
.recent-list-item:last-child { border-bottom: 0; }
.recent-list-head, .recent-list-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.recent-list-title { flex: 1; min-width: 0; font-size: 0.8125rem; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list-time, .recent-list-doc { font-size: 0.72rem; color: var(--ink-4); white-space: nowrap; }
.recent-list-email { font-size: 0.78rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.75rem; color: var(--ink-3); }
.recent-list-meta-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.recent-list-cbte { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.recent-list-amount { font-size: 0.875rem; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.recent-list-receptor { font-size: 0.8125rem; font-weight: 550; color: var(--ink); }

.detail-list { display: grid; gap: 8px; padding: 4px 0; }
.mini-list-item { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.8125rem; }
.mini-list-item:last-child { border-bottom: 0; }
.mini-list-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* listas de definición "etiqueta — valor" en fichas */
dl.kv, .kv-list { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 20px; margin: 0; font-size: 0.8125rem; }
dl.kv dt, .kv-list dt { color: var(--ink-3); }
dl.kv dd, .kv-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.timeline, .timeline-container, .activity-list { display: flex; flex-direction: column; gap: 12px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 1px; background: var(--rule); }
.timeline-item, .activity-item { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; }
.timeline-marker { width: 10px; height: 10px; margin: 6px 0 0 6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--marine); }
.timeline-content { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 10px 14px; }
.timeline-header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; font-size: 0.78rem; }
.timeline-meta { font-size: 0.72rem; color: var(--ink-4); }

.comentarios-header { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--rule-soft); }
.comentarios-count { font-size: 0.75rem; color: var(--ink-4); }
.comentario-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.comentario-item:last-child { border-bottom: 0; }
.comentario-avatar, .responsable-avatar {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: var(--radius-md); background: var(--marine); color: #fff;
    font-size: 0.72rem; font-weight: 700;
}
.comentario-header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.comentario-usuario { font-weight: 650; color: var(--ink); font-size: 0.8125rem; }
.comentario-info, .comentario-body { font-size: 0.8125rem; color: var(--ink-2); }
.comentario-respuestas { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--rule); }
.comentario-form, .comentario-form-nuevo, .comentario-form-respuesta { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 12px; margin-top: 8px; }

/* =============================================================================
   Login y cambio de contraseña — la misma composición que el login del panel:
   formulario a la izquierda sobre blanco, columna clara a la derecha con
   micro-label mono, título grande y liviano y una franja de datos en retículo.
   ============================================================================= */
.login-container, .password-change-container {
    min-height: 100vh; width: 100%;
    display: grid; grid-template-columns: minmax(380px, 46%) 1fr;
    background: var(--surface);
}
.login-main { order: 1; display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); }
.login-aside {
    order: 2; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 72px 0 0;
    background: var(--canvas);
    border-left: 1px solid var(--rule);
}
.login-aside::before {
    /* trama de puntos de la landing, apagada hacia el texto */
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(circle, rgba(18, 22, 31, 0.12) 1.1px, transparent 1.3px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(200deg, #000 0%, transparent 55%);
    mask-image: linear-gradient(200deg, #000 0%, transparent 55%);
}
.login-aside > * { position: relative; }
.login-aside-copy { padding: 0 clamp(24px, 5vw, 64px); }
.login-aside-copy h2 {
    margin: 14px 0 14px; color: var(--ink);
    font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.05;
    max-width: 15ch;
}
.login-aside-copy p { margin: 0; color: var(--ink-3); font-size: 0.9375rem; max-width: 42ch; }
.login-aside-facts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); background: var(--surface); }
.login-aside-facts > div { display: flex; flex-direction: column; gap: 4px; padding: 20px clamp(16px, 2vw, 28px) 24px; }
.login-aside-facts > div + div { border-left: 1px solid var(--rule); }
.login-aside-facts strong { font-size: 1.5rem; font-weight: 300; letter-spacing: -0.02em; color: var(--ink); }
.login-aside-facts span { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }

.login-box, .password-change-box { width: 100%; max-width: 360px; }
.login-brand { display: flex; margin-bottom: 44px; }
.login-brand img { height: 26px; width: auto; }
.login-head { margin-bottom: 22px; }
.login-head h1 { margin: 0; font-size: 2.25rem; font-weight: 300; letter-spacing: -0.035em; line-height: 1.1; }
.login-head p { margin: 8px 0 0; font-size: 0.8125rem; color: var(--ink-3); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field label { margin: 0; font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--marine); }
.login-field input { height: 38px; font-size: 0.875rem; padding: 0 12px; }
.login-field input#codigo_mfa { font-family: var(--font-mono); font-size: 1.2rem; letter-spacing: 0.4em; text-align: center; padding-left: 0.4em; }
.login-field input:-webkit-autofill, .login-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    transition: background-color 9999s ease-out;
}
.login-msg { display: none; font-size: 0.8125rem; line-height: 1.45; color: var(--ink-2); }
.login-msg.is-visible { display: block; }
.login-msg.is-error { color: var(--danger); }
.login-submit {
    height: 40px; width: 100%; margin-top: 4px;
    border-radius: var(--radius-sm);
    background: var(--marine); color: #fff; border: 1px solid var(--marine);
    font-size: 0.8125rem; font-weight: 600;
    transition: background var(--transition);
}
.login-submit:hover { background: var(--marine-2); }
.login-submit:active { transform: translateY(1px); }
.login-foot { margin-top: 28px; font-size: 0.75rem; color: var(--ink-4); }

.password-change-header { margin-bottom: 24px; }
.password-change-header h1 { margin: 0; font-size: 1.75rem; font-weight: 300; letter-spacing: -0.03em; }
.password-change-form { display: flex; flex-direction: column; gap: 14px; }
.password-requirements, .requirements-list {
    background: var(--bg); border: 1px solid var(--rule);
    padding: 10px 14px; margin: 4px 0;
    font-size: 0.78rem;
}
.requirement { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--ink-3); }
.requirement.valid { color: var(--success); }
.requirement-icon { width: 14px; text-align: center; }

.mfa-status, .raw-user-box { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-2); text-align: center; padding: 8px; background: var(--bg); border: 1px solid var(--rule); margin-bottom: 16px; }

@media (max-width: 900px) {
    .login-container, .password-change-container { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}

/* =============================================================================
   Perfil
   ============================================================================= */
.profile-main-section { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.profile-info-card { padding: 0; overflow: hidden; }
.profile-info-header { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--rule-soft); }
.profile-avatar-container { display: flex; align-items: center; gap: 16px; }
.profile-avatar-large {
    width: 64px; height: 64px; flex: none;
    display: inline-grid; place-items: center; overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--marine); color: #fff;
    font-size: 1.5rem; font-weight: 650;
}
.profile-avatar-form { display: inline-block; margin: 0; }
.profile-avatar-btn { position: relative; overflow: hidden; padding: 0; border: 0; cursor: pointer; }
.profile-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-overlay {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(16, 24, 40, 0.55); color: #fff;
    font-size: 0.68rem; font-weight: 650;
    opacity: 0; transition: opacity var(--transition);
}
.profile-avatar-btn:hover .profile-avatar-overlay, .profile-avatar-btn:focus-visible .profile-avatar-overlay { opacity: 1; }
.profile-name-section { display: flex; flex-direction: column; gap: 2px; }
.profile-display-name { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-avatar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-avatar-actions .inline-form { display: inline; margin: 0; }
.profile-avatar-hint { font-size: 0.75rem; color: var(--ink-4); }

.account-details { display: flex; flex-direction: column; padding: 4px 20px; }
.account-detail-row {
    display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 16px;
    min-height: 52px; padding: 8px 0;
    border-bottom: 1px solid var(--rule-soft);
}
.account-detail-row:last-child { border-bottom: 0; }
.account-detail-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); }
.account-detail-value { font-size: 0.8125rem; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.account-detail-value.is-empty { color: var(--ink-4); }

.reveal-link {
    display: inline; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
    font-size: 0.78rem; font-weight: 600; color: var(--accent);
}
.reveal-link:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--accent-hover); }
.reveal-link-danger { color: var(--danger); }

.password-section { padding: 20px; }
.password-section-title { margin: 0 0 4px; font-size: 0.9375rem; font-weight: 650; }
.password-section-desc { margin: 0 0 14px; font-size: 0.8125rem; color: var(--ink-3); }
.password-section-actions { display: flex; gap: 8px; }

.nombre-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.nombre-form[hidden] { display: none; }
.nombre-form input[type="text"] { flex: 1 1 160px; width: auto; }

@media (max-width: 640px) {
    .account-detail-row { grid-template-columns: 1fr auto; }
    .account-detail-label { grid-column: 1 / -1; }
}

/* =============================================================================
   Documentos, mails, plantillas y otros componentes compartidos
   ============================================================================= */
.documents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.document-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 14px 16px; transition: border-color var(--transition), box-shadow var(--transition); }
.document-card:hover { border-color: var(--rule-hover); box-shadow: var(--shadow-sm); }
.document-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.document-title { margin: 0; font-size: 0.875rem; font-weight: 650; color: var(--ink); }
.document-code, .document-meta { font-size: 0.75rem; color: var(--ink-4); }
.document-actions { display: flex; gap: 6px; margin-top: 12px; }

.emails-list { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.email-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--rule-soft); cursor: pointer; transition: background var(--transition); }
.email-item:hover { background: var(--surface-2); }
.email-item:last-child { border-bottom: 0; }
.email-item.no-leido { background: var(--accent-soft); }
.email-item.no-leido .email-item-from, .email-item.no-leido .email-item-subject { color: var(--ink); font-weight: 650; }
.email-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--marine); }
.email-item-content { min-width: 0; }
.email-item-from { font-weight: 550; color: var(--ink); font-size: 0.8125rem; }
.email-item-subject { color: var(--ink-2); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item-preview { color: var(--ink-4); font-size: 0.75rem; }
.email-item-date, .email-date, .email-meta { font-size: 0.72rem; color: var(--ink-4); white-space: nowrap; }
.email-header { padding-bottom: 14px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 14px; }
.email-from { font-weight: 650; color: var(--ink); }
.email-address { font-size: 0.78rem; color: var(--ink-3); }
.email-body { line-height: 1.7; color: var(--ink); }
.email-attachments { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.attachment-item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; margin: 4px 6px 0 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); font-size: 0.78rem; color: var(--ink); }
.attachment-item:hover { background: var(--surface-2); }
.email-html { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 16px; min-height: 200px; }

.acciones-rapidas, .acciones-rapidas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 16px; }
.acciones-rapidas-header { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.accion-rapida { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); color: var(--ink); font-size: 0.8125rem; font-weight: 550; }
.accion-rapida:hover { border-color: var(--rule-hover); background: var(--surface-2); color: var(--ink); }

.plantillas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.plantilla-item { padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-md); font-size: 0.8125rem; color: var(--ink); cursor: pointer; }
.plantilla-item:hover { background: var(--surface); border-color: var(--rule-hover); }

.pendientes-grid, .pendientes-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pendiente-card, .pendiente-item { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--marine); border-radius: var(--radius-md); padding: 12px 14px; box-shadow: var(--shadow-xs); }
.pendiente-card[class*="priority-alta"]  { border-left-color: var(--danger); }
.pendiente-card[class*="priority-media"] { border-left-color: var(--warning); }
.pendiente-card[class*="priority-baja"]  { border-left-color: var(--success); }
.pendiente-header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.pendiente-footer { font-size: 0.75rem; color: var(--ink-4); margin-top: 8px; }

.responsables-list, .versions-list { display: grid; gap: 8px; }
.responsable-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); background: var(--surface-2); }
.responsable-info { font-size: 0.8125rem; }
.version-item { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 10px 14px; }
.version-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.version-info { font-weight: 600; color: var(--ink); font-size: 0.8125rem; }
.version-date { font-size: 0.75rem; color: var(--ink-4); }
.version-comment { font-size: 0.8125rem; color: var(--ink-2); margin-top: 4px; }
.version-actions { display: flex; gap: 6px; margin-top: 8px; }

.report-content { display: grid; gap: 20px; }

.pipeline-stage { display: grid; grid-template-columns: 110px 1fr 60px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.pipeline-stage:last-child { border-bottom: 0; }
.stage-label { font-size: 0.78rem; font-weight: 550; color: var(--ink-2); }
.stage-bar { height: 8px; border-radius: var(--radius-pill); background: var(--chart-track); overflow: hidden; }
.stage-bar > * { display: block; height: 100%; min-width: 2px; border-radius: var(--radius-pill); background: var(--chart-1); }

.roundcube-container, .roundcube-wrapper { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; min-height: calc(100vh - 8rem); }

/* =============================================================================
   Gráficos (SVG server-side)
   ============================================================================= */
.salesops-chart-wrap { position: relative; padding-top: 8px; }
.chart-scroll { position: relative; overflow-x: auto; overflow-y: hidden; }
.chart-svg { display: block; width: 100%; min-width: 620px; height: auto; overflow: visible; }
.chart-grid { stroke: var(--rule-row); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--ink-4); font-family: var(--font-sans); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-tick-y { text-anchor: end; }
.chart-area  { fill: var(--chart-1); fill-opacity: 0.08; }
.chart-line  { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-target { fill: none; stroke: var(--chart-1-soft); stroke-width: 2; stroke-dasharray: 4 3; }
.chart-dot   { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart-bar   { fill: var(--chart-1-mid); }
.chart-endlabel { fill: var(--ink); font-family: var(--font-sans); font-size: 11px; font-weight: 650; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:hover { fill: var(--ink); fill-opacity: 0.03; }
.chart-crosshair { stroke: var(--rule-strong); stroke-width: 1; pointer-events: none; }
.chart-wrap { position: relative; }
.chart-tip {
    position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
    padding: 8px 10px; background: var(--surface); border: 1px solid var(--rule);
    border-radius: var(--radius-md); box-shadow: var(--shadow-md);
    font-size: 0.72rem; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.chart-tip b { display: block; color: var(--ink); font-weight: 650; margin-bottom: 4px; }
.chart-tip dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; }
.chart-tip dt { color: var(--ink-3); }
.chart-tip dd { margin: 0; color: var(--ink); font-weight: 650; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 10px; font-size: 0.72rem; color: var(--ink-3); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key i { display: block; flex: none; border-radius: 2px; }
.chart-key-area   { width: 10px; height: 10px; background: var(--chart-1); }
.chart-key-target { width: 12px; height: 2px; background: var(--chart-1-soft); }
.chart-key-bar    { width: 10px; height: 10px; background: var(--chart-1-mid); }
.chart-stats { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-table { margin-top: 12px; }
.chart-table > summary { cursor: pointer; font-size: 0.75rem; color: var(--ink-3); }
.chart-table > summary:hover { color: var(--ink); }
.chart-table .data-table { margin-top: 8px; font-size: 0.78rem; }
.chart-table .data-table td:not(:first-child), .chart-table .data-table th:not(:first-child) { text-align: right; }

.hbar-chart { display: flex; flex-direction: column; }
.hbar-row { display: flex; align-items: center; gap: 14px; padding: 7px 0; }
.hbar-row + .hbar-row { border-top: 1px solid var(--rule-row); }
.hbar-label { flex: 0 0 74px; font-size: 0.78rem; color: var(--ink-3); white-space: nowrap; }
.hbar-track { flex: 1 1 auto; min-width: 60px; height: 8px; border-radius: var(--radius-pill); background: var(--chart-track); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--chart-1-mid); }
.hbar-fill.is-max { background: var(--chart-1); }
.hbar-value { flex: 0 0 auto; min-width: 10.5rem; text-align: right; font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value strong { color: var(--ink); }
.hbar-value span { color: var(--ink-4); margin-left: 6px; }

/* =============================================================================
   Búsqueda global (overlay de busqueda_global.php)
   ============================================================================= */
.busqueda-global-overlay { position: fixed; inset: 0; z-index: calc(var(--z-overlay) + 20); display: none; background: rgba(16, 24, 40, 0.42); backdrop-filter: blur(2px); }
.busqueda-global-overlay.open { display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; }
.busqueda-global-modal { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow-modal); overflow: hidden; animation: modal-in 160ms ease-out; }
.busqueda-global-header { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--rule-soft); }
.busqueda-global-icon, .busqueda-global-lupa { color: var(--ink-4); flex: none; }
.busqueda-global-header input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; height: 100%; font-size: 0.9375rem; }
.busqueda-global-header input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.busqueda-global-results, .busqueda-global-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.busqueda-global-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-md); cursor: pointer; }
.busqueda-global-item:hover, .busqueda-global-item.active { background: var(--surface-2); }
.busqueda-global-content { flex: 1; min-width: 0; }
.busqueda-global-titulo { font-weight: 650; color: var(--ink); font-size: 0.8125rem; }
.busqueda-global-subtitulo { font-size: 0.75rem; color: var(--ink-3); }
.busqueda-global-tipo { flex: none; font-size: 0.68rem; font-weight: 650; color: var(--ink-3); background: var(--bg-elev); padding: 2px 7px; border-radius: var(--radius-xs); }
.busqueda-global-empty, .busqueda-global-loading { padding: 24px; text-align: center; color: var(--ink-3); font-size: 0.8125rem; }

/* =============================================================================
   Panel de hoy (/dashboard/) — retículo: KPI, novedad destacada, actividad y riel
   ============================================================================= */
.dash { display: flex; flex-direction: column; flex: 1; }
.dash > * { margin-bottom: -1px; }
.dash-bell { gap: 6px; }

/* tira de KPI: celdas pegadas con la línea compartida */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 0 1px 1px 0; }
.dash-kpi {
    display: flex; flex-direction: column; gap: 2px;
    margin: 0 -1px -1px 0; padding: 14px var(--gutter) 16px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--rule);
    transition: background var(--transition);
}
.dash-kpi:hover { background: var(--hover); color: var(--ink); }
.dash-kpi-label { font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.dash-kpi-value { font-size: 2rem; font-weight: 300; letter-spacing: -0.035em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dash-kpi-sub { font-size: 0.75rem; color: var(--ink-3); }
.dash-delta-up   { color: var(--success); font-weight: 500; }
.dash-delta-down { color: var(--danger);  font-weight: 500; }
.dash-delta-flat { color: var(--ink-3); }

/* última novedad: hero claro como la landing (micro-label mono + título liviano) */
.dash-poster {
    position: relative; overflow: hidden;
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px;
    padding: 22px var(--gutter) 22px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--rule);
}
.dash-poster::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 42%; pointer-events: none;
    background-image: radial-gradient(circle, rgba(18, 22, 31, 0.12) 1.1px, transparent 1.3px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(to left, #000 0%, transparent 100%);
    mask-image: linear-gradient(to left, #000 0%, transparent 100%);
}
.dash-poster > * { position: relative; z-index: 1; }
.dash-poster-body { flex: 1 1 420px; min-width: 0; }
.dash-poster-kicker { font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.dash-poster-kicker::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; vertical-align: 1px; border-radius: 50%; background: #22c55e; }
.dash-poster h2 { margin: 8px 0 8px; color: var(--ink); font-size: clamp(1.6rem, 2.8vw, 2.25rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.08; max-width: 30ch; }
.dash-poster p { margin: 0; font-size: 0.8125rem; color: var(--ink-3); max-width: 80ch; line-height: 1.55; }
.dash-poster-cta {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    height: var(--control-h); padding: 0 14px;
    background: var(--marine); color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem; font-weight: 600;
}
.dash-poster-cta:hover { background: var(--marine-2); color: #fff; }

/* cuerpo: actividad + riel, compartiendo la línea vertical */
.dash-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: stretch; padding: 0 1px 1px 0; }
.dash-main, .dash-rail { min-width: 0; margin: 0 -1px -1px 0; }
.dash-main, .dash-panel { background: var(--surface); border: 1px solid var(--rule); padding: 12px var(--gutter) 16px; }
.dash-rail { display: flex; flex-direction: column; }
.dash-rail > * { margin-bottom: -1px; }
.dash-rail > :last-child { flex: 1; }

.dash-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dash-sec-head h3 { margin: 0; font-size: 0.875rem; font-weight: 600; letter-spacing: 0; }
.dash-sec-note { font-size: 0.75rem; color: var(--ink-4); margin-right: auto; }
.dash-link { margin-left: auto; font-size: 0.75rem; font-weight: 600; color: var(--marine); }
.dash-link::after { content: ' ›'; }
.dash-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.dash-hr { margin: 18px calc(-1 * var(--gutter)) 14px; border-top-color: var(--rule); }
.dash-empty { font-size: 0.8125rem; color: var(--ink-4); margin: 0; }

.dash-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); border-top: 1px solid var(--rule); }
.dash-table { width: 100%; }
.dash-table td { white-space: nowrap; }
.dash-table th:first-child, .dash-table td:first-child { padding-left: var(--gutter); }
.dash-table th:last-child, .dash-table td:last-child { padding-right: var(--gutter); }
.dash-td-strong { font-weight: 600; color: var(--ink) !important; }
.dash-td-dim { color: var(--ink-3); white-space: nowrap; font-family: var(--font-mono); font-size: 0.75rem; }
.dash-td-day { color: var(--ink-4); font-size: 0.6875rem; margin-left: 6px; }
.dash-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; font-family: var(--font-mono); font-size: 0.625rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.dash-tag-neutral { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.dash-tag-danger  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.dash-tag-outline { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }

.dash-feature { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: -1px; border: 1px solid var(--rule); background: var(--bg); }
.dash-feature-img { flex: 1 1 220px; min-width: 0; max-height: 170px; overflow: hidden; }
.dash-feature-img img { width: 100%; height: 100%; object-fit: cover; }
.dash-feature-body { flex: 2 1 300px; min-width: 0; padding: 14px 16px 14px 0; }
.dash-feature--noimg .dash-feature-body { padding: 14px 16px; }
.dash-feature h4 { margin: 6px 0 6px; font-size: 1.375rem; font-weight: 300; letter-spacing: -0.025em; line-height: 1.15; }
.dash-feature p { margin: 0 0 10px; font-size: 0.8125rem; color: var(--ink-2); max-width: 70ch; }
.dash-kicker { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.dash-byline { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--ink-3); }
.dash-ini { width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: var(--marine); color: #fff; font-size: 0.6rem; font-weight: 700; }

/* fichas de novedades: celdas pegadas */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 0 1px 1px 0; }
.dash-card { display: flex; flex-direction: column; gap: 4px; margin: 0 -1px -1px 0; padding: 12px 14px; border: 1px solid var(--rule); background: var(--surface); }
.dash-card-title { font-size: 0.9375rem; font-weight: 500; line-height: 1.3; color: var(--ink); letter-spacing: -0.01em; }
.dash-card-body { margin: 0; font-size: 0.75rem; color: var(--ink-3); }

/* riel: cajas apiladas */
.dash-rail-block { background: var(--surface); border: 1px solid var(--rule); padding: 12px var(--gutter) 14px; }
.dash-rail-block h6 { margin: 0 0 8px; font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.dash-qa-box { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--gutter)) -14px; }
.dash-qa {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px var(--gutter); border-top: 1px solid var(--rule-row);
    font-size: 0.8125rem; font-weight: 500; color: var(--ink-2);
}
.dash-qa::after { content: '›'; color: var(--ink-4); font-size: 1rem; }
.dash-qa:hover { background: var(--hover); color: var(--ink); box-shadow: inset 3px 0 0 var(--marine); }

.dash-svc { display: flex; flex-direction: column; }
.dash-svc-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 0.8125rem; border-bottom: 1px solid var(--rule-row); }
.dash-svc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-svc-name { margin-right: auto; color: var(--ink-2); }
.dash-svc-state { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-3); }
.dash-svc-state--alert { color: var(--warning); }
.dash-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #22c55e; }
.dash-dot-warn { background: #d99a06; }
.dash-dot-down { background: #dc2626; }

.dash-week { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--gutter)) -14px; }
.dash-week-item { display: block; padding: 9px var(--gutter); border-top: 1px solid var(--rule-row); color: var(--ink); }
.dash-week-item:hover { background: var(--hover); color: var(--ink); }
.dash-week-when { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); }
.dash-week-when--urge { color: var(--danger); }
.dash-week-what { font-size: 0.8125rem; font-weight: 600; margin-top: 1px; }
.dash-week-meta { font-size: 0.72rem; color: var(--ink-3); }

.dash-people { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-person {
    display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 8px 0 3px;
    border: 1px solid var(--rule);
    background: var(--surface); font-size: 0.75rem; color: var(--ink-2);
}
.dash-person:hover { border-color: var(--marine); color: var(--marine); }
.dash-person-name { min-width: 0; max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1180px) {
    .dash-body { grid-template-columns: 1fr; }
}

/* =============================================================================
   Suscripciones · calendario de liquidaciones de Mercado Pago
   ============================================================================= */
.liq-cal { margin: 0 0 -1px; display: flex; flex-direction: column; }
.liq-cal > * { margin-bottom: -1px !important; }
.liq-cal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px var(--gutter); background: var(--surface); border: 1px solid var(--rule); }
.liq-cal-head h2 { margin: 0; font-size: 1rem; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.liq-cal-head h2 small { color: var(--ink-3); font-weight: 450; font-size: 0.78rem; }
.liq-cal-note { margin: 6px 0 0; font-size: 0.75rem; color: var(--ink-3); line-height: 1.6; max-width: 110ch; }
.liq-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; vertical-align: 0; margin-right: 3px; }
.liq-dot-cobro { background: var(--info); }
.liq-dot-liq   { background: var(--success); }
.liq-dot-ret   { background: #d99a06; }
.liq-cal-nav { display: flex; align-items: center; gap: 6px; }
.liq-cal-nav strong { min-width: 12ch; text-align: center; color: var(--ink); font-size: 0.9375rem; font-weight: 650; }
.liq-cal-nav a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2);
    box-shadow: var(--shadow-xs);
}
.liq-cal-nav a:hover { background: var(--surface-2); color: var(--ink); }
.liq-cal-nav a.liq-cal-hoy { width: auto; padding: 0 10px; font-size: 0.75rem; font-weight: 600; }

.liq-cal-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); padding: 0 1px 1px 0; }
.liq-kpi { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin: 0 -1px -1px 0; padding: 12px var(--gutter) 14px; background: var(--surface); border: 1px solid var(--rule); }
.liq-kpi-label { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.liq-kpi strong { font-size: 1.3rem; font-weight: 700; color: var(--ink); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.liq-kpi small { font-size: 0.72rem; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liq-kpi-ret  { box-shadow: inset 3px 0 0 #d99a06; }
.liq-kpi-ret strong { color: var(--warning); }
.liq-kpi-disp { box-shadow: inset 3px 0 0 var(--success); }
.liq-kpi-disp strong { color: var(--success); }
.liq-kpi-prox { box-shadow: inset 3px 0 0 var(--info); }

.liq-cal-grid-wrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--surface); }
.liq-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(118px, 1fr)); min-width: 826px; }
.liq-cal-dow {
    padding: 8px 10px; background: var(--surface-2);
    font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
    border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule-soft);
}
.liq-cal-dow:nth-child(7n) { border-right: 0; }
.liq-cal-day { position: relative; min-width: 0; min-height: 96px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
.liq-cal-day:nth-child(7n) { border-right: 0; }
.liq-cal-day.liq-cal-wknd { background: #fbfbfc; }
.liq-cal-day.liq-cal-out { opacity: 0.4; }
.liq-cal-num { font-size: 0.72rem; font-weight: 600; color: var(--ink-3); line-height: 1; margin: 2px 2px 3px; }
.liq-cal-today { background: var(--accent-soft) !important; box-shadow: inset 0 0 0 1px var(--accent-300); }
.liq-cal-today .liq-cal-num { color: var(--marine); font-weight: 750; }
.liq-cal-today .liq-cal-num::after { content: ' · hoy'; font-weight: 600; }

.liq-ev {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 6px; border-radius: var(--radius-xs);
    font-size: 0.7rem; line-height: 1.25; min-width: 0;
    border-left: 2px solid transparent; cursor: default; font-variant-numeric: tabular-nums;
}
.liq-ev i { font-size: 0.58rem; flex: none; font-style: normal; }
.liq-ev b { font-weight: 700; flex: none; }
.liq-ev span { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.liq-ev-cobro { background: var(--info-soft); border-left-color: var(--info); color: var(--info); }
.liq-ev-liq   { background: var(--success-soft); border-left-color: var(--success); color: var(--success); }
.liq-ev-proximo, .liq-ev-proyectado { opacity: 0.65; border-left-style: dashed; }
.liq-ev-retenido { background: var(--warning-soft); border-left-color: #d99a06; color: var(--warning); }
.liq-ev-liquidado { opacity: 0.75; }
.liq-ev-liquidado b { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 2px; }
.liq-ev-impago { opacity: 0.6; text-decoration: line-through; background: var(--danger-soft); border-left-color: var(--danger); color: var(--danger); }
.liq-ev-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--radius-xs); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.liq-cal-table { margin-top: 14px; }
.liq-row-today td { background: var(--accent-soft); }
.liq-cal-empty { margin: 12px 0 0; font-size: 0.8125rem; color: var(--ink-3); }

/* =============================================================================
   Drive / CDN
   ============================================================================= */
.drive-page [hidden], .drive-menu[hidden], .drive-uploads[hidden], .drive-toast[hidden], .drive-modal[hidden] { display: none !important; }
.drive-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; align-items: stretch; }
.drive-side { position: sticky; top: var(--topbar-h-band); align-self: start; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - var(--topbar-h-band)); padding: 12px; background: var(--surface); border: 1px solid var(--rule); margin-right: -1px; }
.drive-upload-group { display: flex; flex-direction: column; gap: 6px; }
.drive-upload-btn { width: 100%; height: 38px; }
#btnUploadFolder { height: var(--control-h); }
.drive-tree { overflow: auto; flex: 1; min-height: 0; font-size: 0.8125rem; padding: 4px 0; margin: 0 -12px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.drive-tree ul { list-style: none; margin: 0; padding: 0; }
.drive-tree li > ul { display: none; }
.drive-tree li.open > ul { display: block; }
.drive-tree-node {
    display: flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 8px 0 calc(6px + var(--d, 0) * 14px);
    border-radius: var(--radius-sm);
    color: var(--ink-2); cursor: pointer; user-select: none;
    white-space: nowrap; overflow: hidden;
}
.drive-tree-node > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.drive-tree-node:hover { background: var(--surface-2); color: var(--ink); }
.drive-tree-node.active { background: var(--accent-soft); color: var(--marine); font-weight: 650; }
.drive-tree-node.dropping { outline: 1px dashed var(--accent); background: var(--accent-soft); }
.drive-tree-node.disabled { opacity: 0.35; cursor: not-allowed; }
.drive-tree-tg { width: 14px; height: 14px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; color: var(--ink-4); font-size: 0.55rem; cursor: pointer; transition: transform var(--transition); }
li.open > .drive-tree-node > .drive-tree-tg { transform: rotate(90deg); }
.drive-tree-picker { max-height: 50vh; }
.drive-storage { font-size: 0.72rem; color: var(--ink-3); line-height: 1.5; padding: 0 4px; }
.drive-storage-bar { height: 4px; border-radius: var(--radius-pill); background: var(--chart-track); margin-bottom: 6px; overflow: hidden; }
.drive-storage-bar span { display: block; height: 100%; background: var(--marine); border-radius: inherit; transition: width 0.4s; }

.drive-main { position: relative; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h-band)); background: var(--surface); border: 1px solid var(--rule); overflow: hidden; }
.drive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); }
.drive-crumbs { display: flex; align-items: center; gap: 2px; font-size: 0.875rem; min-width: 0; flex-wrap: wrap; }
.drive-crumb { color: var(--ink-3); padding: 4px 6px; border-radius: var(--radius-xs); white-space: nowrap; }
.drive-crumb:hover { color: var(--ink); background: var(--surface-2); }
.drive-crumb.current { color: var(--ink); font-weight: 650; }
.drive-crumb.dropping { outline: 1px dashed var(--accent); }
.drive-crumb-sep { color: var(--ink-4); }
.drive-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.drive-search input { width: 220px; }
.drive-select, .drive-input { width: auto; }
.drive-input { width: 100%; }
.drive-view { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-elev); border-radius: var(--radius-md); }
.drive-view button { height: 28px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.drive-view button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.drive-selbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--accent-200); font-size: 0.8125rem; color: var(--ink); }
.drive-selbar span { font-weight: 650; margin-right: 8px; }
.drive-btn-danger { color: var(--danger) !important; border-color: var(--danger-line) !important; }
.drive-btn-danger:hover { background: var(--danger-soft) !important; }

.drive-content { flex: 1; padding: 14px; }
.drive-content.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; align-content: start; }
.drive-empty { grid-column: 1 / -1; padding: 64px 16px; text-align: center; color: var(--ink-3); font-size: 0.875rem; }

.drive-item { position: relative; outline: none; user-select: none; cursor: default; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; transition: border-color var(--transition), box-shadow var(--transition); }
.drive-item:hover { border-color: var(--rule-hover); box-shadow: var(--shadow-sm); }
.drive-item.selected { border-color: var(--marine); box-shadow: 0 0 0 1px var(--marine); }
.drive-item:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.drive-item.dragging { opacity: 0.45; }
.drive-item.folder.dropping { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.view-grid .drive-item { display: flex; flex-direction: column; }
.view-grid .drive-thumb { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--rule-soft); }
.drive-thumb-img img { width: 100%; height: 100%; object-fit: contain; background-image: linear-gradient(45deg, #f0f2f5 25%, transparent 25%), linear-gradient(-45deg, #f0f2f5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f2f5 75%), linear-gradient(-45deg, transparent 75%, #f0f2f5 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.drive-thumb-video video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.drive-thumb-video > .drive-play, .drive-mosaic-tile > .drive-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; padding-left: 2px; border-radius: 50%; color: #fff; background: rgba(16, 24, 40, 0.6); font-size: 0.7rem; }
.drive-thumb-glyph { font-family: var(--font-mono); font-size: 2.2rem; color: var(--ink-4); line-height: 1; }
.drive-thumb-folder.has-preview { padding: 0; }
.drive-mosaic { position: absolute; inset: 0; display: grid; gap: 2px; background: var(--rule-soft); }
.drive-mosaic.n1 { grid-template-columns: 1fr; }
.drive-mosaic.n2 { grid-template-columns: 1fr 1fr; }
.drive-mosaic.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.drive-mosaic.n3 .drive-mosaic-tile:first-child { grid-row: 1 / 3; }
.drive-mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.drive-mosaic-tile { position: relative; overflow: hidden; background: var(--surface-2); min-width: 0; min-height: 0; }
.drive-mosaic-tile img, .drive-mosaic-tile video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.drive-folder-badge { position: absolute; left: 8px; bottom: 8px; padding: 3px 7px; border-radius: var(--radius-xs); background: rgba(255, 255, 255, 0.92); color: var(--ink-2); font-size: 0.68rem; font-weight: 650; line-height: 1; box-shadow: var(--shadow-xs); }
.drive-td-thumb .drive-thumb-folder.has-preview { position: relative; }
.drive-td-thumb .drive-mosaic { gap: 1px; }
.drive-td-thumb .drive-folder-badge, .drive-td-thumb .drive-play { display: none; }
.drive-thumb-icon { flex-direction: column; gap: 4px; }
.drive-thumb-icon span { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.1em; color: var(--ink-3); }
.drive-thumb-icon.kind-pdf span { color: var(--danger); }
.drive-thumb-icon.kind-sheet span { color: var(--success); }
.drive-thumb-icon.kind-video span { color: var(--info); }
.drive-thumb-icon.kind-audio span { color: var(--warning); }
.drive-thumb-icon.kind-design span { color: var(--marine); }
.drive-item-meta { display: flex; align-items: center; gap: 6px; padding: 8px 6px 0 10px; min-width: 0; }
.drive-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.drive-item-more { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); color: var(--ink-4); font-size: 1rem; line-height: 1; opacity: 0; transition: opacity var(--transition); }
.drive-item:hover .drive-item-more, .drive-item.selected .drive-item-more { opacity: 1; }
.drive-item-more:hover { color: var(--ink); background: var(--bg-elev); }
.drive-item-sub { padding: 0 10px 9px; font-size: 0.72rem; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-item-sub em { font-style: normal; }

.drive-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.drive-table th { text-align: left; height: 34px; padding: 0 10px; font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.drive-table td { padding: 6px 10px; border-bottom: 1px solid var(--rule-soft); color: var(--ink-2); vertical-align: middle; }
.drive-table .r { text-align: right; white-space: nowrap; }
.drive-table tr.drive-item { border: 0; background: transparent; box-shadow: none; }
.drive-table tr.drive-item:hover td { background: var(--surface-2); }
.drive-table tr.drive-item.selected td { background: var(--accent-soft); }
.drive-td-thumb { width: 48px; }
.drive-td-thumb .drive-thumb { width: 36px; height: 28px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-xs); }
.drive-td-thumb .drive-thumb-icon span { font-size: 0.5rem; }
.drive-td-thumb .drive-thumb-glyph { font-size: 1.1rem; }
.drive-table small { color: var(--ink-4); }

.drive-dropveil { position: absolute; inset: 8px; display: none; align-items: center; justify-content: center; text-align: center; z-index: 5; pointer-events: none; line-height: 1.6; border: 2px dashed var(--accent-400); border-radius: var(--radius-lg); background: rgba(238, 241, 248, 0.9); color: var(--marine); font-size: 0.9375rem; font-weight: 600; }
.drive-dropveil.on { display: flex; }
.drive-dropveil small { display: block; color: var(--ink-3); font-size: 0.78rem; font-weight: 450; }

.drive-menu { position: fixed; z-index: var(--z-toast); min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); box-shadow: var(--shadow-modal); }
.drive-menu button { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 0.8125rem; text-align: left; }
.drive-menu button:hover { background: var(--surface-2); color: var(--ink); }
.drive-menu button.danger { color: var(--danger); }
.drive-menu button.danger:hover { background: var(--danger-soft); }
.drive-menu hr { margin: 4px 0; border-top-color: var(--rule-soft); }

.drive-preview { max-width: min(1100px, 94vw); }
.drive-preview .modal-header { padding: 12px 16px; }
.drive-preview .modal-header h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 0.9375rem; }
.drive-preview-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.drive-preview-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.drive-preview-media { display: flex; align-items: center; justify-content: center; min-height: 380px; max-height: 72vh; overflow: hidden; background: var(--surface-2); }
.drive-preview-media img, .drive-preview-media video { max-width: 100%; max-height: 72vh; object-fit: contain; }
.drive-preview-media iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.drive-preview-big { display: flex; align-items: center; justify-content: center; }
.drive-preview-big span { font-family: var(--font-mono); font-size: 2rem; font-weight: 600; letter-spacing: 0.2em; color: var(--ink-4); }
.drive-preview-meta { padding: 16px; border-left: 1px solid var(--rule-soft); font-size: 0.8125rem; overflow: auto; }
.drive-preview-meta label { margin: 12px 0 6px; font-size: 0.75rem; color: var(--ink-3); }
.drive-preview-meta label:first-child { margin-top: 0; }
.drive-copy { display: flex; }
.drive-copy input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; font-family: var(--font-mono); font-size: 0.72rem; }
.drive-copy .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.drive-preview-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 16px 0 0; }
.drive-preview-meta dt { color: var(--ink-4); }
.drive-preview-meta dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.drive-confirm-list { margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--ink-2); }
.drive-confirm-list li { padding: 3px 0; }

.drive-uploads { position: fixed; right: 20px; bottom: 20px; z-index: 150; width: 360px; max-width: calc(100vw - 2rem); overflow: hidden; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); font-size: 0.78rem; }
.drive-uploads header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); font-weight: 650; color: var(--ink); }
.drive-uploads header button { color: var(--ink-3); font-size: 1.1rem; }
.drive-uploads ul { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; }
.drive-uploads li { display: grid; grid-template-columns: 1fr auto 70px 56px; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--rule-soft); color: var(--ink-2); }
.drive-uploads li .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-uploads li .n small { color: var(--ink-4); }
.drive-uploads li .s { color: var(--ink-4); font-size: 0.7rem; }
.drive-uploads li .p { height: 4px; border-radius: var(--radius-pill); background: var(--chart-track); overflow: hidden; }
.drive-uploads li .p b { display: block; height: 100%; background: var(--marine); transition: width 0.25s; }
.drive-uploads li .st { text-align: right; color: var(--ink-3); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-uploads li.done { cursor: pointer; }
.drive-uploads li.done .st { color: var(--success); }
.drive-uploads li.done .p b { background: var(--success); }
.drive-uploads li.error .st { color: var(--danger); }
.drive-uploads li.error .p b { background: var(--danger); }

.drive-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast); padding: 10px 16px; border-radius: var(--radius-md); background: var(--ink); color: #fff; font-size: 0.8125rem; font-weight: 550; box-shadow: var(--shadow-modal); }
.drive-toast.error { background: var(--danger); }
.drive-toast.warn { background: var(--warning); }

/* =============================================================================
   Ticket (/tickets/ver.php) — mismo componente que el panel, acotado a .tk-panel
   ============================================================================= */
.tk-panel {
    --dc-bg: var(--surface-2); --dc-card: #ffffff; --dc-fg: var(--ink); --dc-body: var(--ink-2);
    --dc-muted-fg: var(--ink-3); --dc-subtle: var(--ink-4); --dc-muted: var(--accent-soft); --dc-hover: var(--surface-2);
    --dc-border: var(--rule); --dc-primary: var(--marine); --dc-primary-dark: var(--marine-2);
    --dc-sans: var(--font-sans); --dc-mono: var(--font-mono);
    font-family: var(--dc-sans); color: var(--dc-fg);
}
.page-container > .tk-panel.dc-page { padding: 0; }
.tk-panel.dc-page { display: flex; flex-direction: column; gap: 0; width: 100%; padding: 0; }
.tk-panel.dc-page > * { margin-bottom: -1px; }
.tk-panel .dc-box, .tk-panel .dc-header, .tk-panel .dc-section, .tk-panel .dc-actions {
    background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); flex-shrink: 0;
}
.tk-panel .dc-box { padding: 14px 18px; }
.tk-panel .dc-box--flush { padding: 0; overflow: hidden; }
.tk-panel .dc-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; }
.tk-panel .dc-header h2 { margin: 0; font-size: 1.625rem; font-weight: 300; letter-spacing: -0.03em; line-height: 1.15; }
.tk-panel .dc-header-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tk-panel .dc-header-title .dc-sub { margin: 0; font-size: 0.8125rem; color: var(--ink-3); }
.tk-panel .dc-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.tk-panel .dc-header-actions form { margin: 0; }
.tk-panel .dc-fact-label, .tk-panel .dc-box-title, .tk-panel .dc-section-title { display: block; margin: 0 0 4px; font-size: 0.75rem; font-weight: 600; color: var(--marine); }
.tk-panel .dc-box-title, .tk-panel .dc-section-title { margin-bottom: 10px; font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.tk-panel .dc-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; }
.tk-panel .dc-grid { display: grid; gap: 0; }
.tk-panel .dc-grid--4 { grid-template-columns: repeat(4, 1fr); }
.tk-panel .dc-grid.dc-grid > * { min-width: 0; padding: 14px 18px; border-right: 1px solid var(--rule-soft); }
.tk-panel .dc-grid.dc-grid > *:last-child { border-right: 0; }
.tk-panel .dc-section { padding: 16px 18px; }
.tk-panel .dc-fact-value { font-size: 0.875rem; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.tk-panel .dc-fact-value.mono { font-family: var(--font-mono); font-weight: 500; }
.tk-panel .dc-segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-elev); border-radius: var(--radius-md); }
.tk-panel .dc-segmented > button { height: 28px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 600; color: var(--ink-3); }
.tk-panel .dc-segmented > button:hover { color: var(--ink); }
.tk-panel .dc-segmented > button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.tk-panel .dc-segmented--sm > button { height: 24px; padding: 0 8px; font-size: 0.72rem; }

.tk-panel .btn-outline, .tk-panel .btn-resolver, .tk-panel .btn-primary {
    display: inline-flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 14px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow-xs);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tk-panel .btn-outline { background: #fff; border-color: var(--rule-strong); color: var(--ink); }
.tk-panel .btn-outline:hover { background: var(--surface-2); border-color: var(--rule-hover); }
.tk-panel .btn-resolver { background: #fff; border-color: var(--success-line); color: var(--success); }
.tk-panel .btn-resolver:hover:not(:disabled) { background: var(--success); border-color: var(--success); color: #fff; }
.tk-panel .btn-primary { background: var(--marine); border-color: var(--marine); color: #fff; }
.tk-panel .btn-primary:hover:not(:disabled) { background: var(--marine-2); border-color: var(--marine-2); }
.tk-panel .btn-resolver:disabled, .tk-panel .btn-primary:disabled { opacity: 0.55; cursor: default; }

.tk-panel .estado-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid transparent; }
.tk-panel .estado-abierto { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.tk-panel .estado-respondido { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.tk-panel .estado-cerrado { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.tk-panel .datos > div { display: flex; flex-direction: column; gap: 4px; }
.tk-panel .datos .dc-fact-value { font-size: 0.9375rem; }

.tk-panel .hilo-titulo { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--rule-soft); }
.tk-panel .mensaje { display: grid; grid-template-columns: 260px minmax(0, 1fr); border-bottom: 1px solid var(--rule-soft); }
.tk-panel .mensaje:last-child { border-bottom: 0; }
.tk-panel .mensaje.soporte { background: var(--surface-2); }
.tk-panel .mensaje-meta { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; border-right: 1px solid var(--rule-soft); }
.tk-panel .mensaje-quien { font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); }
.tk-panel .mensaje.soporte .mensaje-quien { color: var(--marine); }
.tk-panel .mensaje-autor { font-size: 0.8125rem; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.tk-panel .mensaje-email { font-size: 0.78rem; color: var(--ink-3); overflow-wrap: anywhere; }
.tk-panel .mensaje-fecha { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); margin-top: 2px; }
.tk-panel .mensaje-cuerpo { padding: 16px 18px; }
.tk-panel .mensaje-texto { font-size: 0.875rem; line-height: 1.65; color: var(--ink-2); word-break: break-word; }
.tk-panel .mensaje-adjuntos { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tk-panel .adjunto-thumb { width: 92px; height: 92px; object-fit: cover; border: 1px solid var(--rule); border-radius: var(--radius-md); cursor: zoom-in; }
.tk-panel .adjunto-pdf { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 92px; height: 92px; padding: 6px; border: 1px solid var(--rule); border-radius: var(--radius-md); text-decoration: none; color: inherit; vertical-align: top; }
.tk-panel .adjunto-pdf:hover { border-color: #b91c1c; }
.tk-panel .adjunto-pdf-tag { font-weight: 700; font-size: 13px; color: #b91c1c; }
.tk-panel .adjunto-pdf-nombre { max-width: 100%; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-panel .preview-pdf { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-weight: 700; font-size: 13px; color: #b91c1c; }

.tk-panel .respuesta-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.tk-panel .respuesta-head .dc-section-title { margin: 0; }
.tk-panel .respuesta textarea, .tk-panel .tkf-preview { display: block; width: 100%; min-height: 118px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); font-size: 0.875rem; line-height: 1.6; resize: vertical; }
.tk-panel .respuesta textarea[hidden], .tk-panel .tkf-preview[hidden] { display: none; }
.tk-panel .respuesta-acciones { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
.tk-panel .tkf-ayuda { margin-right: auto; font-size: 0.72rem; color: var(--ink-4); }
.tk-panel .previews { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tk-panel .previews:empty { display: none; }
.tk-panel .preview { position: relative; width: 76px; height: 76px; border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.tk-panel .preview img { width: 100%; height: 100%; object-fit: cover; }
.tk-panel .preview-quitar { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(16, 24, 40, 0.75); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.tk-panel .cerrado, .tk-panel .tkp-nota { justify-content: flex-start; }
.tk-panel .tkp-nota { font-size: 0.78rem; color: var(--ink-3); }
.tk-panel .tkp-alert { padding: 10px 12px; font-size: 0.8125rem; border: 1px solid; border-radius: var(--radius-md); }
.tk-panel .tkp-alert-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.tk-panel .tkp-alert-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }

.tk-panel .tkf-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; width: max-content; max-width: 100%; margin: 0 0 6px; padding: 3px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.tk-panel .tkf-toolbar.apagada { opacity: 0.4; pointer-events: none; }
.tk-panel .tkf-toolbar button { min-width: 30px; height: 28px; padding: 0 8px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 0.8125rem; }
.tk-panel .tkf-toolbar button.mono { font-family: var(--font-mono); font-size: 0.75rem; }
.tk-panel .tkf-toolbar button:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.tk-panel .tkf-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--rule); }
.tk-panel .tkf-live {
    display: block; width: 100%; min-height: 118px; max-height: 420px; overflow-y: auto;
    padding: 10px 12px; background: #fff; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
    font-size: 0.875rem; line-height: 1.6; color: var(--ink);
    white-space: pre-wrap; word-break: break-word; outline: none; cursor: text; caret-color: var(--marine);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.tk-panel .tkf-live:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tk-panel .tkf-live.error { border-color: var(--danger); }
.tk-panel .tkf-live.vacio::before { content: attr(data-placeholder); color: var(--ink-4); pointer-events: none; }
.tk-panel .tkf-live .lv-mk { color: #a4aab6; font-weight: 400; font-style: normal; text-decoration: none; }
.tk-panel .tkf-live strong { font-weight: 700; }
.tk-panel .tkf-live .lv-code { padding: 0.05em 0.1em; font-family: var(--font-mono); font-size: 0.88em; background: var(--accent-soft); border-radius: 3px; color: var(--marine-2); }
.tk-panel .tkf-live .lv-pre { display: inline; font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-2); color: var(--marine-2); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.tk-panel .tkf-live .lv-quote { color: var(--ink-3); box-shadow: inset 3px 0 0 var(--accent-300); padding-left: 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.tk-panel .tkf-live .lv-h { font-weight: 700; color: var(--ink); }
.tk-panel .tkf-live .lv-h1 { font-size: 1.35em; }
.tk-panel .tkf-live .lv-h2 { font-size: 1.18em; }
.tk-panel .tkf-live .lv-h3 { font-size: 1.05em; }
.tk-panel .tkf-live .lv-spoiler { background: var(--ink-2); color: #fff; border-radius: 3px; padding: 0 2px; }
.tk-panel .tkf-live .lv-link { color: var(--marine); text-decoration: underline; text-underline-offset: 2px; }

.tkf strong { font-weight: 700; color: var(--ink); }
.tkf code.tkf-code { padding: 0.1em 0.35em; font-family: var(--font-mono); font-size: 0.86em; background: var(--accent-soft); border: 1px solid var(--accent-200); border-radius: var(--radius-xs); color: var(--marine-2); }
.tkf pre.tkf-pre { margin: 6px 0; padding: 10px 12px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.5; white-space: pre; color: var(--marine-2); }
.tkf pre.tkf-pre code { font: inherit; background: none; border: 0; padding: 0; }
.tkf blockquote.tkf-quote { margin: 4px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent-300); color: var(--ink-3); }
.tkf .tkf-h { display: block; margin: 6px 0 2px; color: var(--ink); font-weight: 700; line-height: 1.25; }
.tkf .tkf-h1 { font-size: 1.35em; }
.tkf .tkf-h2 { font-size: 1.18em; }
.tkf .tkf-h3 { font-size: 1.05em; }
.tkf .tkf-spoiler { padding: 0 3px; border-radius: 3px; background: var(--ink-2); color: transparent; cursor: pointer; transition: background 0.15s, color 0.15s; }
.tkf .tkf-spoiler.visible { background: var(--accent-soft); color: inherit; }
.tkf a { color: var(--marine); text-decoration: underline; text-underline-offset: 2px; }
.tkf .tkf-vacio { color: var(--ink-4); }

.tk-lightbox { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 30px; background: rgba(16, 24, 40, 0.82); }
.tk-lightbox[hidden] { display: none; }
.tk-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-md); }
.tk-lightbox-cerrar { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 22px; }

@media (max-width: 1024px) { .tk-panel .dc-grid--4 { grid-template-columns: repeat(2, 1fr); } .tk-panel .dc-grid.dc-grid > *:nth-child(2n) { border-right: 0; } }
@media (max-width: 700px) {
    .tk-panel .mensaje { grid-template-columns: 1fr; }
    .tk-panel .mensaje-meta { border-right: 0; border-bottom: 1px solid var(--rule-soft); padding-bottom: 10px; }
    .tk-panel .dc-header { flex-wrap: wrap; }
}

/* =============================================================================
   Clientes (/clients/): filas de una línea, acciones siempre visibles
   ============================================================================= */
#clients-table th, #clients-table td { padding-left: 11px; padding-right: 11px; }
#clients-table tbody td { white-space: nowrap; padding-top: 8px; padding-bottom: 8px; }
#clients-table tbody td:first-child { max-width: 13rem; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 600; }
#clients-table tbody td:nth-child(2) { max-width: 13rem; overflow: hidden; text-overflow: ellipsis; }
#clients-table tbody td:nth-child(3) { width: 1%; }
#clients-table tbody td:nth-child(6), #clients-table tbody td:nth-child(7) { color: var(--ink-3); font-size: 0.78rem; }
#clients-table tbody td:nth-child(7) br, #clients-table tbody td:nth-child(7) small { display: none; }
#clients-table thead th:last-child, #clients-table tbody td:last-child {
    position: sticky; right: 0; z-index: 1;
    width: 1%; text-align: right;
    background: var(--surface);
    box-shadow: inset 1px 0 0 var(--rule-soft);
}
#clients-table thead th:last-child { background: var(--surface-2); }
#clients-table tbody tr:hover td:last-child { background: var(--surface-2); }

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 1280px) {
    :root { --sidebar-w: 224px; }
}
@media (max-width: 1100px) {
    .salesops-main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar {
        width: 260px;
        background: var(--canvas);
        border-right: 1px solid var(--rule);
        transform: translateX(-100%);
        transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
        box-shadow: var(--shadow-modal);
    }
    body.sidebar-open .sidebar { transform: none; }
    .mobile-menu-btn { display: grid; }
    .content-wrapper { margin-left: 0; }
    .page-top { padding-left: 62px; border-left: 0; border-right: 0; }
    .page-container > * { border-left-width: 0 !important; border-right-width: 0 !important; }
    .app-version { left: 10px; }
    .drive-layout { grid-template-columns: 1fr; }
    .drive-side { position: static; max-height: none; margin: 0 0 -1px; }
    .drive-tree { max-height: 220px; }
    .drive-preview-body { grid-template-columns: 1fr; }
    .drive-preview-meta { border-left: 0; border-top: 1px solid var(--rule-soft); }
}
@media (max-width: 640px) {
    .metrics-grid, .salesops-kpis, .stats-grid, .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-kpi-value { font-size: 1.5rem; }
    .data-table thead th, .data-table tbody td { padding-left: 10px; padding-right: 10px; }
    .hbar-label { flex-basis: 58px; font-size: 0.72rem; }
    .hbar-value { min-width: 7rem; }
    .hbar-value span { display: none; }
    .liq-cal-head h2 small { display: block; }
    .liq-cal-nav { width: 100%; justify-content: space-between; }
    .page-top-title { font-size: 1.375rem; }
    .modal { padding: 12px; }
}

/* =============================================================================
   Impresión
   ============================================================================= */
@media print {
    .sidebar, .mobile-menu-btn, .sidebar-scrim, .page-top .btn, .app-version, .page-foot { display: none !important; }
    body, .main-content { background: #fff; }
    .content-wrapper { margin: 0; padding: 0; }
    .main-content { border: 0; box-shadow: none; }
    .page-top { position: static; backdrop-filter: none; }
    .data-table { font-size: 10pt; }
    a { color: inherit; }
}
