:root {
    --sidebar-width: 240px;
    --primary: #5b8def;
    --primary-soft: #e8f1ff;
    --primary-soft-2: #d6e6ff;
    --primary-dark: #3d6fd9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #334155;
    --text-muted: #94a3b8;
    --sidebar-bg: #e8f1ff;
    --sidebar-bg-2: #dceaff;
    --card-bg: #ffffff;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    background-color: #eef3f9;
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.45;
}

#wrapper { min-height: 100vh; }

/* ===== Soft Sidebar (sticky top + scrollable nav) ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0; top: 0; z-index: 1000;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    border-right: 1px solid #c5d9f5;
    transition: margin-left 0.25s ease;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
    min-height: 100vh;
}
#page-content-wrapper.expanded { margin-left: 0; }

/* Brand + profil tetap di atas, tidak ikut scroll */
.sidebar-top {
    flex-shrink: 0;
    padding: 0.45rem 0.55rem 0.35rem;
    background: transparent;
    border-bottom: 1px solid #c5d9f5;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.4rem 0.4rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary-dark);
}
.sidebar-brand i { font-size: 1.05rem; color: var(--primary); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #c5d9f5;
    border-radius: 0.85rem;
    padding: 0.4rem 0.5rem;
    margin: 0 0.05rem;
    box-shadow: 0 1px 4px rgba(91, 141, 239, 0.12);
}
.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, #7baaf7, #5b8def);
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-name {
    font-weight: 600;
    font-size: 0.76rem;
    color: #1e293b;
    line-height: 1.2;
}
.sidebar-user-sub {
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.sidebar-user-logout {
    margin-left: auto;
    width: 30px; height: 30px;
    border-radius: 0.55rem;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.sidebar-user-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}
.sidebar-user-logout i { font-size: 0.95rem; }

/* Hanya daftar menu yang scroll */
.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.02rem;
    padding: 0.4rem 0.5rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.nav-section-title {
    font-size: 0.62rem !important;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7b9fd4 !important;
    padding: 0.4rem 0.6rem 0.1rem !important;
    margin: 0.15rem 0 0 !important;
    user-select: none;
}

/* Section yang bisa dilipat (Master Data / Admin) */
.nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}
.nav-section-toggle:hover {
    background: rgba(91, 141, 239, 0.12);
    color: var(--primary-dark) !important;
}
.nav-section-toggle .section-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    color: #94a3b8;
}
.nav-section-toggle.open .section-chevron {
    transform: rotate(180deg);
}

.nav-section-items {
    display: none;
    flex-direction: column;
    gap: 0.02rem;
    padding-left: 0.15rem;
}
.nav-section-items.open {
    display: flex;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    border-radius: 0.6rem;
    padding: 0.32rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}
.sidebar .nav-link i {
    font-size: 0.95rem;
    width: 1.05rem;
    text-align: center;
    color: #94a3b8;
}
.sidebar .nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.sidebar .nav-link:hover i { color: var(--primary); }

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #6b9bf5, #5b8def);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(91, 141, 239, 0.35);
    border-color: transparent;
}
.sidebar .nav-link.active i { color: #fff; }

.sidebar .nav-link-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}
.sidebar .nav-link-logout:hover i { color: #dc2626; }

/* ===== Top bar & content ===== */
.topbar { padding: 0.4rem 0.75rem !important; min-height: 46px; background: #fff !important; }
.topbar-title { font-size: 0.92rem; color: #1e293b; }
.topbar-time { font-size: 0.75rem; }
.btn-soft-toggle {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    border-radius: 0.5rem;
}
.btn-soft-toggle:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-soft-2); }
.badge-soft {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 500;
    font-size: 0.72rem;
    border: 1px solid var(--primary-soft-2);
}
.main-content.container-fluid.p-4,
.container-fluid.p-4 { padding: 0.9rem 1rem !important; }

/* ===== Cards / tables / forms (existing compact look) ===== */
.card {
    border: none;
    border-radius: 0.85rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    margin-bottom: 0.75rem;
    background: var(--card-bg);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid #eef2f7;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 0.9rem;
}
.card-body { padding: 0.8rem 0.9rem; }

.stat-card {
    border-left: 3px solid var(--primary);
    transition: transform 0.15s;
    padding: 0.65rem 0.85rem !important;
}
.stat-card:hover { transform: translateY(-1px); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: #3b82f6; }
.stat-card .fs-3 { font-size: 1.35rem !important; }
.stat-card .small { font-size: 0.72rem; }
.stat-card .rounded-circle { padding: 0.45rem !important; }
.stat-card .fs-4 { font-size: 1rem !important; }

.table { font-size: 0.8125rem; margin-bottom: 0; }
.table th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    background-color: #f8fafc;
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
}
.table td { padding: 0.4rem 0.65rem; vertical-align: middle; }

.badge { font-weight: 500; font-size: 0.7rem; padding: 0.25em 0.5em; }
.btn {
    border-radius: 0.55rem;
    font-weight: 500;
    font-size: 0.8125rem;
    padding: 0.35rem 0.7rem;
}
.btn-sm { font-size: 0.75rem; padding: 0.22rem 0.5rem; }
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.form-label { font-size: 0.72rem; margin-bottom: 0.25rem; font-weight: 500; }
.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: #e2e8f0;
    font-size: 0.8125rem;
    padding: 0.35rem 0.6rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(91, 141, 239, 0.18);
}
.form-control-sm, .form-select-sm { font-size: 0.75rem; padding: 0.25rem 0.5rem; }

.login-page {
    min-height: 100vh;
    background: linear-gradient(145deg, #dbeafe 0%, #eff6ff 40%, #f0f9ff 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    max-width: 380px; width: 100%;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(91, 141, 239, 0.15);
    font-size: 0.875rem;
    border: 1px solid #e2e8f0;
}
.login-card h4 { font-size: 1.15rem; }

.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: ''; position: absolute; left: 0.4rem; top: 0; bottom: 0;
    width: 2px; background: #e2e8f0;
}
.timeline-item { position: relative; margin-bottom: 0.85rem; font-size: 0.8125rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.25rem; top: 0.3rem;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

.img-preview {
    max-width: 120px; max-height: 80px; object-fit: cover;
    border-radius: 0.375rem; border: 1px solid #e2e8f0;
}

.row.g-3 { --bs-gutter-y: 0.65rem; --bs-gutter-x: 0.65rem; }
.alert { font-size: 0.8125rem; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; border-radius: 0.65rem; }
.modal-header, .modal-footer { padding: 0.6rem 0.85rem; }
.modal-body { padding: 0.75rem 0.85rem; }
.modal-title { font-size: 0.95rem; }
.list-group-item { padding: 0.45rem 0.75rem; font-size: 0.8125rem; }
hr { margin: 0.75rem 0; }

@media (max-width: 768px) {
    .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    .sidebar.show { margin-left: 0; box-shadow: 4px 0 24px rgba(15,23,42,0.12); }
    #page-content-wrapper { margin-left: 0; }
}


/* Status mesin select (admin) */
.status-select {
    font-weight: 600;
    border: none;
    color: #fff !important;
}
.status-select option {
    color: #1e293b;
    background: #fff;
    font-weight: 500;
}
.status-sel-aktif { background-color: #198754 !important; }
.status-sel-maintenance { background-color: #ffc107 !important; color: #1e293b !important; }
.status-sel-rusak { background-color: #dc3545 !important; }
.status-sel-non_aktif { background-color: #6c757d !important; }

/* Dashboard notifications */
.notif-panel {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b !important;
}
.notif-bell {
    display: inline-flex;
    line-height: 1;
}
@keyframes notif-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
}
.notif-stat-pulse {
    animation: notif-pulse 1.8s ease-in-out infinite;
}
