:root {
  --navy: #14314f;
  --blue: #078bc4;
  --cyan: #dff5ff;
  --teal: #0b8d7c;
  --mint: #e9fbf5;
  --orange: #f26a3d;
  --line: #cfe1ed;
  --paper: #fff;
  --muted: #65788b;
  --shadow: 0 16px 40px rgba(31, 76, 107, 0.1);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #eef7fb;
  color: var(--navy);
  font-family: "Mali", sans-serif;
  letter-spacing: 0;
}
.group-shell {
  min-height: 100vh;
}
.group-header {
  min-height: 104px;
  padding: 18px max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(90deg, #e1f5ff, #f0fff8 58%, #fff5e9);
  border-bottom: 1px solid #b9dbea;
}
.group-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}
.group-brand img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}
.group-brand strong {
  display: block;
  color: #0879b2;
  font-size: 31px;
  line-height: 1;
}
.group-brand small {
  display: block;
  margin-top: 6px;
  font-weight: 600;
  color: #536b80;
}
.group-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.group-nav a,
.group-user {
  min-height: 50px;
  padding: 10px 18px;
  border: 1px solid #bfd7e7;
  border-radius: 25px;
  background: #fff;
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-nav a:hover {
  border-color: #43c9aa;
  background: #eafff7;
}
.group-nav svg {
  width: 20px;
}
.group-main {
  width: min(1440px, calc(100% - 36px));
  margin: 28px auto 64px;
}
.group-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 30px;
  border: 1px solid #b8ddeb;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #effaff 52%, #eafff4);
  box-shadow: var(--shadow);
}
.group-hero-icon,
.heading-icon {
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
}
.group-hero-icon {
  width: 76px;
  height: 76px;
  border-radius: 8px;
}
.group-hero-icon svg {
  width: 38px;
  height: 38px;
}
.group-kicker {
  margin: 0 0 4px;
  color: #078bc4;
  font-size: 13px;
  font-weight: 800;
}
.group-hero h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 45px);
  line-height: 1.2;
}
.group-hero p:not(.group-kicker) {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.7;
}
.group-role-wheel {
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 8px;
}
.group-role-wheel span {
  padding: 12px;
  border: 1px solid #a8dfd1;
  border-radius: 6px;
  background: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.group-layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
  margin-top: 20px;
}
.group-create,
.group-list-panel,
.student-groups {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.group-create {
  padding-bottom: 20px;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.section-heading h2 {
  margin: 0;
  font-size: 22px;
}
.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.heading-icon {
  width: 48px;
  height: 48px;
  border-radius: 7px;
  flex: 0 0 auto;
}
.group-create form {
  padding: 18px;
  display: grid;
  gap: 14px;
}
.group-create label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
}
.group-create input,
.group-create select {
  width: 100%;
  min-height: 50px;
  padding: 0 17px;
  border: 2px solid #c9dfec;
  border-radius: 25px;
  background: #fafdff;
  color: var(--navy);
  font:
    600 15px "Mali",
    sans-serif;
  outline: none;
}
.group-create input:focus,
.group-create select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(7, 139, 196, 0.12);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.student-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.student-picker-head span {
  padding: 5px 10px;
  border-radius: 16px;
  background: var(--cyan);
  color: #0675a7;
  font-size: 12px;
  font-weight: 800;
}
.student-picker {
  max-height: 310px;
  overflow: auto;
  display: grid;
  gap: 7px;
  padding-right: 3px;
}
.student-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid #d3e3ec;
  border-radius: 7px;
  cursor: pointer;
  background: #fff;
}
.student-option:hover {
  border-color: #42c7aa;
  background: #f1fff9;
}
.student-option.selected {
  border-color: var(--teal);
  background: var(--mint);
  box-shadow: inset 4px 0 var(--teal);
}
.student-option input {
  width: 20px;
  min-height: 20px;
}
.student-option span {
  min-width: 0;
}
.student-option strong,
.student-option small {
  display: block;
}
.student-option small {
  color: var(--muted);
  margin-top: 2px;
}
.primary-action {
  min-height: 54px;
  border: 0;
  border-radius: 27px;
  background: var(--teal);
  color: #fff;
  font:
    700 16px "Mali",
    sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
}
.primary-action:disabled {
  opacity: 0.45;
}
.form-status {
  min-height: 24px;
  margin: 0;
  font-size: 13px;
}
.form-status.error {
  color: #c13d2b;
}
.form-status.success {
  color: #087a54;
}
.list-heading {
  position: relative;
}
.list-heading > div:nth-child(2) {
  flex: 1;
}
.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid #bdd7e7;
  border-radius: 50%;
  background: #fff;
  color: #087dac;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.group-list {
  padding: 16px;
  display: grid;
  gap: 14px;
}
.group-card {
  border: 1px solid #cfe0e9;
  border-left: 6px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.group-card.closed {
  border-left-color: #9aaaba;
  opacity: 0.88;
}
.group-card-head {
  padding: 17px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  background: #f8fcfe;
  border-bottom: 1px solid #deebf1;
}
.group-card h3 {
  margin: 0;
  font-size: 20px;
}
.group-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.group-code {
  padding: 8px 12px;
  border-radius: 6px;
  background: #dcf8ef;
  color: #087765;
  font-weight: 800;
}
.member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
}
.member-card {
  padding: 11px;
  border: 1px solid #d9e6ed;
  border-radius: 7px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
}
.member-card.online { border-color: #62cfb2; background: #f0fff9; }
.member-card.online small::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #16a875; }
.group-card.my-group { box-shadow: 0 0 0 3px rgba(11,141,124,.1); }
.member-role-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--cyan);
  display: grid;
  place-items: center;
  color: #087dac;
}
.member-card strong,
.member-card small {
  display: block;
}
.member-card strong {
  font-size: 13px;
}
.member-card small {
  font-size: 11px;
  color: var(--muted);
}
.exit-status {
  font-size: 11px;
  font-weight: 800;
  color: #9b6a00;
}
.exit-status.passed {
  color: #07815c;
}
.group-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}
.group-card-actions a,
.group-card-actions button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #bdd7e7;
  border-radius: 21px;
  background: #fff;
  color: var(--navy);
  font:
    700 13px "Mali",
    sans-serif;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.group-card-actions .open-board {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.group-card-actions .danger {
  color: #c13f30;
  border-color: #f2b5a7;
}
.group-card-actions .edit-group-button {
  min-width: 190px;
  background: #e8f6ff;
  border: 2px solid #078bc4;
  color: #075e91;
}
.edit-group-button span,
.edit-group-button strong,
.edit-group-button small {
  display: block;
  text-align: left;
}
.edit-group-button small {
  margin-top: 1px;
  color: #47738d;
  font-size: 10px;
  font-weight: 600;
}
.student-group-callout {
  margin: 14px;
  padding: 14px;
  border: 2px solid #43c8a9;
  border-radius: 8px;
  background: #effff9;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(150px, auto) auto;
  gap: 12px;
  align-items: center;
}
.student-group-label {
  padding: 8px 10px;
  border-radius: 7px;
  background: #d3f8eb;
  color: #087765;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}
.student-group-callout strong,
.student-group-callout small,
.student-current-mission span,
.student-current-mission b {
  display: block;
}
.student-group-callout > div > strong { font-size: 17px; }
.student-group-callout small,
.student-current-mission span { color: var(--muted); font-size: 11px; }
.student-group-callout .my-role { margin-top: 4px; color: #087765; font-weight: 800; }
.student-current-mission b { margin-top: 2px; font-size: 13px; }
.student-group-callout > a {
  min-height: 46px;
  padding: 10px 15px;
  border-radius: 23px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 800;
}
.student-group-closed { color: #91610a; font-weight: 700; }
.student-group-card.my-group .group-card-head { display: none; }
.group-empty,
.group-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
  gap: 8px;
}
.group-empty i,
.group-loading svg {
  width: 54px;
  height: 54px;
  color: #5abbd8;
}
.group-loading svg {
  animation: spin 1s linear infinite;
}
.group-loading[hidden] {
  display: none;
}
.student-groups {
  margin-top: 20px;
}
.student-groups .group-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.group-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 39, 62, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.group-modal[hidden] {
  display: none;
}
.group-modal-card {
  width: min(480px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 28px 70px rgba(12, 39, 62, 0.28);
}
.modal-icon {
  margin: auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff0eb;
  color: var(--orange);
}
.group-modal-card > div {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.group-modal-card button {
  flex: 1;
  min-height: 48px;
  border: 1px solid #bed3df;
  border-radius: 24px;
  background: #fff;
  font: 700 14px "Mali";
}
.group-modal-card .danger {
  background: #d94e3a;
  color: #fff;
  border-color: #d94e3a;
}
.edit-group-card { width: min(780px, 100%); max-height: min(92vh, 860px); overflow: auto; text-align: left; }
.edit-group-card .edit-modal-heading { margin: 0 0 18px; align-items: center; }
.edit-group-card .edit-modal-heading .modal-icon { margin: 0; flex: 0 0 auto; background: #e5f7ff; color: var(--blue); }
.edit-group-card h2, .edit-group-card p { margin: 0; }
.edit-group-card p { margin-top: 4px; color: var(--muted); }
.edit-group-card form { display: grid; gap: 13px; }
.edit-group-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.edit-group-card input, .edit-group-card select { width: 100%; min-height: 48px; padding: 0 16px; border: 2px solid #c9dfec; border-radius: 24px; background: #fafdff; color: var(--navy); font: 600 14px "Mali"; outline: none; }
.edit-group-card input:focus, .edit-group-card select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(7,139,196,.12); }
.edit-member-picker { max-height: 330px; overflow: auto; display: grid; gap: 8px; padding-right: 4px; }
.edit-member-option { padding: 10px; border: 1px solid #d5e5ed; border-radius: 16px; display: grid; grid-template-columns: minmax(0,1fr) 180px; gap: 12px; align-items: center; background: #fff; }
.edit-member-option.selected { border-color: #42c6a6; background: #effff9; }
.edit-member-option > label { display: flex; align-items: center; gap: 10px; }
.edit-member-option input[type="checkbox"] { width: 21px; min-height: 21px; padding: 0; accent-color: var(--teal); }
.edit-member-option strong, .edit-member-option small { display: block; }
.edit-member-option small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.edit-member-option select { min-height: 42px; }
.edit-member-option select:disabled { opacity: .48; }
.edit-modal-actions { margin-top: 5px !important; }
.edit-modal-actions .primary-action { background: var(--teal); border-color: var(--teal); color: #fff; }
@media (max-width: 620px) {
  .edit-group-card { padding: 18px; }
  .edit-member-option { grid-template-columns: 1fr; }
  .edit-member-option select { margin-left: 31px; width: calc(100% - 31px); }
  .edit-modal-actions { display: grid !important; }
}
.group-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 7px;
  background: #14314f;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s;
}
.group-toast.show {
  opacity: 1;
  transform: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.group-progress-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 14px 0;
}
.group-progress-summary span {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfe3eb;
  border-radius: 19px;
  background: #f3fbfe;
  color: #567083;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.group-progress-summary strong {
  color: var(--navy);
}
.group-progress-summary svg {
  width: 17px;
  height: 17px;
  color: var(--teal);
}
@media (max-width: 900px) {
  .group-header {
    align-items: flex-start;
  }
  .group-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .group-user {
    width: 100%;
    justify-content: center;
  }
  .group-hero {
    grid-template-columns: auto 1fr;
  }
  .group-role-wheel {
    grid-column: 1/-1;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
  }
  .group-layout {
    grid-template-columns: 1fr;
  }
  .student-groups .group-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .group-header {
    min-height: auto;
    padding: 12px 14px;
    display: grid;
  }
  .group-brand img {
    width: 54px;
    height: 54px;
  }
  .group-brand strong {
    font-size: 25px;
  }
  .group-brand small {
    font-size: 11px;
  }
  .group-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .group-user {
    grid-column: 1/-1;
  }
  .group-nav a {
    justify-content: center;
    padding: 9px 11px;
    font-size: 12px;
  }
  .group-main {
    width: calc(100% - 20px);
    margin: 12px auto 32px;
  }
  .group-hero {
    padding: 18px;
    gap: 14px;
  }
  .group-hero-icon {
    width: 54px;
    height: 54px;
  }
  .group-hero h1 {
    font-size: 25px;
  }
  .group-hero p:not(.group-kicker) {
    font-size: 13px;
  }
  .group-role-wheel {
    grid-template-columns: repeat(2, 1fr);
  }
  .group-role-wheel span {
    padding: 9px;
    font-size: 11px;
  }
  .group-layout {
    margin-top: 12px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .member-grid {
    grid-template-columns: 1fr;
  }
  .section-heading {
    padding: 15px;
  }
  .group-card-head {
    grid-template-columns: 1fr;
  }
  .group-card-actions a,
  .group-card-actions button {
    flex: 1;
    justify-content: center;
  }
  .group-create input,
  .group-create select {
    font-size: 16px;
  }
}

.activity-pack-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.activity-pack-field legend {
  padding: 0;
  font-weight: 800;
}
.activity-pack-field > p {
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.activity-pack-picker {
  display: grid;
  gap: 9px;
}
.activity-pack-option {
  width: 100%;
  min-width: 0;
  padding: 13px;
  border: 1.5px solid #c7dce9;
  border-radius: 18px;
  background: #fbfdff;
  color: var(--navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 6px 9px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.activity-pack-option:hover {
  border-color: #49c8a9;
  transform: translateY(-1px);
}
.activity-pack-option.selected {
  border-color: var(--blue);
  background: #eaf8ff;
  box-shadow: 0 0 0 3px rgba(7,139,196,.1);
}
.pack-check {
  color: var(--blue);
  grid-row: 1 / span 2;
}
.pack-check svg { width: 21px; height: 21px; }
.pack-copy { min-width: 0; }
.pack-copy strong, .pack-copy small { display: block; }
.pack-copy strong { font-size: 15px; }
.pack-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.pack-missions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pack-missions span {
  padding: 4px 7px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d7e5ed;
  font-size: 10px;
  white-space: normal;
}
.pack-missions b { margin-right: 4px; color: var(--blue); }
.pack-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}
.pack-label svg { width: 15px; height: 15px; }
.mission-timeline {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.mission-timeline > span {
  min-width: 0;
  padding: 9px;
  border: 1px solid #d7e4ec;
  border-radius: 14px;
  background: #f6f9fb;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr);
  align-items: center;
  gap: 7px;
}
.mission-timeline b {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dfe8ee;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.mission-timeline small { line-height: 1.25; }
.mission-timeline .current { border-color: var(--blue); background: #eaf8ff; }
.mission-timeline .current b { background: var(--blue); color: #fff; }
.mission-timeline .done { border-color: #72d5bd; background: var(--mint); }
.mission-timeline .done b { background: var(--teal); color: #fff; }
@media (max-width: 600px) {
  .mission-timeline { grid-template-columns: 1fr; }
  .activity-pack-option { border-radius: 16px; }
  .student-view .group-hero { display: none; }
  .student-view .group-main { margin-top: 10px; }
  .student-view .group-nav { grid-template-columns: 1fr; }
  .student-groups .section-heading {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f7fcff;
  }
  .student-group-card {
    border: 2px solid #41c8a8;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(8, 86, 122, .1);
  }
  .student-group-callout {
    margin: 0;
    padding: 15px;
    border: 0;
    border-bottom: 1px solid #c9eadf;
    border-radius: 6px 6px 0 0;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .student-group-label { width: max-content; }
  .student-group-callout > div { grid-column: 1 / -1; }
  .student-current-mission {
    padding: 10px 12px;
    border-radius: 7px;
    background: #fff;
  }
  .student-group-callout > a {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 52px;
    font-size: 15px;
  }
  .student-group-card .mission-timeline {
    margin: 12px;
  }
  .student-group-card .group-progress-summary,
  .student-group-card .member-grid {
    padding-left: 12px;
    padding-right: 12px;
  }
  .student-group-card .member-card {
    min-height: 64px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }
  .student-group-card .member-role-icon {
    width: 38px;
    height: 38px;
  }
  .teacher-group-card .group-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .teacher-group-card .group-card-actions a,
  .teacher-group-card .group-card-actions button {
    width: 100%;
    min-height: 48px;
  }
  .teacher-group-card .group-card-actions .edit-group-button {
    grid-column: 1 / -1;
    min-width: 0;
    background: #078bc4;
    border-color: #078bc4;
    color: #fff;
  }
  .teacher-group-card .edit-group-button small { color: #dff5ff; }
}
