/* ==========================================================================
   RADAR JUDICIAL — Sistema de diseño
   Autor del proyecto: Cesar Mejia
   Un solo archivo controla el aspecto de todo el sitio.
   Para recolorear la app entera, cambia los tokens de :root
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Marca — familia «notarial» (rediseño de noviembre de 2026).
       Los nombres se quedan en navy-* para no tocar cientos de reglas: lo que
       cambió es el tono, de un azul marino casi negro a un azul notarial más
       claro. El 700 es el azul de la acción principal. */
    --navy-900: #12324F;
    --navy-800: #173F63;
    --navy-700: #1E4E79;
    --navy-600: #2A6396;
    --navy-500: #3B78AE;
    --navy-100: #E8EEF5;

    --gold-600: #B08D1E;
    --gold-500: #C9A227;
    --gold-400: #E2BE4E;
    --gold-100: #FBF3DC;

    /* Semánticos */
    --ok-600: #15803D;
    --ok-500: #16A34A;
    --ok-100: #E8F7EE;
    --warn-600: #B45309;
    --warn-500: #D97706;
    --warn-100: #FEF4E2;
    --danger-600: #B91C1C;
    --danger-500: #DC2626;
    --danger-100: #FEF0F0;
    --info-600: #0E7490;
    --info-100: #E4F5F9;

    /* Neutros */
    --ink: #0F172A;
    --muted: #5A6B85;
    --faint: #8FA3BD;
    --line: #E3E9F2;
    --line-soft: #EEF3F9;
    --surface: #FFFFFF;
    --bg: #F5F8FC;

    /* Forma */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(11, 37, 69, .06), 0 4px 12px rgba(11, 37, 69, .05);
    --shadow-md: 0 2px 4px rgba(11, 37, 69, .06), 0 12px 32px rgba(11, 37, 69, .09);
    --shadow-lg: 0 4px 8px rgba(11, 37, 69, .06), 0 24px 56px rgba(11, 37, 69, .14);

    /* Puente con Bootstrap */
    --bs-primary: #1E4E79;
    --bs-primary-rgb: 30, 78, 121;
    --bs-body-color: #0F172A;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-border-color: #E3E9F2;
    --bs-link-color: #2A6396;
    --bs-link-hover-color: #1E4E79;
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, .serif {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    letter-spacing: -.015em;
    color: var(--navy-800);
}

main { flex: 1 0 auto; }

a { text-decoration: none; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 12px;
    z-index: 2000;
    background: var(--navy-800);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
}
.skip-link:focus { left: 16px; color: #fff; }

:focus-visible {
    outline: 3px solid rgba(42, 90, 158, .45);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Icono en línea reutilizable */
.ico {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -.15em;
    flex: none;
}

/* --------------------------------------------------------------------------
   3. NAVBAR
   -------------------------------------------------------------------------- */
.rj-navbar {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1030;
}
.rj-navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.rj-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 14px 0;
}
.rj-brand svg { width: 34px; height: 34px; flex: none; }
.rj-brand-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 700;
    font-size: 1.28rem;
    color: var(--navy-800);
    line-height: 1;
    letter-spacing: -.02em;
}
.rj-brand-text span { color: var(--gold-600); }
.rj-brand-sub {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 4px;
}

.rj-nav-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

/* Chip con el correo del usuario */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--navy-100);
    border: 1px solid #D8E4F3;
    color: var(--navy-700);
    font-size: .8rem;
    font-weight: 600;
    padding: 6px 13px 6px 7px;
    border-radius: 999px;
    max-width: 260px;
}
.user-chip .avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--navy-600), var(--navy-800));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .68rem;
    font-weight: 700;
    flex: none;
    text-transform: uppercase;
}
.user-chip .mail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. BOTONES
   -------------------------------------------------------------------------- */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    --bs-btn-focus-shadow-rgb: 42, 90, 158;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; transform: none; }
.btn-sm { border-radius: 9px; }

.btn-primary {
    --bs-btn-bg: var(--navy-700);
    --bs-btn-border-color: var(--navy-700);
    --bs-btn-hover-bg: var(--navy-800);
    --bs-btn-hover-border-color: var(--navy-800);
    --bs-btn-active-bg: var(--navy-900);
    --bs-btn-active-border-color: var(--navy-900);
    --bs-btn-disabled-bg: var(--navy-700);
    --bs-btn-disabled-border-color: var(--navy-700);
    box-shadow: 0 4px 12px rgba(19, 49, 92, .22);
}
.btn-success {
    --bs-btn-bg: var(--ok-600);
    --bs-btn-border-color: var(--ok-600);
    --bs-btn-hover-bg: #126A33;
    --bs-btn-hover-border-color: #126A33;
    --bs-btn-active-bg: #0F5A2B;
    --bs-btn-disabled-bg: var(--ok-600);
    --bs-btn-disabled-border-color: var(--ok-600);
}
.btn-danger {
    --bs-btn-bg: var(--danger-600);
    --bs-btn-border-color: var(--danger-600);
    --bs-btn-hover-bg: #991B1B;
    --bs-btn-hover-border-color: #991B1B;
    --bs-btn-active-bg: #7F1D1D;
    --bs-btn-disabled-bg: var(--danger-600);
    --bs-btn-disabled-border-color: var(--danger-600);
}
.btn-warning {
    --bs-btn-color: var(--navy-900);
    --bs-btn-bg: var(--gold-400);
    --bs-btn-border-color: var(--gold-500);
    --bs-btn-hover-color: var(--navy-900);
    --bs-btn-hover-bg: var(--gold-500);
    --bs-btn-hover-border-color: var(--gold-600);
    --bs-btn-active-bg: var(--gold-600);
    --bs-btn-disabled-color: var(--navy-900);
    --bs-btn-disabled-bg: var(--gold-400);
    --bs-btn-disabled-border-color: var(--gold-500);
    box-shadow: 0 4px 12px rgba(201, 162, 39, .28);
}
.btn-dark {
    --bs-btn-bg: var(--navy-800);
    --bs-btn-border-color: var(--navy-800);
    --bs-btn-hover-bg: var(--navy-900);
    --bs-btn-hover-border-color: var(--navy-900);
    --bs-btn-active-bg: #050F1E;
}
.btn-secondary {
    --bs-btn-bg: #64748B;
    --bs-btn-border-color: #64748B;
    --bs-btn-hover-bg: #526077;
    --bs-btn-hover-border-color: #526077;
}
.btn-light {
    --bs-btn-bg: #FFFFFF;
    --bs-btn-border-color: var(--line);
    --bs-btn-color: var(--navy-700);
    --bs-btn-hover-bg: #F3F7FC;
    --bs-btn-hover-border-color: #CDDAEB;
    --bs-btn-hover-color: var(--navy-800);
}

.btn-outline-primary   { --bs-btn-color: var(--navy-600); --bs-btn-border-color: #C6D5E9; --bs-btn-hover-bg: var(--navy-600); --bs-btn-hover-border-color: var(--navy-600); --bs-btn-active-bg: var(--navy-700); }
.btn-outline-secondary { --bs-btn-color: #56657D; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #56657D; --bs-btn-hover-border-color: #56657D; }
.btn-outline-success   { --bs-btn-color: var(--ok-600); --bs-btn-border-color: #B7E4C8; --bs-btn-hover-bg: var(--ok-600); --bs-btn-hover-border-color: var(--ok-600); }
.btn-outline-danger    { --bs-btn-color: var(--danger-600); --bs-btn-border-color: #F3C6C6; --bs-btn-hover-bg: var(--danger-600); --bs-btn-hover-border-color: var(--danger-600); }
.btn-outline-warning   { --bs-btn-color: var(--warn-600); --bs-btn-border-color: #F0DCA9; --bs-btn-hover-bg: var(--warn-500); --bs-btn-hover-border-color: var(--warn-500); --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; }
.btn-outline-info      { --bs-btn-color: var(--info-600); --bs-btn-border-color: #B7DDE7; --bs-btn-hover-bg: var(--info-600); --bs-btn-hover-border-color: var(--info-600); --bs-btn-hover-color: #fff; }

/* Botón fantasma de la navbar */
.btn-ghost {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy-700);
    font-weight: 600;
    font-size: .9rem;
    padding: 8px 18px;
    border-radius: 11px;
}
.btn-ghost:hover {
    border-color: var(--navy-500);
    color: var(--navy-800);
    box-shadow: var(--shadow-sm);
}

/* Botón principal con logo de Google */
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
    color: #fff;
    font-weight: 600;
    font-size: 1.02rem;
    padding: 15px 28px 15px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--navy-800);
    box-shadow: 0 10px 26px rgba(11, 37, 69, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.btn-cta:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(11, 37, 69, .34);
}
.btn-cta:active { transform: translateY(0); }
.g-badge {
    width: 34px; height: 34px;
    background: #fff;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex: none;
}
.g-badge svg { width: 18px; height: 18px; }

/* Botón cuadrado sólo-icono para tablas */
.btn-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    line-height: 1;
}
.btn-icon .ico { width: 15px; height: 15px; vertical-align: middle; }

/* --------------------------------------------------------------------------
   5. TARJETAS
   -------------------------------------------------------------------------- */
.card {
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: var(--radius-lg);
    --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
    --bs-card-bg: var(--surface);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
}
.card-header .fw-bold {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.08rem;
    color: var(--navy-800);
}

/* Tarjeta de acción del panel */
.tool-card {
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, border-color .2s ease;
}
.tool-card:hover { box-shadow: var(--shadow-md); border-color: #D3DEEC; }
.tool-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.tool-ico {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: none;
    background: linear-gradient(145deg, #EEF3FA, #E2EAF6);
    border: 1px solid #DCE6F3;
    color: var(--navy-700);
}
.tool-ico .ico { width: 20px; height: 20px; }
.tool-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--navy-800);
    line-height: 1.2;
    margin: 0;
}
.tool-sub {
    font-size: .78rem;
    color: var(--muted);
    margin: 2px 0 0;
}

/* Encabezado de página */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}
.page-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
}
.page-sub {
    color: var(--muted);
    font-size: .93rem;
    margin: 6px 0 0;
}

/* Estado del radar.

   El color va acompañado SIEMPRE de texto que dice lo mismo. Un indicador que
   solo se distingue por el color no lo distingue quien no ve bien los colores,
   y aquí lo que se comunica es si el sistema está vigilando o no. */
.estado-radar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: .88rem;
    line-height: 1.3;
}
.estado-radar .punto {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 9px;
}
.estado-texto   { font-weight: 600; }
.estado-detalle { opacity: .75; font-size: .82rem; }

.estado-bien   { background: #e8f5ec; border-color: #b7e0c4; color: #1c6b35; }
.estado-bien   .punto { background: #23a455; }
.estado-aviso  { background: #fdf4e3; border-color: #f0d9a8; color: #8a5b0d; }
.estado-aviso  .punto { background: #d69420; }
.estado-alarma { background: #fdeaea; border-color: #f2c0c0; color: #a32d2d; }
.estado-alarma .punto { background: #d33; }

/* Tarjeta de métrica (admin) */
.stat-card {
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--navy-600);
}
.stat-card.is-gold::after   { background: var(--gold-500); }
.stat-card.is-warn::after   { background: var(--warn-500); }
.stat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.stat-head .ico { width: 17px; height: 17px; color: var(--navy-500); }
.stat-card.is-gold .stat-head .ico { color: var(--gold-600); }
.stat-card.is-warn .stat-head .ico { color: var(--warn-600); }
.stat-value {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--navy-900);
    margin: 0;
}

/* Panel de consumo de radicados */
.usage-panel {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    color: #fff;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 22px;
}
.usage-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .62);
    margin-bottom: 7px;
}
.usage-count {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}
.usage-count .of {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, .65);
}
.usage-bar {
    height: 7px;
    width: min(320px, 60vw);
    background: rgba(255, 255, 255, .18);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 12px;
}
.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-400), var(--gold-500));
    border-radius: 99px;
    transition: width .5s ease;
}

/* --------------------------------------------------------------------------
   6. TABLAS
   -------------------------------------------------------------------------- */
.table {
    --bs-table-hover-bg: #F5F9FE;
    --bs-table-border-color: var(--line-soft);
    margin-bottom: 0;
    color: var(--ink);
}
.table > thead th {
    background: #F7FAFD;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    padding: 13px 14px;
    white-space: nowrap;
}
.table > tbody td {
    padding: 13px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
    font-size: .92rem;
}
.table > tbody tr:last-child td { border-bottom: 0; }
.table-light { --bs-table-bg: #F7FAFD; }
.table-dark  { --bs-table-bg: var(--navy-800); --bs-table-color: #fff; --bs-table-border-color: var(--navy-600); }

/* Radicado en fuente monoespaciada: 23 dígitos se leen mucho mejor */
.radicado-cell {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: .84rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--navy-800);
    white-space: nowrap;
}

.cell-muted { color: var(--muted); }
.table-empty {
    text-align: center;
    padding: 48px 20px !important;
    color: var(--faint);
}
.table-empty .ico {
    width: 40px; height: 40px;
    display: block;
    margin: 0 auto 12px;
    color: #C6D3E4;
}

/* Casillas de selección */
.form-check-input, input[type="checkbox"] {
    cursor: pointer;
    border-color: #C2D0E2;
}
.form-check-input:checked, input[type="checkbox"]:checked {
    background-color: var(--navy-600);
    border-color: var(--navy-600);
}

/* --------------------------------------------------------------------------
   7. BADGES
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .02em;
    padding: .42em .72em;
    border-radius: 7px;
}
.badge.rounded-pill { border-radius: 99px; }

.badge.bg-success   { background-color: var(--ok-100) !important; color: var(--ok-600) !important; box-shadow: inset 0 0 0 1px #BFE7CE; }
.badge.bg-warning   { background-color: var(--warn-100) !important; color: var(--warn-600) !important; box-shadow: inset 0 0 0 1px #F2DFB4; }
.badge.bg-danger    { background-color: var(--danger-100) !important; color: var(--danger-600) !important; box-shadow: inset 0 0 0 1px #F5CACA; }
.badge.bg-info      { background-color: var(--info-100) !important; color: var(--info-600) !important; box-shadow: inset 0 0 0 1px #BEE0EA; }
.badge.bg-secondary { background-color: #EEF2F7 !important; color: #56657D !important; box-shadow: inset 0 0 0 1px #DDE4EE; }
.badge.bg-primary   { background-color: var(--navy-100) !important; color: var(--navy-700) !important; box-shadow: inset 0 0 0 1px #D3E0F1; }
.badge.bg-dark      { background-color: var(--navy-800) !important; color: #fff !important; }
.badge.text-dark    { color: inherit !important; }

/* --------------------------------------------------------------------------
   8. FORMULARIOS
   -------------------------------------------------------------------------- */
.form-control, .form-select {
    border: 1px solid #D8E1EC;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .94rem;
    color: var(--ink);
    background-color: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.form-control::placeholder { color: var(--faint); }
.form-control:focus, .form-select:focus {
    border-color: var(--navy-500);
    box-shadow: 0 0 0 4px rgba(42, 90, 158, .13);
}
.form-control-sm { padding: 7px 11px; font-size: .86rem; border-radius: 9px; }
textarea.form-control { line-height: 1.6; }

.form-control[type="file"] { padding: 8px 12px; cursor: pointer; }
.form-control[type="file"]::file-selector-button {
    background: var(--navy-100);
    border: 0;
    border-radius: 7px;
    color: var(--navy-700);
    font-weight: 600;
    font-size: .82rem;
    padding: 6px 12px;
    margin: -2px 12px -2px -4px;
    cursor: pointer;
    transition: background-color .16s ease;
}
.form-control[type="file"]::file-selector-button:hover { background: #DBE7F7; }

.field-hint {
    font-size: .76rem;
    color: var(--faint);
    margin-top: 7px;
}

/* --------------------------------------------------------------------------
   9. ALERTAS
   -------------------------------------------------------------------------- */
.alert {
    border: 1px solid var(--line);
    border-left: 4px solid var(--navy-600);
    border-radius: 13px;
    box-shadow: var(--shadow-sm);
    font-size: .93rem;
    font-weight: 500;
    padding: 14px 18px;
}
.alert-success { background: #F2FAF5; color: #14532D; border-left-color: var(--ok-500); }
.alert-danger  { background: #FEF3F2; color: #7F1D1D; border-left-color: var(--danger-500); }
.alert-info    { background: #F1F7FD; color: var(--navy-800); border-left-color: var(--navy-500); }
.alert-warning { background: var(--warn-100); color: #7C2D12; border-left-color: var(--warn-500); }

/* --------------------------------------------------------------------------
   10. MODAL
   -------------------------------------------------------------------------- */
.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    color: #fff;
    border-bottom: 0;
    padding: 18px 22px;
}
.modal-header .modal-title {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-body { padding: 22px; background: var(--surface); }
.modal-footer { border-top: 1px solid var(--line); background: #FAFCFE; padding: 14px 22px; }

/* Ficha de datos del expediente */
.detail-table th {
    width: 32%;
    background: #F7FAFD !important;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    vertical-align: middle;
    border-color: var(--line) !important;
}
.detail-table td {
    font-size: .92rem;
    color: var(--ink);
    border-color: var(--line) !important;
}
.detail-table { border-radius: var(--radius); overflow: hidden; border-color: var(--line) !important; }

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy-800);
    margin: 26px 0 12px;
}
.modal-section-title .ico { width: 18px; height: 18px; color: var(--gold-600); }

/* --------------------------------------------------------------------------
   Ancho de las pantallas de trabajo
   --------------------------------------------------------------------------
   `container` de Bootstrap topa en 1320 px. Está pensado para texto y ahí es
   correcto —un párrafo muy ancho se lee mal porque el ojo pierde el renglón
   al volver—, pero una tabla de siete columnas no es un párrafo. En un monitor
   de 24" ese tope dejaba 600 px muertos, casi un tercio del ancho; en uno de
   2560, la mitad.

   El tope de 1800 no es capricho: sin ninguno, en una pantalla ultrapanorámica
   la fila se estira tanto que seguirla de un extremo al otro cuesta más que
   desplazarse. Se gana espacio hasta donde sirve y no más.

   Solo va en las pantallas de trabajo —panel, administración, Corte,
   auditoría, respaldos—. Ayuda, legal y descargo son texto y se quedan con su
   ancho de lectura.
   -------------------------------------------------------------------------- */
.contenedor-trabajo {
    width: 100%;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}
@media (min-width: 1400px) {
    .contenedor-trabajo { padding-left: 1.75rem; padding-right: 1.75rem; }
}

/* Los formularios NO se estiran con la página.
   «Agregar Radicado» y «Carga Masiva» son campos pequeños: a 900 px de ancho
   quedan perdidos en medio de un rectángulo vacío. La tabla es la que gana
   con el espacio; estas dos, no. */
.fila-herramientas { max-width: 1200px; }

.historial-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.historial-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #F7FAFD;
}
.historial-scroll table { margin-bottom: 0; }
.historial-scroll td { font-size: .85rem; }

/* El historial cabe a lo ancho -------------------------------------------
   Las «actuaciones automáticas» de la Rama traen anotaciones de diez o doce
   renglones (destino del reparto, folios, tipo de providencia, todo en un
   párrafo). Con el ancho automático esa columna estiraba la tabla y empujaba
   «Documentos» fuera de la ventana: para descargar un PDF había que arrastrar
   la barra de abajo hasta el final, y ni siquiera se veía que estuviera ahí.

   Con `table-layout: fixed` la tabla nunca pasa del ancho disponible: los
   anchos salen de la primera fila y la anotación se queda con lo que sobre,
   recortada a tres renglones. El texto entero sigue estando, a un clic. */
.tabla-historial { table-layout: fixed; width: 100%; }

/* Un radicado o una URL sin espacios no tienen por dónde partirse y se salen
   de su columna. `anywhere` los parte donde haga falta. */
.tabla-historial td,
.tabla-historial th { overflow-wrap: anywhere; }

.tabla-historial .col-fecha    { width: 96px; }
.tabla-historial .col-actuacion{ width: 140px; }
.tabla-historial .col-tramite  { width: 84px; }
.tabla-historial .col-registro { width: 96px; }
.tabla-historial .col-docs     { width: 92px; }

.tabla-historial .anotacion {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    line-height: 1.35;
    white-space: pre-line;   /* la Rama mete saltos de línea dentro del texto */
}
.tabla-historial .anotacion.abierta {
    display: block;
    overflow: visible;
}
.tabla-historial .ver-mas {
    border: 0;
    background: none;
    padding: 0;
    margin-top: 3px;
    font-size: .74rem;
    font-weight: 600;
    color: var(--navy-800);
    cursor: pointer;
}
.tabla-historial .ver-mas:hover { text-decoration: underline; }

/* En pantallas estrechas «Inicia» y «Finaliza» sobran: casi siempre vienen
   vacías y son justo las que le roban el sitio a la anotación. Siguen en el
   ancho completo, que es donde alguien las mira. */
@media (max-width: 992px) {
    .tabla-historial .col-tramite { display: none; }
}

/* En el TELÉFONO ni con eso caben.

   Una pantalla estrecha son unos 360 px. Las columnas fijas que quedaban
   —fecha 96, actuación 140, registro 96, documentos 92— suman 424: ya no cabe
   la tabla, y la anotación, que es la única sin ancho declarado, se queda con
   lo que sobre. O sea con nada.

   El resultado no era una columna estrecha: era una columna de UN CARÁCTER de
   ancho, con «Ver todo ▼» partido en vertical, una letra por renglón. En el
   escritorio no se veía porque allí sobran cuatrocientos píxeles.

   «Registro» —la fecha en que la Rama anotó la actuación— se va con Inicia y
   Finaliza: en un teléfono lo que se mira es QUÉ pasó, CUÁNDO y el documento.
   Esa fecha sigue en la pantalla grande, que es donde se compara.

   Lo que queda suma 246 y deja unos 90 para la anotación: poco, pero bastante
   para tres renglones recortados y un «Ver todo» que no se parte. */
@media (max-width: 575.98px) {
    .tabla-historial .col-registro  { display: none; }
    .tabla-historial .col-fecha     { width: 72px; }
    .tabla-historial .col-actuacion { width: 110px; }
    .tabla-historial .col-docs      { width: 64px; }
}

/* --------------------------------------------------------------------------
   11. FOOTER
   -------------------------------------------------------------------------- */
.footer {
    margin-top: auto;
    padding: 30px 0;
    background: var(--navy-900);
    color: #9FB0C7;
    font-size: .9rem;
    text-align: center;
    border-top: 3px solid var(--gold-500);
}
.footer a { color: var(--gold-400); font-weight: 600; }
.footer a:hover { text-decoration: underline; color: #F0D98A; }

/* --------------------------------------------------------------------------
   12. PORTADA (index)
   -------------------------------------------------------------------------- */
.hero-wrap { position: relative; padding: 68px 0 40px; isolation: isolate; }
.hero-wrap::before {
    content: "";
    position: absolute;
    inset: -140px 0 auto;
    height: 620px;
    z-index: -1;
    background:
        radial-gradient(760px 420px at 78% 12%, rgba(42, 90, 158, .13), transparent 62%),
        radial-gradient(620px 400px at 8% 0%, rgba(201, 162, 39, .12), transparent 60%);
}
.hero-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(19, 49, 92, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 49, 92, .045) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
    mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--navy-700);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 7px 15px 7px 11px;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}
.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ok-500);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, .55);
    animation: pulseDot 2.2s infinite;
}
@keyframes pulseDot {
    70%  { box-shadow: 0 0 0 9px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.hero-title {
    font-size: clamp(2.15rem, 4.6vw, 3.5rem);
    font-weight: 700;
    line-height: 1.08;
    color: var(--navy-900);
    margin: 22px 0 18px;
}
.hero-title em {
    font-style: normal;
    position: relative;
    white-space: nowrap;
    color: var(--navy-800);
}
.hero-title em::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: .06em;
    height: .32em;
    background: linear-gradient(90deg, rgba(226, 190, 78, .55), rgba(226, 190, 78, .22));
    border-radius: 3px;
    z-index: -1;
}
.hero-lead {
    font-size: 1.09rem;
    line-height: 1.72;
    color: var(--muted);
    max-width: 30rem;
}

.trust-row { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 26px; }
.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    color: var(--muted);
    font-weight: 500;
}
.trust-item .ico { width: 17px; height: 17px; color: var(--gold-600); }

/* Radar animado */
.radar-stage { position: relative; max-width: 460px; margin: 0 auto; }

/* --------------------------------------------------------------------------
   Portada en pantallas anchas
   --------------------------------------------------------------------------
   El contenedor de Bootstrap se corta en 1320px. En un monitor de 1900 eso
   deja unos 290px muertos a cada lado y la portada parece encogida.

   Se ensancha el CONTENEDOR y crece el RADAR, que es el elemento que sostiene
   la composición. El párrafo NO se estira a propósito: por encima de unos 75
   caracteres por línea el ojo pierde el renglón al saltar de línea. Es el
   motivo por el que los periódicos usan columnas estrechas teniendo páginas
   anchas. Más ancho aquí se vería más lleno y se leería peor.

   OJO CON EL ORDEN: estas reglas tienen la misma especificidad que las de
   arriba (una sola clase), así que quien gana es la ÚLTIMA. Si este bloque se
   mueve antes de las reglas base, deja de hacer efecto sin dar ningún error.
   -------------------------------------------------------------------------- */
@media (min-width: 1400px) {
    .hero-wrap .container { max-width: 1560px; }
    .hero-wrap { padding-top: 48px; }
    .radar-stage { max-width: 620px; }
    .hero-title { font-size: clamp(3.1rem, 3.4vw, 4rem); }
    /* El párrafo respira algo, pero sigue lejos del límite de legibilidad */
    .hero-lead { max-width: 34rem; }
}

@media (min-width: 1800px) {
    .hero-wrap .container { max-width: 1720px; }
    .radar-stage { max-width: 700px; }
}
.radar-stage svg { width: 100%; height: auto; display: block; }
.radar-sweep { transform-origin: 220px 220px; animation: sweep 5s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }

.blip { animation: blipIn 5s ease-in-out infinite; transform-origin: center; }
.blip-2 { animation-delay: 1.4s; }
.blip-3 { animation-delay: 2.9s; }
.blip-4 { animation-delay: 3.9s; }
@keyframes blipIn {
    0%, 100% { opacity: .18; }
    8%       { opacity: 1; }
    45%      { opacity: .3; }
}
.ping { animation: ping 5s ease-out infinite; transform-origin: center; transform-box: fill-box; }
.ping-2 { animation-delay: 1.4s; }
.ping-3 { animation-delay: 2.9s; }
@keyframes ping {
    0%        { transform: scale(.4); opacity: .85; }
    25%, 100% { transform: scale(2.6); opacity: 0; }
}

.float-card {
    position: absolute;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 11px;
    animation: bob 6s ease-in-out infinite;
}
.float-card .fc-title { font-size: .82rem; font-weight: 700; color: var(--navy-800); line-height: 1.25; }
.float-card .fc-sub { font-size: .72rem; color: var(--muted); line-height: 1.3; }
.fc-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex: none;
}
.fc-green { background: var(--ok-100); color: var(--ok-500); }
.fc-gold  { background: var(--gold-100); color: var(--gold-600); }
.fc-icon .ico { width: 17px; height: 17px; }
.fc-top { top: 6%; right: -10px; }
.fc-bot { bottom: 8%; left: -14px; animation-delay: 1.6s; }
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}

.section-features { padding: 26px 0 76px; }
.section-kicker {
    text-align: center;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold-600);
    margin-bottom: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.section-kicker::before,
.section-kicker::after {
    content: "";
    height: 1px;
    width: 54px;
    background: linear-gradient(90deg, transparent, var(--line));
}
.section-kicker::after { background: linear-gradient(90deg, var(--line), transparent); }

.feature-card {
    height: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 30px 26px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.feature-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--navy-600), var(--gold-500));
    opacity: 0;
    transition: opacity .22s ease;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: #D3DEEC; }
.feature-card:hover::before { opacity: 1; }
.feature-icon {
    width: 54px; height: 54px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    background: linear-gradient(145deg, #EEF3FA, #E2EAF6);
    border: 1px solid #DCE6F3;
}
.feature-icon svg { width: 27px; height: 27px; }
.feature-card h5 { font-size: 1.15rem; font-weight: 700; color: var(--navy-800); margin-bottom: 9px; }
.feature-card p { color: var(--muted); font-size: .945rem; line-height: 1.65; margin: 0; }

/* --------------------------------------------------------------------------
   13. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .hero-wrap { padding-top: 44px; text-align: center; }
    .hero-lead { margin-left: auto; margin-right: auto; }
    .trust-row { justify-content: center; }
    .radar-stage { margin-top: 46px; max-width: 380px; }
}

@media (max-width: 767.98px) {
    .modal-fullscreen-sm-down .modal-content { height: 100vh; border-radius: 0; }
    .usage-panel { padding: 18px; }
    .usage-bar { width: 100%; }
    .page-head { align-items: flex-start; }
}

@media (max-width: 575.98px) {
    .rj-brand-sub { display: none; }
    .rj-brand svg { width: 30px; height: 30px; }
    .rj-brand-text { font-size: 1.1rem; }
    .btn-cta { width: 100%; justify-content: center; }
    .user-chip { max-width: 170px; font-size: .74rem; }
    .float-card { padding: 9px 12px; }
    .float-card .fc-title { font-size: .74rem; }
    .float-card .fc-sub { font-size: .66rem; }
    .fc-top { right: -4px; }
    .fc-bot { left: -4px; }
    .stat-value { font-size: 2.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* --------------------------------------------------------------------------
   MENÚ LATERAL Y BARRA SUPERIOR — paleta «notarial claro» (fase 1)

   Solo en páginas con sesión: base.html pone `con-menu` en el body. La portada,
   lo legal y el descargo siguen con la cabecera de siempre.

   Menú azul muy claro, acento azul notarial y el dorado de la marca reservado
   para el logo y la franja del elemento activo: el azul hace el trabajo y el
   dorado conserva la identidad.
   -------------------------------------------------------------------------- */
:root {
    --notarial-600: #1E4E79;
    --notarial-500: #2A6396;
    --notarial-100: #E8EEF5;
    --notarial-050: #F3F6FA;
    --notarial-linea: #D5DEEA;
    --notarial-tenue: #5A6B7D;
    --dorado-marca: #B8893C;
    --menu-ancho: 236px;
    --barra-alto: 60px;
}

body.con-menu { background: #FFFFFF; }

.rj-barra {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--barra-alto);
    padding: 0 18px;
    background: #FFFFFF;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--notarial-linea);
}
.rj-barra .rj-brand { padding: 0; }
.rj-barra .rj-brand-text { color: var(--notarial-600); }
.rj-barra .rj-brand-text span { color: var(--dorado-marca); }
.rj-barra-espacio { flex: 1; }

.rj-hamburguesa {
    border: 1px solid var(--notarial-linea);
    background: #FFFFFF;
    color: var(--notarial-600);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rj-usuario { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rj-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: var(--notarial-600); color: #FFFFFF;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600; letter-spacing: .02em;
}
.rj-usuario-texto { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rj-usuario-nombre {
    font-weight: 600; font-size: .86rem; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.rj-usuario-rol { font-size: .72rem; color: var(--notarial-tenue); }

/* El armazón: menú a la izquierda, contenido a la derecha. */
.rj-shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--barra-alto)); }
.rj-shell > main { flex: 1; min-width: 0; padding-bottom: 2rem; }

.rj-menu {
    width: var(--menu-ancho);
    flex: none;
    background: var(--notarial-100);
    border-right: 1px solid var(--notarial-linea);
}
.rj-menu-cuerpo {
    position: sticky;
    top: var(--barra-alto);
    max-height: calc(100vh - var(--barra-alto));
    overflow-y: auto;
    padding: 14px 10px 18px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--barra-alto));
}
.rj-menu-grupo {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--notarial-tenue);
    padding: 14px 10px 6px;
}
.rj-menu-grupo:first-child { padding-top: 4px; }
.rj-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: var(--notarial-600);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.rj-menu-item .ico { width: 18px; height: 18px; flex: none; }
.rj-menu-item:hover { background: rgba(255, 255, 255, .65); color: var(--notarial-600); }
.rj-menu-item.activo {
    background: #FFFFFF;
    border-left-color: var(--dorado-marca);
    border-radius: 0 8px 8px 0;
    font-weight: 600;
}
.rj-menu-item:focus-visible { outline: 2px solid var(--notarial-500); outline-offset: 1px; }
.rj-menu-pie {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--notarial-linea);
}

/* Celular y tableta: el menú se esconde y se abre con ☰ (offcanvas). */
@media (max-width: 991.98px) {
    .rj-menu.offcanvas-lg { width: 280px; border-right: none; }
    .rj-menu-cuerpo { position: static; max-height: none; min-height: 0; flex: 1; }
    .rj-menu .offcanvas-header { border-bottom: 1px solid var(--notarial-linea); }
    .rj-menu .offcanvas-header .rj-brand-text { color: var(--notarial-600); }
    .rj-menu .offcanvas-header .rj-brand-text span { color: var(--dorado-marca); }
    .rj-barra { padding: 0 12px; }
}
@media (max-width: 575.98px) {
    .rj-usuario-texto { display: none; }
}

/* --------------------------------------------------------------------------
   PANEL (rediseño, fase 2): encabezado, tarjetas de resumen y estado en barra
   -------------------------------------------------------------------------- */
.rj-encabezado {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 6px 0 18px;
}
.rj-migas { font-size: .78rem; color: var(--notarial-tenue); margin-bottom: 2px; }
.rj-migas span { margin: 0 4px; }
.rj-titulo {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--notarial-600);
    margin: 0 0 2px;
    letter-spacing: -.01em;
}
.rj-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.rj-acciones .btn-primary { background: var(--notarial-600); border-color: var(--notarial-600); }
.rj-acciones .btn-primary:hover { background: var(--notarial-500); border-color: var(--notarial-500); }
.rj-acciones .btn-outline-primary { color: var(--notarial-600); border-color: var(--notarial-600); }
.rj-acciones .btn-outline-primary:hover { background: var(--notarial-600); color: #FFFFFF; }

.rj-tarjetas {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.rj-tarjeta {
    display: block;
    background: var(--notarial-050);
    border: 1px solid var(--notarial-linea);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--ink);
    text-decoration: none;
}
.rj-tarjeta-enlace:hover { border-color: var(--notarial-500); color: var(--ink); }
.rj-tarjeta-etiqueta { font-size: .78rem; color: var(--notarial-tenue); }
.rj-tarjeta-valor {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--notarial-600);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.rj-tarjeta-de { font-size: .9rem; font-weight: 500; color: var(--faint); }
.rj-tarjeta-nota { font-size: .74rem; color: var(--notarial-tenue); }
.rj-tarjeta .usage-bar { margin-top: 6px; width: 100%; }
.rj-tarjeta-alerta { background: #FDF1F1; border-color: #F2C9C9; }
.rj-tarjeta-alerta .rj-tarjeta-valor { color: #9B2C2C; }
.rj-tarjeta-aviso { background: #FDF6E8; border-color: #EED9AE; }
.rj-tarjeta-aviso .rj-tarjeta-valor { color: #8A6424; }

.rj-punto-novedad {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C53030;
    margin-right: 6px;
    vertical-align: 1px;
}

/* El estado del radar, compacto, en la barra de arriba. */
.rj-estado { padding: 5px 11px; font-size: .78rem; border-radius: 8px; }
.rj-estado .estado-detalle { font-size: .72rem; }

@media (max-width: 991.98px) {
    .rj-tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .rj-estado .estado-detalle { display: none; }
    .rj-estado { padding: 4px 8px; }
}
@media (max-width: 575.98px) {
    .rj-estado .estado-texto { display: none; }
    .rj-estado { padding: 8px; }
    .rj-encabezado { align-items: stretch; }
    .rj-acciones { width: 100%; }
    .rj-acciones > * { flex: 1; }
    .rj-acciones .btn { width: 100%; }
    .rj-titulo { font-size: 1.45rem; }
}

/* Fase 3: la etiqueta pequeña junto al título («Solo administradores»,
   «Se consulta cada día a las 12:00»). */
.rj-etiqueta {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--notarial-100);
    color: var(--notarial-600);
    font-family: 'Inter', sans-serif;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: 0;
}

/* --------------------------------------------------------------------------
   FASE 4: novedades, línea de tiempo, filtros, fichas en el celular
   -------------------------------------------------------------------------- */
.rj-menu-contador {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #FBE4E4;
    color: #9B2C2C;
    font-size: .72rem;
    font-weight: 600;
    text-align: center;
}

/* Novedades: un bloque por día, una fila por actuación. */
.rj-dia { margin-bottom: 22px; }
.rj-dia-titulo {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--notarial-tenue);
    margin: 0 0 8px;
}
.rj-novedad {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--notarial-linea);
    border-radius: 10px;
    background: #FFFFFF;
    margin-bottom: 8px;
}
.rj-novedad.revisada { background: var(--notarial-050); }
.rj-novedad .rj-punto-novedad { margin: 6px 0 0; }
.rj-novedad.revisada .rj-punto-novedad { background: var(--notarial-linea); }
.rj-novedad-act { font-weight: 600; color: var(--ink); }
.rj-novedad-meta { font-size: .8rem; color: var(--notarial-tenue); }
.rj-novedad-anot {
    font-size: .85rem;
    color: #34445A;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rj-vacio {
    text-align: center;
    padding: 40px 16px;
    border: 1px dashed var(--notarial-linea);
    border-radius: 12px;
    color: var(--notarial-tenue);
}

/* La página del proceso: ficha de datos, Corte y línea de tiempo. */
.rj-ficha {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    background: var(--notarial-050);
    border: 1px solid var(--notarial-linea);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: .9rem;
}
.rj-ficha span {
    display: block;
    font-size: .74rem;
    color: var(--notarial-tenue);
}
.rj-ficha-ancha { grid-column: 1 / -1; }
.rj-corte {
    padding: 10px 14px;
    border-radius: 10px;
    background: #FDF6E8;
    border: 1px solid #EED9AE;
    font-size: .9rem;
}
.rj-linea { list-style: none; margin: 0; padding: 0 0 0 4px; }
.rj-hito {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    position: relative;
    padding: 0 0 18px;
}
.rj-hito::before {
    content: '';
    position: absolute;
    left: 157px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--notarial-linea);
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 1px var(--notarial-linea);
}
.rj-hito::after {
    content: '';
    position: absolute;
    left: 161px;
    top: 18px;
    bottom: 0;
    width: 2px;
    background: var(--notarial-linea);
}
.rj-hito:last-child::after { display: none; }
.rj-hito.decisiva::before { background: var(--dorado-marca); box-shadow: 0 0 0 1px var(--dorado-marca); }
.rj-hito-fecha { font-size: .82rem; color: var(--notarial-tenue); text-align: right; padding-top: 2px; }
.rj-hito-cuerpo { padding-left: 20px; }
.rj-hito-titulo { font-weight: 600; color: var(--ink); }
.rj-hito.decisiva .rj-hito-titulo { color: var(--notarial-600); }
.rj-hito-anot { font-size: .88rem; color: #34445A; white-space: pre-line; margin-top: 2px; }
.rj-hito-docs { margin-top: 6px; font-size: .85rem; }

@media (max-width: 767.98px) {
    .rj-ficha { grid-template-columns: 1fr; }
    .rj-hito { grid-template-columns: 1fr; gap: 2px; padding-left: 22px; }
    .rj-hito::before { left: 0; }
    .rj-hito::after { left: 4px; }
    .rj-hito-fecha { text-align: left; }
    .rj-hito-cuerpo { padding-left: 0; }
}
.rj-radicado { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--notarial-500); }
.rj-radicado:hover { color: var(--notarial-600); border-bottom-style: solid; }

/* Las tarjetas que filtran la tabla. */
.rj-tarjeta-filtro { cursor: pointer; }
.rj-tarjeta-filtro:hover { border-color: var(--notarial-500); }
.rj-tarjeta-filtro.activa { border: 2px solid var(--notarial-600); padding: 11px 13px; background: #FFFFFF; }
.rj-tarjeta-filtro:focus-visible { outline: 2px solid var(--notarial-500); outline-offset: 2px; }
.rj-tarjeta-nota a { color: var(--notarial-600); text-decoration: none; }
.rj-tarjeta-nota a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   La tabla de procesos como FICHAS en el celular (< 576 px).

   Solo CSS, a propósito: la tabla sigue siendo la misma, con las mismas
   celdas en el mismo orden. El aviso en vivo, el buscador y los filtros leen
   las celdas por su posición, y no deben notar que en el teléfono se ven
   apiladas. Columnas: 1 casilla · 2 radicado · 3 despacho · 4 última
   actuación · 5 sujetos · 6 agregado · 7 acciones.
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    #tablaProcesos > thead { display: none; }
    #tablaProcesos, #tablaProcesos > tbody { display: block; width: 100%; }
    #tablaProcesos > tbody > tr {
        display: grid;
        grid-template-columns: 26px minmax(0, 1fr);
        column-gap: 8px;
        row-gap: 3px;
        padding: 12px;
        margin: 0 10px 10px;
        border: 1px solid var(--notarial-linea);
        border-radius: 10px;
        background: #FFFFFF;
    }
    #tablaProcesos > tbody > tr > td {
        display: block;
        padding: 0 !important;
        border: none !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        white-space: normal !important;
        text-align: left !important;
        grid-column: 2;
    }
    #tablaProcesos > tbody > tr > td:nth-child(1) { grid-column: 1; grid-row: 1 / span 4; padding-top: 2px !important; }
    #tablaProcesos > tbody > tr > td:nth-child(2) { font-size: 14px; }
    #tablaProcesos > tbody > tr > td:nth-child(3)::before,
    #tablaProcesos > tbody > tr > td:nth-child(4)::before {
        display: block;
        font-size: 11px;
        color: var(--notarial-tenue);
    }
    #tablaProcesos > tbody > tr > td:nth-child(3)::before { content: 'Despacho'; }
    #tablaProcesos > tbody > tr > td:nth-child(4)::before { content: 'Última actuación'; }
    #tablaProcesos > tbody > tr > td:nth-child(5),
    #tablaProcesos > tbody > tr > td:nth-child(6) { display: none !important; }
    #tablaProcesos > tbody > tr > td:nth-child(7) { margin-top: 6px; }
    #tablaProcesos > tbody > tr > td:nth-child(7) > * { justify-content: flex-start !important; }
    #tablaProcesos > tbody > tr > td.table-empty { grid-column: 1 / -1; text-align: center !important; }
}
.rj-cargando { opacity: .75; pointer-events: none; cursor: progress; }
.rj-hace { font-size: .72rem; color: var(--faint); }

/* El buscador de la barra. */
.rj-buscador {
    align-items: center;
    gap: 8px;
    margin-left: 18px;
    padding: 0 12px;
    height: 38px;
    width: min(360px, 32vw);
    border: 1px solid var(--notarial-linea);
    border-radius: 8px;
    background: var(--notarial-050);
    color: var(--notarial-tenue);
}
.rj-buscador:focus-within { border-color: var(--notarial-500); background: #FFFFFF; }
.rj-buscador input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: .88rem;
    color: var(--ink);
}
.rj-aviso-busqueda {
    padding: 9px 14px;
    border-radius: 8px;
    background: var(--notarial-050);
    border: 1px solid var(--notarial-linea);
    font-size: .88rem;
}

/* --------------------------------------------------------------------------
   MODO OSCURO (opcional, por usuario; solo páginas con sesión)

   Bootstrap 5.3 pone oscuros sus propios componentes con data-bs-theme.
   Lo que hay aquí es lo NUESTRO: se redefinen los colores base y se cubren
   las piezas que tenían el blanco escrito a mano. Si una pantalla nueva se ve
   mal en oscuro, casi siempre es un #FFFFFF suelto: hay que llevarlo a una
   variable o añadirlo a esta lista.
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
    --ink: #E6EDF5;
    --muted: #A7B4C4;
    --faint: #7F8EA1;
    --line: #2C3A4B;
    --line-soft: #233040;
    --surface: #151E29;
    --bg: #0F161F;
    --navy-100: #1B2A3B;
    --notarial-600: #8DB7E0;
    --notarial-500: #A9C8E8;
    --notarial-100: #121B26;
    --notarial-050: #18222E;
    --notarial-linea: #2C3A4B;
    --notarial-tenue: #9AAABD;
    --bs-body-bg: #0F161F;
    --bs-body-color: #E6EDF5;
    --bs-border-color: #2C3A4B;
    --bs-link-color: #8DB7E0;
    --bs-link-hover-color: #A9C8E8;
    color-scheme: dark;
}
[data-bs-theme="dark"] body.con-menu,
[data-bs-theme="dark"] .rj-barra,
[data-bs-theme="dark"] .rj-hamburguesa,
[data-bs-theme="dark"] .rj-novedad,
[data-bs-theme="dark"] .rj-tarjeta-filtro.activa,
[data-bs-theme="dark"] .rj-buscador:focus-within,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .tool-card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .btn-ghost,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-body,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select { background-color: #151E29; color: var(--ink); }
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .bg-white { background-color: #18222E !important; color: var(--ink); }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--ink); }
[data-bs-theme="dark"] .table-light { --bs-table-bg: #18222E; --bs-table-color: var(--muted); }
[data-bs-theme="dark"] .rj-menu-item.activo { background: #1B2A3B; }
[data-bs-theme="dark"] .rj-menu-item:hover { background: #18222E; }
[data-bs-theme="dark"] .rj-brand-text,
[data-bs-theme="dark"] .rj-titulo,
[data-bs-theme="dark"] .rj-tarjeta-valor { color: #DCE7F3; }
[data-bs-theme="dark"] .rj-hito::before { border-color: #0F161F; }
[data-bs-theme="dark"] .rj-novedad-anot,
[data-bs-theme="dark"] .rj-hito-anot { color: #C3CEDB; }
[data-bs-theme="dark"] .rj-tarjeta-alerta { background: #2A1719; border-color: #5A2A2E; }
[data-bs-theme="dark"] .rj-tarjeta-alerta .rj-tarjeta-valor { color: #F2A7A7; }
[data-bs-theme="dark"] .rj-tarjeta-aviso,
[data-bs-theme="dark"] .rj-corte { background: #2A2213; border-color: #5C4A23; }
[data-bs-theme="dark"] .rj-tarjeta-aviso .rj-tarjeta-valor { color: #E8C987; }
[data-bs-theme="dark"] .rj-menu-contador { background: #4A1E22; color: #F5B5B5; }
[data-bs-theme="dark"] .estado-bien  { background: #13281C; border-color: #24533A; color: #8FD6A8; }
[data-bs-theme="dark"] .estado-aviso { background: #2A2213; border-color: #5C4A23; color: #E8C987; }
[data-bs-theme="dark"] .estado-alarma { background: #2A1719; border-color: #5A2A2E; color: #F2A7A7; }
[data-bs-theme="dark"] .rj-acciones .btn-primary,
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #2A6396; --bs-btn-border-color: #2A6396; --bs-btn-hover-bg: #3B78AE; --bs-btn-hover-border-color: #3B78AE; background: #2A6396; border-color: #2A6396; }
[data-bs-theme="dark"] .alert-warning { background: #2A2213; border-color: #5C4A23; color: #E8C987; }
@media (max-width: 575.98px) {
    [data-bs-theme="dark"] #tablaProcesos > tbody > tr { background: #151E29; }
}

/* El botón de tema muestra la luna en claro y el sol en oscuro. */
.rj-tema {
    width: 36px; height: 36px; flex: none;
    border: 1px solid var(--notarial-linea);
    border-radius: 8px;
    background: transparent;
    color: var(--notarial-600);
    display: inline-flex; align-items: center; justify-content: center;
}
.rj-tema .solo-oscuro { display: none; }
[data-bs-theme="dark"] .rj-tema .solo-oscuro { display: inline; }
[data-bs-theme="dark"] .rj-tema .solo-claro { display: none; }

/* El índice del manual. */
.rj-indice ol { columns: 2; column-gap: 32px; padding-left: 1.2rem; }
.rj-indice li { margin-bottom: 4px; break-inside: avoid; }
.rj-indice a { color: var(--notarial-600); text-decoration: none; }
.rj-indice a:hover { text-decoration: underline; }
@media (max-width: 575.98px) { .rj-indice ol { columns: 1; } }
[id="recorrido"], [id="que-hace"], [id="mis-procesos"], [id="novedades"], [id="proceso"],
[id="corte"], [id="buscar"], [id="alertas"], [id="sirna"], [id="administracion"],
[id="limites"], [id="correos"], [id="problemas"] { scroll-margin-top: 76px; }

/* «ver todo ▾» de los sujetos, con el mismo estilo que en el historial. */
#tablaProcesos .ver-mas {
    border: 0;
    background: none;
    padding: 0;
    margin-top: 3px;
    font-size: .74rem;
    font-weight: 600;
    color: var(--notarial-600);
    cursor: pointer;
}
#tablaProcesos .ver-mas:hover { text-decoration: underline; }

/* La salida cuando la búsqueda no deja ningún proceso. */
.rj-sin-coincidencias {
    padding: 18px 16px;
    text-align: center;
    color: var(--notarial-tenue);
    border-top: 1px solid var(--notarial-linea);
}
.rj-sin-coincidencias a { color: var(--notarial-600); font-weight: 600; }

/* Expediente documental: las acciones arriba y siempre a la vista al bajar
   por la lista dentro de la ventana. */
.rj-doc-acciones {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 0;
    background: var(--surface, #FFFFFF);
    border-bottom: 1px solid var(--notarial-linea);
}

/* El menú de la cuenta (tu nombre en la barra). */
.rj-usuario-boton {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    padding: 4px 8px 4px 4px;
    text-align: left;
}
.rj-usuario-boton:hover,
.rj-usuario-boton[aria-expanded="true"] { background: var(--notarial-050); border-color: var(--notarial-linea); }
.rj-usuario-boton .rj-flecha { width: 16px; height: 16px; color: var(--notarial-tenue); }
.rj-menu-cuenta { min-width: 260px; padding: 6px; border-radius: 10px; border-color: var(--notarial-linea); }
.rj-menu-cuenta .dropdown-item {
    display: flex; align-items: center; gap: 10px;
    border-radius: 6px; padding: 8px 10px; font-size: .9rem;
}
.rj-menu-cuenta .dropdown-item .ico { width: 17px; height: 17px; }
.rj-cuenta-cabecera { padding: 8px 10px 4px; }
.rj-menu-cuenta .solo-oscuro { display: none; }
[data-bs-theme="dark"] .rj-menu-cuenta .solo-oscuro { display: inline; }
[data-bs-theme="dark"] .rj-menu-cuenta .solo-claro { display: none; }
@media (max-width: 575.98px) { .rj-usuario-boton .rj-flecha { display: none; } }

/* Novedades: las partes del proceso, para reconocerlo sin abrirlo. */
.rj-novedad-partes {
    font-size: .84rem;
    color: var(--notarial-600);
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rj-novedad-partes.abierta { display: block; -webkit-line-clamp: unset; overflow: visible; }
.rj-ver-partes {
    border: 0; background: none; padding: 0;
    font-size: .74rem; font-weight: 600; color: var(--notarial-600); cursor: pointer;
}
.rj-ver-partes:hover { text-decoration: underline; }
