:root {
  --surface-primary: #FFF8F0;
  --surface-secondary: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-tint: #FFF1E3;
  --surface-warm: #FFE8CC;
  --text-primary: #17191F;
  --text-secondary: #5F5148;
  --text-tertiary: #8D7B70;
  --border-default: #E7D4C4;
  --border-subtle: #F2E5DA;
  --accent-primary: #D9611E;
  --accent-hover: #B84F17;
  --accent-secondary: #1E5B4F;
  --accent-tertiary: #315D91;
  --status-success: #1F8A5B;
  --status-warning: #C97818;
  --status-error: #C93C3C;
  --status-info: #315D91;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-primary), white 72%);
  outline-offset: 2px;
}

.app-header {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-6) 0 var(--space-5);
  border-bottom: 3px solid color-mix(in srgb, var(--accent-primary), white 72%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.18; }
h2 { font-size: 22px; line-height: 1.32; }
h3 { font-size: 18px; line-height: 1.4; }

.eyebrow {
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: var(--space-1);
}

.brand-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.brand-nav span, .brand-nav strong {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.brand-nav strong {
  border-color: color-mix(in srgb, var(--accent-primary), white 60%);
  color: var(--accent-primary);
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto var(--space-8);
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  gap: var(--space-5);
}

.control-panel, .work-area, .selected-student, .student-card, .toast {
  border: 1px solid var(--border-default);
  background: var(--surface-secondary);
  border-radius: 8px;
}

.work-area {
  background: linear-gradient(180deg, var(--surface-secondary) 0%, color-mix(in srgb, var(--surface-tint), white 72%) 100%);
}

.control-panel {
  background: linear-gradient(180deg, var(--surface-secondary) 0%, var(--surface-warm) 100%);
}

.control-panel {
  align-self: start;
  position: sticky;
  top: var(--space-4);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-4);
}

.panel-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.panel-section.compact { border-top: 0; padding-top: 0; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.field-label { display: block; color: var(--text-secondary); font-size: 12px; font-weight: 700; margin-bottom: var(--space-1); }

.input, .ai-output {
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  padding: 10px 12px;
}

.input::placeholder { color: var(--text-tertiary); }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.kpi-card {
  min-height: 96px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  padding: var(--space-3);
  text-align: left;
  transition: transform 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out;
}
.kpi-card:hover { border-color: color-mix(in srgb, var(--accent-primary), white 45%); transform: translateY(-1px); }
.kpi-card:active { transform: translateY(0); }
.kpi-card.is-selected { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary), white 92%); }
.kpi-card span { display: block; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.kpi-card strong { display: block; margin-top: var(--space-1); font-size: 28px; line-height: 1.1; }
.kpi-card small { display: block; color: var(--text-tertiary); font-size: 12px; margin-top: var(--space-1); }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border-default); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-right: 1px solid var(--border-default); background: var(--surface-secondary); color: var(--text-secondary); padding: 9px 8px; font-weight: 700; }
.segmented button:last-child { border-right: 0; }
.segmented button.is-active { background: var(--accent-primary); color: white; }
.ai-output { min-height: 190px; resize: vertical; font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.55; }

.button-row, .toolbar-actions, .status-actions, .contact-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.primary-button, .secondary-button, .danger-button, .text-button, .status-button, .contact-link {
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 750;
  text-decoration: none;
  transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
}
.primary-button, .status-button.present { border: 1px solid var(--accent-primary); background: var(--accent-primary); color: white; }
.secondary-button, .contact-link { border: 1px solid var(--border-default); background: var(--surface-secondary); color: var(--text-primary); }
.danger-button, .status-button.absent { border: 1px solid var(--status-error); background: color-mix(in srgb, var(--status-error), white 91%); color: var(--status-error); }
.text-button { border: 0; background: transparent; color: var(--accent-primary); padding-inline: 4px; }
.status-button.late { border: 1px solid var(--status-warning); background: color-mix(in srgb, var(--status-warning), white 88%); color: var(--status-warning); }
.status-button.follow { border: 1px solid var(--status-info); background: color-mix(in srgb, var(--status-info), white 90%); color: var(--status-info); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover, .status-button:hover, .contact-link:hover { transform: translateY(-1px); }
.primary-button:active, .secondary-button:active, .danger-button:active, .status-button:active, .contact-link:active { transform: translateY(0); }

.work-area { padding: var(--space-5); min-width: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.student-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-2); }

.student-card {
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
  min-height: 0;
  transition: transform 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}
.student-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent-primary), white 60%); }
.student-card[data-status="present"] { border-left: 5px solid var(--status-success); }
.student-card[data-status="absent"] { border-left: 5px solid var(--status-error); }
.student-card[data-status="late"] { border-left: 5px solid var(--status-warning); }
.student-card[data-status="follow"] { border-left: 5px solid var(--status-info); }

.student-head { display: flex; justify-content: space-between; gap: var(--space-3); }
.student-name-block { min-width: 0; }
.student-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.student-name small { color: var(--text-tertiary); font-size: 12px; font-weight: 700; }
.status-pill { align-self: start; border-radius: 999px; border: 1px solid var(--border-default); padding: 5px 9px; color: var(--text-secondary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.student-card[data-status="present"] .status-pill { border-color: var(--status-success); color: var(--status-success); }
.student-card[data-status="absent"] .status-pill { border-color: var(--status-error); color: var(--status-error); }
.student-card[data-status="late"] .status-pill { border-color: var(--status-warning); color: var(--status-warning); }
.student-card[data-status="follow"] .status-pill { border-color: var(--status-info); color: var(--status-info); }

.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.meta-item { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.meta-item span { display: block; color: var(--text-tertiary); font-size: 12px; font-weight: 700; }
.meta-item strong { display: block; overflow-wrap: anywhere; font-size: 14px; }

.selected-student { margin-bottom: var(--space-4); padding: var(--space-4); display: grid; gap: var(--space-3); }
.selected-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.note-input { min-height: 76px; resize: vertical; }
.empty-state { padding: var(--space-10); color: var(--text-secondary); text-align: center; border: 1px dashed var(--border-default); border-radius: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 14px; color: var(--surface-secondary); background: var(--text-primary); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 180ms ease-out, transform 180ms ease-out; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .app-header, .shell { width: min(100% - 24px, 720px); }
  .app-header, .toolbar { align-items: stretch; flex-direction: column; }
  .brand-nav { justify-content: flex-start; }
  .shell { grid-template-columns: 1fr; }
  .control-panel { position: static; }
  .student-list { grid-template-columns: 1fr; }
  .selected-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .app-header, .shell { width: min(100% - 16px, 520px); }
  .kpi-grid, .filter-grid, .meta-grid, .selected-grid { grid-template-columns: 1fr; }
  .work-area, .control-panel { padding: var(--space-3); }
  .toolbar-actions, .status-actions, .button-row { width: 100%; }
  .toolbar-actions > *, .status-actions > *, .button-row > * { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.lesson-list {
  display: grid;
  gap: var(--space-2);
  max-height: 260px;
  overflow: auto;
  padding-right: var(--space-1);
}

.lesson-row, .enrollment-row {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: var(--space-2);
  display: grid;
  gap: var(--space-2);
  background: var(--surface-elevated);
}

.lesson-row-head, .enrollment-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.lesson-row strong, .enrollment-row strong {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.lesson-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}

.tiny-button {
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.lesson-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
  display: grid;
  gap: var(--space-3);
}

.enrollment-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}

.enrollment-list {
  display: grid;
  gap: var(--space-2);
}

.muted {
  color: var(--text-secondary);
  word-break: keep-all;
  overflow-wrap: normal;
}

@media (max-width: 560px) {
  .enrollment-controls { grid-template-columns: 1fr; }
}

/* usability redesign pass */
body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-primary), white 42%) 0%, var(--surface-primary) 220px),
    var(--surface-primary);
}

.app-header {
  padding: var(--space-5) 0 var(--space-4);
  align-items: center;
}

.app-header h1 {
  text-wrap: balance;
}

.brand-nav span,
.brand-nav strong {
  background: color-mix(in srgb, var(--surface-secondary), var(--surface-primary) 32%);
}

.shell {
  grid-template-columns: 340px minmax(0, 1fr);
  align-items: start;
}

.control-panel,
.work-area,
.selected-student,
.student-card {
  background: color-mix(in srgb, var(--surface-secondary), var(--surface-primary) 8%);
}

.control-panel {
  gap: var(--space-3);
}

.work-area {
  padding: var(--space-6);
}

.panel-section {
  padding-top: var(--space-3);
  gap: var(--space-2);
}

.panel-section h2 {
  font-size: 18px;
}

.kpi-grid {
  gap: var(--space-2);
}

.kpi-card {
  min-height: 82px;
  padding: var(--space-3);
}

.kpi-card strong {
  font-variant-numeric: tabular-nums;
  font-size: 30px;
}

.input,
.ai-output {
  min-height: 40px;
  background: var(--surface-secondary);
}

.toolbar {
  background: color-mix(in srgb, var(--accent-primary), white 93%);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 74%);
  border-radius: 8px;
  padding: var(--space-4);
}

.toolbar h2 {
  font-size: 24px;
}

.toolbar-actions .danger-button {
  background: var(--surface-secondary);
}

.student-list {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-2);
}

.student-card {
  min-height: 0;
  padding: var(--space-3);
  gap: var(--space-2);
  border-color: var(--border-subtle);
}

.student-card:hover {
  background: var(--surface-secondary);
}

.student-card[data-status="present"],
.student-card[data-status="absent"],
.student-card[data-status="late"],
.student-card[data-status="follow"] {
  border-left-width: 4px;
}

.student-name h3 {
  font-size: 17px;
}

.student-quick-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.student-quick-line span,
.lesson-chip {
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
  max-width: 100%;
  word-break: keep-all;
  overflow-wrap: normal;
}

.primary-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: var(--space-2);
}

.status-button {
  min-height: 40px;
}

.secondary-status {
  background: var(--surface-secondary);
}

.contact-row {
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2);
}

.contact-link,
.contact-row .secondary-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.selected-student {
  gap: var(--space-4);
  background: var(--surface-secondary);
  border-color: color-mix(in srgb, var(--accent-primary), white 72%);
}

.selected-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.selected-hero h2 {
  font-size: 26px;
  text-wrap: balance;
}

.selected-hero h2 span {
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 650;
}

.selected-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.lesson-box {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: var(--space-3);
  background: color-mix(in srgb, var(--surface-primary), white 38%);
}

.lesson-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.lesson-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.lesson-chip small {
  color: var(--text-tertiary);
  font-weight: 700;
}

.empty-chip,
.more-chip {
  background: color-mix(in srgb, var(--accent-primary), white 92%);
  color: var(--accent-primary);
}

.student-lesson-details {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2);
}

.student-lesson-details summary,
.panel-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.student-lesson-details summary::-webkit-details-marker,
.panel-summary::-webkit-details-marker {
  display: none;
}

.student-lesson-details summary {
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 800;
}

.lesson-panel {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}

.panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-primary), white 46%);
  padding: 10px 12px;
}

.panel-summary strong {
  display: block;
  font-size: 16px;
}

.panel-summary small {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}

.summary-icon {
  color: var(--accent-primary);
  font-weight: 900;
  transition: transform 160ms ease-out;
}

.lesson-panel[open] .summary-icon {
  transform: rotate(180deg);
}

.lesson-admin-body {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

.lesson-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: var(--space-2);
}

.lesson-create-grid label:first-child,
.lesson-create-grid label:nth-child(3),
.add-lesson-button {
  grid-column: 1 / -1;
}

.lesson-list {
  max-height: 360px;
  gap: var(--space-3);
}

.lesson-group {
  display: grid;
  gap: var(--space-2);
}

.lesson-group-title {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.lesson-row {
  padding: var(--space-3);
  background: var(--surface-secondary);
}

.teacher-edit-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2);
}

.teacher-edit-row .field-label {
  margin: 0;
}

.compact-input {
  min-height: 36px;
  padding: 7px 10px;
}

.ai-output {
  min-height: 140px;
}

.toast {
  border-color: transparent;
}

@media (max-width: 1180px) {
  .student-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .work-area {
    padding: var(--space-4);
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-top: var(--space-4);
  }

  .brand-nav span,
  .brand-nav strong {
    font-size: 12px;
  }

  .toolbar {
    padding: var(--space-3);
  }

  .toolbar-actions,
  .primary-status,
  .selected-action-row {
    grid-template-columns: 1fr 1fr;
  }

  .primary-status .secondary-status,
  .selected-action-row .secondary-status {
    grid-column: auto;
  }

  .contact-row {
    align-items: stretch;
  }

  .contact-row > * {
    flex: 1 1 100%;
    text-align: center;
  }

  .selected-hero {
    flex-direction: column;
  }

  .lesson-create-grid {
    grid-template-columns: 1fr;
  }
}

/* beginner-friendly repair pass */
.getting-started {
  display: grid;
  gap: var(--space-3);
}

.getting-started h2 {
  font-size: 24px;
  line-height: 1.28;
  text-wrap: balance;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.guide-steps span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 78%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 94%);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 750;
  min-width: 0;
}

.guide-steps strong {
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-primary);
  color: var(--surface-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lesson-panel:not([open]) {
  padding-bottom: 0;
}

.panel-summary:hover {
  border-color: color-mix(in srgb, var(--accent-primary), white 62%);
  background: color-mix(in srgb, var(--accent-primary), white 95%);
}

.status-button.present,
.status-button.absent,
.status-button.follow {
  font-size: 15px;
}

.status-button.late.secondary-status {
  color: var(--text-secondary);
  border-color: var(--border-default);
}

@media (max-width: 720px) {
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .lesson-roster-tools {
    grid-template-columns: 1fr;
  }
}

/* weekday class roster */
.class-roster-panel {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 70%);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-secondary) 0%, color-mix(in srgb, var(--surface-tint), white 64%) 100%);
  padding: var(--space-4);
}

.roster-title-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.lesson-roster-tools {
  display: grid;
  grid-template-columns: minmax(132px, 180px) minmax(220px, 1fr);
  gap: var(--space-2);
  align-items: end;
  width: min(480px, 100%);
}

.lesson-roster-tools .input {
  min-height: 36px;
  padding-block: 8px;
  background: var(--surface-secondary);
}

.weekday-tabs {
  display: grid;
  grid-template-columns: repeat(6, 42px);
  gap: var(--space-2);
}

.weekday-tab {
  min-height: 38px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-weight: 850;
}

.weekday-tab.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--surface-secondary);
}

.weekday-tab:hover {
  border-color: color-mix(in srgb, var(--accent-secondary), white 34%);
  background: var(--surface-warm);
  color: var(--text-primary);
}

.class-roster-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.class-roster-card {
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 78%);
  border-left: 4px solid var(--accent-secondary);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.class-roster-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.class-roster-head strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: normal;
}

.class-roster-head span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
  margin-top: 2px;
}

.class-roster-head b {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 72%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-primary), white 94%);
  color: var(--accent-primary);
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.class-roster-days,
.lesson-days {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.class-roster-days span,
.day-check {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.roster-student-list {
  display: grid;
  gap: var(--space-1);
  max-height: 210px;
  overflow: auto;
  padding-right: 2px;
}

.roster-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  padding: 7px 8px;
  text-align: left;
}

.roster-student-row:hover {
  border-color: var(--border-default);
  background: var(--surface-secondary);
}

.roster-student-row span,
.roster-student-row strong,
.roster-student-row small,
.roster-student-row em {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: normal;
}

.roster-student-row strong,
.roster-student-row small {
  display: block;
}

.roster-student-row small,
.roster-student-row em {
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.empty-roster {
  grid-column: 1 / -1;
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  color: var(--text-secondary);
  padding: var(--space-4);
  text-align: center;
}

.lesson-days {
  padding-top: var(--space-1);
}

.day-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.day-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent-primary);
}

@media (max-width: 720px) {
  .roster-title-row {
    display: grid;
    gap: var(--space-3);
  }

  .weekday-tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
  }

  .weekday-tab {
    padding-inline: 0;
  }
}

@media (max-width: 420px) {
  .class-roster-list {
    grid-template-columns: 1fr;
  }
}
/* seat map */
.seat-map-panel {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-4);
}

.seat-map-title-row {
  align-items: flex-start;
}

.seat-map-note {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

.seat-map-list {
  display: grid;
  gap: var(--space-3);
}

.seat-zone-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.seat-zone-tab {
  min-height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 0 var(--space-4);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.seat-zone-tab:hover,
.seat-zone-tab:focus-visible {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  outline: none;
}

.seat-zone-tab.is-selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--surface-secondary);
}

.seat-zone {
  display: grid;
  gap: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-primary), white 48%);
  padding: var(--space-3);
  min-width: 0;
}

.seat-zone-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.seat-zone-head h3 {
  font-size: 17px;
}

.seat-zone-head p {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.seat-columns {
  display: grid;
  grid-template-columns: repeat(var(--seat-column-count), minmax(88px, 1fr));
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
}

.seat-column {
  display: grid;
  align-content: start;
  gap: var(--space-1);
  min-width: 88px;
}

.seat-cell {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 6px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  padding: 6px;
  text-align: left;
}

button.seat-cell:hover {
  border-color: color-mix(in srgb, var(--accent-primary), white 48%);
  background: color-mix(in srgb, var(--accent-primary), white 95%);
}

.seat-cell[data-seat-status="present"] {
  border-color: color-mix(in srgb, var(--status-success), white 50%);
  background: color-mix(in srgb, var(--status-success), white 92%);
}

.seat-cell[data-seat-status="absent"] {
  border-color: color-mix(in srgb, var(--status-error), white 54%);
  background: color-mix(in srgb, var(--status-error), white 92%);
}

.seat-cell[data-seat-status="late"] {
  border-color: color-mix(in srgb, var(--status-warning), white 50%);
  background: color-mix(in srgb, var(--status-warning), white 91%);
}

.seat-cell[data-seat-status="follow"] {
  border-color: color-mix(in srgb, var(--status-info), white 52%);
  background: color-mix(in srgb, var(--status-info), white 92%);
}

.seat-cell.is-empty {
  border-style: dashed;
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--surface-primary), white 28%);
}

.seat-number {
  grid-row: span 2;
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.seat-name {
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: normal;
}

.seat-cell small {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  word-break: keep-all;
  overflow-wrap: normal;
}

@media (max-width: 720px) {
  .seat-map-title-row {
    display: grid;
    gap: var(--space-2);
  }

  .seat-columns {
    grid-template-columns: repeat(var(--seat-column-count), minmax(84px, 84px));
  }
}
/* learning-center inspired app navigation */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.tab-button.nav-tab {
  min-height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 0 var(--space-4);
  font-weight: 800;
}

.tab-button.nav-tab.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--surface-secondary);
}

.brand-current {
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 62%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 94%);
  color: var(--accent-primary);
  padding: 9px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.quick-check-panel,
.status-legend-panel {
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-4);
}

.quick-check-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
}

.quick-check-main h3 {
  font-size: 18px;
}

.quick-check-tools,
.quick-check-actions,
.status-legend-panel {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.quick-check-actions {
  margin-top: var(--space-3);
}

.quick-check-actions .status-button.is-active {
  outline: 3px solid color-mix(in srgb, var(--accent-primary), white 72%);
  outline-offset: 2px;
}

.status-legend-panel span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-secondary);
}

.legend-dot.status-present { background: color-mix(in srgb, var(--status-success), white 72%); border-color: var(--status-success); }
.legend-dot.status-absent { background: color-mix(in srgb, var(--status-error), white 78%); border-color: var(--status-error); }
.legend-dot.status-late { background: color-mix(in srgb, var(--status-warning), white 74%); border-color: var(--status-warning); }
.legend-dot.status-follow { background: color-mix(in srgb, var(--status-info), white 76%); border-color: var(--status-info); }
.legend-dot.status-empty { background: color-mix(in srgb, var(--surface-primary), white 20%); border-style: dashed; }

body[data-active-view="seats"] [data-view-section]:not([data-view-section~="seats"]),
body[data-active-view="students"] [data-view-section]:not([data-view-section~="students"]),
body[data-active-view="lessons"] [data-view-section]:not([data-view-section~="lessons"]),
body[data-active-view="ai"] [data-view-section]:not([data-view-section~="ai"]) {
  display: none !important;
}

body[data-active-view="seats"] .lesson-panel,
body[data-active-view="seats"] .ai-panel,
body[data-active-view="seats"] .backup-panel,
body[data-active-view="students"] .lesson-panel,
body[data-active-view="students"] .ai-panel,
body[data-active-view="students"] .backup-panel,
body[data-active-view="lessons"] .filter-panel,
body[data-active-view="lessons"] .ai-panel,
body[data-active-view="lessons"] .backup-panel,
body[data-active-view="ai"] .filter-panel,
body[data-active-view="ai"] .lesson-panel {
  display: none;
}

body[data-active-view="ai"] .work-area {
  display: none;
}

body[data-active-view="ai"] .shell {
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
}

body[data-active-view="lessons"] .shell {
  grid-template-columns: 340px minmax(0, 1fr);
}

body[data-active-view="seats"] .student-list,
body[data-active-view="lessons"] .student-list,
body[data-active-view="ai"] .student-list {
  display: none;
}

@media (max-width: 720px) {
  .header-actions,
  .view-switch {
    justify-content: flex-start;
    width: 100%;
  }

  .tab-button.nav-tab {
    flex: 1 1 130px;
  }

  .quick-check-main {
    grid-template-columns: 1fr;
  }

  .quick-check-tools > *,
  .quick-check-actions > * {
    flex: 1 1 130px;
  }
}

/* lesson enrollment workflow */
.weekday-lesson-picker {
  display: grid;
  gap: var(--space-3);
}

.lesson-day-group {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-primary);
}

.lesson-day-title,
.roster-head-actions,
.lesson-choice-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.lesson-day-title strong {
  font-size: 16px;
}

.lesson-day-title span,
.lesson-choice-dates {
  color: var(--text-secondary);
  font-size: 13px;
}

.lesson-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
}

.lesson-choice {
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.lesson-choice:hover,
.lesson-choice:focus-visible {
  border-color: var(--accent-primary);
  outline: none;
}

.lesson-choice:active {
  transform: translateY(1px);
}

.lesson-choice.is-enrolled {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 9%, var(--surface-secondary));
}

.lesson-choice-main strong {
  font-size: 15px;
  line-height: 1.35;
}

.lesson-choice-main em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-primary);
  color: var(--accent-primary);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.lesson-choice.is-enrolled .lesson-choice-main em {
  background: var(--accent-primary);
  color: white;
}

.lesson-choice-sub {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.roster-head-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.print-roster-button {
  min-height: 36px;
  padding: 0 var(--space-3);
  white-space: nowrap;
}

.print-name-strip {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  background: var(--surface-primary);
}

.print-name-strip strong {
  font-size: 13px;
  color: var(--text-secondary);
}

.print-name-strip div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.print-name-strip span {
  font-size: 14px;
  font-weight: 700;
}

.register-table {
  display: grid;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.register-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(84px, .8fr) minmax(84px, .8fr);
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  color: var(--text-primary);
  text-align: left;
}

.register-row:first-child {
  border-top: 0;
}

button.register-row {
  cursor: pointer;
}

button.register-row:hover,
button.register-row:focus-visible {
  background: var(--surface-primary);
  outline: none;
}

.register-row.register-head {
  min-height: 36px;
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.register-row.is-canceled {
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--status-error) 5%, var(--surface-secondary));
}

@media (max-width: 720px) {
  .lesson-choice-grid {
    grid-template-columns: 1fr;
  }

  .register-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .register-row.register-head {
    display: none;
  }
}


/* simplified operator view */
.advanced-filter {
  margin-top: var(--space-3);
}

.advanced-filter summary,
.current-lessons-summary summary,
.register-details summary {
  cursor: pointer;
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.advanced-filter summary::-webkit-details-marker,
.current-lessons-summary summary::-webkit-details-marker,
.register-details summary::-webkit-details-marker {
  display: none;
}

.advanced-filter summary::after,
.current-lessons-summary summary::after,
.register-details summary::after {
  content: " 열기";
  color: var(--text-tertiary);
  font-weight: 700;
}

.advanced-filter[open] summary::after,
.current-lessons-summary[open] summary::after,
.register-details[open] summary::after {
  content: " 닫기";
}

.advanced-filter .filter-grid {
  margin-top: var(--space-3);
}

.detail-day-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.detail-day-tab {
  min-height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  font-weight: 800;
  cursor: pointer;
}

.detail-day-tab.is-active,
.detail-day-tab:hover,
.detail-day-tab:focus-visible {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
  outline: none;
}

.simplified-picker {
  gap: var(--space-3);
}

.simple-lesson-day-group {
  padding: var(--space-3);
}

.simple-lesson-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.simple-lesson-choice {
  min-height: 86px;
}

.simplified-roster-card {
  gap: var(--space-3);
}

.simplified-name-strip {
  border-style: solid;
}

.print-name-button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.print-name-button:hover,
.print-name-button:focus-visible {
  border-color: var(--accent-primary);
  outline: none;
}

.register-details {
  display: grid;
  gap: var(--space-2);
}

.register-details[open] .register-table {
  margin-top: var(--space-2);
}

@media (max-width: 720px) {
  .detail-day-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .simple-lesson-choice-grid {
    grid-template-columns: 1fr;
  }
}


.advanced-filter:not([open]) .filter-grid,
.register-details:not([open]) .register-table {
  display: none;
}

/* compact roster and single-seat-map refinements */
.student-card .status-button {
  min-height: 34px;
  padding: 6px 8px;
}

.student-card .muted {
  font-size: 13px;
  line-height: 1.35;
}

.seat-zone.is-single-zone .seat-columns {
  align-items: start;
}

.seat-name,
.seat-cell small {
  word-break: keep-all;
  overflow-wrap: normal;
}

@media (max-width: 720px) {
  .seat-zone-selector {
    display: grid;
    grid-template-columns: 1fr;
  }

  .seat-zone-tab {
    justify-content: center;
    width: 100%;
  }
}

/* student card density pass */
.student-card .primary-status {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-1);
}

.student-card .secondary-status {
  grid-column: auto;
}

.student-card .contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}

.student-card .contact-link,
.student-card .contact-row .secondary-button {
  min-height: 32px;
  padding: 5px 8px;
}

@media (max-width: 560px) {
  .student-card .contact-row {
    align-items: center;
  }

  .student-card .contact-row > * {
    flex: initial;
    text-align: left;
  }

  .student-card .contact-row .secondary-button {
    text-align: center;
    white-space: nowrap;
  }
}


/* bulk lesson enrollment */
body[data-active-view="students"] .toolbar-actions {
  display: none;
}

.bulk-lesson-panel {
  display: grid;
  gap: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-3);
}

.bulk-lesson-head,
.bulk-lesson-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.bulk-lesson-head h3 {
  font-size: 18px;
  line-height: 1.35;
}

.bulk-lesson-select-label {
  min-width: min(100%, 320px);
}

.bulk-lesson-actions {
  align-items: center;
  justify-content: flex-start;
}

.bulk-selected-count {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  margin-right: auto;
}

.bulk-student-table {
  display: grid;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.bulk-student-row {
  display: grid;
  grid-template-columns: 48px 78px minmax(90px, 1fr) minmax(120px, 1.2fr) 72px 92px 92px;
  gap: var(--space-2);
  align-items: center;
  min-width: 720px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}

.bulk-student-row:last-child {
  border-bottom: 0;
}

.bulk-student-row strong {
  color: var(--text-primary);
  font-size: 14px;
  word-break: keep-all;
}

.bulk-student-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--surface-primary), white 55%);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 850;
}

.bulk-student-row.is-enrolled {
  background: color-mix(in srgb, var(--accent-primary) 7%, var(--surface-secondary));
}

.bulk-student-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.bulk-lesson-empty {
  display: grid;
  gap: var(--space-1);
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  .bulk-lesson-actions > button {
    flex: 1 1 120px;
  }

  .bulk-selected-count {
    flex: 1 1 100%;
    order: -1;
  }
}


/* bulk lesson mobile overflow fix */
.bulk-lesson-panel,
.bulk-student-table,
.class-roster-panel {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 720px) {
  body[data-active-view="lessons"] .shell {
    grid-template-columns: 1fr;
  }

  .bulk-student-table {
    width: 100%;
  }
}

/* student spreadsheet view */
.student-list-tools { display: flex; align-items: end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--surface-secondary); padding: var(--space-3); }
.student-list-tools label { min-width: min(100%, 240px); }
.student-sort-summary { color: var(--text-secondary); font-size: 13px; font-weight: 850; }
.student-table-wrap { display: block; overflow-x: auto; border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-secondary); }
.student-sheet { min-width: 1380px; display: grid; font-size: 12px; }
.student-sheet-title { grid-column: 1 / -1; background: color-mix(in srgb, var(--status-warning), white 24%); color: var(--text-primary); font-size: 18px; font-weight: 900; padding: 8px 10px; border-bottom: 2px solid var(--text-primary); }
.student-sheet-row { display: grid; grid-template-columns: 38px 58px 104px 96px 42px 62px 74px 96px 98px 52px 44px 46px 132px 132px minmax(120px, 1fr); min-height: 30px; border-bottom: 1px solid var(--border-default); }
.student-sheet-row > * { display: flex; align-items: center; justify-content: center; min-width: 0; border-right: 1px solid var(--border-default); padding: 4px 6px; color: var(--text-primary); line-height: 1.25; word-break: keep-all; overflow-wrap: normal; }
.student-sheet-row > *:last-child { border-right: 0; }
.student-sheet-head { position: sticky; top: 0; z-index: 1; min-height: 42px; background: color-mix(in srgb, var(--text-primary), white 70%); font-weight: 900; }
.student-sheet-head > * { color: var(--surface-secondary); }
.sheet-type { background: color-mix(in srgb, var(--status-warning), white 35%); font-weight: 850; }
.sheet-school, .sheet-track, .sheet-phone, .sheet-lessons { justify-content: flex-start; }
.sheet-name { border: 0; background: color-mix(in srgb, var(--status-info), white 82%); color: var(--status-info); font: inherit; font-weight: 850; cursor: pointer; }
.sheet-name:hover, .sheet-name:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.sheet-korean { background: color-mix(in srgb, var(--status-warning), white 78%); }
.sheet-math { background: color-mix(in srgb, var(--status-success), white 83%); }
.sheet-explore { background: color-mix(in srgb, var(--accent-primary), white 78%); font-weight: 800; }
@media (max-width: 720px) { .student-list-tools { display: grid; } }


/* compact editable student roster */
.compact-student-tools { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; align-items: start; }
.student-tool-row { display: flex; align-items: end; gap: var(--space-3); }
.student-add-panel { border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--surface-elevated); padding: var(--space-2); }
.student-add-panel summary { cursor: pointer; color: var(--accent-primary); font-size: 13px; font-weight: 850; }
.student-add-panel summary::-webkit-details-marker { display: none; }
.student-add-grid { display: grid; grid-template-columns: repeat(6, minmax(92px, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.student-add-grid .input { min-height: 34px; padding: 6px 8px; font-size: 13px; }
.student-add-grid button { align-self: end; min-height: 34px; }
.student-table-wrap { overflow-x: visible; }
.compact-student-sheet { width: 100%; min-width: 0; font-size: 12px; }
.compact-student-head, .compact-student-row { grid-template-columns: 34px minmax(76px, .8fr) minmax(82px, .9fr) 48px 62px 72px 72px minmax(86px, .8fr) minmax(132px, 1.1fr) minmax(142px, 1.15fr) minmax(170px, 1.35fr); }
.compact-student-head { min-height: 34px; }
.compact-student-row { min-height: 42px; }
.compact-student-row > * { padding: 3px 4px; }
.sheet-field { display: flex; align-items: center; width: 100%; min-width: 0; }
.sheet-input, .sheet-select { width: 100%; min-width: 0; min-height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-primary); padding: 4px 6px; font-size: 12px; line-height: 1.25; }
.sheet-name-input { font-weight: 850; color: var(--status-info); background: color-mix(in srgb, var(--status-info), white 88%); }
.sheet-input:hover, .sheet-select:hover, .sheet-input:focus, .sheet-select:focus { border-color: var(--accent-primary); background: var(--surface-elevated); outline: none; }
.sheet-seat-combo { display: grid; grid-template-columns: .9fr .9fr .7fr; gap: 3px; width: 100%; min-width: 0; }
.sheet-pair { display: grid; gap: 3px; width: 100%; min-width: 0; }
.sheet-pair .sheet-input { min-height: 22px; padding-top: 2px; padding-bottom: 2px; }
.sheet-lesson-stack { display: grid; gap: 2px; justify-content: stretch; align-content: center; text-align: left; font-size: 11px; line-height: 1.25; }
.sheet-lesson-stack span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.selected-student { display: none !important; }
@media (max-width: 980px) {
  .compact-student-tools { grid-template-columns: 1fr; }
  .student-add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-table-wrap { overflow-x: auto; }
  .compact-student-sheet { min-width: 980px; }
}


/* compact roster width correction for 1280px desktop */
.compact-student-head, .compact-student-row {
  grid-template-columns: 32px minmax(58px, .75fr) minmax(58px, .78fr) 40px 50px 56px 56px minmax(62px, .68fr) minmax(98px, .95fr) minmax(106px, 1fr) minmax(116px, 1.05fr);
}
.compact-student-row > * { padding-left: 2px; padding-right: 2px; }
.sheet-input, .sheet-select { min-height: 28px; padding-left: 3px; padding-right: 3px; font-size: 11.5px; }
.sheet-pair .sheet-input { min-height: 21px; }
.sheet-lesson-stack { font-size: 10.5px; }


/* lesson creation day selector and contact labels */
.lesson-day-create { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); border: 1px solid var(--border-subtle); border-radius: 8px; padding: var(--space-2); margin: 0; }
.lesson-day-create .field-label { grid-column: 1 / -1; margin: 0; }
.lesson-day-create label { display: flex; align-items: center; justify-content: center; gap: var(--space-1); min-height: 32px; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--surface-secondary); font-size: 12px; font-weight: 800; }
.lesson-day-create input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent-primary); }
.phone-pair { gap: 2px; }
.phone-input { font-size: 10.5px; letter-spacing: 0; }
.student-add-grid [data-new-student="studentPhone"],
.student-add-grid [data-new-student="parentPhone"] { font-size: 12px; }


/* contact column width for phone role suffix */
.compact-student-head, .compact-student-row {
  grid-template-columns: 32px minmax(54px, .7fr) minmax(54px, .72fr) 38px 46px 52px 52px minmax(58px, .62fr) minmax(88px, .82fr) minmax(138px, 1.36fr) minmax(102px, .9fr);
}


/* lesson create day selector layout fix */
.lesson-create-grid {
  grid-template-columns: 1fr;
}
.lesson-create-grid label:first-child,
.lesson-create-grid label:nth-child(3),
.add-lesson-button,
.lesson-day-create {
  grid-column: 1 / -1;
}
.lesson-day-create {
  width: 100%;
  min-width: 0;
  min-inline-size: 0;
  box-sizing: border-box;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.lesson-day-create label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.lesson-day-create input {
  flex: 0 0 14px;
}


/* prevent parent lesson grid rules from affecting weekday choices */
.lesson-create-grid .lesson-day-create label {
  grid-column: auto;
}


/* roster filter responsive overflow fix */
.lesson-roster-tools,
.class-roster-head,
.class-roster-head > div,
.roster-head-actions,
.print-name-strip,
.print-name-strip div {
  min-width: 0;
}

.lesson-roster-tools {
  flex: 1 1 360px;
}

.class-roster-head {
  flex-wrap: wrap;
}

.class-roster-head > div:first-child {
  flex: 1 1 180px;
}

.roster-head-actions {
  flex: 1 1 160px;
}

.print-roster-button {
  white-space: normal;
  line-height: 1.25;
}

@media (max-width: 980px) {
  .class-roster-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .lesson-roster-tools,
  .weekday-tabs {
    width: 100%;
  }

  .weekday-tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .class-roster-head,
  .roster-head-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .roster-head-actions b,
  .print-roster-button {
    justify-self: stretch;
    text-align: center;
  }
}


/* roster header stable grid */
.roster-title-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(280px, 480px);
  align-items: end;
}

.roster-title-row > *,
.lesson-roster-tools label,
.lesson-roster-tools .input {
  min-width: 0;
}

.roster-title-row .weekday-tabs {
  grid-column: 1 / -1;
  justify-self: start;
}

.lesson-roster-tools {
  width: 100%;
}

@media (max-width: 720px) {
  .roster-title-row {
    grid-template-columns: 1fr;
  }

  .lesson-roster-tools {
    grid-template-columns: 1fr;
  }

  .roster-title-row .weekday-tabs {
    justify-self: stretch;
  }
}


/* lessons view tablet layout fix */
@media (max-width: 980px) {
  body[data-active-view="lessons"] .shell {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* monthly attendance note board */
.monthly-attendance-panel { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); border: 1px solid color-mix(in srgb, var(--accent-primary), white 62%); border-radius: 8px; background: linear-gradient(180deg, var(--surface-secondary) 0%, color-mix(in srgb, var(--surface-warm), white 68%) 100%); padding: var(--space-4); }
.monthly-attendance-head { align-items: end; }
.monthly-attendance-summary { color: var(--accent-primary); font-size: 13px; font-weight: 850; }
.monthly-attendance-form { display: grid; grid-template-columns: 140px minmax(120px, 1fr) 110px 118px minmax(180px, 1.4fr) auto; gap: var(--space-2); align-items: end; }
.monthly-attendance-form label, .monthly-attendance-form .input { min-width: 0; }
.monthly-note-memo { min-width: 160px; }
.monthly-attendance-list { display: grid; gap: var(--space-2); }
.monthly-note-row { display: grid; grid-template-columns: 72px minmax(160px, 1fr) 96px 56px; align-items: center; gap: var(--space-2); border: 1px solid var(--border-default); border-left: 4px solid var(--accent-primary); border-radius: 8px; background: var(--surface-secondary); padding: var(--space-2); }
.monthly-note-row.is-selected-date { background: color-mix(in srgb, var(--accent-primary), white 92%); }
.monthly-note-date { display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.monthly-note-date strong { font-size: 16px; line-height: 1.2; }
.monthly-note-date span, .monthly-note-main span { color: var(--text-secondary); font-size: 12px; font-weight: 750; }
.monthly-note-main { display: grid; gap: 2px; min-width: 0; }
.monthly-note-main strong, .monthly-note-main span { min-width: 0; overflow-wrap: anywhere; }
.monthly-note-badge { justify-self: start; border: 1px solid var(--status-warning); border-radius: 999px; background: color-mix(in srgb, var(--status-warning), white 86%); color: var(--status-warning); padding: 5px 8px; font-size: 12px; font-weight: 850; white-space: nowrap; }
.monthly-note-badge.absent { border-color: var(--status-error); background: color-mix(in srgb, var(--status-error), white 90%); color: var(--status-error); }
.monthly-note-badge.other { border-color: var(--status-info); background: color-mix(in srgb, var(--status-info), white 90%); color: var(--status-info); }
.monthly-note-delete { justify-self: end; }
.monthly-note-empty { border: 1px dashed var(--border-default); border-radius: 8px; color: var(--text-secondary); padding: var(--space-3); text-align: center; }
@media (max-width: 980px) { .monthly-attendance-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .monthly-note-memo, .monthly-attendance-form button { grid-column: 1 / -1; } }
@media (max-width: 560px) { .monthly-attendance-form, .monthly-note-row { grid-template-columns: 1fr; } .monthly-note-delete, .monthly-note-badge { justify-self: stretch; text-align: center; } }
/* compact student roster column rebalance */
.compact-student-head, .compact-student-row { grid-template-columns: 30px minmax(48px, .48fr) minmax(52px, .5fr) 34px 42px 45px 45px minmax(52px, .48fr) minmax(76px, .62fr) minmax(92px, .75fr) minmax(100px, .8fr) minmax(260px, 2.6fr); }
.compact-student-sheet { font-size: 11.5px; }
.sheet-seat-combo { grid-template-columns: minmax(0, .95fr) auto minmax(0, .9fr) auto minmax(0, .72fr); align-items: center; gap: 2px; }
.seat-slash { color: var(--text-tertiary); font-size: 11px; font-weight: 850; line-height: 1; }
.phone-field { justify-content: stretch; }
.phone-input { font-size: 10px; letter-spacing: 0; }
.sheet-lesson-stack { font-size: 11px; line-height: 1.28; }
.sheet-lesson-stack span { white-space: normal; overflow: visible; text-overflow: clip; }
.compact-student-row { min-height: 48px; align-items: stretch; }
.compact-student-row > * { padding-left: 2px; padding-right: 2px; }
@media (max-width: 980px) { .compact-student-sheet { min-width: 1100px; } }
/* student table overflow containment after column split */
body[data-active-view="students"] .work-area,
body[data-active-view="students"] .student-list,
body[data-active-view="students"] .student-table-wrap { min-width: 0; max-width: 100%; }
body[data-active-view="students"] .student-table-wrap { overflow-x: auto; overflow-y: visible; }
body[data-active-view="students"] .compact-student-sheet { width: max(100%, 1080px); min-width: 0; }
@media (min-width: 981px) {
  body[data-active-view="students"] .compact-student-sheet { width: 100%; }
  body[data-active-view="students"] .compact-student-head,
  body[data-active-view="students"] .compact-student-row { grid-template-columns: 28px minmax(44px, .46fr) minmax(48px, .48fr) 32px 40px 43px 43px minmax(48px, .44fr) minmax(70px, .56fr) minmax(84px, .68fr) minmax(90px, .72fr) minmax(238px, 2.45fr); }
}
@media (max-width: 980px) {
  body[data-active-view="students"] .compact-student-sheet { width: 1080px; min-width: 1080px; }
}
/* student tools mobile containment */
@media (max-width: 980px) {
  body[data-active-view="students"] .compact-student-tools { grid-template-columns: minmax(0, 1fr); }
  body[data-active-view="students"] .student-tool-row { min-width: 0; flex-wrap: wrap; }
  body[data-active-view="students"] .student-add-panel { min-width: 0; }
}
/* root horizontal overflow guard */
html, body { overflow-x: hidden; }
body[data-active-view="students"] .student-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
/* student table layout containment */
body[data-active-view="students"] .student-table-wrap { contain: layout paint; }
/* readable student roster columns */
body[data-active-view="students"] .compact-student-sheet {
  width: max(100%, 1340px);
}
body[data-active-view="students"] .compact-student-head,
body[data-active-view="students"] .compact-student-row {
  grid-template-columns: 32px 72px 88px 38px 52px 56px 56px 86px 104px 148px 158px minmax(330px, 1fr);
}
body[data-active-view="students"] .compact-student-row > * {
  padding-left: 4px;
  padding-right: 4px;
}
body[data-active-view="students"] .sheet-input,
body[data-active-view="students"] .sheet-select {
  font-size: 12px;
  line-height: 1.25;
}
body[data-active-view="students"] .phone-input {
  font-size: 11px;
  padding-left: 4px;
  padding-right: 4px;
}
body[data-active-view="students"] .sheet-lesson-stack {
  font-size: 11.5px;
  line-height: 1.35;
}
@media (min-width: 981px) {
  body[data-active-view="students"] .compact-student-sheet {
    min-width: 1340px;
  }
}
@media (max-width: 980px) {
  body[data-active-view="students"] .compact-student-sheet {
    min-width: 1340px;
  }
}


/* 재종반 등원 처리 상태 확장 */
.attendance-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-button.early { border: 1px solid var(--status-warning); background: color-mix(in srgb, var(--status-warning), white 84%); color: var(--status-warning); }
.status-button.out { border: 1px solid var(--status-info); background: color-mix(in srgb, var(--status-info), white 88%); color: var(--status-info); }
.status-button.return { border: 1px solid var(--status-success); background: color-mix(in srgb, var(--status-success), white 86%); color: var(--status-success); }
.student-card[data-status="early"] { border-left: 4px solid var(--status-warning); }
.student-card[data-status="out"] { border-left: 4px solid var(--status-info); }
.student-card[data-status="return"] { border-left: 4px solid var(--status-success); }
.student-card[data-status="early"] .status-pill { border-color: var(--status-warning); color: var(--status-warning); }
.student-card[data-status="out"] .status-pill { border-color: var(--status-info); color: var(--status-info); }
.student-card[data-status="return"] .status-pill { border-color: var(--status-success); color: var(--status-success); }
.seat-cell[data-seat-status="early"] { border-color: color-mix(in srgb, var(--status-warning), white 50%); background: color-mix(in srgb, var(--status-warning), white 91%); }
.seat-cell[data-seat-status="out"] { border-color: color-mix(in srgb, var(--status-info), white 52%); background: color-mix(in srgb, var(--status-info), white 92%); }
.seat-cell[data-seat-status="return"] { border-color: color-mix(in srgb, var(--status-success), white 52%); background: color-mix(in srgb, var(--status-success), white 91%); }
.legend-dot.status-early { background: color-mix(in srgb, var(--status-warning), white 74%); border-color: var(--status-warning); }
.legend-dot.status-out { background: color-mix(in srgb, var(--status-info), white 76%); border-color: var(--status-info); }
.legend-dot.status-return { background: color-mix(in srgb, var(--status-success), white 72%); border-color: var(--status-success); }
@media (max-width: 560px) { .attendance-kpi-grid { grid-template-columns: 1fr 1fr; } }

/* fit-to-screen student roster and care card */
body[data-active-view="students"] .shell {
  grid-template-columns: minmax(0, 1fr);
}
body[data-active-view="students"] .control-panel {
  display: none;
}
body[data-active-view="students"] .work-area {
  max-width: 100%;
}
body[data-active-view="students"] .student-table-wrap {
  overflow-x: hidden;
}
body[data-active-view="students"] .compact-student-sheet {
  width: 100%;
  min-width: 0;
  font-size: 10.5px;
}
body[data-active-view="students"] .compact-student-head,
body[data-active-view="students"] .compact-student-row {
  grid-template-columns: 24px minmax(48px, .55fr) minmax(56px, .62fr) 28px 36px 40px 40px minmax(52px, .64fr) minmax(76px, .82fr) minmax(96px, 1fr) minmax(104px, 1.06fr) minmax(180px, 2.15fr);
}
body[data-active-view="students"] .student-sheet-title {
  font-size: 16px;
  padding: 7px 9px;
}
body[data-active-view="students"] .compact-student-row {
  min-height: 52px;
}
body[data-active-view="students"] .compact-student-row > * {
  padding-left: 2px;
  padding-right: 2px;
}
body[data-active-view="students"] .sheet-input,
body[data-active-view="students"] .sheet-select {
  min-height: 25px;
  padding: 2px 3px;
  font-size: 10.5px;
}
body[data-active-view="students"] .phone-input {
  font-size: 9.5px;
  padding-left: 2px;
  padding-right: 2px;
}
body[data-active-view="students"] .sheet-seat-combo {
  gap: 1px;
}
body[data-active-view="students"] .seat-slash {
  font-size: 9px;
}
body[data-active-view="students"] .sheet-lesson-stack {
  font-size: 10px;
  line-height: 1.25;
  max-height: 5em;
  overflow: hidden;
}
body[data-active-view="students"] .sheet-lesson-stack span {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
}
.student-care-panel {
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
}
.student-care-panel summary {
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  font-weight: 900;
}
.care-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: var(--space-3);
  padding: var(--space-3);
}
.care-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  min-width: 0;
}
.care-wide {
  grid-column: 1 / -1;
}
.care-form textarea.input {
  min-height: 86px;
  resize: vertical;
}
.care-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.care-history-panel {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-tint), white 70%);
  padding: var(--space-3);
}
.care-summary {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
}
.care-history {
  display: grid;
  gap: var(--space-2);
  max-height: 320px;
  overflow: auto;
}
.care-empty {
  margin: 0;
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  padding: var(--space-3);
  color: var(--text-secondary);
  text-align: center;
}
.care-record {
  display: grid;
  gap: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 72%);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-2);
}
.care-record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-2);
}
.care-record-head div {
  display: grid;
  gap: 2px;
}
.care-record-head span,
.care-audio-chip {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
}
.care-record p,
.care-record pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
}
.care-record pre {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-2);
  color: var(--text-secondary);
}
@media (max-width: 980px) {
  body[data-active-view="students"] .student-table-wrap {
    overflow-x: auto;
  }
  body[data-active-view="students"] .compact-student-sheet {
    min-width: 960px;
  }
  .care-card-grid,
  .care-form {
    grid-template-columns: 1fr;
  }
}
/* simple audio upload and AI summary */
.care-audio-uploader {
  position: relative;
  border: 1px dashed color-mix(in srgb, var(--accent-primary), white 45%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 92%);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}
.care-audio-uploader:hover,
.care-audio-uploader:focus-visible,
.care-audio-uploader.is-dragging {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary), white 86%);
  outline: none;
}
.care-audio-uploader.is-dragging {
  transform: translateY(-1px);
}
.care-audio-uploader.is-busy {
  cursor: progress;
  opacity: .8;
}
.care-audio-uploader input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.care-upload-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none;
}
.care-upload-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-primary);
  color: var(--surface-secondary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}
.care-upload-main div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.care-upload-main strong {
  color: var(--text-primary);
  font-size: 13px;
}
.care-upload-main small {
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.care-actions .primary-button[disabled] {
  opacity: .65;
  cursor: progress;
}
/* student function tabs */
.student-workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 93%);
}
.student-work-tab {
  min-height: 38px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 0 var(--space-4);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}
.student-work-tab:hover,
.student-work-tab:focus-visible {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  outline: none;
}
.student-work-tab.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--surface-secondary);
}
body[data-active-view="students"] [data-student-work-panel][hidden] {
  display: none !important;
}
body[data-active-view="students"] .compact-student-tools {
  grid-template-columns: minmax(220px, 320px);
  justify-content: start;
}
.student-add-workspace {
  margin-bottom: var(--space-3);
}
body[data-active-view="students"] .student-add-workspace .student-add-panel {
  background: var(--surface-secondary);
  padding: var(--space-3);
}
@media (max-width: 720px) {
  .student-work-tab { flex: 1 1 140px; }
}
/* per-student management card */
.sheet-name-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  width: 100%;
  min-width: 0;
}
.sheet-card-button {
  min-height: 24px;
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 62%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-primary), white 90%);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.sheet-card-button:hover,
.sheet-card-button:focus-visible {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary), white 82%);
  outline: none;
}
.care-profile-card {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 66%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 94%);
  padding: var(--space-3);
}
.care-profile-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-2);
}
.care-profile-head strong {
  display: block;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.3;
}
.care-profile-head span,
.care-profile-grid dt,
.care-profile-lessons > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
}
.care-count-badge {
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--accent-primary);
  color: var(--surface-secondary) !important;
  padding: 4px 8px;
}
.care-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
}
.care-profile-grid div {
  min-width: 0;
}
.care-profile-grid dt,
.care-profile-grid dd {
  margin: 0;
}
.care-profile-grid dd {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.care-profile-lessons {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
}
@media (max-width: 720px) {
  .care-profile-grid { grid-template-columns: 1fr; }
}
/* consultation edit controls */
.care-edit-notice {
  border: 1px solid color-mix(in srgb, var(--status-warning), white 58%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--status-warning), white 88%);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  font-weight: 850;
}
.care-record-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.danger-text-button {
  color: var(--status-error);
}
.danger-text-button:hover,
.danger-text-button:focus-visible {
  border-color: var(--status-error);
  color: var(--status-error);
}
/* login screen */
body:not(.is-authenticated) .app-header,
body:not(.is-authenticated) .shell,
body:not(.is-authenticated) .toast {
  display: none !important;
}
body.is-authenticated .login-screen {
  display: none !important;
}
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: var(--surface-primary);
}
.login-card {
  width: min(100%, 420px);
  display: grid;
  gap: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-6);
}
.login-card h1 {
  margin: -8px 0 0;
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1.25;
}
.login-error {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--status-error), white 65%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--status-error), white 90%);
  color: var(--status-error);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  font-weight: 850;
}
.logout-button {
  white-space: nowrap;
}
/* direct seat editing and withdrawal actions */
.seat-edit-hint {
  align-self: start;
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 68%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-primary), white 91%);
  color: var(--accent-primary);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.seat-cell-editable {
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  align-content: start;
}
.seat-main-button,
.seat-main-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}
.seat-main-button { cursor: pointer; }
.seat-main-button:hover .seat-name,
.seat-main-button:focus-visible .seat-name { color: var(--accent-primary); }
.seat-main-button:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent-primary), white 45%); outline-offset: 2px; border-radius: 5px; }
.seat-duplicate-badge {
  justify-self: start;
  border: 1px solid color-mix(in srgb, var(--status-error), white 56%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-error), white 90%);
  color: var(--status-error);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
}
.seat-edit-list { display: grid; gap: 4px; }
.seat-edit-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 4px; align-items: center; font-size: 10px; font-weight: 850; }
.seat-edit-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-move-select,
.seat-assign-select {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 800;
}
.seat-move-select:focus,
.seat-assign-select:focus { border-color: var(--accent-primary); outline: none; }
.sheet-row-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); width: 100%; min-width: 0; }
.sheet-card-button,
.sheet-withdraw-button,
.sheet-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  min-height: 24px;
  border-radius: 6px;
  padding: 2px 3px;
  font-size: 10.5px;
  line-height: 1.1;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.sheet-withdraw-button,
.sheet-delete-button {
  border: 1px solid color-mix(in srgb, var(--status-error), white 62%);
  background: color-mix(in srgb, var(--status-error), white 91%);
  color: var(--status-error);
}
.sheet-withdraw-button:hover,
.sheet-withdraw-button:focus-visible,
.sheet-delete-button:hover,
.sheet-delete-button:focus-visible { border-color: var(--status-error); background: color-mix(in srgb, var(--status-error), white 84%); outline: none; }
@media (max-width: 720px) {
  .seat-zone-head { display: grid; }
  .seat-edit-hint { justify-self: start; white-space: normal; }
  .sheet-row-actions { grid-template-columns: 1fr; }
}
/* roster search, lazy seat editor, withdrawn archive */
.student-tool-row-wide { grid-template-columns: minmax(220px, 1.4fr) minmax(150px, .65fr) auto; align-items: end; }
.seat-inline-action {
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 64%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-primary), white 91%);
  color: var(--accent-primary);
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}
.seat-inline-action:hover,
.seat-inline-action:focus-visible { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary), white 84%); outline: none; }
.withdrawn-panel {
  display: grid;
  gap: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  padding: var(--space-4);
}
.withdrawn-head,
.withdrawn-card {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
}
.withdrawn-list { display: grid; gap: var(--space-2); }
.withdrawn-card {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-primary), white 30%);
  padding: var(--space-3);
}
.withdrawn-card-main { display: grid; gap: 3px; min-width: 0; }
.withdrawn-card-main strong { color: var(--text-primary); font-size: 15px; font-weight: 900; }
.withdrawn-card-main span,
.withdrawn-card-main small { color: var(--text-secondary); font-size: 12px; font-weight: 750; }
.withdrawn-actions { display: flex; gap: var(--space-2); flex: 0 0 auto; }
.withdrawn-actions .secondary-button,
.withdrawn-actions .danger-button { min-height: 32px; padding: 6px 10px; }
@media (max-width: 720px) {
  .student-tool-row-wide,
  .withdrawn-head,
  .withdrawn-card { display: grid; grid-template-columns: 1fr; }
  .withdrawn-actions { justify-content: stretch; }
  .withdrawn-actions .secondary-button,
  .withdrawn-actions .danger-button { width: 100%; }
}
body[data-active-view="students"] .sheet-name-cell {
  align-content: center;
  overflow: hidden;
}
body[data-active-view="students"] .sheet-name-input {
  text-align: center;
  font-weight: 850;
}
body[data-active-view="students"] .sheet-row-actions {
  align-items: stretch;
}
body[data-active-view="students"] .sheet-card-button,
body[data-active-view="students"] .sheet-withdraw-button,
body[data-active-view="students"] .sheet-delete-button {
  max-width: 100%;
}

/* mobile-operator-upgrade */
.care-record-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 2fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 72%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-primary), white 92%);
}
.care-record-controls span { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.care-audio-uploader.is-recording { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary), white 86%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 82%); }

@media (max-width: 760px) {
  body { font-size: 14px; }
  .app-header, .shell { width: 100%; max-width: none; }
  .app-header { padding: 16px 14px; gap: 12px; }
  .shell { margin-bottom: 72px; padding: 0 10px 16px; }
  .control-panel, .work-area, .student-care-panel, .selected-student { border-radius: 8px; }
  .control-panel { gap: 12px; padding: 12px; }
  .work-area { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-height: 74px; padding: 10px; }
  .kpi-card strong { font-size: 23px; }
  .floor-tabs, .view-switch, .header-actions, .toolbar-actions, .quick-check-actions, .quick-check-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .floor-tabs > *, .view-switch > *, .header-actions > *, .toolbar-actions > *, .quick-check-actions > *, .quick-check-tools > * { width: 100%; min-height: 44px; }
  .student-list { grid-template-columns: 1fr; }
  .student-card { padding: 12px; }
  .student-head, .care-record-head, .toolbar { display: grid; grid-template-columns: 1fr; }
  .status-pill { justify-self: start; }
  .care-card-grid, .care-form { grid-template-columns: 1fr; padding: 10px; }
  .care-record-controls { grid-template-columns: 1fr 1fr; }
  .care-record-controls span { grid-column: 1 / -1; }
  .care-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .care-actions button { min-height: 44px; }
  .care-history { max-height: none; }
  .student-table-wrap { overflow-x: visible !important; }
}

@media (max-width: 430px) {
  .kpi-grid, .filter-grid, .floor-tabs, .view-switch, .header-actions, .toolbar-actions, .quick-check-actions, .quick-check-tools, .care-actions { grid-template-columns: 1fr; }
  .brand-nav { display: grid; grid-template-columns: 1fr; width: 100%; }
  .meta-grid { grid-template-columns: 1fr; }
  .input, .primary-button, .secondary-button, .danger-button, .status-button { min-height: 44px; }
}

/* mobile-workflow-separation */
.nav-tab-title,
.nav-tab-desc {
  display: block;
  line-height: 1.25;
}
.nav-tab-title {
  font-size: 15px;
  font-weight: 900;
}
.nav-tab-desc {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  opacity: .82;
}
@media (max-width: 760px) {
  .app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 3px solid var(--accent-primary);
    box-shadow: 0 10px 24px rgba(90, 45, 18, .14);
  }
  .header-actions {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    border: 1px solid color-mix(in srgb, var(--accent-primary), white 62%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent-primary), white 92%);
    padding: 10px;
  }
  .header-actions::before {
    content: "업무 선택";
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 900;
  }
  .view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .tab-button.nav-tab {
    display: grid;
    align-content: center;
    min-width: 0;
    min-height: 62px;
    border: 1px solid color-mix(in srgb, var(--accent-primary), white 64%);
    border-radius: 8px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    padding: 9px 10px;
    text-align: left;
    white-space: normal;
  }
  .tab-button.nav-tab.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: var(--surface-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 82%);
  }
  .brand-current,
  .logout-button {
    justify-self: stretch;
    text-align: center;
  }
  .work-area,
  .control-panel,
  .student-care-panel,
  .student-add-workspace,
  .student-roster-workspace,
  .class-roster-panel,
  .monthly-attendance-panel,
  .ai-panel {
    border-top: 4px solid var(--accent-primary);
    box-shadow: 0 8px 22px rgba(120, 70, 32, .07);
  }
  body[data-active-view="seats"] .work-area::before,
  body[data-active-view="students"] .student-roster-workspace::before,
  body[data-active-view="lessons"] .class-roster-panel::before,
  body[data-active-view="ai"] .ai-panel::before {
    display: block;
    margin-bottom: 10px;
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 900;
  }
  body[data-active-view="seats"] .work-area::before { content: "출석 관리 - 좌석표에서 빠르게 체크"; }
  body[data-active-view="students"] .student-roster-workspace::before { content: "학생관리 - 명단, 상담, 신규생"; }
  body[data-active-view="lessons"] .class-roster-panel::before { content: "수업 관리 - 요일별 수업 명단"; }
  body[data-active-view="ai"] .ai-panel::before { content: "AI 업무 - 보고문과 정리"; }
}
@media (max-width: 430px) {
  .view-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* mobile title safe-area and clipping guard */
@media (max-width: 760px) {
  .app-header {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    overflow: visible;
  }

  .app-header > div:first-child,
  .toolbar,
  .roster-title-row,
  .seat-map-title-row,
  .care-record-head {
    min-width: 0;
  }

  .app-header h1,
  .app-header .eyebrow,
  .toolbar h2,
  .roster-title-row h2,
  .seat-map-title-row h2,
  .student-care-panel h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: keep-all;
    text-wrap: balance;
  }

  .header-actions,
  .view-switch,
  .brand-nav {
    min-width: 0;
  }

  .care-record-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
