@import url(https://fonts.googleapis.com/css?family=Lato:400,700);

#Chat {
    font: 13px/1.4 "Lato", "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    position: fixed;
    right: 0;
    height: 70%;
    max-height: 650px;
    min-height: 480px;
    bottom: 0;
    z-index: 9999;
}

#Chat ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background: transparent;
}
#Chat ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
#Chat ::-webkit-scrollbar-thumb {
    background: #607d8b;
    border-radius: 3px;
}
#Chat ::-webkit-scrollbar-thumb:hover {
    background: #455a64;
    cursor: pointer;
}

#Chat *, #Chat *:before, #Chat *:after {
    box-sizing: border-box;
}

#Chat li {
    list-style: none;
}

/* =========================================================
   TRIGGER BUTTON (DOCK IN BOTTOM RIGHT CORNER)
   ========================================================= */
#Chat .button-chat {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 280px;
    height: 46px;
    padding: 0 16px 0 56px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #1e242d !important;
    border-top: 3px solid #0F7246 !important; /* Verde Institucional */
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 !important;
    color: #f0f4f8 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

#Chat .button-chat:hover {
    background: #28303d !important;
    transform: translateY(-2px);
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.45);
    color: #ffffff !important;
}

#Chat .button-chat .pending {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 46px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0F7246 !important; /* Verde Institucional */
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
    border-radius: 0 !important;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.2);
}

#Chat .button-chat .btn-chat-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#Chat .button-chat .btn-chat-text i {
    color: #0F7246;
    font-size: 15px;
}

#Chat .button-chat .unread {
    position: absolute;
    background: #0F7246;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    padding-left: 56px;
    padding-right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    border-radius: 0 !important;
    animation: notif-color 2s infinite;
    box-sizing: border-box;
}

#Chat .button-chat .unread i {
    font-size: 15px;
    display: inline-block;
    animation: bounceIcon 1s infinite alternate ease-in-out;
}

@keyframes bounceIcon {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.22);
    }
}

@keyframes notif-color {
    0% {
        background-color: #0F7246;
        color: #ffffff;
    }
    50% {
        background-color: #a20025;
        color: #ffffff;
    }
    100% {
        background-color: #0F7246;
        color: #ffffff;
    }
}

#Chat .ord-lib {
    display: none;
    position: fixed;
    bottom: 50px;
    right: 0;
    width: 300px;
    text-align: center;
    font-size: 13.5px;
    line-height: 1.4;
    background: #1b2838;
    border-top: 3px solid #0F7246;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 !important;
    padding: 14px 34px 14px 14px;
    color: white !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

#Chat .ord-lib:hover {
    background: #243548;
}

#Chat .ord-lib .msg {
    display: block;
    width: 100%;
    cursor: pointer;
}

#Chat .ord-lib a.ord-lib-close {
    font-size: 14px;
    position: absolute;
    right: 8px;
    top: 8px;
    padding: 4px;
    color: #abb2bf;
    text-decoration: none;
    cursor: pointer;
    z-index: 2;
}

#Chat .ord-lib a.ord-lib-close:hover {
    color: #ffffff;
}

/* =========================================================
   CONTAINER / WINDOW
   ========================================================= */
#Chat .container-chat {
    display: none;
    position: fixed;
    bottom: 0;
    right: 0;
    width: 780px;
    max-width: 95vw;
    height: 70%;
    max-height: 650px;
    min-height: 480px;
    background: #1e222b;
    border-radius: 0 !important;
    border-top: 3px solid #0F7246 !important; /* Verde Institucional */
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    overflow: hidden;
    z-index: 10000;
}

/* =========================================================
   SIDEBAR / LISTA DE ÓRDENES
   ========================================================= */
#Chat .people-list {
    position: relative;
    height: 100%;
    width: 260px;
    float: left;
    background: #161920;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
}

#Chat .title {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    color: #e6edf3;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #12141a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

#Chat .chat-toggle-close {
    color: #8b949e;
    text-decoration: none;
    font-size: 14px;
    padding: 4px;
    transition: color 0.15s ease;
}
#Chat .chat-toggle-close:hover {
    color: #ffffff;
}

#Chat .new_order {
    display: none;
    width: 100%;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #0F7246 !important; /* Verde Institucional */
    color: #ffffff !important;
    border: none;
    border-radius: 0 !important;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease;
    box-sizing: border-box;
}
#Chat .new_order:hover {
    background: #138d57 !important;
    color: #ffffff !important;
}

#Chat .people-list ul {
    position: relative;
    overflow-y: auto;
    height: calc(100% - 46px);
    margin: 0;
    padding: 0;
    flex: 1;
}

#Chat .people-list ul li {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}

#Chat .people-list ul li:hover {
    background: #222733;
}

#Chat .people-list img {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

#Chat .people-list img.connected {
    border-color: #0F7246;
}

#Chat .people-list img.idle {
    border-color: #fa6800;
}

#Chat .people-list .about {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#Chat .people-list .name {
    color: #e6edf3;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

#Chat .people-list .liberar .name {
    color: #0F7246 !important;
}

#Chat .people-list .status {
    color: #8b949e;
    font-size: 11px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#Chat .people-list .status small {
    color: #6e7681;
}

#Chat .people-list .unread {
    float: right;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #e51400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#Chat .people-list .liberar {
    border-left: 3px solid #0F7246;
    background: rgba(15, 114, 70, 0.1);
}

/* =========================================================
   RIGHT PANELS (NEW & CHAT)
   ========================================================= */
#Chat .chat, #Chat .new {
    width: calc(100% - 260px);
    float: left;
    color: #333333;
    background: #f4f6f9;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#Chat .new .chat-header {
    height: 46px;
    background: #ffffff;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#Chat .new .chat-header h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: #24292e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================================
   GRID DE BOTONES DE NUEVA ORDEN (METRO TILES TOTALMENTE VISIBLES Y CUADRADOS)
   ========================================================= */
#Chat .shortcuts-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
    padding: 20px !important;
    width: 100% !important;
    height: calc(100% - 46px) !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

#Chat .chat-area-btn {
    width: 100% !important;
    height: auto !important;
    min-height: 90px !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 16px 12px !important;
    border: none !important;
    border-radius: 0 !important; /* Esquinas cuadradas estilo Metro */
    cursor: pointer !important;
    color: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    overflow: visible !important;
    text-align: center !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

#Chat .chat-area-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22) !important;
    filter: brightness(1.08) !important;
}

#Chat .chat-area-btn i {
    font-size: 28px !important;
    line-height: 1 !important;
    margin: 0 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
}

#Chat .chat-area-btn .shortcut-label {
    display: block !important;
    width: 100% !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    color: #ffffff !important;
}

/* Sistemas spans full 2 columns */
#Chat .chat-area-btn.btn-sistemas {
    grid-column: span 2 !important;
    flex-direction: row !important;
    gap: 14px !important;
    min-height: 75px !important;
    border-radius: 0 !important;
}

#Chat .chat-area-btn.btn-sistemas i {
    font-size: 32px !important;
}

#Chat .chat-area-btn.btn-sistemas .shortcut-label {
    width: auto !important;
    font-size: 15px !important;
    text-align: left !important;
}

/* =========================================================
   CHAT HEADER & TABS
   ========================================================= */
#Chat .chat .chat-header {
    height: 96px;
    background: #ffffff;
    border-bottom: 1px solid #e1e4e8;
    padding: 10px 14px 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#Chat .chat .chat-header .chat-info {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0;
}

#Chat .chat .chat-header img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

#Chat .chat .chat-header .chat-about {
    margin-left: 10px;
    flex: 1;
    min-width: 0;
}

#Chat .chat .chat-header .chat-with {
    font-weight: 700;
    font-size: 13.5px;
    color: #24292e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#Chat .chat .chat-header .chat-num-messages {
    color: #586069;
    font-size: 11.5px;
    font-weight: 600;
}

#Chat .chat .chat-header a.liberar {
    display: none;
    margin-left: auto;
    border-radius: 0 !important;
    border: none;
}

#Chat .chat .chat-header a.modificar {
    display: none;
    margin-left: 6px;
    border-radius: 0 !important;
    border: none;
}

#Chat .chat .chat-buttons {
    width: 100%;
    display: flex;
    gap: 4px;
    background: #eef1f5;
    padding: 3px;
    border-radius: 0 !important;
    margin-top: 6px;
}

#Chat .chat .chat-buttons button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #586069;
    border-radius: 0 !important;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

#Chat .chat .chat-buttons button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #24292e;
}

#Chat .chat .chat-buttons button.active {
    background: #0F7246 !important; /* Verde Institucional */
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* =========================================================
   CHAT MESSAGES & DETAIL CONTAINER
   ========================================================= */
#Chat .chat-container {
    position: relative;
    height: calc(100% - 96px);
    overflow-y: auto;
    padding: 12px;
    background: #ffffff;
    box-sizing: border-box;
}

#Chat .chat-container#chat-messages {
    padding: 0;
    display: flex;
    flex-direction: column;
}

#Chat .chat .chat-history {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: 14px;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    overflow-y: auto;
    overflow-x: hidden;
}

#Chat .chat .chat-history ul {
    margin: 0;
    padding: 0;
}

#Chat .chat .chat-history .message-data {
    margin-bottom: 6px;
}

#Chat .chat .chat-history .message-data-name {
    font-size: 12px;
    font-weight: 700;
    color: #444d56;
}

#Chat .chat .chat-history .message-data-time {
    color: #8c959f;
    font-size: 11px;
    padding-left: 4px;
}

#Chat .chat .chat-history .message-row {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 18px !important;
    position: relative !important;
    clear: both !important;
    width: 100% !important;
}

#Chat .chat .chat-history .message-row.message-row-other {
    justify-content: flex-start !important;
}

#Chat .chat .chat-history .message-row.message-row-me {
    justify-content: flex-end !important;
}

#Chat .chat .chat-history .chat-msg-avatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid rgba(0, 0, 0, 0.12) !important;
    margin-top: 2px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
    flex-shrink: 0 !important;
}

#Chat .chat .chat-history .message-row-me .chat-msg-avatar {
    border-color: #0F7246 !important;
}

#Chat .chat .chat-history .message-content-wrap {
    display: flex !important;
    flex-direction: column !important;
    max-width: 80% !important;
}

#Chat .chat .chat-history .message-row-me .message-content-wrap {
    align-items: flex-end !important;
}

#Chat .chat .chat-history .message-row-other .message-content-wrap {
    align-items: flex-start !important;
}

#Chat .chat .chat-history .message {
    color: #ffffff !important;
    padding: 10px 14px !important;
    line-height: 1.45 !important;
    font-size: 13px !important;
    border-radius: 4px !important;
    margin-bottom: 0 !important;
    max-width: 100% !important;
    position: relative !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
}

#Chat .chat .chat-history .my-message {
    background: #0F7246 !important; /* Verde Institucional */
    border-radius: 6px 0 6px 6px !important;
}

#Chat .chat .chat-history .other-message {
    background: #24292e !important;
    border-radius: 0 6px 6px 6px !important;
}

#Chat .chat .chat-history .message img {
    cursor: pointer !important;
    max-width: 100% !important;
    border-radius: 2px !important;
}

/* =========================================================
   INPUT BAR
   ========================================================= */
#Chat .chat-input-bar {
    flex-shrink: 0;
    padding: 10px 12px 12px;
    background: #ffffff;
}

#Chat textarea#message-to-send {
    border: 1px solid #d1d5da;
    border-radius: 3px;
    padding: 8px 10px;
    font: 13px/18px "Lato", "Segoe UI", Arial, sans-serif;
    resize: none;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

#Chat textarea#message-to-send:focus {
    border-color: #0F7246;
    box-shadow: 0 0 0 2px rgba(15, 114, 70, 0.25);
}

#Chat .align-left {
    text-align: left;
}
#Chat .align-right {
    text-align: right;
}
#Chat .float-right {
    float: right;
}

#Chat .clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
}