:root {
  --wine: #741c3c;
  --deep-wine: #54132b;
  --blue: #075985;
  --light-blue: #e2f2fb;
  --gold: #d6ad45;
  --green: #15803d;
  --white: #ffffff;
  --background: #f2f7fb;
  --text: #243447;
  --muted: #64748b;
  --border: #dbe4ec;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--background);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .65;
  cursor: wait;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, #e2f2fb, transparent 42%),
    var(--background);
}

.login-card {
  width: min(100%, 460px);
  padding: 32px;
  background: white;
  border-top: 6px solid var(--gold);
  border-radius: 16px;
  box-shadow: 0 12px 36px #172b4418;
}

.school-emblem,
.small-emblem,
.banner-symbol {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  color: white;
  background: var(--wine);
  border: 3px solid var(--gold);
  border-radius: 50%;
}

.school-emblem {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  font-size: 27px;
}

.school-label {
  color: var(--wine);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-align: center;
}

.login-card h1 {
  margin: 12px 0;
  color: var(--wine);
  font-size: clamp(23px, 5vw, 30px);
  text-align: center;
}

.login-description {
  color: var(--blue);
  text-align: center;
}

.security-note {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.form-group {
  min-width: 0;
  margin: 16px 0;
}

.form-group label,
.management-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--deep-wine);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #07598533;
  border-color: var(--blue);
}

.password-field {
  display: flex;
  gap: 7px;
}

.password-field input {
  flex: 1;
  min-width: 0;
}

.show-password {
  padding: 0 12px;
  border: 1px solid var(--wine);
  border-radius: 7px;
  background: var(--wine);
  color: white;
}

.primary-button {
  min-height: 46px;
  padding: 11px 18px;
  border: 2px solid var(--gold);
  border-radius: 7px;
  background: var(--wine);
  color: white;
  font-weight: 700;
}

#loginButton {
  width: 100%;
  margin-top: 10px;
}

.primary-button:hover,
.show-password:hover {
  background: var(--deep-wine);
}

.secondary-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--blue);
  font-weight: 700;
}

.secondary-button:hover {
  background: var(--light-blue);
}

#loginMessage,
#studentFormMessage,
#studentListMessage {
  overflow-wrap: anywhere;
  line-height: 1.6;
}

/* MAIN DASHBOARD LAYOUT */

.dashboard-page:not([hidden]) {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 14px;
  background: var(--wine);
  color: white;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 5px 20px;
  border-bottom: 1px solid #ffffff38;
}

.small-emblem {
  width: 44px;
  height: 44px;
  font-size: 15px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 13px;
}

.sidebar-brand span {
  margin-top: 5px;
  color: #ffe6a0;
  font-size: 10px;
}

.sidebar-user {
  display: grid;
  gap: 7px;
  padding: 17px 7px;
  overflow-wrap: anywhere;
}

.user-label,
.nav-heading {
  color: #f4dce5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

.sidebar-navigation {
  display: block;
}

.nav-heading {
  margin: 15px 9px 9px;
}

.nav-button {
  width: 100%;
  display: block;
  margin: 3px 0;
  padding: 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: white;
  text-align: left;
  font-size: 13px;
}

.nav-button:hover {
  background: #ffffff1c;
}

.nav-button.active {
  background: var(--gold);
  color: var(--deep-wine);
  font-weight: 800;
}

/* Also style the School Settings button created by JavaScript. */
.sidebar-navigation > button[data-section="settings"] {
  width: 100%;
  display: block;
  margin: 3px 0;
  padding: 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: white;
  text-align: left;
  font-size: 13px;
}

.sidebar-navigation > button[data-section="settings"]:hover {
  background: #ffffff1c;
}

.sidebar-navigation > button[data-section="settings"].active {
  background: var(--gold);
  color: var(--deep-wine);
  font-weight: 800;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
}

.sidebar-bottom p {
  font-size: 12px;
}

.logout-button {
  width: 100%;
  padding: 11px;
  border: 1px solid #f3cbd8;
  border-radius: 7px;
  background: transparent;
  color: white;
  font-weight: 700;
}

.logout-button:hover {
  background: var(--deep-wine);
}

.dashboard-main {
  min-width: 0;
  padding: 26px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.breadcrumb {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.dashboard-header h1 {
  margin: 0;
  color: var(--wine);
  font-size: clamp(23px, 3vw, 31px);
}

.dashboard-section {
  width: 100%;
  min-width: 0;
}

.section-intro {
  margin: 24px 0 16px;
}

.section-intro h2 {
  margin: 0 0 7px;
  color: var(--wine);
}

.section-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* OVERVIEW */

.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 25px;
  border-left: 6px solid var(--gold);
  border-radius: 12px;
  background: var(--light-blue);
}

.banner-eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.welcome-banner h2 {
  margin: 8px 0;
  color: var(--wine);
}

.welcome-banner p {
  line-height: 1.6;
}

.banner-symbol {
  width: 75px;
  height: 75px;
  font-size: 24px;
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.stat-card {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  box-shadow: 0 3px 12px #00000008;
}

.stat-label,
.stat-description {
  display: block;
  line-height: 1.5;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
}

.stat-card strong {
  display: block;
  margin: 12px 0;
  color: var(--wine);
  font-size: 30px;
}

.stat-description {
  color: var(--muted);
  font-size: 12px;
}

.stat-wine { border-top: 4px solid var(--wine); }
.stat-blue { border-top: 4px solid var(--blue); }
.stat-gold { border-top: 4px solid var(--gold); }
.stat-green { border-top: 4px solid var(--green); }

.status-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green);
}

.status-card p {
  margin-bottom: 0;
  line-height: 1.6;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  text-align: left;
}

.quick-action:hover {
  border-color: var(--blue);
  background: #f0f9ff;
}

.quick-action strong {
  color: var(--wine);
}

.quick-action small {
  color: var(--muted);
  line-height: 1.5;
}

/* CONTENT CARDS AND STUDENT FORMS */

.content-card,
.management-card {
  min-width: 0;
  margin: 18px 0;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: 0 3px 12px #00000007;
}

.content-card h3,
.management-card h3 {
  margin-top: 0;
  color: var(--wine);
}

.content-card p,
.management-card p {
  line-height: 1.6;
}

#studentForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

#studentForm .form-group {
  min-width: 0;
}

#studentForm .form-group:last-of-type {
  grid-column: 1 / -1;
}

#studentForm .primary-button {
  margin-top: 0;
}

#cancelStudentEdit {
  margin: 8px 0 0 8px;
}

#studentSearch {
  max-width: 500px;
}

/* TABLES */

table {
  border-collapse: collapse;
}

.content-card table,
.management-table {
  width: 100%;
  background: white;
}

.content-card th,
.content-card td,
.management-table th,
.management-table td {
  padding: 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.content-card th,
.management-table th {
  background: var(--wine);
  color: white;
  font-size: 12px;
}

.content-card td,
.management-table td {
  font-size: 13px;
}

.content-card tbody tr:hover,
.management-table tbody tr:hover {
  background: #f0f9ff;
}

.management-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.management-table {
  min-width: 580px;
}

.management-btn {
  margin: 2px;
  padding: 9px 12px;
  border: 0;
  border-radius: 7px;
  background: var(--wine);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.management-btn:hover {
  filter: brightness(.92);
}

.management-btn.blue {
  background: var(--blue);
}

.management-btn.gold {
  background: var(--gold);
  color: #241900;
}

.management-btn.danger {
  background: #a72b3b;
}

.management-wrap {
  width: 100%;
  max-width: 1250px;
  margin: 0 auto;
  padding: 4px;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.management-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 13px;
}

.management-form label {
  min-width: 0;
}

.management-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.management-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.management-stat {
  color: var(--wine);
  font-size: 28px;
  font-weight: 800;
}

.management-logo {
  max-width: 130px;
  max-height: 100px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px;
}

.management-report {
  padding: 24px;
  border: 1px solid #ddd;
  background: white;
  color: #111;
}

/* NOTICES */

#appNotice {
  position: relative;
  z-index: 10;
  margin: 0 0 18px;
  padding: 12px 15px;
  border-radius: 8px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

/* FOOTER */

.dashboard-footer {
  padding: 28px 10px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

/* MOBILE AND TABLET */

@media (max-width: 1100px) {
  .statistics-grid,
  .quick-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main {
    padding: 20px;
  }
}

@media (max-width: 760px) {
  .dashboard-page:not([hidden]) {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 14px;
  }

  .sidebar-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .nav-heading {
    flex-basis: 100%;
  }

  .nav-button,
  .sidebar-navigation > button[data-section="settings"] {
    width: calc(50% - 5px);
    margin: 0;
    padding: 11px 9px;
    font-size: 12px;
  }

  .sidebar-bottom {
    margin-top: 12px;
    padding-top: 10px;
  }

  .dashboard-main {
    padding: 15px;
  }

  .welcome-banner {
    padding: 18px;
  }

  .banner-symbol {
    width: 55px;
    height: 55px;
    font-size: 18px;
  }

  .statistics-grid {
    gap: 9px;
  }

  .stat-card {
    padding: 13px;
  }

  .stat-card strong {
    font-size: 25px;
  }

  .content-card,
  .management-card {
    padding: 15px;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 14px;
  }

  .login-card {
    padding: 23px 18px;
  }

  .dashboard-header {
    align-items: flex-start;
  }

  .welcome-banner {
    align-items: flex-start;
  }

  .banner-symbol {
    display: none;
  }

  #studentForm {
    grid-template-columns: 1fr;
  }

  #studentForm .form-group:last-of-type {
    grid-column: auto;
  }

  #cancelStudentEdit {
    margin-left: 0;
  }

  .statistics-grid,
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #printArea,
  #printArea * {
    visibility: visible !important;
  }

  #printArea {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0 !important;
  }

  .no-print {
    display: none !important;
  }
}.site-credit {
  text-align: center;
  padding: 18px;
  font-style: italic;
  color: #ffffff;
  background-color: #650d24;
  line-height: 1.6;
}