@layer aios.components {
/* Teacher support plan — focused creation flow */
.modal:has(.support-plan-form) {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(92dvh, 920px);
  padding: 0;
  overflow: hidden;
}

.modal:has(.support-plan-form) > .section-title {
  position: relative;
  top: auto;
  z-index: calc(var(--z-raised) + 1);
  min-height: 70px;
  margin: 0;
  padding: 15px 20px;
}

.modal:has(.support-plan-form) > .section-title h2 {
  margin: 0;
  font-size: clamp(22px, 2.3vw, 28px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.support-plan-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: calc(min(92dvh, 920px) - 72px);
  min-height: 0;
  color: var(--white);
}

.support-plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.support-plan-main {
  min-width: 0;
  padding: 24px 28px 34px;
}

.support-plan-intro,
.support-plan-student,
.support-plan-summary-meta > div {
  display: flex;
  align-items: center;
}

.support-plan-intro {
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

.support-plan-student {
  gap: 12px;
  min-width: 0;
}

.support-plan-avatar,
.support-plan-step,
.support-plan-ai-icon,
.support-plan-summary-icon,
.support-plan-receive-icon {
  display: grid;
  place-items: center;
  color: #b9e2ff;
  background: rgba(10, 132, 255, 0.13);
}

.support-plan-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(112, 190, 255, 0.34);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
}

.support-plan-student > span:last-child,
.support-plan-ai > span:nth-child(2),
.support-plan-option > span,
.support-plan-receives li > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.support-plan-student strong,
.support-plan-student small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-plan-student strong,
.support-plan-section-head h3,
.support-plan-summary h3,
.support-plan-ai strong,
.support-plan-option,
.support-plan-option strong,
.support-plan-receives strong,
.support-plan-summary-meta dd {
  color: var(--white);
}

.support-plan-intro-copy {
  max-width: 430px;
  text-align: right;
}

.support-plan-intro-copy p,
.support-plan-section-head p,
.support-plan-student small,
.support-plan-ai small,
.support-plan-option small,
.support-plan-receives small,
.support-plan-file-field > small,
.support-plan-footer-note,
.support-plan-review-note p {
  color: var(--muted);
}

.support-plan-intro-copy p {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.support-plan-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.support-plan-section-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.support-plan-step {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(112, 190, 255, 0.28);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

.support-plan-section-head h3,
.support-plan-summary h3 {
  margin: 0;
}

.support-plan-section-head h3 {
  font-size: 16px;
}

.support-plan-section-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.support-plan-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.support-plan-fields > .full,
.support-plan-options {
  grid-column: 1 / -1;
}

.support-plan-form .field {
  min-width: 0;
  gap: 7px;
}

.support-plan-form .field label {
  color: rgba(239, 247, 255, 0.84);
  font-size: 12px;
  font-weight: 800;
}

.support-plan-form .field label > span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
}

.support-plan-form .field :is(input, select, textarea) {
  min-width: 0;
  min-height: 44px;
  padding: 11px 12px;
  border-color: rgba(145, 180, 225, 0.2);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
  font-size: 14px;
  line-height: 1.4;
}

.support-plan-form .field textarea {
  min-height: 82px;
}

.support-plan-form .field :is(input, select, textarea):focus-visible {
  border-color: rgba(90, 174, 255, 0.78);
  outline: 2px solid rgba(63, 153, 255, 0.28);
  outline-offset: 1px;
}

.support-plan-ai {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(102, 177, 255, 0.22);
  border-radius: 13px;
  background: rgba(10, 132, 255, 0.07);
}

.support-plan-ai-icon,
.support-plan-summary-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.support-plan-ai-icon > .icon-symbol,
.support-plan-summary-icon > .icon-symbol {
  width: 20px;
  height: 20px;
}

.support-plan-ai strong,
.support-plan-receives strong {
  font-size: 12px;
}

.support-plan-ai small,
.support-plan-option small,
.support-plan-receives small {
  font-size: 11px;
  line-height: 1.35;
}

.support-plan-ai-button,
.support-plan-footer > button {
  min-height: 44px;
}

.support-plan-ai-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.support-plan-ai-button > .icon-symbol {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.support-plan-ai-draft {
  border-bottom: 1px solid var(--line);
}

.support-plan-ai-draft summary {
  min-height: 44px;
  padding: 12px 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.support-plan-ai-draft[open] {
  padding-bottom: 14px;
}

.support-plan-file-field input[type="file"] {
  height: auto;
  min-height: 48px;
  padding: 5px;
  color: var(--muted);
}

.support-plan-file-field input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  padding: 0 12px;
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.support-plan-file-field > small {
  font-size: 11px;
}

.support-plan-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.support-plan-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.support-plan-option:has(input:checked) {
  border-color: rgba(90, 174, 255, 0.42);
  background: rgba(10, 132, 255, 0.08);
}

.support-plan-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #0a84ff;
}

.support-plan-option strong {
  font-size: 12px;
}

.support-plan-summary {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  align-content: start;
  gap: 20px;
  min-height: 0;
  padding: 26px 22px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.support-plan-summary-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.support-plan-summary h3 {
  margin-top: 3px;
  font-size: 17px;
}

.support-plan-summary-meta {
  display: grid;
  margin: 0;
  border-block: 1px solid var(--line);
}

.support-plan-summary-meta > div {
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
}

.support-plan-summary-meta > div + div,
.support-plan-review-note {
  border-top: 1px solid var(--line);
}

.support-plan-summary-meta :is(dt, dd) {
  margin: 0;
  font-size: 12px;
}

.support-plan-summary-meta dt {
  color: var(--muted);
}

.support-plan-summary-meta dd {
  max-width: 160px;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-plan-summary-label {
  display: block;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.support-plan-receives ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.support-plan-receives li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  transition: opacity 0.16s ease;
}

.support-plan-receive-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.support-plan-receive-icon > .icon-symbol {
  width: 20px;
  height: 20px;
}

.support-plan-receives li.is-disabled {
  opacity: 0.42;
  text-decoration: line-through;
}

.support-plan-review-note {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding-top: 18px;
}

.support-plan-review-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #91cfff;
}

.support-plan-review-icon > .icon-symbol {
  width: 20px;
  height: 20px;
}

.support-plan-review-note p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.support-plan-footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 70px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(7, 17, 31, 0.97);
}

.support-plan-footer-note {
  justify-self: end;
  font-size: 11px;
}

body[data-theme="light"] :is(
  .support-plan-form,
  .support-plan-section-head h3,
  .support-plan-summary h3,
  .support-plan-student strong,
  .support-plan-ai strong,
  .support-plan-option,
  .support-plan-option strong,
  .support-plan-receives strong,
  .support-plan-summary-meta dd
) {
  color: #071426;
}

body[data-theme="light"] .support-plan-main {
  background: #fbfcff;
}

body[data-theme="light"] :is(
  .support-plan-avatar,
  .support-plan-step,
  .support-plan-ai-icon,
  .support-plan-summary-icon,
  .support-plan-receive-icon
) {
  color: #1558b0;
  background: rgba(36, 88, 246, 0.08);
  border-color: rgba(36, 88, 246, 0.16);
}

body[data-theme="light"] .support-plan-form .field label {
  color: #17243a;
}

body[data-theme="light"] .support-plan-form .field :is(input, select, textarea) {
  color: #071426;
  border-color: #d8e0ee;
  background: #fff;
}

body[data-theme="light"] :is(.support-plan-ai, .support-plan-option:has(input:checked)) {
  border-color: rgba(36, 88, 246, 0.2);
  background: rgba(36, 88, 246, 0.045);
}

body[data-theme="light"] :is(.support-plan-option, .support-plan-summary) {
  border-color: #dfe5ef;
  background: #f5f7fb;
}

body[data-theme="light"] .support-plan-file-field input[type="file"]::file-selector-button {
  color: #11213a;
  border-color: #d5deed;
  background: #f6f8fc;
}

body[data-theme="light"] .support-plan-footer {
  border-color: #dce3ef;
  background: rgba(255, 255, 255, 0.98);
}

@media (max-width: 900px) {
  .support-plan-layout {
    grid-template-columns: 1fr;
  }

  .support-plan-summary {
    position: static;
    min-height: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .support-plan-receives ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .modal-backdrop:has(.support-plan-form) {
    padding: 0;
    align-items: end;
  }

  .modal:has(.support-plan-form) {
    width: 100%;
    max-height: 96dvh;
    border-radius: 22px 22px 0 0;
  }

  .modal:has(.support-plan-form) > .section-title {
    min-height: 62px;
    padding: 11px 14px;
  }

  .modal:has(.support-plan-form) > .section-title h2 {
    font-size: 22px;
  }

  .support-plan-form {
    height: calc(96dvh - 64px);
  }

  .support-plan-main {
    padding: 18px 16px 26px;
  }

  .support-plan-intro {
    display: grid;
    gap: 16px;
    padding-bottom: 18px;
  }

  .support-plan-intro-copy {
    max-width: none;
    text-align: left;
  }

  .support-plan-section {
    padding: 20px 0;
  }

  .support-plan-section-head {
    margin-bottom: 15px;
  }

  .support-plan-fields,
  .support-plan-options,
  .support-plan-receives ul {
    grid-template-columns: 1fr;
  }

  .support-plan-fields > .full {
    grid-column: auto;
  }

  .support-plan-ai {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .support-plan-ai-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .support-plan-form .field textarea {
    min-height: 88px;
  }

  .support-plan-summary {
    padding: 22px 16px 28px;
  }

  .support-plan-footer {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
    gap: 9px;
    min-height: 72px;
    padding-inline: 12px;
  }

  .support-plan-footer-note {
    display: none;
  }

  .support-plan-footer > button {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
    overflow-wrap: anywhere;
    line-height: 1.2;
    white-space: normal;
  }
}

/* Student support-plan workspace — a calm, single-column space to work through
   a teacher's plan. Conversation-first: a title, the teacher's note, a plain
   progress line, then the checklist the student actually works down. No hero
   band, no donut, no competing sidebar — clarity over dashboard chrome. */
.modal:has(.sp-space) {
  width: min(640px, calc(100vw - 32px));
  max-height: min(92dvh, 900px);
  padding: 0;
  overflow: hidden;
}

.modal:has(.sp-space) > .section-title {
  position: relative;
  top: auto;
  z-index: calc(var(--z-raised) + 1);
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.sp-space {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-height: calc(min(92dvh, 900px) - 60px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 26px 28px;
  color: var(--white);
}

.sp-head {
  display: grid;
  gap: 8px;
}

.sp-kicker {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.sp-head h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.sp-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sp-meta {
  font-size: 12.5px;
  color: var(--muted);
}

/* The teacher's message reads like a quiet note in the conversation. */
.sp-note-from {
  margin: 0;
  padding: 13px 15px;
  border-left: 3px solid var(--aios-accent, #0a84ff);
  border-radius: 0 12px 12px 0;
  background: var(--aios-accent-soft, rgba(10, 132, 255, 0.1));
  color: var(--white);
  font-size: 14px;
  line-height: 1.5;
}

.sp-progress {
  display: grid;
  gap: 8px;
}

.sp-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.sp-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(140, 160, 190, 0.2);
  overflow: hidden;
}

.sp-progress-track > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--aios-accent, #0a84ff);
  transition: width 0.4s ease;
}

.sp-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Each task is one large, tappable row — tap anywhere to toggle done. */
.sp-task {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  min-height: 44px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.sp-task:hover {
  border-color: var(--aios-accent, #0a84ff);
  background: rgba(140, 160, 190, 0.06);
}

.sp-task.is-done {
  background: rgba(140, 160, 190, 0.05);
  border-color: var(--line);
}

.sp-task-box {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sp-task-box svg {
  width: 14px;
  height: 14px;
}

.sp-task-box .icon-symbol {
  width: 20px;
  height: 20px;
}

.sp-task.is-done .sp-task-box {
  background: var(--aios-success, #1a8f5a);
  border-color: var(--aios-success, #1a8f5a);
  color: #ffffff;
}

.sp-task-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.sp-task-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
}

.sp-task.is-done .sp-task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.sp-task-detail {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.sp-task-when {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.sp-task-state {
  flex: 0 0 auto;
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.sp-task.is-done .sp-task-state {
  color: var(--aios-success, #1a8f5a);
}

.sp-empty {
  margin: 0;
  padding: 20px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

/* Inline status lines — not banners. */
.sp-done,
.sp-hint {
  margin: -8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.sp-done {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--aios-success, #1a8f5a);
  font-weight: 600;
}

.sp-done svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.sp-hint strong {
  color: var(--white);
  font-weight: 600;
}

.sp-block {
  display: grid;
  gap: 12px;
}

.sp-block h3 {
  margin: 0;
  font-size: 14px;
}

.sp-block h3 span {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.sp-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-space textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
}

.sp-space textarea:focus-visible {
  outline: 2px solid var(--aios-accent, #0a84ff);
  outline-offset: 1px;
  border-color: transparent;
}

@media (max-width: 720px) {
  .sp-space {
    padding: 20px;
    gap: 20px;
  }
}
}
