:root {
  --bg: #f5efe3;
  --panel: rgba(255, 250, 240, 0.92);
  --panel-strong: rgba(254, 251, 246, 0.98);
  --ink: #1f2e2e;
  --muted: #5b6e6e;
  --line: rgba(42, 68, 68, 0.14);
  --green: #1f5c4d;
  --green-soft: #d9eee7;
  --orange: #d7863f;
  --orange-soft: #fff0da;
  --red: #b94f42;
  --red-soft: #fde5e1;
  --shadow: 0 18px 50px rgba(42, 68, 68, 0.12);
  --radius: 24px;
  --font-ui: "Pretendard Variable", "SUIT Variable", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  --font-display: "MaruBuri", "NanumSquareRound", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(180deg, #edf4e5 0%, #f5efe3 40%, #efe7d9 100%);
  color: var(--ink);
  font-family: var(--font-ui);
}

body {
  padding: clamp(14px, 2vw, 28px);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.button-link:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(215, 134, 63, 0.35);
  outline-offset: 2px;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 24px;
  margin-bottom: 24px;
  padding: clamp(22px, 3vw, 36px);
  border-radius: 30px;
  color: #f7f8f2;
  background:
    linear-gradient(130deg, rgba(18, 50, 44, 0.92), rgba(38, 87, 73, 0.9)),
    radial-gradient(circle at top right, rgba(235, 212, 153, 0.24), transparent 36%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 241, 196, 0.12);
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow,
.panel-kicker,
.stat-label {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.82;
}

.eyebrow {
  cursor: pointer;
  user-select: none;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.84rem;
  font-weight: 700;
}

.hero h1,
.panel h2,
.teacher-card h3,
.teacher-box h3 {
  margin: 0;
  font-family: var(--font-display);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
}

.hero-text {
  max-width: 760px;
  margin: 18px 0 0;
  color: rgba(247, 248, 242, 0.9);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
}

.hero-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
}

.stat-card.accent {
  background: rgba(255, 218, 179, 0.18);
}

.dashboard {
  display: grid;
  gap: 24px;
}

.panel {
  padding: clamp(18px, 2.4vw, 24px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.compact-head {
  margin-bottom: 12px;
}

.inline-actions,
.storage-actions,
.bulk-actions,
.result-actions,
.teacher-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary {
  color: #f7f8f2;
  background: linear-gradient(135deg, #205f50, #17463b);
  box-shadow: 0 10px 24px rgba(31, 92, 77, 0.24);
}

.secondary {
  color: var(--green);
  background: var(--green-soft);
}

.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
}

.danger {
  color: var(--red);
}

.helper {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.bulk-grid,
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.quickstart-grid,
.sample-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.helper-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.teacher-card,
.teacher-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
}

.sample-details {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
}

.sample-details summary {
  cursor: pointer;
  font-weight: 700;
}

.sample-details[open] summary {
  margin-bottom: 14px;
}

.sample-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 92, 77, 0.1);
}

.sample-card pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-weight: 700;
}

textarea,
input[type="text"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--ink);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 4px),
    calc(100% - 16px) calc(50% - 4px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  max-height: min(60vh, 560px);
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
}

.student-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

.student-table th,
.student-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.student-table thead {
  background: rgba(31, 92, 77, 0.08);
}

.student-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(229, 241, 236, 0.98);
  backdrop-filter: blur(6px);
}

.student-table tbody tr:last-child td {
  border-bottom: none;
}

.student-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.remove-button {
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--red);
  background: rgba(185, 79, 66, 0.1);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.toggle input {
  margin: 0;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.qr-grid {
  grid-template-columns: minmax(320px, 1fr);
  margin-bottom: 14px;
}

.cleaning-grid {
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(0, 1fr)) minmax(160px, 1fr);
  align-items: center;
}

.manual-locks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.selection-order-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.lock-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(31, 92, 77, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.lock-card strong {
  font-size: 1.02rem;
}

.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.warning-text {
  color: var(--red);
  font-size: 0.9rem;
  line-height: 1.45;
}

.small-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(31, 92, 77, 0.08);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
}

.link-preview {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}

.seat-grid-wrap {
  margin-top: 18px;
  padding: 18px;
  overflow-x: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(252, 248, 241, 0.95), rgba(244, 238, 225, 0.95));
}

.scroll-hint {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.seat-grid-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 14px;
  color: var(--green);
  font-weight: 700;
  text-align: center;
}

.seat-grid {
  display: grid;
  gap: 14px;
  min-width: 900px;
}

.seat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

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

.seat-card {
  display: grid;
  gap: 10px;
  min-height: 136px;
  padding: 14px;
  border: 1px solid rgba(31, 92, 77, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.seat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(31, 92, 77, 0.1);
}

.seat-card.blocked {
  background: repeating-linear-gradient(
    135deg,
    rgba(185, 79, 66, 0.08),
    rgba(185, 79, 66, 0.08) 10px,
    rgba(255, 255, 255, 0.74) 10px,
    rgba(255, 255, 255, 0.74) 20px
  );
  border-color: rgba(185, 79, 66, 0.24);
}

.seat-card.assigned {
  background: linear-gradient(180deg, rgba(225, 245, 238, 0.9), rgba(255, 255, 255, 0.92));
}

.seat-card.reserved {
  background: linear-gradient(180deg, rgba(255, 240, 218, 0.92), rgba(255, 255, 255, 0.92));
}

.seat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.seat-label {
  font-weight: 800;
  color: var(--green);
}

.seat-division {
  color: var(--muted);
  font-size: 0.85rem;
}

.seat-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(31, 92, 77, 0.08);
  color: var(--green);
}

.seat-teacher-controls {
  display: grid;
  gap: 10px;
}

.priority-input {
  max-width: 100px;
  padding: 8px 10px;
  border-radius: 14px;
}

.seat-student {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(31, 92, 77, 0.06);
  line-height: 1.5;
}

.seat-student strong {
  display: block;
}

.seat-empty,
.status-box {
  color: var(--muted);
}

.seat-toggle-button {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
}

.cleaning-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  min-width: 840px;
}

.cleaning-board-wrap {
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.duty-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.duty-card strong {
  font-size: 1.05rem;
}

.duty-card .meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.duty-card.empty {
  background: rgba(255, 255, 255, 0.55);
}

.status-box {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.55);
  line-height: 1.55;
}

.status-box.compact {
  min-height: 0;
}

code {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(31, 92, 77, 0.08);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  body {
    padding: 18px;
  }

  .hero,
  .bulk-grid,
  .result-grid,
  .teacher-grid,
  .strategy-grid,
  .cleaning-grid,
  .quickstart-grid,
  .sample-preview-grid {
    grid-template-columns: 1fr;
  }

  .manual-locks,
  .selection-order-board,
  .cleaning-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-table {
    min-width: 980px;
  }
}

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

  .hero-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .panel-head {
    gap: 14px;
  }
}

@media (max-width: 980px) {
  .hero-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seat-grid {
    min-width: 820px;
  }

  .cleaning-board {
    min-width: 760px;
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 24px;
  }

  .panel {
    padding: 18px;
  }

  .panel-head {
    flex-direction: column;
  }

  .seat-row,
  .cleaning-board,
  .manual-locks,
  .selection-order-board {
    grid-template-columns: 1fr;
  }

  .seat-grid-labels {
    display: none;
  }

  .seat-grid,
  .cleaning-board {
    min-width: 0;
  }

  .scroll-hint {
    display: none;
  }
}

@media print {
  body {
    padding: 0;
    background: #fff;
  }

  .hero {
    color: #111;
    background: #fff;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
    break-inside: avoid;
  }

  #teacher-panel,
  #seat-strategy-box,
  #manual-lock-section,
  #seat-teacher-actions,
  #cleaning-policy-box,
  #cleaning-teacher-actions,
  #storage-panel,
  .seat-teacher-controls,
  .mode-pill,
  .seat-toggle-button {
    display: none !important;
  }
}
