/* Ajustes propios del panel administrativo (sobre el tema Dore de la Web). */

.suite-badge {
    margin-left: 16px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #1d1d1d;
    color: #fec107;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.navbar .user form .dropdown-item {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
}

/* MFA */
.qr-box {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
}

.qr-box svg {
    width: 200px;
    height: 200px;
}

.shared-key {
    font-family: Consolas, "Courier New", monospace;
    font-size: 1rem;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 1rem;
}

.code-input {
    font-size: 1.4rem;
    letter-spacing: 0.3em;
    text-align: center;
}

/* Dashboard */
/* Tarjetas de indicadores del Dashboard: 3 por renglón (dos renglones parejos de 6), 6 en monitores muy anchos y 2
   en teléfono con el ícono arriba. */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1900px) {
    .kpi-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.kpi-card .card-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.kpi-card .card-body > div {
    min-width: 0;
}

.kpi-card i {
    flex: none;
    font-size: 2.2rem;
    color: var(--theme-color-1, #fec107);
}

@media (max-width: 767px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .kpi-grid .kpi-card .card-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 1rem;
    }

    .kpi-grid .kpi-card i {
        font-size: 1.8rem;
    }
}

.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.kpi-card .kpi-label {
    color: #8f8f8f;
    font-size: 0.85rem;
}

.kpi-card .kpi-detail {
    color: #8f8f8f;
    font-size: 0.75rem;
    margin-top: 0.1rem;
}

.visits-chart {
    width: 100%;
    height: 220px;
}

.visits-chart rect {
    fill: #fec107;
}

.visits-chart rect:hover {
    fill: #d39e00;
}

.visits-chart text {
    font-size: 10px;
    fill: #8f8f8f;
}

.bar-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.bar-list li:last-child {
    border-bottom: 0;
}

.job-status {
    display: inline-block;
    min-width: 86px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    text-align: center;
}

.job-status.ok { background: #e3f6e8; color: #1e7b34; }
.job-status.fail { background: #fde4e4; color: #b42318; }
.job-status.run { background: #fff4d6; color: #8a6100; }

/* Hubs (Usuarios, Catálogos) */
.hub-card {
    display: block;
    height: 100%;
    color: inherit;
}

.hub-card:hover {
    color: inherit;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.hub-card i {
    font-size: 2rem;
    color: #fec107;
}

/* Soporte → Chats: bandeja a la izquierda, conversación a la derecha (usa los estilos de chat-widget.css). */
.suite-menu-badge {
    position: absolute;
    top: 10px;
    right: 14px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.main-menu li a {
    position: relative;
}

.suite-chat-unread[hidden],
.suite-menu-badge[hidden] {
    display: none !important;
}

.sc {
    display: flex;
    height: calc(100vh - 260px);
    min-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 15px rgba(0, 0, 0, .04), 0 1px 6px rgba(0, 0, 0, .04);
    overflow: hidden;
}

.sc-inbox {
    width: 340px;
    flex: none;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ececec;
}

.sc-inbox-head {
    padding: 12px;
    border-bottom: 1px solid #ececec;
}

.sc-filters {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.sc-filter {
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 14px;
    padding: 3px 12px;
    font-size: 12px;
    cursor: pointer;
}

.sc-filter.is-active {
    background: #1f1f1f;
    border-color: #1f1f1f;
    color: #fff;
}

.sc-list {
    flex: 1;
    overflow-y: auto;
}

.sc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #f3f3f3;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sc-item:hover {
    background: #f6f4ef;
}

.sc-item.is-active {
    background: #f3e3c3;
}

.sc-item.has-unread .ml-chat-preview {
    color: #303030;
    font-weight: 600;
}

.sc-email {
    display: block;
    font-size: 11px;
    color: #8a8a8a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-thread {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sc-thread.is-dragging .ml-chat-drop {
    display: flex;
}

.sc-thread .ml-chat-drop {
    inset: 64px 0 0 0;
}

.sc-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8a8a8a;
    text-align: center;
}

.sc-placeholder i {
    font-size: 3rem;
    color: #e7c48c;
}

.sc-thread-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #ececec;
}

/* Con poco ancho los botones (bot, Sugerir respuesta, Ver usuario) bajan de renglón en vez de partir el nombre. */
.sc-thread-title {
    flex: 1 1 180px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sc-thread-title small {
    color: #8a8a8a;
}

.sc-messages {
    flex: 1;
    padding: 14px 18px;
}

.sc .ml-chat-bubble {
    max-width: 70%;
}

.sc-who {
    font-size: 11px;
    color: #8a8a8a;
    margin: 6px 4px 2px;
}

/* Respuestas automáticas: burbuja del bot distinta a la de una persona del equipo y estado por conversación. */
.sc-who.is-auto {
    color: #8a6d1f;
    font-weight: 600;
}

.sc .ml-chat-msg.is-auto .ml-chat-bubble {
    background: #fff8e6;
    border: 1px dashed #c9a24b;
}

.sc-bot {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.sc-bot.is-active { background: #e6f6ec; color: #1e7b44; }
.sc-bot.is-paused { background: #ececec; color: #555; }
.sc-bot.is-human { background: #fde8e8; color: #b42323; }
.sc-bot.is-attended { background: #e8f0fd; color: #1f56b0; }

.sc-item .sc-bot {
    align-self: flex-start;
    margin-top: 2px;
}

.sc-thread-head .btn {
    white-space: nowrap;
}

.sc-bot-tools {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* Teléfono: el estado del bot y sus botones bajan a su propia línea para no tapar el nombre. */
@media (max-width: 767px) {
    .sc-thread-head {
        flex-wrap: wrap;
    }

    .sc-bot-tools {
        order: 3;
        width: 100%;
        margin-left: 0;
    }
}

.sc .ml-chat-composer textarea {
    max-height: 160px;
}

@media (max-width: 991px) {
    .sc {
        flex-direction: column;
        height: auto;
    }

    .sc-inbox {
        width: auto;
        max-height: 320px;
        border-right: 0;
        border-bottom: 1px solid #ececec;
    }

    .sc-thread {
        min-height: 480px;
    }
}

/* Usuarios → Ver (ficha del usuario). */
.ud-identity {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.ud-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e7c48c;
    color: #1f1f1f;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.ud-main {
    flex: 1;
    min-width: 260px;
}

.ud-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 1.2rem;
}

.ud-plan {
    font-size: 11px;
}

.ud-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 6px;
    color: #6d6d6d;
    font-size: .85rem;
}

.ud-meta i {
    margin-right: 4px;
}

.ud-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

.ud-stats > div {
    flex: 1 1 140px;
    display: flex;
    flex-direction: column;
}

.ud-stats span {
    font-size: 1.15rem;
    font-weight: 700;
}

.ud-stats small {
    color: #8a8a8a;
}

/* Texto dentro de la etiqueta (ej. "usó 12 de 300"): no toma el tamaño de la cifra. */
.ud-stats small span {
    font-size: inherit;
    font-weight: inherit;
}

.ud-stats .is-danger span {
    color: #e53935;
}

.ud-dl {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 6px 12px;
    margin: 0;
}

.ud-dl dt {
    color: #8a8a8a;
    font-weight: 400;
}

.ud-dl dd {
    margin: 0;
}

.ud-record {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ud-record-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ud-record-body {
    white-space: pre-wrap;
    font-size: .9rem;
}

#expedients-table tbody tr {
    cursor: pointer;
}

/* Detalle del expediente: casi todo el ancho para que las pestañas (Editar, Acuerdos, ...) quepan en un renglón. */
#expedient-modal .modal-dialog {
    max-width: min(1140px, calc(100vw - 2rem));
}

#expedient-modal .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

#expedient-modal .tab-content {
    margin-top: 1.25rem;
}

@media (max-width: 575px) {
    .ud-dl {
        grid-template-columns: 1fr;
    }
}

.ud-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Soporte → Chats en modo oscuro: los colores del chat son variables (--mlc-*, chat-widget.css) y aquí se redefinen
   con los tonos de las tarjetas de Dore dark; lo demás son los blancos fijos de la bandeja y de las burbujas. */
body.theme-dark .ml-chat {
    --mlc-ink: #e6e6e6;
    --mlc-text: #d6d6d6;
    --mlc-muted: #9a9a9a;
    --mlc-line: #33312e;
    --mlc-bg: #242321;
    --mlc-soft: #1b1a18;
    --mlc-mine: #4a3d22;
    --mlc-theirs: #2c2b28;
}

body.theme-dark .sc {
    background: #242321;
    box-shadow: 0 1px 15px rgba(0, 0, 0, .1), 0 1px 8px rgba(0, 0, 0, .1);
}

body.theme-dark .sc-inbox,
body.theme-dark .sc-inbox-head,
body.theme-dark .sc-thread-head {
    border-color: #33312e;
}

body.theme-dark .sc-filter {
    background: #2c2b28;
    border-color: #3a3835;
    color: #c8c8c8;
}

body.theme-dark .sc-filter.is-active {
    background: #e3b778;
    border-color: #e3b778;
    color: #1f1e1c;
}

body.theme-dark .sc-item { border-bottom-color: #2e2c29; }
body.theme-dark .sc-item:hover { background: #2c2b28; }
body.theme-dark .sc-item.is-active { background: #3d3322; }
body.theme-dark .sc-item.has-unread .ml-chat-preview { color: #e6e6e6; }
body.theme-dark .sc-who.is-auto { color: #e3b778; }

body.theme-dark .sc .ml-chat-msg.is-auto .ml-chat-bubble {
    background: #2f2919;
    border-color: #8a6d1f;
}

body.theme-dark .sc .ml-chat-msg.is-theirs .ml-chat-bubble { background: var(--mlc-theirs); }
body.theme-dark .sc .ml-chat-composer { background: var(--mlc-bg); }
body.theme-dark .sc .ml-chat-composer .ml-chat-icon { color: #b5b5b5; }
body.theme-dark .sc .ml-chat-composer textarea { background: #1b1a18; color: #e0e0e0; }
body.theme-dark .sc .ml-chat-composer textarea::placeholder { color: #8a8a8a; }
body.theme-dark .sc .ml-chat-text a { color: #8ab4f8; }
body.theme-dark .sc .ml-chat-day span { background: #33312e; color: #b5b5b5; }
body.theme-dark .sc .ml-chat-image { background: #33312e; }
body.theme-dark .sc .ml-chat-emoji-pop { background: #242321; }

body.theme-dark .sc-bot.is-active { background: #1d3527; color: #7fd6a0; }
body.theme-dark .sc-bot.is-paused { background: #33312e; color: #c8c8c8; }
body.theme-dark .sc-bot.is-human { background: #3b1f1d; color: #ffb4ab; }
body.theme-dark .sc-bot.is-attended { background: #1d2a40; color: #9cc0ff; }

@media (max-width: 991px) {
    body.theme-dark .sc-inbox { border-bottom-color: #33312e; }
}

/* Pestañas de la ficha del usuario: barra blanca con la activa en dorado. */
.ud-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 16px;
    padding: 6px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 15px rgba(0, 0, 0, .04), 0 1px 6px rgba(0, 0, 0, .04);
}

.ud-tabs .nav-link {
    border: 0;
    border-radius: 8px;
    padding: 9px 18px;
    color: #555;
    font-weight: 600;
    transition: background .15s ease, color .15s ease;
}

.ud-tabs .nav-link:hover {
    background: #f6f4ef;
    color: #1f1f1f;
}

.ud-tabs .nav-link.active {
    background: #e3b778;
    color: #fff;
}

/* Modo oscuro: la barra toma el color de las tarjetas del tema (Dore dark). */
body.theme-dark .ud-tabs {
    background: #242321;
    box-shadow: 0 1px 15px rgba(0, 0, 0, .1), 0 1px 8px rgba(0, 0, 0, .1);
}

body.theme-dark .ud-tabs .nav-link {
    color: #a8a8a8;
}

body.theme-dark .ud-tabs .nav-link:hover {
    background: #2f2d2a;
    color: #e6e6e6;
}

body.theme-dark .ud-tabs .nav-link.active {
    background: #e3b778;
    color: #1f1e1c;
}

/* Contenido de las pestañas de la ficha pegado a la barra (que no se vea cortada). */
#user-details {
    margin-top: -10px;
}

.kpi-card.is-positive .kpi-value { color: #1e7b34; }
.kpi-card.is-negative .kpi-value { color: #b42318; }

/* Reportes */

.report-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 16px;
}

.report-filters label {
    margin: 0;
    font-size: .8rem;
    color: #8a8a8a;
}

.report-filters .form-control {
    min-width: 160px;
}

.report-svg rect {
    fill: initial;
}

.suite-bar-svg {
    display: block;
    max-width: 100%;
}

.suite-bar-svg text {
    font-size: 11px;
    fill: #8f8f8f;
}

.report-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
    font-size: .8rem;
    color: #6d6d6d;
}

.report-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border-radius: 2px;
}

.report-card h5 {
    font-weight: 600;
}
