@import url("./theme/tokens.css");

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(160deg, var(--bg) 0%, #fff 45%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* Big animated top banner */
.portal-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--header-ink);
  overflow: hidden;
  isolation: isolate;
}
.portal-banner--hero {
  min-height: 196px;
}
.portal-banner--compact {
  min-height: 0;
}
.portal-banner-inner--compact {
  padding-bottom: 0.55rem;
}
.portal-banner-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, #0f4c5c 0%, #0891b2 35%, #155e75 65%, #0e7490 100%);
  background-size: 220% 220%;
  animation: portal-gradient 10s ease-in-out infinite;
}
.portal-banner-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  animation: portal-shine 4.5s ease-in-out infinite;
  pointer-events: none;
}
.portal-banner-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.portal-banner-orbs .orb {
  position: absolute;
  font-size: 2rem;
  opacity: 0.2;
  animation: portal-float 6s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}
.portal-banner-orbs .orb-a { top: 8%; right: 6%; animation-delay: 0s; }
.portal-banner-orbs .orb-b { top: 42%; right: 18%; font-size: 1.5rem; animation-delay: 1.2s; }
.portal-banner-orbs .orb-c { bottom: 18%; right: 4%; animation-delay: 2.4s; }
.portal-banner-orbs .orb-d { top: 22%; right: 38%; font-size: 1.25rem; animation-delay: 3.6s; }
.portal-banner-inner {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 16px 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.portal-banner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
}
.portal-banner-hero {
  display: grid;
  gap: 14px;
}
.portal-banner-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.portal-back-btn {
  flex-shrink: 0;
  font-size: 1.2rem;
  line-height: 1;
}
.portal-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  animation: portal-pulse 3s ease-in-out infinite;
  flex-shrink: 0;
}
.portal-brand-icon--hero {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.65rem;
}
.portal-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.portal-brand-text strong {
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-brand-text small {
  opacity: 0.9;
  font-size: 0.78rem;
}
.portal-banner-copy {
  min-width: 0;
  flex: 1;
}
.portal-banner-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.88;
}
.portal-banner-title {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}
.portal-banner-rotator {
  position: relative;
  height: 1.35em;
  overflow: hidden;
  font-size: 0.92rem;
  opacity: 0.92;
}
.portal-banner-rotator span {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  opacity: 0;
  transform: translateY(8px);
  animation: portal-rotate-text 9s ease-in-out infinite;
  animation-delay: calc(var(--line-i, 0) * 3s);
}
.portal-banner-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.portal-banner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #0f4c5c;
  font-size: 0.82rem;
  font-weight: 700;
  border: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.portal-banner-btn:active {
  transform: scale(0.98);
}
.portal-banner-btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
}
.portal-banner-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 28px;
  pointer-events: none;
  z-index: 2;
}
.portal-banner-wave svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--bg);
  animation: portal-wave 8s ease-in-out infinite;
}
.portal-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@keyframes portal-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes portal-shine {
  0%, 100% { transform: translateX(-120%); }
  45%, 55% { transform: translateX(120%); }
}
@keyframes portal-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
@keyframes portal-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}
@keyframes portal-rotate-text {
  0%, 26%, 100% { opacity: 0; transform: translateY(8px); }
  4%, 22% { opacity: 1; transform: translateY(0); }
}
@keyframes portal-wave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-2%); }
}

@media (prefers-reduced-motion: reduce) {
  .portal-banner-bg,
  .portal-banner-shine,
  .portal-banner-orbs .orb,
  .portal-brand-icon,
  .portal-banner-rotator span,
  .portal-banner-wave svg {
    animation: none;
  }
  .portal-banner-rotator span:first-child {
    opacity: 1;
    position: static;
    transform: none;
  }
  .portal-banner-rotator span:not(:first-child) {
    display: none;
  }
}

.role-pill {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
}
.icon-btn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 36px; height: 36px; border-radius: 10px;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.header-signout-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.header-signout-btn:hover { background: rgba(255, 255, 255, 0.16); }

.main-content { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.wrap { display: grid; gap: 1rem; }
.card-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.hero-card {
  background: linear-gradient(135deg, var(--header) 0%, #155e75 100%);
  color: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.hero-kicker { margin: 0; opacity: 0.9; font-size: 0.9rem; }
.hero-title { margin: 0.35rem 0; font-size: 1.5rem; }
.hero-sub { margin: 0; opacity: 0.92; }

.page-title { margin: 0 0 0.35rem; font-size: 1.35rem; }
.page-lead { margin: 0 0 1rem; color: var(--muted); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.feature-card:hover { transform: translateY(-2px); }
.feature-card span { font-size: 1.6rem; display: block; margin-bottom: 0.35rem; }
.feature-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.field label { font-weight: 700; font-size: 0.9rem; }
.field input, .field select {
  width: 100%; padding: 0.65rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--cream);
}
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.75rem; }

.primary-btn, .secondary-btn {
  border: 0; border-radius: var(--radius-sm); padding: 0.7rem 1rem;
  cursor: pointer; font-weight: 700;
}
.primary-btn { background: var(--accent); color: white; width: 100%; }
.primary-btn:hover { background: var(--accent-hover); }
.secondary-btn { background: var(--cream); border: 1px solid var(--border); width: 100%; margin-top: 0.5rem; }

.banner {
  max-width: 960px; margin: 0.75rem auto 0; padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm); display: flex; justify-content: space-between; gap: 0.5rem;
}
.banner-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.banner-ok { background: var(--success-soft); color: var(--success); border: 1px solid #a7f3d0; }
.ghost-btn { border: 0; background: transparent; cursor: pointer; }

.list-stack { display: grid; gap: 0.65rem; margin-top: 0.75rem; }
.list-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.85rem;
}
.list-card-top { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.list-card-title { margin: 0; font-weight: 700; }
.list-card-meta { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }
.text-link { color: var(--accent); font-weight: 700; }

.badge {
  display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-processing, .badge-pending { background: var(--gold-soft); color: var(--warning); }
.badge-failed { background: var(--danger-soft); color: var(--danger); }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-suspended { background: var(--danger-soft); color: var(--danger); }
.badge-pending_invite { background: var(--gold-soft); color: var(--warning); }

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius-sm); overflow: hidden; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 0.55rem 0.65rem; text-align: left; font-size: 0.88rem; }
.data-table th { background: var(--cream); }

.empty-state, .loading-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-icon { font-size: 2rem; margin-bottom: 0.35rem; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 0 auto 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint, .hint-box { color: var(--muted); font-size: 0.88rem; }

/* Yajarchana-style account sign-in hub (Student | Staff tabs) */
.auth-hub { padding: 1.4rem 1.25rem 1.1rem; }
.auth-hub__head { margin-bottom: 1rem; }
.auth-hub__kicker {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.auth-hub__title { margin: 0 0 0.35rem; font-size: 1.45rem; }
.auth-hub__audience {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.auth-hub__tab {
  border: 1px solid var(--border);
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}
.auth-hub__tab.active {
  background: var(--accent-soft, #e0f2fe);
  border-color: var(--accent);
  color: var(--accent);
}
.auth-hub__panel[hidden] { display: none; }
.auth-hub__form .primary-btn,
.auth-hub__form .secondary-btn { margin-top: 0.35rem; }
.auth-hub__switch {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.auth-hub__switch a { color: var(--accent); font-weight: 700; }

.auth-hub__flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 0 0 1rem;
}
.auth-hub__flow-btn {
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
}
.auth-hub__flow-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.auth-hub__staff-note {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}
.auth-hub__server-hint {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  background: #fffbeb;
  border-radius: var(--radius-sm);
  border: 1px solid #fde68a;
  font-size: 0.88rem;
}

/* Account page */
.account-page { gap: 0.85rem; }
.account-hero__main {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--header, #0f4c5c);
  background: linear-gradient(135deg, #e0f2fe 0%, #cffafe 100%);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.account-name { margin: 0 0 0.2rem; font-size: 1.25rem; }
.account-meta { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.92rem; }
.account-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.role-pill--light {
  background: var(--cream);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.account-org { margin: 0.85rem 0 0; }
.account-section .section-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.account-section .page-lead { margin-bottom: 0.85rem; }
.account-plan-name {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.quota-meter {
  height: 8px;
  background: var(--cream);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.65rem 0 0.75rem;
  border: 1px solid var(--border);
}
.quota-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #0891b2);
  border-radius: 999px;
}
.account-signout { margin-top: 0.25rem; }

/* Evaluate — chapter dropdown, stepped flow, upload tiles */
.eval-step-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.eval-step-tab {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  text-align: center;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.eval-step-tab.active {
  background: var(--accent-soft, #e0f2fe);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.eval-step-tab.done { color: var(--success); border-color: #a7f3d0; }
.eval-step-panel[hidden] { display: none !important; }
.evaluate-form .field { overflow: visible; position: relative; }
.eval-step-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
.eval-step-actions .primary-btn,
.eval-step-actions .secondary-btn { flex: 1; margin-top: 0; }
.eval-qp-detail { margin-top: 0.65rem; }
.eval-qp-detail[hidden] { display: none !important; }

.chapter-dropdown { position: relative; width: 100%; }
.chapter-dropdown-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}
.chapter-dropdown-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}
.chapter-dropdown-chevron { color: var(--muted); font-size: 0.65rem; flex-shrink: 0; }
.chapter-dropdown-panel {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 60;
  margin-top: 0.35rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 76, 92, 0.15);
  max-height: min(50vh, 320px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
}
.chapter-dropdown-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chapter-dropdown-toolbar .chapter-select-all-line {
  flex: 1;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
}
.chapter-dropdown-done {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  white-space: nowrap;
}
.upload-tiles--single {
  grid-template-columns: 1fr;
}
.upload-tile-single {
  position: relative;
  width: 100%;
}
.file-input-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.eval-submit-btn { margin-top: 0.75rem; }
.chapter-select-all-line strong { font-size: 0.78rem; font-weight: 700; }
.chapter-check-items {
  display: grid;
  gap: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}
.chapter-check-line {
  min-height: 38px;
  align-items: center;
  padding: 0.3rem 0.3rem;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  font-size: 0.76rem;
}
.chapter-check-line:active { background: var(--accent-soft, #e0f2fe); }
.chapter-check-line input[type="checkbox"],
.chapter-select-all-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent, #0891b2);
  cursor: pointer;
}
.check-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  cursor: pointer;
  user-select: none;
}
.check-line input { flex-shrink: 0; }
.check-line span { flex: 1; line-height: 1.3; font-size: 0.76rem; }
.chapter-dropdown-panel[hidden] { display: none !important; }

.choice-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.choice-tile {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--card);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choice-tile.active {
  border-color: var(--accent);
  background: var(--accent-soft, #e0f2fe);
}
.choice-tile-icon { font-size: 1.5rem; }
.choice-tile small { color: var(--muted); font-size: 0.78rem; }

.upload-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.upload-tile {
  display: grid;
  gap: 0.1rem;
  place-items: center;
  padding: 1rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  background: var(--cream);
  cursor: pointer;
  text-align: center;
}
.upload-tile:active { border-color: var(--accent); background: var(--accent-soft, #e0f2fe); }
.upload-tile-icon { font-size: 1.6rem; }
.upload-tile strong { font-size: 0.92rem; }
.upload-tile small { color: var(--muted); font-size: 0.75rem; }
.upload-picked { margin-top: 0.35rem; min-height: 1.1rem; }

/* Reports — big tiles by subject */
.report-subject-group { margin-bottom: 1.25rem; }
.report-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  gap: 0.75rem;
}
.report-tile {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0.85rem;
  min-height: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(15, 76, 92, 0.06);
  text-decoration: none;
  color: inherit;
}
.report-tile:active { border-color: var(--accent); }
.report-tile-subject {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.report-tile-score {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--header, #0f4c5c);
}
.report-tile-meta { font-size: 0.82rem; color: var(--muted); }
.report-tile-time { font-size: 0.72rem; color: var(--muted); margin-top: auto; }

/* Platform config — compact mobile layout, single save bar */
.platform-config-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}
.platform-config-page .config-lead { margin-bottom: 0.65rem; font-size: 0.88rem; }
.config-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 5.5rem;
}
.config-section {
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
}
.config-section-title {
  padding: 0.65rem 0.75rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
}
.config-section-title::-webkit-details-marker { display: none; }
.config-section-body { padding: 0 0.75rem 0.65rem; }
.config-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
}
.config-row:first-child { border-top: 0; }
.config-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.config-input {
  width: 100%;
  max-width: none;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  box-sizing: border-box;
}
.config-readonly {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}
.config-save-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  padding: 0.65rem 1rem;
  background: linear-gradient(to top, var(--card) 80%, transparent);
  border-top: 1px solid var(--border);
}
.config-save-all { width: 100%; margin-top: 0; }
.phone-ui .platform-config-page .config-save-bar {
  bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px));
}

.evaluate-form .radio-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0;
  font-size: 0.92rem;
}
.eval-qp-source { margin-bottom: 0.5rem; }
.teacher-resource-list { margin-top: 0.85rem; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-item {
  display: grid; place-items: center; gap: 0.1rem;
  padding: 0.45rem 0.2rem; font-size: 0.72rem; color: var(--muted);
}
.bottom-nav-item.active { color: var(--accent); font-weight: 700; }
.bottom-nav-item span { font-size: 1.1rem; }

.subpage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.report-toolbar-btn {
  width: auto;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.submission-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.submission-tile {
  display: grid;
  gap: 0.2rem;
  justify-items: center;
  text-align: center;
  min-height: 118px;
  padding: 0.9rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(15, 76, 92, 0.06);
  color: inherit;
  cursor: pointer;
}
.submission-tile--active {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), #fff);
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.16);
}
.submission-tile--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.submission-tile-icon { font-size: 1.65rem; line-height: 1; }
.submission-tile-label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--header, #0f4c5c);
}
.submission-tile-sub {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.submission-page-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: -0.25rem 0 0.75rem;
}
.submission-page-btn {
  width: auto;
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.submission-page-btn--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.report-frame-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 60vh;
}
.report-frame {
  width: 100%;
  min-height: 70vh;
  border: 0;
  background: #fff;
}
.report-frame--pdf { min-height: 72vh; }

.report-hero-banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.25rem;
  box-shadow: 0 4px 16px rgba(15, 76, 92, 0.12);
}
.report-hero-banner-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, #0f4c5c 0%, #0891b2 35%, #155e75 100%);
}
.report-hero-banner-inner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  color: var(--header-ink, #ecfdf5);
}
.report-hero-banner-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}
.report-hero-banner-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.15;
}
.report-hero-banner-score {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  opacity: 0.92;
}
.report-hero-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}
.report-hero-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}
.report-hero-chip--ghost {
  background: transparent;
}

@media (max-width: 599px) {
  .submission-tile-grid {
    grid-template-columns: 1fr;
  }
  .submission-tile {
    min-height: auto;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    text-align: left;
    align-items: center;
    column-gap: 0.75rem;
  }
  .submission-tile-icon { grid-row: 1 / span 2; }
}

.evaluate-form .field input[type="file"] {
  width: 100%;
}
.eval-status {
  margin-top: 1rem;
}
.eval-status-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.eval-status-title {
  font-size: 1rem;
}
.eval-status-pct {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.eval-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--border);
  overflow: hidden;
}
.eval-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0891b2, #06b6d4);
  transition: width 0.35s ease;
}
.eval-progress-bar--pulse {
  animation: eval-progress-pulse 1.4s ease-in-out infinite;
}
@keyframes eval-progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.eval-status-message {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.eval-status-job { margin-top: 0.5rem; }
.eval-status-completed { border-color: #a7f3d0; }
.eval-status-failed { border-color: #fecaca; }
@media (prefers-reduced-motion: reduce) {
  .eval-progress-bar--pulse {
    animation: none;
  }
}
.eval-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.eval-step {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--border);
}
.eval-step.active {
  background: var(--accent-soft, #e0f2fe);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.eval-step.done {
  background: var(--success-soft);
  color: var(--success);
  border-color: #a7f3d0;
}

.app-update-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 1rem 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}
.app-update-banner__text p {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
}
.app-upgrade-btn {
  width: auto;
  margin: 0;
  padding: 0.5rem 1rem;
}

.apk-settings-panel {
  margin: 0 1rem 0.75rem;
}
.apk-settings-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.apk-settings-panel .panel-title {
  margin: 0;
  font-size: 1.05rem;
}
.apk-settings-panel .secondary-btn {
  margin-top: 0.5rem;
}
.apk-share-box {
  margin-top: 1rem;
  padding: 1rem;
  text-align: center;
  background: var(--cream);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.apk-share-box img {
  display: block;
  margin: 0.5rem auto;
  border-radius: 8px;
  background: #fff;
}

/* Academic KB Builder (#/staff/kb) */
.kb-builder-page .page-lead {
  max-width: 36rem;
}
.kb-build-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.kb-build-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.kb-build-form .field--checkbox {
  margin-top: 0.15rem;
}
.kb-build-form .field--checkbox label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.35;
  cursor: pointer;
}
.kb-build-form .field--checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent, #0891b2);
}
.kb-org-options textarea {
  width: 100%;
  min-height: 2.5rem;
  font-family: inherit;
  font-size: 0.9rem;
}
.kb-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.25rem;
}
.choice-tiles--inline {
  margin-bottom: 0;
}
.kb-progress {
  margin-bottom: 1rem;
}
.kb-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.kb-progress-meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.kb-progress-detail {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}
.kb-error {
  margin: 0.5rem 0 0;
  color: var(--danger, #b91c1c);
  font-size: 0.88rem;
}
.kb-jobs-list {
  margin-top: 0.5rem;
}
.kb-job-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.kb-job-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--cream);
  color: var(--muted);
}
.kb-job--pending,
.kb-job--processing {
  background: var(--accent-soft, #e0f2fe);
  color: var(--accent, #0e7490);
}
.kb-job--completed {
  background: #dcfce7;
  color: #166534;
}
.kb-job--failed {
  background: #fee2e2;
  color: #991b1b;
}
.kb-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.kb-badge--pending,
.kb-badge--processing {
  background: var(--accent-soft, #e0f2fe);
  color: var(--accent, #0e7490);
}
.kb-badge--ready {
  background: #dcfce7;
  color: #166534;
}
.kb-badge--failed {
  background: #fee2e2;
  color: #991b1b;
}
.hidden {
  display: none !important;
}
.field-role-panel[hidden] {
  display: none !important;
}
.users-page select.multi-select {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border, #d4d4d8);
  background: var(--card, #fff);
}
.users-page .multi-select-hint {
  margin-bottom: 0.75rem;
}
.teachers-page .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.teachers-page .nested-panel {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle, #f8fafc);
  border-radius: var(--radius-sm);
}
.users-page .multi-select-hint kbd {
  font-size: 0.85em;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
}
@media (max-width: 520px) {
  .kb-build-form .field-row {
    grid-template-columns: 1fr;
  }
}

.kb-map-open {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: #0f4c5c;
  color: #fff;
  font-weight: 650;
  white-space: nowrap;
}
.kb-map-page {
  max-width: none;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0.55rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #f8fafc;
  overflow: hidden;
}
html.kb-map-view,
html.kb-map-view body,
html.kb-map-view #root,
html.kb-map-view .app-shell,
html.kb-map-view .main-content {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
html.kb-map-view .portal-banner,
html.kb-map-view .bottom-nav { display: none; }
html.kb-map-view .main-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
.kb-map-page:fullscreen {
  width: 100%;
  height: 100%;
  background: #f8fafc;
}
.kb-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  align-items: flex-end;
  flex-shrink: 0;
}
.kb-map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.kb-map-controls select,
.kb-map-reset {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
}
.kb-map-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  flex: 1;
  min-height: 0;
}
.kb-map-stage {
  position: relative;
  background:
    radial-gradient(circle at 50% 45%, rgba(8, 145, 178, 0.16), transparent 42%),
    linear-gradient(180deg, #f8fafc, #eef6f8);
  border: 1px solid #dbe4ea;
  border-radius: 18px;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  touch-action: none;
}
.kb-map-svg { width: 100%; height: 100%; display: block; cursor: grab; }
.kb-map-bg { fill: transparent; }
.kb-edge { stroke: #94a3b8; stroke-width: 2.5; fill: none; }
.kb-edge--tree { stroke: #94a3b8; stroke-width: 3; }
.kb-map-svg.is-hovering .kb-edge { opacity: 0.12; }
.kb-map-svg.is-hovering .kb-edge.is-lit { opacity: 1; stroke-width: 2.4; }
.kb-edge--prerequisite { stroke: #0f766e; }
.kb-edge--depends_on { stroke: #b45309; }
.kb-edge--related { stroke: #0369a1; }
.kb-node { cursor: pointer; }
.kb-node--gap { opacity: 0; pointer-events: none; }
.kb-map-svg.is-hovering .kb-node--gap.is-lit { opacity: 1; pointer-events: none; }
.kb-map-page .page-title { margin-bottom: 0.15rem; }
.kb-map-page .page-lead { margin: 0; }
.kb-map-svg.is-hovering .kb-node { opacity: 0.28; transition: opacity 0.16s ease; }
.kb-map-svg.is-hovering .kb-node.is-lit { opacity: 1; }
.kb-map-svg.is-hovering .kb-node--gap:not(.is-lit) { opacity: 0; }
.kb-map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 0.75rem;
  color: #334155;
}
.kb-leg { background: rgba(255,255,255,0.9); border-radius: 999px; padding: 0.15rem 0.5rem; }
.kb-leg--pre { box-shadow: inset 0 -2px 0 #0f766e; }
.kb-leg--dep { box-shadow: inset 0 -2px 0 #b45309; }
.kb-leg--rel { box-shadow: inset 0 -2px 0 #0369a1; }
.kb-leg--gap { box-shadow: inset 0 -2px 0 #94a3b8; }
.kb-map-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(380px, 92vw);
  background: #fff;
  border: 1px solid #dbe4ea;
  border-radius: 18px;
  padding: 0.9rem 1rem 1.2rem;
  overflow: auto;
  z-index: 2;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}
.kb-map-panel h2 { margin: 0.2rem 0 0.5rem; font-size: 1.45rem; }
.kb-map-hook {
  background: #ecfeff;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  margin: 0.4rem 0 0.7rem;
  font-size: 1.05rem;
}
.kb-map-try { margin-bottom: 0; }
.kb-map-panel h3 { margin: 0.8rem 0 0.25rem; font-size: 0.92rem; }
.kb-map-kicker { margin: 0; color: #64748b; font-size: 0.82rem; }
.kb-map-figure img { width: 100%; border-radius: 12px; background: #f8fafc; }
.kb-map-rubric { margin-top: 0.8rem; padding-top: 0.6rem; border-top: 1px solid #e2e8f0; }
.kb-map-close, .kb-map-error { margin-top: 0.4rem; }
.kb-map-close {
  border: 0;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.kb-map-error { color: #b91c1c; }
@media (max-width: 860px) {
  .kb-map-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 46dvh;
  }
}

