* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f7fa;
  color: #222;
}

/* ---------------- Login ---------------- */

.page-login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
.card {
  background: #fff;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  width: 360px;
}
.card h1 { margin: 0 0 20px; font-size: 22px; color: #2a3f5f; }
.card label { display: block; margin-bottom: 14px; font-size: 13px; color: #555; }
.card input {
  display: block; width: 100%; padding: 10px; margin-top: 4px;
  border: 1px solid #ccd; border-radius: 4px; font-size: 14px;
}
.card button {
  width: 100%; padding: 12px; background: #5a7fc8; color: #fff;
  border: none; border-radius: 4px; font-size: 15px; cursor: pointer;
}
.card button:hover { background: #4a6db0; }

/* ---------------- Topbar ---------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2a3f5f;
  color: #fff;
  padding: 12px 24px;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar #adminInfo { font-size: 13px; opacity: 0.85; margin-right: 12px; }
.topbar button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}

/* ---------------- Container & Panels ---------------- */

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

.panel {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.panel h2 { margin: 0 0 12px; font-size: 16px; color: #2a3f5f; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.panel-head h2 { margin: 0; }

.badge {
  font-size: 13px;
  font-weight: normal;
  color: #666;
  margin-left: 8px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.row input, .row select {
  padding: 8px;
  border: 1px solid #ccd;
  border-radius: 4px;
  font-size: 14px;
}
.row > button {
  padding: 8px 16px;
  background: #5a7fc8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.row > button:hover { background: #4a6db0; }

/* ---------------- Tables ---------------- */

.table-scroll-y {
  max-height: 440px;          /* ~10 rows */
  overflow-y: auto;
  border: 1px solid #e1e4eb;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid #e1e4eb;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f0f3f8;
  color: #2a3f5f;
  position: sticky;
  top: 0;
  z-index: 1;
}
tr:hover td { background: #fafbfd; }

.col-num     { width: 80px;  text-align: center; }
.col-actions { width: 160px; text-align: center; }

.muted { color: #888; font-size: 13px; }
.err   { color: #c33; font-size: 13px; min-height: 18px; }

/* ---------------- Action buttons ---------------- */

.btn-pri, .btn-edit, .btn-del {
  border: none;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  color: #fff;
  margin-right: 2px;
}
.btn-pri  { background: #62a0ea; }
.btn-edit { background: #f5b455; }
.btn-del  { background: #d96c6c; }
.btn-pri:hover  { background: #4d8ad6; }
.btn-edit:hover { background: #e29b3a; }
.btn-del:hover  { background: #c25555; }

/* ---------------- Modal ---------------- */

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.modal.open { display: flex; }

.modal-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-head h3 {
  margin: 0;
  color: #2a3f5f;
  font-size: 17px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}
.modal-card label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: #555;
}
.modal-card input[type="text"] {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #ccd;
  border-radius: 4px;
  font-size: 14px;
}
.modal-card .row input[type="text"] { flex: 1; }
.modal-card .row > button[type="button"] {
  padding: 8px 12px;
  background: #ccc;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.modal-card button[type="submit"] {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: #5a7fc8;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
.modal-card button[type="submit"]:hover { background: #4a6db0; }
