:root {
  --color-primary: #0047ab;
  --color-primary-dark: #003785;
  --color-gold: #ffcc00;
  --color-ink: #0c1b33;
  --color-slate: #102347;
  --color-muted: #6782a7;
  --color-bg: #f7f9fc;
  --radius-lg: 32px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-soft: 0 15px 35px rgba(12, 27, 51, 0.12);
  --shadow-card: 0 10px 25px rgba(0, 71, 171, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-ink);
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 71, 171, 0.08);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.logo-icon {
  width: 200px;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.logo-icon img {
  width: 100%;
  height: auto;
  display: block;
}



.logo-sub {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: var(--color-muted);
}

.main-nav {
  display: flex;
  gap: 1rem;
  margin-left: 2rem;
}

.nav-link {
  text-decoration: none;
  color: var(--color-slate);
  font-weight: 500;
  padding: 0.2rem 0.4rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-chip {
  padding: 0.35rem 0.75rem;
  background: rgba(0, 71, 171, 0.12);
  border-radius: 999px;
  font-size: 0.85rem;
}

.logout-form {
  margin: 0;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.3rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-small {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
}

.btn-ghost,
.btn.ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid rgba(0, 71, 171, 0.25);
}

.btn-outline {
  border: 1px solid var(--color-gold);
  color: var(--color-ink);
  background: #fff7d6;
}

.btn-secondary {
  background: var(--color-ink);
  color: #fff;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.inline-form {
  display: inline;
  margin: 0;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
  display: block;
}

.supporting-text {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0;
}

.empty-hint {
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  background: rgba(12, 27, 51, 0.04);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}

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

.page-shell {
  padding: 2rem clamp(1rem, 5vw, 4rem);
  min-height: calc(100vh - 120px);
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 500;
}

.flash.success {
  background: rgba(27, 164, 112, 0.15);
  color: #0b6b4d;
}

.flash.error {
  background: rgba(228, 45, 73, 0.15);
  color: #90232f;
}

.auth-card,
.dashboard-card,
.table-card,
.gallery-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

.auth-switch {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.4rem;
  background: rgba(0, 71, 171, 0.08);
  border-radius: var(--radius-pill);
  margin: 1.5rem 0 1rem;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-tab.active {
  background: #fff;
  color: var(--color-primary);
  box-shadow: var(--shadow-card);
}

.auth-panel[hidden] {
  display: none;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid.metrics {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.export-panel {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.export-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.export-form {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
}

.export-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
}

.export-form select {
  min-width: 200px;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(12, 27, 51, 0.15);
  font-size: 0.95rem;
}

.metric-tile {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 71, 171, 0.08), rgba(255, 204, 0, 0.15));
}

.metric-title {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0 0 0.5rem;
}

.metric-value {
  font-size: 2rem;
  font-family: "Playfair Display", serif;
  margin: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(12, 27, 51, 0.08);
}

.table.table--compact th,
.table.table--compact td {
  padding: 0.6rem 0.6rem;
  font-size: 0.85rem;
}

.table.table--compact .table-action-stack {
  gap: 0.25rem;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.table-actions {
  text-align: right;
}

.table-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.category-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category-stack details summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
}

.category-stack ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-bar {
  margin: 1rem 0;
}

.filter-bar input[type="search"] {
  width: min(360px, 100%);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(12, 27, 51, 0.15);
  font-size: 0.95rem;
}

.student-assignment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.student-assignment-card {
  border: 1px solid rgba(12, 27, 51, 0.08);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.student-assignment-card summary {
  list-style: none;
  padding: 1rem 1.25rem;
  cursor: pointer;
}

.student-assignment-card summary::-webkit-details-marker {
  display: none;
}

.student-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.student-summary-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge-muted {
  background: rgba(12, 27, 51, 0.08);
  color: var(--color-ink);
}

.student-assignment-body {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.student-actions {
  display: flex;
  justify-content: flex-end;
}

.profile-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2rem;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.badge {
  padding: 0.35rem 0.85rem;
  background: rgba(0, 71, 171, 0.1);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
}

.profile-contact {
  min-width: 240px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(0, 71, 171, 0.1);
}

.profile-metrics .metric-tile {
  min-height: 140px;
}

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

.diploma-card {
  border: 1px solid rgba(12, 27, 51, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .logo-icon {
    width: 150px;
  }

  .auth-switch {
    width: 100%;
  }

  .profile-hero {
    flex-direction: column;
  }

  .profile-contact {
    width: 100%;
  }
}

.table th {
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-muted);
}

.student-card {
  background: #fff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 71, 171, 0.08);
}

.student-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.student-meta {
  margin-top: 0.4rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.catalog-card .panel-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.catalog-item {
  border: 1px solid rgba(12, 27, 51, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  background: #fff;
}

.catalog-item header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.catalog-item ul {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.catalog-item li {
  list-style: disc;
}

.catalog-item li small {
  display: block;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
}

.status-progress {
  background: rgba(255, 204, 0, 0.2);
  color: #8a6600;
}

.status-completed {
  background: rgba(27, 164, 112, 0.2);
  color: #0b6b4d;
}

.status-assigned {
  background: rgba(0, 71, 171, 0.12);
  color: var(--color-primary);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 51, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: min(90vw, 800px);
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.field input,
.field select,
.field textarea {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(12, 27, 51, 0.12);
  padding: 0.75rem;
  font-size: 0.95rem;
}

/* Ensure the subject picker shows many visible options at once. */
.field select[multiple] {
  min-height: 240px;
  overflow-y: auto;
}

.section-title {
  font-family: "Playfair Display", serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.chart-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
  }

  .main-nav {
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .page-shell {
    padding: 1.5rem;
  }

  .table th,
  .table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }
}
