:root {
    --color-primary: #4f789f;
    --color-primary-dark: #143052;
    --color-accent: #80a8d0;
    --color-background: #f6f9fc;
    --color-surface: #ffffff;
    --color-foreground: #10243f;
    --color-muted-text: #53657a;
    --color-muted: #eef5fb;
    --color-border: #d6e0ea;
    --color-danger: #b91c1c;
    --color-warning: #9a5d0a;
    --color-focus: #4f789f;
    --color-success: #1c6b50;
    --field-background: #ffffff;
    --topbar-background: rgba(255, 255, 255, 0.94);
    --shadow-sm: 0 1px 2px rgba(16, 36, 63, 0.06);
    --shadow-md: 0 16px 40px rgba(16, 36, 63, 0.1);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --container: 1240px;
    font-family: Lato, "Segoe UI", Arial, sans-serif;
    color: var(--color-foreground);
    background: var(--color-background);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28rem),
        var(--color-background);
    font-size: 16px;
    line-height: 1.55;
}

body:has(dialog[open]) {
    overflow: hidden;
}

a {
    color: var(--color-primary);
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    touch-action: manipulation;
}

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    transform: translateY(-150%);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--color-primary-dark);
}

.skip-link:focus {
    transform: translateY(0);
}

h1,
h2,
h3 {
    margin-top: 0;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.15;
    color: var(--color-foreground);
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
    margin-bottom: 8px;
    font-size: clamp(1.4rem, 2vw, 1.75rem);
}

h3 {
    margin-bottom: 6px;
    font-size: 1.15rem;
}

p {
    margin-top: 0;
    color: var(--color-muted-text);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 10px max(24px, calc((100vw - var(--container)) / 2));
    border-bottom: 1px solid var(--color-border);
    background: var(--topbar-background);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--color-foreground);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.brand-logo-plate,
.login-logo-plate {
    display: inline-flex;
    align-items: center;
    padding: 0;
    background: transparent;
}

.brand-logo-app {
    display: block;
    width: 174px;
    height: auto;
}

/* --- Marca animada ---------------------------------------------------------
   Misma dinámica que la cabecera del sitio público: el símbolo abierto se
   desvanece y entra el cerrado con una escala y un giro muy sutiles, mientras
   el logotipo tipográfico se desplaza un par de píxeles. Solo se animan
   `opacity` y `transform`, que son las dos propiedades que la GPU resuelve sin
   reflow, y se respeta `prefers-reduced-motion`. */

.brand-symbol {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
}

.brand-symbol img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity .24s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}

.brand-symbol-closed {
    opacity: 0;
    transform: scale(1.78) rotate(-2deg);
}

.brand-wordmark {
    height: 25px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}

.brand-wordmark img {
    display: block;
    width: auto;
    height: 100%;
}

.brand:is(:hover, :focus-visible) .brand-symbol-open {
    opacity: 0;
    transform: scale(.9) rotate(2deg);
}

.brand:is(:hover, :focus-visible) .brand-symbol-closed {
    opacity: 1;
    transform: scale(2.12) rotate(0);
}

.brand:is(:hover, :focus-visible) .brand-wordmark {
    transform: translateX(2px);
}

/* La marca compuesta (pantalla de acceso y pie) no tiene una versión cerrada
   del conjunto, así que recibe el mismo tiempo y la misma curva con un
   movimiento más leve, para que se sienta la misma familia de animación. */
.brand-plate-animated {
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}

.brand-plate-animated:hover,
.brand-plate-animated:focus-within {
    transform: translateY(-2px) scale(1.015);
}

@media (prefers-reduced-motion: reduce) {
    .brand-symbol img,
    .brand-wordmark,
    .brand-plate-animated {
        transition: none;
    }

    .brand:is(:hover, :focus-visible) .brand-symbol-open,
    .brand:is(:hover, :focus-visible) .brand-symbol-closed,
    .brand:is(:hover, :focus-visible) .brand-wordmark,
    .brand-plate-animated:hover,
    .brand-plate-animated:focus-within {
        transform: none;
    }
}

.login-logo-plate {
    display: flex;
    width: fit-content;
    margin: 0 auto 22px;
}

.login-brand-logo {
    display: block;
    width: min(230px, 65vw);
    height: auto;
}

.topbar-actions,
.user-summary {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-summary {
    align-items: flex-end;
    flex-direction: column;
    gap: 0;
    line-height: 1.25;
}

.user-summary small {
    color: var(--color-muted-text);
}

.app-shell {
    width: min(calc(100% - 48px), var(--container));
    min-height: calc(100vh - 140px);
    margin: 0 auto;
    padding: 38px 0 64px;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 76px);
    place-items: center;
    padding: 40px 20px;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    width: min(calc(100% - 48px), var(--container));
    margin: 0 auto;
    padding: 22px 0 30px;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted-text);
    font-size: 0.88rem;
}

.site-footer > div {
    display: grid;
    gap: 2px;
}

.footer-brand-logo {
    width: 150px;
    height: auto;
}

.admin-report-link {
    color: var(--color-primary-dark);
    font-weight: 800;
}

.auth-card {
    width: min(100%, 460px);
    padding: clamp(28px, 6vw, 48px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.auth-return-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    margin: -10px 0 18px;
    color: var(--color-primary-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    transition: color 180ms ease;
}

.auth-return-link svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 180ms ease;
}

.auth-return-link:hover {
    color: var(--color-primary);
}

.auth-return-link:hover svg {
    transform: translateX(-3px);
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading > p:last-child {
    margin-bottom: 0;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--color-primary);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stack-form {
    display: grid;
    gap: 18px;
}

label,
legend {
    color: var(--color-foreground);
    font-size: 0.93rem;
    font-weight: 700;
}

label small {
    display: block;
    margin-top: 5px;
    color: var(--color-muted-text);
    font-weight: 400;
}

input,
textarea,
select {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
    padding: 11px 13px;
    border: 1px solid #b4c4d5;
    border-radius: var(--radius-sm);
    color: var(--color-foreground);
    background: var(--field-background);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
    border-color: #8193ab;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 120, 159, 0.18);
}

.password-field {
    position: relative;
    display: block;
    margin-top: 7px;
}

.password-field input {
    margin-top: 0;
    padding-right: 88px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-width: 70px;
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    color: var(--color-primary);
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.password-toggle:hover {
    background: var(--color-muted);
}

.date-picker-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
    margin-top: 7px;
}

.date-picker-control input {
    min-width: 0;
    margin-top: 0;
    font-variant-numeric: tabular-nums;
}

.date-picker-control input[type="date"]::-webkit-calendar-picker-indicator {
    width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
}

.date-picker-control button {
    display: inline-grid;
    width: 48px;
    min-height: 48px;
    place-items: center;
    padding: 0;
    border: 1px solid #b4c4d5;
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    background: var(--field-background);
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.date-picker-control button:hover {
    border-color: var(--color-primary);
    background: var(--color-muted);
}

.date-picker-control button:focus-visible {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 120, 159, 0.18);
}

.date-picker-control svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.subfield-label {
    display: block;
    margin-top: 11px;
    color: var(--color-muted-text);
    font-size: 0.8rem;
    font-weight: 700;
}

.subfield-label + select {
    margin-top: 5px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 750;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.button-primary {
    color: #fff;
    background: var(--color-primary);
    box-shadow: 0 5px 14px rgba(20, 48, 82, 0.2);
}

.button-primary:hover {
    background: var(--color-primary-dark);
}

.button-quiet {
    color: var(--color-primary-dark);
    border-color: var(--color-border);
    background: #fff;
}

.button-quiet:hover {
    border-color: #a9b8cb;
    background: var(--color-muted);
}

.button-danger,
.button-danger-outline {
    color: #fff;
    background: var(--color-danger);
}

.button-danger:hover {
    background: #991b1b;
}

.button-danger-outline {
    color: var(--color-danger);
    border-color: #fecaca;
    background: #fff;
}

.button-danger-outline:hover {
    background: #fef2f2;
}

.button-block {
    width: 100%;
}

.security-note {
    margin: 20px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
    font-size: 0.86rem;
}

.alert {
    margin-bottom: 22px;
    padding: 13px 16px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.alert-success {
    color: #065f46;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.alert-error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.alert-warning {
    color: #78350f;
    border-color: #fde68a;
    background: #fffbeb;
}

.page-heading,
.case-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 30px;
}

.page-heading > div:first-child,
.case-header > div:first-child {
    max-width: 760px;
}

.page-heading p:last-child,
.case-header p:last-child {
    margin-bottom: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.summary-card {
    display: grid;
    min-height: 142px;
    align-content: center;
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.summary-card span,
.summary-card small {
    color: var(--color-muted-text);
}

.summary-card strong {
    margin: 3px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    line-height: 1;
}

.panel {
    padding: clamp(20px, 4vw, 30px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.narrow-panel {
    width: min(100%, 620px);
    margin: 0 auto;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-heading p,
.section-heading h2 {
    margin-bottom: 0;
}

.section-heading > span {
    color: var(--color-muted-text);
    white-space: nowrap;
}

.case-list {
    display: grid;
    gap: 10px;
}

.case-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 116px;
    padding: 18px 20px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    color: inherit;
    background: var(--color-surface);
    text-decoration: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.case-card:hover {
    border-color: #9db1cd;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
    transform: translateY(-1px);
}

.case-card h3 {
    margin: 5px 0;
}

.case-card p {
    margin: 0;
}

.case-reference {
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.case-meta {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.status,
.unread,
.visibility-private,
.visibility-public {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
}

.status-active {
    color: #065f46;
    background: #d1fae5;
}

.status-grace {
    color: #78350f;
    background: #fef3c7;
}

.status-closed,
.status-archived {
    color: #475569;
    background: #e2e8f0;
}

.unread {
    color: #1e40af;
    background: #dbeafe;
}

.empty-state {
    padding: 42px 20px;
    border: 1px dashed #b8c6d8;
    border-radius: 11px;
    text-align: center;
    background: #fbfdff;
}

.empty-state p {
    margin-bottom: 0;
}

.modal {
    width: min(calc(100% - 32px), 720px);
    max-height: calc(100vh - 40px);
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(2px);
}

.modal > form {
    padding: clamp(22px, 5vw, 34px);
}

.modal-small {
    max-width: 520px;
}

.modal-heading,
.modal-actions,
.header-actions,
.heading-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-heading {
    align-items: flex-start;
    justify-content: space-between;
}

.modal-heading h2,
.modal-heading p {
    margin-bottom: 0;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 4px;
}

.icon-button {
    display: inline-grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--color-muted-text);
    background: var(--color-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.icon-button:hover {
    color: var(--color-foreground);
    background: #e2e8f0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 10px 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.radio-option {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    margin-right: 14px;
    font-weight: 500;
}

.radio-option input {
    display: inline-block;
    width: 18px;
    min-height: 18px;
    margin: 0;
}

.breadcrumbs {
    display: flex;
    gap: 9px;
    margin-bottom: 22px;
    color: var(--color-muted-text);
    font-size: 0.9rem;
}

.breadcrumbs a {
    font-weight: 700;
    text-decoration: none;
}

.case-header {
    align-items: flex-start;
}

.heading-meta {
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
    gap: 22px;
    align-items: start;
}

.side-column {
    display: grid;
    gap: 22px;
}

.compact-panel {
    padding: 22px;
}

.data-list {
    display: grid;
    gap: 0;
    margin: 18px 0 0;
}

.data-list > div {
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
}

.data-list dt {
    margin-bottom: 3px;
    color: var(--color-muted-text);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-list dd {
    margin: 0;
    font-weight: 700;
}

.timeline {
    position: relative;
    display: grid;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 16px;
    padding-bottom: 26px;
}

.timeline-item:not(:last-child)::before {
    position: absolute;
    top: 14px;
    bottom: -4px;
    left: 7px;
    width: 2px;
    content: "";
    background: var(--color-border);
}

.timeline-marker {
    position: relative;
    z-index: 1;
    width: 16px;
    height: 16px;
    margin-top: 4px;
    border: 4px solid #bfdbfe;
    border-radius: 50%;
    background: var(--color-primary);
}

.timeline-content {
    min-width: 0;
}

.timeline-content > p {
    margin-bottom: 12px;
    color: #334155;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.timeline-meta time {
    color: var(--color-muted-text);
    font-size: 0.82rem;
    font-weight: 700;
}

.visibility-private {
    color: #7c2d12;
    background: #ffedd5;
}

.visibility-public {
    color: #065f46;
    background: #d1fae5;
}

.document-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-foreground);
    background: var(--color-surface);
    text-decoration: none;
}

.document-link:hover {
    border-color: #9db1cd;
    background: var(--color-muted);
}

.document-link > span:first-child {
    color: var(--color-danger);
    font-size: 0.72rem;
    font-weight: 900;
}

.document-link strong,
.document-link small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-link small {
    color: var(--color-muted-text);
}

.chat-panel {
    position: sticky;
    top: 94px;
}

.messages {
    display: grid;
    gap: 10px;
    max-height: 390px;
    margin-bottom: 16px;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.message {
    width: min(92%, 340px);
    padding: 10px 12px;
    border-radius: 4px 12px 12px 12px;
    background: var(--color-muted);
}

.message-own {
    justify-self: end;
    border-radius: 12px 4px 12px 12px;
    background: #dbeafe;
}

.message strong,
.message time {
    display: block;
    font-size: 0.75rem;
}

.message p {
    margin: 4px 0;
    color: var(--color-foreground);
    overflow-wrap: anywhere;
}

.message time {
    color: var(--color-muted-text);
    text-align: right;
}

.chat-empty {
    padding: 18px;
    border-radius: var(--radius-sm);
    text-align: center;
    background: var(--color-muted);
}

.chat-form {
    display: grid;
    gap: 10px;
}

.chat-form textarea {
    margin: 0;
}

.theme-toggle {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-primary-dark);
    background: var(--color-surface);
    font-weight: 750;
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--color-muted);
}

.theme-toggle [data-theme-icon] {
    font-size: 1.1rem;
    line-height: 1;
}

.theme-toggle-floating {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
    gap: 22px;
    align-items: start;
}

.hearings-panel {
    position: sticky;
    top: 94px;
}

.hearing-list,
.report-list,
.client-report-list,
.assignment-history {
    display: grid;
    gap: 12px;
}

.hearing-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
}

.hearing-card > time {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 64px;
    border-radius: 10px;
    border: 1px solid rgba(128, 168, 208, 0.55);
    color: #fff;
    background: #143052;
    line-height: 1.15;
}

.hearing-card > time strong {
    color: inherit;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    white-space: nowrap;
}

.hearing-card > time span {
    margin-top: 4px;
    font-size: 0.7rem;
}

.hearing-card h3,
.hearing-card p {
    margin-bottom: 4px;
}

.hearing-relative {
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hearing-card.is-reminder-due {
    border-color: #e2a832;
    box-shadow: inset 4px 0 #e2a832;
}

.hearing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 800;
}

.compact-empty {
    padding: 24px 14px;
}

.case-card-identifiers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.case-number {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--color-muted-text);
    background: var(--color-muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.data-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.data-heading h2,
.data-heading p {
    margin-bottom: 0;
}

.activity-hearing,
.confidential-note,
.admin-privacy-note {
    margin: 12px 0;
    padding: 12px 14px;
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-foreground);
    background: var(--color-muted);
}

.activity-hearing strong,
.activity-hearing span {
    display: block;
}

.activity-hearing span {
    color: var(--color-muted-text);
    font-size: 0.84rem;
}

.process-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.assignment-item,
.client-report-card {
    padding: 13px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-muted);
}

a.client-report-card {
    color: inherit;
    text-decoration: none;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

a.client-report-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.report-open-label {
    color: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 800;
}

.assignment-item p,
.client-report-card p {
    margin-bottom: 4px;
}

.reports-panel {
    margin-top: 22px;
}

.report-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.28fr);
    gap: 22px;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
}

.report-card h3 {
    margin-top: 10px;
}

.inline-status-form {
    display: grid;
    align-content: start;
    gap: 10px;
}

.report-status-new {
    color: #7c2d12;
    background: #ffedd5;
}

.report-status-reviewing {
    color: #1e40af;
    background: #dbeafe;
}

.report-status-closed {
    color: #475569;
    background: #e2e8f0;
}

.report-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 22px;
    align-items: start;
}

.confidential-note {
    margin-top: 0;
    margin-bottom: 22px;
    border-left-color: var(--color-success);
    font-size: 0.9rem;
}

.report-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
    gap: 22px;
    align-items: start;
}

.report-main-column {
    display: grid;
    gap: 22px;
}

.report-original > p:last-of-type {
    color: var(--color-foreground);
    white-space: normal;
}

.report-case-context {
    display: grid;
    gap: 3px;
    margin-top: 18px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}

.report-case-context span {
    color: var(--color-muted-text);
}

.report-status-control {
    display: flex;
    align-items: end;
    gap: 10px;
    min-width: min(100%, 330px);
}

.report-status-control label {
    flex: 1;
}

.report-messages {
    display: grid;
    gap: 10px;
    max-height: 520px;
    margin-bottom: 20px;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.report-message-form {
    display: grid;
    gap: 14px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.report-evidence-panel {
    position: sticky;
    top: 94px;
}

.report-evidence-list {
    display: grid;
    gap: 10px;
}

.report-evidence-list .document-link {
    width: 100%;
}

html[data-theme="dark"] {
    --color-primary: #c9a962;
    --color-primary-dark: #f0ede8;
    --color-accent: #dfc07a;
    --color-background: #0d0f13;
    --color-surface: #161a22;
    --color-foreground: #f0ede8;
    --color-muted-text: #a4aab5;
    --color-muted: #202631;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-danger: #ff8d8d;
    --color-warning: #dfc07a;
    --color-focus: #dfc07a;
    --color-success: #2ecc8b;
    --field-background: #11151c;
    --topbar-background: rgba(13, 15, 19, 0.94);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at top right, rgba(201, 169, 98, 0.08), transparent 28rem),
        var(--color-background);
}

html[data-theme="dark"] .brand-logo-plate,
html[data-theme="dark"] .login-logo-plate {
    padding: 6px 10px;
    border-radius: 8px;
    background: #f6f9fc;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .footer-brand-logo {
    padding: 4px 8px;
    border-radius: 6px;
    background: #f6f9fc;
}

html[data-theme="dark"] .hearing-card > time {
    border-color: rgba(223, 192, 122, 0.55);
    color: #f0ede8;
    background: #252b35;
}

html[data-theme="dark"] .hearing-card > time span {
    color: #d2d7df;
}

html[data-theme="dark"] .button-primary {
    color: #101319;
    background: #c9a962;
}

html[data-theme="dark"] .button-primary:hover {
    background: #dfc07a;
}

html[data-theme="dark"] .button-quiet,
html[data-theme="dark"] .button-danger-outline {
    color: var(--color-foreground);
    background: var(--color-surface);
}

html[data-theme="dark"] .case-card:hover,
html[data-theme="dark"] .document-link:hover,
html[data-theme="dark"] .icon-button:hover {
    border-color: rgba(223, 192, 122, 0.5);
    background: var(--color-muted);
}

html[data-theme="dark"] .timeline-content > p {
    color: var(--color-foreground);
}

html[data-theme="dark"] .message-own {
    background: rgba(201, 169, 98, 0.19);
}

html[data-theme="dark"] .empty-state {
    border-color: var(--color-border);
    background: rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .alert-success {
    color: #a7f3d0;
    border-color: rgba(46, 204, 139, 0.35);
    background: rgba(46, 204, 139, 0.1);
}

html[data-theme="dark"] .alert-error {
    color: #fecaca;
    border-color: rgba(255, 141, 141, 0.38);
    background: rgba(185, 28, 28, 0.14);
}

html[data-theme="dark"] .status-active,
html[data-theme="dark"] .visibility-public {
    color: #a7f3d0;
    background: rgba(46, 204, 139, 0.14);
}

html[data-theme="dark"] .status-grace,
html[data-theme="dark"] .visibility-private,
html[data-theme="dark"] .report-status-new {
    color: #fde68a;
    background: rgba(201, 169, 98, 0.15);
}

html[data-theme="dark"] .unread,
html[data-theme="dark"] .report-status-reviewing {
    color: #bfdbfe;
    background: rgba(79, 120, 159, 0.24);
}

.dashboard-layout-admin {
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.55fr);
    align-items: start;
}

.dashboard-filter,
.calendar-toolbar,
.report-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}

.dashboard-filter label,
.calendar-toolbar label,
.report-filter-form label {
    flex: 1 1 210px;
    margin: 0;
}

.management-sidebar {
    display: grid;
    gap: 18px;
}

.management-panel {
    padding: 22px;
}

.management-panel .section-heading {
    align-items: flex-start;
    gap: 12px;
}

.management-panel .section-heading > a {
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 800;
}

.management-event-list,
.recent-change-list,
.team-list,
.agenda-event-list {
    display: grid;
    gap: 10px;
}

.management-event {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.management-event:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.management-event time,
.agenda-event-row > time {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 58px;
    border-radius: 9px;
    color: #fff;
    background: #143052;
    line-height: 1.15;
}

.management-event time span,
.agenda-event-row > time span {
    margin-top: 3px;
    font-size: 0.7rem;
}

.management-event h3,
.management-event p,
.recent-change-list strong,
.recent-change-list small {
    margin: 2px 0 0;
}

.event-type-label {
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.recent-change-list a {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    color: inherit;
    text-decoration: none;
}

.recent-change-list a:hover {
    border-color: var(--color-primary);
    background: var(--color-muted);
}

.recent-change-list span,
.recent-change-list small {
    color: var(--color-muted-text);
    font-size: 0.76rem;
}

.team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    background: var(--color-surface);
}

.team-name-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.team-row h3,
.team-row p {
    margin: 0 0 3px;
}

.calendar-toolbar-panel,
.report-filter-panel {
    padding-bottom: 4px;
}

.calendar-heading,
.period-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.period-navigation {
    margin-bottom: 22px;
    padding-block: 18px;
}

.calendar-heading h2,
.period-navigation h2 {
    margin: 0;
    text-align: center;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    margin-top: 20px;
    border: 1px solid var(--color-border);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.calendar-weekdays span {
    padding: 9px;
    color: var(--color-muted-text);
    background: var(--color-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.calendar-grid {
    border-top: 1px solid var(--color-border);
    border-left: 1px solid var(--color-border);
}

.calendar-day {
    min-width: 0;
    min-height: 142px;
    padding: 9px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.calendar-day > time {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 800;
}

.calendar-day.is-outside {
    opacity: 0.42;
    background: var(--color-muted);
}

.calendar-day.is-today > time {
    color: #fff;
    background: var(--color-primary);
}

.calendar-day-events {
    display: grid;
    gap: 5px;
    margin-top: 7px;
}

.calendar-event {
    min-width: 0;
    padding: 6px 7px;
    border-left: 3px solid var(--color-primary);
    border-radius: 5px;
    background: var(--color-muted);
    font-size: 0.7rem;
}

.calendar-event span,
.calendar-event strong,
.calendar-event small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-hearing {
    border-left-color: #b7791f;
    background: rgba(226, 168, 50, 0.14);
}

.calendar-event-client_appointment,
.calendar-event-new_client {
    border-left-color: var(--color-success);
}

.calendar-event-meeting {
    border-left-color: #4f789f;
}

.calendar-more {
    color: var(--color-muted-text);
    font-size: 0.7rem;
}

.agenda-event-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
}

.agenda-event-row h3,
.agenda-event-row p {
    margin: 2px 0 0;
}

.agenda-row-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.responsive-table {
    max-width: 100%;
    overflow-x: auto;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.metrics-table th,
.metrics-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.metrics-table thead th {
    color: var(--color-muted-text);
    background: var(--color-muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metrics-table tbody th {
    min-width: 190px;
    text-align: left;
}

.metrics-table tbody th small {
    display: block;
    margin-top: 3px;
    color: var(--color-danger);
}

html[data-theme="dark"] .management-event time,
html[data-theme="dark"] .agenda-event-row > time {
    border: 1px solid rgba(223, 192, 122, 0.45);
    color: #f0ede8;
    background: #252b35;
}

@media (max-width: 900px) {
    .detail-grid,
    .dashboard-layout,
    .report-page-grid,
    .report-detail-grid {
        grid-template-columns: 1fr;
    }

    .chat-panel,
    .hearings-panel,
    .report-evidence-panel {
        position: static;
    }
}

@media (max-width: 700px) {
    .topbar {
        padding: 10px 16px;
    }

    .user-summary {
        display: none;
    }

    .brand-logo-app {
        width: 142px;
    }

    .theme-toggle-label {
        display: none;
    }

    .app-shell {
        width: min(calc(100% - 28px), var(--container));
        padding-top: 26px;
    }

    .page-heading,
    .case-header,
    .site-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading .button,
    .header-actions .button {
        flex: 1;
    }

    .summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .summary-card {
        min-height: 104px;
    }

    .case-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .case-meta {
        justify-items: start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-actions .button {
        width: 100%;
    }

    .report-card {
        grid-template-columns: 1fr;
    }

    .report-status-control {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-heading,
    .period-navigation,
    .team-row,
    .agenda-event-row {
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-heading,
    .period-navigation {
        display: flex;
    }

    .team-row {
        display: flex;
    }

    .team-row form,
    .team-row .button {
        width: 100%;
    }

    .calendar-weekdays {
        display: none;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        border: 0;
    }

    .calendar-day {
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr);
        min-height: 0;
        border: 1px solid var(--color-border);
        border-radius: 9px;
    }

    .calendar-day.is-outside {
        display: none;
    }

    .calendar-day-events {
        margin-top: 0;
    }

    .calendar-event span,
    .calendar-event strong,
    .calendar-event small {
        white-space: normal;
    }

    .agenda-event-row {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .agenda-row-actions {
        grid-column: 1 / -1;
        justify-items: stretch;
    }
}

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

/* ==========================================================================
   VIGILANCIA PROCESAL — módulo judicial
   Estilos de la pantalla de procesos por juzgado y de la ficha del proceso.
   Se añaden al final para no tocar ninguna regla existente.
   ========================================================================== */

.topbar-link {
    font-size: 0.86rem;
    padding: 8px 14px;
}

.judicial-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin: 0 0 22px;
}

.judicial-stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.judicial-stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    line-height: 1.1;
}

.judicial-stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted-text);
}

.judicial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 20px;
    margin-bottom: 22px;
}

.judicial-grid-wide {
    grid-template-columns: minmax(320px, 2fr) minmax(280px, 1fr);
}

.judicial-scan-form { margin: 0; }
.judicial-heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.judicial-hint {
    font-size: 0.86rem;
    color: var(--color-muted-text);
    line-height: 1.6;
}

.judicial-hint code {
    background: var(--color-muted);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.82rem;
}

.judicial-filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.judicial-filters label { margin: 0; font-size: 0.85rem; }
.judicial-filter-grow { flex: 1 1 200px; }

.judicial-table-wrap { overflow-x: auto; }

.judicial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.judicial-table th {
    text-align: left;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-muted-text);
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.judicial-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.judicial-table tr:hover td { background: var(--color-muted); }

.judicial-name {
    display: block;
    font-weight: 700;
    color: var(--color-primary-dark);
    text-decoration: none;
}

.judicial-radicado {
    display: inline-block;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    color: var(--color-muted-text);
    background: var(--color-muted);
    padding: 2px 7px;
    border-radius: 5px;
    margin-top: 4px;
}

.judicial-dep {
    display: block;
    font-size: 0.76rem;
    color: var(--color-muted-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.judicial-radicado-line { font-size: 0.9rem; }

.judicial-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--color-muted);
    color: var(--color-muted-text);
    white-space: nowrap;
}

.judicial-pill-activo { background: #e3f2ea; color: var(--color-success); }
.judicial-pill-terminado { background: #eef1f5; color: var(--color-muted-text); }
.judicial-pill-archivado { background: #fdf2e3; color: var(--color-warning); }
.judicial-pill-new { background: #e7efff; color: var(--color-primary-dark); }
.judicial-pill-ok { background: #e3f2ea; color: var(--color-success); }
.judicial-pill-error { background: #fdecec; color: var(--color-danger); }

.judicial-inline { display: inline; margin: 0; }

.judicial-switch {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-muted-text);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.76rem;
    cursor: pointer;
    white-space: nowrap;
}

.judicial-switch.is-on {
    background: #e3f2ea;
    border-color: #b6dcc8;
    color: var(--color-success);
    font-weight: 700;
}

.judicial-open { font-size: 0.82rem; padding: 6px 12px; }

.judicial-despacho-list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow-y: auto; }

.judicial-despacho {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    background: var(--color-surface);
}

.judicial-despacho:hover { background: var(--color-muted); }
.judicial-despacho strong { display: block; font-size: 0.9rem; color: var(--color-primary-dark); }
.judicial-despacho small { font-size: 0.76rem; color: var(--color-muted-text); }
.judicial-despacho-nums { text-align: right; }

.judicial-badge {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    background: var(--color-primary-dark);
    color: #fff;
    border-radius: 999px;
    padding: 3px 9px;
    font-weight: 700;
    font-size: 0.82rem;
}

.judicial-pending, .judicial-runs { list-style: none; margin: 0; padding: 0; }

.judicial-pending li a {
    display: block;
    padding: 11px 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
}

.judicial-pending li a:hover strong { color: var(--color-primary); }
.judicial-pending strong { display: block; font-size: 0.9rem; color: var(--color-primary-dark); }
.judicial-pending span { display: block; font-size: 0.8rem; color: var(--color-muted-text); }
.judicial-pending time { font-size: 0.76rem; color: var(--color-muted-text); }

.judicial-runs li {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
}

.judicial-runs time { display: block; font-weight: 700; color: var(--color-primary-dark); }
.judicial-runs span { display: block; color: var(--color-muted-text); font-size: 0.8rem; }
.judicial-runs small { color: var(--color-muted-text); font-size: 0.75rem; }

.judicial-ficha {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 0 0 8px;
}

.judicial-ficha dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-muted-text);
}

.judicial-ficha dd { margin: 2px 0 0; font-weight: 600; color: var(--color-foreground); }

.judicial-subtitle {
    font-size: 0.9rem;
    margin: 22px 0 10px;
    color: var(--color-primary-dark);
}

.judicial-partes { list-style: none; margin: 0; padding: 0; }
.judicial-partes li {
    padding: 9px 12px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 7px;
}
.judicial-partes strong { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted-text); }
.judicial-partes span { font-size: 0.9rem; }

.judicial-timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.judicial-timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--color-border);
}
.judicial-timeline li { position: relative; padding: 0 0 22px 12px; }
.judicial-timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 3px solid var(--color-accent);
}
.judicial-timeline li.is-fresh .judicial-timeline-dot {
    border-color: var(--color-primary-dark);
    background: var(--color-primary-dark);
}
.judicial-timeline li.is-fresh .judicial-timeline-body {
    background: #f4f8ff;
    border-color: #cfdff7;
}
.judicial-timeline-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
}
.judicial-timeline-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.judicial-timeline-head time { font-weight: 700; font-size: 0.86rem; color: var(--color-primary-dark); }
.judicial-timeline-body h3 { margin: 0 0 6px; font-size: 0.98rem; }
.judicial-timeline-body p { margin: 0; font-size: 0.88rem; color: var(--color-muted-text); line-height: 1.6; }

/* ==========================================================================
   CITAS DE LA WEB Y ARTICULOS
   Estados de la agenda publica y del blog. Mismo criterio de color que arriba.
   ========================================================================== */

.judicial-pill-pending { background: #fdf2e3; color: var(--color-warning); }
.judicial-pill-confirmed { background: #e3f2ea; color: var(--color-success); }
.judicial-pill-completed { background: #eef1f5; color: var(--color-muted-text); }
.judicial-pill-cancelled { background: #fdecec; color: var(--color-danger); }
.judicial-pill-published { background: #e3f2ea; color: var(--color-success); }
.judicial-pill-draft { background: #eef1f5; color: var(--color-muted-text); }

/* El listado lateral de articulos reutiliza el de pendientes judiciales. */
.compact-panel .judicial-pending a { display: block; }
.compact-panel .judicial-pending time { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--color-muted-text); }
.compact-panel .judicial-pending .judicial-pill { margin-top: 4px; }

/* El editor de articulos respira mejor con campos anchos y separados. */
.stack-form textarea { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 0.9rem; line-height: 1.6; }
.stack-form small { display: block; margin-top: 5px; font-size: 0.82rem; color: var(--color-muted-text); line-height: 1.5; }
.stack-form code { background: var(--color-muted); border-radius: 4px; padding: 1px 5px; font-size: 0.85em; }

@media (max-width: 860px) {
    .judicial-grid-wide { grid-template-columns: 1fr; }
}

/* ── Editor de articulos: imagen, destacado y optimizador SEO ─────────── */
.judicial-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.judicial-check input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin: 0;
}
.judicial-imagen-actual {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}
/* La vista previa se acota para que una foto vertical o un poster 4:5 no
   empuje el resto del formulario fuera de la pantalla. */
.judicial-imagen-actual img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 300px;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}
.judicial-inline-form {
    margin-top: 8px;
}
.button-mini {
    min-height: 0;
    padding: 7px 13px;
    font-size: 0.78rem;
}
.muted-small {
    margin: 8px 0;
    color: var(--color-muted-text);
    font-size: 0.84rem;
    line-height: 1.55;
}
.seo-fila {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border);
}
.seo-fila:last-child {
    border-bottom: 0;
}
.seo-fila textarea {
    font-size: 0.85rem;
}
.seo-fila small {
    color: var(--color-muted-text);
    font-size: 0.78rem;
}
#seo-resultado {
    margin-top: 16px;
}
#seo-resultado ul {
    margin: 6px 0 14px;
    padding-left: 20px;
}
#seo-resultado li {
    margin: 4px 0;
}

/* ── Carga de articulos desde un archivo .md ──────────────────────────── */
.cargador-md {
    margin-bottom: 28px;
    padding: 18px 20px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}
.cargador-md .section-heading {
    margin-bottom: 8px;
}
.cargador-md input[type="file"] {
    max-width: 100%;
    background: var(--field-background);
}

.cargador-md .cargador-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cargador-md .cargador-fila {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.cargador-md .cargador-fila input[type="file"] {
    flex: 1 1 240px;
}

/* ── Barra de progreso del optimizador SEO ────────────────────────────── */
.seo-progreso {
    margin: 14px 0 4px;
}
.seo-barra {
    height: 8px;
    border-radius: 99px;
    background: var(--color-border);
    overflow: hidden;
}
.seo-barra span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 99px;
    background: var(--color-primary);
    transition: width 0.45s ease;
}
.seo-progreso .muted-small {
    margin: 8px 0 0;
    font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   MÓDULO REDES SOCIALES (INSTAGRAM + TIKTOK) — Estilo Metricool
   ========================================================================== */

.social-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.social-tab {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-muted-text);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.social-tab:hover {
    background: var(--color-muted);
    color: var(--color-foreground);
}

.social-tab.is-active {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.social-composer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.95fr);
    gap: 22px;
    align-items: start;
    margin-bottom: 24px;
}

@media (max-width: 980px) {
    .social-composer-grid {
        grid-template-columns: 1fr;
    }
}

.social-two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.social-platform-picker {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}

.social-platform-picker legend {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0 6px;
    color: var(--color-primary-dark);
}

.social-platform-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.social-platform-Toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
    margin: 0;
}

.social-platform-Toggle input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin: 0;
}

.social-platform-Toggle strong {
    display: block;
    font-size: 0.92rem;
    color: var(--color-foreground);
}

.social-platform-Toggle small {
    display: block;
    margin: 0;
    font-size: 0.76rem;
    color: var(--color-muted-text);
}

.social-platform-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
}

.social-badge-ig {
    background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af);
}

.social-badge-tt {
    background: #111827;
    box-shadow: inset 2px 0 0 #00f2fe, inset -2px 0 0 #fe0979;
}

.social-option-card {
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-option-card h3 {
    margin: 0 0 4px;
    font-size: 0.96rem;
}

.social-submit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.social-preview-switcher {
    display: flex;
    gap: 6px;
}

.social-preview-switcher .is-active {
    background: var(--color-primary-dark);
    color: #fff;
}

/* Simulador de teléfono móvil */
.social-phone-mockup {
    max-width: 310px;
    margin: 8px auto 0;
    padding: 12px;
    border-radius: 34px;
    background: #0f172a;
    border: 3px solid #334155;
    box-shadow: var(--shadow-md);
    color: #fff;
}

.social-phone-notch {
    width: 90px;
    height: 14px;
    margin: 0 auto 10px;
    border-radius: 99px;
    background: #1e293b;
}

.social-phone-screen {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background: #090d16;
    min-height: 490px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.social-phone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.78);
    font-size: 0.75rem;
    z-index: 2;
}

.social-phone-network-pill {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.14);
}

.social-phone-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 290px;
    max-height: 360px;
    background: #111827;
    overflow: hidden;
}

.social-phone-media video,
.social-phone-media img {
    width: 100%;
    height: 100%;
    max-height: 360px;
    object-fit: cover;
    display: block;
}

.social-phone-placeholder {
    padding: 24px 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
}

.social-phone-placeholder strong {
    display: block;
    font-size: 1.2rem;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.social-phone-overlay {
    padding: 12px 14px;
    background: linear-gradient(to top, rgba(9, 13, 22, 0.96), rgba(9, 13, 22, 0.72));
}

.social-phone-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.social-phone-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.social-phone-caption {
    margin: 0;
    color: #e2e8f0;
    font-size: 0.78rem;
    line-height: 1.45;
    max-height: 92px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Calendario mensual estilo Metricool */
.social-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.social-calendar-day-head {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted-text);
    padding: 6px 8px;
    text-align: center;
}

.social-calendar-cell {
    min-height: 122px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.social-calendar-cell.is-empty {
    background: var(--color-muted);
    opacity: 0.55;
}

.social-calendar-cell.is-today {
    border: 2px solid var(--color-primary);
}

.social-calendar-cell-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.social-calendar-day-num {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--color-primary-dark);
}

.social-calendar-add {
    font-size: 0.72rem;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-muted);
    color: var(--color-primary-dark);
    font-weight: 700;
}

.social-calendar-add:hover {
    background: var(--color-primary);
    color: #fff;
}

.social-calendar-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.social-calendar-event {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 5px 6px;
    border-radius: 6px;
    background: var(--color-muted);
    border-left: 3px solid var(--color-primary);
    font-size: 0.74rem;
    text-decoration: none;
    color: var(--color-foreground);
}

.social-calendar-event.status-published {
    border-left-color: var(--color-success);
}

.social-calendar-event.status-failed {
    border-left-color: var(--color-danger);
}

.social-calendar-event-time {
    font-weight: 700;
    color: var(--color-primary-dark);
}

.social-calendar-event-title {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.social-oauth-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 18px;
}

@media (max-width: 760px) {
    .social-calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .social-calendar-day-head {
        display: none;
    }
}


/* ── Novedades v2: Selector de Formato, Orden de Miniaturas y Música ─────── */

.social-format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.social-format-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 13px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
    margin: 0;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.social-format-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.social-format-card strong {
    font-size: 0.92rem;
    color: var(--color-foreground);
}

.social-format-card small {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-muted-text);
    line-height: 1.35;
}

.social-format-card.is-selected {
    border-color: var(--color-primary);
    background: rgba(79, 120, 159, 0.12);
}

.social-thumbnails-wrapper {
    margin-top: 14px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.social-thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 0.84rem;
}

.social-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}

.social-thumb-card {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    flex-direction: column;
}

.social-thumb-card.is-active-slide {
    border-color: var(--color-primary);
}

.social-thumb-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 2px 7px;
    border-radius: 99px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
}

.social-thumb-media {
    width: 100%;
    height: 110px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-thumb-media img,
.social-thumb-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.social-thumb-actions {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 5px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.social-thumb-btn {
    flex: 1;
    min-height: 26px;
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-muted);
    color: var(--color-foreground);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}

.social-thumb-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.social-music-box {
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-muted);
}

.social-phone-media-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
}

.social-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 30px;
    height: 30px;
    min-height: 0;
    border-radius: 50%;
    border: 0;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-carousel-nav.is-prev { left: 8px; }
.social-carousel-nav.is-next { right: 8px; }

.social-carousel-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    padding: 2px 8px;
    border-radius: 99px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.social-phone-music-tag {
    display: block;
    margin-top: 6px;
    color: #93c5fd;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
