* { box-sizing: border-box; margin: 0; padding: 0; }

.fraud-wrapper {
    display: flex;
    width: 100%;
    height: calc(100vh - 64px);
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
    position: relative;
}

/* ===================================================
   SIDEBAR KIRI
   =================================================== */
.fraud-sidebar {
    width: 340px;
    min-width: 340px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 12px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    transition: width .3s ease, min-width .3s ease;
    overflow: hidden;
    z-index: 500;
}

.fraud-sidebar.collapsed {
    width: 0;
    min-width: 0;
}

/* ===================================================
   HEADER OPSI B
   =================================================== */
.sidebar-header-b {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.header-b-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.header-b-title {
    font-size: 14px;
    font-weight: 700;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-b-badge {
    background: #B71C1C;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
}

.header-b-stat-btn {
    font-size: 12px;
    color: #B71C1C;
    border: 1px solid #B71C1C;
    border-radius: 999px;
    padding: 3px 10px;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    transition: background .2s;
}
.header-b-stat-btn:hover { background: #fff5f5; }

.header-b-segs {
    display: flex;
    gap: 6px;
}

.seg-pill {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid;
    text-align: center;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.seg-active   { border-color: #B71C1C; background: #fff5f5; }
.seg-inactive { border-color: #e0e0e0; background: transparent; }

.seg-num {
    font-size: 16px;
    font-weight: 700;
    color: #B71C1C;
}

.seg-lbl { font-size: 10px; margin-top: 2px; }
.seg-lbl-active   { color: #B71C1C; }
.seg-lbl-inactive { color: #aaa; }

/* ===================================================
   SIDEBAR PANELS
   =================================================== */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.sidebar-panel.hidden { display: none; }

.stats-inner {
    padding: 16px 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* ===================================================
   SIDEBAR SEARCH
   =================================================== */
.sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
}
.sidebar-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 12px;
    outline: none;
}

.fraud-list-body { flex: 1; overflow-y: auto; }

.fraud-list-loading,
.fraud-list-empty {
    padding: 24px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ===================================================
   PANEL TOGGLE BUTTON (di map header)
   =================================================== */
.panel-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff0f0;
    border: 1.5px solid #B71C1C;
    border-radius: 20px;
    color: #B71C1C;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.panel-toggle-btn:hover { background: #fee2e2; }
.panel-btn-icon { font-size: 14px; }
.panel-btn-badge {
    background: #B71C1C;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ===================================================
   STATS BAR (top STO / SA)
   =================================================== */
.stats-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}
.stats-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}
.stats-bar-label {
    font-size: 11px;
    color: #495057;
    width: 90px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stats-bar-wrap {
    flex: 1;
    background: #f5f5f5;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
}
.stats-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width .5s ease;
}
.stats-bar-fill.red    { background: #B71C1C; }
.stats-bar-fill.orange { background: #E65100; }
.stats-bar-count {
    font-size: 11px;
    font-weight: 700;
    color: #212529;
    width: 24px;
    text-align: right;
    flex-shrink: 0;
}

/* ===================================================
   MAP HEADER
   =================================================== */
.map-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 999;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.map-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.map-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.map-header-title { font-weight: 700; font-size: 15px; color: #212529; }
.map-header-sub   { font-size: 11px; color: #888; margin-top: 1px; }

/* ===================================================
   MAP SEARCH
   =================================================== */
.map-search-wrapper { position: relative; width: 280px; flex-shrink: 0; }
.map-search-wrapper input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.map-suggestion {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    z-index: 9999;
    max-height: 240px;
    overflow-y: auto;
}
.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 13px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 12px;
}
.suggestion-item:hover { background: #f8faff; }
.suggestion-type { font-size:10px;font-weight:700;padding:2px 7px;border-radius:5px; }
.type-cbase { background:#dbeafe;color:#1d4ed8; }
.type-psb   { background:#fef9c3;color:#854d0e; }
.type-fraud { background:#fee2e2;color:#b91c1c; }

/* ===================================================
   NOTIF BELL
   =================================================== */
.notif-bell-btn {
    position: relative;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    transition: border-color .2s;
    flex-shrink: 0;
}
.notif-bell-btn:hover { border-color: #B71C1C; }

.notif-dot {
    display: none;
    position: absolute;
    top: 4px; right: 4px;
    width: 9px; height: 9px;
    background: #B71C1C;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.notif-panel {
    display: none;
    position: absolute;
    top: 46px; right: 0;
    width: 340px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.16);
    z-index: 99999;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.notif-panel-header {
    padding: 12px 16px;
    background: #B71C1C;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.notif-panel-title {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}
.notif-read-btn {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
}
.notif-read-btn:hover { background: rgba(255,255,255,.35); }

.notif-list { max-height: 420px; overflow-y: auto; }

.notif-date-label {
    padding: 5px 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #888;
    background: #f9f9f9;
    border-bottom: 1px solid #f0f0f0;
    border-top: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background .15s;
}
.notif-item:hover { background: #fff8f8; }
.notif-item-name {
    font-weight: 600;
    font-size: 12px;
    color: #212529;
    margin-bottom: 2px;
}
.notif-item-order {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 3px;
}
.notif-item-detail {
    font-size: 11px;
    color: #6c757d;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.notif-item-meta {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}

/* ===================================================
   MAP CONTAINER
   =================================================== */
.map-container {
    flex: 1;
    position: relative;
    height: 100%;
}

#fraudMap {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===================================================
   STAT BOXES (di dalam sidebar statistik)
   =================================================== */
.fraud-stats-row { display:flex;gap:8px;margin-bottom:14px; }

.fraud-stat-box {
    flex:1;border-radius:12px;
    padding:10px 4px;text-align:center;
}
.fraud-stat-box.cbase   { background:#E3F2FD; }
.fraud-stat-box.psb     { background:#FFF3E0; }
.fraud-stat-box.cbase-f { background:#FCE4EC; }
.fraud-stat-box.aman    { background:#E8F5E9; }

.stat-num   { font-size:22px;font-weight:800; }
.stat-label { font-size:10px;color:#666;margin-top:2px; }

.fraud-stat-box.cbase   .stat-num { color:#1565C0; }
.fraud-stat-box.psb     .stat-num { color:#E65100; }
.fraud-stat-box.cbase-f .stat-num { color:#AD1457; }
.fraud-stat-box.aman    .stat-num { color:#2E7D32; }

.fraud-summary-bar {
    display:flex;gap:6px;
    margin-bottom:16px;
    border-top:1px solid #f0f0f0;
    padding-top:12px;
}
.summary-item { flex:1;text-align:center; }
.summary-item .s-label { font-size:9px;font-weight:700;text-transform:uppercase; }
.summary-item .s-value { font-size:18px;font-weight:800;margin-top:4px;color:#111827; }
.summary-item.green  .s-label { color:#16a34a; }
.summary-item.yellow .s-label { color:#ca8a04; }
.summary-item.red    .s-label { color:#dc2626; }
.summary-item.blue   .s-label { color:#2563eb; }

/* ===================================================
   LAYER TOGGLES — PILL
   =================================================== */
.fraud-layer-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.layer-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity .2s, filter .2s;
    user-select: none;
}
.layer-pill.off { opacity: 0.35; filter: grayscale(60%); }

.layer-pill.cbase       { background:#E3F2FD;color:#1565C0;border-color:#1565C0; }
.layer-pill.circle      { background:#E3F2FD;color:#1565C0;border-color:#42A5F5;border-style:dashed; }
.layer-pill.fraud       { background:#FFF3E0;color:#E65100;border-color:#FF6D00; }
.layer-pill.cbase-fraud { background:#FCE4EC;color:#AD1457;border-color:#AD1457; }
.layer-pill.aman        { background:#E8F5E9;color:#2E7D32;border-color:#43A047; }

.layer-pill .pill-dot { width:9px;height:9px;border-radius:50%;flex-shrink:0; }
.layer-pill.cbase       .pill-dot { background:#1565C0; }
.layer-pill.circle      .pill-dot { background:#42A5F5; }
.layer-pill.fraud       .pill-dot { background:#FF6D00; }
.layer-pill.cbase-fraud .pill-dot { background:#AD1457; }
.layer-pill.aman        .pill-dot { background:#43A047; }

/* ===================================================
   ANIMASI NOTIFIKASI
   =================================================== */
@keyframes slideUp {
    from { opacity:0;transform:translateX(-50%) translateY(20px); }
    to   { opacity:1;transform:translateX(-50%) translateY(0); }
}

/* ===================================================
   FRAUD LIST CARDS
   =================================================== */
.fraud-card {
    margin: 10px 12px;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    border-left: 4px solid #B71C1C;
    background: #fff;
    cursor: pointer;
    transition: box-shadow .2s, transform .15s;
    overflow: hidden;
}
.fraud-card.hovered {
    box-shadow: 0 4px 16px rgba(183,28,28,.12);
    transform: translateY(-1px);
}
.fraud-card.cbase-card { border-left-color: #AD1457; }

.fraud-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 6px;
}
.fraud-card-num {
    background: #B71C1C;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.fraud-card-num.cbase-num { background: #AD1457; }

.fraud-card-name {
    font-weight: 700;
    font-size: 13px;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fraud-card-order {
    font-size: 10px;
    color: #aaa;
    font-weight: 500;
    margin-top: 1px;
}

.fraud-badge-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fee2e2;
    color: #B71C1C;
    flex-shrink: 0;
}
.fraud-badge-label.cbase-badge {
    background: #FCE4EC;
    color: #AD1457;
}

.fraud-card-meta {
    padding: 4px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.fraud-card-row {
    display: flex;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.5;
}
.meta-label {
    color: #aaa;
    font-weight: 600;
    min-width: 44px;
    flex-shrink: 0;
    font-size: 11px;
}
.meta-val {
    color: #495057;
    flex: 1;
}
.jarak-val {
    font-weight: 700;
    color: #E65100;
}
.cbase-jarak { color: #AD1457; }

.fraud-detail-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: none;
    border-top: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #B71C1C;
    text-align: left;
}
.fraud-detail-btn:hover { background: #fff5f5; }
.fraud-detail-btn::after {
    content: '▾';
    font-size: 13px;
    color: #B71C1C;
    transition: transform .2s;
}
.fraud-detail-btn.open::after { transform: rotate(180deg); }

.fraud-detail-panel {
    display: none;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    padding: 10px 12px;
}
.fraud-detail-panel.show { display: block; }

.fdp-psb   { font-size: 11px; font-weight: 600; color: #212529; margin-bottom: 1px; }
.fdp-count { font-size: 11px; color: #999; margin-bottom: 10px; }

.fdp-match {
    border-left: 2px solid #FF6D00;
    border-radius: 0 8px 8px 0;
    background: #fff;
    padding: 9px 10px;
    margin-bottom: 7px;
    cursor: pointer;
    transition: background .15s;
}
.fdp-match:last-child { margin-bottom: 0; }
.fdp-match:hover      { background: #fff8f0; }
.fdp-match-name       { font-size: 12px; font-weight: 600; color: #212529; margin-bottom: 2px; }
.fdp-match-type       { font-size: 10px; color: #aaa; margin-bottom: 6px; }

.jarak-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #FFF3E0;
    color: #BF360C;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 5px;
}

.fraud-card.active { border-left-color: #FF6D00; background: #fff8f0; }

/* ===================================================
   FIX LEAFLET POINTER EVENTS
   =================================================== */
#fraudMap .leaflet-interactive { pointer-events:auto !important; cursor:pointer !important; }
#fraudMap .leaflet-pane { pointer-events:none; }
#fraudMap .leaflet-pane .leaflet-interactive { pointer-events:auto !important; }