:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --warning: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  padding: 28px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.brand-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin-bottom: 10px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.subtitle { margin: 0 0 20px; color: var(--muted); }

/* Topbar */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-weight: 700; font-size: 17px; color: var(--primary); }
.campus-pill {
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.container { max-width: 1360px; margin: 0 auto; padding: 16px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }

/* Toolbar & Filters */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; }

.filters-card {
  background: var(--card);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

/* Inputs & Buttons */
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 12px; }

.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f9fafb; }

/* Table */
.table-card {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
th { background: #f9fafb; font-size: 12px; color: var(--muted); font-weight: 600; }
tr:hover td { background: #f9fafb; }

.empty-state { padding: 28px; text-align: center; color: var(--muted); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.urgency-overdue { background: #991b1b; color: #fff; }
.urgency-critical { background: #ef4444; color: #fff; }
.urgency-today { background: #f59e0b; color: #fff; }
.urgency-upcoming { background: #3b82f6; color: #fff; }
.urgency-normal { background: #e5e7eb; color: #374151; }

.dup-badge { background: #fef3c7; color: #92400e; margin-top: 4px; }
.level-badge { background: #e0e7ff; color: #3730a3; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-content {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-lg { max-width: 820px; }
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
}
.modal-body { padding: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.full-width { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.error-msg { color: var(--danger); margin-bottom: 10px; font-size: 13px; }
.note-item {
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  background: #f9fafb;
  margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}
