* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f4f6f9;
    margin: 0;
    color: #2c3e50;
}
.topbar {
    background: #1a6e3c;
    color: #fff;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.brand-block { display: flex; align-items: center; gap: 10px; }
.brand-logo-circle {
    width: 48px; height: 48px; border-radius: 50%; background: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-logo { width: 40px; height: 40px; border-radius: 50%; }
.brand-title { font-size: 20px; font-weight: 700; line-height: 1.1; }
.brand-subtitle { font-size: 13px; opacity: 0.85; }
.topbar a { color: #fff; text-decoration: none; margin-left: 16px; }
.container { padding: 20px; max-width: 1200px; margin: 0 auto; }
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-box { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); text-align: center; }
.stat-box .num { font-size: 28px; font-weight: 700; color: #1a6e3c; }
.stat-box.alert .num { color: #c0392b; }
.stat-box .label { color: #7f8c8d; font-size: 13px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #f7f9fb; color: #555; }
.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.green { background: #d4edda; color: #155724; }
.badge.red { background: #f8d7da; color: #721c24; }
.badge.yellow { background: #fff3cd; color: #856404; }
.badge.orange { background: #ffe0b2; color: #a05a00; }
.badge.gray { background: #e2e3e5; color: #383d41; }
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #1a6e3c;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}
.btn.secondary { background: #6c757d; }
.btn.danger { background: #c0392b; }
.btn.small { padding: 5px 10px; font-size: 12px; }
form.inline { display: inline; }
input, select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
label { font-size: 13px; color: #555; display: block; margin-bottom: 4px; margin-top: 10px; }
.nav-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.nav-tabs a {
    padding: 8px 14px;
    background: #fff;
    border-radius: 6px;
    text-decoration: none;
    color: #1a6e3c;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.nav-tabs a.active { background: #1a6e3c; color: #fff; }
.row-present { background: #f0fdf4; }
.row-absent { background: #fef2f2; }
.row-unmarked { background: #fffbea; }
.attendance-btns button {
    padding: 6px 14px;
    margin-right: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
.attendance-btns button.active-present { background: #28a745; color: #fff; border-color: #28a745; }
.attendance-btns button.active-absent { background: #dc3545; color: #fff; border-color: #dc3545; }
.offline-banner { background: #ffc107; color: #333; padding: 8px 16px; text-align: center; font-size: 14px; }

/* ===================== MOBILE PWA DASHBOARD ===================== */
.mobile-wrap { max-width: 480px; margin: 0 auto; padding: 10px 12px; }
.mobile-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 4px 10px;
}
.mobile-header .logo-circle {
    width: 62px; height: 62px; border-radius: 50%; background: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.mobile-header .logo-circle img { width: 53px; height: 53px; border-radius: 50%; }
.mobile-header .text-block { text-align: left; }
.mobile-header h1 { font-size: 23px; color: #1a6e3c; margin: 0; line-height: 1.2; }
.mobile-header .sub { font-size: 15px; color: #888; }
.mobile-user-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
    font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.mobile-user-bar a { color: #c0392b; text-decoration: none; font-weight: 600; }
.mobile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.mobile-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 142px;
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: relative;
}
.mobile-btn .icon { font-size: 27px; margin-bottom: 5px; }
.mobile-btn .count { font-size: 22px; font-weight: 800; }
.mobile-btn .label { font-size: 18px; margin-top: 4px; text-align: center; font-weight: 700; line-height: 1.15; }
.mobile-btn.pulse { animation: pulseGlow 1.6s infinite; }
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(192,57,43,0.6); }
    70% { box-shadow: 0 0 0 12px rgba(192,57,43,0); }
    100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}
.color-students { background: linear-gradient(135deg,#3498db,#2874a6); }
.color-attendance { background: linear-gradient(135deg,#27ae60,#1e8449); }
.color-income { background: linear-gradient(135deg,#16a085,#117a65); }
.color-expense { background: linear-gradient(135deg,#e67e22,#ca6f1e); }
.color-reports { background: linear-gradient(135deg,#8e44ad,#6c3483); }
.color-fees { background: linear-gradient(135deg,#e74c3c,#c0392b); }

@media (max-width: 340px) {
    .mobile-btn { height: 125px; }
    .mobile-btn .icon { font-size: 22px; }
    .mobile-btn .count { font-size: 18px; }
    .mobile-btn .label { font-size: 16px; }
}

/* ---- Mobile sub-pages: back arrow header ---- */
.mobile-page-header {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 2px 14px;
}
.mobile-page-header .back-arrow {
    font-size: 24px; color: #1a6e3c; text-decoration: none;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.mobile-page-header .page-title { font-size: 18px; font-weight: 700; color: #1a3c6e; }

/* ---- Mobile report chooser list ---- */
.mobile-report-list { display: flex; flex-direction: column; gap: 8px; }
.mobile-report-item {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-radius: 10px; padding: 14px 16px;
    text-decoration: none; color: #2c3e50; font-size: 15px; font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.mobile-report-item .icon { font-size: 20px; }

/* ---- Mobile tables: allow horizontal scroll instead of breaking layout ---- */
.mobile-wrap .card table { min-width: 480px; }
.mobile-wrap .table-scroll { overflow-x: auto; }
