@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Playfair+Display:wght@700&display=swap');

:root {
  --ink: #111827;
  --navy: #10172c;
  --panel: #19223b;
  --blue: #606cf5;
  --gold: #f6c960;
  --muted: #9daac4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Manrope, sans-serif;
  background: #0e1425;
  color: #eef3ff;
}

.sidebar {
  position: fixed;
  width: 250px;
  inset: 0 auto 0 0;
  padding: 32px 18px;
  background: #121a30;
  border-right: 1px solid #293450;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  display: block;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 1px;
}

.brand span {
  color: var(--gold);
}

.user-name {
  margin: 40px 10px 22px;
  font-weight: 700;
}

.user-name small,
.list small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 3px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  color: #bdc8df;
  text-decoration: none;
  border-radius: 9px;
  padding: 11px 12px;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: #24304c;
  color: #fff;
}

.main {
  margin-left: 250px;
  min-height: 100vh;
  padding: 32px max(4vw, 32px);
}

.topbar,
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 28px;
  margin: 0;
  font-weight: 800;
}

.topbar span {
  color: var(--muted);
  font-size: 13px;
}

.live-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(25, 34, 59, 0.9);
  border: 1px solid #2f4068;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.live-badge-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #31e36d;
  box-shadow: 0 0 8px #31e36d;
}

.hero {
  padding: 34px;
  border-radius: 20px;
  background: linear-gradient(130deg, #2a356c, #624a94);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.hero h2 {
  font-family: 'Playfair Display', serif;
  font-size: 31px;
  margin: 7px 0;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--gold);
  font-weight: 800;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 22px 0;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid #2b3858;
  border-radius: 15px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 36px;
  display: block;
  margin-top: 10px;
}

.panel h3 {
  font-size: 18px;
  margin: 0 0 17px;
  font-weight: 800;
}

.quick,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick a,
.chip-list span {
  background: #273555;
  border-radius: 8px;
  padding: 11px 14px;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.quick a:hover {
  background: #334670;
  transform: translateY(-1px);
}

.chip-list small {
  display: block;
  color: var(--gold);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) 1.22fr;
  gap: 20px;
}

.stack {
  display: grid;
  gap: 15px;
}

.stack label,
.form-grid label {
  display: grid;
  gap: 7px;
  color: #c9d4ea;
  font-size: 13px;
}

.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 9px !important;
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #394767;
  border-radius: 8px;
  background: #10182e;
  color: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(246, 201, 96, 0.16);
}

textarea {
  min-height: 92px;
}

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

.list {
  display: grid;
  gap: 9px;
}

.list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 11px;
  background: #222e4c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.15s;
}

.list article:hover {
  border-color: rgba(246, 201, 96, 0.35);
}

.inline {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  font-weight: 700;
}

.table {
  margin: 0;
}

.fullscreen {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 22, 43, 0.88);
  color: #fff;
  border-radius: 999px;
  padding: 0.58rem 0.9rem;
  font: 700 12px/1.1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, border-color 0.15s;
}

.fullscreen:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 430px;
  align-items: center;
  gap: 10vw;
  padding: 8vw;
  background: radial-gradient(circle at 15% 80%, #4c3b75, transparent 40%), #0d1324;
}

.login-copy h1 {
  font: 60px 'Playfair Display', serif;
  max-width: 520px;
}

.login-copy p {
  color: #c5cde1;
  max-width: 430px;
}

.login-card {
  padding: 35px;
  background: #fff;
  color: #17213a;
  border-radius: 18px;
  display: grid;
  gap: 15px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.login-card h2,
.login-card p {
  margin: 0;
}

.login-card label {
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  margin-top: 6px;
  background: #f6f8fc;
  color: #111;
  border-color: #d9dfed;
}

.login-card small {
  color: #667085;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-eye {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  cursor: pointer;
}

.password-eye:hover,
.password-eye:focus {
  background: #e9edf5;
  color: #111827;
  outline: none;
}

.password-eye svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.status-select {
  min-width: 112px;
  padding: 7px 30px 7px 10px;
  font-size: 12px;
}

.form-note {
  color: var(--muted);
  font-size: 12px;
}

.assigned-admins {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.assigned-admins span {
  font-size: 11px;
  background: #33415f;
  border-radius: 999px;
  padding: 3px 8px;
  color: #dce6fa;
}

.reset-confirm-modal {
  background: #ffffff;
  color: #17213a;
  border-radius: 14px;
  border: 0;
}

.reset-confirm-modal .modal-header,
.reset-confirm-modal .modal-footer {
  border-color: #e5e7eb;
}

.reset-confirm-modal .modal-title {
  color: #111827;
  font-weight: 700;
}

.reset-confirm-modal .modal-body {
  color: #374151;
  font-size: 15px;
}

.reset-confirm-modal .modal-body strong {
  color: #111827;
}

.reset-confirm-modal .btn-close {
  opacity: 0.7;
}

/* Top-layer Popover Toast Notifications (modern-web-guidance compliant) */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.quiz-toast {
  position: relative;
  inset: auto;
  margin: 0;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 270px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(18, 28, 52, 0.96);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  transition: opacity 0.22s ease, transform 0.22s ease, display 0.22s ease allow-discrete;
}

.quiz-toast[popover]:is(:popover-open, .\:popover-open) {
  position: fixed;
  inset: auto 20px 20px auto;
  display: flex;
}

.quiz-toast + .quiz-toast {
  margin-top: 8px;
}

@supports (top: calc(1px * sibling-index())) {
  .quiz-toast[popover]:is(:popover-open, .\:popover-open) {
    bottom: calc(20px + (sibling-index() - 1) * 58px);
  }
}

.quiz-toast-success {
  border-left: 4px solid #4ade80;
}

.quiz-toast-warning {
  border-left: 4px solid #f6c960;
}

.quiz-toast-danger {
  border-left: 4px solid #fb7185;
}

.quiz-toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

.quiz-toast-close {
  border: 0;
  background: transparent;
  color: #9daac4;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.quiz-toast-close:hover {
  color: #fff;
}

.theme-modal {
  background: #121a30;
  color: #eef3ff;
  border: 1px solid #2b3858;
  border-radius: 14px;
}

.theme-modal .modal-header,
.theme-modal .modal-footer {
  border-color: #293450;
}

.sub-panel {
  background: #141e36;
}

.progress {
  background-color: #10182e;
}

/* ==========================================================================
   Light Theme Overrides (html[data-theme="light"])
   ========================================================================== */
html[data-theme="light"] {
  --ink: #0f172a;
  --navy: #f8fafc;
  --panel: #ffffff;
  --blue: #4f46e5;
  --gold: #b45309;
  --muted: #475569;
}

html[data-theme="light"] body {
  background: #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right-color: #e2e8f0;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .brand {
  color: #0f172a;
}

html[data-theme="light"] .brand span {
  color: #d97706;
}

html[data-theme="light"] .user-name {
  color: #0f172a;
}

html[data-theme="light"] .user-name small,
html[data-theme="light"] .list small {
  color: #475569;
}

html[data-theme="light"] .sidebar nav a {
  color: #334155;
  font-weight: 600;
}

html[data-theme="light"] .sidebar nav a:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .live-badge-pill {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .hero {
  background: linear-gradient(130deg, #e0e7ff, #ede9fe);
  border: 1px solid #c7d2fe;
  color: #0f172a;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.1);
}

html[data-theme="light"] .hero h2 {
  color: #0f172a;
}

html[data-theme="light"] .hero p {
  color: #334155;
}

html[data-theme="light"] .hero .eyebrow,
html[data-theme="light"] .eyebrow {
  color: #4338ca;
}

html[data-theme="light"] .stat-card,
html[data-theme="light"] .panel {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .sub-panel {
  background: #f8fafc;
  border-color: #cbd5e1;
}

html[data-theme="light"] .progress {
  background-color: #e2e8f0;
}

html[data-theme="light"] .stat-card span {
  color: #475569;
  font-weight: 600;
}

html[data-theme="light"] .stat-card strong {
  color: #0f172a;
}

html[data-theme="light"] .quick a,
html[data-theme="light"] .chip-list span {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 600;
}

html[data-theme="light"] .quick a:hover {
  background: #e2e8f0;
  color: #0f172a;
}

html[data-theme="light"] .chip-list small {
  color: #b45309;
  font-weight: 700;
}

html[data-theme="light"] .stack label,
html[data-theme="light"] .form-grid label {
  color: #1e293b;
  font-weight: 600;
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .form-control {
  background: #ffffff;
  border-color: #94a3b8;
  color: #0f172a;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #64748b;
}

html[data-theme="light"] input:disabled,
html[data-theme="light"] textarea:disabled,
html[data-theme="light"] select:disabled {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  opacity: 1;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] .form-control:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

html[data-theme="light"] .list article {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

html[data-theme="light"] .list article:hover {
  border-color: #64748b;
  background: #f1f5f9;
}

html[data-theme="light"] .assigned-admins span {
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
}

html[data-theme="light"] .fullscreen {
  background: #ffffff;
  color: #0f172a;
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .fullscreen:hover {
  border-color: #4f46e5;
}

html[data-theme="light"] .login-shell {
  background: radial-gradient(circle at 15% 80%, #e0e7ff, transparent 45%), #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .login-copy p {
  color: #334155;
}

html[data-theme="light"] .quiz-toast {
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.15);
}

html[data-theme="light"] .quiz-toast-close {
  color: #64748b;
}

html[data-theme="light"] .quiz-toast-close:hover {
  color: #0f172a;
}

html[data-theme="light"] .theme-modal,
html[data-theme="light"] .modal-content.bg-dark {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .theme-modal .modal-header,
html[data-theme="light"] .theme-modal .modal-footer,
html[data-theme="light"] .modal-content.bg-dark .modal-header,
html[data-theme="light"] .modal-content.bg-dark .modal-footer {
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .theme-modal .btn-close-white,
html[data-theme="light"] .modal-content.bg-dark .btn-close-white {
  filter: none;
}

html[data-theme="light"] .table-dark {
  --bs-table-color: #0f172a;
  --bs-table-bg: #ffffff;
  --bs-table-border-color: #cbd5e1;
  --bs-table-striped-bg: #f8fafc;
  --bs-table-striped-color: #0f172a;
  --bs-table-hover-bg: #f1f5f9;
  --bs-table-hover-color: #0f172a;
  color: #0f172a;
  border-color: #cbd5e1;
}

html[data-theme="light"] .text-warning {
  color: #b45309 !important;
}

html[data-theme="light"] .text-muted {
  color: #475569 !important;
}

html[data-theme="light"] .text-light {
  color: #1e293b !important;
}

html[data-theme="light"] code {
  color: #be185d;
  background: #fce7f3;
  padding: 1px 5px;
  border-radius: 4px;
}

html[data-theme="light"] .btn-outline-light {
  --bs-btn-color: #1e293b;
  --bs-btn-bg: #ffffff;
  --bs-btn-border-color: #94a3b8;
  --bs-btn-hover-color: #0f172a;
  --bs-btn-hover-bg: #f1f5f9;
  --bs-btn-hover-border-color: #4f46e5;
  --bs-btn-active-color: #0f172a;
  --bs-btn-active-bg: #e2e8f0;
  --bs-btn-disabled-color: #64748b;
  --bs-btn-disabled-border-color: #cbd5e1;
  color: #1e293b;
  background-color: #ffffff;
  border-color: #94a3b8;
}

html[data-theme="light"] .btn-outline-light:hover:not(:disabled) {
  color: #0f172a;
  background-color: #f1f5f9;
  border-color: #4f46e5;
}

html[data-theme="light"] .btn-outline-info {
  --bs-btn-color: #0369a1;
  --bs-btn-border-color: #0284c7;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #0284c7;
  --bs-btn-hover-border-color: #0284c7;
  color: #0369a1;
  border-color: #0284c7;
}

html[data-theme="light"] .btn-outline-info:hover:not(:disabled) {
  color: #ffffff;
  background-color: #0284c7;
  border-color: #0284c7;
}

html[data-theme="light"] .btn-outline-warning {
  --bs-btn-color: #b45309;
  --bs-btn-border-color: #d97706;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #d97706;
  --bs-btn-hover-border-color: #d97706;
  color: #b45309;
  border-color: #d97706;
}

html[data-theme="light"] .btn-outline-warning:hover:not(:disabled) {
  color: #ffffff;
  background-color: #d97706;
  border-color: #d97706;
}

@media (max-width: 800px) {
  .sidebar {
    position: static;
    width: auto;
  }
  .main {
    margin: 0;
    padding: 20px 14px;
  }
  .card-grid,
  .two-col,
  .form-grid,
  .login-shell {
    grid-template-columns: 1fr;
  }
  .sidebar nav {
    grid-template-columns: repeat(2, 1fr);
  }
  .login-shell {
    padding: 30px;
  }
  .login-copy h1 {
    font-size: 42px;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

