/* Menú lateral: forzar contraste (MudBlazor no debe pintar aquí) */
.nexus-sidebar a,
.nexus-sidebar a:visited {
    color: rgba(255, 255, 255, 0.7);
}

:root,
[data-theme="light"] {
    /* Tequinson corporate palette */
    --nexus-brand:       #0D1B2A;   /* carbón profundo — sidebar */
    --nexus-action:      #3A7DAE;   /* azul corporativo — primary */
    --nexus-action-deep: #2C6590;   /* pressed/hover */
    --nexus-green:       #5FA882;   /* sage green accent */
    --nexus-success:     #5FA882;
    --nexus-error:       #B83A3A;
    --nexus-warning:     #C97C30;
    --nexus-accent-obo:  #7A6EA8;
    /* surfaces */
    --nexus-bg:          #F7F8FA;   /* fondo main, mínimo tinte */
    --nexus-surface:     #FFFFFF;
    --nexus-surface-2:   #F5F7F9;
    --nexus-border:      #E8ECF0;   /* borde único, consistente */
    --nexus-text:        #1A2B3C;
    --nexus-text-strong: #0D1B2A;
    --nexus-text-muted:  #7A8B98;
    --nexus-text-soft:   #5A7080;
    --nexus-hover:       #F0F4F8;
    --nexus-topbar-bg:   rgba(255, 255, 255, 0.96);
    --nexus-topbar-line: #EEF1F5;
    --nexus-shadow:      rgba(13, 27, 42, 0.12);
    --nexus-shadow-soft: rgba(13, 27, 42, 0.04);
    --nexus-topbar-h:    56px;
    --nexus-main-pad-y:  3.5rem;
}

[data-theme="dark"] {
    --nexus-brand:       #0D1B2A;
    --nexus-action:      #5B9BC8;
    --nexus-action-deep: #3A7DAE;
    --nexus-green:       #6FBA94;
    --nexus-success:     #6FBA94;
    --nexus-error:       #D45A5A;
    --nexus-warning:     #D4924A;
    --nexus-accent-obo:  #9A8EC8;
    --nexus-bg:          #0F1419;
    --nexus-surface:     #1A2332;
    --nexus-surface-2:   #151C26;
    --nexus-border:      #2A3544;
    --nexus-text:        #E8F0F7;
    --nexus-text-strong: #F3F7FB;
    --nexus-text-muted:  #9AADB8;
    --nexus-text-soft:   #8A9BAE;
    --nexus-hover:       #243041;
    --nexus-topbar-bg:   rgba(21, 28, 38, 0.96);
    --nexus-topbar-line: #2A3544;
    --nexus-shadow:      rgba(0, 0, 0, 0.45);
    --nexus-shadow-soft: rgba(0, 0, 0, 0.25);
}

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    background: var(--nexus-bg);
    color: var(--nexus-text);
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

/* Toggle de tema (topbar + login) */
.nexus-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--nexus-action);
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.nexus-theme-btn:hover {
    background: var(--nexus-hover);
    color: var(--nexus-action-deep);
}

.nexus-theme-btn svg {
    display: block;
}

.login-layout {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

.login-theme-slot {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
}

.nexus-theme-btn--login {
    width: 42px;
    height: 42px;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-border);
    box-shadow: 0 2px 8px var(--nexus-shadow-soft);
}

.nexus-theme-btn--login:hover {
    background: var(--nexus-hover);
}


/*
  Inputs densos outlined: altura fija + padding vertical 0
  para que el texto quede centrado (MudBlazor + font-size custom).
*/
.mud-input.mud-input-outlined.mud-input-margin-dense {
    font-size: 0.8125rem;
}

.mud-input.mud-input-outlined.mud-input-margin-dense > input.mud-input-root:not([type="hidden"]),
.mud-input.mud-input-outlined.mud-input-margin-dense .mud-select-input,
.mud-input.mud-input-outlined.mud-input-margin-dense > .mud-input-slot:not(textarea) {
    min-height: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.mud-input.mud-input-outlined.mud-input-margin-dense textarea.mud-input-root {
    min-height: auto !important;
    height: auto !important;
    line-height: 1.4 !important;
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
    display: block !important;
    align-items: stretch !important;
}

.mud-input.mud-input-outlined.mud-input-margin-dense .mud-input-adornment {
    height: 36px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    align-self: center !important;
}

.mud-input.mud-input-outlined.mud-input-margin-dense .mud-icon-root.mud-input-adornment-icon {
    font-size: 1.15rem !important;
}

.mud-input-control.mud-input-control-margin-dense > .mud-input-control-input-container > label.mud-input-label.mud-input-label-inputcontrol {
    font-size: 0.75rem;
}

/*
  MudBlazor reserva espacio de AppBar aunque no haya MudAppBar:
  .mud-main-content { padding-top: var(--mud-appbar-height) } (+ media queries).
  Al no usar AppBar, forzamos altura 0 y padding 0.
*/
:root {
    --mud-appbar-height: 0px;
}

.mud-layout.nexus-shell {
    --mud-appbar-height: 0px;
    min-height: 100vh;
    /* No overflow:hidden: cortaba el pie de mensajes / botón Enviar */
}

.mud-main-content,
.mud-main-content.nexus-main-content {
    padding-top: 0 !important;
}

@media (min-width: 0px) {
    .mud-main-content {
        padding-top: 0 !important;
    }
}

@media (min-width: 600px) {
    .mud-main-content {
        padding-top: 0 !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Page headers (comunes)
   ══════════════════════════════════════════════════════════════════ */

.page-header {
    margin-bottom: 1.35rem;
}

.page-title {
    font-weight: 700 !important;
    letter-spacing: -0.025em;
    color: var(--nexus-text-strong) !important;
    line-height: 1.25 !important;
}

.page-subtitle {
    margin-top: 0.25rem !important;
    max-width: 42rem;
    color: var(--nexus-text-muted) !important;
    font-size: 0.875rem !important;
    line-height: 1.45 !important;
}

/* Títulos de sección / panel: un solo peso en toda la app */
.section-title {
    font-weight: 600 !important;
    letter-spacing: -0.01em;
    color: var(--nexus-text) !important;
    line-height: 1.35 !important;
}

/* Tabs Mud: menos grito tipográfico, más producto SaaS */
.nexus-tabs .mud-tab {
    text-transform: none !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    letter-spacing: 0 !important;
    min-width: auto !important;
    padding: 0 1rem !important;
    color: var(--nexus-text-muted) !important;
}

.nexus-tabs .mud-tab.mud-tab-active {
    color: var(--nexus-text-strong) !important;
    font-weight: 600 !important;
}

.nexus-tabs .mud-tabs-toolbar {
    background: transparent !important;
    border-bottom: 1px solid var(--nexus-border);
}

/* Barra de pestañas de gestión: sin fondo blanco, hereda el gris de la página */
.mgmt-tabbar-row .nexus-tabs .mud-tabs-toolbar,
.mgmt-tabbar-tabs .mud-tabs-toolbar {
    background: transparent !important;
    border-bottom: none !important;
}

.nexus-tabs .mud-tab-slider {
    height: 2px !important;
    border-radius: 2px 2px 0 0;
}

/* ══════════════════════════════════════════════════════════════════
   Home — bienvenida elegante
   ══════════════════════════════════════════════════════════════════ */

.home-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    padding: 1.5rem 1.6rem;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(58, 125, 174, 0.08) 0%, rgba(95, 168, 130, 0.06) 48%, transparent 100%),
        var(--nexus-surface);
    border: 1px solid var(--nexus-border);
    box-shadow: 0 1px 2px var(--nexus-shadow-soft);
}

.home-eyebrow {
    margin: 0 0 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nexus-action);
}

.home-greeting {
    font-weight: 700 !important;
    letter-spacing: -0.03em;
    color: var(--nexus-text-strong) !important;
    margin-bottom: 0.35rem !important;
}

.home-lead {
    max-width: 28rem;
    font-size: 0.925rem !important;
    line-height: 1.5 !important;
    color: var(--nexus-text-muted) !important;
}

.home-status {
    flex-shrink: 0;
    padding-top: 0.15rem;
}

.home-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    white-space: nowrap;
}

.home-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.home-status-pill--ok {
    background: #EDF7F2;
    color: #2E7A58;
    border-color: #C5E4D4;
}

.home-status-pill--ok .home-status-dot {
    background: #5FA882;
    box-shadow: 0 0 0 3px rgba(95, 168, 130, 0.2);
}

.home-status-pill--warn {
    background: #FEF8EE;
    color: #9A5E1A;
    border-color: #F0C88A;
}

.home-status-pill--warn .home-status-dot {
    background: #C97C30;
}

.home-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.home-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    border-radius: 14px;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-border);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px var(--nexus-shadow-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.home-card:hover {
    border-color: var(--nexus-action);
    box-shadow: 0 8px 24px var(--nexus-shadow-soft);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.home-card:focus-visible {
    outline: 2px solid var(--nexus-action);
    outline-offset: 2px;
}

.home-card--accent {
    background: linear-gradient(145deg, var(--nexus-surface) 0%, var(--nexus-surface-2) 100%);
}

.home-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    background: rgba(58, 125, 174, 0.12);
    color: var(--nexus-action);
    flex-shrink: 0;
}

.home-card--accent .home-card-icon {
    background: linear-gradient(135deg, rgba(58, 125, 174, 0.16) 0%, rgba(95, 168, 130, 0.14) 100%);
    color: var(--nexus-action-deep);
}

.home-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.home-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--nexus-text-strong);
    letter-spacing: -0.01em;
}

.home-card-desc {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--nexus-text-muted);
}

.home-card-arrow {
    color: var(--nexus-text-muted);
    flex-shrink: 0;
    transition: color 0.15s ease, transform 0.15s ease;
}

.home-card:hover .home-card-arrow {
    color: var(--nexus-action);
    transform: translateX(2px);
}

.home-alert {
    border-radius: 10px !important;
}

@media (max-width: 759px) {
    .home-hero {
        flex-direction: column;
        padding: 1.25rem 1.15rem;
    }

    .home-actions {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Login — split tipográfico elegante (sin imagen)
   ══════════════════════════════════════════════════════════════════ */

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--nexus-bg);
    font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

.login-brand {
    position: relative;
    display: none;
    overflow: hidden;
    background: #0B1726;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.75rem;
}

.login-brand-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 70% at 20% 15%, rgba(58, 125, 174, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 70% 55% at 85% 80%, rgba(78, 196, 200, 0.1) 0%, transparent 50%),
        linear-gradient(160deg, #081320 0%, #0E2238 48%, #0B1726 100%);
}

.login-brand-atmosphere::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -120px;
    top: -80px;
    border-radius: 50%;
    border: 1px solid rgba(150, 200, 230, 0.1);
}

.login-brand-atmosphere::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -40px;
    top: 40px;
    border-radius: 50%;
    border: 1px solid rgba(150, 200, 230, 0.07);
}

.login-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.75rem;
    max-width: 340px;
    animation: login-brand-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-mark {
    width: 64px;
    height: 64px;
}

.login-mark-svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(46, 140, 190, 0.25));
}

.login-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.login-brand-name {
    margin: 0;
    font-size: clamp(1.85rem, 2.4vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #F3F7FB;
}

.login-brand-tagline {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(126, 196, 210, 0.85);
}

.login-brand-support {
    margin: 0.55rem 0 0;
    max-width: 28ch;
    font-size: 0.9rem;
    line-height: 1.55;
    color: rgba(190, 208, 222, 0.62);
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 2.75rem;
    background: var(--nexus-bg);
}

.login-panel {
    width: min(100%, 400px);
    animation: login-panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-panel-header {
    margin-bottom: 1.85rem;
}

.login-eyebrow {
    margin: 0 0 0.55rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--nexus-action);
}

.login-heading {
    margin: 0 0 0.45rem;
    font-size: clamp(1.55rem, 2.2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--nexus-text-strong);
}

.login-lede {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--nexus-text-muted);
}

.login-alert {
    border-radius: 8px !important;
}

.login-form {
    display: block;
}

.login-field .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--nexus-border) !important;
}

.login-field .mud-input:focus-within .mud-input-outlined-border {
    border-color: var(--nexus-action) !important;
}

.login-field-password .mud-input-adornment-end .mud-icon-root {
    font-size: 1.125rem !important;
}

.login-submit {
    height: 44px !important;
    border-radius: 8px !important;
    text-transform: none !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    letter-spacing: 0.01em;
    box-shadow: none !important;
    transition: background-color 0.18s ease, transform 0.18s ease !important;
}

.login-submit:hover:not(:disabled):not(.mud-disabled) {
    transform: translateY(-1px);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.25rem 0;
    color: var(--nexus-text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--nexus-border);
}

.login-microsoft {
    height: 44px !important;
    border-radius: 8px !important;
    text-transform: none !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    color: var(--nexus-text-strong) !important;
    border-color: var(--nexus-border) !important;
    background: var(--nexus-surface) !important;
}

.login-microsoft:hover:not(:disabled):not(.mud-disabled) {
    border-color: var(--nexus-action) !important;
    background: var(--nexus-hover) !important;
}

.login-dev-hint {
    margin: 1.15rem 0 0;
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--nexus-text-muted);
    font-variant-numeric: tabular-nums;
}

.login-panel-footer {
    margin-top: 2rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--nexus-border);
    font-size: 0.7rem;
    color: var(--nexus-text-muted);
    letter-spacing: 0.01em;
}

@keyframes login-panel-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes login-brand-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 960px) {
    .login-shell {
        grid-template-columns: 1fr 1fr;
    }

    .login-brand {
        display: flex;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-main {
        padding: 3.5rem 4.5rem;
        justify-content: center;
    }

    .login-panel {
        width: min(100%, 400px);
    }
}

@media (max-width: 959px) {
    .login-shell {
        background: #0B1726;
    }

    .login-brand {
        display: flex;
        min-height: auto;
        padding: 1.75rem 1.35rem 1.5rem;
        justify-content: flex-start;
    }

    .login-brand-content {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        max-width: none;
    }

    .login-mark {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .login-brand-support {
        display: none;
    }

    .login-brand-name {
        font-size: 1.25rem;
    }

    .login-brand-tagline {
        font-size: 0.62rem;
        letter-spacing: 0.1em;
    }

    .login-brand-atmosphere::before,
    .login-brand-atmosphere::after {
        display: none;
    }

    .login-main {
        min-height: calc(100dvh - 7rem);
        border-radius: 1.15rem 1.15rem 0 0;
        margin-top: 0;
        position: relative;
        z-index: 1;
        padding: 2rem 1.25rem 2.25rem;
        box-shadow: 0 -10px 32px rgba(10, 22, 40, 0.14);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-panel,
    .login-brand-content,
    .login-submit {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   MudBlazor overrides: botones primarios
   ══════════════════════════════════════════════════════════════════ */

.mud-button-filled-primary {
    background-color: var(--nexus-action) !important;
}

.mud-button-filled-primary:hover {
    background-color: var(--nexus-action-deep) !important;
}

/* ══════════════════════════════════════════════════════════════════
   Ticket workspace (mis SATs, vista simple)
   ══════════════════════════════════════════════════════════════════ */

.ticket-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (max-width: 959px) {
    .ticket-workspace--detail .ticket-list-panel {
        display: none;
    }

    .ticket-workspace:not(.ticket-workspace--detail) .ticket-detail-panel {
        display: none;
    }

    .ticket-back-btn {
        margin-top: -0.25rem;
    }
}

@media (min-width: 1200px) {
    .ticket-workspace {
        grid-template-columns: 1.1fr 1fr;
        grid-template-rows: auto 1fr;
    }

    .ticket-list-panel {
        grid-column: 1 / -1;
    }
}

/* ── Toolbars y filtros responsive ── */
.page-toolbar {
    width: 100%;
}

.page-toolbar-spacer {
    flex: 1 1 auto;
}

.page-toolbar-filter {
    min-width: 220px;
    max-width: 280px;
}

@media (max-width: 599px) {
    .page-toolbar-spacer {
        display: none !important;
    }

    .page-toolbar-filter,
    .page-toolbar-action {
        width: 100%;
        max-width: 100%;
    }

    .typology-dept-chips {
        max-width: 100%;
    }
}

.ticket-row-selected {
    background-color: rgba(58, 125, 174, 0.08) !important;
}

/* ══════════════════════════════════════════════════════════════════
   Workspace split-pane (gestión de SATs)
   ══════════════════════════════════════════════════════════════════ */

.tw-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.tw-obo-btn,
.tw-filters-btn {
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
}

.tw-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #fff;
    color: #3A7DAE;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.tw-filters-btn.mud-button-filled .tw-filters-badge {
    background: rgba(255, 255, 255, 0.95);
    color: #2A6590;
}

.tw-filters-panel {
    margin-bottom: 0.55rem;
    padding: 0.55rem 0.7rem 0.5rem;
    border: 1px solid var(--nexus-border);
    border-radius: 8px;
    background: #F7F9FB;
}

.tw-filters-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4rem 0.5rem;
    align-items: start;
}

.tw-filters-search {
    grid-column: 1 / -1;
}

.tw-filters-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid #E5EAF0;
}

.tw-filters-clear {
    text-transform: none !important;
    font-size: 0.8rem !important;
}

.tw-filters-panel .mud-input-control {
    margin-top: 2px !important;
}

.tw-filters-panel .mud-input-outlined .mud-input-outlined-border {
    border-radius: 6px;
}

.tw-filters-actions .mud-typography-caption {
    font-size: 0.72rem !important;
}

.tw-obo-bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.6rem;
}

.tw-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 462px) 1fr;
    gap: 0;
    height: 100%;
    max-height: none;
    min-height: 360px;
    min-width: 0;
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--nexus-surface);
    box-shadow: 0 1px 4px var(--nexus-shadow-soft);
}

@media (max-width: 1100px) and (min-width: 960px) {
    .tw-workspace {
        grid-template-columns: minmax(260px, 36%) 1fr;
    }
}

/* Página de SATs: aprovecha el alto útil bajo topbar + padding */
.tickets-fill-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--nexus-topbar-h) - var(--nexus-main-pad-y));
    min-height: 0;
}

.tickets-fill-page .page-header {
    margin-bottom: 0.45rem;
    flex-shrink: 0;
}

.tickets-fill-page .page-subtitle {
    margin-top: 0.1rem !important;
    font-size: 0.8rem !important;
}

.tickets-fill-page .nexus-tabs {
    margin-bottom: 0.45rem !important;
    flex-shrink: 0;
}

.tickets-fill-workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tickets-fill-workspace > .tw-toolbar,
.tickets-fill-workspace > .tw-filters-panel {
    flex-shrink: 0;
}

.tickets-fill-workspace > .tw-toolbar {
    margin-bottom: 0.4rem;
}

.tickets-fill-workspace > .tw-workspace {
    flex: 1;
    min-height: 0;
}

/* ── Barra de pestañas + botones de acción en la misma fila (Management) ── */
.mgmt-tabbar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    /* la línea divisoria la pone .mgmt-tabbar-row en lugar del toolbar de MudTabs */
    border-bottom: 1px solid var(--nexus-border);
    margin-bottom: 0;
    padding-bottom: 0;
}

.mgmt-tabbar-tabs {
    flex: 1;
    min-width: 0;
    margin-bottom: 0 !important;
}

.mgmt-tabbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding-right: 0.25rem;
}

@media (max-width: 599px) {
    .mgmt-tabbar-row {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .mgmt-tabbar-tabs {
        flex: 1 1 100%;
        min-width: 0;
    }

    .mgmt-tabbar-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
        padding: 0 0.25rem 0.35rem;
    }

    .mgmt-tabbar-actions .mud-button-root {
        flex: 1 1 auto;
        max-width: 9rem;
    }
}

/* ── Lista izquierda ── */
.tw-list-pane {
    display: flex;
    flex-direction: column;
    /* Separador visual más marcado entre lista y detalle */
    border-right: 2px solid #D6E4EF;
    overflow: hidden;
    background: #F4F7FA;
}


.tw-list-actions {
    padding: 0.75rem 0.75rem 0.5rem;
    border-bottom: 1px solid var(--nexus-border);
}

.tw-list-search {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--nexus-border);
    background: #fff;
}

.tw-list-filters {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--nexus-border);
    background: #fff;
}

.tw-list-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.tw-filter-select {
    min-width: 0;
}

.tw-search-field .mud-input-outlined .mud-input-outlined-border,
.tw-filter-select .mud-input-outlined .mud-input-outlined-border,
.tw-filters-search .mud-input-outlined .mud-input-outlined-border {
    border-radius: 6px;
}

@media (max-width: 1400px) {
    .tw-filters-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .tw-filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tw-filters-grid {
        grid-template-columns: 1fr;
    }
}

.tw-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tw-list-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    border-top: 1px solid var(--nexus-border);
    background: #fff;
    flex-shrink: 0;
}

.tw-list-footer-count {
    font-size: 0.7rem;
    color: #7A8B98;
}

.tw-list-footer-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-list-footer-page {
    font-size: 0.7rem;
    color: #7A8B98;
    min-width: 2.5rem;
    text-align: center;
}

.tw-list-nav-btn {
    background: none;
    border: 1px solid var(--nexus-border);
    border-radius: 4px;
    color: #4A5568;
    font-size: 0.8rem;
    line-height: 1;
    width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s;
}

.tw-list-nav-btn:hover:not(:disabled) {
    background: #EBF3F9;
    border-color: #4E96C4;
    color: #0D1B2A;
}

.tw-list-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.tw-list-loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.tw-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: #B0BEC5;
}

/* ── Resumen de cola + filas compactas ── */
.tw-list-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.85rem;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #C8DDE9;
    background: #E6F0F7;
    position: sticky;
    top: 0;
    z-index: 1;
}

.tw-list-sort {
    margin-left: auto;
    min-width: 9.5rem;
    max-width: 12rem;
    flex: 0 1 12rem;
}

.tw-list-sort-select {
    margin: 0 !important;
}

.tw-list-sort-select .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.tw-list-sort-select .mud-input-outlined .mud-input-outlined-border {
    border-radius: 6px !important;
}

.tw-list-summary-item {
    font-size: 0.68rem;
    color: #5A6570;
    white-space: nowrap;
}

.tw-list-summary-item strong {
    color: #1A2B3C;
    font-weight: 700;
}

.tw-list-summary-item--alert {
    color: #8B1E1E;
}

.tw-list-summary-item--alert strong {
    color: #8B1E1E;
}

.tw-list-summary-item--assigned {
    color: #1A4A5C;
}

.tw-list-summary-item--assigned strong {
    color: #1A4A5C;
}

.tw-ticket-row {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    padding: 0.45rem 0.65rem 0.45rem 0;
    border-bottom: 1px solid #C8DDE9;
    cursor: pointer;
    background: transparent;
    transition: background 0.1s;
    user-select: none;
    min-height: 52px;
}

.tw-ticket-row:hover {
    background: #EBF3F9;
}

.tw-ticket-row:focus {
    outline: 2px solid var(--nexus-action);
    outline-offset: -2px;
}

.tw-ticket-row--active {
    background: #DCEEF8 !important;
}

.tw-ticket-row-prio {
    align-self: stretch;
    width: 4px;
    border-radius: 0 2px 2px 0;
    background: #C5CDD4;
}

.tw-ticket-row--prio-low .tw-ticket-row-prio { background: #9AABB8; }
.tw-ticket-row--prio-normal .tw-ticket-row-prio { background: #4E96C4; }
.tw-ticket-row--prio-high .tw-ticket-row-prio { background: #D08A3A; }
.tw-ticket-row--prio-veryhigh .tw-ticket-row-prio { background: #C45C3A; }
.tw-ticket-row--prio-critical .tw-ticket-row-prio { background: #B83A3A; }

.tw-ticket-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.tw-ticket-row-line1 {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.tw-ticket-row-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1A2B3C;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tw-ticket-row-line2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex-wrap: nowrap;
}

.tw-ticket-row-email {
    font-size: 0.68rem;
    color: #7A8A98;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
    max-width: none;
}

.tw-ticket-row-line2 .tw-ticket-row-prio-label {
    flex-shrink: 0;
}

.tw-ticket-row-line2 .tw-card-sla {
    flex-shrink: 0;
}

.tw-ticket-row-unassigned {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #6E3F00;
    background: #FDE7C2;
    border: 1px solid #D4A04A;
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    white-space: nowrap;
}

.tw-ticket-row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    flex-shrink: 0;
    padding-right: 0.15rem;
}

.tw-ticket-row-prio-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
}

.tw-ticket-row-prio-label.priority-low {
    background: var(--priority-low-bg);
    color: var(--priority-low-fg);
    border-color: var(--priority-low-border);
}

.tw-ticket-row-prio-label.priority-normal {
    background: var(--priority-normal-bg);
    color: var(--priority-normal-fg);
    border-color: var(--priority-normal-border);
}

.tw-ticket-row-prio-label.priority-high {
    background: var(--priority-high-bg);
    color: var(--priority-high-fg);
    border-color: var(--priority-high-border);
}

.tw-ticket-row-prio-label.priority-very-high {
    background: var(--priority-very-high-bg);
    color: var(--priority-very-high-fg);
    border-color: var(--priority-very-high-border);
}

.tw-ticket-row-prio-label.priority-critical {
    background: var(--priority-critical-bg);
    color: var(--priority-critical-fg);
    border-color: var(--priority-critical-border);
}

.tw-ticket-row .tw-card-status {
    font-size: 0.68rem;
    padding: 0.12rem 0.45rem;
    flex-shrink: 0;
}

.tw-ticket-row .tw-card-sla {
    font-size: 0.68rem;
    font-weight: 700;
}

/* ── Tarjeta de ticket (lista minimal) — legacy, por si queda alguna referencia ── */
.tw-ticket-card {
    padding: 0.7rem 0.9rem;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #F0F2F5;
    cursor: pointer;
    background: transparent;
    transition: background 0.1s;
    user-select: none;
}

.tw-ticket-card:hover {
    background: #F7F8FA;
}

.tw-ticket-card:focus {
    outline: 2px solid var(--nexus-action);
    outline-offset: -2px;
}

.tw-ticket-card--active {
    background: #EEF4F8 !important;
    box-shadow: inset 3px 0 0 var(--nexus-action);
}

.tw-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
    gap: 0.5rem;
}

.tw-ticket-num {
    font-size: 0.68rem;
    font-weight: 600;
    color: #9AABB8;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.tw-card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.2;
}

/* Estado = pastilla con relleno (distinto del tipo, que solo usa puntito) */
.tw-card-status--new {
    color: #16324A;
    background: #D4E4F1;
    border-color: #6E95B3;
}

.tw-card-status--pendingapproval {
    color: #6E3F00;
    background: #FDE7C2;
    border-color: #D4A04A;
}

.tw-card-status--assigned {
    color: #1A4A5C;
    background: #C8E6E0;
    border-color: #4A9B8C;
}

.tw-card-status--inprogress {
    color: #0D3F66;
    background: #C9E4F7;
    border-color: #4E96C4;
}

.tw-card-status--pausedbythirdparty {
    color: #6B3A08;
    background: #FCE0B8;
    border-color: #D08A3A;
}

.tw-card-status--resolved {
    color: #0B5C32;
    background: #B8E6C8;
    border-color: #2F9E5F;
}

.tw-card-status--closed {
    color: #5A6570;
    background: #EEF0F2;
    border-color: #B0B8C0;
}

.tw-status-chip {
    height: 18px !important;
    font-size: 0.67rem !important;
    padding: 0 5px !important;
    min-width: 0 !important;
}

.tw-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1A2B3C;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.tw-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    overflow: hidden;
}

.tw-card-meta--people {
    margin-bottom: 0.15rem;
}

.tw-card-line {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
    overflow: hidden;
}

.tw-card-k {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9AABB8;
}

.tw-card-v {
    font-size: 0.72rem;
    font-weight: 500;
    color: #4A6070;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tw-card-line--email .tw-card-v {
    color: #6B7C8C;
    font-weight: 400;
}

.tw-card-requester,
.tw-card-type,
.tw-card-email {
    font-size: 0.7rem;
    color: #8A9BAE;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tw-card-requester {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 40%;
    font-weight: 500;
    color: #4A6070;
}

.tw-card-email {
    flex: 1 1 auto;
    min-width: 0;
}

.tw-card-type {
    flex-shrink: 0;
    margin-left: auto;
}

.tw-card-sep {
    color: #D0D8DF;
    flex-shrink: 0;
    font-size: 0.7rem;
}

.tw-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.3rem;
    gap: 0.4rem;
}

.tw-card-bottom .tw-card-line {
    flex: 1;
    min-width: 0;
}

.tw-card-assignee {
    font-size: 0.68rem;
    color: #A0B0BC;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.tw-card-sla {
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.tw-card-icon {
    font-size: 0.82rem !important;
    width: 0.82rem !important;
    height: 0.82rem !important;
}

.tw-sla-ok       { color: #9AABB8; }
.tw-sla-warning  { color: #9A6B2F; }
.tw-sla-critical { color: #B83A3A; }
.tw-sla-overdue  { color: #B83A3A; }

/* ── Panel derecho (detalle) ── */
.tw-detail-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.tw-detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #B0BEC5;
    padding: 2rem;
}

.tw-empty-icon {
    font-size: 2rem !important;
    width: 2rem !important;
    height: 2rem !important;
    opacity: 0.3;
}

.tw-back-btn-wrap {
    padding: 0.5rem 0.75rem 0;
}

@media (min-width: 960px) {
    .tw-back-btn-wrap {
        display: none;
    }
}

.tw-detail-header {
    padding: 0.5rem 0.9rem 0.45rem;
    border-bottom: 1px solid var(--nexus-border);
    background: #fff;
    flex-shrink: 0;
}

.tw-detail-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.tw-detail-num {
    font-size: 0.72rem;
    font-weight: 600;
    color: #9AABB8;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.tw-detail-title-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1A2B3C;
    line-height: 1.3;
}

.tw-people-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 0.7rem;
}

.tw-people-row--stack {
    margin-bottom: 0.25rem;
}

@media (max-width: 700px) {
    .tw-people-row {
        grid-template-columns: 1fr;
    }
}

.tw-person-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid #E6EBF0;
    border-radius: 6px;
    background: #F7F9FB;
}

.tw-person-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A9BAE;
}

.tw-person-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--nexus-brand);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tw-person-email-row {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
}

.tw-person-email-k {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9AABB8;
}

.tw-person-email {
    font-size: 0.78rem;
    color: var(--nexus-action);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tw-person-email:hover {
    text-decoration: underline;
}

.tw-person-note {
    font-size: 0.72rem;
    color: #6B7C8C;
}

.tw-person-empty {
    font-size: 0.82rem;
    color: #9AABB8;
    font-style: italic;
}

.tw-requester-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.65rem;
}

.tw-requester-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A9BAE;
}

.tw-requester-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--nexus-brand);
}

.tw-requester-email,
a.tw-requester-email {
    font-size: 0.8rem;
    color: var(--nexus-action);
    text-decoration: none;
}

.tw-requester-email:hover,
a.tw-requester-email:hover {
    text-decoration: underline;
}

.tw-requester-obo {
    font-size: 0.75rem;
    color: #6B7C8C;
}

.tw-resumen-requester {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.35rem;
}

.tw-rating-panel {
    border: 1px solid #DDE4EC;
    border-radius: 6px;
    background: #F7F9FB;
}

.tw-meta-tag--rating {
    font-weight: 600;
    border-color: #C5D9E8;
    background: #EEF5FA;
    color: #2C6590;
}

.tw-detail-chips {
    gap: 4px !important;
}

.tw-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

/* Chips de persona en la cabecera del detalle */
a.tw-meta-person-tag {
    text-decoration: none;
    cursor: pointer;
}

a.tw-meta-person-tag:hover {
    background: #EAF2F8;
    border-color: #8DBDD8;
    color: #1A2B3C;
}

.tw-meta-person-unassigned {
    color: #6E3F00;
    background: #FDE7C2;
    border-color: #D4A04A;
}

.tw-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    border: 1px solid var(--nexus-border);
    border-radius: 4px;
    background: #F7F8FA;
    color: #4A6070;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    max-width: 100%;
}

.tw-meta-label {
    color: #9AABB8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.6rem;
}

.tw-meta-tag--status {
    border-color: transparent;
    font-weight: 700;
    border-radius: 999px;
    height: auto;
    min-height: 1.5rem;
    padding: 0.18rem 0.55rem;
}

.tw-meta-tag--status.tw-card-status--new {
    color: #16324A;
    background: #D4E4F1;
    border-color: #6E95B3;
}

.tw-meta-tag--status.tw-card-status--pendingapproval {
    color: #6E3F00;
    background: #FDE7C2;
    border-color: #D4A04A;
}

.tw-meta-tag--status.tw-card-status--assigned {
    color: #1A4A5C;
    background: #C8E6E0;
    border-color: #4A9B8C;
}

.tw-meta-tag--status.tw-card-status--inprogress {
    color: #0D3F66;
    background: #C9E4F7;
    border-color: #4E96C4;
}

.tw-meta-tag--status.tw-card-status--pausedbythirdparty {
    color: #6B3A08;
    background: #FCE0B8;
    border-color: #D08A3A;
}

.tw-meta-tag--status.tw-card-status--resolved {
    color: #0B5C32;
    background: #B8E6C8;
    border-color: #2F9E5F;
}

.tw-meta-tag--status.tw-card-status--closed {
    color: #5A6570;
    background: #EEF0F2;
    border-color: #B0B8C0;
}

.tw-meta-tag--flag {
    color: #7A8B98;
}

.tw-meta-tag--priority {
    font-weight: 600;
}

.tw-meta-tag--priority.priority-low {
    border-color: var(--priority-low-border, #B7D4C4);
    background: var(--priority-low-bg, #F0F7F3);
    color: var(--priority-low-fg, #2F6B4F);
}

.tw-meta-tag--priority.priority-normal {
    border-color: var(--priority-normal-border, #B7CDE0);
    background: var(--priority-normal-bg, #F0F5FA);
    color: var(--priority-normal-fg, #2C6590);
}

.tw-meta-tag--priority.priority-high {
    border-color: var(--priority-high-border, #E4C89A);
    background: var(--priority-high-bg, #FBF5EB);
    color: var(--priority-high-fg, #9A6B2F);
}

.tw-meta-tag--priority.priority-very-high {
    border-color: var(--priority-very-high-border, #E3B4B4);
    background: var(--priority-very-high-bg, #FBF0F0);
    color: var(--priority-very-high-fg, #A33A3A);
}

.tw-meta-tag--priority.priority-critical {
    border-color: var(--priority-critical-border, #D99A9A);
    background: var(--priority-critical-bg, #F8EAEA);
    color: var(--priority-critical-fg, #8B1E1E);
    font-weight: 700;
}

.tw-meta-tag--sla {
    cursor: default;
}

button.tw-meta-tag--sla {
    cursor: pointer;
    font: inherit;
    appearance: none;
}

.tw-meta-tag--sla .tw-meta-sla-extra {
    font-weight: 500;
    opacity: 0.85;
    margin-left: 0.15rem;
}

.tw-meta-tag--sla-ok {
    color: #0B5C32;
    background: #B8E6C8;
    border-color: #2F9E5F;
}

.tw-meta-tag--sla-overdue {
    color: #8B1E1E;
    background: #F8EAEA;
    border-color: #D99A9A;
}

.tw-meta-tag--sla-paused {
    color: #6B3A08;
    background: #FCE0B8;
    border-color: #D08A3A;
}

.tw-meta-tag--sla-neutral {
    color: #5A6570;
    background: #EEF0F2;
    border-color: #B0B8C0;
}

.tw-sla-strip {
    padding: 0 1.1rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--nexus-border);
}

.tw-approval-strip {
    padding: 0.5rem 1.1rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--nexus-border);
}

/* ── Split: gestión 50% | chat 50% ── */
.tw-detail-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.tw-mgmt-col {
    order: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--nexus-border);
}

.tw-mgmt-col .tw-approval-strip,
.tw-mgmt-col .tw-open-sat-strip,
.tw-mgmt-col .tw-mgmt-sla-row {
    flex-shrink: 0;
}

.tw-mgmt-sla-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--nexus-border);
    background: #fff;
    overflow: hidden;
    min-width: 0;
}

.tw-mgmt-sla-row .tw-meta-tag--sla {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}

.tw-mgmt-tabs {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.tw-mgmt-tabs .mud-tabs-toolbar {
    min-height: 2rem;
}

.tw-mgmt-tabs .mud-tab {
    min-height: 2rem !important;
    padding: 0 0.65rem !important;
    font-size: 0.78rem !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.tw-mgmt-tabs .mud-tabs-panels {
    flex: 1;
    overflow-y: auto;
}

.tw-mgmt-tabs .tw-tab-panel {
    padding: 0.55rem 0.7rem;
}

/* Panel de resolución: visible y claro al abrir "Resolver SAT" */
.tw-resolve-block {
    margin-bottom: 0.15rem;
}

.tw-resolve-panel {
    position: relative;
    padding: 0.75rem 0.85rem;
    border: 1px solid #7BB87A;
    border-radius: 8px;
    background: #F3FAF3;
}

.tw-resolve-busy {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    border-radius: 8px;
    background: rgba(243, 250, 243, 0.92);
    color: #1A3D2A;
    font-size: 0.85rem;
    font-weight: 600;
}

.tw-resolve-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 0.65rem;
}

.tw-resolve-panel-icon {
    color: #2F9E5F !important;
    font-size: 1.25rem !important;
    margin-top: 0.1rem;
}

.tw-resolve-panel-title {
    font-weight: 700 !important;
    color: #1A3D2A !important;
    margin-bottom: 0.1rem !important;
    line-height: 1.25 !important;
}

.tw-resolve-panel-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.tw-mgmt-tabs .tw-description {
    font-size: 0.82rem;
    line-height: 1.45;
    margin-bottom: 0.65rem !important;
}

.tw-summary-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.7rem;
    background: #F7F9FB;
    border: 1px solid var(--nexus-border);
    border-radius: 6px;
}

.tw-summary-fact {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.tw-summary-fact-k {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6A7A88;
}

.tw-summary-fact-v {
    font-size: 0.78rem;
    color: #1A2B3C;
    word-break: break-word;
}

.tw-summary-history {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tw-summary-history li {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) auto;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
    font-size: 0.72rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #EEF1F4;
}

.tw-summary-history-when {
    color: #7A8A98;
    white-space: nowrap;
}

.tw-summary-history-what {
    color: #1A2B3C;
    min-width: 0;
}

.tw-summary-history-who {
    color: #5A6570;
    white-space: nowrap;
}

/* Historial estilo Jira */
.tw-history-filter .mud-button-root {
    text-transform: none;
    font-size: 0.75rem;
}

.tw-history {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tw-history-day-label {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6A7A88;
}

.tw-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tw-history-item {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #EEF1F4;
}

.tw-history-item:last-child {
    border-bottom: none;
}

.tw-history-time {
    font-size: 0.72rem;
    color: #7A8A98;
    white-space: nowrap;
    padding-top: 0.1rem;
}

.tw-history-body {
    min-width: 0;
}

.tw-history-text {
    margin: 0;
    font-size: 0.78rem;
    color: #1A2B3C;
    line-height: 1.4;
}

.tw-history-actor {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 0.68rem;
    color: #5A6570;
}

@media (max-width: 640px) {
    .tw-summary-facts {
        grid-template-columns: 1fr;
    }

    .tw-summary-history li {
        grid-template-columns: 1fr;
    }
}

.tw-mgmt-tabs .tw-person-label {
    font-size: 0.62rem;
}

.tw-mgmt-tabs .tw-person-name {
    font-size: 0.8rem;
}

.tw-mgmt-tabs .mud-typography-subtitle2,
.tw-mgmt-tabs .section-title {
    font-size: 0.8rem !important;
}

.tw-mgmt-col .mgmt-form {
    gap: 0.75rem;
}

.tw-mgmt-col .mgmt-form-label {
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
    letter-spacing: 0.04em;
    color: #6A7A88;
}

.tw-mgmt-col .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0.15rem !important;
}

/* Coherencia label / valor en selects del panel Gestión (Variant.Text) */
.tw-mgmt-col .mud-input-control > .mud-input-control-input-container > label.mud-input-label,
.tw-mgmt-col .mud-input-label.mud-input-label-inputcontrol {
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
    color: #5A6570 !important;
}

.tw-mgmt-col .mud-input,
.tw-mgmt-col .mud-input > input.mud-input-slot,
.tw-mgmt-col .mud-input .mud-select-input,
.tw-mgmt-col .mud-select .mud-input-slot,
.tw-mgmt-col .mud-typography-body1 {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    color: #1A2B3C !important;
}

.tw-mgmt-col .mud-input.mud-input-text {
    font-size: 0.875rem !important;
}

.tw-mgmt-col .mud-input-adornment .mud-icon-root {
    font-size: 1.1rem !important;
}

.tw-mgmt-col .mud-input-control.mud-input-control-margin-dense {
    margin-top: 0 !important;
}

.tw-mgmt-col .linked-assets-picker,
.tw-mgmt-col .ticket-linked-assets {
    font-size: 0.82rem;
}

.tw-conv-col {
    order: 2;
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background: #fff;
}

.tw-conv-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--nexus-border);
    font-weight: 600;
    font-size: 0.8rem;
    color: #1A2B3C;
    background: #fff;
    flex-shrink: 0;
    gap: 0.25rem;
}

.tw-conv-badge {
    height: 18px !important;
    font-size: 0.67rem !important;
    padding: 0 5px !important;
    min-width: 0 !important;
}

.tw-conv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tw-conv-empty {
    text-align: center;
    padding: 1.5rem 0;
    opacity: 0.5;
}

.tw-conv-footer {
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--nexus-border);
    flex-shrink: 0;
    background: #fff;
    z-index: 2;
}

.tw-composer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tw-composer-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tw-composer-hint {
    padding: 0 0.15rem;
    line-height: 1.2;
}

.tw-composer-pending {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0 0.1rem 0.35rem;
}

.tw-composer-pending-item {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: #EEF2F6;
    border: 1px solid var(--nexus-border, #E2E8F0);
    flex-shrink: 0;
}

.tw-composer-pending-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tw-composer-pending-name {
    display: block;
    font-size: 0.65rem;
    padding: 0.35rem;
    line-height: 1.2;
    overflow: hidden;
}

.tw-composer-pending-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(13, 27, 42, 0.72);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tw-composer-pending-remove:hover {
    background: rgba(13, 27, 42, 0.9);
}

.tw-composer-field {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

/* Quitar márgenes/huecos de Mud que desalinean el botón */
.tw-composer-field.mud-input-control,
.tw-composer .tw-composer-field {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.tw-composer-field .mud-input-control-input-container {
    margin: 0 !important;
}

.tw-composer-field .mud-input-outlined .mud-input-outlined-border {
    border-radius: 10px !important;
}

.tw-composer-field .mud-input-slot,
.tw-composer-field .mud-input > input.mud-input-slot {
    min-height: 40px !important;
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
}

.tw-composer-send {
    flex-shrink: 0;
    align-self: center;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 10px !important;
    background-color: var(--nexus-action) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.tw-composer-send .mud-icon-root,
.tw-composer-send .mud-button-label {
    color: #ffffff !important;
}

.tw-composer-send:hover:not(:disabled):not(.mud-button-disabled) {
    background-color: var(--nexus-action-deep) !important;
}

.tw-composer-send:disabled,
.tw-composer-send.mud-disabled,
.tw-composer-send.mud-button-disabled {
    background-color: #B7D0E3 !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

.tw-composer-send:disabled .mud-icon-root,
.tw-composer-send.mud-disabled .mud-icon-root,
.tw-composer-send.mud-button-disabled .mud-icon-root {
    color: #ffffff !important;
    opacity: 0.95 !important;
}

.tw-tab-panel {
    padding: 0.55rem 0.7rem;
}

.tw-description {
    color: #2D3748;
    line-height: 1.45;
    font-size: 0.82rem;
}

/* ── Responsive móvil ── */
@media (max-width: 959px) {
    :root,
    [data-theme="light"],
    [data-theme="dark"] {
        --nexus-topbar-h: 52px;
        --nexus-main-pad-y: 2rem;
    }

    .tickets-fill-page {
        height: auto;
        min-height: calc(100dvh - var(--nexus-topbar-h) - var(--nexus-main-pad-y));
    }

    /* Detalle móvil: más espacio útil (sin título de página ni tabs) */
    .tickets-fill-page:has(.tw-workspace--mobile-detail) {
        height: calc(100dvh - var(--nexus-topbar-h) - 0.75rem);
        min-height: 0;
        margin: 0;
    }

    .tickets-fill-page:has(.tw-workspace--mobile-detail) .page-header,
    .tickets-fill-page:has(.tw-workspace--mobile-detail) .mgmt-tabbar-row,
    .tickets-fill-page:has(.tw-workspace--mobile-detail) .tw-toolbar,
    .tickets-fill-page:has(.tw-workspace--mobile-detail) .tw-filters-panel {
        display: none !important;
    }

    .tickets-fill-page:has(.tw-workspace--mobile-detail) .tickets-fill-workspace {
        flex: 1;
        min-height: 0;
    }

    .tw-workspace {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        border-radius: 8px;
    }

    .tw-workspace:not(.tw-workspace--mobile-detail) .tw-detail-pane {
        display: none;
    }

    .tw-workspace.tw-workspace--mobile-detail .tw-list-pane {
        display: none;
    }

    .tw-workspace:not(.tw-workspace--mobile-detail) .tw-list-pane {
        max-height: none;
        border-bottom: none;
    }

    .tw-list-pane--hidden-mobile {
        display: none;
    }

    /* Un solo scroll en el panel de detalle */
    .tw-workspace--mobile-detail {
        height: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .tw-workspace--mobile-detail .tw-detail-pane {
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
    }

    .tw-workspace--mobile-detail .tw-detail-header {
        position: sticky;
        top: 0;
        z-index: 3;
        padding: 0.4rem 0.75rem 0.35rem;
    }

    .tw-workspace--mobile-detail .tw-detail-title-row {
        margin-bottom: 0.25rem;
    }

    .tw-workspace--mobile-detail .tw-detail-title-text {
        font-size: 0.92rem;
    }

    .tw-workspace--mobile-detail .tw-meta-desktop-only {
        display: none !important;
    }

    .tw-workspace--mobile-detail .tw-meta-label {
        display: none;
    }

    .tw-workspace--mobile-detail .tw-back-btn-wrap {
        position: sticky;
        top: 0;
        z-index: 4;
        padding: 0.25rem 0.5rem 0;
        background: var(--nexus-surface);
    }

    .tw-workspace--mobile-detail .tw-detail-body {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        overflow: visible;
        min-height: 0;
        grid-template-columns: none;
        grid-template-rows: none;
    }

    .tw-workspace--mobile-detail .tw-mgmt-col,
    .tw-workspace--mobile-detail .tw-conv-col {
        order: unset;
        overflow: visible;
        max-height: none;
        min-height: 0;
        border-right: none;
        display: flex;
        flex-direction: column;
    }

    .tw-workspace--mobile-detail .tw-conv-col {
        background: var(--nexus-surface);
        border-bottom: none;
    }

    /* Separación clara chat → gestión */
    .tw-workspace--mobile-detail .tw-mgmt-col {
        margin-top: 0.35rem;
        padding-top: 0;
        border-top: none;
        border-bottom: none;
        background: var(--nexus-bg);
        box-shadow: inset 0 1px 0 var(--nexus-border);
    }

    .tw-workspace--mobile-detail .tw-mgmt-col::before {
        content: "Detalle y gestión";
        display: block;
        margin: 0;
        padding: 0.7rem 0.85rem 0.55rem;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: var(--nexus-text-muted);
        background:
            linear-gradient(180deg, var(--nexus-surface-2) 0%, var(--nexus-bg) 100%);
        border-top: 6px solid var(--nexus-border);
        border-bottom: 1px solid var(--nexus-border);
    }

    .tw-workspace--mobile-detail .tw-mgmt-sla-row {
        background: transparent;
        border-bottom-color: var(--nexus-border);
    }

    .tw-workspace--mobile-detail .tw-conv-col {
        min-height: 0;
    }

    /* Sin scroll interno en tabs Gestión / Resumen / Archivos */
    .tw-workspace--mobile-detail .tw-mgmt-tabs {
        overflow: visible;
        flex: 0 0 auto;
        min-height: 0;
    }

    .tw-workspace--mobile-detail .tw-mgmt-tabs .mud-tabs-panels {
        overflow: visible !important;
        flex: none !important;
        height: auto !important;
        max-height: none !important;
    }

    .tw-workspace--mobile-detail .tw-mgmt-tabs .mud-tabs-toolbar {
        position: sticky;
        top: 2.75rem;
        z-index: 2;
        background: var(--nexus-surface);
    }

    .tw-workspace--mobile-detail .linked-assets-list,
    .tw-workspace--mobile-detail .ticket-messages {
        max-height: none !important;
        overflow: visible !important;
    }

    /* Chat: mensajes sin scroll propio; composer sticky al fondo del viewport */
    .tw-workspace--mobile-detail .tw-conv-messages {
        overflow: visible;
        flex: 0 0 auto;
        max-height: none;
        min-height: 8rem;
        padding-bottom: 0.5rem;
    }

    .tw-workspace--mobile-detail .tw-conv-footer {
        position: sticky;
        bottom: 0;
        z-index: 3;
        box-shadow: 0 -4px 12px var(--nexus-shadow-soft);
        border-bottom: 1px solid var(--nexus-border);
    }

    .tw-obo-bar {
        margin-bottom: 0.5rem;
    }

    .tw-list-nav-btn {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 2.75rem;
        min-height: 2.75rem;
    }
}

@media (max-width: 599px) {
    :root,
    [data-theme="light"],
    [data-theme="dark"] {
        --nexus-main-pad-y: 1.5rem;
    }

    .tickets-fill-page:has(.tw-workspace--mobile-detail) .nexus-main,
    .nexus-main:has(.tw-workspace--mobile-detail) {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-bottom: 0.35rem;
    }

    .tw-toolbar {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .tw-toolbar .mud-button-root {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tw-list-filter-row {
        grid-template-columns: 1fr;
    }

    .tw-list-sort {
        margin-left: 0;
        flex: 1 1 100%;
        max-width: none;
    }

    .tw-detail-header {
        padding: 0.5rem 0.65rem 0.4rem;
    }

    .tw-meta-row {
        gap: 0.25rem;
    }

    .tw-meta-tag {
        max-width: calc(100% - 0.5rem);
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Mensajes / burbujas (estilo chat: míos a la derecha, otros a la izquierda)
   ══════════════════════════════════════════════════════════════════ */

.ticket-messages {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-message-row {
    display: flex;
    width: 100%;
}

.ticket-message-row--mine {
    justify-content: flex-end;
}

.ticket-message-row--theirs {
    justify-content: flex-start;
}

.ticket-message-bubble {
    max-width: min(78%, 28rem);
    border-radius: 14px;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    box-shadow: 0 1px 0 rgba(13, 27, 42, 0.04);
}

.ticket-message-bubble--theirs {
    background: #F3F6F9;
    color: #1A2B3C;
    border-bottom-left-radius: 4px;
}

.ticket-message-bubble--mine {
    background: #3A7DAE;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ticket-message-bubble--mine .ticket-message-meta {
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

.ticket-message-bubble--internal {
    border: 1px dashed #C97C30;
}

.ticket-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    opacity: 0.72;
}

.ticket-message-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.ticket-message-attachments {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.ticket-message-image-link {
    display: block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
}

.ticket-message-image {
    display: block;
    max-width: 100%;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.06);
}

.ticket-message-bubble--mine .ticket-message-image {
    background: rgba(255, 255, 255, 0.12);
}

.ticket-message-file {
    font-size: 0.8rem;
    word-break: break-all;
    text-decoration: underline;
}

.ticket-message-bubble--mine .ticket-message-file {
    color: #fff;
}

.ticket-message-bubble--theirs .ticket-message-file {
    color: #2A6590;
}

.ticket-form-card {
    max-width: 900px;
}

.finished-resolution-panel {
    background: #F0F6FA;
    border-left: 3px solid var(--nexus-green);
    border-radius: 8px;
}

.finished-resolution-text {
    white-space: pre-wrap;
}

.finished-resolution-below-list {
    border-top: 1px solid var(--nexus-border);
    background: #fff;
}

/* ══════════════════════════════════════════════════════════════════
   Escala de importancia (SAT) — prioridades y tipos
   ══════════════════════════════════════════════════════════════════ */

:root {
    --priority-low-bg:        #EDF6F1;
    --priority-low-fg:        #2E7A58;
    --priority-low-border:    #9ECFB8;
    --priority-low-dot:       #5FA882;

    --priority-normal-bg:     #EAF2F8;
    --priority-normal-fg:     #2A6590;
    --priority-normal-border: #8DBDD8;
    --priority-normal-dot:    #3A7DAE;

    --priority-high-bg:       #FEF8EE;
    --priority-high-fg:       #9A5E1A;
    --priority-high-border:   #F0C88A;
    --priority-high-dot:      #C97C30;

    --priority-very-high-bg:  #FEF2E8;
    --priority-very-high-fg:  #8A3A18;
    --priority-very-high-border: #F0A880;
    --priority-very-high-dot: #C96030;

    --priority-critical-bg:   #FBF0F0;
    --priority-critical-fg:   #882828;
    --priority-critical-border: #E09090;
    --priority-critical-dot:  #B83A3A;

    /* Tipos de ticket */
    /* Tipo SAT: color solo en el puntito (no competir con pastillas de estado) */
    --ticket-incident-bg:     transparent;
    --ticket-incident-fg:     #2C3A47;
    --ticket-incident-border: transparent;
    --ticket-incident-dot:    #D32F2F;

    --ticket-request-bg:      transparent;
    --ticket-request-fg:      #2C3A47;
    --ticket-request-border:  transparent;
    --ticket-request-dot:     #1565C0;

    --ticket-data-requirement-bg:     transparent;
    --ticket-data-requirement-fg:     #2C3A47;
    --ticket-data-requirement-border: transparent;
    --ticket-data-requirement-dot:    #6A1B9A;

    --destination-dept-bg:    #F0F6FA;
    --destination-dept-fg:    #1A4060;
    --destination-dept-border: #8AB4CC;
    --destination-dept-dot:   #3A7DAE;
}

[data-theme="dark"] {
    --priority-low-bg:            rgba(111, 186, 148, 0.18);
    --priority-low-fg:            #8FDBB0;
    --priority-low-border:        rgba(111, 186, 148, 0.38);
    --priority-low-dot:           #6FBA94;

    --priority-normal-bg:         rgba(91, 155, 200, 0.18);
    --priority-normal-fg:         #8FC5E8;
    --priority-normal-border:     rgba(91, 155, 200, 0.38);
    --priority-normal-dot:        #5B9BC8;

    --priority-high-bg:           rgba(212, 146, 74, 0.18);
    --priority-high-fg:           #E0B070;
    --priority-high-border:       rgba(212, 146, 74, 0.38);
    --priority-high-dot:          #D4924A;

    --priority-very-high-bg:      rgba(208, 138, 58, 0.20);
    --priority-very-high-fg:      #F0A878;
    --priority-very-high-border:  rgba(208, 138, 58, 0.42);
    --priority-very-high-dot:     #D08A3A;

    --priority-critical-bg:       rgba(212, 90, 90, 0.22);
    --priority-critical-fg:       #F08080;
    --priority-critical-border:   rgba(212, 90, 90, 0.45);
    --priority-critical-dot:      #D45A5A;

    --ticket-incident-fg:         #E8F0F7;
    --ticket-request-fg:          #E8F0F7;
    --ticket-data-requirement-fg: #E8F0F7;

    --destination-dept-bg:        rgba(91, 155, 200, 0.14);
    --destination-dept-fg:        #8FC5E8;
    --destination-dept-border:    rgba(91, 155, 200, 0.35);
    --destination-dept-dot:       #5B9BC8;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid;
    white-space: nowrap;
}

.priority-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-low {
    background: var(--priority-low-bg);
    color: var(--priority-low-fg);
    border-color: var(--priority-low-border);
}

.priority-low .priority-badge-dot,
.priority-low .priority-select-dot {
    background: var(--priority-low-dot);
}

.priority-normal {
    background: var(--priority-normal-bg);
    color: var(--priority-normal-fg);
    border-color: var(--priority-normal-border);
}

.priority-normal .priority-badge-dot,
.priority-normal .priority-select-dot {
    background: var(--priority-normal-dot);
}

.priority-high {
    background: var(--priority-high-bg);
    color: var(--priority-high-fg);
    border-color: var(--priority-high-border);
}

.priority-high .priority-badge-dot,
.priority-high .priority-select-dot {
    background: var(--priority-high-dot);
}

.priority-very-high {
    background: var(--priority-very-high-bg);
    color: var(--priority-very-high-fg);
    border-color: var(--priority-very-high-border);
}

.priority-very-high .priority-badge-dot,
.priority-very-high .priority-select-dot {
    background: var(--priority-very-high-dot);
}

.priority-critical {
    background: var(--priority-critical-bg);
    color: var(--priority-critical-fg);
    border-color: var(--priority-critical-border);
}

.priority-critical .priority-badge-dot,
.priority-critical .priority-select-dot {
    background: var(--priority-critical-dot);
}

.priority-select-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.35rem 0;
    max-width: 24rem;
    white-space: normal;
}

.priority-select-item--compact {
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    max-width: none;
    white-space: nowrap;
}

.priority-select-item--compact .priority-select-dot {
    margin-top: 0;
}

.priority-select-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.priority-select-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.priority-select-item-title {
    font-weight: 600;
    line-height: 1.25;
}

.priority-select-item-desc {
    font-size: 0.73rem;
    line-height: 1.35;
    opacity: 0.8;
}

.priority-low .priority-select-item-title     { color: var(--priority-low-fg); }
.priority-normal .priority-select-item-title  { color: var(--priority-normal-fg); }
.priority-high .priority-select-item-title    { color: var(--priority-high-fg); }
.priority-very-high .priority-select-item-title { color: var(--priority-very-high-fg); }
.priority-critical .priority-select-item-title  { color: var(--priority-critical-fg); }

/* Lista desplegable MudBlazor */
.mud-list-item.priority-low.mud-selected-item,
.mud-list-item.priority-low.mud-selected { background-color: var(--priority-low-bg) !important; }

.mud-list-item.priority-normal.mud-selected-item,
.mud-list-item.priority-normal.mud-selected { background-color: var(--priority-normal-bg) !important; }

.mud-list-item.priority-high.mud-selected-item,
.mud-list-item.priority-high.mud-selected { background-color: var(--priority-high-bg) !important; }

.mud-list-item.priority-very-high.mud-selected-item,
.mud-list-item.priority-very-high.mud-selected { background-color: var(--priority-very-high-bg) !important; }

.mud-list-item.priority-critical.mud-selected-item,
.mud-list-item.priority-critical.mud-selected { background-color: var(--priority-critical-bg) !important; }

/* Valor seleccionado en el campo cerrado */
.priority-select.priority-low ::deep .mud-input-slot,
.priority-select.priority-low ::deep .mud-select-input { color: var(--priority-low-fg); font-weight: 600; }

.priority-select.priority-normal ::deep .mud-input-slot,
.priority-select.priority-normal ::deep .mud-select-input { color: var(--priority-normal-fg); font-weight: 600; }

.priority-select.priority-high ::deep .mud-input-slot,
.priority-select.priority-high ::deep .mud-select-input { color: var(--priority-high-fg); font-weight: 600; }

.priority-select.priority-very-high ::deep .mud-input-slot,
.priority-select.priority-very-high ::deep .mud-select-input { color: var(--priority-very-high-fg); font-weight: 600; }

.priority-select.priority-critical ::deep .mud-input-slot,
.priority-select.priority-critical ::deep .mud-select-input { color: var(--priority-critical-fg); font-weight: 700; }

/* ── Tipos de ticket ── */
.ticket-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    border-radius: 0;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    border: none;
    background: transparent;
    color: #2C3A47;
    white-space: nowrap;
}

.ticket-type-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticket-type-incident {
    background: transparent;
    color: var(--ticket-incident-fg);
    border: none;
}

.ticket-type-incident .ticket-type-badge-dot,
.ticket-type-incident .ticket-type-select-dot {
    background: var(--ticket-incident-dot);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.18);
}

.ticket-type-request {
    background: transparent;
    color: var(--ticket-request-fg);
    border: none;
}

.ticket-type-request .ticket-type-badge-dot,
.ticket-type-request .ticket-type-select-dot {
    background: var(--ticket-request-dot);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.16);
}

.ticket-type-data-requirement {
    background: transparent;
    color: var(--ticket-data-requirement-fg);
    border: none;
}

.ticket-type-data-requirement .ticket-type-badge-dot,
.ticket-type-data-requirement .ticket-type-select-dot {
    background: var(--ticket-data-requirement-dot);
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.16);
}

.tw-card-type.ticket-type-badge {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 0.7rem;
}

.ticket-type-select-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.35rem 0;
    max-width: 24rem;
    white-space: normal;
}

.ticket-type-select-item--compact {
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    max-width: none;
    white-space: nowrap;
}

/* El popover no debe quedar limitado al ancho estrecho del campo (p. ej. sm=3). */
.ticket-type-select-popover {
    min-width: 15.5rem !important;
}

.ticket-type-select-popover .mud-list-item .mud-list-item-text,
.ticket-type-select-popover .ticket-type-select-item-title {
    white-space: nowrap;
}

.ticket-type-select-item--compact .ticket-type-select-dot {
    margin-top: 0;
}

.ticket-type-select-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.ticket-type-select-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.ticket-type-select-item-title {
    font-weight: 600;
    line-height: 1.25;
}

.ticket-type-select-item-desc {
    font-size: 0.73rem;
    line-height: 1.35;
    opacity: 0.8;
}

.ticket-type-incident .ticket-type-select-item-title      { color: #B71C1C; }
.ticket-type-request .ticket-type-select-item-title       { color: #0D47A1; }
.ticket-type-data-requirement .ticket-type-select-item-title { color: #4A148C; }

.mud-list-item.ticket-type-incident.mud-selected-item,
.mud-list-item.ticket-type-incident.mud-selected { background-color: #FBEAEA !important; }

.mud-list-item.ticket-type-request.mud-selected-item,
.mud-list-item.ticket-type-request.mud-selected { background-color: #E8F1FB !important; }

.mud-list-item.ticket-type-data-requirement.mud-selected-item,
.mud-list-item.ticket-type-data-requirement.mud-selected { background-color: #F0EAF6 !important; }

.ticket-type-select.ticket-type-incident ::deep .mud-input-slot,
.ticket-type-select.ticket-type-incident ::deep .mud-select-input { color: #B71C1C; font-weight: 600; }

.ticket-type-select.ticket-type-request ::deep .mud-input-slot,
.ticket-type-select.ticket-type-request ::deep .mud-select-input { color: #0D47A1; font-weight: 600; }

.ticket-type-select.ticket-type-data-requirement ::deep .mud-input-slot,
.ticket-type-select.ticket-type-data-requirement ::deep .mud-select-input { color: #4A148C; font-weight: 600; }

/* ── Select outlined temático ── */
.destination-department-select {
    --sat-field-fg: var(--destination-dept-fg);
    --sat-field-bg: var(--destination-dept-bg);
    --sat-field-border: var(--destination-dept-border);
}

.ticket-type-select.ticket-type-incident {
    --sat-field-fg: #B71C1C;
    --sat-field-bg: #FBEAEA;
    --sat-field-border: #E4A8A8;
}

.ticket-type-select.ticket-type-request {
    --sat-field-fg: #0D47A1;
    --sat-field-bg: #E8F1FB;
    --sat-field-border: #9BB8DE;
}

.ticket-type-select.ticket-type-data-requirement {
    --sat-field-fg: #4A148C;
    --sat-field-bg: #F0EAF6;
    --sat-field-border: #B5A0D4;
}

.priority-select.priority-low {
    --sat-field-fg: var(--priority-low-fg);
    --sat-field-bg: var(--priority-low-bg);
    --sat-field-border: var(--priority-low-border);
}

.priority-select.priority-normal {
    --sat-field-fg: var(--priority-normal-fg);
    --sat-field-bg: var(--priority-normal-bg);
    --sat-field-border: var(--priority-normal-border);
}

.priority-select.priority-high {
    --sat-field-fg: var(--priority-high-fg);
    --sat-field-bg: var(--priority-high-bg);
    --sat-field-border: var(--priority-high-border);
}

.priority-select.priority-very-high {
    --sat-field-fg: var(--priority-very-high-fg);
    --sat-field-bg: var(--priority-very-high-bg);
    --sat-field-border: var(--priority-very-high-border);
}

.priority-select.priority-critical {
    --sat-field-fg: var(--priority-critical-fg);
    --sat-field-bg: var(--priority-critical-bg);
    --sat-field-border: var(--priority-critical-border);
}

.sat-themed-outlined-select .mud-input-label {
    color: var(--sat-field-fg) !important;
    font-weight: 600;
}

.sat-themed-outlined-select .mud-input-slot,
.sat-themed-outlined-select .mud-select-input {
    color: var(--sat-field-fg);
    font-weight: 600;
}

.sat-themed-outlined-select .mud-input-outlined-border {
    border-color: var(--sat-field-border) !important;
}

.sat-themed-outlined-select .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--sat-field-fg) !important;
}

.sat-themed-outlined-select .mud-input-outlined.mud-input-outlined-focus .mud-input-outlined-border {
    border-color: var(--sat-field-fg) !important;
    border-width: 2px;
}

.sat-themed-outlined-select .mud-input-control-input-container {
    background-color: var(--sat-field-bg);
    border-radius: 6px;
}

.sat-themed-outlined-select .mud-input.mud-input-outlined.mud-input-margin-dense > input.mud-input-root,
.sat-themed-outlined-select .mud-input.mud-input-outlined.mud-input-margin-dense .mud-select-input,
.sat-themed-outlined-select .mud-input.mud-input-outlined.mud-input-margin-dense > .mud-input-slot:not(textarea) {
    min-height: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.sat-themed-outlined-select .mud-icon-root.mud-input-adornment-icon {
    color: var(--sat-field-fg);
}

.mud-list-item.destination-dept-item.mud-selected-item,
.mud-list-item.destination-dept-item.mud-selected {
    background-color: var(--destination-dept-bg) !important;
    color: var(--destination-dept-fg);
}

/* ══════════════════════════════════════════════════════════════════
   Maestros: pestañas y tablas
   ══════════════════════════════════════════════════════════════════ */

.masters-tabs {
    width: 100%;
}

.masters-tabs .mud-tabs-panel {
    background: #fff;
}

.masters-table.mud-table-root {
    border: 1px solid var(--nexus-border);
    border-radius: 10px;
    overflow: hidden;
}

.masters-table .mud-table-head .mud-table-cell {
    font-weight: 600;
    background: #F7F8FA;
    color: #1A2B3C;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Chips de departamento ── */
.typology-dept-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 22rem;
}

.dept-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

.asset-ref-code {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #0f172a;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════
   Adjuntos de SAT
   ══════════════════════════════════════════════════════════════════ */

.ticket-attachment-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.ticket-attachment-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 1.25rem;
    border: 1.5px dashed var(--nexus-border);
    border-radius: 8px;
    background: var(--nexus-surface-2);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    outline: none;
    color: var(--nexus-text-muted);
}

.ticket-attachment-dropzone:hover,
.ticket-attachment-dropzone:focus-visible {
    border-color: var(--nexus-action);
    background: rgba(58, 125, 174, 0.1);
}

.ticket-attachment-dropzone-compact {
    padding: 0.5rem 0.75rem;
    margin-top: 0.25rem;
}

.ticket-attachment-pending-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--nexus-border);
    border-radius: 8px;
    background: var(--nexus-surface);
}

.ticket-attachment-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.ticket-attachment-thumb-placeholder {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F6F9;
    border-radius: 6px;
    flex-shrink: 0;
}

.ticket-attachment-js-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-attachment-js-preview-row .ticket-attachment-thumb {
    width: 60px;
    height: 60px;
}

.ticket-attachment-pending-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ticket-attachment-pending-name {
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-attachment-pending-size {
    font-size: 0.73rem;
    color: var(--nexus-text-muted);
}

.ticket-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.65rem;
}

.ticket-attachment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--nexus-border);
    border-radius: 8px;
    background: var(--nexus-surface);
    text-align: center;
}

.ticket-attachment-image {
    max-width: 100%;
    max-height: 110px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 0.3rem;
}

.ticket-attachment-link {
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════════
   Dashboard
   ══════════════════════════════════════════════════════════════════ */

.dashboard-kpi {
    height: 100%;
    border-color: var(--nexus-border) !important;
}

.dashboard-kpi-value {
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-bar-row {
    display: grid;
    grid-template-columns: minmax(6rem, 38%) 1fr 2.5rem;
    gap: 0.5rem;
    align-items: center;
}

.dashboard-bar-label {
    font-size: 0.78rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #4A6070;
}

.dashboard-bar-track {
    height: 6px;
    background: #EEF1F5;
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-bar-fill {
    height: 100%;
    border-radius: 999px;
    min-width: 4px;
    transition: width 0.25s ease;
}

/* Todas las barras usan el mismo azul corporativo — menos ruido */
.dashboard-bar-fill-primary  { background: var(--nexus-action); }
.dashboard-bar-fill-origin   { background: var(--nexus-action); }
.dashboard-bar-fill-dest     { background: #8A7BAE; }
.dashboard-bar-fill-status   { background: var(--nexus-green); }
.dashboard-bar-fill-priority { background: var(--nexus-warning); }
.dashboard-bar-fill-typology { background: var(--nexus-action); }

.dashboard-bar-value {
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
    color: #1A2B3C;
}

/* ══════════════════════════════════════════════════════════════════
   Nueva SAT (formulario)
   ══════════════════════════════════════════════════════════════════ */

.sat-new-ticket-page {
    max-width: 760px;
    margin: 0 auto;
    padding-bottom: 1.5rem;
}

.sat-new-ticket-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.sat-new-ticket-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 9px;
    background: rgba(58, 125, 174, 0.12);
    color: var(--nexus-action);
    flex-shrink: 0;
}

.sat-new-ticket-title {
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

/* Tarjeta principal: sin sombra exagerada, borde sutil */
.sat-new-ticket-card {
    background: var(--nexus-surface) !important;
    border: 1px solid var(--nexus-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px var(--nexus-shadow-soft) !important;
    color: var(--nexus-text);
}

.sat-new-ticket-progress {
    border-radius: 999px !important;
}

/* Secciones internas: fondo muy sutil, sin bordes dobles */
.sat-new-ticket-section {
    padding: 0.7rem 0.8rem;
    margin-bottom: 0.6rem;
    background: var(--nexus-surface-2);
    border: 1px solid var(--nexus-border);
    border-radius: 8px;
}

.sat-new-ticket-section:last-of-type {
    margin-bottom: 0;
}

.sat-new-ticket-section-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600 !important;
    letter-spacing: -0.01em;
    color: var(--nexus-text) !important;
    margin-bottom: 0.55rem !important;
    line-height: 1.35 !important;
    font-size: 0.875rem !important;
}

.sat-new-ticket-section-title .mud-icon-root {
    color: var(--nexus-action);
    opacity: 0.75;
    font-size: 1.05rem !important;
}

.sat-new-ticket-alert {
    border-radius: 8px !important;
}

.sat-new-ticket-alert + .mud-grid,
.sat-new-ticket-section .sat-new-ticket-alert + * {
    margin-top: 0.25rem;
}

.sat-new-ticket-caption {
    display: block;
    padding: 0 0.25rem 0.5rem;
}

.sat-new-ticket-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--nexus-border);
}

.sat-new-ticket-footer-hint {
    text-align: left;
}

.sat-new-ticket-submit {
    align-self: flex-start;
    min-width: 9.5rem;
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
}

.sat-new-ticket-submit .mud-button-label {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.35rem;
}

@media (min-width: 600px) {
    .sat-new-ticket-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sat-new-ticket-footer-hint {
        order: -1;
        margin: 0;
    }
}

.sat-new-ticket-success {
    text-align: center;
}

.sat-new-ticket-success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.sat-new-ticket-success-icon .mud-icon-root {
    font-size: 2.75rem !important;
}

/* Campos densos: radio + helper (alineación global en html/body) */
.sat-new-ticket-page .sat-new-ticket-field .mud-input-control,
.sat-new-ticket-page .sat-new-ticket-form .mud-input-control {
    margin-top: 2px !important;
}

.sat-new-ticket-page .sat-new-ticket-field ::deep .mud-input-outlined-border,
.sat-new-ticket-page .sat-new-ticket-form ::deep .mud-input-outlined-border {
    border-radius: 6px !important;
}

.sat-new-ticket-page .sat-new-ticket-field ::deep .mud-input-control-input-container,
.sat-new-ticket-page .sat-new-ticket-form ::deep .mud-input-control-input-container {
    border-radius: 6px;
}

.sat-new-ticket-page .destination-department-select ::deep .mud-input-control-input-container {
    border-radius: 6px;
}

.sat-new-ticket-page .mud-button-root {
    border-radius: 8px !important;
    text-transform: none;
    font-weight: 600;
}

.sat-new-ticket-page .sat-new-ticket-footer .mud-button-root {
    border-radius: 8px !important;
    min-height: 34px;
    letter-spacing: 0;
}

.sat-new-ticket-page .ticket-attachment-dropzone {
    border-radius: 8px;
    background: var(--nexus-surface);
    padding: 0.85rem 0.75rem !important;
}

.sat-new-ticket-page .ticket-attachment-pending-item {
    border-radius: 8px;
}

.sat-new-ticket-page .mud-paper-outlined {
    border-radius: 8px !important;
    border-color: var(--nexus-border) !important;
    background: var(--nexus-surface) !important;
}

.sat-new-ticket-page .mud-checkbox .mud-button-root {
    border-radius: 6px !important;
}

.sat-new-ticket-page .mud-input-helper-text {
    font-size: 0.7rem !important;
}

/* ══════════════════════════════════════════════════════════════════
   Formulario Gestión del SAT (panel detalle)
   ══════════════════════════════════════════════════════════════════ */

.mgmt-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.mgmt-form-section {
    padding: 0;
    margin: 0;
}

.mgmt-form-label {
    margin: 0 0 0.45rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9AABB8;
}

.mgmt-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--nexus-border);
    flex-wrap: wrap;
}

.mgmt-form-hint {
    flex: 1;
    min-width: 10rem;
    line-height: 1.35 !important;
}

.mgmt-form-save {
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
    min-width: 6.5rem;
}

.mgmt-procedure-group .mud-button-root {
    text-transform: none !important;
    font-weight: 500 !important;
}

.linked-assets-picker {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.linked-assets-title {
    margin: 0 !important;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9AABB8 !important;
}

.linked-assets-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--nexus-border);
    border-radius: 8px;
    background: var(--nexus-surface-2);
}

.linked-assets-item {
    margin: 0 !important;
}

.linked-assets-item-main {
    display: block;
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--nexus-text);
}

.linked-assets-item-meta {
    display: block;
    font-size: 0.7rem;
    color: var(--nexus-text-muted);
    line-height: 1.25;
}

/* ══════════════════════════════════════════════════════════════════
   Dark mode — superficies y textos frecuentes fuera de Mud
   ══════════════════════════════════════════════════════════════════ */

[data-theme="dark"] .mud-paper,
[data-theme="dark"] .mud-table-container,
[data-theme="dark"] .mud-table,
[data-theme="dark"] .mud-expand-panel {
    background-color: var(--nexus-surface) !important;
    color: var(--nexus-text);
}

[data-theme="dark"] .mud-table th,
[data-theme="dark"] .mud-table td {
    color: var(--nexus-text);
    border-color: var(--nexus-border) !important;
}

[data-theme="dark"] .mud-input,
[data-theme="dark"] .mud-input-slot,
[data-theme="dark"] .mud-select,
[data-theme="dark"] .mud-input-label {
    color: var(--nexus-text);
}

[data-theme="dark"] .mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--nexus-border) !important;
}

[data-theme="dark"] .home-hero {
    background:
        linear-gradient(135deg, rgba(91, 155, 200, 0.12) 0%, rgba(111, 186, 148, 0.08) 48%, transparent 100%),
        var(--nexus-surface);
}

[data-theme="dark"] .home-status-pill--ok {
    background: rgba(111, 186, 148, 0.15);
    color: #8FDBB0;
    border-color: rgba(111, 186, 148, 0.35);
}

[data-theme="dark"] .home-status-pill--warn {
    background: rgba(212, 146, 74, 0.15);
    color: #E0B070;
    border-color: rgba(212, 146, 74, 0.35);
}

[data-theme="dark"] .home-card--accent .home-card-icon {
    color: var(--nexus-action);
}

[data-theme="dark"] .sat-new-ticket-page .mud-input-label,
[data-theme="dark"] .sat-new-ticket-page .mud-input,
[data-theme="dark"] .sat-new-ticket-page .mud-input-slot,
[data-theme="dark"] .sat-new-ticket-page .mud-select-input,
[data-theme="dark"] .sat-new-ticket-page .mud-typography-body1,
[data-theme="dark"] .sat-new-ticket-page .mud-typography-body2,
[data-theme="dark"] .sat-new-ticket-page .mud-typography-caption,
[data-theme="dark"] .sat-new-ticket-page .mud-input-helper-text {
    color: var(--nexus-text) !important;
}

[data-theme="dark"] .sat-new-ticket-page .mud-input-label.mud-input-label-inputcontrol {
    color: var(--nexus-text-soft) !important;
}

[data-theme="dark"] .sat-new-ticket-page .mud-input-control-input-container {
    background-color: var(--nexus-bg);
    border-radius: 6px;
}

[data-theme="dark"] .sat-new-ticket-footer-hint,
[data-theme="dark"] .sat-new-ticket-caption {
    color: var(--nexus-text-muted) !important;
}

[data-theme="dark"] .ticket-attachment-pending-name {
    color: var(--nexus-text);
}

[data-theme="dark"] .ticket-attachment-pending-size {
    color: var(--nexus-text-muted);
}

/* Tags del listado: estado, prioridad y SLA */
[data-theme="dark"] .tw-card-status--new,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--new {
    color: #9BCAE8;
    background: rgba(110, 149, 179, 0.22);
    border-color: rgba(110, 149, 179, 0.42);
}

[data-theme="dark"] .tw-card-status--pendingapproval,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--pendingapproval {
    color: #E0B070;
    background: rgba(212, 160, 74, 0.18);
    border-color: rgba(212, 160, 74, 0.40);
}

[data-theme="dark"] .tw-card-status--assigned,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--assigned {
    color: #7AD4C4;
    background: rgba(74, 155, 140, 0.18);
    border-color: rgba(74, 155, 140, 0.40);
}

[data-theme="dark"] .tw-card-status--inprogress,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--inprogress {
    color: #8FC5E8;
    background: rgba(78, 150, 196, 0.22);
    border-color: rgba(78, 150, 196, 0.42);
}

[data-theme="dark"] .tw-card-status--pausedbythirdparty,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--pausedbythirdparty {
    color: #E0A860;
    background: rgba(208, 138, 58, 0.18);
    border-color: rgba(208, 138, 58, 0.40);
}

[data-theme="dark"] .tw-card-status--resolved,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--resolved {
    color: #8FDBB0;
    background: rgba(47, 158, 95, 0.18);
    border-color: rgba(47, 158, 95, 0.40);
}

[data-theme="dark"] .tw-card-status--closed,
[data-theme="dark"] .tw-meta-tag--status.tw-card-status--closed {
    color: #9AADB8;
    background: rgba(154, 173, 184, 0.14);
    border-color: rgba(154, 173, 184, 0.32);
}

[data-theme="dark"] .tw-meta-tag--sla-ok {
    color: #8FDBB0;
    background: rgba(47, 158, 95, 0.16);
    border-color: rgba(47, 158, 95, 0.35);
}

[data-theme="dark"] .tw-meta-tag--sla-overdue {
    color: #F08080;
    background: rgba(212, 90, 90, 0.18);
    border-color: rgba(212, 90, 90, 0.40);
}

[data-theme="dark"] .tw-meta-tag--sla-paused {
    color: #E0A860;
    background: rgba(208, 138, 58, 0.18);
    border-color: rgba(208, 138, 58, 0.40);
}

[data-theme="dark"] .tw-meta-tag--sla-neutral {
    color: var(--nexus-text-muted);
    background: var(--nexus-surface-2);
    border-color: var(--nexus-border);
}

[data-theme="dark"] .tw-sla-ok {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-sla-warning {
    color: #E0B070;
}

[data-theme="dark"] .tw-sla-critical,
[data-theme="dark"] .tw-sla-overdue {
    color: #F08080;
}

[data-theme="dark"] .notif-badge {
    box-shadow: 0 0 0 2px var(--nexus-surface-2);
}

/* ══════════════════════════════════════════════════════════════════
   Dark mode — Panel de gestión de tickets (completo)
   ══════════════════════════════════════════════════════════════════ */

/* Contenedor general del workspace */
[data-theme="dark"] .tw-workspace {
    background: var(--nexus-surface);
    box-shadow: 0 1px 4px var(--nexus-shadow-soft);
}

[data-theme="dark"] .tw-toolbar {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-filters-panel {
    background: var(--nexus-surface-2);
    border-color: var(--nexus-border);
}

/* Lista izquierda */
[data-theme="dark"] .tw-list-pane {
    background: var(--nexus-bg);
    border-right-color: var(--nexus-border);
}

[data-theme="dark"] .tw-list-search,
[data-theme="dark"] .tw-list-filters {
    background: var(--nexus-surface);
}

[data-theme="dark"] .tw-list-summary {
    background: rgba(91, 155, 200, 0.12);
    border-bottom-color: var(--nexus-border);
}

[data-theme="dark"] .tw-list-summary-item {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-list-summary-item strong {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-list-footer {
    background: var(--nexus-surface);
    border-top-color: var(--nexus-border);
}

[data-theme="dark"] .tw-list-footer-count,
[data-theme="dark"] .tw-list-footer-page {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-list-nav-btn {
    color: var(--nexus-text);
    border-color: var(--nexus-border);
}

[data-theme="dark"] .tw-list-nav-btn:hover:not(:disabled) {
    background: var(--nexus-hover);
    border-color: var(--nexus-action);
    color: var(--nexus-text-strong);
}

/* Filas de ticket */
[data-theme="dark"] .tw-ticket-row {
    border-bottom-color: var(--nexus-border);
}

[data-theme="dark"] .tw-ticket-row:hover {
    background: var(--nexus-hover);
}

[data-theme="dark"] .tw-ticket-row--active {
    background: rgba(91, 155, 200, 0.18) !important;
}

[data-theme="dark"] .tw-ticket-row-title {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-ticket-row-email {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-ticket-row-unassigned {
    color: #D4924A;
    background: rgba(212, 146, 74, 0.15);
    border-color: rgba(212, 146, 74, 0.35);
}

[data-theme="dark"] .tw-ticket-card {
    border-bottom-color: var(--nexus-border);
}

[data-theme="dark"] .tw-ticket-card:hover {
    background: var(--nexus-hover);
}

[data-theme="dark"] .tw-ticket-card--active {
    background: rgba(91, 155, 200, 0.15) !important;
}

[data-theme="dark"] .tw-ticket-num,
[data-theme="dark"] .tw-detail-num {
    color: var(--nexus-text-muted);
}

/* Panel detalle (columna central) */
[data-theme="dark"] .tw-detail-pane,
[data-theme="dark"] .tw-detail-header {
    background: var(--nexus-surface);
}

[data-theme="dark"] .tw-detail-title-text {
    color: var(--nexus-text-strong);
}

[data-theme="dark"] .tw-mgmt-col {
    border-right-color: var(--nexus-border);
    background: var(--nexus-surface);
}

[data-theme="dark"] .tw-mgmt-sla-row {
    background: var(--nexus-surface);
}

[data-theme="dark"] .tw-tab-panel {
    background: transparent;
}

[data-theme="dark"] .tw-description {
    color: var(--nexus-text);
}

/* Chips / meta tags de la cabecera */
[data-theme="dark"] .tw-meta-tag {
    background: var(--nexus-surface-2);
    border-color: var(--nexus-border);
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-meta-label {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] a.tw-meta-person-tag:hover {
    background: var(--nexus-hover);
    border-color: var(--nexus-action);
    color: var(--nexus-text-strong);
}

[data-theme="dark"] .tw-meta-tag--rating {
    background: rgba(91, 155, 200, 0.15);
    border-color: rgba(91, 155, 200, 0.35);
    color: var(--nexus-action);
}

/* Cards de persona / rating */
[data-theme="dark"] .tw-person-card,
[data-theme="dark"] .tw-rating-panel {
    background: var(--nexus-surface-2);
    border-color: var(--nexus-border);
}

[data-theme="dark"] .tw-person-label,
[data-theme="dark"] .tw-person-email-k,
[data-theme="dark"] .tw-requester-label {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-person-name,
[data-theme="dark"] .tw-requester-name {
    color: var(--nexus-text-strong);
}

[data-theme="dark"] .tw-person-note,
[data-theme="dark"] .tw-requester-obo {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-person-empty {
    color: var(--nexus-text-muted);
}

/* Resumen e historial */
[data-theme="dark"] .tw-summary-facts {
    background: var(--nexus-surface-2);
}

[data-theme="dark"] .tw-summary-fact-k {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-summary-fact-v {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-summary-history li {
    border-bottom-color: var(--nexus-border);
}

[data-theme="dark"] .tw-summary-history-when {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-summary-history-what {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-summary-history-who {
    color: var(--nexus-text-soft);
}

[data-theme="dark"] .tw-history-day-label {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-history-item {
    border-bottom-color: var(--nexus-border);
}

[data-theme="dark"] .tw-history-time {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-history-text {
    color: var(--nexus-text);
}

[data-theme="dark"] .tw-history-actor {
    color: var(--nexus-text-soft);
}

/* Formulario de gestión + inputs Mud */
[data-theme="dark"] .tw-mgmt-col .mgmt-form-label,
[data-theme="dark"] .mgmt-form-label {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .mgmt-form-hint {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .tw-mgmt-col .mud-input-label,
[data-theme="dark"] .tw-mgmt-col .mud-input-label.mud-input-label-inputcontrol,
[data-theme="dark"] .tw-mgmt-col .mud-input-control > .mud-input-control-input-container > label {
    color: var(--nexus-text-soft) !important;
}

[data-theme="dark"] .tw-mgmt-col .mud-input,
[data-theme="dark"] .tw-mgmt-col .mud-input > input.mud-input-slot,
[data-theme="dark"] .tw-mgmt-col .mud-input .mud-select-input,
[data-theme="dark"] .tw-mgmt-col .mud-select .mud-input-slot,
[data-theme="dark"] .tw-mgmt-col .mud-typography-body1,
[data-theme="dark"] .tw-mgmt-col .mud-typography-body2,
[data-theme="dark"] .tw-mgmt-col .mud-typography-caption {
    color: var(--nexus-text) !important;
}

[data-theme="dark"] .tw-mgmt-col .mud-input-control-input-container,
[data-theme="dark"] .tw-mgmt-col .mud-input.mud-input-outlined,
[data-theme="dark"] .tw-mgmt-col .mud-input.mud-input-text {
    background-color: var(--nexus-surface-2);
    border-radius: 6px;
}

[data-theme="dark"] .tw-mgmt-col .mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--nexus-border) !important;
}

[data-theme="dark"] .tw-mgmt-col .mud-icon-root {
    color: var(--nexus-text-muted);
}

[data-theme="dark"] .mgmt-procedure-group .mud-button-root {
    color: var(--nexus-text);
    border-color: var(--nexus-border);
}

/* Columna de conversación */
[data-theme="dark"] .tw-conv-col,
[data-theme="dark"] .tw-conv-header,
[data-theme="dark"] .tw-conv-footer {
    background: var(--nexus-surface);
}

[data-theme="dark"] .tw-conv-header {
    color: var(--nexus-text-strong);
}

[data-theme="dark"] .tw-composer-pending-item {
    background: var(--nexus-surface-2);
}

[data-theme="dark"] .tw-composer-field .mud-input-control-input-container,
[data-theme="dark"] .tw-composer-field .mud-input.mud-input-outlined {
    background-color: var(--nexus-surface-2);
    border-radius: 10px;
}

[data-theme="dark"] .tw-composer-field .mud-input,
[data-theme="dark"] .tw-composer-field .mud-input-slot,
[data-theme="dark"] .tw-composer-field input {
    color: var(--nexus-text) !important;
}

[data-theme="dark"] .tw-composer-field .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--nexus-border) !important;
}

/* Burbujas de chat */
[data-theme="dark"] .ticket-message-bubble--theirs {
    background: var(--nexus-surface-2);
    color: var(--nexus-text);
    box-shadow: none;
}

[data-theme="dark"] .ticket-message-bubble--theirs .ticket-message-file {
    color: var(--nexus-action);
}

[data-theme="dark"] .ticket-message-bubble--mine {
    background: #3A7DAE;
    color: #fff;
}

/* Panel de resolución */
[data-theme="dark"] .tw-resolve-panel {
    background: rgba(111, 186, 148, 0.08);
    border-color: rgba(111, 186, 148, 0.35);
}

[data-theme="dark"] .tw-resolve-panel-title {
    color: var(--nexus-green) !important;
}

[data-theme="dark"] .tw-resolve-busy {
    background: rgba(26, 35, 50, 0.92);
    color: var(--nexus-green);
}

[data-theme="dark"] .finished-resolution-panel {
    background: rgba(91, 155, 200, 0.1);
}

[data-theme="dark"] .linked-assets-title {
    color: var(--nexus-text-muted) !important;
}

[data-theme="dark"] .notif-item--unread {
    background: rgba(91, 155, 200, 0.12);
}

/* Tabs del detalle */
[data-theme="dark"] .tw-mgmt-tabs .mud-tab {
    color: var(--nexus-text-muted) !important;
}

[data-theme="dark"] .tw-mgmt-tabs .mud-tab.mud-tab-active {
    color: var(--nexus-text-strong) !important;
}

[data-theme="dark"] .tw-mgmt-tabs .section-title,
[data-theme="dark"] .tw-mgmt-tabs .mud-typography-subtitle2 {
    color: var(--nexus-text) !important;
}


