* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F8F5FC;
    color: #2D2D2D;
}

/* ── LOGIN ── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('/static/img/Fondo_Plusi.png') center center / cover no-repeat;
    position: relative;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(107, 45, 139, 0.15);
}

.login-card {
    position: relative;
    z-index: 1;
}

.login-card {
    display: flex;
    width: 820px;
    min-height: 480px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #E8D8F5;
    box-shadow: 0 4px 32px rgba(107, 45, 139, 0.10);
}

.login-left {
    width: 42%;
    background: #FFFFFF;
    border-right: 1px solid #E8D8F5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 1.5rem;
}

.login-logo {
    width: 200px;
    object-fit: contain;
    padding: 8px;

}

.login-divider {
    width: 50px;
    height: 2px;
    background: #29ABE2;
    border-radius: 2px;
}

.login-badge {
    background: #6B2D8B;
    color: white;
    font-size: 11px;
    padding: 6px 18px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.login-description {
    font-size: 12px;
    color: #9B6BC0;
    text-align: center;
    line-height: 1.6;
}

.login-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    gap: 1.25rem;
    background: #F8F5FC;
    position: relative;
}

.login-top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6B2D8B 0%, #29ABE2 100%);
}

.login-title {
    font-size: 22px;
    font-weight: 500;
    color: #6B2D8B;
}

.login-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin-top: 6px;

}

.login-accent-line {
    width: 100%;
    height: 2px;
    background: #29ABE2;
    border-radius: 2px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12px;
    color: #6B2D8B;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9B6BC0;
    font-size: 16px;
}

.input-wrapper input {
    width: 100%;
    height: 42px;
    border: 1px solid #D4B8E8;
    border-radius: 8px;
    padding: 0 12px 0 36px;
    font-size: 14px;
    background: white;
    color: #2D2D2D;
    outline: none;
    transition: border-color 0.2s;
}

.input-wrapper input:focus {
    border-color: #6B2D8B;
}

.btn-login {
    width: 100%;
    height: 44px;
    background: #6B2D8B;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.2s;
    margin-top: 0.25rem;
}

.btn-login:hover {
    background: #4A1F6B;
}

.login-error {
    background: #FCEBEB;
    border: 1px solid #F7C1C1;
    color: #A32D2D;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.login-footer {
    font-size: 11px;
    color: #9CA3AF;
    text-align: center;
    margin-top: 0.5rem;
}

.login-plusi-avatar {
    width: 180px;
    object-fit: contain;
    margin-top: 0.5rem;
}

.login-plusi-greeting {
    font-size: 13px;
    color: #6B2D8B;
    font-weight: 500;
    text-align: center;
}

/* ── PANEL GENERAL ── */
.panel-shell {
    display: flex;
    min-height: 100vh;
    background: #F8F5FC;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 220px;
    background: #6B2D8B;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-top-accent {
    height: 3px;
    background: linear-gradient(90deg, #4A1F6B 0%, #29ABE2 100%);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #7D3A9E;
    display: flex;
    justify-content: center;
    background: white;
}

.sidebar-logo {
    width: 140px;
    object-fit: contain;
}

.sidebar-user {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #7D3A9E;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #29ABE2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.sidebar-user-info span:first-child {
    color: white;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info span:last-child {
    color: #C89EDF;
    font-size: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.sidebar-nav-label {
    color: #C89EDF;
    font-size: 10px;
    letter-spacing: 0.8px;
    padding: 0.5rem 1rem 0.2rem;
    text-transform: uppercase;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.5rem 1rem;
    color: #E0C8F5;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-nav-item:hover {
    background: #7D3A9E;
    color: white;
}

.sidebar-nav-item.active {
    background: #29ABE2;
    color: white;
}

.sidebar-nav-item i {
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #7D3A9E;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #C89EDF;
    font-size: 12px;
    text-decoration: none;
}

.sidebar-logout:hover {
    color: white;
}

.sidebar-logout i {
    font-size: 15px;
}

/* ── MAIN ── */
.panel-main {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── TOPBAR ── */
.panel-topbar {
    background: white;
    border-bottom: 1px solid #E8D8F5;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.panel-topbar-title {
    font-size: 16px;
    font-weight: 500;
    color: #6B2D8B;
}

.panel-topbar-sub {
    font-size: 12px;
    color: #9B6BC0;
}

.panel-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-topbar-date {
    font-size: 12px;
    color: #9B7080;
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-topbar-date i {
    font-size: 13px;
}

.panel-topbar-bell {
    color: #6B2D8B;
    font-size: 20px;
    cursor: pointer;
}

/* ── CONTENT ── */
.panel-content {
    flex: 1;
    padding: 1.5rem;
    position: relative;
}

.plusi-corner-img {
    position: absolute;
    bottom: 0;
    right: 1rem;
    width: 130px;
    object-fit: contain;
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* ── STATUS BAR ── */
.panel-status-bar {
    background: white;
    border-top: 1px solid #E8D8F5;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
}

.status-pill i {
    font-size: 12px;
}

.status-pill.purple {
    background: #F3E8FF;
    color: #6B2D8B;
}

.status-pill.teal {
    background: #E0F7F4;
    color: #0891B2;
}

.status-pill.green {
    background: #DCFCE7;
    color: #166534;
}

/* ── MÉTRICAS ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 1.25rem;
}

.metric-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #E8D8F5;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.metric-icon.purple { background: #F3E8FF; color: #6B2D8B; }
.metric-icon.teal   { background: #E0F7F4; color: #0891B2; }
.metric-icon.amber  { background: #FEF3C7; color: #D97706; }
.metric-icon.red    { background: #FEE2E2; color: #DC2626; }

.metric-label {
    font-size: 11px;
    color: #9B6BC0;
    margin-top: 2px;
}

.metric-value {
    font-size: 28px;
    font-weight: 500;
    color: #2D2D2D;
    line-height: 1;
}

.metric-sub {
    font-size: 11px;
    color: #9CA3AF;
}

/* ── SECCIONES ── */
.sections-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 12px;
}

.panel-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #E8D8F5;
}

.panel-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #F3E8FF;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-card-title {
    font-size: 13px;
    font-weight: 500;
    color: #6B2D8B;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-card-title i { font-size: 15px; }

.panel-card-link {
    font-size: 11px;
    color: #29ABE2;
    text-decoration: none;
}

/* ── CASOS ESCALADOS ── */
.case-list { padding: 0.25rem 0; }

.case-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #FAF5FF;
}

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

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

.urgency-dot.high   { background: #EF4444; }
.urgency-dot.medium { background: #F59E0B; }
.urgency-dot.low    { background: #10B981; }

.case-info { flex: 1; min-width: 0; }

.case-info .case-title {
    display: block;
    font-size: 12px;
    color: #2D2D2D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-info .case-meta {
    display: block;
    font-size: 10px;
    color: #9CA3AF;
}

.case-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.case-badge.pqrs { background: #F3E8FF; color: #6B2D8B; }
.case-badge.cita { background: #E0F7F4; color: #0891B2; }

/* ── ACCIONES RÁPIDAS ── */
.quick-actions {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qa-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #E8D8F5;
    background: #FAF5FF;
    color: #6B2D8B;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.15s;
}

.qa-btn:hover { background: #F3E8FF; }

.qa-btn i {
    font-size: 16px;
    color: #9B6BC0;
}

.sidebar-logout {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 0;
}

/* ── CASOS ESCALADOS ── */
.casos-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 100px;
}

.caso-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #E8D8F5;
    overflow: hidden;
}

.caso-card.urgencia-alta {
    border-left: 4px solid #EF4444;
}

.caso-card.urgencia-media {
    border-left: 4px solid #F59E0B;
}

.caso-card.urgencia-normal {
    border-left: 4px solid #10B981;
}

.caso-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #F3E8FF;
    background: #FAF5FF;
}

.caso-urgencia-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6B2D8B;
}

.caso-fecha {
    font-size: 11px;
    color: #9CA3AF;
}

.caso-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.caso-motivo {
    font-size: 13px;
    color: #2D2D2D;
}

.caso-resumen {
    font-size: 12px;
    color: #6B7280;
    line-height: 1.5;
}

.caso-responsable {
    font-size: 12px;
    color: #29ABE2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.caso-actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid #F3E8FF;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-tomar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #6B2D8B;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-tomar:hover { background: #4A1F6B; }

.btn-resolver {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
}

.btn-liberar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #F3E8FF;
    color: #6B2D8B;
    border: 1px solid #D4B8E8;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
}

.btn-ver-chat {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #E0F7F4;
    color: #0891B2;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    text-decoration: none;
}

.casos-vacio {
    padding: 3rem 1rem;
    text-align: center;
    color: #9B6BC0;
    font-size: 13px;
}

/* ── CONVERSACIONES ── */
.conversaciones-lista {
    padding: 0.25rem 0;
}

.conversacion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #FAF5FF;
    text-decoration: none;
    transition: background 0.15s;
}

.conversacion-item:hover { background: #FAF5FF; }

.conv-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F3E8FF;
    color: #6B2D8B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.conv-info { flex: 1; min-width: 0; }

.conv-nombre {
    font-size: 13px;
    color: #2D2D2D;
    font-weight: 500;
}

.conv-meta {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}

.conv-estado {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
}

.conv-estado-activa { background: #DCFCE7; color: #166534; }
.conv-estado-inactiva { background: #FEF3C7; color: #D97706; }
.conv-estado-cerrada { background: #F3E8FF; color: #6B2D8B; }

/* ── DETALLE CONVERSACIÓN ── */
.detalle-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 100px;
}


.chat-burbuja {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 80%;
}

.chat-burbuja-usuario { align-self: flex-end; }
.chat-burbuja-plusi { align-self: flex-start; }
.chat-burbuja-sistema { align-self: center; }

.chat-remitente {
    font-size: 10px;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-burbuja-usuario .chat-remitente { justify-content: flex-end; }

.chat-contenido {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-burbuja-usuario .chat-contenido {
    background: #6B2D8B;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-burbuja-plusi .chat-contenido {
    background: #F3E8FF;
    color: #2D2D2D;
    border-bottom-left-radius: 4px;
}

.chat-burbuja-sistema .chat-contenido {
    background: #F8F5FC;
    color: #9B6BC0;
    font-size: 11px;
    border-radius: 20px;
}

.chat-hora {
    font-size: 10px;
    color: #9CA3AF;
}

.chat-burbuja-usuario .chat-hora { text-align: right; }

.ia-badge {
    background: #29ABE2;
    color: white;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ── RESPUESTA ASESOR ── */
.chat-respuesta-asesor {
    padding: 1rem;
    border-top: 1px solid #E8D8F5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #FAF5FF;
}

.chat-respuesta-textarea {
    width: 100%;
    border: 1px solid #D4B8E8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    color: #2D2D2D;
}

.chat-respuesta-textarea:focus {
    border-color: #6B2D8B;
}

/* ── CHAT INPUT AREA (estilo WhatsApp) ── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
}

.chat-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0.75rem 1rem;
    border-top: 1px solid #E8D8F5;
    background: white;
    border-radius: 0 0 10px 10px;
}

.chat-input-textarea {
    flex: 1;
    border: 1px solid #D4B8E8;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    color: #2D2D2D;
    background: #FAF5FF;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
}

.chat-input-textarea:focus {
    border-color: #6B2D8B;
    background: white;
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #6B2D8B;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chat-send-btn:hover {
    background: #4A1F6B;
}