/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #333; background: #f5f7fa; line-height: 1.6; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Container ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* ---- Nav ---- */
.main-nav { background: #1e293b; color: #fff; padding: 0.75rem 0; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.nav-brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.nav-brand:hover { text-decoration: none; }
.nav-links { list-style: none; display: flex; gap: 1.25rem; }
.nav-links a { color: #cbd5e1; font-size: 0.9rem; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-app-btn { background: #2563eb; color: #fff !important; padding: 0.3rem 0.75rem; border-radius: 6px; font-weight: 600; }
.nav-app-btn:hover { background: #1d4ed8; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; width: 100%; flex-direction: column; gap: 0.5rem; padding-top: 0.75rem; }
    .nav-links.open { display: flex; }
}

/* ---- Alerts ---- */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ---- Cards / Panels ---- */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1.5rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 1rem; }
.page-header h1 { font-size: 1.5rem; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
th { background: #f8fafc; font-weight: 600; white-space: nowrap; }
tr:hover { background: #f8fafc; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.9rem; font-family: inherit; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: 0.5rem 1.25rem; border: none; border-radius: 6px; font-size: 0.9rem; cursor: pointer; text-align: center; font-family: inherit; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; text-decoration: none; }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover  { background: #b91c1c; text-decoration: none; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.filter-select { padding: 0.5rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.9rem; background: #fff; cursor: pointer; }

/* ---- Login ---- */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { text-align: center; margin-bottom: 1.5rem; }

/* ---- Dashboard stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.25rem; text-align: center; }
.stat-card .num { font-size: 2rem; font-weight: 700; color: #2563eb; }
.stat-card .label { font-size: 0.85rem; color: #64748b; }

/* ---- Badge ---- */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ---- View Toggle ---- */
.view-toggle { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; }
.view-btn { padding: 0.4rem 0.75rem; border: none; background: #fff; font-size: 0.85rem; cursor: pointer; color: #64748b; font-family: inherit; }
.view-btn.active { background: #2563eb; color: #fff; }
.view-btn:not(.active):hover { background: #f1f5f9; }

/* ---- Calendar ---- */
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cal-nav h2 { font-size: 1.2rem; color: #1e293b; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 2px solid #1e293b; border-top: 2px solid #1e293b; }
.cal-day-header { text-align: center; font-weight: 700; font-size: 0.85rem; color: #fff; background: #1e293b; padding: 0.6rem 0.5rem; border-right: 2px solid #1e293b; border-bottom: 2px solid #1e293b; }
.cal-cell { min-height: 110px; border-right: 2px solid #1e293b; border-bottom: 2px solid #1e293b; padding: 0.4rem; background: #fff; }
.cal-empty { background: #f1f5f9; }
.cal-today { background: #eff6ff; }
.cal-date { font-weight: 700; font-size: 0.9rem; color: #1e293b; margin-bottom: 0.3rem; padding-bottom: 0.2rem; border-bottom: 1px solid #e2e8f0; }
.cal-today .cal-date { color: #2563eb; }
.cal-event { display: block; background: #dbeafe; color: #1e40af; font-size: 0.75rem; padding: 0.2rem 0.4rem; border-radius: 3px; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; border-left: 3px solid #2563eb; }
.cal-event:hover { background: #bfdbfe; text-decoration: none; }
@media (max-width: 768px) {
    .cal-cell { min-height: 70px; }
    .cal-event { font-size: 0.65rem; }
    .cal-day-header { font-size: 0.75rem; }
}

/* ---- Footer ---- */
.site-footer { text-align: center; padding: 2rem 0 1rem; font-size: 0.8rem; color: #94a3b8; }

/* ---- Misc ---- */
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
