:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1d26;
  --muted: #5c6478;
  --border: #d8dce6;
  --accent: #2563eb;
  --accent-hi: #1d4ed8;
  --accent-soft: #eef2ff;
  --danger: #b91c1c;
  --warn-bg: #fffbeb;
  --warn-border: #fcd34d;
  --radius: 8px;
  --input-pad: 0.55rem 0.65rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
}

.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

.top-tagline {
  color: var(--muted);
  font-size: 0.875rem;
}

.top-nav {
  margin-left: auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

.top-nav a:hover { text-decoration: underline; }

.top-nav form { margin: 0; display: inline; }

.top-nav .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.wrap-wide { max-width: 56rem; }

h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.hint.danger { color: var(--danger); }

a { color: var(--accent); }

a.btn,
button.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.35;
  cursor: pointer;
  vertical-align: middle;
}

a.btn:hover,
button.btn:hover {
  background: #f8fafc;
  border-color: #c5cdd9;
}

a.btn.primary,
button.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

a.btn.primary:hover,
button.btn.primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}

a.btn.btn-excel,
button.btn.btn-excel {
  background: #217346;
  border-color: #1a5c38;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(33, 115, 70, 0.25);
}

a.btn.btn-excel:hover,
button.btn.btn-excel:hover {
  background: #1a5c38;
  border-color: #14532d;
  color: #fff;
}

a.btn.btn-pdf,
button.btn.btn-pdf {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.25);
}

a.btn.btn-pdf:hover,
button.btn.btn-pdf:hover {
  background: #991b1b;
  border-color: #7f1d1d;
  color: #fff;
}

.guide-back {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
}

.btn-row .btn { margin: 0; }

.teacher-report-row {
  margin-top: 0;
  align-items: center;
}

.teacher-simulate-form {
  display: inline-flex;
  margin: 0;
}

.teacher-simulate-form .btn {
  margin: 0;
}

@media (max-width: 520px) {
  .teacher-report-row {
    flex-direction: column;
    align-items: stretch;
  }

  .teacher-simulate-form {
    display: block;
  }

  .teacher-simulate-form .btn {
    width: 100%;
  }
}

.card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin: 1rem 0;
}

.card h2,
.panel h2 {
  margin-top: 0;
}

.panel-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stack > label,
.stack .field {
  display: block;
  margin-bottom: 1.1rem;
}

.stack > label:last-child,
.stack .field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.field-input,
.stack input[type="text"],
.stack input[type="password"],
.stack input[type="email"],
.stack input[type="search"],
.stack textarea,
.stack select,
.fieldset-body input[type="text"],
.ac-wrap input[type="text"] {
  width: 100%;
  margin: 0;
  padding: var(--input-pad);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus,
.stack input:focus,
.stack textarea:focus,
.stack select:focus,
.fieldset-body input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.stack textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.45;
}

.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88rem;
  word-break: break-all;
}

.copy-line {
  background: var(--accent-soft);
  padding: 0.75rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #dbeafe;
  margin: 0.5rem 0 0.75rem;
}

.copy-actions { margin-top: 0.5rem; }

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0.75rem 0;
}

.alert-error {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.alert-warn {
  color: #92400e;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.alert-info {
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.is-hidden { display: none !important; }

.survey-reveal {
  margin-top: 1.5rem;
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.survey-reveal.is-visible {
  opacity: 1;
  transform: none;
}

.page-intro {
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
  background: var(--card);
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.qtext {
  margin: 0 0 0.85rem;
  color: #334155;
  line-height: 1.5;
}

.question-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.75rem 0;
  background: #fafbff;
}

.question-block legend {
  font-weight: 600;
}

.question-block .q-text {
  width: 100%;
  min-height: 4.5rem;
  margin: 0.5rem 0 0.75rem;
  padding: var(--input-pad);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
  display: block;
}

.question-block .q-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.95rem;
  cursor: pointer;
}

.question-block .q-type input { width: auto; margin: 0; }

.question-block .q-actions { margin-top: 0.5rem; }

.question-negative {
  border-color: #fca5a5;
  background: #fffbfb;
}

.question-positive {
  border-color: #86efac;
  background: #f7fff9;
}

.pick-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.45rem 0;
}

.rank {
  flex: 0 0 1.75rem;
  color: var(--muted);
  padding-top: 0.55rem;
  text-align: right;
  font-size: 0.9rem;
}

.add-pick-btn { margin-top: 0.65rem; }

.ac-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.ac-list,
#login-ac-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  max-height: 14rem;
  overflow: auto;
}

.ac-list li,
#login-ac-list li {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.ac-list li:hover,
.ac-list li.active,
#login-ac-list li:hover,
#login-ac-list li.active {
  background: var(--accent-soft);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.75rem 0;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:hover { background: #f8fafc; }

.data-table .num { text-align: right; white-space: nowrap; }

.data-table .actions {
  white-space: nowrap;
  text-align: right;
}

.data-table .actions .btn {
  margin-left: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.student-list {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 2rem;
}

.student-list li {
  margin: 0.2rem 0;
  break-inside: avoid;
}

.done-panel {
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 24rem;
  margin: 2rem auto;
}

.done-panel h1 { margin-bottom: 0.75rem; }

.form-actions {
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

.form-actions .btn.primary {
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
}

.form-actions-dual {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-actions-dual .btn {
  flex: 1;
  min-width: 10rem;
  text-align: center;
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
}

.preview-banner {
  margin-bottom: 1rem;
}

.preview-section-divider {
  margin: 2rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border, #d1d5db);
  color: var(--muted);
  font-size: 0.95rem;
}

.survey-reveal.preview-stack {
  margin-top: 0;
  opacity: 1;
  transform: none;
}

/* Report page */
table.matrix {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

table.matrix th,
table.matrix td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: center;
}

table.matrix th.rowh,
table.matrix td.rowh {
  text-align: left;
  max-width: 14rem;
}

table.matrix .filter-row input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: #94a3b8; font-weight: normal; }

.socio-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  background: #fafbff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.socio-svg circle.ring { fill: none; stroke: #cbd5e1; stroke-width: 1; }
.socio-svg text.name { font-size: 10px; text-anchor: middle; fill: #334155; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: #1e3a8a;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.graph-wrap {
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcff;
  overflow: hidden;
}

.graph-wrap svg {
  width: 100%;
  height: 760px;
  display: block;
}

.graph-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.6rem 0 0.9rem;
  font-size: 0.9rem;
}

.graph-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.network-status {
  margin: 0.25rem 0 0.5rem;
}

.target-legend {
  margin-top: 1rem;
}

.target-legend-table {
  font-size: 0.85rem;
}

.target-legend-table td,
.target-legend-table th {
  padding: 0.35rem 0.5rem;
}

.graph-wrap-target {
  min-height: 640px;
}

.graph-wrap-target svg {
  height: 640px;
}

.graph-wrap-inner {
  width: 100%;
  height: 100%;
  min-height: 640px;
}

.graph-wrap-inner svg {
  width: 100%;
  height: 640px;
  display: block;
}

#targetWrapOuter,
#networkWrapOuter {
  position: relative;
}

.graph-hover-tip {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 5;
  max-width: 90%;
  padding: 0.5rem 0.85rem;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.9rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  text-align: center;
}

.report-view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.report-view-controls label {
  flex: 1 1 14rem;
  margin: 0;
}

.cohesion-legend {
  margin-bottom: 1rem;
}

.matrix-cell.cell-mutual-sym {
  background: #d1fae5;
  font-weight: 600;
}

.matrix-cell.cell-mutual-anti {
  background: #fecdd3;
  color: #9f1239;
  font-weight: 600;
}

.cell-mutual-sym-sample {
  display: inline-block;
  width: 1.1em;
  height: 0.85em;
  flex-shrink: 0;
  background: #d1fae5;
}

.cell-mutual-anti-sample {
  display: inline-block;
  width: 1.1em;
  height: 0.85em;
  flex-shrink: 0;
  background: #fecdd3;
}

.report-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
}

.report-header-row .report-title {
  margin: 0;
}

.report-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.matrix-legend-box {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.matrix-legend-intro {
  margin: 0;
}

.matrix-legend-items {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.matrix-legend-items li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.matrix-block + .matrix-block {
  margin-top: 2rem;
}

.groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.groups-criterion {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.group-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--card, #fff);
}

.group-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.group-members {
  margin: 0;
  line-height: 1.5;
}

.group-card-isolated {
  border-style: dashed;
  background: #f8fafc;
}

.group-card-note,
.groups-overlap-note {
  margin: 0.15rem 0 0.35rem;
}

.results-dashboard {
  margin-bottom: 1.5rem;
}

.results-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.results-kpi {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--card, #fff);
}

.results-kpi-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.results-kpi-val {
  font-size: 1.15rem;
}

.results-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.85rem;
}

.results-panel h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.results-metrics,
.results-interpret,
.results-zones {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.55;
  font-size: 0.92rem;
}

.results-zones {
  list-style: none;
  padding-left: 0;
}

.results-zones li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.login-gender-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

.gender-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 0.35rem;
}

.gender-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.shape-m,
.shape-f {
  display: inline-block;
  width: 10px;
  height: 10px;
  vertical-align: middle;
}

.shape-m {
  background: #64748b;
}

.shape-f {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #64748b;
  background: transparent;
}

.gender-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.z1 { background: #22c55e; }
.z2 { background: #84cc16; }
.z3 { background: #f59e0b; }
.z4 { background: #94a3b8; }

/* —— App shell (logged-in teachers) —— */
.body-app { background: var(--bg); }

.top-user {
  font-size: 0.9rem;
  color: var(--muted);
}

.badge-admin {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  vertical-align: middle;
}

.app-shell {
  display: flex;
  align-items: flex-start;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  gap: 1.5rem;
}

.sidebar {
  flex: 0 0 11.5rem;
  position: sticky;
  top: 0.75rem;
  padding: 1rem 0;
}

.sidebar-title {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sidebar-title:not(:first-child) {
  margin-top: 1.25rem;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-link {
  display: block;
  padding: 0.4rem 0.55rem;
  margin: 0.1rem 0;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.sidebar-link:hover {
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.sidebar-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 600;
}

.sidebar-foot {
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
}

.sidebar-foot a { color: var(--muted); }

.page-content.app-main {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 1.25rem 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent-hi);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.btn-danger {
  border-color: #fda4af;
  color: #9f1239;
  background: #fff1f2;
}

.btn-danger:hover {
  background: #fecdd3;
  border-color: #fb7185;
  color: #881337;
}

a.btn.btn-panel,
button.btn.btn-panel {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

a.btn.btn-panel:hover,
button.btn.btn-panel:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
}

a.btn.btn-report,
button.btn.btn-report {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

a.btn.btn-report:hover,
button.btn.btn-report:hover {
  background: #d1fae5;
  border-color: #4ade80;
  color: #14532d;
}

.data-table .actions a.btn:hover,
.data-table .actions button.btn:hover {
  text-decoration: none;
}

.inline-form {
  display: inline;
  margin: 0;
}

.data-table .actions .inline-form {
  margin-left: 0.35rem;
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
    padding: 0 0.75rem 2rem;
  }

  .sidebar {
    flex: none;
    width: 100%;
    position: static;
    padding: 0.75rem 0 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .sidebar-title:not(:first-child) {
    width: 100%;
    margin-top: 0.75rem;
  }

  .sidebar-foot { display: none; }
}

@media (max-width: 520px) {
  .wrap { padding: 1rem 0.75rem 2rem; }
  .page-content.wrap:not(.app-main) { padding: 1rem 0.75rem 2rem; }
  .student-list { columns: 1; }
  .data-table .actions .btn {
    display: block;
    margin: 0.25rem 0 0;
  }
}

/* ——— Guide / Instruction ——— */

.guide-flow {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.guide-step {
  margin: 0;
}

.guide-step-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.guide-step-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.guide-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.guide-arrow {
  text-align: center;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0;
}

.guide-mock {
  margin: 0.85rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}

.guide-mock-form .guide-mock-line {
  height: 0.55rem;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.guide-mock-line.guide-mock-title {
  width: 45%;
  height: 0.7rem;
  background: #cbd5e1;
}

.guide-mock-line.short { width: 70%; }

.guide-mock-block {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.45rem;
  border: 1px solid var(--border);
}

.guide-mock-positive {
  background: #f7fff9;
  border-color: #86efac;
}

.guide-mock-negative {
  background: #fffbfb;
  border-color: #fca5a5;
}

.guide-mock-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.guide-mock-badge.sym {
  background: #d1fae5;
  color: #065f46;
}

.guide-mock-badge.anti {
  background: #fecdd3;
  color: #9f1239;
}

.guide-mock-btn {
  margin-top: 0.35rem;
  pointer-events: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
}

.guide-mock-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.guide-mock-url {
  flex: 1 1 12rem;
  padding: 0.4rem 0.6rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.guide-mock-table {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.guide-mock-cell.head {
  font-size: 0.85rem;
  color: var(--muted);
}

.guide-mock-cell.val {
  font-weight: 700;
  font-size: 1.1rem;
}

.guide-report-map {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.guide-report-chip {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  pointer-events: none;
}

.guide-report-chip.active {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: #1e3a8a;
  font-weight: 600;
}

.guide-bullets {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.guide-bullets li { margin: 0.35rem 0; }

.guide-tip {
  margin-top: 0.5rem;
}

.guide-tip h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.guide-tip ul {
  margin: 0;
  padding-left: 1.2rem;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.method-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.method-card-wide {
  grid-column: 1 / -1;
}

.method-dl {
  margin: 0;
}

.method-dl dt {
  font-weight: 600;
  margin-top: 0.65rem;
  font-size: 0.92rem;
}

.method-dl dt:first-child { margin-top: 0; }

.method-dl dd {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.method-dl dd p {
  margin: 0.35rem 0 0;
}

.method-dl dd p:first-child {
  margin-top: 0;
}

.method-formula-label {
  margin: 0.55rem 0 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

.method-formula {
  margin: 0 !important;
  padding: 0.4rem 0.55rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.method-terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.method-terms-grid-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .method-terms-grid-trio {
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  }
}

.method-term {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}

.method-term-title {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.method-term-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.method-term-note {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.method-zones {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.method-zone-item {
  margin: 0.75rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.method-zone-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.method-zone-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.method-zone-desc {
  margin: 0 0 0 1.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.method-weights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.65rem 0;
}

.method-weight {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}

.method-weight.w3 { background: #d1fae5; color: #065f46; }
.method-weight.w2 { background: #dbeafe; color: #1e40af; }
.method-weight.w1 { background: #f1f5f9; color: #475569; }

.preview-step-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.preview-step-label-first {
  margin-top: 0;
}

.preview-flow-step {
  margin-top: 1.25rem;
}

.preview-gender-demo .gender-pick {
  margin-top: 0.35rem;
}

.method-card ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.method-card ul li { margin: 0.4rem 0; }
