/* ============================================================
   HELP MENU — icon colors
   ============================================================ */
#helpMenu .fa-book-open{color:var(--blue,#2F6FEA);}
#helpMenu .fa-circle-question{ color:#F59E0B; }
#helpMenu .fa-keyboard{ color:#10B981; }
#helpMenu .fa-code-branch{ color:#8B5CF6; }
#helpMenu .fa-headset{ color:#06B6D4; }
#helpMenu .fa-circle-info{ color:#6B7280; }

/* Varian dropdown-item khusus help menu (icon + judul + deskripsi).
   Dipisah dari .dropdown-item global (di layout.css) supaya tidak
   menimpa notif/user-menu yang pakai layout satu baris. */
.help-item{
    display:flex;
    align-items:flex-start;
    gap:12px;
    padding:10px 12px;
    border-radius:10px;
    transition:background .15s ease;
}
.help-item:hover{ background:var(--bg); }
.help-item i{
    width:18px;
    margin-top:2px;
    color:var(--blue);
    flex-shrink:0;
    text-align:center;
    font-size:13.5px;
}
.help-item div{ display:flex; flex-direction:column; }
.help-item strong{ font-size:13px; color:var(--text); font-weight:600; }
.help-item small{ margin-top:2px; font-size:11px; color:var(--mute); }

/* ============================================================
   MESSAGE V2 — UNIFIED WORKSPACE MESSENGER
   ============================================================ */
:root{
    --chat-primary:var(--blue,#2F6FEA);
    --chat-primary-strong:var(--blue-dark,#1E5FE0);
    --chat-primary-soft:var(--blue-soft,#EEF4FF);
    --chat-bg:#F7F9FD;
    --chat-surface:#FFFFFF;
    --chat-border:#E6EAF2;
    --chat-border-strong:#D9E0EC;
    --chat-ink:#101828;
    --chat-ink-soft:#667085;
    --chat-ink-faint:#98A2B3;
    --chat-success:#12B76A;
    --chat-danger:#D92D20;
    --chat-shadow:0 28px 80px rgba(16,24,40,.18),0 8px 24px rgba(16,24,40,.08);
}

.chat-overlay{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.24);
    backdrop-filter:blur(2px);
    -webkit-backdrop-filter:blur(2px);
    opacity:0;
    visibility:hidden;
    transition:opacity .2s ease,visibility .2s ease;
    z-index:99970;
}
.chat-overlay.show{opacity:1;visibility:visible}

.chat-panel{
    position:fixed;
    top:12px;
    right:-900px;
    bottom:12px;
    width:min(860px,calc(100vw - 24px));
    max-width:calc(100vw - 24px);
    background:var(--chat-surface);
    border:1px solid rgba(217,224,236,.9);
    border-radius:22px;
    box-shadow:var(--chat-shadow);
    overflow:hidden;
    display:flex;
    flex-direction:column;
    z-index:99980;
    transition:right .28s cubic-bezier(.22,1,.36,1);
    color:var(--chat-ink);
}
.chat-panel.show{right:12px}

.chat-header{
    height:70px;
    flex:0 0 70px;
    padding:0 18px 0 20px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    background:#fff;
    border-bottom:1px solid var(--chat-border);
}
.chat-header-copy{display:flex;align-items:center;gap:12px;min-width:0}
.chat-header-icon{
    width:38px;height:38px;border-radius:12px;
    display:flex;align-items:center;justify-content:center;
    background:var(--chat-primary-soft);color:var(--chat-primary);
    font-size:15px;flex:0 0 auto;
}
.chat-header h3{
    margin:0;
    font-family:"Sora","Inter",sans-serif;
    font-size:16px;
    line-height:1.2;
    font-weight:800;
    letter-spacing:-.02em;
    color:var(--chat-ink);
}
.chat-header small{
    display:flex;align-items:center;gap:6px;
    margin-top:4px;font-size:11px;font-weight:600;color:var(--chat-ink-soft);
}
.chat-status-dot{width:6px;height:6px;border-radius:50%;background:var(--chat-success);box-shadow:0 0 0 3px rgba(18,183,106,.1)}
.chat-header-close{
    width:38px;height:38px;border:1px solid var(--chat-border);border-radius:11px;background:#fff;
    display:flex;align-items:center;justify-content:center;color:#667085;cursor:pointer;transition:.16s ease;
}
.chat-header-close:hover{background:#F9FAFB;color:#101828;border-color:var(--chat-border-strong)}

.chat-body{
    min-height:0;
    flex:1;
    display:grid;
    grid-template-columns:286px minmax(0,1fr);
    background:var(--chat-bg);
}
.chat-sidebar{
    min-width:0;min-height:0;
    display:flex;flex-direction:column;
    background:#fff;border-right:1px solid var(--chat-border);
}
.chat-sidebar-tools{padding:14px 13px 8px;flex:0 0 auto}
.chat-sidebar-search{position:relative}
.chat-sidebar-search i{
    position:absolute;left:12px;top:50%;transform:translateY(-50%);
    color:var(--chat-ink-faint);font-size:12px;pointer-events:none;
}
.chat-sidebar-search input{
    width:100%;height:40px;border:1px solid var(--chat-border);border-radius:11px;
    background:#F9FAFB;color:var(--chat-ink);outline:none;
    padding:0 12px 0 34px;font:500 12px/1 "Inter",sans-serif;
    transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;
}
.chat-sidebar-search input:focus{background:#fff;border-color:color-mix(in srgb,var(--blue,#2F6FEA) 34%,var(--border,#dfe4ec));box-shadow:0 0 0 3px color-mix(in srgb,var(--blue,#2F6FEA) 9%,transparent)}
.chat-sidebar-caption{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 4px 7px}
.chat-sidebar-caption strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#667085;font-weight:800}
.chat-sidebar-caption span{font-size:10.5px;color:#98A2B3;font-weight:600}
.chat-list{flex:1;min-height:0;overflow-y:auto;padding:4px 8px 12px;overscroll-behavior:contain}
.chat-list::-webkit-scrollbar,.chat-messages::-webkit-scrollbar{width:6px}
.chat-list::-webkit-scrollbar-thumb,.chat-messages::-webkit-scrollbar-thumb{background:#D6DBE5;border-radius:99px}
.chat-list::-webkit-scrollbar-track,.chat-messages::-webkit-scrollbar-track{background:transparent}

.chat-item{
    position:relative;
    display:flex;align-items:center;gap:10px;
    min-height:62px;padding:9px 9px;border-radius:12px;
    cursor:pointer;transition:background .14s ease;
    user-select:none;
}
.chat-item:hover{background:#F8FAFD}
.chat-item.active{background:var(--chat-primary-soft,#EEF4FF)}
.chat-item.active::before{content:"";position:absolute;left:-8px;top:16px;bottom:16px;width:3px;border-radius:0 6px 6px 0;background:var(--chat-primary)}
.chat-avatar,.chat-user-avatar{
    position:relative;overflow:hidden;
    display:flex;align-items:center;justify-content:center;
    border-radius:50%;background:#EAF1FF;color:var(--chat-primary);
    font-weight:800;flex:0 0 auto;
}
.chat-avatar{width:39px;height:39px;font-size:13px}
.chat-avatar img,.chat-user-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.chat-info{flex:1;min-width:0}
.chat-info-row{display:flex;align-items:center;gap:6px;min-width:0}
.chat-info strong{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:750;color:#1D2939}
.chat-role-pill{flex:0 0 auto;max-width:76px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;padding:3px 5px;border-radius:999px;background:#F2F4F7;color:#667085}
.chat-info span.chat-preview{display:block;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11.2px;color:#7A8292}
.chat-meta{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:0 0 auto;min-width:24px}
.chat-meta small{font-size:9.5px;color:#98A2B3;font-weight:600}
.chat-unread{min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--chat-primary);color:#fff;display:flex;align-items:center;justify-content:center;font-size:9.5px;font-weight:800}
.chat-no-data,.chat-loading{padding:38px 16px;text-align:center;color:#98A2B3;font-size:12px;line-height:1.6}
.chat-loading i{margin-right:6px}

.chat-content{min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--chat-bg);overflow:hidden}
.chat-empty{margin:auto;padding:30px;text-align:center;max-width:340px;color:#667085}
.chat-empty-icon{width:60px;height:60px;margin:0 auto 15px;border-radius:18px;background:var(--chat-primary-soft,#EEF4FF);color:var(--chat-primary);display:flex;align-items:center;justify-content:center;font-size:23px}
.chat-empty h3{font-family:"Sora","Inter",sans-serif;margin:0;color:#101828;font-size:15px;font-weight:800}
.chat-empty p{margin:7px 0 0;font-size:12px;line-height:1.6;color:#7A8292}
.chat-window{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden}

.chat-user{
    height:62px;flex:0 0 62px;padding:0 16px;
    display:flex;align-items:center;gap:10px;background:#fff;border-bottom:1px solid var(--chat-border);
}
.chat-back-btn{display:none;width:34px;height:34px;border:1px solid var(--chat-border);border-radius:10px;background:#fff;color:#667085;align-items:center;justify-content:center;cursor:pointer;flex:0 0 auto}
.chat-user-dynamic{min-width:0;flex:1}
.chat-user-box{display:flex;align-items:center;gap:10px;min-width:0}
.chat-user-avatar{width:38px;height:38px;font-size:13px}
.chat-user-copy{min-width:0;display:flex;flex-direction:column}
.chat-user-copy strong{font-size:12.5px;font-weight:800;color:#1D2939;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-user-copy small{display:flex;align-items:center;gap:5px;margin-top:3px;font-size:10.5px;color:#7A8292;font-weight:600}
.chat-user-copy small::before{content:"";width:5px;height:5px;border-radius:50%;background:#12B76A}

.chat-messages-shell{position:relative;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;background:var(--chat-bg)}
.chat-load-older{
    flex:0 0 auto;align-self:center;margin:9px auto 0;height:30px;padding:0 12px;
    border:1px solid var(--chat-border);border-radius:999px;background:rgba(255,255,255,.94);color:#667085;
    display:flex;align-items:center;gap:6px;font-size:10.5px;font-weight:700;cursor:pointer;box-shadow:0 3px 10px rgba(16,24,40,.04);z-index:2;
}
.chat-load-older[hidden]{display:none!important}
.chat-load-older:hover{border-color:#B8CCF5;color:var(--chat-primary)}
.chat-messages{
    flex:1;min-height:0;overflow-y:auto;padding:16px 19px 18px;
    display:flex;flex-direction:column;overscroll-behavior:contain;scroll-behavior:auto;
    background:radial-gradient(circle at 88% 4%,color-mix(in srgb,var(--chat-primary) 3.5%,transparent),transparent 34%),var(--chat-bg);
}
.chat-date-separator{align-self:center;margin:7px 0 13px;padding:4px 9px;border-radius:999px;background:#EAECF0;color:#667085;font-size:9.5px;font-weight:750}
.chat-unread-separator{display:flex;align-items:center;gap:9px;margin:4px 0 14px;color:var(--chat-primary);font-size:9.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.chat-unread-separator::before,.chat-unread-separator::after{content:"";height:1px;flex:1;background:#C9DAFB}

.chat-message-row{position:relative;display:flex;flex-direction:column;max-width:76%;margin:0 0 9px}
.chat-message-row.me{align-self:flex-end;align-items:flex-end}
.chat-message-row.other{align-self:flex-start;align-items:flex-start}
.chat-message-line{display:flex;align-items:flex-start;gap:5px;max-width:100%}
.chat-message-row.me .chat-message-line{flex-direction:row-reverse}
.chat-message-card{
    min-width:70px;max-width:100%;padding:8px 10px 6px;border-radius:14px;
    background:#fff;border:1px solid #E5EAF2;color:#1D2939;
    box-shadow:0 1px 2px rgba(16,24,40,.025);
}
.chat-message-row.me .chat-message-card{background:var(--chat-primary);border-color:var(--chat-primary);color:var(--theme-on-primary,#fff);border-bottom-right-radius:5px}
.chat-message-row.other .chat-message-card{border-bottom-left-radius:5px}
.chat-message-text{font-size:12.2px;line-height:1.48;white-space:pre-wrap;word-break:break-word}
.chat-message-row.deleted .chat-message-card{background:#F9FAFB;border-style:dashed;color:#98A2B3}
.chat-message-row.me.deleted .chat-message-card{background:#F2F4F7;border-color:#D0D5DD;color:#667085}
.chat-message-deleted{font-style:italic;font-size:11.5px;display:flex;align-items:center;gap:6px}

.chat-reply-quote{margin:-1px -2px 7px;padding:6px 8px;border-radius:8px;background:#F2F4F7;border-left:3px solid #98A2B3;display:flex;flex-direction:column;gap:2px;min-width:0}
.chat-message-row.me .chat-reply-quote{background:rgba(255,255,255,.14);border-left-color:rgba(255,255,255,.75)}
.chat-reply-quote strong{font-size:9.5px;font-weight:800;color:#475467;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-message-row.me .chat-reply-quote strong{color:#fff}
.chat-reply-quote span{font-size:10.3px;line-height:1.3;color:#667085;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}
.chat-message-row.me .chat-reply-quote span{color:rgba(255,255,255,.86)}

.chat-message-attachment{margin:0 0 6px;max-width:280px}
.chat-message-image{display:block;border-radius:10px;overflow:hidden;border:0;background:transparent;padding:0;cursor:pointer;max-width:100%}
.chat-message-image img{display:block;max-width:260px;max-height:220px;width:auto;height:auto;object-fit:cover;border-radius:10px;background:#EAECF0}
.chat-file-link{display:flex;align-items:center;gap:9px;min-width:190px;max-width:280px;padding:8px;border-radius:9px;background:#F2F4F7;color:#344054;text-decoration:none!important}
.chat-message-row.me .chat-file-link{background:rgba(255,255,255,.14);color:#fff}
.chat-file-icon{width:30px;height:30px;border-radius:8px;background:#fff;color:var(--chat-primary);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.chat-file-copy{min-width:0;display:flex;flex-direction:column}
.chat-file-copy strong{font-size:10.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-file-copy span{font-size:9px;opacity:.72;margin-top:2px}

.chat-message-footer{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin-top:4px;min-height:13px;font-size:9px;color:#98A2B3}
.chat-message-row.me .chat-message-footer{color:rgba(255,255,255,.74)}
.chat-message-footer .chat-edited{font-style:italic}
.chat-read-icon{font-size:8.5px;color:rgba(255,255,255,.7)}
.chat-read-icon.read{color:#DDF5FF}
.chat-message-row.failed .chat-message-footer{color:#F04438}

.chat-message-menu-btn{
    width:26px;height:26px;border:0;border-radius:8px;background:transparent;color:#98A2B3;
    display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .14s ease,background .14s ease,color .14s ease;
}
.chat-message-row:hover .chat-message-menu-btn,.chat-message-menu-btn:focus,.chat-message-row.menu-open .chat-message-menu-btn{opacity:1}
.chat-message-menu-btn:hover{background:#EAECF0;color:#475467}
.chat-message-actions{
    position:absolute;top:28px;z-index:8;min-width:126px;padding:5px;border-radius:10px;background:#fff;border:1px solid var(--chat-border);box-shadow:0 12px 28px rgba(16,24,40,.14);display:none;
}
.chat-message-row.me .chat-message-actions{right:0}.chat-message-row.other .chat-message-actions{left:0}
.chat-message-row.menu-open .chat-message-actions{display:block}
.chat-message-actions button{width:100%;height:31px;padding:0 8px;border:0;border-radius:7px;background:transparent;color:#475467;display:flex;align-items:center;gap:8px;font:650 10.5px/1 "Inter",sans-serif;cursor:pointer;text-align:left}
.chat-message-actions button:hover{background:#F2F4F7;color:#101828}
.chat-message-actions button.danger{color:#D92D20}
.chat-message-actions button.danger:hover{background:#FEF3F2}

.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.chat-message-row.me .chat-reactions{justify-content:flex-end}
.chat-reaction-chip{height:22px;padding:0 7px;border:1px solid #E4E7EC;border-radius:999px;background:#fff;color:#344054;display:flex;align-items:center;gap:4px;font-size:10.5px;cursor:pointer;box-shadow:0 1px 2px rgba(16,24,40,.03)}
.chat-reaction-chip.mine{border-color:color-mix(in srgb,var(--chat-primary) 36%,var(--chat-border));background:var(--chat-primary-soft,#EEF4FF);color:var(--chat-primary)}
.chat-reaction-chip span{font-size:9px;font-weight:800}
.chat-reaction-picker{position:absolute;top:-34px;z-index:10;display:flex;gap:2px;padding:4px;border:1px solid var(--chat-border);border-radius:999px;background:#fff;box-shadow:0 10px 28px rgba(16,24,40,.14)}
.chat-message-row.me .chat-reaction-picker{right:0}.chat-message-row.other .chat-reaction-picker{left:0}
.chat-reaction-picker button{width:27px;height:27px;border:0;border-radius:50%;background:transparent;font-size:14px;cursor:pointer;transition:transform .12s ease,background .12s ease}
.chat-reaction-picker button:hover{background:#F2F4F7;transform:scale(1.14)}

.chat-composer-state,.chat-attachment-preview{
    flex:0 0 auto;margin:0 14px;padding:8px 10px;border:1px solid var(--chat-border);border-bottom:0;background:#fff;
    display:flex;align-items:center;gap:9px;
}
.chat-composer-state[hidden],.chat-attachment-preview[hidden]{display:none!important}
.chat-composer-state{border-radius:11px 11px 0 0;margin-top:8px}
.chat-composer-state-icon,.chat-attachment-preview-icon{width:30px;height:30px;border-radius:8px;background:var(--chat-primary-soft,#EEF4FF);color:var(--chat-primary);display:flex;align-items:center;justify-content:center;flex:0 0 auto;font-size:11px}
.chat-composer-state-copy,.chat-attachment-preview-copy{min-width:0;flex:1;display:flex;flex-direction:column}
.chat-composer-state-copy strong,.chat-attachment-preview-copy strong{font-size:10.5px;color:#344054;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-composer-state-copy span,.chat-attachment-preview-copy span{margin-top:2px;font-size:9.8px;color:#7A8292;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-composer-state>button,.chat-attachment-preview>button{width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:#98A2B3;display:flex;align-items:center;justify-content:center;cursor:pointer}
.chat-composer-state>button:hover,.chat-attachment-preview>button:hover{background:#F2F4F7;color:#475467}

.chat-input{
    flex:0 0 auto;padding:10px 13px 12px;background:#fff;border-top:1px solid var(--chat-border);
    display:flex;align-items:flex-end;gap:7px;
}
.chat-composer-state:not([hidden]) + .chat-attachment-preview[hidden] + .chat-input,
.chat-attachment-preview:not([hidden]) + .chat-input{border-top:0}
.chat-input textarea{
    flex:1;min-height:40px;max-height:112px;resize:none;overflow-y:auto;
    padding:10px 12px;border:1px solid var(--chat-border);border-radius:12px;background:#F9FAFB;color:#1D2939;
    outline:none;font:500 12px/1.45 "Inter",sans-serif;transition:.15s ease;
}
.chat-input textarea:focus{background:#fff;border-color:color-mix(in srgb,var(--blue,#2F6FEA) 34%,var(--border,#dfe4ec));box-shadow:0 0 0 3px color-mix(in srgb,var(--blue,#2F6FEA) 8%,transparent)}
.chat-input-action,.chat-send{width:40px;height:40px;flex:0 0 auto;border-radius:11px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:.14s ease}
.chat-input-action{border:1px solid var(--chat-border);background:#fff;color:#667085}
.chat-input-action:hover{background:#F9FAFB;color:#344054}
.chat-send{border:0;background:var(--chat-primary);color:#fff;box-shadow:0 6px 14px color-mix(in srgb,var(--chat-primary) 22%,transparent)}
.chat-send:hover{background:var(--chat-primary-strong);transform:translateY(-1px)}
.chat-send:disabled,.chat-input-action:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none}

.chat-confirm-backdrop{position:absolute;inset:0;z-index:30;background:rgba(16,24,40,.18);display:flex;align-items:center;justify-content:center;padding:18px}
.chat-confirm-card{width:min(320px,100%);border:1px solid var(--chat-border);border-radius:15px;background:#fff;box-shadow:0 18px 50px rgba(16,24,40,.16);padding:16px}
.chat-confirm-card strong{display:block;font-family:"Sora","Inter",sans-serif;font-size:13px;color:#101828}.chat-confirm-card p{margin:6px 0 14px;font-size:11px;line-height:1.5;color:#667085}
.chat-confirm-actions{display:flex;justify-content:flex-end;gap:7px}.chat-confirm-actions button{height:34px;padding:0 12px;border-radius:9px;font:750 10.5px/1 "Inter",sans-serif;cursor:pointer}.chat-confirm-cancel{border:1px solid var(--chat-border);background:#fff;color:#475467}.chat-confirm-delete{border:0;background:#D92D20;color:#fff}

@media(max-width:992px){
    .chat-panel{top:8px;bottom:8px;right:-100vw;width:calc(100vw - 16px);max-width:calc(100vw - 16px);border-radius:18px}
    .chat-panel.show{right:8px}
    .chat-body{grid-template-columns:260px minmax(0,1fr)}
    .chat-message-row{max-width:82%}
}
@media(max-width:768px){
    .chat-panel{inset:0 auto 0 100vw;width:100vw;max-width:100vw;border:0;border-radius:0;transition:left .25s cubic-bezier(.22,1,.36,1);right:auto}
    .chat-panel.show{left:0;right:auto}
    .chat-header{height:64px;flex-basis:64px;padding:0 14px}
    .chat-body{grid-template-columns:1fr;position:relative;overflow:hidden}
    .chat-sidebar,.chat-content{position:absolute;inset:0;width:100%;height:100%;border-right:0;transition:transform .25s cubic-bezier(.22,1,.36,1)}
    .chat-sidebar{z-index:2;transform:translateX(0)}
    .chat-content{z-index:1;transform:translateX(100%)}
    .chat-body.chat-mobile-conv .chat-sidebar{transform:translateX(-100%);pointer-events:none}
    .chat-body.chat-mobile-conv .chat-content{transform:translateX(0)}
    .chat-back-btn{display:flex}
    .chat-message-row{max-width:88%}
    .chat-message-menu-btn{opacity:1}
    .chat-messages{padding:14px 12px 16px}
}
@media(max-width:480px){
    .chat-sidebar-tools{padding:11px 10px 6px}
    .chat-list{padding:3px 6px 10px}
    .chat-user{padding:0 10px}
    .chat-message-row{max-width:91%}
    .chat-message-card{padding:8px 9px 6px}
    .chat-message-text{font-size:12px}
    .chat-message-image img{max-width:min(240px,72vw);max-height:210px}
    .chat-input{padding:9px 10px calc(10px + env(safe-area-inset-bottom))}
    .chat-composer-state,.chat-attachment-preview{margin-left:10px;margin-right:10px}
}

/* ============================================================
   TOPBAR RESPONSIVE — MOBILE / TABLET
   Dibuat lokal di file ini agar aman meski layout.css masih desktop-first.
   ============================================================ */
.topbar,
.topbar-actions,
.search-box,
.user-chip,
.shift-indicator{
    min-width:0;
}

/* Cegah text/input memaksa topbar melebar keluar viewport */
.search-box input{
    min-width:0;
    max-width:100%;
}

@media (max-width: 900px){
    .topbar{
        display:flex !important;
        flex-wrap:wrap;
        align-items:center;
        gap:10px;
        height:auto !important;
        min-height:64px;
        padding:10px 12px !important;
        overflow:visible;
    }

    .topbar .menu-btn{
        flex:0 0 auto;
        margin:0 !important;
    }

    .topbar-actions{
        display:flex !important;
        align-items:center;
        justify-content:flex-end;
        gap:6px !important;
        margin-left:auto !important;
        flex:0 0 auto;
        max-width:calc(100% - 54px);
    }

    /* Search pindah ke baris kedua dan memakai seluruh lebar */
    .topbar > .search-box{
        order:3;
        flex:1 0 100% !important;
        width:100% !important;
        max-width:none !important;
        margin:0 !important;
    }

    .topbar > .search-box input{
        width:100% !important;
        height:42px;
        box-sizing:border-box;
    }

    /* Shortcut keyboard tidak penting di touch device */
    .topbar > .search-box kbd{
        display:none !important;
    }

    .shift-indicator{
        flex:0 0 auto;
        padding:7px 9px !important;
        gap:7px !important;
        white-space:nowrap;
    }

    .shift-info{
        min-width:0;
    }

    .shift-info small{
        display:none !important;
    }

    .shift-info strong{
        font-size:11px !important;
        line-height:1;
    }

    .topbar .icon-btn{
        flex:0 0 38px;
        width:38px !important;
        height:38px !important;
        min-width:38px;
        padding:0 !important;
    }

    /* Di tablet/mobile, nama user disingkat menjadi avatar saja */
    .topbar .user-chip{
        width:40px !important;
        min-width:40px !important;
        height:40px !important;
        padding:0 !important;
        display:flex !important;
        align-items:center;
        justify-content:center;
        flex:0 0 40px;
        border-radius:12px !important;
    }

    .topbar .user-chip > div:not(.avatar),
    .topbar .user-chip > .fa-chevron-down{
        display:none !important;
    }

    .topbar .user-chip .avatar{
        margin:0 !important;
        flex:0 0 auto;
    }

    /* Dropdown jangan keluar layar di HP */
    .topbar .dropdown-menu,
    .topbar .dropdown-menu.wide{
        position:fixed !important;
        top:118px !important;
        left:12px !important;
        right:12px !important;
        width:auto !important;
        min-width:0 !important;
        max-width:calc(100vw - 24px) !important;
        max-height:calc(100dvh - 132px);
        overflow-y:auto;
        overscroll-behavior:contain;
    }

    /* Chat memakai tinggi viewport mobile yang benar */
    .chat-panel{
        height:100dvh;
    }

    .chat-content,
    .chat-window,
    .chat-sidebar{
        min-width:0;
        min-height:0;
    }
}

@media (max-width: 520px){
    .topbar{
        gap:8px;
        padding:8px 10px !important;
    }

    .topbar-actions{
        gap:4px !important;
        max-width:calc(100% - 48px);
    }

    /* Shift dibuat super compact supaya semua tombol muat di 360px */
    .shift-indicator{
        width:36px !important;
        min-width:36px !important;
        height:36px !important;
        padding:0 !important;
        display:flex !important;
        align-items:center;
        justify-content:center;
        border-radius:10px !important;
    }

    .shift-indicator .shift-info{
        display:none !important;
    }

    .shift-indicator .shift-dot{
        margin:0 !important;
        flex:0 0 auto;
    }

    .topbar .icon-btn{
        flex-basis:36px;
        width:36px !important;
        min-width:36px;
        height:36px !important;
    }

    .topbar .user-chip{
        width:36px !important;
        min-width:36px !important;
        height:36px !important;
        flex-basis:36px;
    }

    .topbar .user-chip .avatar{
        transform:scale(.9);
    }

    .topbar > .search-box input{
        height:40px;
        font-size:13px;
    }

    .topbar .dropdown-menu,
    .topbar .dropdown-menu.wide{
        top:106px !important;
        left:8px !important;
        right:8px !important;
        max-width:calc(100vw - 16px) !important;
        max-height:calc(100dvh - 118px);
        border-radius:14px !important;
    }

    .chat-user{
        padding:0 12px;
    }

    .chat-user-box{
        min-width:0;
    }

    .chat-user-box > div:last-child{
        min-width:0;
    }

    .chat-user-box strong,
    .chat-user-box small{
        display:block;
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
    }

    .chat-input textarea{
        min-width:0;
        max-height:96px;
    }
}

/* HP sangat kecil */
@media (max-width: 380px){
    .topbar{
        padding-left:8px !important;
        padding-right:8px !important;
    }

    .topbar-actions{
        gap:3px !important;
    }

    .topbar .icon-btn,
    .topbar .user-chip,
    .shift-indicator{
        width:34px !important;
        min-width:34px !important;
        height:34px !important;
        flex-basis:34px;
    }

    .chat-header{
        padding-left:12px;
        padding-right:12px;
    }

    .chat-messages{
        padding:12px;
    }

    .chat-bubble{
        max-width:90%;
    }

    .chat-input{
        gap:8px;
        padding:10px;
        padding-bottom:max(10px, env(safe-area-inset-bottom));
    }

    .chat-input button{
        width:42px;
        height:42px;
        border-radius:14px;
    }
}

/* Safe-area iPhone notch / home indicator */
@supports (padding: max(0px)){
    @media (max-width: 900px){
        .topbar{
            padding-left:max(12px, env(safe-area-inset-left)) !important;
            padding-right:max(12px, env(safe-area-inset-right)) !important;
        }
        .chat-input{
            padding-bottom:max(12px, env(safe-area-inset-bottom));
        }
    }
}


/* ============================================================
   MESSENGER — MOBILE COMPACT FLOATING PANEL
   Tidak fullscreen: tetap lega tetapi menyisakan ruang di tepi layar.
   ============================================================ */
@media (max-width:768px){

    .chat-overlay{
        display:block !important;
        background:rgba(15,17,35,.38) !important;
        backdrop-filter:blur(3px) !important;
        -webkit-backdrop-filter:blur(3px) !important;
    }

    .chat-panel{
        top:auto !important;
        left:auto !important;

        right:-110vw !important;
        bottom:max(8px,env(safe-area-inset-bottom)) !important;

        width:calc(100vw - 16px) !important;
        max-width:520px !important;

        height:min(84dvh,720px) !important;
        max-height:calc(100dvh - 24px) !important;
        min-height:520px;

        border-radius:22px !important;
        box-shadow:
            0 24px 70px rgba(15,23,42,.30),
            0 0 0 1px rgba(255,255,255,.06) !important;

        overflow:hidden !important;

        transition:right .32s cubic-bezier(.16,1,.3,1) !important;
    }

    .chat-panel.show{
        right:max(8px,env(safe-area-inset-right)) !important;
    }

    .chat-header{
        height:64px !important;
        min-height:64px;
        padding:0 14px !important;
        border-radius:22px 22px 0 0;
    }

    .chat-header h3{
        font-size:14px !important;
    }

    .chat-header small{
        font-size:9.5px !important;
    }

    .chat-header #closeChat{
        width:36px !important;
        height:36px !important;
        min-width:36px;
        border-radius:11px !important;
    }

    .chat-body{
        min-height:0;
        height:calc(100% - 64px);
        grid-template-columns:1fr !important;
    }

    .chat-sidebar,
    .chat-content{
        width:100% !important;
        height:100% !important;
        min-width:0;
        min-height:0;
    }

    .chat-sidebar-search{
        margin:11px 11px 7px !important;
    }

    .chat-sidebar input{
        height:42px;
        padding:10px 13px 10px 38px !important;
        font-size:16px !important;
    }

    #chatList{
        padding:3px 7px 10px !important;
        overflow-y:auto;
        -webkit-overflow-scrolling:touch;
    }

    .chat-item{
        min-height:64px;
        padding:9px 10px !important;
        gap:10px !important;
        border-radius:12px !important;
    }

    .chat-avatar{
        width:42px !important;
        height:42px !important;
        min-width:42px;
        font-size:13px !important;
    }

    .chat-info strong{
        font-size:12.5px !important;
    }

    .chat-info span{
        font-size:10.5px !important;
    }

    .chat-meta small{
        font-size:8.8px !important;
    }

    .chat-user{
        height:56px !important;
        min-height:56px;
        padding:0 10px !important;
    }

    .chat-back-btn{
        width:34px !important;
        height:34px !important;
        min-width:34px;
    }

    .chat-user-avatar{
        width:36px !important;
        height:36px !important;
        min-width:36px;
        font-size:12px !important;
    }

    .chat-user-box{
        gap:8px !important;
        min-width:0;
    }

    .chat-user-box > div:last-child{
        min-width:0;
    }

    .chat-user-box strong{
        display:block;
        max-width:calc(100vw - 150px);
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        font-size:12.5px !important;
    }

    .chat-user-box small{
        display:block;
        max-width:calc(100vw - 150px);
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        font-size:9px !important;
    }

    .chat-window{
        min-height:0;
    }

    .chat-messages{
        min-height:0;
        padding:12px 10px !important;
        -webkit-overflow-scrolling:touch;
    }

    .chat-bubble{
        max-width:84% !important;
        margin-bottom:8px !important;
    }

    .chat-bubble .bubble{
        padding:9px 11px !important;
        border-radius:15px !important;
        font-size:12px !important;
        line-height:1.45 !important;
    }

    .chat-bubble small{
        font-size:8.5px !important;
    }

    .chat-input{
        gap:7px !important;
        padding:
            8px
            9px
            max(8px,env(safe-area-inset-bottom))
            9px !important;
    }

    .chat-input textarea{
        min-width:0;
        min-height:42px;
        max-height:92px !important;
        padding:10px 12px !important;
        border-radius:15px !important;
        font-size:16px !important;
        line-height:1.35;
    }

    .chat-input button{
        width:42px !important;
        height:42px !important;
        min-width:42px;
        border-radius:13px !important;
    }

    .chat-empty{
        padding:18px !important;
    }

    .chat-empty i{
        font-size:40px !important;
        margin-bottom:12px !important;
    }

    .chat-empty h3{
        font-size:13px !important;
    }

    .chat-empty p{
        font-size:10.5px !important;
        line-height:1.45;
    }
}

@media (max-width:480px){

    .chat-panel{
        width:calc(100vw - 14px) !important;
        height:min(82dvh,680px) !important;
        min-height:500px;
        bottom:max(7px,env(safe-area-inset-bottom)) !important;
        border-radius:20px !important;
    }

    .chat-panel.show{
        right:max(7px,env(safe-area-inset-right)) !important;
    }

    .chat-header{
        height:60px !important;
        min-height:60px;
        border-radius:20px 20px 0 0;
    }

    .chat-body{
        height:calc(100% - 60px);
    }
}

/* HP pendek / landscape: jangan memaksa min-height terlalu besar */
@media (max-width:768px) and (max-height:620px){

    .chat-panel{
        height:calc(100dvh - 16px) !important;
        min-height:0 !important;
    }

    .chat-header{
        height:54px !important;
        min-height:54px;
    }

    .chat-body{
        height:calc(100% - 54px);
    }

    .chat-header small{
        display:none;
    }
}

@media (max-width:360px){

    .chat-panel{
        width:calc(100vw - 10px) !important;
    }

    .chat-panel.show{
        right:5px !important;
    }

    .chat-bubble{
        max-width:88% !important;
    }
}



/* ============================================================
   LOGOUT CONFIRMATION — PREMIUM MODAL
   ============================================================ */
.logout-confirm-overlay{
    position:fixed;
    inset:0;
    z-index:10050;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    background:rgba(15,23,42,.48);
    backdrop-filter:blur(7px);
    -webkit-backdrop-filter:blur(7px);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .22s ease,visibility .22s ease;
}

.logout-confirm-overlay.show{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}

.logout-confirm-card{
    width:min(100%,400px);
    position:relative;
    overflow:hidden;
    padding:26px;
    border:1px solid rgba(226,232,240,.9);
    border-radius:24px;
    background:rgba(255,255,255,.98);
    box-shadow:
        0 30px 80px rgba(15,23,42,.24),
        0 2px 8px rgba(15,23,42,.05);
    color:#111827;
    font-family:var(--body,'Inter',system-ui,sans-serif);
    transform:translateY(14px) scale(.97);
    transition:transform .28s cubic-bezier(.16,1,.3,1);
}

.logout-confirm-overlay.show .logout-confirm-card{
    transform:translateY(0) scale(1);
}

.logout-confirm-card::before{
    content:"";
    position:absolute;
    width:180px;
    height:180px;
    border-radius:50%;
    right:-85px;
    top:-95px;
    background:radial-gradient(circle,rgba(239,68,68,.12),rgba(239,68,68,0) 68%);
    pointer-events:none;
}

.logout-confirm-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
}

.logout-confirm-icon{
    width:54px;
    height:54px;
    flex:0 0 54px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:16px;
    background:linear-gradient(145deg,#FFF1F2,#FFE4E6);
    border:1px solid #FECDD3;
    color:#E11D48;
    font-size:21px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.9);
}

.logout-confirm-close{
    width:34px;
    height:34px;
    flex:0 0 34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:0;
    border-radius:10px;
    background:#F8FAFC;
    color:#64748B;
    cursor:pointer;
    transition:background .15s ease,color .15s ease,transform .15s ease;
}

.logout-confirm-close:hover{
    background:#F1F5F9;
    color:#0F172A;
    transform:rotate(6deg);
}

.logout-confirm-copy{
    margin-top:18px;
}

.logout-confirm-copy h3{
    margin:0;
    color:#111827;
    font-size:20px;
    font-weight:800;
    letter-spacing:-.025em;
    line-height:1.25;
}

.logout-confirm-copy p{
    margin:8px 0 0;
    color:#64748B;
    font-size:13px;
    line-height:1.65;
}

.logout-confirm-user{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
    margin-top:18px;
    padding:11px 12px;
    border:1px solid #E9EEF5;
    border-radius:14px;
    background:#F8FAFC;
}

.logout-confirm-avatar{
    width:34px;
    height:34px;
    flex:0 0 34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:10px;
    background:linear-gradient(135deg,var(--blue,#2F6FEA),var(--blue-light,#4C8CF5));
    color:#fff;
    font-size:12px;
    font-weight:800;
}

.logout-confirm-user-copy{
    min-width:0;
}

.logout-confirm-user-copy strong,
.logout-confirm-user-copy span{
    display:block;
    max-width:100%;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
}

.logout-confirm-user-copy strong{
    color:#1E293B;
    font-size:12px;
    font-weight:700;
}

.logout-confirm-user-copy span{
    margin-top:2px;
    color:#94A3B8;
    font-size:10.5px;
}

.logout-confirm-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin-top:22px;
}

.logout-confirm-actions button{
    min-height:46px;
    padding:10px 14px;
    border-radius:13px;
    font-family:inherit;
    font-size:12.5px;
    font-weight:750;
    cursor:pointer;
    transition:transform .16s ease,box-shadow .16s ease,background .16s ease,border-color .16s ease;
}

.logout-cancel{
    border:1px solid #E2E8F0;
    background:#fff;
    color:#475569;
}

.logout-cancel:hover{
    background:#F8FAFC;
    border-color:#CBD5E1;
}

.logout-submit{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border:1px solid rgba(225,29,72,.12);
    background:linear-gradient(135deg,#EF4444,#E11D48);
    color:#fff;
    box-shadow:0 10px 24px rgba(225,29,72,.20);
}

.logout-submit:hover{
    transform:translateY(-1px);
    box-shadow:0 14px 30px rgba(225,29,72,.28);
}

.logout-submit:active,
.logout-cancel:active{
    transform:scale(.985);
}

body.logout-modal-open{
    overflow:hidden !important;
}

@media(max-width:520px){
    .logout-confirm-overlay{
        align-items:flex-end;
        padding:
            10px
            max(10px,env(safe-area-inset-right))
            max(10px,env(safe-area-inset-bottom))
            max(10px,env(safe-area-inset-left));
    }

    .logout-confirm-card{
        width:100%;
        padding:20px 17px 17px;
        border-radius:22px;
        transform:translateY(24px) scale(.985);
    }

    .logout-confirm-overlay.show .logout-confirm-card{
        transform:translateY(0) scale(1);
    }

    .logout-confirm-icon{
        width:48px;
        height:48px;
        flex-basis:48px;
        border-radius:14px;
        font-size:18px;
    }

    .logout-confirm-copy{
        margin-top:15px;
    }

    .logout-confirm-copy h3{
        font-size:18px;
    }

    .logout-confirm-copy p{
        font-size:11.5px;
        line-height:1.55;
    }

    .logout-confirm-user{
        margin-top:14px;
    }

    .logout-confirm-actions{
        margin-top:18px;
    }

    .logout-confirm-actions button{
        min-height:48px;
        font-size:12px;
    }
}

@media(max-width:350px){
    .logout-confirm-actions{
        grid-template-columns:1fr;
    }

    .logout-submit{
        order:1;
    }

    .logout-cancel{
        order:2;
    }
}

@media(prefers-reduced-motion:reduce){
    .logout-confirm-overlay,
    .logout-confirm-card,
    .logout-confirm-close,
    .logout-confirm-actions button{
        transition:none !important;
    }
}
.ctr-demo-badge{display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:7px 10px;border:1px solid rgba(124,92,255,.22);border-radius:11px;background:linear-gradient(135deg,rgba(73,117,255,.12),rgba(116,83,255,.10));color:#526ee8;text-decoration:none;white-space:nowrap}
.ctr-demo-badge>i{font-size:12px}.ctr-demo-badge span{display:block;line-height:1.05}.ctr-demo-badge b{display:block;font-size:8px;letter-spacing:.09em}.ctr-demo-badge small{display:block;margin-top:3px;font-size:7px;color:#8994ab}
html[data-theme="dark"] .ctr-demo-badge{color:#9db5ff;border-color:rgba(137,164,255,.25);background:rgba(91,119,231,.10)}
@media(max-width:680px){.ctr-demo-badge{padding:7px 9px}.ctr-demo-badge small{display:none}}
