/* ===== Admin v2: Top Bar Layout ===== */
.admin-v2 {
  min-height: 100dvh;
  background: var(--surface-container);
}
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(248, 249, 251, 0.85);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}
.admin-topbar .admin-brand { justify-self: start; }
.admin-topbar .admin-theme { justify-self: center; }
.admin-topbar .admin-actions { justify-self: end; }
html[data-theme="dark"] .admin-topbar {
  background: rgba(21, 23, 26, 0.85);
}
.admin-brand {
  font-family: var(--font-headline);
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  flex-shrink: 0;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 18px 16px 6px;
  background: transparent;
}
.admin-tabs a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-family: var(--font-headline);
  font-size: .9rem;
  transition: background .15s, color .15s;
}
.admin-tabs a:hover { background: var(--surface-container); color: var(--text); }
.admin-tabs a.active {
  background: var(--bubble-me);
  color: var(--bubble-me-text);
  box-shadow: var(--shadow-ambient);
}
.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.admin-actions .home-btn { font-size: .82rem; padding: 8px 14px; }
.admin-actions .logout-btn { font-size: .82rem; padding: 8px 14px; }

.admin-content {
  padding: 32px clamp(16px, 4vw, 40px);
  max-width: 1000px;
  margin: 0 auto;
  min-width: 0;
}
.admin-content h1 {
  font-family: var(--font-headline);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 6px;
}
.admin-content h2 {
  font-family: var(--font-headline);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 28px 0 12px;
}

/* ===== Forms ===== */
.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0;
}
.inline-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.inline-form input,
.inline-form select {
  min-height: 44px;
  padding: 10px 16px;
  background: var(--surface-lowest);
  border: 0;
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: .92rem;
}
.inline-form input:focus,
.inline-form select:focus {
  outline: 0;
  box-shadow: 0 0 0 2px rgba(105, 95, 0, 0.2);
}

/* ===== Settings Form ===== */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
}
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.settings-form input:disabled { opacity: .6; }
.settings-form .btn-primary { align-self: flex-start; margin-top: 6px; }

/* ===== Data Table ===== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  background: var(--surface-lowest);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-ambient);
}
.data-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-low);
}
.data-table td {
  padding: 14px 18px;
  font-size: .92rem;
  color: var(--text);
}
.data-table tr:not(:last-child) td { box-shadow: inset 0 -1px 0 var(--border-ghost); }
.data-table button {
  background: var(--surface-low);
  border: 0;
  color: var(--danger);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: .82rem;
}
.data-table button:hover { background: var(--surface-container); }
.data-table a { color: var(--primary); font-weight: 600; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0;
}
.filters input, .filters select {
  min-height: 44px;
  padding: 10px 16px;
  background: var(--surface-lowest);
  border: 0;
  border-radius: var(--radius-full);
  color: var(--text);
}

/* ===== XLSX Import Card ===== */
.xlsx-import {
  background: var(--surface-lowest);
  padding: 22px;
  border-radius: var(--radius-xl);
  margin: 16px 0 28px;
  box-shadow: var(--shadow-ambient);
}
.xlsx-import h2 { margin: 0 0 6px; font-size: 1.1rem; }
.xlsx-import .hint {
  color: var(--text-dim);
  font-size: .85rem;
  margin: 6px 0 14px;
  line-height: 1.5;
}
.xlsx-import code {
  background: var(--surface-low);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: .85em;
  font-family: "SFMono-Regular", "Consolas", monospace;
}
.xlsx-drop {
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  background: var(--surface-low);
  transition: background .15s, box-shadow .15s;
  margin: 12px 0;
  outline: 2px dashed transparent;
  outline-offset: -4px;
}
.xlsx-drop p { margin: 0; color: var(--text-muted); }
.xlsx-drop.dragover {
  background: rgba(255, 235, 51, 0.15);
  outline-color: var(--primary);
}
.xlsx-drop button { margin-left: 8px; }

details {
  background: var(--surface-lowest);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin: 12px 0;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 4px 0;
}
details textarea {
  width: 100%;
  margin: 12px 0;
  background: var(--surface-low);
  border: 0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: inherit;
  color: var(--text);
}

.student-count {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 20px 4px 8px;
  font-family: var(--font-headline);
}
.home-btn {
  text-align: center;
  text-decoration: none;
  display: inline-block;
  background: var(--bubble-me);
  color: var(--bubble-me-text);
  font-weight: 700;
}
.home-btn:hover { filter: brightness(1.05); }
.logout-btn { font-weight: 700; }

@media (max-width: 860px) {
  .admin-topbar { padding: 10px 14px; gap: 10px; }
  .admin-brand h1 { font-size: 1rem; }
  .admin-tabs { gap: 4px; }
  .admin-tabs a { padding: 8px 14px; font-size: .82rem; }
  .admin-actions .home-btn { display: none; }
  .admin-content { padding: 20px 14px; }
  .admin-content h1 { font-size: clamp(1.3rem, 5vw, 1.7rem); }
  .data-table { font-size: .85rem; }
  .data-table th, .data-table td { padding: 12px 14px; }
}

@media (max-width: 520px) {
  .admin-topbar { justify-content: space-between; }
  .admin-brand h1 { display: none; }
  .admin-tabs { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; padding-top: 4px; flex-wrap: nowrap; }
  .admin-tabs a { flex-shrink: 0; }
  .admin-actions .logout-btn { font-size: .78rem; padding: 6px 12px; }
  .inline-form input, .inline-form select, .filters input, .filters select { flex: 1 1 100%; min-width: 0; }
  .inline-form label { flex: 1 1 100%; }
  .xlsx-import { padding: 16px; }
  .xlsx-drop { padding: 24px 12px; }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: 10px 12px; }
}

.data-table button.btn-edit {
  color: var(--primary);
  margin-right: 6px;
}

.admin-dialog {
  border: 0;
  border-radius: var(--radius-xl);
  padding: 24px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow-ambient);
  max-width: 460px;
  width: calc(100% - 32px);
  color: var(--text);
}
.admin-dialog::backdrop { background: rgba(0,0,0,.4); backdrop-filter: blur(4px); }
.admin-dialog h2 { margin: 0 0 16px; font-size: 1.1rem; font-family: var(--font-headline); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.admin-name { color: var(--primary); text-decoration: none; font-weight: 700; cursor: pointer; }
.admin-name:hover { text-decoration: underline; }

.qr-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.qr-modal .qr-box { background: #fff; border-radius: 12px; padding: 24px; text-align: center; min-width: 300px; }
.qr-modal .qr-box h3 { margin: 0 0 12px; }
.qr-modal .qr-box img { width: 260px; height: 260px; display: block; margin: 0 auto; }
.qr-modal .qr-url { font-size: 0.85rem; word-break: break-all; margin: 12px 0; }
.qr-modal .qr-url a { color: var(--primary); }
.qr-modal .qr-close { margin-top: 8px; }
.cohort-hint { background: #fff7b2; padding: 8px 12px; border-radius: 8px; font-weight: 600; color: #201c00; }

/* 차수 리스트 — 업데이트 시각 / 입장 모달 */
.cohort-updated { font-size: .8rem; color: var(--text-dim, #888); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cohort-range { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-dim, #888); }
/* 차수 목록은 무슨 일이 있어도 셀당 1줄 — 줄바꿈 금지(차수명 포함). 폭이 모자라면 가로 스크롤. */
#cohort-table td, #cohort-table th { white-space: nowrap; }
/* 버튼이 많은 '바로가기'·'관리' 칸을 위해 차수표 버튼은 더 조밀하게 */
#cohort-table button { padding: 6px 10px; font-size: .78rem; }
.enter-modal-ov {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.enter-modal {
  width: 100%; max-width: 340px;
  background: #fff; border-radius: 16px; padding: 22px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.enter-modal h3 { margin: 0 0 14px; font-size: 1.05rem; font-weight: 800; }
.enter-modal input {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  padding: 12px 14px; border: 1px solid #ddd; border-radius: 10px;
  font-size: .95rem; outline: none;
}
.enter-modal input:focus { border-color: var(--primary, #1c6dd0); }
.enter-modal .enter-err { color: #ef4444; font-size: .82rem; min-height: 1em; margin: 0 0 10px; }
.enter-modal-btns { display: flex; gap: 8px; }
.enter-modal-btns button {
  flex: 1; padding: 12px; border: 0; border-radius: 10px;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  background: #eee; color: #333;
}
.enter-modal-btns button.primary { background: #ffeb33; color: #201c00; }
