/* ============================================================
   SIGAP — dashboard.css
   ============================================================ */

/* ── Dashboard Nav (tabs + search in one bar) ────────────────── */
.db-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 32px;
    gap: 16px;
}

.db-nav-tabs {
    display: flex;
    align-items: center;
    gap: 0;
}

.db-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 18px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #999;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.db-nav-tab:hover { color: #111; text-decoration: none; }
.db-nav-tab.active { color: #111; font-weight: 700; border-bottom-color: #111; }

.db-tab-badge {
    display: none;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
    line-height: 1.6;
}

.db-tab-badge:not(:empty) { display: inline-block; }

/* ── Global search (inside nav) ──────────────────────────────── */
.db-search-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.db-search-wrap input {
    width: 240px;
    padding: 8px 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #111;
    outline: none;
    transition: border-color 0.15s;
}

.db-search-wrap input:focus { border-color: #111; }
.db-search-wrap input::placeholder { color: #bbb; }

.db-btn-reset {
    padding: 8px 14px;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.db-btn-reset:hover { border-color: #111; color: #111; }

/* ── Section header ──────────────────────────────────────────── */
.db-section-header {
    margin-bottom: 22px;
}

.db-section-header h2 {
    font-size: 19px;
    font-weight: 700;
    color: #111;
    margin-bottom: 4px;
}

.db-section-header p {
    font-size: 14px;
    color: #888;
}

/* ── Sections ────────────────────────────────────────────────── */
.db-section { display: none; }
.db-section.active { display: block; }
#tab-home .db-section-header,
#tab-home .db-stat-grid,
#tab-home .db-info-grid {
    display: none;
}

.home-text-space {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    padding: 20px;
}

.home-text-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.home-text-space h2 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 14px;
}

.home-text-editor {
    min-height: 220px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    color: #333;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    white-space: pre-wrap;
}

.home-text-editor:focus {
    border-color: #111;
    background: #fff;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.db-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.db-stat-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 20px 22px;
    background: #fff;
}

.db-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 8px;
}

.db-stat-value {
    font-size: 36px;
    font-weight: 800;
    color: #111;
    line-height: 1;
}

.stat-low  .db-stat-value { color: #16a34a; }
.stat-medium .db-stat-value { color: #d97706; }
.stat-high .db-stat-value { color: #dc2626; }

/* ── Info grid ───────────────────────────────────────────────── */
.db-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.db-info-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 22px 24px;
}

.db-info-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin-bottom: 14px;
}

.db-info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.db-info-list li {
    font-size: 14px;
    color: #555;
    padding-left: 14px;
    position: relative;
}

.db-info-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: #ccc;
}

/* ── Alur flow ───────────────────────────────────────────────── */
.db-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.db-flow-step {
    background: #f4f4f4;
    border: 1px solid #e4e4e4;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.db-flow-arrow {
    color: #ccc;
    font-size: 16px;
    font-weight: 700;
}

/* ── Data layout (main + sidebar) ───────────────────────────── */
.db-data-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 28px;
    align-items: start;
}

.db-data-main { min-width: 0; }

/* ── Angkatan bar ─────────────────────────────────────────────── */
.db-angkatan-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.db-angkatan-tabs {
    display: flex;
    gap: 6px;
}

.db-angkatan-tab {
    padding: 7px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}

.db-angkatan-tab:hover { background: #f5f5f5; color: #111; }
.db-angkatan-tab.active { background: #111; color: #fff; border-color: #111; font-weight: 700; }

.db-angkatan-search input {
    padding: 8px 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #111;
    outline: none;
    width: 220px;
    transition: border-color 0.15s;
}

.db-angkatan-search input:focus { border-color: #111; }
.db-angkatan-search input::placeholder { color: #bbb; }

/* ── Sidebar Kategori Risiko ─────────────────────────────────── */
.db-data-sidebar {
    position: sticky;
    top: 24px;
}

.db-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 12px;
}

.db-sidebar-card {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    margin-bottom: 8px;
    background: #fff;
}

.db-sidebar-icon { font-size: 16px; flex-shrink: 0; line-height: 1.4; }

.db-sidebar-label {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    margin-bottom: 5px;
}

.db-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.db-sidebar-list li {
    font-size: 12px;
    color: #888;
    padding-left: 10px;
    position: relative;
}

.db-sidebar-list li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: #ccc;
    font-weight: 700;
}

/* ── Table ───────────────────────────────────────────────────── */
.db-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
}

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

.db-table thead th {
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
}

.db-table-row td {
    padding: 13px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-weight: 500;
    vertical-align: middle;
}

.db-table-row:hover td { background: #fafafa; cursor: pointer; }
.db-table-row:last-child td { border-bottom: none; }

/* Score bar */
.db-score-wrap { display: flex; align-items: center; gap: 10px; }

.db-score {
    font-size: 14px;
    font-weight: 800;
    min-width: 28px;
}

.db-score-bar {
    flex: 1;
    height: 5px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.db-score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Score number — color on text only, no background */
.score-low    { color: #16a34a; }
.score-medium { color: #d97706; }
.score-high   { color: #dc2626; }

/* Score bar fill — colored background */
.score-low    .db-score-fill { background: #22c55e; }
.score-medium .db-score-fill { background: #f59e0b; }
.score-high   .db-score-fill { background: #ef4444; }
.db-score-fill.score-low    { background: #22c55e; }
.db-score-fill.score-medium { background: #f59e0b; }
.db-score-fill.score-high   { background: #ef4444; }

/* Badges */
.db-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
}

.badge-low    { background: #dcfce7; color: #15803d; }
.badge-medium { background: #fef3c7; color: #b45309; }
.badge-high   { background: #fee2e2; color: #b91c1c; }

/* Empty */
.db-empty {
    text-align: center;
    padding: 32px;
    color: #bbb;
    font-size: 14px;
}

/* ── Detail panel ────────────────────────────────────────────── */
.db-detail-panel {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 20px 22px;
    min-height: 80px;
}

.db-detail-placeholder {
    color: #bbb;
    font-size: 14px;
}

.db-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.db-detail-name { font-size: 18px; font-weight: 800; color: #111; }
.db-detail-satuan { font-size: 14px; color: #888; margin-top: 2px; }

.db-detail-score-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.db-detail-score {
    font-size: 28px;
    font-weight: 800;
}

.db-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.db-detail-item {
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 10px 14px;
}

.db-detail-key {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #aaa;
    margin-bottom: 4px;
}

.db-detail-val { font-size: 14px; font-weight: 500; color: #333; }

.db-detail-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    color: #444;
}

/* ── Alert cards ─────────────────────────────────────────────── */
.db-alert-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.db-filter-btn {
    padding: 7px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.db-filter-btn:hover { border-color: #111; color: #111; }
.db-filter-btn.active { background: #111; color: #fff; border-color: #111; }

.db-alert-card {
    border: 1px solid #e8e8e8;
    border-left-width: 4px;
    border-radius: 4px;
    padding: 16px 18px;
    margin-bottom: 10px;
}

.db-alert-card.badge-high   { border-left-color: #ef4444; }
.db-alert-card.badge-medium { border-left-color: #f59e0b; }
.db-alert-card.badge-low    { border-left-color: #22c55e; }

.db-alert-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.db-alert-score { font-size: 13px; font-weight: 700; color: #999; }
.db-alert-name  { font-size: 15px; font-weight: 700; color: #111; margin-bottom: 5px; }
.db-alert-faktor { font-size: 13px; color: #666; margin-bottom: 3px; }
.db-alert-rek   { font-size: 13px; color: #999; }

/* ── Pembinaan ───────────────────────────────────────────────── */
.db-pembinaan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.db-pembinaan-card {
    border: 1px solid #e8e8e8;
    border-top-width: 3px;
    border-radius: 6px;
    padding: 22px 22px 20px;
}

.card-low    { border-top-color: #22c55e; }
.card-medium { border-top-color: #f59e0b; }
.card-high   { border-top-color: #ef4444; }

.db-pembinaan-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.db-pembinaan-header h4 { font-size: 15px; font-weight: 700; color: #111; }

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

.dot-low    { background: #22c55e; }
.dot-medium { background: #f59e0b; }
.dot-high   { background: #ef4444; }

.db-pembinaan-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.db-pembinaan-card ul li {
    font-size: 14px;
    color: #555;
    padding-left: 14px;
    position: relative;
}

.db-pembinaan-card ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: #ccc;
}

/* ── Kategori tab divider ─────────────────────────────────────── */
.db-kat-divider {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 32px 0;
}

/* ── Mini panel ──────────────────────────────────────────────── */
.db-kat-panel {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
}

/* ── Tab Data Prajurit: dua kolom (kiri=search, kanan=panel) ─── */
.db-data2-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
}

.db-data2-main { min-width: 0; }

/* Panel kanan sticky */
.db-kat-panel-side {
    position: sticky;
    top: 24px;
}

/* ── Search bar + multi-select ───────────────────────────────── */
.db-search2-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.db-search2-bar input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 9px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #111;
    outline: none;
    transition: border-color 0.15s;
}

.db-search2-bar input[type="text"]:focus { border-color: #111; }
.db-search2-bar input[type="text"]::placeholder { color: #bbb; }

/* ── Multi-select dropdown ───────────────────────────────────── */
.db-multiselect {
    position: relative;
    flex-shrink: 0;
}

.db-multiselect-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
    min-width: 160px;
    justify-content: space-between;
}

.db-multiselect-btn:hover { border-color: #111; color: #111; }

.db-multiselect-arrow {
    font-size: 11px;
    color: #aaa;
    transition: transform 0.15s;
}

.db-multiselect-panel.open + .db-multiselect-btn .db-multiselect-arrow,
.db-multiselect-btn:has(+ .db-multiselect-panel.open) .db-multiselect-arrow {
    transform: rotate(180deg);
}

.db-multiselect-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    z-index: 200;
    padding: 8px 0;
}

.db-multiselect-panel.open { display: block; }

.db-ms-group {
    padding: 8px 14px 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #bbb;
}

.db-ms-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.1s;
}

.db-ms-item:hover { background: #f5f5f5; }

.db-ms-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #111;
    flex-shrink: 0;
    cursor: pointer;
}

/* ── Hasil pencarian (kartu) ─────────────────────────────────── */
.db-result-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 10px;
    background: #fff;
    transition: box-shadow 0.15s;
}

.db-result-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.07); }

.db-result-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.db-result-nama {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 2px;
}

.db-result-satuan {
    font-size: 13px;
    color: #999;
}

.db-result-score-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.db-result-body {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    align-items: baseline;
}

.db-result-body:last-child { margin-bottom: 0; }

.db-result-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #bbb;
    flex-shrink: 0;
    width: 90px;
}

.db-kat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

.db-kat-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
}

/* Mini tabs AD / AL / AU */
.db-mini-tabs {
    display: flex;
    gap: 4px;
}

.db-mini-tab {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    transition: all 0.12s;
}

.db-mini-tab:hover { color: #111; border-color: #aaa; }
.db-mini-tab.active { background: #111; color: #fff; border-color: #111; }

/* Row item dalam mini panel */
.db-kat-row {
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.db-kat-row:last-child { border-bottom: none; }

.db-kat-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
}

.db-kat-name {
    font-size: 13px;
    font-weight: 700;
    color: #111;
}

.db-kat-score {
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}

.db-kat-badge-wrap {
    margin-bottom: 5px;
}

.db-kat-faktor {
    font-size: 12px;
    color: #999;
    line-height: 1.45;
}

/* ── Kategori Risiko & Level ─────────────────────────────────── */
.db-level-section {
    margin-bottom: 32px;
}

.db-level-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.db-level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.db-level-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 22px 20px;
}

.db-level-score {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.db-level-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.db-level-desc {
    font-size: 13px;
    color: #777;
    line-height: 1.6;
    margin-bottom: 14px;
}

.db-level-action {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.db-level-action li {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    padding-left: 12px;
    position: relative;
}

.db-level-action li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #ccc;
    font-size: 11px;
}

/* ── Kategori grid ───────────────────────────────────────────── */
.db-kategori-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.db-kategori-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 22px 20px;
}

.db-kategori-icon {
    font-size: 24px;
    margin-bottom: 12px;
}

.db-kategori-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin-bottom: 12px;
}

.db-kategori-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.db-kategori-card ul li {
    font-size: 13px;
    color: #666;
    padding-left: 12px;
    position: relative;
}

.db-kategori-card ul li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: #bbb;
    font-weight: 700;
}

/* ── Responsive ──────────────────────────────────────────────── */
/* ── Sub-nav (Pencarian / Daerah Sekitar) ────────────────────── */
.db-sub-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 24px;
}

.db-sub-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.db-sub-tab:hover { color: #111; }
.db-sub-tab.active { color: #111; border-bottom-color: #111; }

.db-sub-section { display: none; }
.db-sub-section.active { display: block; }

/* ── Near Me Layout (two-column: card left | map right) ─────── */
.nm-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 12px;
    align-items: flex-start;
    min-height: 320px;
}

/* ── Near Me Card (left column) ──────────────────────────────── */
.nm-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.nm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    gap: 10px;
}

.nm-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nm-icon-pin {
    font-size: 16px;
    color: #1d6fc4;
}

.nm-title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

.nm-subtitle {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
    margin-top: 1px;
}

.nm-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.nm-count-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid #1d6fc4;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #1d6fc4;
    min-width: 64px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.nm-help-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Prompt lokasi ───────────────────────────────────────────── */
.nm-prompt {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    padding: 22px 20px;
    text-align: left;
}

.nm-prompt-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}
.nm-prompt-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.nm-prompt p { font-size: 13px; color: #999; max-width: 280px; line-height: 1.5; }

.nm-locate-btn {
    padding: 9px 24px;
    background: #1d6fc4;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.nm-locate-btn:hover { background: #1558a0; }

/* ── Loading ─────────────────────────────────────────────────── */
.nm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    color: #aaa;
    font-size: 13px;
}

.nm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e8e8;
    border-top-color: #1d6fc4;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Map right column ────────────────────────────────────────── */
.nm-map-right {
    position: fixed;
    left: 300px;
    top: 130px;
    z-index: 1000;
    width: min(760px, calc(100vw - 32px));
    height: 430px;
    min-width: 360px;
    min-height: 260px;
    border: 1px solid #cfd7e3;
    border-radius: 8px;
    overflow: hidden;
    resize: both;
    background: #fff;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
}

.nm-map-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 34px;
    padding: 0 10px 0 12px;
    border-bottom: 1px solid #dbe2ea;
    background: #f8fafc;
    color: #111827;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    cursor: move;
    user-select: none;
}

.nm-map-close {
    width: 22px;
    height: 22px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    font-size: 16px;
    line-height: 18px;
}

.nm-map-close:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.nm-map-overlay {
    position: absolute;
    top: 42px;
    right: 12px;
    z-index: 2000;
    display: block;
    visibility: visible;
    pointer-events: none;
}

.nm-map-overlay .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);
    font-size: 11px;
    line-height: 1.4;
}

#nmMap {
    position: relative;
    width: 100%;
    flex: 1;
    height: 100%;
    overflow: hidden;
    background: #eef3f8;
}

.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;
}

.nm-map-pin.is-user {
    width: 24px;
    height: 24px;
}

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

.nm-offscreen-layer {
    position: absolute;
    inset: 0;
    z-index: 650;
    pointer-events: none;
}

.nm-offscreen-indicator {
    appearance: none;
    position: absolute;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.32));
    cursor: pointer;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.nm-offscreen-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -7px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid currentColor;
    color: inherit;
    transform: translateX(-50%) rotate(var(--nm-angle));
    transform-origin: 50% 19px;
}

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

.nm-risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
}

.nm-risk-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.nm-risk-indicator.risk-high .nm-risk-dot { background: #ef4444; }
.nm-risk-indicator.risk-medium .nm-risk-dot { background: #f59e0b; }
.nm-risk-indicator.risk-low .nm-risk-dot { background: #22c55e; }

/* Legacy — kept so old JS refs don't error */
.nm-map-window { display: none; }
.nm-map-body { flex: 1; min-height: 0; }

/* ── Custom Leaflet markers ──────────────────────────────────── */
/* .nm-pin — ukuran & style diatur dinamis via JS (makePinIcon) */
.nm-pin { transition: width 0.2s ease, height 0.2s ease; }

.nm-user-pin {
    width: 16px;
    height: 16px;
    background: #1d6fc4;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px rgba(29,111,196,0.25);
}

/* Leaflet popup */
.nm-popup { font-family: 'Inter', sans-serif; min-width: 180px; }
.nm-popup-name { font-size: 13px; font-weight: 700; color: #111; margin-bottom: 6px; }
.nm-popup-detail { font-size: 12px; color: #666; line-height: 1.6; }

/* ── Bottom info bar ─────────────────────────────────────────── */
.nm-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: #1d4060;
    gap: 10px;
    flex-shrink: 0;
}

.nm-info-text {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nm-info-arrow {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .db-stat-grid     { grid-template-columns: repeat(2, 1fr); }
    .db-level-grid    { grid-template-columns: 1fr; }
    .db-kategori-grid { grid-template-columns: repeat(2, 1fr); }
    .db-data2-layout  { grid-template-columns: 1fr; }
    .db-kat-panel-side { position: static; }
    .nm-layout        { grid-template-columns: 200px 1fr; }
}

@media (max-width: 768px) {
    .db-search-wrap input  { width: 100%; }
    .db-stat-grid          { grid-template-columns: repeat(2, 1fr); }
    .home-text-grid        { grid-template-columns: 1fr; }
    .db-info-grid          { grid-template-columns: 1fr; }
    .db-pembinaan-grid     { grid-template-columns: 1fr; }
    .db-detail-grid        { grid-template-columns: 1fr; }
    .db-detail-footer      { grid-template-columns: 1fr; }
    .db-nav                { flex-direction: column; align-items: flex-start; }
    .db-nav-tabs           { overflow-x: auto; width: 100%; }
    .db-angkatan-bar       { flex-direction: column; align-items: flex-start; }
    .db-angkatan-search input { width: 100%; }
    .db-search2-bar        { flex-direction: column; align-items: stretch; }
    .db-search2-bar input  { width: 100%; }
    .db-multiselect-btn    { width: 100%; }
    .nm-layout             { grid-template-columns: 1fr; }
    .nm-map-right {
        left: 16px;
        top: 92px;
        width: calc(100vw - 32px);
        height: 340px;
    }
    .nm-card               { margin: 0; }
}
