* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
    background: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}
.app-container {
    max-width: 1400px;
    width: 100%;
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.10);
    padding: 25px 30px 35px;
    transition: all 0.3s;
}
h1, h2, h3, h4 { font-weight: 600; color: #0f172a; }
button {
    cursor: pointer;
    border: none;
    outline: none;
    padding: 10px 22px;
    border-radius: 14px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #3b82f6;
    color: #fff;
}
button:hover { background: #2563eb; transform: scale(1.02); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
button.danger { background: #ef4444; }
button.danger:hover { background: #dc2626; }
button.success { background: #22c55e; }
button.success:hover { background: #16a34a; }
button.warning { background: #f59e0b; }
button.warning:hover { background: #d97706; }
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
    outline: none;
}
label { font-weight: 500; color: #334155; display: block; margin-bottom: 6px; }
.form-group { margin-bottom: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.card {
    background: #ffffff;
    border-radius: 24px;
    padding: 22px 26px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid #eef2f6;
    margin-bottom: 22px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.card-header h3 { font-size: 1.25rem; }
.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #dbeafe; color: #1d4ed8;
}
.badge-paid { background: #dcfce7; color: #166534; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef3c7; color: #92400e; }
.hidden { display: none !important; }
.flex { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: #64748b; font-size: 0.9rem; }
.avatar {
    width: 60px; height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e2e8f0;
    background: #f1f5f9;
}
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #e2e8f0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #eef2f6; }
th { background: #f8fafc; font-weight: 600; color: #475569; }
tr:hover { background: #fafbfc; }
.login-box {
    max-width: 440px;
    margin: 60px auto;
    padding: 40px 36px;
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.06);
    border: 1px solid #eef2f6;
}
.login-box h2 { text-align: center; margin-bottom: 6px; }
.login-box p.sub { text-align: center; color: #64748b; margin-bottom: 24px; }
.login-box button { width: 100%; padding: 14px; font-size: 1rem; border-radius: 16px; }
.login-box .demo-info { margin-top: 14px; font-size: 0.85rem; color: #94a3b8; text-align: center; }
.role-tag {
    display: inline-block;
    padding: 2px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #dbeafe; color: #1d4ed8;
}
.role-tag.admin { background: #fce7f3; color: #be185d; }
.role-tag.teacher { background: #d1fae5; color: #065f46; }
.role-tag.parent { background: #fef3c7; color: #92400e; }
.role-tag.student { background: #e0e7ff; color: #3730a3; }
.role-tag.super { background: #ede9fe; color: #5b21b6; }
.role-tag.principal { background: #fce7f3; color: #be185d; }
.toast {
    position: fixed;
    bottom: 30px; right: 30px;
    background: #1e293b;
    color: #fff;
    padding: 14px 28px;
    border-radius: 16px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.photo-preview { width: 100px; height: 100px; border-radius: 16px; object-fit: cover; border: 2px dashed #cbd5e1; background: #f8fafc; }
.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 2px solid #eef2f6;
    padding-bottom: 8px;
}
.tabs button {
    background: transparent;
    color: #64748b;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: 0.2s;
}
.tabs button:hover { background: #f1f5f9; color: #0f172a; transform: none; }
.tabs button.active { background: #3b82f6; color: #fff; }
.tab-content { display: none; animation: fadeUp 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
.stat-number { font-size: 2.2rem; font-weight: 700; color: #0f172a; margin-top: 4px; }
.report-card {
    background: #f8fafc;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-top: 16px;
}
.report-card table { margin-top: 12px; }
.bar-chart { display: flex; gap: 18px; align-items: flex-end; height: 130px; margin-top: 12px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.bar { width: 100%; max-width: 40px; background: #3b82f6; border-radius: 8px 8px 0 0; transition: height 0.5s; min-height: 6px; }
.bar-label { font-size: 0.7rem; color: #64748b; margin-top: 6px; }
.top-bar { margin-bottom: 16px; }
.footer-note { margin-top: 24px; font-size: 0.8rem; border-top: 1px solid #eef2f6; padding-top: 16px; }

/* Storage Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.modal.show { display: flex !important; }
#storageEditModal textarea {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Logo in header */
#schoolLogoHeader {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 2px;
    background: #fff;
}

@media (max-width: 768px) {
    .row, .row-3 { grid-template-columns: 1fr; }
    .app-container { padding: 16px; }
    .login-box { padding: 24px 18px; margin: 20px auto; }
}
