/* NEST ERP — Design System (matches NEST WordPress theme) */
:root {
  --teal: #0D524F;
  --teal-light: #145f5b;
  --gold: #C49A22;
  --gold-light: #d4aa32;
  --cream: #F4EFE6;
  --cream-dark: #ede6d8;
  --charcoal: #2C2C2C;
  --white: #ffffff;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --success: #1a7a4a;
  --success-light: #eafaf1;
  --warning: #b7770d;
  --warning-light: #fef9e7;
  --border: #ddd5c4;
  --text-muted: #666;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ── */
h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ── Layout ── */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.page-wrap { padding: 40px 0 60px; }

/* ── Navbar ── */
.navbar {
  background: var(--teal);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.navbar-brand {
  font-family: var(--font-serif);
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-brand .logo-dot {
  width: 28px; height: 28px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: var(--white);
}
.navbar-user {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--white);
  padding: 5px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-teal { background: var(--teal); color: var(--white); }
.btn-teal:hover:not(:disabled) { background: var(--teal-light); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover:not(:disabled) { background: var(--gold-light); }
.btn-outline { background: transparent; border: 2px solid var(--teal); color: var(--teal); }
.btn-outline:hover:not(:disabled) { background: var(--teal); color: var(--white); }
.btn-sm { padding: 6px 16px; font-size: 0.82rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 10px 16px; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card-sm { padding: 20px; }

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--charcoal);
  transition: border-color 0.2s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,82,79,0.12);
}
.form-control.is-error { border-color: var(--danger); }
.form-control:disabled { background: var(--cream); cursor: not-allowed; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D524F' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-error { background: var(--danger-light); color: var(--danger); border-left: 3px solid var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left: 3px solid var(--warning); }
.alert:empty { display: none; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pass { background: var(--success-light); color: var(--success); }
.badge-fail { background: var(--danger-light); color: var(--danger); }
.badge-gold { background: #fef3d0; color: var(--warning); }

/* ── Progress bar ── */
.progress-wrap { margin-bottom: 8px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar-track { background: var(--cream-dark); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar-fill { background: var(--gold); height: 100%; border-radius: 20px; transition: width 0.4s ease; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; gap: 0; }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-btn:hover { color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  background: var(--teal);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--cream); }
td { padding: 9px 12px; vertical-align: middle; }
td.at-risk { color: var(--danger); font-weight: 700; }
td.top-score { color: var(--success); font-weight: 700; }

/* ── Student card (marks entry) ── */
.student-card {
  text-align: center;
  padding: 36px 28px;
}
.student-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.student-name { font-family: var(--font-serif); font-size: 1.5rem; color: var(--charcoal); }
.student-meta { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.marks-input-wrap {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 24px 0;
}
.marks-input-wrap .form-control {
  width: 120px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--teal);
  padding: 12px;
}
.marks-input-wrap .max-label { font-size: 1.1rem; color: var(--text-muted); }

.nav-btns { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--teal) 0%, #0a3d3b 100%);
  padding: 20px;
}
.login-card { width: 100%; max-width: 400px; }
.login-logo {
  text-align: center;
  margin-bottom: 28px;
  color: var(--white);
}
.login-logo .logo-dot-lg {
  width: 56px; height: 56px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: var(--white);
  margin: 0 auto 12px;
}
.login-logo h1 { font-size: 1.6rem; }
.login-logo p { font-size: 0.85rem; opacity: 0.8; margin-top: 4px; }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-family: var(--font-serif); font-size: 1.8rem; color: var(--teal); font-weight: 700; }
.stat-card .stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Section header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 4px;
}

/* ── Chart container ── */
.chart-wrap { position: relative; height: 280px; }

/* ── At-risk list ── */
.risk-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--danger-light);
  border-left: 4px solid var(--danger);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 10px;
}
.risk-item .risk-name { font-weight: 600; color: var(--charcoal); }
.risk-item .risk-detail { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.risk-score { font-size: 1.2rem; font-weight: 700; color: var(--danger); }

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--cream-dark);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { text-align: center; padding: 40px; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .card { padding: 20px 16px; }
  .page-wrap { padding: 24px 0 40px; }
  .nav-btns { flex-direction: column; }
  .nav-btns .btn { width: 100%; }
  .tabs { overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
}
