/* ============================================================
   SIGAP Admin — admin.css
   ============================================================ */

@font-face {
    font-family: 'Roboto';
    src: url('../../assets/font/Roboto-VariableFont_wdth,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('../../assets/font/Roboto-Italic-VariableFont_wdth,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

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

html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; }

body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.65;
    color: #111;
    background: #f7f7f7;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

a { color: #111; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   LAYOUT — Login
   ============================================================ */

.login-body {
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 40px 44px 36px;
    width: 100%;
    max-width: 400px;
}

/* Login Header */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 88px;
    height: auto;
    display: block;
    margin: 0 auto 14px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.5px;
    display: inline-block;
    position: relative;
    padding-bottom: 6px;
    text-align: center;
}

.login-header h1::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(to right, #cc0000, #111, #c9a227, transparent);
}

.login-subtitle {
    font-size: 14px;
    color: #999;
    margin-top: 6px;
    font-weight: 400;
    text-align: center;
    width: 100%;
}

/* Login Form */
.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-error {
    background: #fff0f0;
    border: 1px solid #f9a0a0;
    color: #8b1a1a;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
}

.login-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #166534;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
}

.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: #f3f3f3;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
}

.login-tab {
    border: 0;
    border-radius: 4px;
    padding: 8px 10px;
    background: transparent;
    color: #777;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.login-tab.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.login-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.login-panel.active { display: flex; }

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
}

.form-group input {
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #111;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus { border-color: #111; }
.form-group input::placeholder { color: #bbb; }

.btn-login {
    margin-top: 4px;
    padding: 12px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-login:hover { background: #333; }

.login-back {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

.login-back a { color: #999; }
.login-back a:hover { color: #111; text-decoration: none; }

/* ============================================================
   LAYOUT — Admin Panel
   ============================================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #111;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Slide behaviour */
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 600;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.28s ease;
    box-shadow: none;
}
.sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,0.22);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 44px;
    height: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

.sidebar-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-weight: 400;
    margin-top: 1px;
}

/* Nav Links */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 11px 14px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    line-height: 1.3;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 600;
}

/* Sub-text: hanya muncul saat aktif */
.sidebar-link::after {
    content: attr(data-sub);
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0);
    line-height: 1.2;
    max-height: 0;
    overflow: hidden;
    transition: color 0.18s, max-height 0.22s ease;
    pointer-events: none;
}
.sidebar-link.active::after {
    color: rgba(255,255,255,0.45);
    max-height: 20px;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

.btn-view-site-sidebar {
    display: block;
    width: 100%;
    padding: 9px;
    text-align: center;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.55);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    margin-bottom: 8px;
}
.btn-view-site-sidebar:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 9px;
    text-align: center;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255,80,80,0.25);
    color: #ff8080;
    text-decoration: none;
}

/* ── Main ── */
.admin-main {
    flex: 1;
    width: 100%;
    margin-left: 0;
    padding: 32px 40px 64px;
    overflow-y: auto;
    min-width: 0;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Bar — disembunyikan, Lihat SIGAP dipindah ke sidebar */
.admin-topbar { display: none; }

.admin-page-title {
    font-size: 30px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.5px;
}

.admin-page-sub {
    font-size: 16px;
    color: #999;
    margin-top: 3px;
}

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

.btn-view-site {
    padding: 9px 18px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    transition: border-color 0.12s, color 0.12s;
    text-decoration: none;
}

.btn-view-site:hover {
    border-color: #111;
    color: #111;
    text-decoration: none;
}

/* ── Sidebar Badge ── */
.sidebar-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
}

/* ── Stat Cards (baru) ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 18px 20px 16px;
}

.sc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sc-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    line-height: 1.3;
}

.sc-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sc-icon-wrap svg { width: 18px; height: 18px; }

.sc-icon-blue   { background: #eff6ff; color: #3b82f6; }
.sc-icon-red    { background: #fef2f2; color: #ef4444; }
.sc-icon-orange { background: #fff7ed; color: #f97316; }
.sc-icon-yellow { background: #fffbeb; color: #f59e0b; }
.sc-icon-green  { background: #f0fdf4; color: #22c55e; }

.sc-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 4px;
}

.sc-blue   .sc-value { color: #2563eb; }
.sc-red    .sc-value { color: #dc2626; }
.sc-orange .sc-value { color: #ea580c; }
.sc-yellow .sc-value { color: #d97706; }
.sc-green  .sc-value { color: #16a34a; }

.sc-blue   { border-top: 3px solid #3b82f6; }
.sc-red    { border-top: 3px solid #ef4444; }
.sc-orange { border-top: 3px solid #f97316; }
.sc-yellow { border-top: 3px solid #f59e0b; }
.sc-green  { border-top: 3px solid #22c55e; }

.sc-sub {
    font-size: 12px;
    color: #bbb;
    font-weight: 400;
}

/* ── Cards General ── */
.admin-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 22px 24px;
}

.admin-card-full { width: 100%; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin: 0;
    padding: 0;
    border: none;
}

.card-badge {
    font-size: 11px;
    font-weight: 600;
    background: #dcfce7;
    color: #16a34a;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* Live dot */
.live-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
    50%       { box-shadow: 0 0 0 6px rgba(34,197,94,0.08); }
}

/* ── Row 2: Chart + Donut ── */
.dash-row2 {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 14px;
    margin-bottom: 14px;
}

.card-chart { }
.chart-wrap {
    height: 240px;
    position: relative;
    width: 100%;
}
.chart-wrap canvas {
    display: block;
    width: 100% !important;
}

.card-donut { display: flex; flex-direction: column; }
.donut-wrap { height: 160px; position: relative; margin-bottom: 16px; }

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dl-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.dl-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    flex: 1;
}

.dl-val {
    font-size: 14px;
    font-weight: 600;
    color: #111;
}

/* ── Row 3: Aktivitas + Notifikasi ── */
.dash-row3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* Aktivitas */
.activity-list { display: flex; flex-direction: column; gap: 2px; }

.act-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.act-item:last-child { border-bottom: none; }

.act-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.act-body { flex: 1; min-width: 0; }

.act-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-meta {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-time {
    font-size: 12px;
    color: #ccc;
    font-weight: 600;
    flex-shrink: 0;
}

/* Notifikasi */
.notif-count {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-list { display: flex; flex-direction: column; gap: 2px; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.notif-item:last-child { border-bottom: none; }

.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.notif-alert .notif-dot  { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.notif-update .notif-dot { background: #3b82f6; }

.notif-body { flex: 1; }

.notif-teks {
    font-size: 13px;
    color: #333;
    line-height: 1.45;
}

.notif-waktu {
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

/* ── Row 4: Risk Table ── */
.risk-table-wrap { overflow-x: auto; }

.risk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.risk-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #bbb;
    padding: 0 12px 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.risk-table td {
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
    vertical-align: middle;
}

.risk-table tbody tr:last-child td { border-bottom: none; }

.risk-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.chip-aman   { background: #f1f5f9; color: #64748b; }
.chip-rendah { background: #f0fdf4; color: #16a34a; }
.chip-sedang { background: #fffbeb; color: #d97706; }
.chip-tinggi { background: #fef2f2; color: #dc2626; }

.mini-bar-wrap {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    width: 140px;
    background: #f0f0f0;
}

.mini-bar { height: 100%; min-width: 2px; }

.empty-note {
    font-size: 14px;
    color: #bbb;
    padding: 20px 0;
    text-align: center;
}

/* ============================================================
   Monitoring
   ============================================================ */

.monitor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.monitor-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.monitor-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
}

.monitor-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.monitor-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f3f4f6;
    color: #111;
    font-size: 11px;
    font-weight: 800;
}

.monitor-blue,
.monitor-red,
.monitor-green,
.monitor-orange,
.monitor-yellow { background: #f3f4f6; color: #111; }

.monitor-status {
    padding: 3px 8px;
    background: #f8fafc;
    color: #64748b;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.monitor-status.warning { color: #dc2626; }

.monitor-card h3 {
    color: #111;
    font-size: 15px;
    line-height: 1.25;
    margin-bottom: 5px;
}

.monitor-card p {
    color: #999;
    font-size: 13px;
    line-height: 1.4;
}

.monitor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(320px, 0.88fr);
    gap: 12px;
    margin-bottom: 12px;
    align-items: stretch;
}

.monitor-map {
    position: relative;
    height: 240px;
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        #fafafa;
    background-size: 44px 44px;
}

.heat-point {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #111;
    box-shadow: 0 0 0 14px rgba(17,17,17,0.08);
}

.hp-1 { left: 20%; top: 34%; }
.hp-2 { left: 54%; top: 26%; }
.hp-3 { left: 68%; top: 63%; }
.hp-4 { left: 35%; top: 70%; }

.map-line {
    position: absolute;
    height: 2px;
    background: rgba(17,17,17,0.12);
    transform-origin: left center;
}

.line-1 { left: 23%; top: 40%; width: 34%; transform: rotate(-8deg); }
.line-2 { left: 38%; top: 72%; width: 32%; transform: rotate(-18deg); }

.map-label {
    position: absolute;
    left: 16px;
    bottom: 14px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #777;
    font-size: 12px;
    font-weight: 700;
}

.monitor-stream,
.monitor-device-list,
.monitor-route {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.monitor-stream-item {
    display: grid;
    grid-template-columns: 9px 1fr auto;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid #f3f3f3;
}

.monitor-stream-item:last-child { border-bottom: 0; }

.monitor-stream-item > span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 7px;
    background: #111;
}

.monitor-stream-item strong {
    display: block;
    color: #111;
    font-size: 14px;
    line-height: 1.35;
}

.monitor-stream-item p {
    color: #999;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

.monitor-stream-item em {
    color: #bbb;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.monitor-device-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f3f3;
}

.monitor-device-list div:last-child { border-bottom: 0; }
.monitor-device-list span { color: #777; font-size: 14px; font-weight: 600; }
.monitor-device-list strong { color: #111; font-size: 22px; line-height: 1; }

.route-step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #999;
    font-size: 14px;
    font-weight: 600;
}

.route-step span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
}

.route-step.active span { background: #111; }

.monitor-heatmap-card {
    margin-bottom: 12px;
}

.monitor-map-window .monitor-heatmap-card {
    border-width: 1px 0 0;
    border-radius: 0;
    margin-bottom: 0;
    padding: 9px 12px;
    flex-shrink: 0;
    max-height: 156px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.monitor-map-window .monitor-heatmap-card[hidden] {
    display: none;
}

.monitor-map-window .monitor-heatmap-card .card-head {
    margin-bottom: 8px;
    padding-bottom: 7px;
}

.monitor-map-window .monitor-heatmap-card .card-title {
    font-size: 13px;
}

.monitor-map-window .monitor-heatmap-card .card-badge {
    font-size: 10px;
    padding: 2px 7px;
}

.monitor-cluster-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.monitor-cluster-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    padding-top: 2px;
}

.cluster-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f3f3;
}

.cluster-row:last-child { border-bottom: 0; }

.cluster-row strong {
    display: block;
    color: #111;
    font-size: 14px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cluster-row p {
    color: #999;
    font-size: 12px;
    line-height: 1.35;
    margin-top: 2px;
}

.cluster-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cluster-bar {
    display: block;
    height: 6px;
    min-width: 8px;
    max-width: 100%;
    border-radius: 999px;
    margin-left: auto;
}

.cluster-bar.high { background: #ef4444; }
.cluster-bar.medium { background: #f97316; }
.cluster-bar.safe { background: #22c55e; }

.monitor-map-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.monitor-map-window {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 320px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.monitor-map-window .nm-map-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 42px;
    padding: 0 12px 0 14px;
    border-bottom: 1px solid #dbe2ea;
    background: #111;
    color: #fff;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    user-select: none;
    letter-spacing: 0.2px;
}

.monitor-map-note {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 700;
}

.monitor-cluster-toggle {
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    transition: background 0.15s;
}

.monitor-cluster-toggle::after {
    content: ' ＋';
    margin-left: 2px;
    color: rgba(255,255,255,0.85);
}

.monitor-cluster-toggle.is-open {
    background: #1d4ed8;
}

.monitor-cluster-toggle.is-open::after {
    content: ' ✕';
}

.monitor-cluster-toggle:hover {
    background: #1d4ed8;
}

.monitor-map-window .nm-map-overlay {
    position: absolute;
    top: 52px;
    right: 12px;
    z-index: 700;
    pointer-events: none;
}

.monitor-map-window .nm-count-badge {
    min-width: 62px;
    padding: 3px 9px;
    border-radius: 4px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    color: #111827;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.monitor-map-window .monitor-map,
#adminMonitorMap {
    position: relative;
    width: 100%;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #eef3f8;
}

.monitor-map-window .nm-map-pin {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.32));
    cursor: pointer;
    transform-origin: center center;
}

.monitor-map-window .leaflet-marker-icon .nm-map-pin {
    display: block;
}

.monitor-map-window .nm-map-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1d4060;
    gap: 10px;
    flex-shrink: 0;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.monitor-map-window .nm-risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.monitor-map-window .nm-risk-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.14);
}

.monitor-map-window .nm-info-arrow {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 18px;
}

.monitor-map-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
}

.monitor-heat-gradient {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.86;
    filter: blur(5px);
    mix-blend-mode: multiply;
    transform: scale(0.82);
    transform-origin: center center;
    transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
    background:
        radial-gradient(circle,
            rgba(255,0,0,0.95) 0%,
            rgba(255,68,0,0.88) 10%,
            rgba(255,224,0,0.76) 24%,
            rgba(126,255,0,0.66) 42%,
            rgba(25,235,40,0.34) 67%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-out {
    opacity: 0.78;
    filter: blur(4px);
    transform: scale(0.38);
    background:
        radial-gradient(circle,
            rgba(126,255,0,0.88) 0%,
            rgba(126,255,0,0.72) 42%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-mid {
    transform: scale(0.70);
}

.monitor-heat-gradient.zoom-in {
    opacity: 0.94;
    filter: blur(3px);
    transform: scale(1);
    background:
        radial-gradient(circle,
            rgba(255,0,0,1) 0%,
            rgba(255,35,0,0.96) 14%,
            rgba(255,224,0,0.78) 30%,
            rgba(126,255,0,0.50) 52%,
            rgba(25,235,40,0.12) 76%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.heat-medium {
    opacity: 0.70;
    background:
        radial-gradient(circle,
            rgba(255,112,0,0.90) 0%,
            rgba(255,224,0,0.72) 25%,
            rgba(126,255,0,0.52) 52%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.heat-medium.zoom-out {
    opacity: 0.72;
    background:
        radial-gradient(circle,
            rgba(126,255,0,0.84) 0%,
            rgba(126,255,0,0.58) 44%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.heat-medium.zoom-in {
    opacity: 0.84;
    background:
        radial-gradient(circle,
            rgba(255,84,0,0.96) 0%,
            rgba(255,224,0,0.78) 28%,
            rgba(126,255,0,0.44) 56%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.heat-low {
    opacity: 0.44;
    background:
        radial-gradient(circle,
            rgba(255,224,0,0.52) 0%,
            rgba(126,255,0,0.46) 38%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.heat-safe {
    opacity: 0.22;
    background:
        radial-gradient(circle,
            rgba(126,255,0,0.38) 0%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-out.heat-dom-high {
    background:
        radial-gradient(circle,
            rgba(255,0,0,0.92) 0%,
            rgba(255,88,0,0.78) 28%,
            rgba(255,224,0,0.46) 52%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-out.heat-dom-medium {
    background:
        radial-gradient(circle,
            rgba(255,112,0,0.88) 0%,
            rgba(255,224,0,0.62) 38%,
            rgba(126,255,0,0.34) 62%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-out.heat-dom-low {
    background:
        radial-gradient(circle,
            rgba(255,224,0,0.70) 0%,
            rgba(126,255,0,0.58) 45%,
            rgba(25,235,40,0) 100%);
}

.monitor-heat-gradient.zoom-out.heat-dom-safe {
    background:
        radial-gradient(circle,
            rgba(126,255,0,0.82) 0%,
            rgba(25,235,40,0.44) 48%,
            rgba(25,235,40,0) 100%);
}

/* ============================================================
   Alert Page
   ============================================================ */

.alert-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.alert-stat-card {
    padding: 16px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
}

.alert-stat-card span {
    display: block;
    color: #999;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 8px;
}

.alert-stat-card strong {
    display: block;
    color: #111;
    font-size: 28px;
    line-height: 1;
}

.alert-page-card {
    margin-bottom: 12px;
}

.alert-filter-card {
    margin-bottom: 12px;
}

.alert-filter-grid {
    display: grid;
    grid-template-columns: 1.3fr repeat(4, minmax(130px, 1fr));
    gap: 10px;
}

.alert-filter-grid input,
.alert-filter-grid select {
    width: 100%;
    height: 38px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    padding: 0 10px;
    outline: none;
}

.alert-main-layout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.72fr);
    gap: 12px;
    align-items: stretch;
    padding-bottom: 34px;
}

.alert-main-layout .alert-page-card,
.alert-main-layout .alert-detail-card {
    height: 520px;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.alert-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.alert-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.alert-table th {
    text-align: left;
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 0 12px 10px 0;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.alert-table td {
    color: #333;
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
}

.alert-table tbody tr:last-child td {
    border-bottom: 0;
}

.alert-table tbody tr {
    cursor: pointer;
}
.alert-table tbody tr:hover td {
    background: #fafafa;
}
.alert-table tbody tr.row-active td {
    background: #f0f7ff;
}
.alert-table tbody tr.row-active td strong {
    color: #1d4ed8;
}

.alert-table td strong,
.alert-table td span {
    display: block;
}

.alert-table td strong {
    color: #111;
    font-size: 14px;
    line-height: 1.35;
}

.alert-table td span {
    color: #999;
    font-size: 12px;
    line-height: 1.35;
    margin-top: 2px;
}

.alert-chip,
.alert-priority {
    display: inline-flex !important;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 1.2 !important;
    margin-top: 0 !important;
}

.alert-risk-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 4px 0;
    font-size: 12px !important;
    font-weight: 800;
    line-height: 1.2 !important;
    margin-top: 0 !important;
    white-space: nowrap;
}

.alert-risk-chip span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0 !important;
}

.alert-chip {
    background: #f8fafc;
    color: #64748b !important;
}

.alert-chip.muted {
    background: #fff7ed;
    color: #ea580c !important;
}

.alert-priority.tinggi {
    background: #fef2f2;
    color: #dc2626 !important;
}

.alert-priority.sedang {
    background: #fffbeb;
    color: #d97706 !important;
}

.alert-priority.rendah {
    background: #f0fdf4;
    color: #16a34a !important;
}

.alert-priority.critical {
    background: #fef2f2;
    color: #991b1b !important;
}

.alert-priority.high {
    background: #fff7ed;
    color: #ea580c !important;
}

.alert-priority.medium {
    background: #fffbeb;
    color: #d97706 !important;
}

.alert-priority.low {
    background: #f0fdf4;
    color: #16a34a !important;
}

.alert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 132px;
}

.alert-actions button {
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    background: #fff;
    color: #555;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 8px;
    cursor: pointer;
}

.alert-actions button:hover {
    border-color: #111;
    color: #111;
}

.alert-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.alert-pagination button {
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    background: #fff;
    color: #555;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
}

.alert-pagination button:disabled {
    cursor: default;
    opacity: 0.45;
}

.alert-pagination span {
    color: #777;
    font-size: 12px;
    font-weight: 700;
}

.alert-layout-last-update {
    position: absolute;
    left: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #999;
    font-size: 12px;
    font-weight: 700;
}

.alert-layout-last-update strong {
    color: #111;
    font-size: 12px;
}

.alert-detail-card {
    position: sticky;
    top: 20px;
    overflow-y: auto;
}

.alert-detail-block {
    padding: 11px 0;
    border-bottom: 1px solid #f3f3f3;
}

.alert-detail-block:last-child {
    border-bottom: 0;
}

.alert-detail-block h4 {
    color: #111;
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 4px;
}

.alert-detail-block p {
    color: #777;
    font-size: 12px;
    line-height: 1.45;
}

.alert-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-timeline span {
    position: relative;
    padding-left: 18px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
}

.alert-timeline span::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #111;
}

/* ============================================================
   AI Analytics
   ============================================================ */

.ai-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.ai-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
}

.ai-section-head h2 {
    color: #111;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.ai-section-head p {
    color: #999;
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

.ai-section-primary {
    padding: 14px;
    border: 1px solid #eeeeee;
    border-radius: 10px;
    background: #fbfbfb;
}

.ai-section-primary .admin-card {
    border-color: #e5e5e5;
}

.ai-summary-grid,
.ai-threat-grid,
.ai-recommend-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.ai-summary-card,
.ai-threat-grid div,
.ai-recommend-grid span {
    padding: 16px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    min-width: 0;
}

.ai-summary-card span,
.ai-threat-grid span {
    display: block;
    color: #999;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ai-summary-card strong,
.ai-threat-grid strong {
    color: #111;
    font-size: 28px;
    line-height: 1;
}

.ai-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
    gap: 12px;
    margin-bottom: 0;
}

.ai-narrative-card {
    margin-bottom: 0;
}

.ai-api-card {
    margin-bottom: 0;
    padding: 0;
    overflow: hidden;
    border-color: #e5e5e5;
}

.ai-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #eeeeee;
    background: #111;
    color: #fff;
}

.ai-model-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #fff;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    flex-shrink: 0;
}

.ai-chat-title {
    min-width: 0;
    flex: 1;
}

.ai-chat-title h3 {
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.ai-chat-title p {
    color: rgba(255,255,255,0.55);
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

.ai-analysis-time {
    display: block;
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    margin-top: 6px;
}

.ai-model-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.78);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.ai-api-card.is-error .ai-model-status {
    background: rgba(220,38,38,0.22);
    color: #fecaca;
}

.ai-chat-output {
    position: relative;
    margin: 16px;
    padding: 16px 16px 16px 52px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fff;
    min-height: 112px;
}

.ai-chat-output::before {
    content: 'AI';
    position: absolute;
    left: 14px;
    top: 16px;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
}

.ai-typing-loader {
    display: none;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.ai-api-card.is-loading .ai-typing-loader {
    display: flex;
}

.ai-typing-loader span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #111;
    opacity: 0.28;
    animation: sigapAiTyping 1s ease-in-out infinite;
}

.ai-typing-loader span:nth-child(2) { animation-delay: .15s; }
.ai-typing-loader span:nth-child(3) { animation-delay: .3s; }

.ai-loading-skeleton {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.ai-api-card.is-loading .ai-loading-skeleton {
    display: flex;
}

.ai-loading-skeleton span {
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(90deg, #eeeeee 0%, #f8f8f8 45%, #eeeeee 90%);
    background-size: 220% 100%;
    animation: sigapAiShimmer 1.2s linear infinite;
}

.ai-loading-skeleton span:nth-child(1) { width: 96%; }
.ai-loading-skeleton span:nth-child(2) { width: 78%; }
.ai-loading-skeleton span:nth-child(3) { width: 52%; }

@keyframes sigapAiTyping {
    0%, 80%, 100% { transform: translateY(0); opacity: .28; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@keyframes sigapAiShimmer {
    from { background-position: 160% 0; }
    to { background-position: -60% 0; }
}

.ai-subtitle {
    color: #999;
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

.ai-conclusion {
    color: #444;
    font-size: 14px;
    line-height: 1.6;
}

.ai-conclusion strong {
    color: #111;
}

.ai-api-columns {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 16px 16px;
}

.ai-api-columns > div {
    min-width: 0;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.ai-api-columns h4 {
    color: #111;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.ai-rising-risk-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-rising-risk-list div {
    border-bottom: 1px solid #f2f2f2;
    padding-bottom: 8px;
}

.ai-rising-risk-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ai-rising-risk-list strong {
    display: block;
    color: #111;
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 4px;
}

.ai-rising-risk-list em {
    color: #dc2626;
    font-style: normal;
    font-weight: 800;
}

.ai-rising-risk-list span,
.ai-rising-risk-list small {
    display: block;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.ai-rising-risk-list small {
    color: #999;
    margin-top: 4px;
}

.ai-bars,
.ai-prediction-list,
.ai-category-list,
.ai-cluster-list,
.ai-evidence-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-bars div {
    display: grid;
    grid-template-columns: 90px 1fr;
    align-items: center;
    gap: 12px;
}

.ai-bars span,
.ai-prediction-list span,
.ai-category-list span,
.ai-cluster-list span {
    color: #777;
    font-size: 13px;
    font-weight: 700;
}

.ai-bars strong {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: #111;
}

.ai-prediction-list div,
.ai-category-list div,
.ai-cluster-list div,
.ai-evidence-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f3f3;
}

.ai-prediction-list div:last-child,
.ai-category-list div:last-child,
.ai-cluster-list div:last-child,
.ai-evidence-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ai-prediction-list strong,
.ai-category-list strong,
.ai-cluster-list strong {
    color: #111;
    font-size: 13px;
    white-space: nowrap;
}

.ai-evidence-list div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
}

.ai-evidence-list strong {
    color: #111;
    font-size: 13px;
}

.ai-evidence-list span,
.ai-evidence-list em {
    color: #777;
    font-size: 12px;
    font-style: normal;
    line-height: 1.35;
}

.ai-chip-grid,
.ai-recommend-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 0;
}

.ai-chip-grid {
    display: grid;
    gap: 10px;
}

.ai-chip-grid span,
.ai-recommend-grid span {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    padding: 12px;
    text-align: center;
}

.ai-insight-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-left: 18px;
    color: #555;
    font-size: 13px;
    line-height: 1.45;
}

.ai-recommend-card {
    margin-bottom: 0;
}

/* ============================================================
   Pembinaan
   ============================================================ */

.pembinaan-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.pembinaan-summary-grid div {
    padding: 16px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
}

.pembinaan-summary-grid span {
    display: block;
    color: #999;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pembinaan-summary-grid strong {
    color: #111;
    font-size: 28px;
    line-height: 1;
}

.pembinaan-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 12px;
    margin-bottom: 12px;
}

.pembinaan-table-card,
.pembinaan-detail-card {
    min-height: 0;
}

.pembinaan-table-wrap {
    overflow-x: hidden;
    width: 100%;
}

.pembinaan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.pembinaan-table th {
    text-align: left;
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    padding: 0 8px 10px 0;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
}

/* column widths — sesuaikan agar pas tanpa scroll */
.pembinaan-table th:nth-child(1),
.pembinaan-table td:nth-child(1) { width: 22%; }
.pembinaan-table th:nth-child(2),
.pembinaan-table td:nth-child(2) { width: 16%; }
.pembinaan-table th:nth-child(3),
.pembinaan-table td:nth-child(3) { width: 11%; }
.pembinaan-table th:nth-child(4),
.pembinaan-table td:nth-child(4) { width: 10%; }
.pembinaan-table th:nth-child(5),
.pembinaan-table td:nth-child(5) { width: 13%; }
.pembinaan-table th:nth-child(6),
.pembinaan-table td:nth-child(6) { width: 13%; }
.pembinaan-table th:nth-child(7),
.pembinaan-table td:nth-child(7) { width: 15%; }

.pembinaan-table td {
    color: #333;
    padding: 10px 8px 10px 0;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
    overflow: hidden;
}

.pembinaan-table td strong,
.pembinaan-table td span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pembinaan-table td strong {
    color: #111;
    font-size: 13px;
    line-height: 1.35;
}

.pembinaan-table td span {
    color: #999;
    font-size: 11px;
    line-height: 1.35;
    margin-top: 1px;
}

.pembinaan-chip {
    display: inline-flex !important;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b !important;
    font-size: 11px !important;
    font-weight: 700;
    line-height: 1.2 !important;
    margin-top: 0 !important;
    white-space: nowrap;
}

.pembinaan-progress {
    width: 100%;
    max-width: 80px;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #f0f0f0;
}

.pembinaan-progress span {
    display: block;
    height: 100%;
    background: #111;
}

.pembinaan-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    min-width: 0;
}

.pembinaan-actions button {
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    background: #fff;
    color: #555;
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 4px;
    cursor: pointer;
}

.pembinaan-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pembinaan-info-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f3f3;
}

.pembinaan-info-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.pembinaan-info-list span {
    color: #777;
    font-size: 13px;
    font-weight: 700;
}

.pembinaan-info-list strong {
    color: #111;
    font-size: 13px;
    text-align: right;
}

.pembinaan-chip-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.pembinaan-chip-grid span {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    padding: 12px;
    text-align: center;
}

/* ============================================================
   Mobile Topbar & Backdrop
   ============================================================ */

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: #111;
    color: #fff;
    z-index: 700;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.mobile-topbar-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.3px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mobile-topbar-actions {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.mobile-topbar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.mobile-topbar-action:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
    text-decoration: none;
}
.mobile-topbar-logout {
    background: rgba(255,80,80,0.2);
    color: #ffb3b3;
}
.mobile-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}
.mobile-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
body.mobile-sidebar-open .mobile-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.mobile-sidebar-open .mobile-hamburger span:nth-child(2) { opacity: 0; }
body.mobile-sidebar-open .mobile-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

body.sidebar-is-open {
    overflow: hidden;
    height: 100vh;
    overscroll-behavior: contain;
}

.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 590;
    background: rgba(0,0,0,.45);
}
.mobile-backdrop.active { display: block; }

/* ============================================================
   Responsive — Tablet (≤ 1100px)
   ============================================================ */

@media (max-width: 1100px) {
    .stat-grid                { grid-template-columns: repeat(3, 1fr); }
    .monitor-grid             { grid-template-columns: repeat(3, 1fr); }
    .monitor-layout           { grid-template-columns: 1fr; }
    .monitor-cluster-layout   { grid-template-columns: 1fr; }
    .alert-main-layout        { grid-template-columns: 1fr; }
    .alert-filter-grid        { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ai-summary-grid,
    .ai-threat-grid,
    .ai-recommend-grid,
    .ai-chip-grid             { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ai-layout                { grid-template-columns: 1fr; }
    .ai-api-columns           { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pembinaan-summary-grid,
    .pembinaan-chip-grid      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pembinaan-layout         { grid-template-columns: 1fr; }
    .dash-row2                { grid-template-columns: 1fr; }
    .card-donut               { flex-direction: row; align-items: center; gap: 24px; }
    .donut-wrap               { flex-shrink: 0; }
    .donut-legend             { flex-direction: column; }
    .peng-grid                { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive — Mobile (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
    /* Topbar & sidebar */
    .mobile-topbar  { display: flex; }
    .mobile-topbar-actions { display: flex; }
    #sidebarTrigger { display: none !important; }
    .admin-main {
        margin-left: 0 !important;
        padding: 72px 16px 48px; /* ruang untuk topbar */
    }
    body.sidebar-is-open #pageContent { margin-left: 0 !important; }
    /* Sidebar mulai di bawah topbar agar brand terlihat */
    .sidebar {
        z-index: 600;
        top: 52px;
        height: calc(100vh - 52px);
    }
    /* Grids → 1 kolom */
    .stat-grid                { grid-template-columns: repeat(2, 1fr); }
    .monitor-grid             { grid-template-columns: repeat(2, 1fr); }
    .monitor-layout           { grid-template-columns: 1fr; }
    .dash-row2, .dash-row3    { grid-template-columns: 1fr; }
    .alert-stat-grid          { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .alert-filter-grid        { grid-template-columns: 1fr; }
    .alert-main-layout        { grid-template-columns: 1fr; }
    .pembinaan-layout         { grid-template-columns: 1fr; }
    .pembinaan-summary-grid   { grid-template-columns: repeat(2, 1fr); }
    .ai-layout                { grid-template-columns: 1fr; }
    .ai-api-columns           { grid-template-columns: 1fr; }
    .ai-summary-grid,
    .ai-threat-grid,
    .ai-recommend-grid,
    .ai-chip-grid             { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .peng-grid                { grid-template-columns: 1fr; }
    .monitor-cluster-list     { grid-template-columns: 1fr; }
    .monitor-header           { flex-direction: column; gap: 8px; }

    /* Tabel — scroll horizontal */
    .pembinaan-table-wrap     { overflow-x: auto; }
    .alert-table-wrap         { overflow-x: auto; }
    .risk-table-wrap          { overflow-x: auto; }
    .pembinaan-table          { min-width: 640px; }

    /* Modal — hampir full screen */
    .pb-modal {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 92vh !important;
        top: 4vh !important;
        transform: translateX(-50%) !important;
    }
    #sigapDialogBox { max-width: 92vw; margin: 0 16px; }

    /* Touch targets lebih besar */
    .sidebar-link             { padding: 14px 16px; font-size: 17px; }
    .pb-btn-view, .pb-btn-update,
    .pb-btn-followup, .pb-btn-complete,
    .pb-btn-kembali           { padding: 10px 8px; font-size: 13px; }
    .peng-input               { padding: 13px; font-size: 16px; }
    .peng-btn-primary         { padding: 13px 20px; font-size: 15px; }

    /* Card padding */
    .admin-card               { padding: 16px; }
    .card-head                { margin-bottom: 14px; }

    /* Pembinaan actions — 2 kolom penuh */
    .pembinaan-actions        { grid-template-columns: 1fr 1fr; }

    /* Login */
    .login-wrap               { padding: 28px 20px; }
}

/* ============================================================
   Responsive — Small Phone (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {
    body                      { font-size: 17px; }
    .stat-grid                { grid-template-columns: 1fr 1fr; }
    .monitor-grid             { grid-template-columns: 1fr; }
    .alert-stat-grid          { grid-template-columns: 1fr; }
    .pembinaan-summary-grid   { grid-template-columns: 1fr; }
    .ai-summary-grid,
    .ai-threat-grid,
    .ai-recommend-grid,
    .ai-chip-grid             { grid-template-columns: 1fr; }
    .monitor-map              { height: 220px; }
    .cluster-row              { grid-template-columns: 1fr; }
    .cluster-bars             { width: 100%; margin-left: 0; }
    .pb-status-cards          { grid-template-columns: 1fr; }
    .pb-status-flow           { flex-direction: column; align-items: flex-start; }
    .pb-status-arrow          { display: none; }
    .admin-main               { padding: 64px 12px 40px; }
    .ai-chat-head             { align-items: flex-start; flex-wrap: wrap; }
    .ai-model-status          { width: 100%; }
    .ai-chat-output           { margin: 12px; padding: 14px 14px 14px 46px; }
    .ai-api-columns           { margin: 0 12px 12px; }
}
