/* SIMS Monitor — app.css | Mobile-first, portrait-optimised */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #185FA5;
    --blue-lt: #E6F1FB;
    --blue-bd: #378ADD;
    --green: #0F6E56;
    --green-lt: #E1F5EE;
    --amber: #854F0B;
    --amber-lt: #FAEEDA;
    --purple: #3C3489;
    --purple-lt: #EEEDFE;
    --red: #A32D2D;
    --red-lt: #FCEBEB;
    --teal: #1D9E75;
    --bg: #F0F2F5;
    --surface: #FFFFFF;
    --border: rgba(0,0,0,0.07);
    --border-md: rgba(0,0,0,0.13);
    --text: #181816;
    --muted: #6b6b68;
    --radius: 7px;
    --radius-lg: 11px;
    --sidebar-w: 220px;
    --topbar-h: 50px;
    --px: 16px;
    --touch: 46px;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 0.5px solid var(--border-md);
    display: flex;
    flex-direction: column;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.22s ease, width 0.22s ease;
}

    .sidebar.open {
        transform: translateX(0);
    }

@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 299;
}

    .sidebar-overlay.show {
        display: block;
    }

@media (min-width: 768px) {
    .sidebar-overlay {
        display: none !important;
    }
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 14px 14px;
    border-bottom: 0.5px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.logo-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.logo-sub {
    font-size: 10px;
    color: var(--muted);
    line-height: 1.3;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 6px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    min-height: var(--touch);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
}

    .sidebar-link i {
        font-size: 18px;
        flex-shrink: 0;
    }

    .sidebar-link:hover {
        background: var(--bg);
        color: var(--text);
    }

    .sidebar-link.active {
        background: var(--blue-lt);
        color: var(--blue);
    }

@media (min-width: 768px) {
    .sidebar-link {
        padding: 8px 10px;
        min-height: unset;
        font-size: 13px;
    }

        .sidebar-link i {
            font-size: 17px;
        }
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 0.5px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

    .sidebar-user-info .user-name {
        font-size: 13px;
        font-weight: 600;
        white-space: normal;
        overflow: visible;
        word-break: break-word;
        line-height: 1.3;
    }

    .sidebar-user-info .user-role {
        font-size: 11px;
        color: var(--muted);
    }

/* ── Collapse button (desktop only) ─────────────────────────── */
.btn-collapse {
    display: none;
    position: absolute;
    bottom: 72px;
    right: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 0.5px solid var(--border-md);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    z-index: 10;
    transition: color 0.15s, background 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

    .btn-collapse:hover {
        color: var(--blue);
        background: var(--blue-lt);
    }

@media (min-width: 768px) {
    .btn-collapse {
        display: flex;
    }
}

/* ── Collapsed state (desktop) ──────────────────────────────── */
@media (min-width: 768px) {
    .sidebar.collapsed {
        width: 52px;
    }

        .sidebar.collapsed .logo-text,
        .sidebar.collapsed .nav-label,
        .sidebar.collapsed .sidebar-user-info,
        .sidebar.collapsed .btn-logout {
            display: none;
        }

        .sidebar.collapsed .sidebar-logo {
            justify-content: center;
            padding: 18px 0 14px;
        }

        .sidebar.collapsed .sidebar-link {
            justify-content: center;
            padding: 10px 0;
        }

        .sidebar.collapsed .sidebar-user {
            justify-content: center;
            padding: 12px 0;
        }

    .app-wrapper.sidebar-collapsed {
        margin-left: 52px;
    }
}

/* ── APP WRAPPER + TOPBAR ────────────────────────────────────── */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left 0.22s ease;
}

@media (min-width: 768px) {
    .app-wrapper {
        margin-left: var(--sidebar-w);
    }
}

.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 var(--px);
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--surface);
    border-bottom: 0.5px solid var(--border-md);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .topbar {
        display: none;
    }
}

.topbar-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch);
    height: var(--touch);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 22px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

    .btn-menu:hover {
        background: var(--bg);
        color: var(--text);
    }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.app-main {
    flex: 1;
    padding: 10px var(--px) 16px;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .app-main {
        padding: 22px 28px;
    }
}

@media (min-width: 1200px) {
    .app-main {
        padding: 24px 36px;
    }
}

.page-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 1px;
    letter-spacing: -0.3px;
}

@media (min-width: 768px) {
    .page-title {
        font-size: 19px;
    }
}

.page-sub {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
}

@media (min-width: 768px) {
    .page-title {
        font-size: 21px;
    }

    .page-sub {
        margin-bottom: 18px;
    }
}

/* ── AVATAR + LOGOUT ─────────────────────────────────────────── */
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue-lt);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

    .avatar.sm {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

.btn-logout {
    color: var(--muted);
    font-size: 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

    .btn-logout:hover {
        color: var(--red);
        background: var(--red-lt);
    }

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

@media (min-width: 480px) {
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
        gap: 10px;
        margin-bottom: 18px;
    }
}

.stat-grid-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

@media (min-width: 480px) {
    .stat-grid-hero {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .stat-grid-hero {
        gap: 10px;
        margin-bottom: 18px;
    }
}

.stat-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 13px 14px;
}

    .stat-card.blue {
    }

    .stat-card.green {
        border-left: 3px solid var(--teal);
    }

    .stat-card.amber {
        border-left: 3px solid #EF9F27;
    }

    .stat-card.purple {
        border-left: 3px solid #7F77DD;
    }

    .stat-card.red {
        border-left: 3px solid #E24B4A;
    }

.stat-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-val {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

@media (min-width: 768px) {
    .stat-val {
        font-size: 24px;
    }
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--px);
    border-bottom: 0.5px solid var(--border);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
}

.card-body {
    padding: 13px var(--px);
}

@media (min-width: 768px) {
    .card-header {
        padding: 12px 16px;
    }

    .card-body {
        padding: 14px 16px;
    }
}

/* ── DASHBOARD GRID ──────────────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}

@media (min-width: 600px) {
    .dash-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

@media (min-width: 1100px) {
    .dash-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 14px;
    }
}

.dash-grid .card.full {
    grid-column: 1 / -1;
}

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-granted {
    background: var(--green-lt);
    color: var(--green);
}

.badge-fixed {
    background: var(--blue-lt);
    color: var(--blue);
}

.badge-lm-pub {
    background: var(--amber-lt);
    color: var(--amber);
}

.badge-lm-pri {
    background: var(--purple-lt);
    color: var(--purple);
}

.badge-broadcast {
    background: var(--red-lt);
    color: var(--red);
}

.badge-aero {
    background: var(--green-lt);
    color: var(--green);
}

.badge-other {
    background: #F1EFE8;
    color: #5F5E5A;
}

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px var(--px);
    border-bottom: 0.5px solid var(--border);
    background: var(--bg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-bar label {
        font-size: 11px;
        color: var(--muted);
        flex-shrink: 0;
    }

.filter-btn {
    padding: 7px 14px;
    min-height: 36px;
    border-radius: 20px;
    font-size: 12px;
    border: 0.5px solid var(--border-md);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.12s;
    font-family: inherit;
    flex-shrink: 0;
    white-space: nowrap;
}

    .filter-btn:hover {
        border-color: var(--blue-bd);
        color: var(--blue);
    }

    .filter-btn.active {
        background: var(--blue-lt);
        border-color: var(--blue-bd);
        color: var(--blue);
        font-weight: 500;
    }

@media (min-width: 768px) {
    .filter-bar {
        flex-wrap: wrap;
        overflow-x: unset;
        padding: 10px 16px;
    }

    .filter-btn {
        min-height: 28px;
        padding: 4px 11px;
        font-size: 12px;
    }
}

/* ── FORM ────────────────────────────────────────────────────── */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

    .form-group label {
        font-size: 11px;
        color: var(--muted);
    }

/* ── FILTER GRID ─────────────────────────────────────────────── */

/* ── FILTER COMPACT (peta + data) ────────────────────────────── */
.filter-compact {
    padding: 10px 12px;
    border-bottom: 0.5px solid var(--border);
}

.filter-search-row {
    margin-bottom: 8px;
}

    .filter-search-row .search-wrap {
        width: 100%;
    }

    .filter-search-row input[type=search] {
        width: 100%;
        font-size: 12px;
        padding: 6px 8px 6px 28px;
        min-height: 34px;
    }

.filter-dropdowns-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-end;
}

    .filter-dropdowns-row .form-group {
        flex: 1 1 120px;
        min-width: 100px;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

        .filter-dropdowns-row .form-group label {
            font-size: 10px;
            color: var(--muted);
            white-space: nowrap;
        }

    .filter-dropdowns-row select {
        width: 100%;
        font-size: 12px;
        padding: 5px 7px;
        min-height: 32px;
    }

    .filter-dropdowns-row .filter-actions {
        flex: 0 0 auto;
        display: flex;
        gap: 4px;
        align-items: flex-end;
    }

        .filter-dropdowns-row .filter-actions .btn {
            min-height: 32px;
            padding: 5px 10px;
            font-size: 12px;
        }

@media (min-width: 768px) {
    .filter-compact {
        padding: 10px 16px;
    }

    .filter-dropdowns-row .form-group {
        flex: 1 1 130px;
    }
}

@media (max-width: 540px) {
    .filter-dropdowns-row {
        flex-wrap: wrap;
    }

        .filter-dropdowns-row .form-group {
            flex: 1 1 calc(50% - 6px);
        }
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 0.5px solid var(--border);
}

    .filter-grid .filter-full {
        grid-column: 1 / -1;
    }

    .filter-grid .form-group {
        min-width: 0;
    }

    .filter-grid input[type=search],
    .filter-grid select {
        width: 100%;
        font-size: 12px;
        padding: 6px 8px;
        min-height: 36px;
    }

    .filter-grid .search-wrap input {
        padding-left: 26px;
    }

.filter-actions {
    display: flex;
    gap: 6px;
}

    .filter-actions .btn {
        flex: 1;
        justify-content: center;
    }

@media (min-width: 768px) {
    .filter-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        padding: 12px 16px;
        gap: 10px;
    }

    .filter-actions {
        grid-column: unset;
        align-items: flex-end;
    }

        .filter-actions .btn {
            flex: unset;
        }
}

@media (min-width: 540px) {
    .form-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

input[type=text], input[type=search], select {
    padding: 7px 10px;
    min-height: 38px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    width: 100%;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

    input[type=text]:focus, input[type=search]:focus, select:focus {
        outline: none;
        border-color: var(--blue-bd);
        box-shadow: 0 0 0 3px rgba(55,138,221,0.10);
    }

@media (min-width: 768px) {
    input[type=text], input[type=search], select {
        padding: 7px 10px;
        min-height: unset;
        font-size: 13px;
        width: auto;
    }
}

.search-wrap {
    position: relative;
}

    .search-wrap i {
        position: absolute;
        left: 9px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
        font-size: 14px;
        pointer-events: none;
    }

    .search-wrap input {
        padding-left: 28px;
    }

@media (min-width: 768px) {
    .search-wrap i {
        font-size: 14px;
        left: 9px;
    }

    .search-wrap input {
        padding-left: 28px;
        min-width: 200px;
    }
}

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

thead th {
    padding: 9px 11px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 0.5px solid var(--border-md);
    white-space: nowrap;
}

tbody td {
    padding: 10px 11px;
    border-bottom: 0.5px solid var(--border);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: #F7F7F6;
}

@media (max-width: 767px) {
    thead th:first-child, tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: var(--bg);
        box-shadow: 1px 0 0 var(--border);
    }

    tbody td:first-child {
        background: var(--surface);
    }

    tbody tr:hover td:first-child {
        background: #F7F7F6;
    }
}

.td-mono {
    font-family: 'SF Mono','Fira Code',monospace;
    font-size: 11px;
    color: var(--blue);
}

.td-freq {
    font-family: 'SF Mono','Fira Code',monospace;
    font-size: 11.5px;
}

.td-muted {
    color: var(--muted);
}

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px var(--px);
    border-top: 0.5px solid var(--border);
    font-size: 12px;
}

.pag-info {
    color: var(--muted);
}

.pag-links {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

    .pag-links a, .pag-links span {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: var(--radius);
        border: 0.5px solid var(--border-md);
        font-size: 12px;
        text-decoration: none;
        color: var(--text);
    }

        .pag-links a:hover {
            border-color: var(--blue-bd);
            color: var(--blue);
            background: var(--blue-lt);
        }

        .pag-links span.active {
            background: var(--blue);
            border-color: var(--blue);
            color: #fff;
        }

        .pag-links span.dots {
            border: none;
            color: var(--muted);
        }

@media (min-width: 768px) {
    .pagination {
        padding: 10px 16px;
    }

    .pag-links a, .pag-links span {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    min-height: var(--touch);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    border: 0.5px solid var(--border-md);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.12s;
    background: var(--surface);
    color: var(--text);
}

    .btn:hover {
        background: var(--bg);
    }

.btn-primary {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

    .btn-primary:hover {
        background: #0C447C;
        border-color: #0C447C;
    }

.btn i {
    font-size: 16px;
}

@media (min-width: 768px) {
    .btn {
        padding: 6px 13px;
        min-height: unset;
        font-size: 12.5px;
    }

        .btn i {
            font-size: 14px;
        }
}

/* ── CHARTS ──────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 190px;
}

@media (min-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-item {
    display: grid;
    grid-template-columns: 90px 1fr 58px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bar-label {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 7px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--blue);
}

.bar-val {
    text-align: right;
    font-weight: 500;
    font-size: 12px;
}

.bar-pct {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 400;
    margin-left: 2px;
}

.sub-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    flex-shrink: 0;
    vertical-align: middle;
}

@media (min-width: 768px) {
    .bar-item {
        grid-template-columns: 110px 1fr 66px;
    }
}

/* ── MAP ─────────────────────────────────────────────────────── */
#map {
    width: 100%;
    height: 60vh;
    min-height: 280px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

@media (min-width: 768px) {
    #map {
        height: 70vh;
        min-height: 400px;
    }
}

@media (min-width: 1200px) {
    #map {
        height: 75vh;
    }
}

.map-controls {
    padding: 10px var(--px);
    border-bottom: 0.5px solid var(--border);
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: center;
}

    .map-controls::-webkit-scrollbar {
        display: none;
    }

@media (min-width: 768px) {
    .map-controls {
        flex-wrap: wrap;
        overflow-x: unset;
        padding: 10px 16px;
    }
}

.map-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    flex: 1;
}

@media (max-width: 539px) {
    .map-legend {
        display: none;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

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

/* ── LOGIN ───────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px var(--px) 24px;
    background: var(--bg);
}

@media (min-width: 480px) {
    .login-page {
        align-items: center;
        padding: 24px;
    }
}

.login-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

@media (min-width: 480px) {
    .login-card {
        padding: 36px;
    }
}

.login-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    margin: 0 auto 18px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.btn-sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    min-height: var(--touch);
    border-radius: var(--radius);
    background: var(--blue);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-sso:hover {
        background: #0C447C;
    }

/* ── LEAFLET ─────────────────────────────────────────────────── */
.leaflet-popup-content {
    font-size: 13px;
    line-height: 1.6;
    min-width: 190px;
}

    .leaflet-popup-content strong {
        display: block;
        font-size: 13px;
        margin-bottom: 4px;
    }

    .leaflet-popup-content .pop-meta {
        color: var(--muted);
        font-size: 11px;
    }

/* ── FOOTER ──────────────────────────────────────────────────── */
.app-footer {
    border-top: 0.5px solid var(--border);
    padding: 10px var(--px);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

@media (min-width: 640px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ── UTILITIES ───────────────────────────────────────────────── */
.text-muted {
    color: var(--muted);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

    .empty-state i {
        font-size: 36px;
        display: block;
        margin-bottom: 10px;
    }

/* ── SERVICE GRID (dashboard) ──────────────────────────────── */
.svc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .svc-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
}

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .app-footer, .btn-menu, .sidebar-overlay {
        display: none !important;
    }

    .app-wrapper {
        margin-left: 0 !important;
    }

    .card {
        break-inside: avoid;
    }
}

/* ── Bar item mobile: angka pindah baris bawah ───────────────── */
@media (max-width: 479px) {
    .bar-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 8px;
    }

        .bar-item .bar-label {
            grid-column: 1;
            grid-row: 1;
        }

        .bar-item .bar-val {
            grid-column: 2;
            grid-row: 1;
            text-align: right;
        }

        .bar-item .bar-track {
            grid-column: 1 / -1;
            grid-row: 2;
        }
}

/* ── Fix Leaflet z-index: di bawah sidebar (z-index 300) ─────── */
.leaflet-pane {
    z-index: 10 !important;
}

.leaflet-top,
.leaflet-bottom {
    z-index: 20 !important;
}

.leaflet-popup-pane {
    z-index: 30 !important;
}

.leaflet-tooltip-pane {
    z-index: 35 !important;
}

.leaflet-control {
    z-index: 20 !important;
}

/* ── Dashboard stat 3 ────────────────────────────────────────── */
.dash-stat3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

@media (max-width: 479px) {
    .dash-stat3 {
        grid-template-columns: 1fr 1fr;
    }

        .dash-stat3 .stat-card:last-child {
            grid-column: 1 / -1;
        }
}

/* ── Dashboard section spacing ───────────────────────────────── */
.dash-section {
    margin-bottom: 12px;
}

/* ── Card hint (kecil di kanan header) ───────────────────────── */
.card-hint {
    font-size: 10px;
    color: var(--muted);
}

/* ── Expand rows ─────────────────────────────────────────────── */
.dash-barlist {
    padding: 0 14px;
}

@media (min-width: 768px) {
    .dash-barlist {
        padding: 0 16px;
    }
}

.expand-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 12px;
}

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

@media (max-width: 479px) {
    .expand-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 3px 8px;
    }

        .expand-row .er-label {
            grid-column: 1;
            grid-row: 1;
        }

        .expand-row .er-val {
            grid-column: 2;
            grid-row: 1;
        }

        .expand-row .bar-track {
            grid-column: 1 / -1;
            grid-row: 2;
        }
}

.expand-row[onclick] {
    cursor: pointer;
}

    .expand-row[onclick]:hover .er-label {
        color: var(--blue);
    }

.er-label {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.er-chev {
    font-size: 11px;
    color: var(--muted);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

    .er-chev.open {
        transform: rotate(90deg);
    }

.er-val {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px;
    font-size: 12px;
}

/* ── Expand children ─────────────────────────────────────────── */
.expand-children {
    display: none;
    background: var(--bg);
    border-radius: var(--radius);
    margin: 2px 0 4px;
    padding: 0 10px;
}

    .expand-children.open {
        display: block;
    }

.indent1 .er-label {
    padding-left: 10px;
    font-size: 11.5px;
}

.indent1 .er-val {
    font-size: 11px;
}

.indent2 .er-label {
    padding-left: 10px;
    font-size: 11px;
    color: var(--muted);
}

.indent2 .er-val {
    font-size: 10.5px;
}

/* ── Nested expand (kecamatan dalam kabupaten) ───────────────── */
.expand-children .expand-children {
    background: var(--surface);
    border: 0.5px solid var(--border);
    margin: 2px 0 4px;
    padding: 0 8px;
}

/* ── Client search ───────────────────────────────────────────── */
.dash-search {
    width: 100%;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
    min-height: unset;
}

    .dash-search:focus {
        border-color: var(--blue-bd);
        box-shadow: 0 0 0 3px rgba(55,138,221,0.10);
    }

/* ── Client scrollable list ──────────────────────────────────── */
.dash-scroll {
    max-height: 320px;
    overflow-y: auto;
    padding-bottom: 4px;
}

@media (min-width: 768px) {
    .dash-scroll {
        max-height: 400px;
    }
}

/* ── er-val: 2 kolom lurus (absolut + persen) ────────────────── */
.er-val {
    display: grid;
    grid-template-columns: 54px 34px;
    gap: 0;
    justify-items: end;
    align-items: center;
    flex-shrink: 0;
}

.er-abs {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    text-align: right;
}

.er-pct {
    font-size: 10.5px;
    color: var(--muted);
    text-align: right;
}

/* mobile: sembunyikan bar-track, er-val tetap 2 kolom */
@media (max-width: 479px) {
    .expand-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 3px 8px;
    }

        .expand-row .er-label {
            grid-column: 1;
            grid-row: 1;
        }

        .expand-row .er-val {
            grid-column: 2;
            grid-row: 1;
        }

        .expand-row .bar-track {
            grid-column: 1 / -1;
            grid-row: 2;
        }

    .expand-children .expand-row .bar-track {
        display: none;
    }

    .expand-children .expand-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto;
    }
}
