/* ════════════════════════════════════
   디자인 토큰
   색·크기·라운드·그림자는 전부 여기서만 정한다.
   ════════════════════════════════════ */
:root {
  --font: 'Pretendard Variable', Pretendard, 'Malgun Gothic',
          'Apple SD Gothic Neo', system-ui, sans-serif;
  --font-mono: 'Consolas', 'D2Coding', ui-monospace, monospace;

  --bg:            #f7f8fa;
  --surface:       #ffffff;
  --surface-2:     #f1f3f5;
  --surface-3:     #e9ecef;
  --border:        #e4e7ec;
  --border-strong: #d0d5dd;

  /*
    빈 좌석 — 화면(--bg #f7f8fa)과 PNG(흰 배경) 양쪽에서 형태가 읽혀야 한다.
    예전에는 채움이 --surface-2 라 배경과 대비 1.05:1 이었다. 즉 안 보였다.
    형태는 대부분 테두리가 만든다. 채움은 한 단계만 내린다.
    ※ export-png.js 가 캔버스라 CSS 변수를 못 읽어 같은 값을 상수로 갖고 있다.
      한쪽만 바꾸면 화면과 인쇄물이 갈라진다.
  */
  --seat-empty:        #e5e9ee;   /* 배경 대비 1.05 → 1.17 */
  --seat-empty-border: #b9c2ce;   /* 배경 대비 1.17 → 1.70 */
  --seat-empty-ink:    #667085;   /* 좌석번호. 채움 위 2.3 → 4.0 */

  --text:   #1a1d21;
  --text-2: #667085;
  --text-3: #98a2b3;

  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  #eff4ff;

  --success:       #16a34a;
  --success-hover: #15803d;
  --danger:        #dc2626;
  --danger-soft:   #fef2f2;

  --warn-soft:   #fffbeb;
  --warn-border: #fde68a;
  --warn-text:   #854d0e;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(16,24,40,0.05);
  --sh-2: 0 4px 12px rgba(16,24,40,0.08);
  --sh-3: 0 12px 32px rgba(16,24,40,0.16);

  /* 12px 아래로는 내려가지 않는다 — 답답함의 큰 몫이 여기 있었다 */
  --fs-xs:  12px;
  --fs-sm:  13px;
  --fs-md:  14px;
  --fs-lg:  16px;
  --fs-xl:  18px;

  --ring: 0 0 0 3px var(--accent-soft);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--bg);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── 공통 폼 컨트롤 ──
   예전에는 6개 블록에 제각각 정의돼 있어 화살표·높이·라운드가 다 달랐다. */
select,
input[type=text], input[type=number], input[type=password] {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
input::placeholder { color: var(--text-3); }
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
button { font-family: inherit; }
button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }

/* 얇은 스크롤바 */
#class-list, .modal-body, #editor-row-list, #editor-class-list, #right-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
#class-list::-webkit-scrollbar, .modal-body::-webkit-scrollbar,
#editor-row-list::-webkit-scrollbar, #editor-class-list::-webkit-scrollbar,
#right-panel::-webkit-scrollbar { width: 10px; height: 10px; }
#class-list::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb,
#editor-row-list::-webkit-scrollbar-thumb, #editor-class-list::-webkit-scrollbar-thumb,
#right-panel::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: var(--r-pill);
  border: 3px solid transparent; background-clip: content-box;
}

/* ════════════════════════════════════
   좌측 패널
   ════════════════════════════════════ */
#left-panel {
  width: 380px;
  min-width: 320px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

#panel-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#panel-title {
  font-size: var(--fs-xl); font-weight: 700;
  color: var(--text); letter-spacing: -0.3px;
}
/*
  제작자 표기 + 문의 창구. 학교명과 다른 정보라 줄을 섞지 않는다.
  보기 전용(/b/<id>)에서는 좌측 패널이 통째로 숨겨지므로 여기는 안 보인다 —
  그래서 우측 패널 푸터에도 같은 버튼이 하나 더 있다.
*/
#panel-credit {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font-size: var(--fs-xs); color: var(--text-2);
}
#panel-credit strong { color: var(--text); font-weight: 600; }

#panel-school {
  font-size: var(--fs-sm); color: var(--text-2);
  margin-top: 8px; min-height: 18px;
}
#panel-school.loaded { color: var(--accent); font-weight: 600; }
#save-status {
  font-size: var(--fs-xs); color: var(--text-3);
  margin-top: 2px; min-height: 16px;
}
#save-status.ok  { color: var(--success); }
#save-status.err { color: var(--danger); font-weight: 600; }

/* 툴바 */
#preset-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preset-btn {
  height: 36px; padding: 0 6px;
  font-size: var(--fs-xs); font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.preset-btn:hover { background: var(--surface-3); box-shadow: var(--sh-1); }
/* 이 도구의 시작점이라 혼자 눈에 띄어야 한다 */
.preset-btn.accent {
  background: var(--accent); color: #fff;
  border-color: var(--accent); font-weight: 600;
}
.preset-btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* 학반 추가 폼 */
#add-form {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 6px; align-items: flex-end;
  flex-shrink: 0;
  background: var(--bg);
}
.form-label {
  font-size: var(--fs-xs); color: var(--text-2);
  display: block; margin-bottom: 5px; font-weight: 500;
}
.form-group { display: flex; flex-direction: column; min-width: 0; }
#sel-grade { width: 84px; }
#sel-class { width: 74px; }
#inp-count { width: 66px; }
#add-btn {
  height: 36px; padding: 0 14px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-md);
  cursor: pointer; font-size: var(--fs-sm); font-weight: 600;
  white-space: nowrap; transition: background 0.12s;
}
#add-btn:hover { background: var(--accent-hover); }

/* ── 학반 목록 ── */
#class-list { flex: 1; overflow-y: auto; padding: 12px; }
#class-list-empty {
  color: var(--text-3); font-size: var(--fs-sm);
  text-align: center; margin-top: 40px; line-height: 1.9;
}
#class-list-empty strong { color: var(--text-2); }
.class-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  user-select: none;
}
.class-item:hover { border-color: var(--border-strong); box-shadow: var(--sh-1); }
.class-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.class-item-header { display: flex; align-items: center; gap: 8px; }
.class-color-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.class-name { font-weight: 600; font-size: var(--fs-md); flex: 1; letter-spacing: -0.2px; }
.class-count-badge {
  font-size: var(--fs-xs); color: var(--text-2); font-weight: 500;
  background: var(--surface-2); border-radius: var(--r-pill); padding: 3px 9px;
}
.class-btns { display: flex; gap: 3px; flex-shrink: 0; }
.btn-icon {
  background: none; border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; font-size: var(--fs-xs); padding: 3px 7px; color: var(--text-2);
  transition: background 0.1s, color 0.1s, border-color 0.1s; line-height: 1.4;
}
.btn-icon:disabled { opacity: 0.3; cursor: default; }
.btn-icon:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
.btn-icon.del:not(:disabled):hover {
  background: var(--danger-soft); color: var(--danger); border-color: var(--danger);
}

/* 배정 좌석 pills */
.class-seats-info { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.seats-info-label {
  font-size: var(--fs-xs); color: var(--text-3);
  font-weight: 600; margin-bottom: 6px;
}
.seat-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.seat-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); border: 1px solid #d6e2fd;
  border-radius: var(--r-sm); padding: 4px 9px;
  font-size: var(--fs-xs); line-height: 1.3;
}
.seat-pill-row { font-weight: 700; color: var(--accent); }
.seat-pill-nums { color: var(--text); }

/* 인라인 편집 (인원 + 시작 행) */
.edit-row { display: flex; align-items: center; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.edit-row-label { font-size: var(--fs-xs); color: var(--text-2); flex-shrink: 0; }
.edit-count-input { width: 58px; height: 32px; padding: 0 8px; border-color: var(--accent); }
.edit-startrow-select { height: 32px; padding: 0 26px 0 8px; max-width: 82px; border-color: var(--accent); }
/* 시작 행을 지정한 학반에만 표시 — 지정하지 않는 쪽이 보통이라 조용해야 한다 */
.startrow-chip {
  font-size: var(--fs-xs); color: #6b4bb8; background: #f3efff;
  border: 1px solid #e0d6fa; border-radius: var(--r-pill);
  padding: 2px 8px; white-space: nowrap; flex-shrink: 0; font-weight: 500;
}
.btn-save {
  height: 32px; padding: 0 12px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer;
}
.btn-save:hover { background: var(--accent-hover); }

/* ── 하단 바 — [좌석 배치]가 주 동작이므로 단독 행으로 올린다 ── */
#bottom-bar {
  padding: 14px; border-top: 1px solid var(--border);
  background: var(--bg); flex-shrink: 0;
}
#total-info {
  font-size: var(--fs-xs); color: var(--text-2);
  text-align: center; margin-bottom: 10px; font-weight: 500;
}
#total-info.over { color: var(--danger); font-weight: 700; }

#arrange-mode-row {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 10px;
}
#arrange-mode-row label { flex-shrink: 0; font-weight: 500; }
#arrange-mode { flex: 1; min-width: 0; height: 34px; font-size: var(--fs-xs); }
#arrange-gap-wrap { flex-shrink: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
#arrange-gap { width: 54px; height: 34px; padding: 0 8px; text-align: center; font-size: var(--fs-xs); }

#arrange-btn {
  width: 100%; padding: 14px;
  background: var(--success); color: #fff;
  border: none; border-radius: var(--r-lg);
  cursor: pointer; font-size: var(--fs-lg); font-weight: 700;
  letter-spacing: 0.5px;
  transition: background 0.12s, box-shadow 0.2s;
}
#arrange-btn:hover { background: var(--success-hover); }
/* 학반은 있는데 아직 배치 전 — "여길 누르면 된다"는 신호 */
#arrange-btn.nudge { box-shadow: 0 0 0 4px rgba(22,163,74,0.22); }

.bottom-btns { display: flex; gap: 8px; margin-top: 8px; }
.bottom-btns > button { flex: 1; }
#img-btn {
  height: 36px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); cursor: pointer;
  font-size: var(--fs-xs); font-weight: 500;
  transition: background 0.12s; white-space: nowrap;
}
#img-btn:hover:not(:disabled) { background: var(--surface-2); }
#img-btn:disabled { color: var(--text-3); border-color: var(--border); cursor: default; }
#reset-btn {
  height: 36px; padding: 0 12px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer;
  font-size: var(--fs-xs); transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
#reset-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }

/* ════════════════════════════════════
   우측 패널 · 좌석맵
   좌석 지름(--seat-size)은 render.js 의 fitSeatSize() 가 화면 폭에 맞춰 내려준다.
   ════════════════════════════════════ */
#right-panel {
  flex: 1; overflow: auto; padding: 24px;
  display: flex; flex-direction: column; align-items: center;
}
#stage-label {
  background: var(--text); color: #fff;
  padding: 11px 48px; border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 500; letter-spacing: 4px;
  margin-bottom: 22px; flex-shrink: 0;
  width: min(420px, 60%); text-align: center;
}
#seat-map {
  --seat-size: 28px;
  --seat-gap: 5px;
  --row-label-w: 26px;
  display: flex; flex-direction: column; gap: var(--seat-gap);
  align-items: stretch;
  /* 가장 긴 행에 폭을 맞춘다. 100%로 두면 행 이름(A…A)이 화면 양끝까지 밀려난다. */
  width: fit-content; max-width: 100%; margin: 0 auto;
}
.seat-row { display: flex; align-items: center; }
.row-label {
  font-weight: 600; font-size: var(--fs-xs); color: var(--text-2);
  width: var(--row-label-w); text-align: center; flex-shrink: 0;
}
.seats-container { flex: 1; display: flex; justify-content: center; gap: var(--seat-gap); }
.seat {
  width: var(--seat-size); height: var(--seat-size); border-radius: 50%;
  border: 1.5px solid var(--seat-empty-border); background: var(--seat-empty);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--seat-size) * 0.3); color: var(--seat-empty-ink);
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s; cursor: default;
  flex-shrink: 0; font-weight: 500; letter-spacing: -0.3px;
}
/* 안쪽 흰 테두리 — 비슷한 계열 색이 붙어도 반의 경계가 보인다 */
.seat.assigned {
  border-color: transparent; color: rgba(255,255,255,0);
  font-size: calc(var(--seat-size) * 0.26); font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
.seat.dimmed { opacity: 0.13; }
/* 확대해도 옆 좌석을 덮지 않도록 배율과 링을 간격(--seat-gap) 안에 가둔다 */
.seat.highlighted {
  color: rgba(255,255,255,0.95) !important;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 2px var(--text);
  transform: scale(1.12); z-index: 2;
}
/* 노랑·연두처럼 밝은 반 색 위에서는 흰 좌석번호가 안 읽힌다 (render.js 의 textOn) */
.seat.highlighted.on-light { color: rgba(26,29,33,0.95) !important; }
.seat.highlighted.on-light { box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18), 0 0 0 2px var(--text); }

/* ── 범례 — 칩 자체를 반 색으로 채워 좌석과 바로 이어지게 한다 ── */
#legend {
  margin-top: 24px; display: flex; flex-wrap: wrap;
  gap: 8px; justify-content: center; width: 100%;
}
.legend-item {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 15px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); color: #fff; cursor: pointer;
  border: none; line-height: 1.3;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.legend-name  { font-weight: 600; letter-spacing: -0.2px; }
.legend-count { font-weight: 500; opacity: 0.85; font-size: var(--fs-xs); }
.legend-item:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
/* 좌석맵의 dimmed 와 같은 언어로 맞춘다 */
#legend.has-selection .legend-item { opacity: 0.4; }
#legend.has-selection .legend-item.selected {
  opacity: 1; box-shadow: 0 0 0 3px var(--text); transform: scale(1.04);
}

/* ════════════════════════════════════
   모달 공통
   ════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(16,24,40,0.45); backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  width: 560px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide  { width: 800px; }
.modal.small { width: 420px; }
.modal-header {
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-lg); font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 24px; cursor: pointer; padding: 0 2px; line-height: 1;
  border-radius: var(--r-sm); transition: color 0.12s;
}
.modal-close:hover { color: var(--text); }
.modal-body { overflow-y: auto; padding: 20px; flex: 1; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0; background: var(--bg);
}

/* ── 학교 목록 행 ── */
.no-presets {
  text-align: center; color: var(--text-3); font-size: var(--fs-sm);
  padding: 20px 0; line-height: 1.9;
}
.no-presets strong { color: var(--text-2); }
.no-presets small { color: var(--danger); font-size: var(--fs-xs); }
.preset-list-item {
  display: flex; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 8px; gap: 10px;
  transition: background 0.1s, border-color 0.1s;
}
.preset-list-item:hover { background: var(--bg); border-color: var(--border-strong); }
.preset-school-name { flex: 1; font-weight: 600; font-size: var(--fs-md); letter-spacing: -0.2px; }
.preset-school-meta { font-size: var(--fs-xs); color: var(--text-2); }
.btn-load {
  height: 32px; padding: 0 14px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.btn-load:hover { background: var(--accent-hover); }
.btn-sm {
  height: 32px; padding: 0 11px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--fs-xs); color: var(--text-2);
  cursor: pointer; white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.btn-sm:hover { background: var(--surface-2); color: var(--text); }
.btn-sm.danger { border-color: #f0c2c2; color: var(--danger); }
.btn-sm.danger:hover { background: var(--danger-soft); }

.share-notice {
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  border-radius: var(--r-lg); padding: 13px 15px;
  font-size: var(--fs-xs); color: var(--warn-text); line-height: 1.75;
  margin-bottom: 16px;
}
.share-notice strong { color: #6b3f0a; font-weight: 700; }
#share-result-title { font-weight: 700; font-size: var(--fs-sm); }

.save-section { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 18px; }
.save-section h4 { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 10px; font-weight: 600; }
.save-row { display: flex; gap: 8px; }
.save-row input { flex: 1; }
.btn-green {
  height: 36px; padding: 0 16px; background: var(--success); color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.btn-green:hover { background: var(--success-hover); }
.btn-blue {
  height: 40px; padding: 0 22px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-md);
  font-weight: 600; cursor: pointer; transition: background 0.12s;
}
.btn-blue:hover { background: var(--accent-hover); }
.btn-cancel {
  height: 40px; padding: 0 18px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--fs-md); color: var(--text-2); cursor: pointer; transition: background 0.12s;
}
.btn-cancel:hover { background: var(--surface-2); color: var(--text); }

/* 인라인 스타일을 대체하는 유틸 */
.btn-block { width: 100%; }
.btn-block-lg { width: 100%; height: 46px; font-size: var(--fs-md); }
.section-title { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.row-gap-8 { display: flex; gap: 8px; }
.row-gap-8 > button { flex: 1; height: 38px; }
.count-hint { font-weight: 400; color: var(--text-3); font-size: var(--fs-xs); }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.pin-input {
  text-align: center; letter-spacing: 8px;
  font-size: var(--fs-xl); height: 48px;
}

/* ════ 학교 편집 모달 ════ */
.editor-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .editor-two-col { grid-template-columns: 1fr; } }

.editor-section { margin-bottom: 18px; }
.editor-section h4 {
  font-size: var(--fs-xs); color: var(--text-2);
  margin-bottom: 9px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.school-name-input { width: 100%; height: 42px; font-size: var(--fs-md); }

/* 좌석 행 편집 */
#editor-row-list {
  border: 1px solid var(--border); border-radius: var(--r-md);
  max-height: 230px; overflow-y: auto; padding: 6px;
  margin-bottom: 8px;
}
#editor-row-list-empty { text-align: center; color: var(--text-3); font-size: var(--fs-xs); padding: 14px 0; }
.row-edit-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 5px; border-radius: var(--r-sm);
}
.row-edit-item:hover { background: var(--bg); }
.rei-name-input  { width: 50px; height: 30px; padding: 0 6px; text-align: center; font-weight: 600; }
.rei-count-input { width: 56px; height: 30px; padding: 0 6px; text-align: center; }
.rei-label { font-size: var(--fs-xs); color: var(--text-2); flex: 1; }
.btn-del-row {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: var(--fs-lg); padding: 0 3px; line-height: 1;
}
.btn-del-row:hover { color: var(--danger); }

.add-row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.arf-name  { width: 56px; height: 34px; text-align: center; }
.arf-count { width: 76px; height: 34px; }
.btn-add-row {
  height: 34px; padding: 0 12px; background: var(--text-2); color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.btn-add-row:hover { background: var(--text); }
.btn-link {
  background: none; border: none; color: var(--accent);
  font-size: var(--fs-xs); cursor: pointer; text-decoration: underline;
  font-family: inherit; padding: 0; margin-left: auto; font-weight: 500;
}
.btn-link:hover { color: var(--accent-hover); }

/* 학반 편집 — 라벨을 위로 올려 입력칸 폭을 확보한다 */
.batch-row, .indiv-row { display: flex; gap: 8px; align-items: flex-end; }
.batch-row .form-group, .indiv-row .form-group { flex: 1 1 0; min-width: 0; }
.batch-row .form-group.grade, .indiv-row .form-group.grade { flex: 0 0 88px; }
.batch-row select, .batch-row input,
.indiv-row select, .indiv-row input { width: 100%; }
.btn-batch, .btn-indiv {
  flex: 0 0 auto; height: 36px;
  padding: 0 14px; color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.btn-batch { background: var(--text-2); }
.btn-batch:hover { background: var(--text); }
.btn-indiv { background: var(--accent); }
.btn-indiv:hover { background: var(--accent-hover); }

.editor-divider { height: 1px; background: var(--border); margin: 16px 0; }

#editor-class-list {
  max-height: 210px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px;
}
#editor-class-list-empty { text-align: center; color: var(--text-3); font-size: var(--fs-xs); padding: 14px 0; }
.editor-class-row {
  display: flex; align-items: center;
  padding: 4px 6px; border-radius: var(--r-sm); gap: 8px; font-size: var(--fs-sm);
}
.editor-class-row:hover { background: var(--bg); }
.editor-class-row.editing { background: var(--accent-soft); }
.ecr-name { flex: 1; color: var(--text); font-weight: 500; }
.ecr-count { font-size: var(--fs-xs); color: var(--text-2); }
.editor-class-row .edit-count-input { width: 66px; height: 30px; }
.btn-edit-ecr, .btn-del-ecr {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: var(--fs-md); padding: 0 3px; line-height: 1;
}
.btn-edit-ecr:hover { color: var(--accent); }
.btn-del-ecr { font-size: var(--fs-lg); }
.btn-del-ecr:hover { color: var(--danger); }

.editor-summary {
  font-size: var(--fs-xs); color: var(--text-2); padding: 7px 10px;
  background: var(--bg); border-radius: var(--r-sm); margin-top: 8px;
}

/* ════════════════════════════════════
   공유 · 저장
   ════════════════════════════════════ */
.share-field { margin-bottom: 16px; }
.share-field label {
  display: block; font-size: var(--fs-sm); color: var(--text);
  font-weight: 600; margin-bottom: 6px;
}
.share-field input { width: 100%; height: 40px; font-size: var(--fs-md); }
.share-hint { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.75; margin-top: 7px; }
.share-hint strong { color: var(--text); font-weight: 600; }

.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; background: var(--bg); color: var(--text);
  font-size: var(--fs-sm); font-family: var(--font-mono);
}
.link-row button { white-space: nowrap; }

/* ════════════════════════════════════
   보기 전용 모드
   ════════════════════════════════════ */
#viewer-bar { display: none; }

body.view-mode #left-panel { display: none; }
body.view-mode #viewer-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  width: 100%; max-width: 1000px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 16px 20px; margin-bottom: 22px;
  box-shadow: var(--sh-1);
}
#viewer-school { font-size: var(--fs-xl); font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
#viewer-title  { font-size: var(--fs-sm); color: var(--text-2); margin-top: 3px; }
#viewer-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.viewer-btn {
  height: 38px; padding: 0 14px; font-size: var(--fs-xs); font-weight: 500;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--r-md); cursor: pointer;
  transition: background 0.12s;
}
.viewer-btn:hover { background: var(--surface-2); }
.viewer-btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600;
}
.viewer-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

body.view-mode #right-panel { padding-top: 20px; }

/* ════════════════════════════════════
   좁은 화면 (선생님들이 폰으로 열어보는 경우)
   ════════════════════════════════════ */
@media (max-width: 720px) {
  body.view-mode #right-panel { padding: 14px 12px; }
  /* 좌석 크기는 fitSeatSize() 의 하한(16px)이 잡아 주고, 넘치면 가로로 스크롤한다 */
  body.view-mode #seat-map { min-width: max-content; }
  body.view-mode #viewer-bar { padding: 14px; }
}

/* ════════════════════════════════════
   학교 선택 — 검색 · 즐겨찾기 · 학교 목록
   ════════════════════════════════════ */
.picker-section {
  display: flex; align-items: baseline; gap: 8px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-2);
  margin: 20px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.picker-section:first-child { margin-top: 4px; }
.picker-section-hint { font-weight: 400; color: var(--text-3); }

.btn-star {
  background: none; border: none; cursor: pointer;
  font-size: var(--fs-xl); line-height: 1; color: var(--border-strong);
  padding: 0 2px; flex-shrink: 0; width: 24px; text-align: center;
  transition: color 0.12s, transform 0.12s;
}
.btn-star:hover { color: #f0a500; transform: scale(1.15); }
.btn-star.on { color: #f5b301; }
.btn-star.placeholder { cursor: default; font-size: var(--fs-md); opacity: 0.5; }
.btn-star.placeholder:hover { color: var(--border-strong); transform: none; }

.search-row { position: relative; margin-bottom: 14px; }
.search-row .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: var(--fs-sm); opacity: 0.5; pointer-events: none;
}
#school-search { width: 100%; height: 42px; padding: 0 14px 0 36px; font-size: var(--fs-md); }

.catalog-item .catalog-main { flex: 1; min-width: 0; }
.catalog-item .preset-school-name { flex: none; }
.catalog-item .preset-school-meta { margin-top: 3px; }
.mine-badge {
  font-size: var(--fs-xs); color: var(--accent); font-weight: 600;
  background: var(--accent-soft); border: 1px solid #d6e2fd;
  border-radius: var(--r-pill); padding: 3px 9px; white-space: nowrap;
}

/* 학교 목록 등록 (학교 등록 모달) — 선택이 아니므로 무엇이 올라가는지 함께 밝힌다 */
.publish-section { padding-top: 2px; }
.publish-title { font-size: var(--fs-md); font-weight: 700; color: var(--text); margin-bottom: 6px; }
.publish-why { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.7; margin: 0; }
.publish-why strong { color: var(--text); font-weight: 600; }
.publish-fields {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.publish-fields .form-group { flex: 1 1 190px; }
.publish-fields input { width: 100%; }
.publish-fields .share-hint { flex: 1 1 100%; margin-top: 0; }

/* 올라가는 것 / 올라가지 않는 것 — 나란히 놓아야 읽힌다 */
.publish-what {
  margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px;
  font-size: var(--fs-xs); line-height: 1.6;
}
.publish-what > div { display: flex; gap: 10px; align-items: baseline; }
.publish-what dt {
  flex: 0 0 auto; min-width: 104px; font-weight: 700;
  border-radius: var(--r-sm); padding: 2px 8px; text-align: center;
}
.publish-what dt.up    { background: var(--accent-soft); color: var(--accent); }
.publish-what dt.never { background: var(--surface-3);   color: var(--text-2); }
.publish-what dd { margin: 0; color: var(--text-2); }

/* 등록 실패 — 모달을 닫지 않고 여기에 적는다 */
.editor-error {
  margin-top: 16px; padding: 12px 14px;
  background: var(--danger-soft); border: 1px solid #fecaca;
  border-radius: var(--r-md);
  font-size: var(--fs-sm); color: var(--danger); line-height: 1.7;
  white-space: pre-line; font-weight: 500;
}

/* 학교명 자동완성 (등록 모달) */
.name-suggest { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.suggest-exact {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  font-size: var(--fs-sm); color: var(--warn-text); line-height: 1.6;
}
.suggest-exact > div { flex: 1 1 220px; }
.suggest-head { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; margin-top: 2px; }
.suggest-row {
  text-align: left; width: 100%;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-2);
  font-family: inherit; font-size: var(--fs-sm); cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.suggest-row:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* 키보드로 고른 행 (↑↓) */
.picker-active {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  box-shadow: var(--ring);
}
/* 검색어와 겹치는 글자 */
.preset-school-name mark {
  background: #fde68a; color: var(--text);
  border-radius: 3px; padding: 0 1px; font-weight: 700;
}

/* 예전 방식으로 이 브라우저에만 남은 학교 — 일회성 회수 안내 */
.legacy-banner {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; margin-bottom: 4px;
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  border-radius: var(--r-lg);
  font-size: var(--fs-xs); color: var(--warn-text); line-height: 1.7;
}
.legacy-banner strong { font-weight: 700; }
.legacy-btns { display: flex; gap: 8px; }

.save-section-hint {
  font-size: var(--fs-xs); color: var(--text-3);
  line-height: 1.7; margin: -4px 0 10px;
}

/* 내 배치도 */
.board-item .catalog-main { flex: 1; min-width: 0; }
.board-item .preset-school-name { flex: none; }
.board-item .preset-school-meta { margin-top: 3px; }

/* 푸터 — 좌측 패널은 보기 모드에서 숨겨지므로 우측 패널에 둔다 */
#app-footer {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
  /*
    sticky 로 바닥에 붙인다. margin-top:auto 만 두면 18행 강당에서
    좌석맵이 화면을 다 채워 스크롤해야 문의 버튼이 나왔다.
    #right-panel 이 스크롤 컨테이너이므로 여기 기준으로 붙는다.
  */
  margin-top: auto;
  position: sticky; bottom: 0;
  padding: 12px 8px; width: 100%; max-width: 900px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: var(--fs-xs); color: var(--text-2);
}
/*
  문의 버튼은 두 곳에 있고 무게가 다르다.
   · 좌측 헤더 — 크레딧에 딸린 작은 버튼이라 조용해도 된다 (테두리 pill)
   · 우측 푸터 — 옆 안내문과 무게가 갈라져야 버튼으로 읽힌다 (파란 채움)
*/
.contact-btn {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); padding: 5px 12px;
  color: var(--text); font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  white-space: nowrap; line-height: 1.4;
  box-shadow: var(--sh-1);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.contact-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

#contact-link {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-size: var(--fs-sm); padding: 8px 18px;
  box-shadow: var(--sh-2);
}
#contact-link:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.suggest-mine {
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--accent-soft); border: 1px solid #d6e2fd;
  font-size: var(--fs-sm); color: var(--accent); line-height: 1.6; font-weight: 500;
}

/* ════════════════════════════════════
   대화상자 · 토스트 (브라우저 기본 alert/confirm 대신)
   ════════════════════════════════════ */
/* 다른 모달(z-index 200) 위에서 떠야 한다 — 삭제 확인은 목록 모달에서 나온다 */
#dialog-modal { z-index: 300; }
#dialog-modal .modal-header { border-bottom: none; padding: 20px 22px 6px; font-size: var(--fs-lg); }
#dialog-modal .modal-body   { padding: 6px 22px 18px; }
#dialog-modal .modal-footer { background: transparent; border-top: none; padding: 6px 18px 18px; }
.dialog-message {
  /* \n 이 그대로 줄바꿈이 된다 — 여러 줄 안내가 알림창처럼 읽혀야 한다 */
  white-space: pre-line;
  font-size: var(--fs-sm); line-height: 1.75; color: var(--text-2);
}
.btn-danger-solid {
  height: 40px; padding: 0 22px; background: var(--danger); color: #fff;
  border: none; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.btn-danger-solid:hover { background: #b91c1c; }
/* 확인 버튼이 <a> 인 경우(새 창) 도 같은 모양이어야 한다 */
#dialog-footer a.btn-blue {
  display: inline-flex; align-items: center;
  text-decoration: none;
}

#toast-host {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  max-width: min(92vw, 460px);
  padding: 11px 18px; border-radius: var(--r-pill);
  background: var(--text); color: #fff;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.5;
  box-shadow: var(--sh-3);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
}
.toast.in  { opacity: 1; transform: translateY(0); }
.toast.ok  { background: var(--success); }
.toast.err { background: var(--danger); }

/* 클립보드가 막힌 환경의 대비책 (내 배치도) */
.fallback-link { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.fallback-link input { flex: 1; font-size: var(--fs-xs); }
.fallback-link span  { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.board-item { flex-wrap: wrap; }
