*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--primary);
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.brand-icon { font-size: 1.5rem; }

.nav-links {
    list-style: none;
    display: flex;
    gap: .25rem;
}

.nav-links a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: background .2s, color .2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: .95rem;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.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: var(--info); }

.stat-label {
    font-size: .85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: .25rem;
}

/* Schedule info */
.schedule-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.schedule-item {
    display: flex;
    flex-direction: column;
}

.schedule-item .label {
    font-size: .75rem;
    opacity: .8;
    text-transform: uppercase;
}

.schedule-item .time {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

thead th {
    background: #f8fafc;
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #cffafe; color: #155e75; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: none;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #15803d; }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #b91c1c; }

.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #b45309; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: #f8fafc; }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.form-group label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    padding: .6rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    transition: border-color .2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1rem;
}

/* Alerts */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Attendance action buttons */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
}

.att-btn {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all .2s;
}

.att-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: #eff6ff;
}

.att-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.att-btn.done {
    border-color: var(--success);
    background: #f0fdf4;
}

.att-btn .att-icon { font-size: 1.5rem; }
.att-btn .att-label { font-size: .8rem; font-weight: 600; margin-top: .25rem; }
.att-btn .att-time  { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }

/* Search bar */
.search-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-bar .form-control { flex: 1; min-width: 200px; }

/* Clock display */
.live-clock {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    padding: 1rem;
}

.live-date {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: .8rem;
    border-top: 1px solid var(--border);
    background: var(--card);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: .75rem 1rem;
        gap: .5rem;
    }

    .nav-links { flex-wrap: wrap; justify-content: center; }

    .page-header { flex-direction: column; align-items: flex-start; }
}
