﻿:root {
  --nhowe-navy: #14306b;
  --nhowe-navy-dark: #0c2048;
  --nhowe-gold: #c9a227;
  --nhowe-gold-light: #e8c84a;
  --nhowe-bg: #f7f9fc;
  --nhowe-surface: #ffffff;
  --nhowe-border: #d8dee8;
  --nhowe-text: #1a1a2e;
  --nhowe-muted: #5c6578;
  --nhowe-radius: 10px;
  --nhowe-shadow: 0 4px 24px rgba(20, 48, 107, 0.08);
  --nhowe-font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --sidebar-width: 252px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--nhowe-font);
  background: var(--nhowe-bg);
  color: var(--nhowe-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── App shell: sidebar + main ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--nhowe-navy-dark) 0%, var(--nhowe-navy) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 3px solid var(--nhowe-gold);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
  height: 48px;
  width: auto;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.3;
}

.sidebar-brand-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--nhowe-gold-light);
  margin-top: 0.15rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.65rem 1rem;
}

.sidebar-section {
  margin: 1rem 0 0.35rem;
  padding: 0 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-section:first-child {
  margin-top: 0.25rem;
}

.sidebar-link {
  display: block;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.15rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(201, 162, 39, 0.22);
  color: #fff;
  border-left: 3px solid var(--nhowe-gold);
  padding-left: calc(0.75rem - 3px);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.sidebar-role {
  display: block;
  font-size: 0.75rem;
  color: var(--nhowe-gold-light);
  margin-bottom: 0.65rem;
  line-height: 1.35;
}

.sidebar-logout {
  display: block;
  text-align: center;
  padding: 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.15);
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2rem;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 300;
  background: var(--nhowe-navy);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--nhowe-shadow);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 150;
}

.sidebar-backdrop.show {
  display: block;
}

/* ── Typography & content ── */
h1 {
  color: var(--nhowe-navy);
  font-size: 1.65rem;
  margin: 0 0 0.5rem;
}

h2 {
  color: var(--nhowe-navy);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

.card, .stats .stat {
  background: var(--nhowe-surface);
  border: 1px solid var(--nhowe-border);
  border-radius: var(--nhowe-radius);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(20, 48, 107, 0.04);
}

.card label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--nhowe-muted);
}

.card input, .card select, .card textarea,
.filters input, .filters select {
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  border: 1px solid var(--nhowe-border);
  border-radius: 6px;
  font: inherit;
  color: var(--nhowe-text);
}

.card input:focus, .card select:focus, .card textarea:focus {
  outline: 2px solid rgba(20, 48, 107, 0.25);
  border-color: var(--nhowe-navy);
}

button, .btn {
  background: var(--nhowe-navy);
  color: #fff;
  border: 0;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background 0.15s;
}

button:hover, .btn:hover {
  background: var(--nhowe-navy-dark);
}

button.btn-secondary, .btn-secondary {
  background: #fff;
  color: var(--nhowe-navy);
  border: 1px solid var(--nhowe-border);
}

button.btn-gold {
  background: var(--nhowe-gold);
  color: var(--nhowe-navy-dark);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0;
}

.stat {
  text-align: center;
  border-top: 3px solid var(--nhowe-gold);
}

.stat strong {
  display: block;
  font-size: 1.75rem;
  color: var(--nhowe-navy);
}

.stat span {
  font-size: 0.85rem;
  color: var(--nhowe-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--nhowe-surface);
  margin: 1rem 0;
  border-radius: var(--nhowe-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 48, 107, 0.05);
}

th, td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #eef1f6;
  text-align: left;
  font-size: 0.92rem;
}

th {
  background: var(--nhowe-bg);
  color: var(--nhowe-navy);
  font-weight: 600;
}

.error {
  background: #fde8e8;
  padding: 0.85rem 1rem;
  border-radius: var(--nhowe-radius);
  border-left: 4px solid #c0392b;
}

.notice {
  background: #edf7ed;
  padding: 0.85rem 1rem;
  border-radius: var(--nhowe-radius);
  border: 1px solid #b7dfc0;
}

.delegation-banner {
  background: linear-gradient(90deg, #fff8e1, #fff);
  border: 1px solid var(--nhowe-gold);
  border-radius: var(--nhowe-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.filters {
  margin: 0.85rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--nhowe-muted);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.muted { color: var(--nhowe-muted); font-size: 0.9rem; }

hr {
  border: 0;
  border-top: 1px solid #eef1f6;
  margin: 1.25rem 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.page-header h1 { margin: 0; }

.btn-link {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--nhowe-navy);
  border: 1px solid var(--nhowe-border);
  background: #fff;
  font-weight: 500;
  font-size: 0.9rem;
}

.btn-link.primary {
  background: var(--nhowe-navy);
  color: #fff;
  border-color: var(--nhowe-navy);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.checkbox input { width: auto; margin: 0; }

.table-scroll { overflow-x: auto; margin: 1rem 0; }

.marks-form .mark-input { width: 5rem; padding: 0.35rem; }
.marks-form .comment-input { width: 100%; min-width: 8rem; padding: 0.35rem; }
.marks-header p { margin: 0.25rem 0; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--nhowe-navy-dark) 0%, var(--nhowe-navy) 45%, #1a4080 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--nhowe-radius);
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--nhowe-shadow);
  border-top: 4px solid var(--nhowe-gold);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-brand img {
  height: 72px;
  width: auto;
  display: block;
  margin: 0 auto 0.65rem;
}

.login-school-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--nhowe-navy);
  letter-spacing: 0.02em;
}

.login-card h1 {
  text-align: center;
  font-size: 1.3rem;
  margin: 0 0 1.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
}

.login-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--nhowe-muted);
}

.login-form input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--nhowe-border);
  border-radius: 6px;
  font: inherit;
  color: var(--nhowe-text);
}

.login-form input:focus {
  outline: 2px solid rgba(20, 48, 107, 0.25);
  border-color: var(--nhowe-navy);
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.75rem;
}

.login-footer-note {
  text-align: center;
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--nhowe-muted);
}

.site-footer {
  text-align: center;
  padding: 1.25rem 1.5rem;
  color: var(--nhowe-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--nhowe-border);
  background: var(--nhowe-surface);
}

.site-footer em { color: var(--nhowe-navy); }

.site-footer p { margin: 0.25rem 0; }

/* ── Student portal ── */
.student-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
  background: var(--nhowe-surface);
  border: 1px solid var(--nhowe-border);
  border-radius: var(--nhowe-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--nhowe-gold);
  box-shadow: var(--nhowe-shadow);
}

.student-photo {
  width: 120px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--nhowe-border);
  background: var(--nhowe-bg);
}

.student-photo-placeholder {
  width: 120px;
  height: 150px;
  border-radius: 8px;
  border: 2px dashed var(--nhowe-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nhowe-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
  background: var(--nhowe-bg);
}

.student-hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}

.student-meta span {
  background: var(--nhowe-bg);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ── Report card ── */
.report-card {
  background: #fff;
  border: 1px solid var(--nhowe-border);
  border-radius: var(--nhowe-radius);
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--nhowe-shadow);
}

.report-header {
  text-align: center;
  border-bottom: 2px solid var(--nhowe-gold);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.report-header img {
  height: 56px;
  margin-bottom: 0.5rem;
}

.report-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.report-subtitle {
  margin: 0.25rem 0 0;
  color: var(--nhowe-muted);
}

.report-student-row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.report-student-row img {
  width: 90px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--nhowe-border);
}

.report-meta {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.report-meta th, .report-meta td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.report-meta th {
  width: 130px;
  color: var(--nhowe-muted);
  background: transparent;
}

.report-footer {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
  text-align: center;
  color: var(--nhowe-muted);
  font-size: 0.88rem;
}

@media print {
  .sidebar, .sidebar-toggle, .site-footer, .no-print, .delegation-banner {
    display: none !important;
  }
  .main-wrap { margin-left: 0 !important; }
  .main-content { padding: 0; max-width: 100%; }
  body { background: #fff; }
  .report-card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .main-content {
    padding: 3.5rem 1rem 1.5rem;
  }
  .student-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .student-photo, .student-photo-placeholder {
    margin: 0 auto;
  }
}
