/* ==========================================================================
   SIAKAD — layout admin (di atas theme.css bersama dari Portal)
   Breakpoint: desktop ≥1200px sidebar tetap; <1200px sidebar off-canvas.
   ========================================================================== */

:root {
    --sidebar-width: 260px;
}

body {
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background-color: var(--ws-surface);
    border-right: 1px solid var(--ws-border);
    overflow-y: auto;
    z-index: 1045;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--ws-border);
    position: sticky;
    top: 0;
    background-color: var(--ws-surface);
    z-index: 1;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.75rem;
    display: grid;
    place-items: center;
    background-color: var(--ws-primary-light);
    color: var(--ws-primary);
    font-size: 1.25rem;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ws-text-muted);
    padding: 1rem 1rem 0.35rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1rem;
    border-radius: 0.6rem;
    color: var(--ws-text-secondary);
    font-weight: 500;
    font-size: 0.925rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar .nav-link:hover {
    background-color: var(--ws-primary-subtle);
    color: var(--ws-primary);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background-color: var(--ws-primary);
    color: #fff;
    box-shadow: var(--ws-shadow);
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
    color: #0F172A;
}

.sidebar-backdrop {
    display: none;
}

/* ── Main ────────────────────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--ws-surface);
    border-bottom: 1px solid var(--ws-border);
}

@media (max-width: 1199.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--ws-shadow-lg);
    }

    .sidebar.show + .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1040;
    }

    .main {
        margin-left: 0;
    }
}

/* ── Komponen ────────────────────────────────────────────────────────── */
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    background-color: var(--ws-primary-light);
    color: var(--ws-primary);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.card:hover {
    transform: translateY(-1px);
}

.card.no-hover:hover {
    transform: none;
    box-shadow: var(--ws-shadow);
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

.table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ws-text-secondary);
    border-bottom-color: var(--ws-border);
    white-space: nowrap;
}

.table td {
    border-color: var(--ws-border);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--ws-surface-hover);
}

.form-control,
.form-select {
    border-color: var(--ws-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ws-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}

.form-check-input:checked {
    background-color: var(--ws-primary);
    border-color: var(--ws-primary);
}

.btn-outline-primary {
    color: var(--ws-primary);
    border-color: var(--ws-primary);
}

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

.btn {
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:active {
    transform: scale(0.97);
}

.text-primary {
    color: var(--ws-primary) !important;
}

.bg-primary-subtle-ws {
    background-color: var(--ws-primary-subtle) !important;
    color: var(--ws-primary) !important;
}

.font-monospace-sm {
    font-family: var(--bs-font-monospace);
    font-size: 0.85rem;
}

.perm-table td,
.perm-table th {
    white-space: nowrap;
}

/* ── Login ───────────────────────────────────────────────────────────── */
.login-panel {
    background: linear-gradient(135deg, #047857 0%, #059669 55%, #34D399 100%);
}

/* ── Tom Select (pemilih wilayah) — selaras tema & mode gelap ───────── */
.ts-wrapper .ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-dropdown {
    background-color: var(--ws-surface);
    color: var(--ws-text);
    border-color: var(--ws-border);
}

.ts-wrapper .ts-control input {
    color: var(--ws-text);
}

.ts-wrapper .ts-control input::placeholder {
    color: var(--ws-text-muted);
}

.ts-wrapper.focus .ts-control {
    border-color: var(--ws-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}

.ts-dropdown .option {
    color: var(--ws-text);
}

.ts-dropdown .active {
    background-color: var(--ws-primary-subtle);
    color: var(--ws-primary);
}

.ts-dropdown .no-results {
    padding: 0.5rem 0.75rem;
    color: var(--ws-text-secondary);
}

.ts-wrapper.disabled .ts-control {
    background-color: var(--ws-surface-hover);
    opacity: 0.7;
}

/* Logo aplikasi (assets/img/ikon.png) di sidebar & halaman login */
.sidebar-brand .brand-icon.brand-logo { background: none; }
.sidebar-brand .brand-icon.brand-logo img { width: 40px; height: 40px; object-fit: contain; }
.logo-login { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 1.25rem; padding: .5rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }

/* Isi panduan operator (general.md §5.8): langkah bernomor, kotak tips/awas */
.isi-panduan { line-height: 1.65; }
.isi-panduan h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
.isi-panduan h3:first-child { margin-top: 0; }
.isi-panduan ol.langkah { counter-reset: langkah; list-style: none; padding-left: 0; }
.isi-panduan ol.langkah > li { counter-increment: langkah; position: relative; padding: 0 0 .65rem 2.4rem; }
.isi-panduan ol.langkah > li::before { content: counter(langkah); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--ws-primary-subtle); color: var(--ws-primary); font-weight: 600; font-size: .85rem; display: grid; place-items: center; }
.isi-panduan .tips, .isi-panduan .awas { border-radius: .5rem; padding: .65rem .85rem; margin: .75rem 0; font-size: .925rem; }
.isi-panduan .tips { background: var(--ws-primary-subtle); }
.isi-panduan .awas { background: rgba(220, 53, 69, .1); }
.isi-panduan .tips::before { content: "Tips: "; font-weight: 600; color: var(--ws-primary); }
.isi-panduan .awas::before { content: "Perhatian: "; font-weight: 600; color: #dc3545; }
.isi-panduan .tbl { display: inline-block; padding: 0 .4rem; border: 1px solid var(--ws-border, #dee2e6); border-radius: .3rem; font-size: .85em; font-weight: 500; white-space: nowrap; }
.isi-panduan dl dt { font-weight: 600; }
.isi-panduan dl dd { margin-bottom: .5rem; }
