*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; }
input, select, textarea { outline: none; font-family: inherit; }

/* Loading */
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.spinner { width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top-color: #1a3a5c; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 8px; color: white; font-size: 14px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; max-width: 340px; }
.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
.toast.info { background: #1a3a5c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Navbar */
.navbar { background: linear-gradient(135deg, #1a3a5c, #2c5f8f); color: white; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.navbar-brand { font-size: 20px; font-weight: 800; color: #f5a623; }
.navbar-brand span { color: white; }
.navbar-links { display: flex; gap: 8px; align-items: center; }
.nav-btn { padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; transition: all 0.2s; }
.nav-btn.primary { background: #f5a623; color: #1a3a5c; }
.nav-btn.primary:hover { background: #e09518; }
.nav-btn.outline { border: 1px solid rgba(255,255,255,0.5); color: white; background: transparent; }
.nav-btn.outline:hover { background: rgba(255,255,255,0.1); }
.nav-btn.ghost { color: rgba(255,255,255,0.85); background: transparent; }
.nav-btn.ghost:hover { background: rgba(255,255,255,0.1); border-radius: 6px; }

/* Layout */
.app-layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 220px; background: #1a3a5c; color: white; flex-shrink: 0; padding: 20px 0; }
.sidebar-menu { list-style: none; }
.sidebar-menu li a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: rgba(255,255,255,0.8); font-size: 14px; transition: background 0.2s; }
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: rgba(255,255,255,0.12); color: white; }
.sidebar-menu li a .icon { width: 18px; text-align: center; }
.sidebar-section { padding: 10px 20px 4px; font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,0.4); letter-spacing: 1px; margin-top: 10px; }
.main-content { flex: 1; padding: 28px; overflow-x: hidden; }

/* Page titles */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: #1a3a5c; }
.page-sub { font-size: 14px; color: #888; margin-top: 4px; }

/* Cards */
.card { background: white; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 20px; }
.card + .card { margin-top: 16px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 800; color: #1a3a5c; }
.stat-sub { font-size: 12px; color: #aaa; margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; transition: all 0.2s; cursor: pointer; border: none; }
.btn-primary { background: #1a3a5c; color: white; }
.btn-primary:hover { background: #14304f; }
.btn-accent { background: #f5a623; color: #1a3a5c; }
.btn-accent:hover { background: #e09518; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-outline { border: 1.5px solid #ddd; background: white; color: #555; }
.btn-outline:hover { border-color: #1a3a5c; color: #1a3a5c; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-icon { padding: 6px 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid #e0e0e0; border-radius: 7px; font-size: 14px; transition: border 0.2s; }
.form-control:focus { border-color: #1a3a5c; }
.form-control.error { border-color: #dc3545; }
.form-error { font-size: 12px; color: #dc3545; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #f8f9fa; font-weight: 600; color: #555; text-align: left; padding: 11px 14px; border-bottom: 2px solid #e9ecef; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
tr:hover td { background: #fafbfc; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: #d4edda; color: #155724; }
.badge-red { background: #f8d7da; color: #721c24; }
.badge-blue { background: #d0e8f7; color: #0c4a6e; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-gray { background: #e9ecef; color: #555; }

/* Events cards */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.event-card { background: white; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
.event-card-header { padding: 14px 16px; display: flex; align-items: flex-start; gap: 14px; border-bottom: 1px solid #f0f2f5; }
.event-date-badge { background: #1a3a5c; color: white; border-radius: 8px; padding: 8px 12px; text-align: center; min-width: 52px; flex-shrink: 0; }
.event-date-badge .day { font-size: 20px; font-weight: 800; line-height: 1; }
.event-date-badge .mon { font-size: 11px; opacity: 0.8; }
.event-card-title { font-weight: 700; color: #1a3a5c; font-size: 15px; }
.event-card-body { padding: 12px 16px; }
.event-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #777; margin-bottom: 8px; }
.event-desc { font-size: 13px; color: #666; line-height: 1.5; }
.event-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e0e0e0; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.cal-header { background: #1a3a5c; color: white; text-align: center; padding: 8px 4px; font-size: 13px; font-weight: 600; }
.cal-cell { background: white; min-height: 80px; padding: 6px; }
.cal-cell.other-month { background: #f8f9fa; }
.cal-cell.today { outline: 2px solid #f5a623; outline-offset: -2px; }
.cal-day { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
.cal-cell.today .cal-day { color: #f5a623; }
.cal-event { font-size: 11px; background: #1a3a5c; color: white; border-radius: 3px; padding: 2px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Announcement */
.announcement { background: #fff3cd; border: 1px solid #ffc107; border-radius: 8px; padding: 14px 18px; margin-bottom: 12px; display: flex; align-items: flex-start; gap: 14px; }
.ann-title { font-weight: 700; color: #856404; }
.ann-msg { font-size: 13px; color: #664d03; }

/* Hero */
.hero { background: linear-gradient(135deg, #1a3a5c, #2c5f8f); color: white; border-radius: 12px; padding: 50px 40px; margin-bottom: 30px; text-align: center; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 15px; opacity: 0.9; max-width: 600px; margin: 0 auto 28px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a3a5c, #2c5f8f); }
.auth-card { background: white; border-radius: 12px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-text { font-size: 28px; font-weight: 800; color: #1a3a5c; }
.auth-logo-text span { color: #f5a623; }
.auth-subtitle { font-size: 14px; color: #888; text-align: center; margin-top: 4px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: white; border-radius: 10px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; color: #1a3a5c; }
.modal-close { background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: #555; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 700; color: #1a3a5c; display: flex; align-items: center; gap: 8px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: #aaa; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-text { font-size: 15px; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* Search bar */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-input { flex: 1; padding: 9px 12px; border: 1.5px solid #e0e0e0; border-radius: 7px; font-size: 14px; }
.search-input:focus { border-color: #1a3a5c; outline: none; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .hero { padding: 32px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
