/**
 * MATH QUIZ UI V2 — Teacher Workspace design tokens + shell + editor + mobile.
 * Namespace: mq-ws-* (isolated from WP Admin chrome).
 */

:root {
  --mq-ws-bg: #f3f5f8;
  --mq-ws-surface: #ffffff;
  --mq-ws-ink: #1a2332;
  --mq-ws-muted: #5b6b7c;
  --mq-ws-line: #d8dee6;
  --mq-ws-accent: #0f6b5c;
  --mq-ws-accent-soft: #e6f4f1;
  --mq-ws-warn: #b45309;
  --mq-ws-warn-bg: #fff7ed;
  --mq-ws-err: #b91c1c;
  --mq-ws-err-bg: #fef2f2;
  --mq-ws-ok: #15803d;
  --mq-ws-ok-bg: #f0fdf4;
  --mq-ws-sidebar: 248px;
  --mq-ws-sidebar-collapsed: 68px;
  --mq-ws-header: 56px;
  --mq-ws-radius: 10px;
  --mq-ws-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.04);
  --mq-ws-font: "Segoe UI", "Be Vietnam Pro", system-ui, sans-serif;
  --mq-ws-mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

body.mq-ws-app #wpadminbar { display: none !important; }
html:has(body.mq-ws-app) { margin-top: 0 !important; }
body.mq-ws-app #adminmenumain,
body.mq-ws-app #adminmenuback,
body.mq-ws-app #adminmenuwrap { display: none !important; }
body.mq-ws-app #wpcontent,
body.mq-ws-app #wpbody,
body.mq-ws-app #wpbody-content {
  margin: 0 !important;
  padding: 0 !important;
}
body.mq-ws-app #wpfooter { display: none !important; }
body.mq-ws-app #wpbody-content > .notice,
body.mq-ws-app #wpbody-content > .updated,
body.mq-ws-app #wpbody-content > .error { display: none !important; }
body.mq-ws-app {
  margin-top: 0 !important;
  background: var(--mq-ws-bg);
}

/* Drawer scroll lock — only while workspace drawer is open */
body.mq-ws-drawer-open {
  overflow: hidden !important;
}

.mq-ws-root {
  --mq-ws-sidebar-w: var(--mq-ws-sidebar);
  box-sizing: border-box;
  font-family: var(--mq-ws-font);
  color: var(--mq-ws-ink);
  background: var(--mq-ws-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  max-width: 100%;
}
.mq-ws-root *,
.mq-ws-root *::before,
.mq-ws-root *::after { box-sizing: border-box; }

.mq-ws-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.mq-ws-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--mq-ws-accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.mq-ws-skip:focus { left: 8px; top: 8px; }

.mq-ws-header {
  height: var(--mq-ws-header);
  min-height: var(--mq-ws-header);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--mq-ws-surface);
  border-bottom: 1px solid var(--mq-ws-line);
  position: sticky;
  top: 0;
  z-index: 40;
  /* Isolate from theme `header {}` rules (Blocksy / child theme). */
  inset: auto;
  width: auto;
  max-width: none;
  float: none;
  transform: none;
}

/*
 * Desktop shell (= WP Admin workspace): sidebar full-height flush left,
 * app header only in the content column — prevents Σ MATH QUIZ stacking
 * under «MATH QUIZ Soạn đề».
 *
 * Important: .mq-ws-body must occupy ONLY the content row (not 1 / -1).
 * Spanning the header row made .mq-ws-main paint under the sticky header
 * and clipped page titles / lead text (e.g. Kết quả).
 */
@media (min-width: 769px) {
  /* Admin: polished full-height sidebar beside header */
  body.mq-ws-app .mq-ws-root {
    display: grid;
    grid-template-columns: var(--mq-ws-sidebar-w) minmax(0, 1fr);
    grid-template-rows: var(--mq-ws-header) minmax(0, 1fr);
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  body.mq-ws-app .mq-ws-root > .mq-ws-skip {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: start;
  }
  body.mq-ws-app .mq-ws-header {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    max-width: none;
    position: relative;
    top: auto;
    z-index: 40;
  }
  body.mq-ws-app .mq-ws-body {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    min-height: 0;
  }
  body.mq-ws-app .mq-ws-sidebar {
    width: var(--mq-ws-sidebar-w);
    flex-shrink: 0;
    margin-top: calc(-1 * var(--mq-ws-header));
    min-height: calc(100% + var(--mq-ws-header));
    z-index: 45;
  }
  body.mq-ws-app .mq-ws-overlay {
    display: none !important;
  }
  body.mq-ws-app .mq-ws-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
  }

  /*
   * Front (/giao-vien/): NO sidebar pull-up — negative margin was covering
   * the Blocksy site header («Thầy Sang Toán») and clipping «MATH QUIZ Soạn đề».
   * Simple column: app header full width, then sidebar | main flush.
   */
  body.mq-ws-front .mq-ws-root {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  body.mq-ws-front .mq-ws-header {
    position: relative;
    top: auto;
    width: 100%;
    flex-shrink: 0;
    z-index: 40;
  }
  body.mq-ws-front .mq-ws-body {
    display: flex;
    flex: 1;
    min-height: 0;
  }
  body.mq-ws-front .mq-ws-sidebar {
    /* Keep the first navigation item completely below the MQ header.
     * Some themes/containers can visually overlap the first few pixels
     * of the body row on /giao-vien/. */
    margin-top: 0 !important;
    min-height: 0;
    height: auto;
    max-height: 100%;
    width: var(--mq-ws-sidebar-w);
    flex-shrink: 0;
    align-self: stretch;
    position: sticky;
    top: 0;
    bottom: auto;
    overflow: hidden;
    z-index: 45;
  }
  body.mq-ws-front .mq-ws-nav {
    /* Prevent “Tổng quan” (the first item) from being clipped at the
     * boundary between the MQ header and sidebar on the front workspace. */
    padding-top: 14px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Brand lives in the app header on front — avoid a second Σ MATH QUIZ */
  body.mq-ws-front .mq-ws-sidebar-brand {
    display: none;
  }
  body.mq-ws-front .mq-ws-overlay {
    display: none !important;
  }
  body.mq-ws-front .mq-ws-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
  }
}
/* Home logo — return to thaysang.com from the Teacher Math Quiz workspace. */
.mq-ws-home-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px;
  box-shadow: none !important;
  padding: 0;
  overflow: visible;
  transition: outline-color .15s ease;
}
.mq-ws-home-logo img {
  display: block;
  width: 26px;
  height: 26px;
  max-width: 26px;
  max-height: 26px;
  object-fit: contain;
  background: transparent !important;
}
.mq-ws-home-logo:hover,
.mq-ws-home-logo:focus-visible {
  background: transparent !important;
  border: 0 !important;
  outline: 2px solid rgba(15, 107, 92, 0.35);
  outline-offset: 2px;
  transform: none;
}

.mq-ws-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mq-ws-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--mq-ws-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.mq-ws-brand-text {
  font-size: 15px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.mq-ws-header-title {
  font-size: 14px;
  color: var(--mq-ws-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.mq-ws-search-wrap {
  flex: 1;
  max-width: 420px;
  position: relative;
  margin-left: auto;
}
.mq-ws-search {
  width: 100%;
  height: 36px;
  border: 1px solid var(--mq-ws-line);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 14px;
  background: var(--mq-ws-bg);
  color: var(--mq-ws-ink);
}
.mq-ws-search:focus {
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 1px;
  background: #fff;
}
.mq-ws-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  box-shadow: var(--mq-ws-shadow);
  max-height: 320px;
  overflow: auto;
  z-index: 50;
}
.mq-ws-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--mq-ws-ink);
  border-bottom: 1px solid var(--mq-ws-line);
}
.mq-ws-search-item:hover,
.mq-ws-search-item:focus {
  background: var(--mq-ws-accent-soft);
  outline: none;
}
.mq-ws-search-type {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mq-ws-muted);
  margin-right: 6px;
}
.mq-ws-search-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--mq-ws-muted);
}
.mq-ws-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.mq-ws-icon-btn {
  min-width: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--mq-ws-ink);
  text-decoration: none;
  font-size: 16px;
}
.mq-ws-icon-btn:hover,
.mq-ws-icon-btn:focus-visible {
  background: var(--mq-ws-bg);
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 0;
}
.mq-ws-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--mq-ws-err);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.mq-ws-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--mq-ws-muted);
  max-width: 140px;
}
.mq-ws-user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mq-ws-menu-btn { display: none; }

.mq-ws-body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}
.mq-ws-sidebar {
  width: var(--mq-ws-sidebar-w);
  flex-shrink: 0;
  background: #0f1c24;
  color: #e8eef2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
  z-index: 30;
}
.mq-ws-root.is-collapsed {
  --mq-ws-sidebar-w: var(--mq-ws-sidebar-collapsed);
}
.mq-ws-root.is-collapsed .mq-ws-nav-label,
.mq-ws-root.is-collapsed .mq-ws-sidebar-brand-text {
  display: none;
}
.mq-ws-root.is-collapsed .mq-ws-nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.mq-ws-root.is-collapsed .mq-ws-collapse-btn {
  font-size: 16px;
  letter-spacing: 0;
}
.mq-ws-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mq-ws-sidebar-brand-text {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 13px;
}
.mq-ws-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  flex: 1;
  overflow: auto;
}
.mq-ws-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: #c9d4dc;
  text-decoration: none;
  font-size: 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.mq-ws-nav-item:hover,
.mq-ws-nav-item:focus-visible {
  background: rgba(255,255,255,0.08);
  color: #fff;
  outline: none;
}
.mq-ws-nav-item.is-active {
  background: var(--mq-ws-accent);
  color: #fff;
}
.mq-ws-nav-icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
}
.mq-ws-sidebar-foot {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  margin-top: auto;
}
.mq-ws-collapse-btn {
  width: 100%;
  margin-top: 6px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #c9d4dc;
  border-radius: 8px;
  cursor: pointer;
}
.mq-ws-collapse-btn:hover,
.mq-ws-collapse-btn:focus-visible {
  background: rgba(255,255,255,0.08);
  outline: none;
}
.mq-ws-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 36, 0.45);
  z-index: 25;
}

.mq-ws-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 12px 12px;
}
.mq-ws-root.is-editor-route {
  --mq-ws-header: 44px;
}
.mq-ws-root.is-editor-route .mq-ws-main {
  padding: 4px 4px 4px 2px;
}
.mq-ws-root.is-editor-route .mq-ws-view {
  max-width: none;
  margin: 0;
}
.mq-ws-root.is-editor-route .mq-ws-header {
  padding: 0 8px;
  gap: 8px;
}
body.mq-ws-app .mq-ws-root.is-chrome-hidden {
  grid-template-rows: minmax(0, 1fr);
}
body.mq-ws-app .mq-ws-root.is-chrome-hidden .mq-ws-header {
  display: none;
}
body.mq-ws-app .mq-ws-root.is-chrome-hidden .mq-ws-body {
  grid-row: 1;
}
body.mq-ws-app .mq-ws-root.is-chrome-hidden .mq-ws-sidebar {
  margin-top: 0;
  min-height: 100%;
}
.mq-ws-root.is-chrome-hidden .mq-ws-main {
  padding-top: 2px;
}
.mq-ws-view {
  width: 100%;
  max-width: min(1600px, 100%);
  margin-inline: auto;
}
.mq-ws-skeleton {
  padding: 40px;
  color: var(--mq-ws-muted);
  text-align: center;
}

.mq-ws-h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mq-ws-lead {
  margin: 0 0 20px;
  color: var(--mq-ws-muted);
  font-size: 15px;
}
.mq-ws-grid {
  display: grid;
  gap: 14px;
}
.mq-ws-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mq-ws-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mq-ws-card {
  background: var(--mq-ws-surface);
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  padding: 16px;
  box-shadow: var(--mq-ws-shadow);
}
.mq-ws-stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 4px 0;
}
.mq-ws-stat-label {
  font-size: 13px;
  color: var(--mq-ws-muted);
}
.mq-ws-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.mq-ws-active-quiz {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--mq-ws-accent-soft);
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  font-size: 13px;
}
.mq-ws-active-quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mq-ws-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mq-ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--mq-ws-line);
  background: #fff;
  color: var(--mq-ws-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.mq-ws-btn:hover,
.mq-ws-btn:focus-visible {
  border-color: var(--mq-ws-accent);
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 1px;
}
.mq-ws-btn-primary {
  background: var(--mq-ws-accent);
  border-color: var(--mq-ws-accent);
  color: #fff;
}
.mq-ws-btn-primary:hover,
.mq-ws-btn-primary:focus-visible {
  filter: brightness(1.05);
  color: #fff;
}
.mq-ws-btn-ghost { background: transparent; }
.mq-ws-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.mq-ws-section-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}
.mq-ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
}
.mq-ws-table th,
.mq-ws-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--mq-ws-line);
  vertical-align: middle;
  word-break: break-word;
}
.mq-ws-table th {
  color: var(--mq-ws-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mq-ws-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--mq-ws-bg);
  color: var(--mq-ws-muted);
}
.mq-ws-pill-ok { background: var(--mq-ws-ok-bg); color: var(--mq-ws-ok); }
.mq-ws-pill-warn { background: var(--mq-ws-warn-bg); color: var(--mq-ws-warn); }
.mq-ws-pill-draft { background: #eef2ff; color: #3730a3; }
.mq-ws-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--mq-ws-muted);
}
.mq-ws-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mq-ws-activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--mq-ws-line);
  font-size: 14px;
}
.mq-ws-activity-list time {
  color: var(--mq-ws-muted);
  font-size: 12px;
  white-space: nowrap;
}
.mq-ws-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.mq-ws-link-card {
  display: block;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--mq-ws-shadow);
}
.mq-ws-link-card:hover,
.mq-ws-link-card:focus-visible {
  border-color: var(--mq-ws-accent);
  outline: 2px solid var(--mq-ws-accent);
}
.mq-ws-link-card strong {
  display: block;
  margin: 4px 0;
  font-size: 15px;
}
.mq-ws-link-card span {
  font-size: 12px;
  color: var(--mq-ws-accent);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.mq-ws-link-card em {
  display: block;
  font-style: normal;
  color: var(--mq-ws-muted);
  font-size: 13px;
}
.mq-ws-offline-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 0 0 16px;
}
.mq-ws-offline-pick label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  flex: 1 1 280px;
  min-width: 0;
}
.mq-ws-offline-pick select {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  box-sizing: border-box;
}
label[for="mq-ws-on-reveal"],
#mq-ws-on-reveal-score {
  display: block;
  margin-top: 8px;
  font-weight: 600;
  font-size: 13px;
}
#mq-ws-on-reveal,
#mq-ws-on-reveal-min {
  display: block;
  width: 100%;
  max-width: 520px;
  min-height: 40px;
  margin-top: 6px;
  box-sizing: border-box;
}
.mq-ws-offline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.mq-ws-offline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}
.mq-ws-offline-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  min-width: 100px;
}
.mq-ws-offline-form input[type="number"],
.mq-ws-offline-form input[type="text"] {
  min-height: 40px;
  font-size: 16px;
  box-sizing: border-box;
  width: 100%;
}
.mq-ws-offline-form-stack {
  flex-direction: column;
  align-items: stretch;
}
.mq-ws-offline-form-stack textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.mq-ws-offline-import {
  margin-top: 12px;
  font-size: 13px;
}
.mq-ws-offline-import summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .mq-ws-offline-pick {
    flex-direction: column;
    align-items: stretch;
  }
  .mq-ws-offline-pick .mq-ws-btn {
    width: 100%;
    min-height: 44px;
  }
}

.mq-ws-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  height: 100%;
  position: relative;
}
.mq-ws-editor-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  padding: 4px 6px;
  position: sticky;
  top: 0;
  z-index: 15;
  overflow-x: auto;
}
.mq-ws-editor-bar .mq-ws-btn {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.mq-ws-editor-title {
  font-weight: 700;
  font-size: 13px;
  margin-right: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mq-ws-curriculum-gap {
  margin-left: 8px;
  flex: 0 0 auto;
  vertical-align: middle;
}
.mq-ws-save-state {
  font-size: 13px;
  color: var(--mq-ws-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mq-ws-save-state.is-ok { color: var(--mq-ws-ok); }
.mq-ws-save-state.is-busy { color: var(--mq-ws-accent); }
.mq-ws-save-state.is-dirty { color: var(--mq-ws-warn); }
.mq-ws-save-state.is-err { color: var(--mq-ws-err); }

.mq-ws-editor-panes {
  display: grid;
  grid-template-columns: minmax(300px, 340px) 6px minmax(0, 1fr) 6px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 520px;
  max-width: 100%;
}
.mq-ws-splitter {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 2;
  align-self: stretch;
}
.mq-ws-splitter::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: 2px;
  width: 2px;
  border-radius: 2px;
  background: var(--mq-ws-line);
}
.mq-ws-splitter:hover::after,
.mq-ws-splitter:focus-visible::after {
  background: var(--mq-ws-accent);
}
.mq-ws-splitter:focus-visible {
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 1px;
}
.mq-ws-pane {
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.mq-ws-pane-outline {
  max-width: none;
  min-width: 300px;
}
.mq-ws-prev-section {
  margin-bottom: 16px;
}
.mq-ws-prev-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--mq-ws-muted);
  letter-spacing: 0.03em;
}
.mq-ws-prev-q {
  margin-bottom: 10px;
}
.mq-ws-prev-q:focus-visible {
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 2px;
}
.mq-ws-prev-error {
  color: var(--mq-ws-err);
  margin: 8px 0;
  font-size: 14px;
}
.mq-ws-preview-scale {
  transform-origin: top left;
}
.mq-ws-preview-scale .mq-ws-prev-stem,
.mq-ws-preview-scale .katex-display {
  max-width: 100%;
  overflow-x: auto;
}
.mq-ws-preview-scale img {
  max-width: 100%;
  height: auto;
}
.gddt-latex-table {
  border-collapse: collapse;
  margin: 8px auto;
  max-width: 100%;
}
.gddt-latex-table td {
  border: 1px solid #111;
  padding: 4px 10px;
  text-align: center;
  vertical-align: middle;
}
.mq-ws-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--mq-ws-line);
  background: #fafbfc;
  font-size: 12px;
  font-weight: 700;
}
.mq-ws-pane-head .mq-ws-btn {
  min-height: 26px;
  padding: 0 6px;
  font-size: 12px;
}
.mq-ws-pane-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
  min-height: 0;
}

.mq-ws-outline-part { margin-bottom: 8px; }
.mq-ws-outline-part-title {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--mq-ws-muted);
  letter-spacing: 0.01em;
  margin: 0 0 6px;
}
.mq-ws-outline-part-name {
  display: block;
  min-width: 0;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.mq-ws-score-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}
.mq-ws-score-input {
  width: 58px;
  min-height: 26px;
  border: 1px solid var(--mq-ws-line);
  border-radius: 6px;
  padding: 0 4px;
  font-size: 12px;
  background: #fff;
}
.mq-ws-points-field input { max-width: 120px; }
.mq-ws-outline-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--mq-ws-ink);
  min-height: 40px;
}
.mq-ws-outline-item:hover,
.mq-ws-outline-item:focus-visible {
  background: var(--mq-ws-accent-soft);
  outline: none;
}
.mq-ws-outline-item.is-active {
  background: var(--mq-ws-accent-soft);
  box-shadow: inset 3px 0 0 var(--mq-ws-accent);
}
.mq-ws-st {
  width: 16px;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.4;
}
.mq-ws-st-ok { color: var(--mq-ws-ok); }
.mq-ws-st-warn { color: var(--mq-ws-warn); }
.mq-ws-st-empty,
.mq-ws-st-error { color: var(--mq-ws-err); }
.mq-ws-outline-meta {
  display: block;
  color: var(--mq-ws-muted);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mq-ws-field { margin-bottom: 12px; }
.mq-ws-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.mq-ws-field textarea,
.mq-ws-field input[type="text"],
.mq-ws-field select {
  width: 100%;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 44px;
  background: #fff;
  color: var(--mq-ws-ink);
}
.mq-ws-field textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mq-ws-mono);
  line-height: 1.45;
}
.mq-ws-field textarea:focus,
.mq-ws-field input:focus,
.mq-ws-field select:focus {
  outline: 2px solid var(--mq-ws-accent);
  border-color: var(--mq-ws-accent);
}
.mq-ws-opt-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.mq-ws-opt-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--mq-ws-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.mq-ws-tf-row {
  display: grid;
  grid-template-columns: 36px 1fr 110px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.mq-ws-mode-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--mq-ws-bg);
  padding: 3px;
  border-radius: 8px;
}
.mq-ws-mode-tabs button {
  border: 0;
  background: transparent;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--mq-ws-muted);
}
.mq-ws-mode-tabs button.is-active {
  background: #fff;
  color: var(--mq-ws-ink);
  box-shadow: var(--mq-ws-shadow);
}
.mq-ws-math-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.mq-ws-math-bar button {
  min-height: 36px;
  min-width: 36px;
  padding: 0 8px;
  border: 1px solid var(--mq-ws-line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.mq-ws-math-bar button:hover,
.mq-ws-math-bar button:focus-visible {
  border-color: var(--mq-ws-accent);
  outline: none;
}

.mq-ws-prev-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
}
.mq-ws-prev-q {
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
}
.mq-ws-prev-q.is-active {
  border-color: var(--mq-ws-accent);
  box-shadow: 0 0 0 2px var(--mq-ws-accent-soft);
}
.mq-ws-prev-q-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--mq-ws-muted);
  font-weight: 700;
}
.mq-ws-prev-stem { font-size: 15px; line-height: 1.55; margin-bottom: 10px; }
.mq-ws-prev-opts { list-style: none; margin: 0; padding: 0; }
.mq-ws-prev-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px dashed var(--mq-ws-line);
  font-size: 14px;
}
.mq-ws-prev-opt.is-correct {
  background: var(--mq-ws-ok-bg);
  margin: 0 -8px;
  padding: 8px;
  border-radius: 6px;
}
.mq-ws-prev-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mq-ws-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.mq-ws-prev-exp {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--mq-ws-line);
  font-size: 14px;
}
.mq-ws-zoom {
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
  font-size: 13px;
}
.mq-ws-preview-scale { transform-origin: top left; }

.mq-ws-check-panel {
  position: absolute;
  z-index: 30;
  top: 40px;
  left: 8px;
  right: 8px;
  max-height: min(320px, 48vh);
  overflow: auto;
  margin: 0;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  padding: 12px;
  box-shadow: var(--mq-ws-shadow);
}
.mq-ws-check-panel[hidden] { display: none !important; }
.mq-ws-check-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}
.mq-ws-findings {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mq-ws-findings li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--mq-ws-line);
  font-size: 14px;
}

.mq-ws-mobile-tabs {
  display: none;
  gap: 6px;
  margin-bottom: 8px;
}
.mq-ws-mobile-tabs button {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--mq-ws-line);
  background: #fff;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.mq-ws-mobile-tabs button.is-active {
  background: var(--mq-ws-accent);
  border-color: var(--mq-ws-accent);
  color: #fff;
}

.mq-ws-notify-panel {
  position: absolute;
  right: 16px;
  top: calc(var(--mq-ws-header) + 6px);
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  box-shadow: var(--mq-ws-shadow);
  z-index: 60;
  padding: 12px;
}
.mq-ws-idv-item {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--mq-ws-line);
  border-radius: 10px;
  background: #fffbeb;
}
.mq-ws-idv-item .mq-ws-btn {
  min-height: 40px;
}
@media (max-width: 640px) {
  .mq-ws-notify-panel {
    left: 12px;
    right: 12px;
    width: auto;
  }
}
.mq-ws-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0f1c24;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  z-index: 100;
  font-size: 14px;
  box-shadow: var(--mq-ws-shadow);
}

@media (max-width: 1024px) {
  .mq-ws-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mq-ws-editor-panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px;
  }
  .mq-ws-splitter { display: none; }
  .mq-ws-pane-outline {
    grid-column: 1 / -1;
    max-width: none;
    min-width: 0;
    max-height: 200px;
  }
  .mq-ws-header-title { display: none; }
}

@media (max-width: 768px) {
  /* Lock the shell to the screen and scroll .mq-ws-main. A phone with only
     min-height:100vh clipped Giao bài: the column grew, overflow:hidden on
     .mq-ws-body cut it off, and no box actually scrolled. */
  html:has(body.mq-ws-front),
  html:has(body.mq-ws-app),
  body.mq-ws-front,
  body.mq-ws-app {
    height: 100%;
    overflow: hidden;
  }
  .mq-ws-root {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .mq-ws-menu-btn { display: inline-flex; }
  .mq-ws-brand-text { font-size: 14px; }
  .mq-ws-search-wrap { display: none; }
  .mq-ws-user-name { display: none; }
  .mq-ws-root {
    display: flex;
    flex-direction: column;
  }
  .mq-ws-header {
    /* Stay in document flow under site header; sticky only within MQ shell */
    position: sticky;
    top: 0;
    z-index: 40;
    grid-column: auto;
    grid-row: auto;
    width: auto;
  }
  .mq-ws-icon-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .mq-ws-body {
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1 1 0%;
    min-height: 0;
    /* Definite height (parent is 100dvh) so the drawer stays on screen
       and .mq-ws-main is the scrollport. flex-basis 0% is required:
       basis auto lets the column grow with Giao bài and then get clipped. */
    overflow: hidden;
  }
  /*
   * Root cause fix: drawer was position:fixed; top:0 — covered Blocksy header,
   * admin bar, and Math Quiz chrome. Keep it absolute inside .mq-ws-body
   * (which sits below .mq-ws-header in normal flow).
   */
  .mq-ws-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    max-height: 100%;
    width: min(280px, 86vw);
    max-width: 86vw;
    flex: none;
    grid-column: auto;
    grid-row: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 35;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .mq-ws-nav {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
  }
  .mq-ws-sidebar-foot {
    flex-shrink: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .mq-ws-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
  }
  .mq-ws-root.is-drawer-open .mq-ws-sidebar {
    transform: translateX(0);
  }
  .mq-ws-root.is-drawer-open .mq-ws-overlay {
    display: block;
  }
  .mq-ws-collapse-btn { display: none; }
  .mq-ws-main {
    position: relative;
    z-index: 1;
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    padding: 14px 12px;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: auto;
  }
  .mq-ws-view {
    max-width: 100%;
  }
  .mq-ws-grid-4,
  .mq-ws-grid-2 { grid-template-columns: 1fr; }
  .mq-ws-mobile-tabs { display: flex; }
  .mq-ws-editor-panes {
    grid-template-columns: 1fr !important;
    min-height: 60vh;
    gap: 0;
  }
  .mq-ws-splitter { display: none; }
  #mq-ws-reset-layout { display: none; }
  .mq-ws-editor-panes[data-mobile-pane="outline"] .mq-ws-pane-editor,
  .mq-ws-editor-panes[data-mobile-pane="outline"] .mq-ws-pane-preview,
  .mq-ws-editor-panes[data-mobile-pane="editor"] .mq-ws-pane-outline,
  .mq-ws-editor-panes[data-mobile-pane="editor"] .mq-ws-pane-preview,
  .mq-ws-editor-panes[data-mobile-pane="preview"] .mq-ws-pane-outline,
  .mq-ws-editor-panes[data-mobile-pane="preview"] .mq-ws-pane-editor {
    display: none;
  }
  .mq-ws-pane-outline { max-height: none; min-width: 0; }
  .mq-ws-editor-bar .mq-ws-btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }
  .mq-ws-tf-row { grid-template-columns: 36px 1fr; }
  .mq-ws-tf-row select { grid-column: 2; }
  .mq-ws-prev-stem,
  .mq-ws-field textarea,
  .mq-ws-field input,
  .mq-ws-btn {
    font-size: 16px;
  }
  .mq-ws-h1 { font-size: 22px; line-height: 1.3; }
  .mq-ws-lead { font-size: 15px; }
  .mq-ws-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .mq-ws-compose-toolbar .mq-ws-btn {
    min-height: 44px;
  }
}

@media (max-width: 430px) {
  .mq-ws-actions .mq-ws-btn { width: 100%; }
  .mq-ws-editor-title { width: 100%; margin-bottom: 4px; }
}

.mq-ws-outline-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mq-ws-outline-main strong {
  display: inline;
}
.mq-ws-type-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--mq-ws-accent-soft, #eff6ff);
  color: var(--mq-ws-accent, #1d4ed8);
  font-size: 10px;
  font-weight: 650;
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.mq-ws-outline-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--mq-ws-line, #e2e8f0);
  background: #fff;
}
.mq-ws-outline-toolbar .mq-ws-btn {
  width: 100%;
  justify-content: center;
  min-height: 36px;
  font-size: 12px;
}
.mq-ws-outline-empty {
  padding: 8px;
  font-size: 13px;
}
.mq-ws-outline-foot-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--mq-ws-muted);
  font-size: 13px;
}
.mq-ws-outline-more {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mq-ws-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.mq-ws-outline-more:hover,
.mq-ws-outline-more:focus-visible {
  background: var(--mq-ws-accent-soft, #eff6ff);
  color: var(--mq-ws-ink);
  outline: none;
}
.mq-ws-outline-menu {
  position: fixed;
  z-index: 100200;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--mq-ws-border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.mq-ws-outline-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--mq-ws-ink);
  min-height: 40px;
}
.mq-ws-outline-menu button:hover,
.mq-ws-outline-menu button:focus-visible {
  background: var(--mq-ws-accent-soft, #eff6ff);
  outline: none;
}
.mq-ws-outline-menu button.is-danger {
  color: var(--mq-ws-err);
}
.mq-ws-btn-danger {
  background: var(--mq-ws-err, #b42318);
  border-color: var(--mq-ws-err, #b42318);
  color: #fff;
}
.mq-ws-btn-danger:hover,
.mq-ws-btn-danger:focus-visible {
  filter: brightness(0.95);
  color: #fff;
}
.mq-ws-confirm,
.mq-ws-qpreview {
  position: fixed;
  inset: 0;
  z-index: 100150;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mq-ws-confirm-backdrop,
.mq-ws-qpreview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.mq-ws-confirm-card,
.mq-ws-qpreview-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  padding: 20px;
}
.mq-ws-qpreview-card {
  width: min(720px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.mq-ws-confirm-title {
  margin: 0 0 8px;
  font-size: 17px;
}
.mq-ws-confirm-body {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.45;
}
.mq-ws-confirm-note {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--mq-ws-muted);
}
.mq-ws-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 14px;
}
.mq-ws-confirm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.mq-ws-pick {
  position: fixed;
  inset: 0;
  z-index: 100150;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mq-ws-pick-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.mq-ws-pick-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  padding: 20px;
}
.mq-ws-pick-wide .mq-ws-pick-card {
  width: min(720px, calc(100vw - 32px));
}
.mq-ws-pick-title {
  margin: 0 0 4px;
  font-size: 17px;
}
.mq-ws-pick-sub {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--mq-ws-muted);
}
.mq-ws-pick-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
}
.mq-ws-pick-wide .mq-ws-pick-cols {
  grid-template-columns: 1fr 1fr;
}
.mq-ws-pick-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.mq-ws-pick-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.mq-ws-pick-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
}
.mq-ws-pick-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
}
.mq-ws-pick-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--mq-ws-ink, #0f172a);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.mq-ws-pick-item:hover,
.mq-ws-pick-item:focus-visible {
  background: #f1f5f9;
  outline: none;
}
.mq-ws-pick-item.is-selected {
  background: var(--mq-ws-accent-soft, #e6f4f1);
  border-color: var(--mq-ws-accent, #0f6b5c);
}
.mq-ws-pick-empty {
  margin: 8px;
  font-size: 13px;
  color: var(--mq-ws-muted);
}
.mq-ws-pick-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
@media (max-width: 720px) {
  .mq-ws-pick-wide .mq-ws-pick-cols {
    grid-template-columns: 1fr;
  }
  .mq-ws-pick-list {
    max-height: 180px;
  }
}
.mq-ws-qpreview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--mq-ws-border, #e2e8f0);
}
.mq-ws-qpreview-body {
  padding: 14px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* —— Bank picker panel (Editor → Từ ngân hàng) —— */
body.mq-ws-bank-open {
  overflow: hidden;
}
.mq-ws-bank-panel {
  position: fixed;
  inset: 0;
  z-index: 100100;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.mq-ws-bank-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.mq-ws-bank-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: var(--mq-ws-surface, #fff);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}
.mq-ws-bank-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--mq-ws-border, #e2e8f0);
}
.mq-ws-bank-back { display: none; }
.mq-ws-bank-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}
.mq-ws-bank-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--mq-ws-border, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mq-ws-bank-search {
  width: 100%;
  max-width: none;
  border-radius: 8px;
  min-height: 40px;
}
.mq-ws-bank-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.mq-ws-bank-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--mq-ws-muted);
}
.mq-ws-bank-filter select {
  min-width: 120px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--mq-ws-border, #cbd5e1);
  padding: 4px 8px;
  background: #fff;
}
.mq-ws-bank-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 360px);
  gap: 0;
}
.mq-ws-bank-list {
  overflow: auto;
  padding: 8px 12px 16px;
  min-width: 0;
}
.mq-ws-bank-preview {
  border-left: 1px solid var(--mq-ws-border, #e2e8f0);
  overflow: auto;
  background: var(--mq-ws-bg, #f8fafc);
  padding: 12px;
}
.mq-ws-bank-preview-head {
  font-size: 12px;
  font-weight: 650;
  color: var(--mq-ws-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mq-ws-bank-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--mq-ws-border, #f1f5f9);
}
.mq-ws-bank-row:hover {
  background: var(--mq-ws-accent-soft, #eff6ff);
}
.mq-ws-bank-check {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  flex-shrink: 0;
}
.mq-ws-bank-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mq-ws-bank-id {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--mq-ws-accent, #1d4ed8);
}
.mq-ws-bank-title-row {
  font-weight: 600;
  font-size: 14px;
}
.mq-ws-bank-snippet {
  font-size: 13px;
  color: var(--mq-ws-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mq-ws-bank-tags {
  font-size: 11px;
  color: var(--mq-ws-muted);
}
.mq-ws-bank-quick {
  flex-shrink: 0;
  align-self: center;
  font-size: 12px;
  min-height: 36px;
}
.mq-ws-bank-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 4px;
  font-size: 13px;
}
.mq-ws-bank-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--mq-ws-border, #e2e8f0);
  background: var(--mq-ws-surface, #fff);
}
.mq-ws-bank-meta {
  font-size: 13px;
  color: var(--mq-ws-muted);
}
.mq-ws-bank-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .mq-ws-bank-body {
    grid-template-columns: 1fr;
  }
  .mq-ws-bank-preview {
    border-left: 0;
    border-top: 1px solid var(--mq-ws-border, #e2e8f0);
    max-height: 40vh;
  }
}

@media (max-width: 768px) {
  .mq-ws-bank-sheet {
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  .mq-ws-bank-back { display: inline-flex; }
  .mq-ws-bank-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .mq-ws-bank-filter select {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
  .mq-ws-bank-search { font-size: 16px; min-height: 44px; }
  .mq-ws-bank-row { min-height: 52px; }
  .mq-ws-bank-quick { min-height: 40px; }
  .mq-ws-bank-foot {
    position: sticky;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
  }
  .mq-ws-bank-actions .mq-ws-btn {
    flex: 1;
    min-height: 44px;
    font-size: 16px;
  }
  .mq-ws-bank-preview[hidden] { display: none !important; }
  .mq-ws-outline-more {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
  .mq-ws-outline-toolbar .mq-ws-btn {
    min-height: 44px;
    font-size: 15px;
  }
  .mq-ws-type-badge {
    display: block;
    margin: 4px 0 0;
    width: fit-content;
  }
  .mq-ws-outline-menu button {
    min-height: 44px;
    font-size: 15px;
  }
}

/*
 * Front (/giao-vien/): align shell geometry with Admin (body.mq-ws-app).
 * Root cause of left whitespace was:
 *   1) max-width + margin-inline:auto on .mq-ws-root (centered card)
 *   2) theme (Blocksy) content column padding/max-width around the shortcode
 * Fix: full-bleed shell under site header; do not center the workspace shell.
 * Also zero the vertical gap (Blocksy ~105px / hub 16px) between site nav and MQ.
 */
body.mq-ws-front {
  overflow-x: hidden;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--mq-ws-bg);
}

/*
 * Front teacher workspace: behave like the native WP Admin application.
 * The /giao-vien/ page must not retain the public-site header/navigation
 * above Math Quiz; the workspace itself provides its own app chrome.
 * Scope everything to .mq-ws-front so the public site is unaffected.
 */
body.mq-ws-front #wpadminbar,
body.mq-ws-front #header,
body.mq-ws-front header.site-header,
body.mq-ws-front .site-header,
body.mq-ws-front .ct-header,
body.mq-ws-front .ct-header-wrapper,
body.mq-ws-front #footer,
body.mq-ws-front footer.site-footer,
body.mq-ws-front .site-footer,
body.mq-ws-front .ct-footer {
  display: none !important;
}

body.mq-ws-front #page,
body.mq-ws-front .site,
body.mq-ws-front .site-container,
body.mq-ws-front main.site-main {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

/* Hide theme page chrome that sits between site nav and the workspace */
body.mq-ws-front .entry-header,
body.mq-ws-front .entry-title,
body.mq-ws-front h1.entry-title,
body.mq-ws-front .page-header,
body.mq-ws-front .page-title,
body.mq-ws-front h1.wp-block-post-title,
body.mq-ws-front .wp-block-post-title,
body.mq-ws-front .hero-section,
body.mq-ws-front .ct-page-title-container {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Theme column → edge-to-edge + zero vertical gap for Math Quiz only */
body.mq-ws-front #content,
body.mq-ws-front #primary,
body.mq-ws-front .site-content,
body.mq-ws-front .content-area,
body.mq-ws-front .entry-content,
body.mq-ws-front .post-content,
body.mq-ws-front .site-main,
body.mq-ws-front article.type-page,
body.mq-ws-front article.page,
body.mq-ws-front .ct-container,
body.mq-ws-front .ct-container-full,
body.mq-ws-front #main > .ct-container-full,
body.mq-ws-front .site-main > .ct-container-full {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.mq-ws-front .entry-content.is-layout-constrained > * {
  margin-block: 0 !important;
  max-width: none !important;
}

/* Match Admin: shell fills available width; sidebar flush left of workspace */
body.mq-ws-front .mq-ws-root {
  width: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}

/* Public-site header is hidden on the teacher workspace; no mobile header compensation is needed. */

body.mq-ws-app .mq-ws-root {
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}

/* —— Matrix generation (UI-5) —— */
.mq-ws-matrix-settings {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.mq-ws-matrix-settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.mq-ws-matrix-settings input[type="text"],
.mq-ws-matrix-settings input[type="number"],
.mq-ws-matrix-row select,
.mq-ws-matrix-row input,
.mq-ws-matrix-card select,
.mq-ws-matrix-card input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 36px;
  border: 1px solid var(--mq-ws-border, #cbd5e1);
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 400;
}
.mq-ws-matrix-check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500 !important;
  margin-top: 22px;
}
.mq-ws-matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.mq-ws-matrix-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.mq-ws-matrix-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.mq-ws-matrix-table th:nth-child(1),
.mq-ws-matrix-table td:nth-child(1) { width: 36px; }
.mq-ws-matrix-table th:nth-child(7),
.mq-ws-matrix-table td:nth-child(7) { width: 72px; }
.mq-ws-matrix-table th:nth-child(8),
.mq-ws-matrix-table td:nth-child(8) { width: 64px; }
.mq-ws-matrix-num { font-weight: 700; color: var(--mq-ws-accent); }
.mq-ws-matrix-cards { display: none; }
.mq-ws-matrix-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0 8px;
  padding: 12px;
  background: var(--mq-ws-accent-soft, #eff6ff);
  border-radius: 8px;
  font-size: 14px;
}
.mq-ws-matrix-weights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
  margin: 0 0 12px;
}
.mq-ws-matrix-weights-label {
  font-size: 13px;
  font-weight: 700;
  padding-bottom: 8px;
}
.mq-ws-matrix-weights label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}
.mq-ws-matrix-weight {
  width: 88px;
  max-width: 100%;
  min-height: 36px;
  border: 1px solid #e3b341;
  background: #fff8db;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}
.mq-ws-matrix-stats-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 12px;
}
.mq-ws-matrix-stats {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}
.mq-ws-matrix-stats th,
.mq-ws-matrix-stats td {
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  text-align: center;
  white-space: nowrap;
}
.mq-ws-matrix-stats thead th {
  background: #d9e2f3;
  font-weight: 700;
}
.mq-ws-matrix-stats tbody th {
  text-align: left;
  background: #f8fafc;
}
.mq-ws-matrix-stats .is-point { background: #e2efda; }
.mq-ws-matrix-stats .is-pct { background: #f4b183; font-weight: 700; }
.mq-ws-matrix-stats .is-total { font-weight: 700; }
.mq-ws-matrix-avail {
  margin: 12px 0;
  border: 1px solid var(--mq-ws-border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
}
.mq-ws-matrix-avail-head {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 650;
}
.mq-ws-matrix-avail-head.is-ok { background: #ecfdf3; color: #027a48; }
.mq-ws-matrix-avail-head.is-short { background: #fef3f2; color: #b42318; }
.mq-ws-matrix-avail .is-ok { color: #027a48; font-weight: 650; }
.mq-ws-matrix-avail .is-short { color: #b42318; font-weight: 650; }
.mq-ws-matrix-error {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #b42318;
  font-size: 14px;
}
.mq-ws-matrix-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.mq-ws-matrix-sources {
  margin: 0 0 12px;
}
.mq-ws-matrix-sources .mq-ws-rex-sources {
  max-height: 280px;
}
.mq-ws-matrix-gaps {
  margin-top: 8px;
}
.mq-ws-matrix-gaps a,
.mq-ws-matrix-error a {
  color: #175cd3;
}
.mq-ws-curriculum-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
@media (max-width: 768px) {
  .mq-ws-curriculum-row {
    grid-template-columns: 1fr;
  }
}
.mq-ws-muted { color: var(--mq-ws-muted); }

@media (max-width: 900px) {
  .mq-ws-matrix-settings {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .mq-ws-matrix-settings {
    grid-template-columns: 1fr;
  }
  .mq-ws-matrix-check { margin-top: 0; }
  .mq-ws-matrix-table-wrap { display: none; }
  .mq-ws-matrix-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mq-ws-matrix-card {
    border: 1px solid var(--mq-ws-border, #e2e8f0);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
  }
  .mq-ws-matrix-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mq-ws-matrix-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
  }
  .mq-ws-matrix-card select,
  .mq-ws-matrix-card input {
    min-height: 44px;
    font-size: 16px;
  }
  .mq-ws-matrix-actions .mq-ws-btn {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
}

/* —— Assignment workspace (UI-6A) —— */
.mq-ws-h2 {
  margin: 0 0 12px;
  font-size: 16px;
}
.mq-ws-assign-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  gap: 8px;
}
.mq-ws-assign-chrome { flex-shrink: 0; }
.mq-ws-assign-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.mq-ws-assign-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.mq-ws-assign-help { position: relative; }
.mq-ws-assign-help summary { list-style: none; cursor: pointer; }
.mq-ws-assign-help-body {
  position: absolute;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  max-width: 360px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-assign-help-body p { margin: 0; }
.mq-ws-assign-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Board / list pages manage their own inner scroll */
.mq-ws-assign-root:has(.mq-ws-assign-board),
.mq-ws-assign-root:has(.mq-ws-classes-board),
.mq-ws-assign-root:has(.mq-ws-track-page),
.mq-ws-assign-root:has(.mq-ws-stu-page) {
  overflow: hidden;
}
.mq-ws-track-page,
.mq-ws-stu-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 10px;
  padding: 12px;
}
.mq-ws-track-split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
.mq-ws-track-chrome,
.mq-ws-stu-chrome {
  flex-shrink: 0;
}
.mq-ws-track-chrome {
  min-height: 0;
  overflow: auto;
  padding-right: 12px;
  border-right: 1px solid var(--mq-ws-line, #e2e8f0);
}
.mq-ws-track-stats {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.mq-ws-track-stats .mq-ws-card {
  padding: 12px;
}
.mq-ws-track-avg-line,
.mq-ws-track-actions {
  margin: 0 0 8px;
}
.mq-ws-track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mq-ws-track-note {
  font-size: 12px;
  margin: 8px 0 0;
}
.mq-ws-track-scroll,
.mq-ws-stu-list-scroll,
#mq-ws-stu-list {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.mq-ws-track-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.mq-ws-track-tools {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.mq-ws-track-tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.mq-ws-track-tool-label {
  min-width: 64px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-track-toggle[aria-pressed="true"] {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.mq-ws-track-list .mq-ws-track-scroll {
  height: auto;
  flex: 1 1 auto;
}
.mq-ws-track-scroll .mq-ws-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 var(--mq-ws-line, #e2e8f0);
}
.mq-ws-assign-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.mq-ws-assign-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.mq-ws-assign-board {
  display: grid;
  grid-template-columns: minmax(200px, 0.72fr) minmax(260px, 0.95fr) minmax(300px, 1.35fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  width: 100%;
  align-items: stretch;
}
.mq-ws-asg-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  overflow: hidden;
}
.mq-ws-asg-panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 8px;
}
.mq-ws-asg-panel-h .mq-ws-h2 {
  margin: 0;
  font-size: 15px;
}
.mq-ws-asg-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.mq-ws-asg-panel-foot {
  flex-shrink: 0;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--mq-ws-line, #e2e8f0);
}
.mq-ws-asg-panel-foot .mq-ws-btn-primary { width: 100%; }
.mq-ws-asg-folder {
  flex-shrink: 0;
  margin-top: 8px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
  padding: 0 10px 8px;
}
.mq-ws-asg-folder > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 0;
  list-style: none;
}
.mq-ws-asg-folder > summary::-webkit-details-marker { display: none; }
.mq-ws-assign-board.is-mix {
  grid-template-columns: minmax(620px, 1.75fr) minmax(260px, 0.75fr);
}
.mq-ws-rex-split {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
  align-items: stretch;
}
.mq-ws-rex-side {
  flex: 0 0 272px;
  width: 272px;
  max-width: 38%;
  min-height: 0;
  overflow: auto;
}
.mq-ws-rex-side .mq-ws-rex-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mq-ws-rex-side .mq-ws-assign-grid4 {
  grid-template-columns: 1fr 1fr;
  margin: 0;
}
.mq-ws-rex-side #mq-ws-asg-mix-dock {
  margin: 0;
  padding: 0;
  border: 0;
}
.mq-ws-rex-side #mq-ws-asg-mix-dock:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mq-ws-rex-side .mq-ws-rex-tools-bar .mq-ws-btn { flex: 1 1 calc(50% - 8px); }
.mq-ws-rex-list-h {
  flex-shrink: 0;
  font-size: 12px;
  padding: 0 2px 4px;
}
.mq-ws-mode-fieldset[hidden],
#mq-ws-asg-single-wrap[hidden],
#mq-ws-asg-mix-wrap[hidden],
#mq-ws-asg-mix-dock[hidden] { display: none !important; }
.mq-ws-assign-board.is-mix .mq-ws-asg-panel--source .mq-ws-asg-panel-scroll {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mq-ws-assign-board.is-mix #mq-ws-asg-mix-wrap:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.mq-ws-assign-board.is-mix .mq-ws-multi-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}
.mq-ws-assign-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mq-ws-assign-tabs-row .mq-ws-assign-tabs {
  flex: 1 1 auto;
  min-width: 0;
}
.mq-ws-assign-tab-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}
.mq-ws-asg-mins {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  color: #0f172a;
}
.mq-ws-asg-mins input {
  width: 52px;
  height: 22px;
  border: 0;
  padding: 0;
  font: inherit;
  background: transparent;
}
.mq-ws-asg-mins input:disabled { color: #94a3b8; }
.mq-ws-asg-panel-foot { display: flex; flex-direction: column; gap: 6px; }
.mq-ws-asg-panel-foot #mq-ws-asg-save-mix { width: 100%; }
.mq-ws-asg-pop { position: relative; }
.mq-ws-asg-pop > summary {
  list-style: none;
  cursor: pointer;
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  line-height: 26px;
}
.mq-ws-asg-pop > summary::-webkit-details-marker { display: none; }
.mq-ws-asg-pop[open] > summary {
  border-color: var(--mq-ws-accent, #0f766e);
  color: var(--mq-ws-accent, #0f766e);
}
.mq-ws-asg-pop-body {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  width: min(320px, 80vw);
  padding: 10px;
  background: #fff;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mq-ws-asg-pop-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 650;
}
.mq-ws-asg-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mq-ws-rex-dock {
  flex-shrink: 0;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--mq-ws-line, #e2e8f0);
}
.mq-ws-rex-dock[hidden] { display: none !important; }
.mq-ws-rex-dock-h {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.mq-ws-rex-dock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.mq-ws-rex-dock-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 650;
  flex: 1 1 140px;
  margin: 0;
}
.mq-ws-rex-dock-row select,
.mq-ws-rex-dock .mq-ws-assign-grid4 input {
  width: 100%;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
}
.mq-ws-asg-panel--suggest[hidden] { display: none !important; }
.mq-ws-asg-suggest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mq-ws-asg-suggest-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  height: auto;
  padding: 8px 10px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.mq-ws-asg-suggest-btn:hover,
.mq-ws-asg-suggest-btn:focus-visible {
  border-color: var(--mq-ws-accent);
  outline: 2px solid var(--mq-ws-accent);
  outline-offset: 1px;
}
.mq-ws-asg-suggest-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.mq-ws-asg-suggest-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-asg-suggest-btn.is-active {
  background: var(--mq-ws-accent);
  border-color: var(--mq-ws-accent);
  color: #fff;
}
.mq-ws-asg-suggest-btn.is-active .mq-ws-asg-suggest-meta { color: rgba(255, 255, 255, .85); }
.mq-ws-asg-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
}
.mq-ws-asg-form-head,
.mq-ws-asg-given-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.mq-ws-asg-form-head .mq-ws-h2,
.mq-ws-asg-given-head .mq-ws-h2 {
  margin: 0;
}
.mq-ws-assign-form--compact {
  max-width: none;
  max-height: none;
  overflow: visible;
}
.mq-ws-assign-given {
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.mq-ws-assign-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  padding-right: 2px;
  align-content: start;
}
.mq-ws-asg-card {
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  min-width: 0;
}
.mq-ws-asg-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.mq-ws-asg-card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.mq-ws-asg-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 8px 0 10px;
  font-size: 12px;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-asg-card .mq-ws-assign-acts {
  white-space: normal;
}
.mq-ws-assign-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}
.mq-ws-assign-form select,
.mq-ws-assign-form input[type="datetime-local"],
.mq-ws-assign-form input[type="number"],
.mq-ws-assign-form input[type="text"],
.mq-ws-assign-form input[type="search"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 34px;
  height: 34px;
  border: 1px solid var(--mq-ws-border, #cbd5e1);
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 400;
  font-size: 13px;
}
.mq-ws-assign-grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}
.mq-ws-assign-grid2 label {
  margin-bottom: 0;
}
.mq-ws-assign-grid4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}
.mq-ws-assign-grid4 label {
  margin-bottom: 0;
}
.mq-ws-rex-listcol .mq-ws-rex-sources {
  min-height: 240px;
  height: 100%;
}
.mq-ws-rex-sources {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  padding: 4px 6px;
  background: #fff;
}
.mq-ws-rex-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(110px, 0.8fr) minmax(120px, 0.9fr);
  gap: 6px;
  flex-shrink: 0;
}
.mq-ws-rex-name {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
}
.mq-ws-rex-name input { flex: 1 1 auto; font-weight: 500; }
.mq-ws-rex-list-h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.mq-ws-rex-tools input[type="search"],
.mq-ws-rex-tools input[type="text"],
.mq-ws-rex-tools select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
}
.mq-ws-rex-picked {
  display: flex;
  margin: 0;
  min-height: 32px;
  align-items: center;
  justify-self: start;
  width: auto;
  white-space: nowrap;
  gap: 8px;
}
.mq-ws-rex-picked input {
  width: auto;
  height: auto;
  min-height: 0;
  flex: 0 0 auto;
}
#mq-ws-matrix-quiz-source .mq-ws-rex-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#mq-ws-matrix-quiz-source .mq-ws-rex-tools input[type="search"] {
  flex: 1 1 220px;
  width: auto;
  min-width: 180px;
}
#mq-ws-matrix-quiz-source .mq-ws-rex-tools select {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}
#mq-ws-matrix-quiz-source .mq-ws-rex-picked {
  flex: 0 0 auto;
  margin-left: auto;
}
.mq-ws-rex-tools-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  font-size: 12px;
}
.mq-ws-rex-tools-bar .mq-ws-muted { margin-right: auto; }
.mq-ws-rex-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #eef2f6;
  cursor: pointer;
  font-weight: 500;
}
.mq-ws-rex-item[hidden] { display: none !important; }
.mq-ws-rex-item:last-of-type { border-bottom: 0; }
.mq-ws-rex-item input { margin-top: 3px; flex: 0 0 auto; }
.mq-ws-rex-item-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mq-ws-rex-item-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.mq-ws-rex-item-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--mq-ws-muted, #64748b);
  line-height: 1.35;
}
.mq-ws-rex-empty { padding: 10px 6px; }
.mq-ws-rex-preview-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}
.mq-ws-rex-preview {
  border: 1px dashed var(--mq-ws-line, #cbd5e1);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #f8fafc;
  font-size: 12px;
  max-height: min(22vh, 180px);
  overflow: auto;
}
.mq-ws-rex-block {
  margin: 8px 0 0;
}
.mq-ws-rex-block ol {
  margin: 6px 0 0 1.2em;
  padding: 0;
}
.mq-ws-assign-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.mq-ws-assign-tabs .mq-ws-btn {
  flex: 0 0 auto;
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}
.mq-ws-mode-fieldset {
  margin: 0 0 10px;
  padding: 6px 8px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
}
.mq-ws-mode-fieldset--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.mq-ws-mode-fieldset--row legend {
  width: 100%;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  float: none;
}
.mq-ws-mode-option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 2px 0;
}
.mq-ws-mode-option--compact {
  flex-wrap: nowrap;
  align-items: center;
  padding: 2px 0 !important;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  border-top: 0 !important;
  cursor: pointer;
}
.mq-ws-mode-option--compact .mq-ws-muted { display: none; }
.mq-ws-assign-class-form,
.mq-ws-assign-student-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.mq-ws-assign-student-filters.mq-ws-stu-filters-compact {
  grid-template-columns: minmax(120px, 200px) minmax(140px, 260px) auto;
  gap: 8px;
  align-items: end;
  margin: 0 0 8px;
  max-width: 560px;
}
.mq-ws-assign-class-form label,
.mq-ws-assign-student-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.mq-ws-stu-filters-compact label {
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-assign-class-form input,
.mq-ws-assign-student-filters select,
.mq-ws-assign-student-filters input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  height: 44px;
  font-size: 16px;
}
.mq-ws-stu-filters-compact select,
.mq-ws-stu-filters-compact input {
  min-height: 32px;
  height: 32px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
}
.mq-ws-assign-class-form .mq-ws-btn,
.mq-ws-assign-student-filters .mq-ws-btn {
  min-height: 44px;
  height: 44px;
}
.mq-ws-stu-filters-compact .mq-ws-btn {
  min-height: 32px;
  height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}
.mq-ws-aud-box {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--mq-ws-line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin: 0;
  flex: 1;
  min-height: 0;
}
.mq-ws-asg-panel--audience > .mq-ws-mode-fieldset,
.mq-ws-asg-panel--audience > .mq-ws-asg-hint {
  flex-shrink: 0;
}
.mq-ws-asg-panel--audience > .mq-ws-aud-box {
  flex: 1 1 auto;
}
.mq-ws-aud-side {
  border-right: 1px solid var(--mq-ws-line);
  background: #f8fafc;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.mq-ws-aud-side-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mq-ws-aud-side input[type="search"] {
  margin-bottom: 4px;
  min-height: 30px;
  height: 30px;
  font-size: 13px;
  flex-shrink: 0;
}
.mq-ws-aud-grade {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.mq-ws-aud-grade.is-active {
  background: #1d4ed8;
  color: #fff;
}
.mq-ws-aud-main {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.mq-ws-aud-main-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.mq-ws-aud-main-bar input[type="search"] {
  min-width: 140px;
  min-height: 30px;
  height: 30px;
}
.mq-ws-aud-list-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.mq-ws-aud-section {
  margin-bottom: 12px;
}
.mq-ws-aud-section-h {
  font-size: 13px;
  font-weight: 650;
  color: var(--mq-ws-muted);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mq-ws-aud-section-all {
  border: 0;
  background: none;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0;
}
.mq-ws-aud-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 12px;
}
.mq-ws-aud-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  min-height: 36px;
}
.mq-ws-aud-check em {
  font-style: normal;
  color: var(--mq-ws-muted);
  font-size: 12px;
}
@media (max-width: 720px) {
  .mq-ws-aud-box {
    grid-template-columns: 1fr;
    min-height: 260px;
  }
  .mq-ws-aud-side {
    border-right: 0;
    border-bottom: 1px solid var(--mq-ws-line);
    flex-direction: row;
    flex-wrap: wrap;
    max-height: 140px;
  }
  .mq-ws-aud-side-scroll {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
.mq-ws-multi-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}
.mq-ws-multi-label {
  font-size: 13px;
  font-weight: 600;
}
.mq-ws-multi-trigger {
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  color: var(--mq-ws-ink);
}
.mq-ws-multi-trigger:hover,
.mq-ws-multi-trigger:focus-visible {
  border-color: var(--mq-ws-accent, #1a7f4e);
  outline: none;
}
.mq-ws-multi-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(26, 35, 50, 0.12);
  padding: 8px;
}
.mq-ws-multi-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}
.mq-ws-multi-check input {
  margin-top: 2px;
  flex: 0 0 auto;
}
.mq-ws-class-archive {
  margin-top: 12px;
  border-top: 1px solid var(--mq-ws-line);
  padding-top: 10px;
}
.mq-ws-class-archive summary,
.mq-ws-class-create summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--mq-ws-ink);
  user-select: none;
}
.mq-ws-class-create {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px dashed var(--mq-ws-line, #cbd5e1);
  border-radius: 8px;
  background: #f8fafc;
}
.mq-ws-class-create[open] { background: #fff; }
.mq-ws-class-create .mq-ws-assign-class-form { margin-top: 10px; }
.mq-ws-class-create-bar {
  flex-shrink: 0;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 8px;
  background: #f4faf8;
}
.mq-ws-asg-panel--classes > .mq-ws-class-filters,
.mq-ws-asg-panel--classes > .mq-ws-asg-hint,
.mq-ws-asg-panel--classes > .mq-ws-class-archive,
.mq-ws-asg-panel--grades > .mq-ws-assign-class-form,
.mq-ws-asg-panel--grades > .mq-ws-class-filters {
  flex-shrink: 0;
}
.mq-ws-classes-board {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(360px, 1.4fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  width: 100%;
  align-items: stretch;
}
.mq-ws-asg-panel--grades,
.mq-ws-asg-panel--classes {
  min-height: 0;
}
.mq-ws-classes-table-scroll {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.mq-ws-class-filters {
  margin: 0 0 8px;
}
.mq-ws-assign-class-form--create {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 8px;
}
.mq-ws-asg-panel--classes .mq-ws-assign-class-form--create {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}
@media (max-width: 900px) {
  .mq-ws-classes-board {
    grid-template-columns: 1fr;
  }
}
.mq-ws-class-row {
  cursor: context-menu;
}
.mq-ws-stu-hint {
  font-size: 12px;
  margin: 0 0 12px;
}
.mq-ws-stu-list-head {
  margin: 8px 0 8px;
}
.mq-ws-stu-table-wrap {
  margin: 0;
}
.mq-ws-stu-list-scroll .mq-ws-stu-table thead th,
#mq-ws-stu-list .mq-ws-stu-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 var(--mq-ws-line, #e2e8f0);
}
.mq-ws-stu-sort {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
}
.mq-ws-stu-sort:hover {
  color: var(--mq-ws-accent, #0f766e);
}
.mq-ws-stu-row {
  cursor: context-menu;
}
.mq-ws-stu-name {
  font-weight: 700;
}
.mq-ws-stu-contact {
  font-size: 11px;
  margin-top: 3px;
}
.mq-ws-stu-td-sbd,
.mq-ws-stu-td-quizzes {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mq-ws-stu-th-quizzes,
.mq-ws-stu-td-quizzes {
  text-align: right;
}
.mq-ws-stu-th-quizzes .mq-ws-stu-sort {
  width: 100%;
  text-align: right;
}
.mq-ws-stu-row.is-editing > td {
  background: #f8fafb;
  padding: 10px 12px;
  vertical-align: top;
}
.mq-ws-stu-edit-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 0.9fr) minmax(90px, 0.6fr) auto;
  gap: 8px 10px;
  align-items: end;
}
.mq-ws-stu-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mq-ws-muted, #64748b);
  min-width: 0;
}
.mq-ws-stu-edit {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 32px;
  height: 32px;
  padding: 3px 8px;
  font-size: 13px;
  border: 1px solid var(--mq-ws-line, #e2e8f0);
  border-radius: 6px;
  background: #fff;
}
.mq-ws-stu-edit:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: #0f766e;
}
.mq-ws-stu-edit-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-bottom: 1px;
}
.mq-ws-stu-row-err {
  grid-column: 1 / -1;
  font-size: 11px;
  color: #b91c1c;
  min-height: 0;
}
.mq-ws-stu-row.is-sbd-dup .mq-ws-stu-edit-sbd {
  border-color: #dc2626;
  background: #fef2f2;
}
.mq-ws-stu-row.is-saving {
  opacity: 0.72;
}
.mq-ws-stu-save,
.mq-ws-stu-cancel {
  min-height: 28px !important;
  height: 28px;
  padding: 2px 8px !important;
  font-size: 12px !important;
}
@media (max-width: 720px) {
  .mq-ws-stu-edit-form {
    grid-template-columns: 1fr 1fr;
  }
  .mq-ws-stu-edit-actions {
    grid-column: 1 / -1;
  }
}
.mq-ws-stu-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.mq-ws-stu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mq-ws-stu-panel {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--mq-ws-line);
  border-radius: 10px;
  background: #f8fafb;
}
.mq-ws-stu-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 12px;
}
.mq-ws-stu-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mq-ws-ink);
}
.mq-ws-stu-form label[hidden] {
  display: none !important;
}
.mq-ws-stu-form input,
.mq-ws-stu-form select {
  font-weight: 500;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}
.mq-ws-stu-form .mq-ws-assign-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 550;
  grid-column: 1 / -1;
}
.mq-ws-stu-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.mq-ws-stu-file input[type="file"] {
  padding: 6px 0;
  border: 0;
  background: transparent;
}
.mq-ws-stu-creds {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #86efac;
  border-radius: 10px;
  background: var(--mq-ws-ok-bg);
}
.mq-ws-stu-creds-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.mq-ws-stu-creds code {
  font-family: var(--mq-ws-mono);
  font-size: 13px;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--mq-ws-line);
}
.mq-ws-stu-dir {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #cce3de;
  background: #f4faf8;
  border-radius: 8px;
}
.mq-ws-stu-dir-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0 0 10px;
}
.mq-ws-stu-dir .mq-ws-table-wrap {
  max-height: 280px;
  overflow: auto;
}
.mq-ws-stu-dir .mq-ws-btn {
  min-height: 36px;
  height: auto;
  white-space: nowrap;
}
.mq-ws-prev-focus-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
}
.mq-ws-prev-q.is-focus-hidden {
  display: none !important;
}
.mq-ws-prev-q.is-active {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 8px;
}
.mq-ws-assign-check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500 !important;
}
.mq-ws-mode-fieldset {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 6px 8px;
  margin: 0 0 10px;
  background: #f8fafc;
}
.mq-ws-mode-fieldset legend {
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.mq-ws-mode-option {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 8px;
  padding: 6px 4px;
  cursor: pointer;
}
.mq-ws-mode-option + .mq-ws-mode-option {
  border-top: 1px solid #e2e8f0;
}
.mq-ws-mode-fieldset--row .mq-ws-mode-option + .mq-ws-mode-option {
  border-top: 0;
}
.mq-ws-mode-option .mq-ws-muted {
  flex: 1 1 100%;
  margin-left: 22px;
  font-size: 12px;
}
.mq-ws-mode-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f7;
  color: #334155;
}
.mq-ws-asg-dup {
  background: #fef3c7;
  color: #92400e;
}
.mq-ws-assign-st.is-on { color: #15803d; font-weight: 700; }
.mq-ws-assign-st.is-off { color: #64748b; }

/* Theo dõi — trạng thái học sinh */
.mq-ws-track-st {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.mq-ws-track-st.is-submitted {
  color: #15803d;
  background: #f0fdf4;
}
.mq-ws-track-st.is-progress {
  color: #1d4ed8;
  background: #eff6ff;
}
.mq-ws-track-st.is-pending {
  color: #b45309;
  background: #fff7ed;
}
.mq-ws-track-st.is-other {
  color: #475569;
  background: #f1f5f9;
}
.mq-ws-track-stat.is-submitted {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.mq-ws-track-stat.is-submitted .mq-ws-stat-value { color: #15803d; }
.mq-ws-track-stat.is-progress {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.mq-ws-track-stat.is-progress .mq-ws-stat-value { color: #1d4ed8; }
.mq-ws-track-stat.is-pending {
  border-color: #fed7aa;
  background: #fff7ed;
}
.mq-ws-track-stat.is-pending .mq-ws-stat-value { color: #b45309; }
.mq-ws-assign-acts {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mq-ws-assign-link {
  min-width: 150px;
  white-space: nowrap;
}
.mq-ws-assign-link .mq-ws-btn {
  margin: 2px 4px 2px 0;
}

/* Compact assignment action + extra-attempt modal */
.mq-ws-assign-acts .mq-ws-assign-attempts {
  min-height: 38px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
  border-width: 1px;
}
.mq-ws-extra-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}
.mq-ws-extra-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.48);
}
.mq-ws-extra-dialog {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  margin: 7vh auto 0;
  overflow: auto;
  background: var(--mq-ws-surface);
  border: 1px solid var(--mq-ws-line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15,23,42,.28);
  padding: 20px;
}
.mq-ws-extra-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:8px;
}
.mq-ws-extra-head h3 { margin:0; font-size:20px; }
.mq-ws-extra-head p { margin:3px 0 0; color:var(--mq-ws-muted); font-size:12px; }
.mq-ws-extra-close { min-height:38px; width:38px; padding:0; font-size:22px; }
.mq-ws-extra-label { display:block; margin-top:14px; font-weight:600; }
.mq-ws-extra-label select,
.mq-ws-extra-label input { display:block; width:100%; margin-top:6px; min-height:42px; box-sizing:border-box; }
.mq-ws-extra-target {
  margin-top:10px;
  max-height:320px;
  overflow:auto;
  border:1px solid var(--mq-ws-line);
  border-radius:9px;
  padding:10px 12px;
  background:#fff;
}
.mq-ws-extra-subhead { font-weight:700; margin-bottom:6px; }
.mq-ws-extra-check { display:flex; align-items:flex-start; gap:8px; padding:7px 4px; cursor:pointer; font-weight:500; }
.mq-ws-extra-check input { margin-top:3px; flex:0 0 auto; }
.mq-ws-extra-check small { color:var(--mq-ws-muted); font-weight:400; }
.mq-ws-extra-footer { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
@media (max-width:700px) {
  .mq-ws-extra-dialog { margin:4vh auto 0; max-height:90vh; padding:16px; }
  .mq-ws-extra-target { max-height:250px; }
}

@media (max-width: 1100px) {
  .mq-ws-assign-board,
  .mq-ws-assign-board.is-mix {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .mq-ws-asg-panel--suggest {
    grid-column: 1 / -1;
    max-height: 240px;
  }
}
@media (max-width: 900px) {
  .mq-ws-rex-split { flex-direction: column; }
  .mq-ws-rex-side {
    flex: none;
    width: auto;
    max-width: none;
    overflow: visible;
  }
  .mq-ws-rex-listcol .mq-ws-rex-sources {
    min-height: 280px;
    max-height: 52vh;
    height: auto;
  }
}
@media (max-width: 900px) {
  .mq-ws-assign-layout,
  .mq-ws-assign-stack,
  .mq-ws-assign-board,
  .mq-ws-assign-board.is-mix {
    grid-template-columns: 1fr;
  }
  .mq-ws-asg-panel--suggest {
    grid-column: auto;
    max-height: none;
  }
  .mq-ws-track-split {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .mq-ws-track-chrome {
    border-right: 0;
    padding-right: 0;
    overflow: visible;
  }
  .mq-ws-track-scroll {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .mq-ws-track-list {
    height: auto;
  }
  .mq-ws-assign-page,
  .mq-ws-assign-root,
  .mq-ws-assign-root:has(.mq-ws-assign-board),
  .mq-ws-assign-root:has(.mq-ws-classes-board),
  .mq-ws-assign-root:has(.mq-ws-track-page),
  .mq-ws-assign-root:has(.mq-ws-stu-page),
  .mq-ws-assign-board,
  .mq-ws-assign-board.is-mix {
    display: flex;
    flex-direction: column;
    flex: none;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
  }
  .mq-ws-assign-board,
  .mq-ws-assign-board.is-mix {
    display: grid;
  }
  .mq-ws-asg-panel {
    max-height: none;
    overflow: visible;
    flex: none;
    height: auto;
  }
  .mq-ws-asg-panel-scroll,
  .mq-ws-aud-list-scroll,
  .mq-ws-assign-scroll {
    max-height: none;
    overflow: visible;
    flex: none;
  }
  .mq-ws-assign-grid2,
  .mq-ws-assign-grid4 {
    grid-template-columns: 1fr 1fr;
  }
  .mq-ws-assign-class-form,
  .mq-ws-assign-student-filters {
    grid-template-columns: 1fr;
  }
  .mq-ws-assign-student-filters.mq-ws-stu-filters-compact {
    grid-template-columns: 1fr 1fr auto;
    max-width: none;
  }
  .mq-ws-assign-form select,
  .mq-ws-assign-form input {
    min-height: 40px;
    font-size: 16px;
  }
  .mq-ws-assign-form .mq-ws-btn-primary,
  .mq-ws-asg-panel-foot .mq-ws-btn-primary {
    width: 100%;
    min-height: 44px;
  }
}

/* UI-6D Results workspace */
.mq-ws-res-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}
.mq-ws-res-chrome { flex-shrink: 0; }
.mq-ws-res-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.mq-ws-res-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.mq-ws-res-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mq-ws-res-page .mq-ws-active-quiz {
  margin: 8px 0 0;
  padding: 6px 10px;
  gap: 8px;
}
.mq-ws-res-page .mq-ws-btn,
.mq-ws-res-page .mq-ws-btn-sm,
.mq-ws-res-filters .mq-ws-btn,
.mq-ws-res-table .mq-ws-btn {
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}
.mq-ws-res-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 0 8px;
  align-items: flex-end;
}
.mq-ws-res-filters label,
.mq-ws-res-fl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  font-weight: 650;
  color: #5b6b7c;
  min-width: 108px;
  flex: 1 1 108px;
}
.mq-ws-res-fl-wide { min-width: 160px; flex: 1.4 1 160px; }
.mq-ws-res-fl-num { min-width: 64px; flex: 0 0 64px; }
.mq-ws-res-filter-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  flex: 0 0 auto;
  padding-bottom: 0;
}
.mq-ws-res-filters select,
.mq-ws-res-filters input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 30px;
  height: 30px;
  font-size: 13px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 2px 8px;
}
.mq-ws-res-table-wrap { overflow: auto; }
.mq-ws-res-table th,
.mq-ws-res-table td {
  padding: 6px 8px;
  font-size: 13px;
}
.mq-ws-res-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
  box-shadow: 0 1px 0 var(--mq-ws-line, #e2e8f0);
}
.mq-ws-ac-cell { white-space: nowrap; }
.mq-ws-ac-cell[data-level="HIGH_RISK"],
.mq-ws-ac-cell[data-level="REVIEW_REQUIRED"] {
  color: #b45309;
  font-weight: 650;
}
.mq-ws-ac-cell[data-level="NONE"] { color: #94a3b8; }

@media (min-width: 769px) {
  .mq-ws-main:has(.mq-ws-res-page),
  .mq-ws-main:has(#mq-ws-results-root),
  .mq-ws-main:has(#mq-ws-guests-root),
  .mq-ws-main:has(.mq-ws-assign-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 16px;
  }
  /* Flex chain: main → view → page → root → list → table-wrap (scroll) */
  .mq-ws-view:has(.mq-ws-res-page),
  .mq-ws-view:has(#mq-ws-results-root),
  .mq-ws-view:has(#mq-ws-guests-root),
  .mq-ws-view:has(.mq-ws-assign-page),
  .mq-ws-view:has(.mq-ws-res-page) > .mq-ws-res-page,
  .mq-ws-view:has(#mq-ws-guests-root) > .mq-ws-guests-page,
  .mq-ws-view:has(.mq-ws-assign-page) > .mq-ws-assign-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-width: none;
  }
  .mq-ws-guests-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .mq-ws-res-chrome,
  .mq-ws-guests-toolbar,
  .mq-ws-view:has(#mq-ws-guests-root) > .mq-ws-guests-page > .mq-ws-active-quiz {
    flex-shrink: 0;
  }
  #mq-ws-results-root,
  #mq-ws-guests-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .mq-ws-res-filters {
    flex-shrink: 0;
    background: var(--mq-ws-bg, #f4f7f9);
    z-index: 2;
    padding-bottom: 4px;
  }
  .mq-ws-guests-hint {
    flex-shrink: 0;
    margin: 0 0 6px;
    font-size: 12px;
  }
  #mq-ws-res-list,
  #mq-ws-guests-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  #mq-ws-res-list .mq-ws-res-table-wrap,
  #mq-ws-guests-list .mq-ws-res-table-wrap {
    flex: 1 1 auto;
    min-height: 120px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .mq-ws-res-pager { flex-shrink: 0; }
}

/* Narrow Giao bài: one column is taller than the screen. Scroll .mq-ws-main.
   The desktop rule above sets overflow:hidden and flex-shrinks the page to
   the viewport, which is what made a phone unable to move past Đề đề xuất. */
@media (max-width: 900px) {
  .mq-ws-main:has(.mq-ws-assign-page) {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: auto;
  }
  .mq-ws-view:has(.mq-ws-assign-page),
  .mq-ws-view:has(.mq-ws-assign-page) > .mq-ws-assign-page {
    flex: none;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
  }
}
.mq-ws-guests-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mq-ws-guests-title {
  margin: 0;
  font-size: 1.35rem;
}
.mq-ws-guests-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mq-ws-guests-help summary {
  list-style: none;
}
.mq-ws-guests-help-body {
  min-width: 260px;
  max-width: 320px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--mq-ws-muted, #64748b);
}
.mq-ws-guests-help-body p { margin: 0; }
.mq-ws-guests-page .mq-ws-active-quiz {
  margin-bottom: 8px;
  padding: 6px 10px;
}
.mq-ws-guests-page .mq-ws-active-quiz .mq-ws-btn {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}
.mq-ws-guests-filters label {
  font-size: 13px;
}
.mq-ws-guest-more-cell {
  width: 48px;
  text-align: right;
  white-space: nowrap;
}
.mq-ws-res-cards { display: none; }
.mq-ws-guest-link-cell {
  min-width: 220px;
}
.mq-ws-guest-link-cell select,
.mq-ws-res-cards .mq-ws-guest-class,
.mq-ws-res-cards .mq-ws-guest-user {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  min-height: 40px;
  font-size: 14px;
}
.mq-ws-guest-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mq-ws-btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}
.mq-ws-res-summary {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.mq-ws-res-score {
  font-size: 1.75rem;
  font-weight: 800;
  color: #15803d;
  margin: 8px 0;
}
.mq-ws-res-answers,
.mq-ws-res-int {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.mq-ws-res-q { border-top: 1px solid #eef2f6; padding: 8px 0; }
.mq-ws-res-q-toggle {
  width: 100%;
  text-align: left;
  min-height: 44px;
  font-size: 16px;
  font-weight: 700;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #0b1220;
}
.mq-ws-res-stem { margin: 6px 0 10px; line-height: 1.5; }
.mq-ws-res-essay {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}
.mq-ws-ok { color: #15803d; font-weight: 700; }
.mq-ws-bad { color: #b91c1c; font-weight: 700; }
.mq-ws-res-risk {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-weight: 800;
  letter-spacing: .02em;
}
.mq-ws-res-risk[data-level="REVIEW_REQUIRED"],
.mq-ws-res-risk[data-level="HIGH_RISK"] {
  background: #fff7ed;
  color: #9a3412;
}
.mq-ws-res-review-note {
  color: #9a3412;
  font-weight: 650;
}
.mq-ws-res-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.mq-ws-res-counts li {
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.mq-ws-res-timeline {
  max-height: 280px;
  overflow: auto;
  font-size: 13px;
  color: #334155;
}
.mq-ws-res-pager {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.mq-ws-back { margin: 0 0 12px; }
@media (max-width: 800px) {
  .mq-ws-res-table-wrap { display: none; }
  .mq-ws-res-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mq-ws-res-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
  }
  .mq-ws-res-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
  .mq-ws-res-card .mq-ws-btn-primary {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    margin-top: 8px;
  }
}

/* UI-7 Dashboard analytics */
.mq-ws-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mq-ws-stat-na { color: #94a3b8; font-weight: 700; }
.mq-ws-dash-priority {
  border-left: 4px solid #ea580c;
  margin-bottom: 16px;
}
.mq-ws-dash-case-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mq-ws-dash-case {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #eef2f6;
}
.mq-ws-dash-bars {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mq-ws-dash-bars li {
  display: grid;
  grid-template-columns: 88px 1fr 40px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 14px;
}
.mq-ws-dash-bar-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.mq-ws-dash-bar-track > span {
  display: block;
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
}
.mq-ws-dash-bar-n { text-align: right; font-weight: 700; }
.mq-ws-dash-cards { display: none; }
.mq-ws-dash-table-wrap { overflow: auto; }
@media (max-width: 800px) {
  .mq-ws-dash-table-wrap { display: none; }
  .mq-ws-dash-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .mq-ws-dash-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
  }
  .mq-ws-dash-card h3 { margin: 0 0 6px; }
  .mq-ws-dash-card .mq-ws-btn-primary { min-height: 44px; margin-top: 8px; }
  .mq-ws-dash-bars li {
    grid-template-columns: 72px 1fr 36px;
  }
}

/* UI-8 Import + form control alignment */
.mq-ws-compose-toolbar,
.mq-ws-compose-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  align-items: center;
}
.mq-ws-compose-toolbar .mq-ws-btn {
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  box-sizing: border-box;
  white-space: nowrap;
}
.mq-ws-folder-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  user-select: none;
}
.mq-ws-folder-bar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--mq-ws-muted);
  margin-right: 4px;
}
.mq-ws-folder-chip {
  border: 1px solid var(--mq-ws-line);
  background: #fff;
  color: var(--mq-ws-ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.mq-ws-folder-chip:hover,
.mq-ws-folder-chip:focus-visible {
  border-color: var(--mq-ws-accent);
  outline: none;
}
.mq-ws-folder-chip.is-active {
  background: var(--mq-ws-accent-soft);
  border-color: var(--mq-ws-accent);
  color: var(--mq-ws-accent);
}
.mq-ws-folder-chip.is-child {
  font-weight: 550;
  opacity: 0.95;
}
.mq-ws-quiz-row.is-cut,
.mq-ws-explorer-row.is-cut {
  opacity: 0.45;
}

/* Windows-like explorer for Soạn đề */
.mq-ws-explorer {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 0;
  min-height: min(62vh, 640px);
  background: var(--mq-ws-surface);
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  box-shadow: var(--mq-ws-shadow);
  overflow: hidden;
}
.mq-ws-explorer-side {
  border-right: 1px solid var(--mq-ws-line);
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.mq-ws-explorer-side-head {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mq-ws-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--mq-ws-line);
}
.mq-ws-explorer-tree {
  overflow: auto;
  padding: 6px 4px 12px;
  flex: 1;
}
.mq-ws-tree-node {
  display: block;
}
.mq-ws-tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 6px 8px 6px calc(8px + (var(--d, 0) * 14px));
  border-radius: 6px;
  cursor: pointer;
  color: var(--mq-ws-ink);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.25;
}
.mq-ws-tree-item:hover,
.mq-ws-tree-item:focus-visible {
  background: #e8eef4;
  outline: none;
}
.mq-ws-tree-item.is-active {
  background: #cfe8e2;
  color: var(--mq-ws-accent);
}
.mq-ws-tree-item-flat {
  margin-top: 8px;
  border-top: 1px solid var(--mq-ws-line);
  border-radius: 0 0 6px 6px;
  padding-top: 10px;
  color: var(--mq-ws-muted);
}
.mq-ws-tree-twist {
  width: 14px;
  flex: 0 0 14px;
  font-size: 11px;
  color: var(--mq-ws-muted);
  text-align: center;
  user-select: none;
}
.mq-ws-tree-twist.is-empty {
  visibility: hidden;
}
.mq-ws-tree-ico {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}
.mq-ws-tree-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mq-ws-tree-count {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--mq-ws-muted);
  font-weight: 600;
}
.mq-ws-explorer-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}
.mq-ws-explorer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--mq-ws-line);
  background: #fbfcfd;
}
.mq-ws-explorer-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 0;
  font-size: 13px;
}
.mq-ws-crumb {
  border: 0;
  background: transparent;
  color: var(--mq-ws-accent);
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.mq-ws-crumb:hover,
.mq-ws-crumb:focus-visible {
  background: var(--mq-ws-accent-soft);
  outline: none;
}
.mq-ws-crumb.is-current {
  color: var(--mq-ws-ink);
  cursor: default;
  font-weight: 700;
}
.mq-ws-crumb-sep {
  color: var(--mq-ws-muted);
  user-select: none;
}
.mq-ws-explorer-search {
  flex: 0 1 200px;
}
.mq-ws-explorer-search input {
  width: 100%;
  border: 1px solid var(--mq-ws-line);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  background: #fff;
}
.mq-ws-explorer-card {
  flex: 1;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.mq-ws-explorer-table .mq-ws-explorer-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mq-ws-explorer-table .mq-ws-explorer-name a,
.mq-ws-explorer-open {
  border: 0;
  background: transparent;
  color: var(--mq-ws-ink);
  font-weight: 600;
  font-size: 14px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.mq-ws-explorer-table .mq-ws-explorer-name a:hover,
.mq-ws-explorer-open:hover {
  color: var(--mq-ws-accent);
  text-decoration: underline;
}
.mq-ws-file-ico {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
}
.mq-ws-explorer-row {
  cursor: default;
}
.mq-ws-explorer-row:hover,
.mq-ws-explorer-row:focus-visible {
  background: #f0f7f5;
  outline: none;
}
.mq-ws-folder-row {
  cursor: pointer;
}
.mq-ws-explorer-status {
  margin-top: auto;
  padding: 8px 12px;
  border-top: 1px solid var(--mq-ws-line);
  font-size: 12px;
  color: var(--mq-ws-muted);
  background: #fbfcfd;
}
@media (max-width: 860px) {
  .mq-ws-explorer {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .mq-ws-explorer-side {
    border-right: 0;
    border-bottom: 1px solid var(--mq-ws-line);
    max-height: 220px;
  }
}
.mq-ws-ctx-menu {
  position: fixed;
  z-index: 100000;
  min-width: 210px;
  max-width: min(320px, 92vw);
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  box-shadow: 0 8px 24px rgba(26, 35, 50, 0.14);
  padding: 4px 0;
  border-radius: 8px;
}
.mq-ws-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--mq-ws-ink);
}
.mq-ws-ctx-menu button:hover,
.mq-ws-ctx-menu button:focus-visible {
  background: var(--mq-ws-accent-soft);
  outline: none;
}
.mq-ws-ctx-sep {
  height: 1px;
  background: var(--mq-ws-line);
  margin: 4px 0;
}
.mq-ws-ctx-menu button.is-disabled,
.mq-ws-ctx-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.mq-ws-folder-picker {
  position: fixed;
  inset: 0;
  z-index: 100010;
  background: rgba(26, 35, 50, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mq-ws-folder-picker-panel {
  width: min(420px, 96vw);
  max-height: min(72vh, 560px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(26, 35, 50, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mq-ws-folder-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.mq-ws-folder-picker-head strong {
  font-size: 16px;
}
.mq-ws-folder-picker-list {
  overflow: auto;
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mq-ws-folder-pick-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--mq-ws-line);
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.mq-ws-folder-pick-item:hover,
.mq-ws-folder-pick-item:focus-visible {
  border-color: var(--mq-ws-accent);
  background: var(--mq-ws-accent-soft);
  outline: none;
}
.mq-ws-folder-pick-ico {
  font-size: 18px;
  line-height: 1.2;
}
.mq-ws-folder-pick-item strong {
  display: block;
  font-size: 14px;
}
.mq-ws-folder-pick-item em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--mq-ws-muted);
  margin-top: 2px;
}
.mq-ws-folder-picker-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--mq-ws-line);
  display: flex;
  justify-content: flex-end;
}
.mq-ws-import-formats {
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--mq-ws-muted);
}
.mq-ws-table-wrap {
  overflow: auto;
  max-width: 100%;
}
.mq-ws-import-sources {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.mq-ws-import-pill {
  flex: 0 0 auto;
  min-height: 40px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mq-ws-import-pill.is-active {
  background: #1e3a5f;
  border-color: #1e3a5f;
  color: #fff;
}
.mq-ws-import-panel .mq-ws-h2 { margin-top: 0; }
.mq-ws-import-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}
.mq-ws-import-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.mq-ws-import-fields input[type="text"],
.mq-ws-import-fields input[type="number"],
.mq-ws-import-fields input[type="file"],
.mq-ws-import-fields textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  font-weight: 400;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
}
.mq-ws-import-fields input[type="text"],
.mq-ws-import-fields input[type="number"] {
  min-height: 44px;
  height: 44px;
}
.mq-ws-import-fields textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.45;
}
.mq-ws-import-file input[type="file"] {
  min-height: 44px;
  padding: 8px;
}
.mq-ws-import-fname {
  font-size: 13px;
  font-weight: 500;
  color: #5b6b7c;
}
.mq-ws-import-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}
.mq-ws-import-opts label {
  margin: 0;
}
.mq-ws-import-opts input[type="number"] {
  width: 100px;
}
.mq-ws-import-actions {
  align-items: center;
}
.mq-ws-import-actions .mq-ws-btn {
  min-height: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mq-ws-import-status {
  min-height: 1.25em;
  font-size: 14px;
  color: #334155;
}
.mq-ws-import-preview {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.mq-ws-import-list {
  margin: 8px 0 0;
  padding-left: 1.25rem;
  font-size: 14px;
  line-height: 1.5;
}
.mq-ws-import-list li.is-warn {
  color: #b45309;
}

/* Harden results filter row vertical alignment */
.mq-ws-res-filters {
  align-items: flex-end;
}
.mq-ws-res-filters label {
  justify-content: flex-end;
}
.mq-ws-res-filters select,
.mq-ws-res-filters input[type="search"],
.mq-ws-res-filters input[type="text"],
.mq-ws-res-filters input[type="number"] {
  line-height: 1.25;
}
.mq-ws-res-filters .mq-ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .mq-ws-import-sources {
    flex-wrap: nowrap;
  }
  .mq-ws-import-opts {
    flex-direction: column;
    align-items: stretch;
  }
  .mq-ws-import-actions .mq-ws-btn {
    width: 100%;
  }
  .mq-ws-compose-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .mq-ws-compose-toolbar .mq-ws-btn {
    width: 100%;
    min-height: 44px;
    height: 44px;
  }
  .mq-ws-res-filters label,
  .mq-ws-res-fl {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }
  .mq-ws-res-filter-actions {
    flex: 1 1 100%;
  }
  .mq-ws-res-filter-actions .mq-ws-btn {
    flex: 1;
  }
}

/* Quiz hub (Soạn đề → chọn đề) */
.mq-ws-quiz-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.mq-ws-quiz-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mq-ws-quiz-hub {
  display: block;
}
.mq-ws-quiz-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mq-ws-student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.mq-ws-student-card {
  background: var(--mq-ws-surface);
  border: 1px solid var(--mq-ws-line);
  border-radius: var(--mq-ws-radius);
  padding: 14px;
  box-shadow: var(--mq-ws-shadow);
}
.mq-ws-student-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.mq-ws-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e8eef5;
  color: #3b4a5c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.mq-ws-attempt-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.mq-ws-attempt-k {
  font-size: 12px;
  color: var(--mq-ws-muted);
}
.mq-ws-attempt-v {
  font-size: 18px;
  font-weight: 700;
}
.mq-ws-export-menu {
  position: relative;
}
.mq-ws-export-menu summary {
  list-style: none;
  cursor: pointer;
}
.mq-ws-export-menu summary::-webkit-details-marker { display: none; }
.mq-ws-export-list {
  position: absolute;
  right: 0;
  z-index: 5;
  margin-top: 4px;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--mq-ws-line);
  border-radius: 8px;
  box-shadow: var(--mq-ws-shadow);
  padding: 6px;
}
.mq-ws-export-list button,
.mq-ws-export-list a {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
}
.mq-ws-export-list button:hover,
.mq-ws-export-list a:hover {
  background: var(--mq-ws-accent-soft);
}
.mq-ws-quiz-more-danger {
  color: var(--mq-ws-err);
}

@media (max-width: 480px) {
  .mq-ws-compose-toolbar {
    grid-template-columns: 1fr;
  }
  .mq-ws-header {
    padding: 0 10px;
    gap: 8px;
  }
  .mq-ws-main {
    padding: 12px 10px;
  }
}
