/* 1. Reset & Universal Box Sizing */
*, *::before, *::after {
    box-sizing: border-box; /* Prevents elements/buttons from exceeding parent width */
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #e11d48;
    --success: #10b981;
    --warning: #f59e0b;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 2. Responsive Layout & Navbar */
.navbar {
    background: var(--primary);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar a { 
    color: white; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 0.95rem;
}

.container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* 3. Mobile-First Grid System */
.grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to 1 column for mobile */
    gap: 1rem;
    margin: 1rem 0;
}

/* Desktop Grid: Switch to multiple columns above 768px */
@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .navbar {
        padding: 0.75rem 2rem;
    }
}

pre {
    background: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
}
/* 4. Cards */
.card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.card h3 {
    margin-top: 0;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--bg-body);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.badge-info { background: #e0f2fe; color: #0369a1; } /* Blue badge for Asst. Head */
.badge-danger { background: #fee2e2; color: #b91c1c; }


/* 5. Details & Rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.detail-label { 
    font-weight: 600; 
    color: var(--text-muted); 
    padding-right: 10px;
}

/* 6. Mobile-Friendly Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 0.4rem; 
    font-size: 0.85rem; 
}

.form-control {
    width: 100%;
    padding: 0.75rem; /* Larger touch target for mobile */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1); 
}

/* 7. Buttons (Touch Friendly) */
.btn {
    padding: 0.8rem 1.2rem; /* Larger for thumbs */
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: none;
    transition: opacity 0.2s;
    font-size: 0.95rem;
    text-align: center;
}

.btn:active { opacity: 0.7; }

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }

.btn-block { 
    width: 100%; 
    display: block; 
    margin-top: 1rem;
}

/* 8. Charts Responsiveness */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px; /* Fixed height for mobile usability */
    margin-top: 1rem;
}

@media (min-width: 992px) {
    .chart-container {
        height: 350px;
    }
}

/* 9. Tables (Horizontal Scroll for Mobile) */
.table-container {
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow-x: auto; /* Allow swiping left/right on mobile */
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 600px; /* Forces scroll rather than squishing data */
}

th { 
    background: #f1f5f9; 
    padding: 1rem; 
    text-align: left; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    color: var(--text-muted); 
}

td { 
    padding: 1rem; 
    border-bottom: 1px solid var(--border); 
    font-size: 0.9rem;
}

/* 10. QR Codes */
.qr-box { 
    text-align: center; 
    padding: 1rem; 
    border: 2px dashed var(--border); 
    border-radius: 12px;
    background: #f8fafc;
}

.qr-box img { 
    max-width: 140px; 
    height: auto; 
}

/* 11. Alerts */
.alert { 
    padding: 1rem; 
    border-radius: 8px; 
    margin-bottom: 1rem; 
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* 12. Badges */
.badge { 
    padding: 0.25rem 0.6rem; 
    border-radius: 50px; 
    font-size: 0.7rem; 
    font-weight: 700; 
    text-transform: uppercase;
}

/* Navigation Divider (Vertical Line) */
.nav-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 15px;
    display: inline-block;
}

/* Section Marker for Mobile/Sidebars */
.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    margin-right: 10px;
}

/* Responsive adjustment: hide vertical line on small screens and stack menus */
@media (max-width: 768px) {
    .nav-divider {
        width: 100%;
        height: 1px;
        margin: 10px 0;
        display: block;
    }
    .navbar .nav-links {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
}
canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}



.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f1f5f9; color: #475569; }