* {
  box-sizing: border-box;
}

:root {
  --space-xs: 0.35rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 1.75rem;
  --space-xl: 2.5rem;
  --space-xxl: 3rem;
  --color-primary: #1d3557;
  --color-accent: #457b9d;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #f7f7fb;
  color: #222;
  line-height: 1.5;
}

.app-header {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-brand a {
  color: #fff;
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.header-nav a {
  color: #dfe7f5;
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
}

.header-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-pill {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}

.header-session {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-user {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.header-user-name {
  font-weight: 600;
}

.header-user-role {
  font-size: 0.9rem;
  color: #cfd8ec;
}

.app-header .btn,
.app-header .btn.ghost {
  border-radius: 999px;
}

.app-header .btn.ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
}

.app-header .btn.ghost:hover {
  background: #fff;
  color: var(--color-primary);
}

main {
  padding: var(--space-xxl) var(--space-xl);
  max-width: 1280px;
  margin: var(--space-lg) auto var(--space-xl);
}

section {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

section + section {
  margin-top: var(--space-lg);
}

.card {
  max-width: 420px;
  margin: 0 auto;
}

label {
  display: block;
  margin-bottom: 1rem;
}

input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccd;
  border-radius: 4px;
}

button,
.btn {
  background: #457b9d;
  color: #fff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-weight: 600;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

button:hover,
.btn:hover {
  background: #356080;
}

.btn.ghost {
  background: transparent;
  color: #1d3557;
  border: 1px solid #1d3557;
}

.btn.ghost:hover {
  background: #1d3557;
  color: #fff;
}

.error {
  color: #d00000;
}

.success {
  color: #2b9348;
  font-weight: 600;
}

.helper-text {
  color: #555;
  font-size: 0.9rem;
}

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

.action-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.hidden {
  display: none;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccd;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
}

th {
  background: #f0f4f8;
}

footer {
  text-align: center;
  padding: 1rem 0 2rem;
  color: #666;
}

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

.inline-form button {
  margin: 0;
}

section.teacher-dashboard {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.teacher-dashboard {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.teacher-menu {
  width: 260px;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 18px rgba(29, 53, 87, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.teacher-status-summary {
  background: #f1f5fb;
  border-radius: 12px;
  padding: 1rem;
}

.teacher-status-summary h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #1d3557;
}

.teacher-status-summary p {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-approved {
  background: #e8f5e9;
  color: #1b5e20;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-awaiting_approval {
  background: #fff3cd;
  color: #856404;
}

.status-pending_school {
  background: #ffe4e1;
  color: #a83232;
}

.status-rejected {
  background: #fdecea;
  color: #a61b1b;
}

.menu-link {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  color: #1d3557;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.menu-link:hover {
  background: #f0f4f8;
}

.menu-link.active {
  background: #1d3557;
  color: #fff;
  border-color: #1d3557;
}

.menu-link.disabled {
  color: #999;
  background: #f3f3f6;
  pointer-events: none;
}

.teacher-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.teacher-panel {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.teacher-panel h3 {
  margin-top: 0;
}

.teacher-panel .helper {
  margin-top: 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

.teacher-panel .section-header h3 {
  margin: 0 0 0.35rem;
}

.teacher-panel .section-header p {
  margin: 0 0 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: #edf2fb;
  color: #1d3557;
  font-size: 0.8rem;
  font-weight: 600;
}

.teacher-inline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.teacher-inline-actions button,
.teacher-inline-actions .btn {
  flex: 1;
  min-width: 140px;
}

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

.modal-layer[hidden] {
  display: none;
}

.modal-layer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-panel {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.text-muted {
  color: #666;
  font-size: 0.9rem;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.table-actions .btn,
.table-actions button {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.btn.danger,
button.danger {
  background: #d90429;
}

.btn.danger:hover,
button.danger:hover {
  background: #b1001f;
}

.teacher-alert-list {
  margin: 0;
  padding-left: 1.2rem;
}

.teacher-alert-list li + li {
  margin-top: 0.4rem;
}

@media (max-width: 960px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-session {
    width: 100%;
    justify-content: space-between;
  }

  main {
    padding: 2.5rem 1.5rem;
  }

  section {
    padding: 1.5rem;
  }

  .teacher-dashboard {
    flex-direction: column;
  }

  .teacher-menu {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .header-session {
    flex-direction: column;
    align-items: flex-start;
  }

  main {
    padding: 2rem 1rem;
    margin: var(--space-md) auto var(--space-lg);
  }

  section {
    padding: 1.25rem;
  }
}
