/* ============================================
   SISTEM MONITORING SKRIPSI - STYLESHEET
   ============================================ */

:root {
    --primary-color: #1b3a5c;
    --primary-light: #27548a;
    --primary-dark: #0f2440;
    --secondary-color: #e8a020;
    --success-color: #2e7d32;
    --danger-color: #c62828;
    --warning-color: #f57f17;
    --info-color: #0277bd;
    --light-color: #f5f5f5;
    --body-bg: #eef1f5;
    --card-bg: #ffffff;
    --text-color: #2b2b2b;
    --text-muted: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--body-bg);
    color: var(--text-color);
    line-height: 1.55;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { text-decoration: none; color: inherit; }

/* ============ LOGIN ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    display: flex;
}

.login-left {
    flex: 1;
    padding: 40px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.login-logo {
    width: 110px; height: 110px;
    background: #fff;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 44px;
    margin-bottom: 20px;
}

.login-left h1 { font-size: 24px; margin-bottom: 8px; letter-spacing: 1px; }
.login-left p { opacity: .9; font-size: 14px; }
.login-right { flex: 1.2; padding: 40px; }
.login-form h2 { color: var(--primary-color); margin-bottom: 24px; font-size: 21px; }
.login-demo {
    margin-top: 26px;
    background: var(--light-color);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
}

/* ============ LAYOUT ============ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 250px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    overflow-y: auto;
    z-index: 60;
    transition: transform .25s ease;
    -webkit-overflow-scrolling: touch;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 55;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.btn-menu {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-menu:active { background: var(--light-color); }

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-header .logo {
    width: 60px; height: 60px;
    margin: 0 auto 10px;
    background: rgba(255, 255, 255, .15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
}

.sidebar-header h3 { font-size: 15px; letter-spacing: 1px; }
.sidebar-header p { font-size: 11.5px; opacity: .75; margin-top: 3px; }

.sidebar-menu ul { list-style: none; padding: 12px 0 30px; }
.sidebar-menu li.menu-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: .55;
    padding: 16px 20px 6px;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, .85);
    border-left: 3px solid transparent;
    transition: .2s;
}
.sidebar-menu li a i { width: 18px; text-align: center; }
.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, .12);
    border-left-color: var(--secondary-color);
    color: #fff;
}

.main-content { margin-left: 250px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 14px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar h4 { font-size: 17px; color: var(--primary-color); }
.topbar-sub { font-size: 12.5px; color: var(--text-muted); }
.user-info { display: flex; align-items: center; gap: 16px; }
.user-link { display: flex; align-items: center; gap: 10px; }
.user-link strong { display: block; font-size: 13.5px; }
.user-link small { font-size: 11.5px; color: var(--text-muted); }
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar.has-foto { background: #e3eaf2; }
.avatar-xl {
    width: 84px; height: 84px;
    font-size: 34px;
    box-shadow: var(--shadow);
}
.profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
    flex-wrap: wrap;
}
.profile-name {
    display: block;
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 2px;
}
.foto-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
}
.foto-preview {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.periode {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--light-color);
}
.periode-pagi { background: #e8f5e9; color: var(--success-color); }
.periode-malam { background: #fff8e1; color: var(--warning-color); }

.content { padding: 24px 26px; flex: 1; }

.footer {
    padding: 14px 26px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* ============ CARDS & STATS ============ */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 15.5px;
    color: var(--primary-color);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--secondary-color); }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}
.stat-icon.bg-primary { background: var(--primary-color); }
.stat-icon.bg-success { background: var(--success-color); }
.stat-icon.bg-warning { background: var(--warning-color); }
.stat-icon.bg-danger { background: var(--danger-color); }
.stat-icon.bg-info { background: var(--info-color); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-color); line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }

/* ============ TABLE ============ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding-bottom: 4px;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c5cdd4; border-radius: 999px; }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.table th,
table.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}
table.table th {
    background: var(--light-color);
    color: var(--primary-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}
table.table tr:hover td { background: #fafbfd; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ FORM ============ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}
.form-group label i { color: var(--primary-light); width: 16px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    background: #fff;
    transition: border .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(39, 84, 138, .12);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    background: var(--primary-color);
    color: #fff;
    transition: .2s;
}
.btn:hover { background: var(--primary-light); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-success { background: var(--success-color); }
.btn-success:hover { background: #1b5e20; }
.btn-danger { background: var(--danger-color); }
.btn-danger:hover { background: #8e0000; }
.btn-warning { background: var(--warning-color); color: #fff; }
.btn-warning:hover { background: #c58a00; }
.btn-secondary { background: #607d8b; }
.btn-secondary:hover { background: #455a64; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover { background: var(--primary-color); color: #fff; }

/* ============ BADGE ============ */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #e8f5e9; color: var(--success-color); }
.badge-warning { background: #fff8e1; color: var(--warning-color); }
.badge-danger { background: #ffebee; color: var(--danger-color); }
.badge-info { background: #e1f5fe; color: var(--info-color); }
.badge-secondary { background: #eceff1; color: #546e7a; }
.badge-primary { background: #e3f0fb; color: var(--primary-color); }

/* ============ ALERT ============ */
.alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #e8f5e9; color: var(--success-color); border: 1px solid #c8e6c9; }
.alert-danger { background: #ffebee; color: var(--danger-color); border: 1px solid #ffcdd2; }
.alert-warning { background: #fff8e1; color: #8d6e00; border: 1px solid #ffecb3; }
.alert-info { background: #e1f5fe; color: var(--info-color); border: 1px solid #b3e5fc; }

/* ============ PROGRESS ============ */
.progress {
    height: 12px;
    background: #eceff1;
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
}
.progress-bar {
    height: 100%;
    border-radius: 999px;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: width .4s;
    min-width: 28px;
}
.bar-success { background: var(--success-color); }
.bar-info { background: var(--info-color); }
.bar-warning { background: var(--warning-color); }
.bar-muted { background: #90a4ae; }
.progress-lg { height: 18px; }

/* ============ MISC ============ */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.section-head h5 { font-size: 16px; color: var(--primary-color); }
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}
.empty-state i { font-size: 42px; color: #cfd8dc; margin-bottom: 12px; display: block; }
.detail-list { list-style: none; }
.detail-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 10px;
    font-size: 13.5px;
}
.detail-list li span.k { color: var(--text-muted); font-weight: 600; }
.file-link {
    color: var(--info-color);
    font-weight: 600;
}
.catatan-box {
    background: #fff8e1;
    border-left: 4px solid var(--warning-color);
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    margin-top: 10px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.search-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13.5px;
}
.card-acuan {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: .2s;
}
.card-acuan:hover { border-color: var(--primary-light); background: #eef5fc; }
.card-acuan strong { color: var(--primary-color); font-size: 13.5px; display: block; }
.card-acuan small { color: var(--text-muted); font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.modul-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.modul-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    background: #fafbfd;
}
.modul-card h6 {
    font-size: 13.5px;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.actions-gap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions-gap .btn { flex: 0 1 auto; }

/* filter chips (admin) */
.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    max-width: 100%;
}
.filter-chips .btn { flex-shrink: 0; }

/* ============ MODAL PREVIEW FILE ============ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 35, .62);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none !important; }

.modal-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    width: 100%;
    max-width: 860px;
    max-height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-color);
}
.modal-header h6 {
    font-size: 14px;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.modal-header h6 span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.modal-close:hover { background: #ffebee; color: var(--danger-color); }

.modal-body {
    padding: 14px;
    overflow: auto;
    flex: 1;
    background: #f7f9fb;
    min-height: 220px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

.file-preview-loading,
.file-preview-fallback {
    text-align: center;
    padding: 36px 16px;
    color: var(--text-muted);
}
.file-preview-fallback i {
    font-size: 52px;
    display: block;
    margin-bottom: 12px;
    color: #90a4ae;
}
.file-preview-fallback .file-ext {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--light-color);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--primary-color);
}

.preview-img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 180px);
    margin: 0 auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
}

.preview-pdf {
    width: 100%;
    height: min(70vh, 720px);
    border: 0;
    border-radius: 10px;
    background: #fff;
}

.preview-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    max-height: min(70vh, 720px);
    overflow: auto;
}

.file-preview-link { cursor: pointer; }
.file-preview-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .modal-backdrop { padding: 8px; align-items: flex-end; }
    .modal-dialog {
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
        max-width: 100%;
    }
    .modal-body { padding: 10px; }
    .modal-footer { padding: 10px 12px; }
    .preview-pdf { height: 60vh; }
    .modal-header h6 { font-size: 13px; }
}

/* ============ RESPONSIVE ============ */

/* --- Tablet & HP (drawer sidebar) --- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-105%);
        width: min(86vw, 300px);
        box-shadow: 8px 0 28px rgba(0, 0, 0, .25);
        will-change: transform;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-overlay[hidden] { display: none !important; }
    body.sidebar-open { overflow: hidden; touch-action: none; }
    .sidebar-overlay {
        display: block;
        -webkit-backdrop-filter: blur(1px);
        backdrop-filter: blur(1px);
    }

    /* menu sidebar lebih lega untuk sentuhan */
    .sidebar-menu li a { padding: 13px 18px; font-size: 14.5px; min-height: 46px; }
    .sidebar-menu li.menu-title { padding-top: 18px; }

    .btn-menu { display: inline-flex; }
    .main-content { margin-left: 0; max-width: 100vw; }

    .content {
        padding: 16px 14px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
    .topbar {
        padding: 12px 14px;
        gap: 10px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
    .topbar h4 {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40vw;
    }
    .topbar-sub { font-size: 11.5px; }
    .footer {
        padding: 12px 14px;
        font-size: 11.5px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        word-break: break-word;
    }

    /* Login mobile */
    .login-page {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        align-items: flex-start;
        min-height: 100dvh;
    }
    .login-container {
        flex-direction: column;
        max-width: 440px;
        margin: auto;
    }
    .login-left { padding: 26px 18px; }
    .login-left .login-logo { width: 72px; height: 72px; font-size: 30px; margin-bottom: 12px; }
    .login-left h1 { font-size: 18px; }
    .login-right { padding: 24px 18px; }
    .login-form h2 { font-size: 17px; margin-bottom: 18px; }

    /* Grid tumpuk */
    .form-row, .grid-2 { grid-template-columns: 1fr; }
    .detail-list li { grid-template-columns: 1fr; gap: 2px; padding: 10px 0; }
    .modul-grid { grid-template-columns: 1fr; }

    /* Stat cards */
    .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-card { padding: 14px 12px; gap: 10px; min-width: 0; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }
    .stat-value { font-size: 18px; word-break: break-word; }
    .stat-label { font-size: 11px; line-height: 1.35; }

    /* Topbar user */
    .user-info { gap: 8px; min-width: 0; }
    .user-text strong {
        max-width: 28vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 13px;
    }
    .user-text small { display: none; }
    .periode-text { display: none; }
    .periode { padding: 7px 8px; font-size: 11px; line-height: 1; }

    .card { padding: 14px 12px; border-radius: 10px; }
    .section-head { gap: 10px; }
    .section-head h5 { font-size: 14.5px; }
    .section-head .actions-gap { width: 100%; margin-top: 0; }
    .section-head .actions-gap .btn { flex: 1 1 auto; }

    /* Tabel: scroll horizontal + aksi ringkas */
    table.table { font-size: 12.5px; min-width: 620px; }
    table.table th, table.table td { padding: 8px 9px; }
    table.table th { font-size: 11px; }
    .table-actions { gap: 5px; }
    .table-actions .btn { min-width: 34px; min-height: 34px; padding: 6px 8px; justify-content: center; }
    .table-actions form { display: inline; }

    /* Form mobile: cegah zoom iOS + target sentuh */
    .form-group { margin-bottom: 13px; }
    .form-group label { font-size: 12.5px; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* wajib >=16px di iOS agar tidak auto-zoom */
        padding: 12px 12px;
        min-height: 44px;
        border-radius: 10px;
    }
    .form-group textarea { min-height: 96px; }
    .search-bar input,
    .search-bar select {
        font-size: 16px;
        padding: 12px;
        min-height: 44px;
        border-radius: 10px;
        width: 100%;
        flex: 1 1 100%;
        min-width: 0;
    }
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-bar .btn { width: 100%; justify-content: center; min-height: 44px; }

    /* Tombol */
    .btn {
        min-height: 42px;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 14px;
        justify-content: center;
    }
    .btn-sm { min-height: 38px; padding: 8px 12px; font-size: 12.5px; border-radius: 8px; }
    .actions-gap { gap: 8px; }
    .actions-gap .btn { flex: 1 1 140px; }

    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline .form-group { min-width: 0; width: 100%; flex: none; }
    .form-inline .btn { width: 100%; }

    .filter-chips { flex-wrap: nowrap; }
    .filter-chips .btn { flex: 0 0 auto; min-height: 38px; }

    .alert { align-items: flex-start; line-height: 1.45; }
    .alert i { margin-top: 2px; }

    .profile-hero { gap: 12px; }
    .profile-name { font-size: 16px; }
    .avatar-xl { width: 72px; height: 72px; font-size: 28px; }

    /* progress bar lebih tebal & terbaca */
    .progress { height: 14px; min-width: 64px; }
    .progress-bar { font-size: 10px; }
    .progress-lg { height: 20px; }

    /* modul card */
    .modul-card { padding: 12px; }
    .modul-card h6 { flex-wrap: wrap; font-size: 13px; }
    .modul-card form { width: 100%; }
    .modul-card .form-group input,
    .modul-card .form-group textarea { width: 100%; }
}

/* --- Mobile kecil (<=480px) --- */
@media (max-width: 480px) {
    .content { padding: 12px 10px; }
    .topbar { padding: 10px 10px; }
    .topbar h4 { font-size: 13.5px; max-width: 34vw; }
    .topbar-sub { display: none; } /* hemat tinggi topbar */
    .avatar { width: 34px; height: 34px; font-size: 14px; }
    .user-text strong { max-width: 30vw; font-size: 12.5px; }
    .btn-menu { width: 40px; height: 40px; font-size: 16px; }

    .grid-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { flex-direction: row; align-items: center; padding: 12px 10px; }
    .stat-icon { width: 36px; height: 36px; font-size: 15px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 10.5px; }

    /* Login: fokus form, sembunyikan panel branding */
    .login-page { padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); }
    .login-container { border-radius: 14px; max-width: 100%; }
    .login-left { display: none; }
    .login-right { padding: 22px 16px; }
    .login-demo { font-size: 11.5px; margin-top: 18px; }

    .card { padding: 12px 10px; }
    .card-title { font-size: 13.5px; margin-bottom: 12px; }
    .section-head h5 { font-size: 13.5px; }

    table.table { min-width: 540px; font-size: 12px; }
    .alert { font-size: 12.5px; padding: 10px 11px; }

    .detail-list li { font-size: 12.5px; }
    .detail-list li span.k { font-size: 11.5px; }
    .form-hint { font-size: 11px; }
    .empty-state { padding: 28px 12px; }
    .empty-state i { font-size: 34px; }

    .foto-preview { width: 80px; height: 80px; }
    .card-acuan { padding: 10px; }
    .card-acuan strong { font-size: 12.5px; }
}

/* --- Sangat sempit (<=360px) --- */
@media (max-width: 360px) {
    .grid-stats { grid-template-columns: 1fr; }
    .stat-card { flex-direction: row; }
    .btn-menu { width: 38px; height: 38px; }
    .topbar h4 { max-width: 28vw; }
    table.table { min-width: 480px; }
}

/* --- Landscape HP: rapikan topbar & hindari 100vh bug --- */
@media (max-height: 500px) and (max-width: 900px) {
    .login-page { align-items: flex-start; min-height: auto; }
    .login-left { display: none; }
    .sidebar-header { padding: 14px 16px; }
    .sidebar-header .logo { width: 44px; height: 44px; font-size: 20px; margin-bottom: 6px; }
    .sidebar-menu li a { padding: 10px 16px; min-height: 40px; }
}

/* --- Desktop: sidebar selalu terbuka --- */
@media (min-width: 901px) {
    .sidebar { transform: none !important; }
    .sidebar-overlay { display: none !important; }
    .btn-menu { display: none !important; }
    body.sidebar-open { overflow: visible; touch-action: auto; }
    .main-content { max-width: none; }
}

/* --- Aksesibilitas --- */
@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
    * { scroll-behavior: auto !important; transition: none !important; }
}

/* Force dark-mode friendly inputs (opsional, hindari teks kuning di Android) */
@media (prefers-color-scheme: dark) {
    .form-group input,
    .form-group select,
    .form-group textarea,
    .search-bar input,
    .search-bar select {
        color: var(--text-color);
    }
}
