:root {
  color-scheme: light;
  --wmcgw-navy: #0a1628;
  --wmcgw-navy-deep: #050a14;
  --wmcgw-navy-soft: #1e3a52;
  --wmcgw-teal: #2b5e7d;
  --wmcgw-teal-light: #3d7394;
  --wmcgw-teal-muted: #5a7d9a;
  --wmcgw-gold: #c9a227;
  --wmcgw-gold-dark: #a6851f;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #d4dde8;
  --text: var(--wmcgw-navy);
  --muted: var(--wmcgw-teal-muted);
  --link: var(--wmcgw-teal);
  --danger: #b91c1c;
  --success: #2d6a4f;
  --warning: var(--wmcgw-gold-dark);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 24px;
  background:
    radial-gradient(720px 440px at 12% 18%, rgba(201, 162, 39, 0.14), transparent 58%),
    radial-gradient(640px 420px at 88% 82%, rgba(43, 94, 125, 0.28), transparent 55%),
    linear-gradient(145deg, var(--wmcgw-navy-deep) 0%, var(--wmcgw-navy) 42%, var(--wmcgw-navy-soft) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--wmcgw-gold);
  border-radius: 18px;
  padding: 28px 24px 22px;
  box-shadow: 0 20px 60px rgba(10, 22, 40, 0.14);
}

.login-logo {
  display: block;
  width: 120px;
  height: auto;
  max-height: 100px;
  margin: 0 auto 18px;
  object-fit: contain;
}

.login-title {
  margin: 0 0 18px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.field-group {
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  align-items: stretch;
}

.input-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 0;
  font: inherit;
  font-size: 16px;
}

.input-row .side-btn {
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  color: #374151;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.input-row .side-btn:hover {
  background: #e5e7eb;
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.login-actions .help-link {
  font-size: 13px;
}

.btn-login {
  min-width: 88px;
  min-height: 44px;
  height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--wmcgw-teal) 0%, #1e4a63 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(43, 94, 125, 0.35);
}

.btn-login:hover {
  filter: brightness(1.05);
}

.login-footer {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.login-footer a {
  color: var(--wmcgw-gold-light, #ddbc5a);
}

.alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid transparent;
  font-size: 13px;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--success);
}

.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.app-header {
  background: linear-gradient(135deg, var(--wmcgw-navy) 0%, var(--wmcgw-navy-soft) 100%);
  border-bottom: 2px solid var(--wmcgw-gold);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.app-brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  word-break: break-word;
  color: #ffffff;
}

.app-brand p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  word-break: break-word;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
  word-break: break-word;
}

.app-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.admin-cohort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #d1d5db;
}

.admin-cohort-form label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.admin-cohort-form select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 14px;
}

.admin-cohort-meta {
  font-size: 13px;
  color: var(--muted);
}

.cohort-picker-form {
  display: grid;
  gap: 10px;
}

.cohort-picker-btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  background: #f9fafb;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.cohort-picker-btn:hover {
  background: #f3f4f6;
}

.cohort-picker-btn strong {
  display: block;
  margin-bottom: 4px;
}

.cohort-picker-btn span {
  font-size: 12px;
  color: var(--muted);
}

.admin-subnav {
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
}

.admin-subnav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
  list-style: none;
}

.admin-subnav-list a {
  display: inline-block;
  padding: 12px 14px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.admin-subnav-list a:hover {
  color: var(--link);
  text-decoration: none;
}

.admin-subnav-list a.is-active {
  color: #111827;
  border-bottom-color: #111827;
}

.admin-cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-card {
  display: block;
  padding: 20px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: inherit;
  text-decoration: none;
}

.admin-card:hover {
  border-color: #9ca3af;
  text-decoration: none;
}

.admin-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.admin-card p {
  margin: 0 0 10px;
  color: #374151;
}

.admin-card-meta {
  font-size: 13px;
  color: var(--muted);
}

.admin-card-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
}

.lessons-list {
  display: grid;
  gap: 10px;
}

.lessons-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.lessons-list-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.lessons-list-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.form-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.lesson-delete-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.lesson-delete-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.lesson-unit {
  margin-bottom: 18px;
}

.lesson-unit-header h2 {
  margin: 0 0 4px;
}

.lesson-unit-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.lesson-unit-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.lesson-window-banner {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.lesson-window-open {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.lesson-window-not_started {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.lesson-window-closed {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.lesson-window-closed-msg {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.form-fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid #e5e7eb;
}

.form-fieldset legend {
  padding: 0 6px;
  font-weight: 600;
}

.fieldset-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.assignment-example-field {
  display: grid;
  gap: 10px;
}

.assignment-example-field .field-label {
  font-weight: 600;
}

.assignment-example-current {
  margin: 0;
  font-size: 14px;
}

.form-row-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.panel {
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 20px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
}

.submissions-count {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.submissions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.submissions-search {
  flex: 1 1 220px;
  display: grid;
  gap: 6px;
  margin: 0;
}

.submissions-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 16px;
}

.submissions-filter {
  display: grid;
  gap: 6px;
  margin: 0;
  font-weight: 600;
  font-size: 13px;
}

.submissions-filter select {
  min-width: 160px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 16px;
}

.submissions-empty {
  margin: 0 0 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--muted);
  font-size: 13px;
}

.submissions-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.submissions-page-info {
  font-size: 13px;
  color: var(--muted);
  min-width: 7rem;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.submission-row[hidden] {
  display: none;
}

.panel p,
.panel li {
  color: #374151;
}

.content-block {
  white-space: pre-wrap;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 16px;
}

.form-grid textarea {
  min-height: 120px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #111827;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: #f9fafb;
}

.btn-primary {
  background: #111827;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1f2937;
}

.btn-danger {
  border-color: #b91c1c;
  color: #b91c1c;
}

.meta-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.meta-list strong {
  text-align: right;
  word-break: break-word;
}

.meta-list span {
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-verified {
  background: #dcfce7;
  color: #166534;
}

.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-none {
  background: #e5e7eb;
  color: #374151;
}

.upload-box {
  border: 1px dashed #94a3b8;
  padding: 18px;
  background: #f8fafc;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bulk-grade-panel {
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.bulk-grade-header h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.bulk-grade-header p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.bulk-grade-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.bulk-grade-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}

.bulk-grade-form input,
.bulk-grade-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 16px;
}

.bulk-grade-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.bulk-grade-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
}

.bulk-grade-checkbox input {
  width: auto;
  min-height: auto;
}

.pdf-viewer-modal[hidden] {
  display: none !important;
}

body.pdf-viewer-open {
  overflow: hidden;
}

.pdf-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.pdf-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.pdf-viewer-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1100px, calc(100vw - 24px));
  height: min(88vh, 900px);
  margin: 6vh auto 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.pdf-viewer-header h3 {
  margin: 0;
  font-size: 15px;
}

.pdf-viewer-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pdf-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdf-viewer-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #f8fafc;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 14px;
}

.stat-card strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .login-page {
    justify-content: flex-start;
    padding-top: 20px;
  }

  .login-card {
    padding: 22px 16px 18px;
  }

  .login-title {
    font-size: 14px;
  }

  .login-actions,
  .app-header,
  .login-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .login-actions .help-link {
    text-align: center;
  }

  .btn-login,
  .login-actions .btn-login {
    width: 100%;
  }

  .login-footer {
    gap: 8px;
    text-align: center;
  }

  .app-header {
    padding: 12px 14px;
  }

  .app-brand {
    width: 100%;
  }

  .app-brand img {
    width: 42px;
    height: 42px;
  }

  .app-brand h1 {
    font-size: 16px;
  }

  .app-nav {
    width: 100%;
    justify-content: space-between;
  }

  .app-main {
    padding: 16px 12px 32px;
  }

  .panel {
    padding: 16px 14px;
  }

  .meta-list li {
    flex-direction: column;
    gap: 4px;
  }

  .meta-list strong {
    text-align: left;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .upload-box input[type="file"] {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .submissions-table thead {
    display: none;
  }

  .submissions-table,
  .submissions-table tbody,
  .submissions-table tr,
  .submissions-table td {
    display: block;
    width: 100%;
  }

  .submissions-table tr {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #d1d5db;
    background: #ffffff;
  }

  .submissions-table td {
    padding: 0 0 12px;
    border-bottom: 0;
  }

  .submissions-table td:last-child {
    padding-bottom: 0;
  }

  .submissions-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
  }

  .submission-row[hidden] {
    display: none !important;
  }

  .bulk-grade-form {
    grid-template-columns: 1fr;
  }

  .pdf-viewer-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    margin: 6px auto 0;
  }

  .pdf-viewer-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.publish-status-box {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  background: #f9fafb;
}

.publish-status-draft {
  border-color: #f59e0b;
  background: #fffbeb;
}

.publish-status-live {
  border-color: #10b981;
  background: #ecfdf5;
}

.lesson-status-badge {
  font-weight: 600;
}

.lesson-status-draft {
  color: #b45309;
}

.lesson-status-published {
  color: #047857;
}
