/*
  AxisQuest Management - parent/teacher portal. Same tokens/laws as site.css
  (--bg, --text, --accent, --divider, --neutral-*, --font-heading), scoped to
  classes only used under /Management so the in-game app CSS stays untouched.
  Plain dashboard-app shell on purpose - no HP bars, no bottom tab nav, no
  RPG framing; the audience here is a parent or teacher, not the player.
*/
/* ---- page shell: sidebar + content, same structure as the design mockup ----
   Both columns are capped at exactly one viewport tall (height, not min-height) and clip
   their own overflow, so scrolling never happens at the .mgmt-page level - each column
   scrolls (or doesn't) independently instead of dragging the other along with it. */
.mgmt-page { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.mgmt-sidebar {
  background: var(--neutral-100); border-right: 2px solid var(--divider);
  padding: 22px 16px; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}
.mgmt-sidebar .brand { font-family: var(--font-heading); font-weight: 800; font-size: 19px; letter-spacing: -0.01em; flex: none; }
.mgmt-sidebar .kicker { margin: 3px 0 22px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-secondary); flex: none; }
/* flex:1 + min-height:0 is what lets this scroll on its own once the menu items
   outgrow the space left between the kicker above and .foot below - .foot never moves. */
.mgmt-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; }
.mgmt-nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px; font-weight: 600; font-size: 13.5px;
  text-decoration: none; color: var(--text);
}
.mgmt-nav-item svg { width: 19px; height: 19px; flex: none; }
.mgmt-nav-item.active { background: var(--text); color: var(--bg); }
.mgmt-nav-item.disabled { color: var(--neutral-400); pointer-events: none; }
.mgmt-sidebar .foot { display: flex; flex-direction: column; gap: 3px; padding-top: 14px; border-top: 2px solid var(--divider); flex: none; }
.mgmt-play-link {
  display: flex; align-items: center; gap: 11px; padding: 10px; font-weight: 700; font-size: 13.5px;
  color: var(--accent); text-decoration: none;
}
.mgmt-play-link svg { width: 19px; height: 19px; flex: none; }
.mgmt-logout-btn {
  display: flex; align-items: center; gap: 11px; padding: 10px; font-weight: 600; font-size: 13.5px;
  color: var(--text-secondary); background: none; border: none; cursor: pointer; width: 100%; text-align: left; font-family: inherit;
}
.mgmt-logout-btn svg { width: 18px; height: 18px; flex: none; }

/* Capped at one viewport tall too, same as .mgmt-sidebar - .mgmt-topbar (flex:none) then
   never scrolls, and .mgmt-content (flex:1 + min-height:0 below) is the only thing inside
   that does, independently of the sidebar's own scroll. */
.mgmt-main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.mgmt-topbar {
  display: flex; align-items: center; gap: 20px; padding: 16px 28px;
  border-bottom: 2px solid var(--divider); background: var(--bg); flex: none;
}
.mgmt-topbar .titles { margin-right: auto; }
.mgmt-topbar .crumb { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 2px; }
.mgmt-topbar h1 { margin: 0; font-weight: 800; font-size: 21px; letter-spacing: -0.01em; }
.mgmt-topbar .search-wrap { position: relative; }
.mgmt-topbar .search {
  display: flex; align-items: center; gap: 8px; border: 2px solid var(--divider);
  padding: 9px 12px; width: 240px; color: var(--text-secondary);
}
.mgmt-topbar .search svg { width: 16px; height: 16px; flex: none; }
.mgmt-topbar .search input {
  border: none; outline: none; background: none; padding: 0; width: 100%;
  font-family: var(--font-heading); font-size: 13px; color: var(--text); opacity: 1;
}
.mgmt-topbar .search input::placeholder { color: var(--text-secondary); }
.mgmt-topbar .search input:disabled { cursor: default; }
.mgmt-search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; width: 360px; max-width: calc(100vw - 32px);
  max-height: 420px; overflow-y: auto; background: var(--bg); border: 2px solid var(--divider); z-index: 50;
}
.mgmt-search-group-label {
  padding: 10px 14px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-secondary);
}
.mgmt-search-item {
  display: block; padding: 10px 14px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--neutral-200); font-size: 12.5px;
}
.mgmt-search-item:last-child { border-bottom: none; }
.mgmt-search-item-sub { margin-top: 3px; font-size: 11px; color: var(--text-secondary); }
.mgmt-search-empty { padding: 18px 14px; text-align: center; color: var(--text-secondary); font-size: 12.5px; }
.mgmt-search-seeall {
  display: block; text-align: center; padding: 10px 14px; font-weight: 700; font-size: 12px;
  color: var(--accent); border-top: 2px solid var(--divider); text-decoration: none;
}
.mgmt-topbar .account { display: flex; align-items: center; gap: 10px; }
.mgmt-topbar .avatar {
  width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; background: var(--text); color: var(--bg);
}
.mgmt-topbar .who { line-height: 1.25; }
.mgmt-topbar .who .nm { font-weight: 700; font-size: 13px; }
.mgmt-topbar .who .rl { font-size: 11.5px; color: var(--text-secondary); }
.mgmt-topbar .account svg { width: 15px; height: 15px; color: var(--text-secondary); flex: none; }

@media (max-width: 900px) {
  .mgmt-topbar .search-wrap { display: none; }
}

/* No max-width here on purpose - .mgmt-content fills whatever's left of .mgmt-page's
   "240px sidebar + 1fr content" grid. A page that wants a narrower reading column sets its
   own max-width on something *inside* here, not on this container - stacking a cap here on
   top of a per-page cap was double-limiting the same box. */
.mgmt-content { padding: 30px 34px 60px; flex: 1; min-height: 0; overflow-y: auto; }

.mgmt-auth-wrap { max-width: 440px; margin: 60px auto; display: flex; flex-direction: column; gap: 20px; }
.mgmt-auth-wrap .brand-block { text-align: center; }
.mgmt-role-toggle { display: flex; gap: 6px; }
.mgmt-role-opt { flex: 1; padding: 12px; border: 2px solid var(--divider); text-align: center; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--bg); color: var(--text); }
.mgmt-role-opt.active { background: var(--text); color: var(--bg); }
.mgmt-role-opt input { display: none; }
.mgmt-play-note {
  display: flex; align-items: center; gap: 10px; border: 2px solid var(--divider);
  padding: 13px 15px; font-size: 12.5px; color: var(--text-secondary);
}

.mgmt-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.mgmt-stat-card { border: 2px solid var(--divider); padding: 18px 20px; }
.mgmt-stat-card .num { font-weight: 800; font-size: 30px; letter-spacing: -0.01em; }
.mgmt-stat-card .lbl { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-secondary); }

.mgmt-char-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 36px; }
.mgmt-c-card { border: 2px solid var(--divider); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.mgmt-avatar {
  width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  color: var(--accent); border: 2px solid var(--accent);
}
.mgmt-invite-card {
  border: 2px dashed var(--divider); display: flex; flex-direction: column; gap: 10px; padding: 5px;
}

.mgmt-panel { border: 2px solid var(--divider); overflow-x: auto; }
.mgmt-panel-head { padding: 14px 16px; border-bottom: 2px solid var(--divider); font-weight: 800; font-size: 14px; }
.mgmt-pend-item { padding: 13px 16px; border-bottom: 1px solid var(--neutral-200); display: flex; align-items: center; gap: 12px; }
.mgmt-pend-item:last-child { border-bottom: none; }

.mgmt-split { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
.mgmt-table { width: 100%; min-width: 480px; border-collapse: collapse; }
.mgmt-table th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-secondary); padding: 10px 16px; border-bottom: 2px solid var(--divider); }
.mgmt-table td { padding: 12px 16px; border-bottom: 1px solid var(--neutral-200); font-size: 13.5px; }
.mgmt-table tr:last-child td { border-bottom: none; }
.mgmt-invite-box { display: flex; gap: 10px; border: 2px solid var(--divider); padding: 14px; margin-bottom: 26px; align-items: center; }
.mgmt-invite-box .lbl { font-size: 12px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }

/* ---- assign exam ---- */
.mgmt-assign-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; max-width: 1100px; }
.mgmt-sec { border: 2px solid var(--divider); padding: 22px; margin-bottom: 22px; }
.mgmt-sec h3 { margin: 0 0 4px; font-weight: 800; font-size: 15px; }
.mgmt-sec .hint { margin: 0 0 16px; font-size: 12.5px; color: var(--text-secondary); }
.mgmt-chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.mgmt-pill { position: relative; padding: 9px 15px; border: 2px solid var(--divider); font-weight: 700; font-size: 13px; cursor: pointer; }
.mgmt-pill input { position: absolute; opacity: 0; pointer-events: none; }
.mgmt-pill:has(input:checked) { background: var(--text); border-color: var(--text); color: var(--accent); }
.mgmt-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mgmt-review { position: sticky; top: 16px; border: 2px solid var(--accent); padding: 20px; background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.mgmt-review .k { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.mgmt-review dl { margin: 0 0 18px; display: flex; flex-direction: column; gap: 9px; }
.mgmt-review .r { display: flex; justify-content: space-between; font-size: 13px; gap: 10px; }
.mgmt-review .r span:first-child { color: var(--text-secondary); }
.mgmt-review .r span:last-child { font-weight: 700; text-align: right; }
.mgmt-review .btn { width: 100%; justify-content: center; margin-bottom: 9px; }
.mgmt-review .btn:last-child { margin-bottom: 0; }

@media (max-width: 800px) {
  .mgmt-assign-layout { grid-template-columns: 1fr; }
  .mgmt-review { position: static; }
}

/* A "back to the list this came from" button, icon-only, docked to the right end of a page's
   own title row (see _ManagementBackButton.cshtml) - not a bottom-of-page text link. */
.btn-icon { padding: 9px; gap: 0; flex-shrink: 0; }

/* ---- aggregate Reports page: weekly accuracy trend, a plain CSS bar chart (no library) ---- */
.mgmt-trend-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; overflow-x: auto; padding-top: 8px; }
.mgmt-trend-col { flex: 1 0 32px; min-width: 32px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.mgmt-trend-bar { width: 100%; max-width: 36px; background: var(--text); min-height: 3px; }

/* ---- Settings: notification-preference rows ---- */
.mgmt-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; border-bottom: 1px solid var(--neutral-200);
}
.mgmt-toggle-row:last-child { border-bottom: none; }
.mgmt-toggle-row .lbl { font-weight: 700; font-size: 13.5px; }
.mgmt-toggle-row .hint { margin: 2px 0 0; font-size: 12px; color: var(--text-secondary); }

/* ---- notification bell (topbar) ---- */
.mgmt-notif { position: relative; }
.mgmt-notif summary {
  list-style: none; cursor: pointer; position: relative;
  width: 38px; height: 38px; border: 2px solid var(--divider);
  display: inline-flex; align-items: center; justify-content: center;
}
.mgmt-notif summary::-webkit-details-marker { display: none; }
.mgmt-notif summary svg { width: 17px; height: 17px; }
.mgmt-notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.mgmt-notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 420px;
  overflow-y: auto; background: var(--bg); border: 2px solid var(--divider); z-index: 50;
}
.mgmt-notif-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 2px solid var(--divider); font-weight: 800; font-size: 13px;
}
.mgmt-notif-markall {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 700; color: var(--accent); padding: 0;
}
.mgmt-notif-row { border-bottom: 1px solid var(--neutral-200); }
.mgmt-notif-row:last-child { border-bottom: none; }
.mgmt-notif-row.unread { background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.mgmt-notif-btn {
  display: block; width: 100%; text-align: left; padding: 12px 14px;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.mgmt-notif-msg { font-size: 12.5px; color: var(--text); line-height: 1.4; }
.mgmt-notif-time { margin-top: 3px; font-size: 11px; color: var(--text-secondary); }
.mgmt-notif-empty { padding: 20px 14px; text-align: center; color: var(--text-secondary); font-size: 12.5px; }

/* ---- mobile: sidebar stacks above content instead of beside it, nav wraps into a
   horizontal strip instead of a tall vertical list, and every multi-column grid above
   collapses to one column. No JS drawer/hamburger - just reflow. Deliberately last in the
   file so it wins the cascade against every base rule above it touches. ---- */
@media (max-width: 700px) {
  /* Below this width the sidebar stacks above the content instead of beside it, so the
     desktop-only "two independent viewport-tall scroll columns" model above doesn't apply -
     reset back to one normal page scroll. */
  .mgmt-page { display: block; height: auto; }
  .mgmt-sidebar {
    border-right: none; border-bottom: 2px solid var(--divider);
    padding: 16px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 16px;
    height: auto; overflow: visible;
  }
  .mgmt-sidebar .kicker { margin: 0 16px 0 0; }
  .mgmt-nav { flex-direction: row; flex-wrap: wrap; flex: 1 0 100%; gap: 2px; min-height: auto; overflow-y: visible; }
  .mgmt-nav-item { padding: 8px 10px; }
  .mgmt-sidebar .foot { flex-direction: row; flex-wrap: wrap; border-top: none; padding-top: 0; }

  .mgmt-main { height: auto; overflow: visible; }
  .mgmt-topbar { padding: 12px 16px; gap: 12px; }
  .mgmt-topbar .who { display: none; }

  .mgmt-content { padding: 20px 16px 40px; flex: none; overflow-y: visible; }

  .mgmt-stat-row, .mgmt-char-row { grid-template-columns: 1fr; }
  .mgmt-split, .mgmt-row2 { grid-template-columns: 1fr; }

  .mgmt-trend-chart { height: 100px; }
  .mgmt-toggle-row { flex-direction: column; align-items: flex-start; gap: 8px; }

  .mgmt-notif-panel { position: fixed; top: 60px; right: 8px; left: 8px; width: auto; }
}
