/* ============================================================
   InduPilot - Design System
   Colors: Primary #0066FF, Deep Blue #0B1F3A, Light Blue #E8F1FF
   ============================================================ */

:root {
    --primary: #0066FF;
    --primary-hover: #0052CC;
    --primary-light: #E8F1FF;
    --primary-dark: #004DB3;
    --deep-blue: #0B1F3A;
    --deep-blue-light: #132D52;
    --white: #FFFFFF;
    --gray-50: #F8F9FB;
    --gray-100: #F1F3F5;
    --gray-200: #E9ECEF;
    --gray-300: #DEE2E6;
    --gray-400: #CED4DA;
    --gray-500: #ADB5BD;
    --gray-600: #6C757D;
    --gray-700: #495057;
    --gray-800: #343A40;
    --gray-900: #212529;
    --green: #28A745;
    --orange: #FD7E14;
    --red: #DC3545;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.03);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.2s ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body { background: var(--gray-50); }

.login-page { display: flex; min-height: 100vh; }

/* ---- Left panel: video background ---- */
.login-left {
    flex: 0 0 45%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow: hidden;
}

.login-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
}

.login-left-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(11,31,58,.82) 0%, rgba(0,77,179,.72) 100%);
    z-index: 1;
}

.login-brand {
    text-align: center;
    position: relative;
    z-index: 2;
    margin-bottom: 3rem;
}

.login-logo-img {
    width: 500px;
    height: 500px;
    object-fit: contain;
    margin: 0 auto 1.25rem;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.25));
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,.6);
    font-weight: 400;
}

.login-features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 320px;
    width: 100%;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: rgba(255,255,255,.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,.1);
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.login-feature:hover {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.18);
}

.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(0,102,255,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.login-feature strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
}

.login-feature span {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,.55);
}

/* ---- Right panel: form ---- */
.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--white);
}

.login-form-container {
    width: 100%;
    max-width: 400px;
    animation: fadeInUp .5s ease;
}

.login-form-header {
    margin-bottom: 2rem;
    text-align: center;
}

.login-logo-right {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto 1rem;
    display: block;
}

.login-form-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    letter-spacing: -0.3px;
}

.login-form-header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* Alert */
.login-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    animation: slideDown .3s ease;
}

.login-alert-error {
    background: #FEF2F2;
    color: var(--red);
    border: 1px solid #FECACA;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Form fields */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.login-input-wrap { position: relative; }

.login-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: color .2s;
}

.login-input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

.login-input::placeholder { color: var(--gray-400); }

.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,255,.1);
}

.login-input-wrap:focus-within .login-input-icon { color: var(--primary); }

/* Button */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1.5rem;
    margin-top: 0.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.login-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 50%);
    pointer-events: none;
}

.login-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,102,255,.35);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Footer */
.login-footer { margin-top: 2.5rem; text-align: center; }
.login-footer p { font-size: 0.8rem; color: var(--gray-400); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-body { background: var(--gray-50); padding-top: 56px; }

/* Navbar */
.navbar {
    background: var(--deep-blue) !important;
    height: 56px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    z-index: 1030;
    padding: 0 0.75rem;
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--white) !important;
    padding: 0;
}

.navbar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,.8);
    font-weight: 500;
}

.navbar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0,102,255,.35);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.btn-logout {
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    color: rgba(255,255,255,.8) !important;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(255,255,255,.15) !important;
    color: var(--white) !important;
}

.navbar-user-name {
    font-size: 0.85rem;
    color: rgba(255,255,255,.85);
    font-weight: 500;
}

.btn-nav-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.8);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    padding: 0;
    transition: var(--transition);
}
.btn-nav-icon:hover {
    background: rgba(255,255,255,.15);
    color: var(--white);
}

/* Footer */
.app-footer {
    padding: 0.75rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.78rem;
    color: var(--gray-500);
}
.footer-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--gray-600);
}
.footer-copy {
    color: var(--gray-400);
}

/* Main content */
.app-main { min-height: calc(100vh - 56px); margin-left: 260px; transition: margin-left .25s ease; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: 260px;
    height: calc(100vh - 56px);
    background: var(--deep-blue);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    transition: width .25s ease, transform .25s ease;
    border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    height: 100%;
}

.sidebar-section { padding: 0.25rem 0; }

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 0.375rem 1rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.sidebar-nav-item:hover {
    color: var(--white);
    background: rgba(255,255,255,.06);
}

.sidebar-nav-item.active {
    color: var(--white);
    background: rgba(0,102,255,.15);
}

.sidebar-nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35rem;
    bottom: 0.35rem;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.875rem;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,.4);
    font-weight: 600;
}

.sidebar-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform .2s ease;
}

.sidebar-section.open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 1.5rem;
}

.sidebar-section.open .sidebar-submenu {
    display: block;
}

.sidebar-subitem {
    padding: 0.45rem 1.25rem;
    font-size: 0.825rem;
}

.sidebar-icon-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.8rem;
}

/* Sidebar toggle button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,.08);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.8);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,.15);
    color: var(--white);
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1015;
    opacity: 0;
    transition: opacity .25s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar collapsed state */
body.sidebar-collapsed .sidebar {
    width: 60px;
}

body.sidebar-collapsed .sidebar .sidebar-label,
body.sidebar-collapsed .sidebar .sidebar-chevron {
    display: none;
}

body.sidebar-collapsed .sidebar-heading .sidebar-label,
body.sidebar-collapsed .sidebar-heading .sidebar-chevron {
    display: none;
}

body.sidebar-collapsed .sidebar-heading {
    display: flex;
    justify-content: center;
    padding: 0.6rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    color: rgba(255,255,255,.65);
    font-size: 0.875rem;
    width: 100%;
    text-align: left;
}

body.sidebar-collapsed .sidebar-heading:hover {
    color: var(--white);
    background: rgba(255,255,255,.06);
}

body.sidebar-collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 0.6rem;
}

body.sidebar-collapsed .sidebar-submenu {
    display: none !important;
}

body.sidebar-collapsed .sidebar-section:hover .sidebar-submenu {
    display: block !important;
    position: absolute;
    left: 60px;
    top: 0;
    width: 200px;
    background: var(--deep-blue);
    border-radius: 0 6px 6px 0;
    box-shadow: 4px 0 12px rgba(0,0,0,.3);
    z-index: 1100;
    padding: 0.5rem 0;
    border-left: 1px solid rgba(255,255,255,.1);
}

body.sidebar-collapsed .sidebar-section:hover .sidebar-submenu .sidebar-subitem {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    justify-content: flex-start;
}

body.sidebar-collapsed .sidebar-section:hover .sidebar-submenu .sidebar-subitem .sidebar-icon-sm {
    width: 18px;
    height: 18px;
}

body.sidebar-collapsed .sidebar-section {
    position: relative;
}

body.sidebar-collapsed .sidebar-divider { margin: 0.375rem 0.5rem; }

body.sidebar-collapsed .app-main {
    margin-left: 60px;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ============================================================
   Bootstrap overrides
   ============================================================ */
.btn-primary { background: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }

.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.alert { border-radius: var(--radius-md); font-size: .9rem; font-weight: 500; border: none; }
.alert-success { background: #F0FFF4; color: #22543D; }
.alert-danger { background: #FEF2F2; color: #991B1B; }

.table { border-radius: var(--radius-md); overflow: hidden; }

/* ============================================================
   USER MANAGEMENT
   ============================================================ */
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.3px; }

.user-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.user-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.status-dot.active { background: var(--green); }
.status-dot.inactive { background: var(--gray-400); }

.badge { font-weight: 500; font-size: 0.75rem; }
.bg-primary-subtle { background: var(--primary-light) !important; }
.text-primary { color: var(--primary) !important; }

.form-label { font-size: 0.85rem; font-weight: 600; color: var(--gray-700); }
.form-control { border-radius: var(--radius-md); font-size: 0.9rem; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,255,.1); }

.table th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
    background: var(--gray-50);
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.table-hover tbody tr:hover { background: var(--gray-50); }

.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.65rem; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: var(--white); }

.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
.btn-loading::after { content: ""; position: absolute; width: 14px; height: 14px; top: 50%; left: 50%; margin: -7px 0 0 -7px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DESIGN SYSTEM - Components
   ============================================================ */

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.page-header h1, .page-title { margin-bottom: 0; }
.page-header .page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.page-subtitle { font-size: 0.9rem; color: var(--gray-500); font-weight: 400; margin-top: 0.15rem; }

/* --- Section Header (inside cards) --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}
.section-header h6 { margin: 0; font-weight: 600; font-size: 0.9rem; color: var(--gray-800); }
.section-header .section-actions { display: flex; gap: 0.5rem; }

/* --- KPI Card --- */
.kpi-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}
.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: inherit;
    text-decoration: none;
}
.kpi-card .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.kpi-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}
.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}
.kpi-card .kpi-trend {
    font-size: 0.75rem;
    font-weight: 600;
}
.kpi-card .kpi-trend.up { color: var(--green); }
.kpi-card .kpi-trend.down { color: var(--red); }

/* KPI icon color variants */
.kpi-icon.primary { background: var(--primary-light); color: var(--primary); }
.kpi-icon.success { background: #F0FFF4; color: var(--green); }
.kpi-icon.warning { background: #FFFBEB; color: #D97706; }
.kpi-icon.danger { background: #FEF2F2; color: var(--red); }
.kpi-icon.info { background: #ECFEFF; color: #0891B2; }
.kpi-icon.purple { background: #F5F3FF; color: #7C3AED; }
.kpi-icon.gray { background: var(--gray-100); color: var(--gray-600); }

/* --- Quick Action Card --- */
.action-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: var(--transition);
    display: block;
}
.action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}
.action-card .action-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.action-card .action-label { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); }
.action-card .action-desc { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.15rem; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state h5 { color: var(--gray-600); font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.empty-state p { font-size: 0.85rem; color: var(--gray-500); max-width: 360px; margin: 0 auto; }

/* --- Alert Card (for dashboard warnings) --- */
.alert-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.alert-card:hover { text-decoration: none; }
.alert-card .alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}
.alert-card .alert-value { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.alert-card .alert-text { font-size: 0.78rem; opacity: 0.8; }
.alert-card.danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-card.danger .alert-icon { background: #DC3545; color: #fff; }
.alert-card.warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-card.warning .alert-icon { background: #F59E0B; color: #fff; }
.alert-card.info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #BFDBFE; }
.alert-card.info .alert-icon { background: var(--primary); color: #fff; }

/* --- Progress Bar --- */
.progress { height: 6px; border-radius: 3px; background: var(--gray-200); overflow: hidden; }
.progress-bar { background: var(--primary); border-radius: 3px; transition: width .4s ease; }
.progress-bar.success { background: var(--green); }
.progress-bar.warning { background: var(--orange); }
.progress-bar.danger { background: var(--red); }

/* --- Data List --- */
.data-list { list-style: none; padding: 0; margin: 0; }
.data-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}
.data-list li:last-child { border-bottom: none; }
.data-list .list-label { color: var(--gray-500); font-weight: 500; }
.data-list .list-value { color: var(--gray-800); font-weight: 600; }

/* --- Workflow Step --- */
.workflow-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.5rem 0;
    overflow-x: auto;
}
.workflow-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--gray-400);
    background: var(--gray-50);
}
.workflow-step.active { background: var(--primary-light); color: var(--primary); }
.workflow-step.done { background: #F0FFF4; color: var(--green); }
.workflow-step .step-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--gray-300);
}
.workflow-step.active .step-dot { background: var(--primary); }
.workflow-step.done .step-dot { background: var(--green); }
.workflow-step + .workflow-step::before {
    content: "";
    width: 20px;
    height: 2px;
    background: var(--gray-200);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* ============================================================
   PHASE 4 — COMPONENTS
   ============================================================ */

/* --- Buttons --- */
.btn { font-weight: 500; font-size: 0.875rem; border-radius: var(--radius-sm); padding: 0.5rem 1rem; transition: var(--transition); display: inline-flex; align-items: center; gap: 0.4rem; line-height: 1.4; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.95rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--white); }
.btn-secondary { background: var(--gray-100); border-color: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }
.btn-outline-secondary { background: transparent; border-color: var(--gray-300); color: var(--gray-600); }
.btn-outline-secondary:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-success { background: var(--green); border-color: var(--green); color: var(--white); }
.btn-success:hover { background: #218838; border-color: #218838; color: var(--white); }
.btn-danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-danger:hover { background: #c82333; border-color: #c82333; color: var(--white); }
.btn-warning { background: var(--orange); border-color: var(--orange); color: var(--white); }
.btn-warning:hover { background: #e0a800; border-color: #e0a800; color: var(--white); }
.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: var(--white); }
.btn-outline-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-outline-danger:hover { background: var(--red); color: var(--white); }
.btn-outline-success { background: transparent; border-color: var(--green); color: var(--green); }
.btn-outline-success:hover { background: var(--green); color: var(--white); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* --- Tables --- */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.data-table thead th { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); color: var(--gray-600); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 0.75rem 1rem; white-space: nowrap; }
.data-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 0.35rem; justify-content: flex-end; }

/* --- Badges --- */
.badge-status { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1; }
.badge-status.success { background: #D4EDDA; color: #155724; }
.badge-status.warning { background: #FFF3CD; color: #856404; }
.badge-status.danger  { background: #F8D7DA; color: #721C24; }
.badge-status.info    { background: #D1ECF1; color: #0C5460; }
.badge-status.purple  { background: #E8DAEF; color: #6C3483; }
.badge-status.muted   { background: var(--gray-100); color: var(--gray-600); }
.badge-status.primary { background: var(--primary-light); color: var(--primary); }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: var(--gray-200); color: var(--gray-600); }

/* --- Forms --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.4rem; }
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control, .form-select { border-radius: var(--radius-sm); border: 1px solid var(--gray-300); padding: 0.55rem 0.85rem; font-size: 0.875rem; color: var(--gray-800); transition: var(--transition); background: var(--white); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,255,.12); }
.form-control:disabled, .form-select:disabled { background: var(--gray-50); opacity: 0.7; }
.form-text { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.25rem; }
.form-row { display: grid; gap: 1rem; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* --- Alerts --- */
.alert { border-radius: var(--radius-md); padding: 0.85rem 1.15rem; font-size: 0.875rem; border: none; display: flex; align-items: flex-start; gap: 0.65rem; }
.alert-success { background: #D4EDDA; color: #155724; }
.alert-danger  { background: #F8D7DA; color: #721C24; }
.alert-warning { background: #FFF3CD; color: #856404; }
.alert-info    { background: #D1ECF1; color: #0C5460; }

/* --- Cards --- */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-body { padding: 1.25rem; }

/* --- Tabs --- */
.nav-tabs-custom { border-bottom: 2px solid var(--gray-200); gap: 0; }
.nav-tabs-custom .nav-link { border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--gray-500); font-weight: 500; font-size: 0.875rem; padding: 0.65rem 1.15rem; transition: var(--transition); }
.nav-tabs-custom .nav-link:hover { color: var(--gray-700); border-bottom-color: var(--gray-300); }
.nav-tabs-custom .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }

/* --- Modals --- */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); }
.modal-header { border-bottom: 1px solid var(--gray-100); padding: 1.15rem 1.5rem; }
.modal-title { font-weight: 600; font-size: 1.05rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--gray-100); padding: 1rem 1.5rem; }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-500); }
.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--gray-300); }
.empty-state p { font-size: 0.9rem; margin: 0.25rem 0; }
.empty-state .btn { margin-top: 0.75rem; }

/* --- Dropdown --- */
.dropdown-menu { border: 1px solid var(--gray-200); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 0.35rem; min-width: 180px; }
.dropdown-item { border-radius: var(--radius-sm); padding: 0.5rem 0.85rem; font-size: 0.875rem; color: var(--gray-700); transition: var(--transition); }
.dropdown-item:hover { background: var(--gray-100); color: var(--gray-900); }
.dropdown-item i { width: 18px; text-align: center; margin-right: 0.35rem; color: var(--gray-500); }

/* --- Progress --- */
.progress-custom { height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.progress-custom .bar { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.progress-custom .bar-primary { background: var(--primary); }
.progress-custom .bar-success { background: var(--green); }
.progress-custom .bar-warning { background: var(--orange); }
.progress-custom .bar-danger  { background: var(--red); }

/* --- Utilities --- */
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }

/* --- Print styles --- */
@media print {
    .sidebar, .navbar, .sidebar-toggle, .sidebar-overlay { display: none !important; }
    .app-main { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid var(--gray-300); }
    .btn { display: none !important; }
}

/* ============================================================
   Responsive
   ============================================================ */

/* --- 1200px: Small desktops --- */
@media (max-width: 1200px) {
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- 992px: Tablets --- */
@media (max-width: 992px) {
    .login-left { display: none; }
    .login-right {
        flex: 1;
        background: linear-gradient(135deg, var(--deep-blue) 0%, #0D2847 100%);
    }
    .login-form-container {
        background: var(--white);
        border-radius: var(--radius-xl);
        padding: 2.5rem 2rem;
        box-shadow: var(--shadow-xl);
    }
    .login-form-header h2,
    .login-form-header p { text-align: center; }
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0 !important;
    }
    body.sidebar-collapsed .app-main {
        margin-left: 0 !important;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .page-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .data-table { font-size: 0.8rem; }
    .data-table thead th,
    .data-table tbody td { padding: 0.6rem 0.75rem; }
}

/* --- 768px: Small tablets / large phones --- */
@media (max-width: 768px) {
    html { font-size: 14px; }
    .container-fluid { padding-left: 1rem !important; padding-right: 1rem !important; }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-title { font-size: 1.25rem; }
    .page-actions {
        width: 100%;
        flex-direction: column;
    }
    .page-actions .btn { width: 100%; justify-content: center; }
    .form-row-2,
    .form-row-3 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: 1fr; }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-tabs-custom {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tabs-custom .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
    }
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .table-actions {
        flex-wrap: nowrap;
    }
    .btn { padding: 0.45rem 0.85rem; font-size: 0.8rem; }
    .btn-lg { padding: 0.55rem 1.15rem; font-size: 0.85rem; }
    .card-body { padding: 1rem; }
    .modal-body { padding: 1.15rem; }
    .modal-header { padding: 1rem 1.15rem; }
    .modal-footer { padding: 0.85rem 1.15rem; }
    .empty-state { padding: 2rem 1rem; }
    .empty-state i { font-size: 2rem; }
    .app-footer .d-flex { flex-direction: column; gap: 0.25rem; text-align: center; }
}

/* --- 576px: Phones --- */
@media (max-width: 576px) {
    .login-right { padding: 1rem; }
    .login-form-container { padding: 2rem 1.25rem; }
    .login-form-header h2 { font-size: 1.5rem; }
    html { font-size: 13px; }
    .container-fluid { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .page-title { font-size: 1.1rem; }
    .page-subtitle { font-size: 0.75rem; }
    .page-actions .btn { font-size: 0.75rem; padding: 0.4rem 0.7rem; }
    .badge-status { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
    .data-table { font-size: 0.75rem; }
    .data-table thead th { font-size: 0.7rem; padding: 0.5rem 0.6rem; }
    .data-table tbody td { padding: 0.5rem 0.6rem; }
    .card-body { padding: 0.85rem; }
    .section-header { padding: 0.7rem 0.85rem; }
    .section-header h5, .section-header h6 { font-size: 0.85rem; }
    .navbar-brand span { display: none !important; }
    .navbar-user-name { display: none !important; }
    .btn-logout span { display: none !important; }
}
