:root {
  --navy-950: #071b3a;
  --navy-900: #0a274f;
  --navy-800: #0f3060;
  --navy-700: #123566;
  --gold-700: #8a6a1f;
  --gold-600: #a97c22;
  --gold-500: #c9a13a;
  --gold-300: #e3c47c;
  --gold-100: #f3e6c4;
  --ivory: #f8f4ea;
  --ivory-100: #fffdf7;
  --ink: #14213d;
  --ink-soft: #4a5674;
  --line: rgba(10, 39, 79, 0.14);
  --line-on-navy: rgba(227, 196, 124, 0.28);
  --radius: 14px;
  --shadow: 0 20px 45px -20px rgba(10, 39, 79, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  color: var(--navy-900);
  margin: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-700);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--gold-600);
  display: inline-block;
}

.ribbon {
  display: inline-block;
  position: relative;
  background: var(--navy-900);
  color: var(--gold-300);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 7px 22px;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0% 50%);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

.btn {
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 2px;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-600));
  color: var(--navy-950);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(169, 124, 34, 0.55);
}

.btn-ghost-light {
  background: transparent;
  border: 1.5px solid var(--line-on-navy);
  color: var(--ivory-100);
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--navy-900);
  color: var(--navy-900);
}

.btn-outline:hover {
  background: var(--navy-900);
  color: var(--ivory-100);
}

/* Header */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 244, 234, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  height: 44px;
  width: 44px;
  object-fit: contain;
}

.brand-text {
  line-height: 1.05;
}

.brand-text .name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--navy-900);
}

.brand-text .sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-700);
  font-weight: 700;
}

nav.links {
  display: flex;
  gap: 34px;
  align-items: center;
}

nav.links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14.5px;
  font-weight: 600;
  transition: color .18s ease;
}

nav.links a:hover, nav.links a:focus-visible {
  color: var(--navy-900);
}

/* Dashboard Layout */
.dash-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
  position: relative;
}

.dash-sidebar {
  background: var(--navy-950);
  color: var(--ivory-100);
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.dash-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid var(--line-on-navy);
  margin-bottom: 14px;
}

.dash-brand .dash-brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(248, 244, 234, 0.7);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-300);
}

.sidebar-close-btn svg {
  width: 18px;
  height: 18px;
}

.dash-brand img {
  height: 34px;
  width: 34px;
}

.dash-brand .name {
  font-family: 'Fraunces', serif;
  font-size: 14.5px;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(248, 244, 234, 0.75);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  width: 100%;
  transition: background .15s ease, color .15s ease;
  text-decoration: none;
}

.dash-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ivory-100);
}

.dash-nav-item.active {
  background: var(--gold-500);
  color: var(--navy-950);
}

.dash-nav-item .ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.dash-nav-container {
  flex: 1;
  overflow-y: auto;
}

.dash-bottom-section {
  padding-top: 14px;
  border-top: 1px solid var(--line-on-navy);
  margin-top: auto;
}

.dash-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  margin-bottom: 8px;
}

.dash-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-950);
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 16px;
}

.dash-user-details {
  flex: 1;
}

.dash-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ivory-100);
  margin: 0;
}

.dash-user-role {
  font-size: 11px;
  color: rgba(248, 244, 234, 0.65);
  margin: 0;
  text-transform: capitalize;
}

.dash-logout-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(248, 244, 234, 0.25);
  background: transparent;
  color: rgba(248, 244, 234, 0.7);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  cursor: pointer;
}

.dash-logout-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--gold-500);
  color: var(--gold-300);
}

.dash-main {
  padding: 30px 40px 60px;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy-950);
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-on-navy);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-brand img {
  height: 32px;
  width: 32px;
}

.mobile-brand .name {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  color: var(--ivory-100);
}

.hamburger-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ivory-100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.hamburger-btn svg {
  width: 24px;
  height: 24px;
}

/* Profile Fields Styling */
.profile-field {
  margin-bottom: 18px;
}

.profile-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-value {
  padding: 12px 16px;
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
}

.dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 14px;
}

.dash-topbar h1 {
  font-size: 26px;
  font-weight: 600;
}

.dash-topbar .who {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.exit-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-900);
  text-decoration: none;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Cards and Layout */
.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.pill {
  background: var(--ivory-100);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-900);
}

.pill.gold {
  background: var(--gold-100);
  border-color: var(--gold-300);
  color: var(--gold-700);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--ivory-100);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.card.span2 {
  grid-column: span 2;
}

.card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card h3 .more {
  font-size: 12px;
  color: var(--gold-700);
  font-weight: 700;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row-link {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  transition: background .15s ease;
}

.list-row-link:hover {
  background: rgba(20, 30, 60, 0.04);
}

.list-row-link:hover .t {
  color: var(--navy-900);
  text-decoration: underline;
}

.list-row .t {
  font-weight: 600;
  color: var(--ink);
}

.list-row .d {
  color: var(--ink-soft);
  font-size: 12px;
}

.tag-soft {
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy-900);
}

.tag-soft.warn {
  background: #fbe9df;
  border-color: #e8b89a;
  color: #9a4a1f;
}

.perf-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-top: 6px;
}

.perf-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-600));
}

.attend-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--gold-500) 0deg 338deg, var(--line) 338deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 4px;
  position: relative;
}

.attend-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: var(--ivory-100);
  border-radius: 50%;
}

.attend-ring span {
  position: relative;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: var(--navy-900);
}

.page-title {
  margin-bottom: 30px;
}

.page-title h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.page-title p {
  color: var(--ink-soft);
  margin: 0;
}

@media (max-width: 980px) {
  nav.links {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .dash-shell {
    grid-template-columns: 1fr;
  }

  .dash-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .3s ease;
    box-shadow: 10px 0 40px rgba(0,0,0,0.3);
  }

  .dash-sidebar.open {
    transform: translateX(0);
  }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .overlay.open {
    display: block;
  }

  .dash-brand {
    display: flex;
  }

  .sidebar-close-btn {
    display: flex;
  }

  .dash-main {
    padding: 20px 16px 40px;
  }

  .grid-cards {
    grid-template-columns: 1fr;
  }

  .card.span2 {
    grid-column: span 1;
  }

  .dash-topbar {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .dash-topbar h1 {
    text-align: center;
  }

  .dash-topbar .who {
    text-align: center;
  }

  .badge-row {
    justify-content: center;
  }

  .dash-main h2 {
    text-align: center;
  }

  .card h3 {
    text-align: center;
    flex-direction: column;
    gap: 6px;
  }
}

/* ===== Shared form / table / modal components (used across student, teacher, admin portals) ===== */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  font-size: 14.5px;
  font-family: inherit;
  background: var(--ivory);
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 161, 58, 0.18);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.error-message {
  color: #dc2626;
  font-size: 13px;
  margin-top: 10px;
}

.success-message {
  color: #15803d;
  font-size: 13px;
  margin-top: 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-family: 'Fraunces', serif;
  color: var(--navy-900);
  font-size: 20px;
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--line);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--ivory);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.status-pill.good {
  background: rgba(21, 128, 61, 0.1);
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.25);
}

.status-pill.warn {
  background: rgba(201, 161, 58, 0.14);
  color: #92700f;
  border-color: rgba(201, 161, 58, 0.3);
}

.status-pill.bad {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 22, 41, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--ivory-100);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-box h2 {
  font-family: 'Fraunces', serif;
  color: var(--navy-900);
  margin: 0 0 20px 0;
  font-size: 20px;
}

.modal-close {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -8px;
}

.modal-close button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-soft);
  font-size: 14px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.icon-btn {
  padding: 8px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.icon-btn.btn-danger-outline {
  border-color: #b3423a;
  color: #b3423a;
}

.icon-btn.btn-danger-outline:hover {
  background: #b3423a;
  border-color: #b3423a;
  color: #fff;
}

.attendance-roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.attendance-roster-row:last-child {
  border-bottom: none;
}

.attendance-toggle {
  display: flex;
  gap: 6px;
}

.attendance-toggle button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--ivory);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.attendance-toggle button.present.active {
  background: rgba(21, 128, 61, 0.12);
  border-color: #15803d;
  color: #15803d;
}

.attendance-toggle button.absent.active {
  background: rgba(220, 38, 38, 0.1);
  border-color: #dc2626;
  color: #dc2626;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .data-table {
    font-size: 12.5px;
  }
}

/* ===== Mobile-friendly tables =====
   Below this width, tables stop scrolling sideways (which was breaking on
   phones) and instead stack into readable, card-like rows. Each cell shows
   a small label (from the data-label attribute) in place of the column
   header. Tables that don't have data-label attributes still stack safely,
   just without the inline label. */
@media (max-width: 720px) {
  .data-table thead {
    display: none;
  }

  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 14px;
    background: var(--ivory-100);
  }

  .data-table tr:last-child {
    margin-bottom: 0;
  }

  .data-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    text-align: right;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .data-table td:not([data-label]) {
    justify-content: flex-start;
    text-align: left;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    text-align: left;
    flex-shrink: 0;
  }

  .data-table td.table-actions {
    display: block;
  }

  .data-table td.table-actions::before {
    display: block;
    margin-bottom: 8px;
  }

  .data-table td.table-actions > div {
    justify-content: flex-start;
  }
}

/* Extra breathing room fix for very small phones */
@media (max-width: 480px) {
  .modal-box {
    padding: 22px 18px;
  }

  .dash-main {
    padding: 16px 12px 32px;
  }

  .section-head h2 {
    font-size: 17px;
  }

  .card {
    padding: 18px;
  }
}

/* =====================================================================
   Subject picker — checkbox list inside the Add Teacher modal
   ===================================================================== */
.subject-picker {
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  padding: 6px 4px;
}

.subject-picker-loading {
  padding: 12px 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.subject-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.subject-check-item:hover {
  background: var(--ivory);
}

.subject-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-600);
  cursor: pointer;
  flex-shrink: 0;
}

.subject-check-item span {
  font-size: 13.5px;
  color: var(--ink);
  flex: 1;
}

.subject-check-item:has(input:checked) {
  background: var(--gold-100);
}

.subject-check-item:has(input:checked) span {
  font-weight: 600;
  color: var(--navy-900);
}

.subject-check-tag {
  font-size: 11px;
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--ink-soft);
  white-space: nowrap;
  flex: none !important;
  font-weight: 400 !important;
}
