* { box-sizing: border-box; }

/* 해외/국내/전체 중 '해외'(가장 중요) 강조 */
.hl-overseas { font-weight: 800; color: #1d4ed8; }

/* 구역 색상 표식 (config :color) */
.color-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
  flex: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.12) inset;
}

:root {
  --line: #cbd2d9;
  --line-strong: #94a3b8;
  --pre-bg: #f8fafc;
  --session-bg: #f1f5f9;
  --accent: #2563eb;
  --error: #dc2626;
}

body {
  margin: 0;
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #1e293b;
  background: #eef2f6;
}

/* ===== 상단 바 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #1e293b;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand .title { font-weight: 800; font-size: 17px; white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  color: #cbd5e1;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs a.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 700; }

.auth { display: flex; align-items: center; gap: 10px; }
.auth .username { font-size: 14px; color: #e2e8f0; white-space: nowrap; }
.auth button {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.auth .login-btn { background: var(--accent); border-color: var(--accent); }

.page { padding: 16px; }

.board {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  padding: 20px;
}

/* ===== 메인 계수 페이지 ===== */
.count-page { max-width: 900px; margin: 0 auto; }
.count-page h1 { font-size: 20px; text-align: center; margin: 4px 0 16px; }
.zone-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.zone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 96px;
  padding: 14px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  text-align: center;
}
.zone-card-name { font-weight: 700; font-size: 16px; }
.zone-card-region { font-size: 13px; color: #64748b; }
.count-page .today { text-align: center; color: #334155; font-weight: 700; margin-bottom: 14px; }
.zone-card.clickable { cursor: pointer; transition: transform .05s, box-shadow .1s; }
.zone-card.clickable:hover { box-shadow: 0 3px 10px rgba(0,0,0,.14); }
.zone-card.clickable:active { transform: scale(.97); }

/* ===== 계수 입력 페이지 (모바일 우선) ===== */
.count-input { max-width: 520px; margin: 0 auto; }
.ci-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ci-top .back {
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 15px;
}
.ci-top .today { font-size: 13px; color: #64748b; font-weight: 700; }
.ci-zone {
  display: flex; align-items: center; font-size: 20px; font-weight: 800;
  padding: 12px 4px; margin-bottom: 8px;
}
.ci-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.ci-tabs button {
  flex: 1; padding: 14px 8px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; color: #334155;
}
.ci-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ci-tabs button:disabled, .ci-tabs button.disabled {
  background: #eef1f4; color: #b6bfca; border-color: var(--line); cursor: not-allowed;
}
.ci-form { display: flex; flex-direction: column; }
.ci-form label { font-size: 14px; font-weight: 700; color: #475569; margin: 12px 0 6px; }
.ci-form input {
  font-size: 18px; padding: 14px; border: 2px solid var(--line-strong); border-radius: 10px;
}
.ci-form .submit {
  margin-top: 24px; padding: 16px; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; cursor: pointer;
}
.ci-form .submit:active { filter: brightness(.94); }

.log-badge.count { background: #7c3aed; }
.log-badge.reset { background: #dc2626; }
.log-badge.config { background: #0891b2; }

/* 색상 편집기 */
.color-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type="color"] {
  width: 46px; height: 34px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; cursor: pointer; flex: none;
}
.color-row .cr-name { font-size: 15px; }
.save-colors { padding: 12px 18px; border-radius: 10px; border: none; font-size: 16px; font-weight: 800; cursor: pointer; }
.save-colors:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ===== 수퍼 관리자 설정 페이지 ===== */
.settings { max-width: 640px; margin: 0 auto; }
.settings h1 { font-size: 20px; text-align: center; margin: 4px 0 20px; }
.setting-block {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px;
}
.setting-block h2 { font-size: 16px; margin: 0 0 8px; }
.super-tag { font-size: 11px; font-weight: 700; color: #b45309; background: #fef3c7; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }

/* ===== 관리자 통계 페이지 ===== */
.stats { max-width: 720px; margin: 0 auto; }
.stats h1 { font-size: 20px; text-align: center; margin: 4px 0 8px; }
.stats .desc { text-align: center; color: #64748b; font-size: 14px; margin: 0 0 16px; }
.stats-scroll { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; min-width: 420px; }
.stats-table th, .stats-table td {
  border: 1px solid var(--line); padding: 12px 10px; text-align: center;
  font-size: 16px; font-variant-numeric: tabular-nums;
}
.stats-table thead th { background: #f1f5f9; font-weight: 700; }
.stats-table th.corner { background: #f8fafc; }
.stats-table th.rowlabel { text-align: left; background: #f8fafc; font-weight: 700; white-space: nowrap; }
.stats-table td.overseas { font-weight: 800; color: #1d4ed8; }   /* 해외 강조 */
.stats-table td.na { color: #b6bfca; background: #eef1f4; font-weight: 700; }
.stats-table tr.sum td, .stats-table tr.sum th { background: #eff6ff; font-weight: 800; }
.setting-block .desc { font-size: 14px; color: #64748b; margin: 0 0 12px; line-height: 1.5; }
.setting-block.danger { border-color: #fecaca; background: #fef2f2; }
.setting-block.danger h2 { color: #b91c1c; }
.danger-btn {
  padding: 12px 18px; border-radius: 10px; border: none;
  background: #dc2626; color: #fff; font-size: 16px; font-weight: 800; cursor: pointer;
}
.danger-btn:disabled { background: #f3b4b4; cursor: not-allowed; }
/* 팝업 안에서 .popup-actions button 규칙(특이성)에 지지 않도록 보강 */
.popup-actions .danger-btn { background: #dc2626; color: #fff; border: none; }
.popup-actions .danger-btn:disabled { background: #f3b4b4; color: #fff; cursor: not-allowed; }
.popup.msg-lg input[type="text"] {
  width: 100%; font-size: 18px; padding: 12px; margin-top: 6px;
  border: 2px solid var(--line-strong); border-radius: 8px;
}

@media (min-width: 700px) {
  .zone-card { min-height: 120px; }
  .zone-card-name { font-size: 18px; }
}

/* ===== 로그인 폼 ===== */
.popup label { display: block; font-size: 13px; color: #475569; margin: 10px 0 4px; }
.popup input[type="text"],
.popup input[type="password"] {
  width: 100%;
  font-size: 16px;
  padding: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
}
.error-msg { color: var(--error); font-size: 14px; margin: 10px 0 0; }

/* ===== 활동 로그 ===== */
.log-list { display: flex; flex-direction: column; }
.log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.log-row:last-child { border-bottom: none; }
.log-time { color: #64748b; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.log-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #64748b;
  white-space: nowrap;
}
.log-badge.adjust { background: var(--accent); }
.log-badge.login  { background: #16a34a; }
.log-badge.logout { background: #94a3b8; }
.log-user { font-weight: 700; white-space: nowrap; }
.log-detail { color: #334155; }
.empty { text-align: center; color: #94a3b8; padding: 30px; }

@media (max-width: 640px) {
  .log-row { flex-wrap: wrap; gap: 6px; }
  .log-detail { flex-basis: 100%; }
}

/* ===== 대회기간 청소 배정판 ===== */
.session-board { max-width: 900px; margin: 0 auto; }
.sb-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sb-top h1 { font-size: 20px; margin: 4px 0; }
.sb-top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sb-top .today { font-weight: 700; color: #334155; }
/* 제목과 구역 목록 사이 여백 */
.sb-zones { margin-top: 20px; }

/* 한 눈에 보기 — 우측 상단 고정 패널 */
.summary-panel {
  position: fixed; top: 60px; right: 12px; z-index: 40;
  width: max-content; max-width: 92vw;   /* 내용 폭에 맞춰 늘어남 (개행 방지) */
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden;
}
.summary-panel.collapsed { width: auto; }
.summary-panel .sp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 14px; cursor: pointer; user-select: none;
}
.summary-panel .sp-body { padding: 8px 10px; max-height: 70vh; overflow: auto; }
.summary-panel .sp-today { font-size: 12px; color: #64748b; margin-bottom: 6px; font-weight: 700; }
.summary-panel .empty { font-size: 12px; color: #94a3b8; padding: 8px 2px; text-align: left; }

.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td {
  border: 1px solid var(--line); padding: 5px 8px; font-size: 12px;
  white-space: nowrap;                    /* 셀 내용 개행 금지 */
}
.summary-table thead th { background: #f8fafc; text-align: center; }
.summary-table thead th .hint { font-size: 10px; color: #94a3b8; font-weight: 400; white-space: nowrap; }
.summary-table td.name { text-align: left; }
.summary-table td.num { text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .summary-panel { top: 54px; right: 8px; }
  .summary-panel .sp-body { max-height: 50vh; }
}

.date-control {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 16px; padding: 10px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
}
.date-control .dc-label { font-size: 13px; color: #92400e; font-weight: 700; margin-right: 4px; }
.date-control button {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; font-size: 14px;
}
.date-control button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.sb-zones { display: flex; flex-direction: column; gap: 14px; }
.sb-zone {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.sb-zone-head {
  padding: 10px 12px; font-weight: 800; font-size: 15px;
  background: #f1f5f9; border-bottom: 1px solid var(--line);
}
.sb-table { width: 100%; border-collapse: collapse; }
.sb-table th, .sb-table td {
  border: 1px solid var(--line); padding: 8px 6px; text-align: center; font-size: 14px;
}
.sb-table thead th { background: #f8fafc; font-weight: 700; }
.sb-table th.rowlabel {
  text-align: left; background: #f8fafc; font-weight: 600; white-space: nowrap; width: 34%;
}
.sb-table th.rowlabel .hint { display: block; font-size: 11px; color: #94a3b8; font-weight: 400; }

/* 비활성(미래) 컬럼 */
.sb-table .col-off { background: #eef1f4; color: #b6bfca; }
/* 오늘 컬럼 강조 */
.sb-table .col-today { background: #eff6ff; }
.sb-table thead th.col-today { background: #dbeafe; }

/* 당일 배정 셀 */
.sb-table td.sb-day {
  font-weight: 800; font-size: 16px; cursor: pointer; background: #fff;
}
.sb-table td.sb-day.col-today { background: #eff6ff; }
.sb-table td.sb-day:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.sb-table td.sb-day.disabled {
  cursor: not-allowed; background: #eef1f4; color: #b6bfca;
}
.sb-table td.sb-day.disabled:hover { outline: none; }

h1 {
  text-align: center;
  font-size: 22px;
  margin: 4px 0 16px;
}

.total-row {
  text-align: right;
  margin-bottom: 16px;
  font-weight: 600;
}
.total-row input {
  width: 90px;
  font-size: 18px;
  text-align: right;
  padding: 6px 8px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
}

/* 두 컬럼(사전 | 회기중) 레이아웃 */
.header-cols,
.group-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.phase-head {
  text-align: center;
  font-weight: 700;
  padding: 10px;
  background: var(--session-bg);
  border: 1px solid var(--line);
}
.side.pre.phase-head  { background: var(--pre-bg); }

.group-block {
  border-bottom: 2px solid var(--line-strong);
}
.group-block:last-of-type { border-bottom: none; }

.side.pre     { background: var(--pre-bg); border-right: 2px solid var(--line-strong); }
.side.session { background: var(--session-bg); }

.row {
  display: grid;
  grid-template-columns: 1fr 72px 64px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row.subhead {
  font-weight: 700;
  font-size: 13px;
  color: #475569;
  background: rgba(0,0,0,.02);
}

.cell.name     { font-size: 14px; }
.cell.proposed { text-align: center; color: #475569; font-size: 14px; }

.cell.assigned {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  padding: 6px 0;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.cell.assigned:hover { border-color: var(--accent); }
.subhead .cell.assigned {
  border: none; background: none; font-weight: 700; font-size: 13px; cursor: default;
}
.cell.assigned.error {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error) inset;
}

.footer { text-align: center; margin-top: 18px; }
.footer button {
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

/* 입력 팝업 */
.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.popup {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 260px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.popup h3 { margin: 0 0 4px; }
.popup p { margin: 0 0 10px; color: #64748b; font-size: 14px; }

/* 계수 확인/안내 팝업 — 문구를 크고 또렷하게 */
.popup.msg-lg { min-width: 300px; max-width: 92vw; }
.popup.msg-lg p { font-size: 18px; line-height: 1.65; color: #1e293b; font-weight: 500; }
.popup.msg-lg .popup-actions button { font-size: 17px; padding: 13px; }
.popup input {
  width: 100%;
  font-size: 20px;
  text-align: center;
  padding: 8px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
}
.popup-actions {
  display: flex; gap: 8px; margin-top: 14px;
}
.popup-actions button {
  flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; font-size: 15px;
}
.popup-actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 640px) {
  .cell.name { font-size: 13px; }
  .row { grid-template-columns: 1fr 60px 56px; padding: 8px 6px; }
}
