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

html { font-size: 20px; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --card-bg: #1a2a3a;
  --border: #2a2d3a;
  --primary: #6366f1;
  --primary-hover: #4f52d4;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --text: #e2e8f0;
  --muted: #64748b;
}

html.light-mode {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --card-bg: #ffffff;
  --border: #cbd5e1;
  --primary: #4f52d4;
  --primary-hover: #3730a3;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --text: #1e293b;
  --muted: #64748b;
}

html.light-mode body {
  background: var(--bg);
  color: var(--text);
}

/* ── 라이트 모드 보정 ─────────────────────────────────────── */

/* 기본 */
html.light-mode .navbar { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
html.light-mode input,
html.light-mode textarea,
html.light-mode select  { color-scheme: light; }
html.light-mode .muted-text,
html.light-mode .muted-num { color: var(--muted); }

/* 흰 글자 → 어두운 글자 (흰 배경에서 안 보이는 것들) */
html.light-mode .num-bold      { color: var(--text); }
html.light-mode .dist-item-name { color: var(--text); }

/* 옅은 노랑 계열 텍스트 */
html.light-mode .notice-list             { color: #92400e; }
html.light-mode .score-table td:last-child { color: #6d28d9; }
html.light-mode .tip                     { color: #92400e; }

/* 테이블 헤더 다크 배경 → 라이트 배경 */
html.light-mode .member-table th { background: #e2e8f0; color: #475569; }
html.light-mode .section-label   { background: #e2e8f0; color: var(--text); }
html.light-mode .score-title     { background: #e2e8f0; color: var(--text); }

/* 테이블 행 구분선/hover (흰 배경 전제 투명색 → 다크 기반으로 전환) */
html.light-mode .member-table td         { border-bottom: 1px solid var(--border); }
html.light-mode .member-table tr:hover td { background: rgba(0,0,0,.03); }
html.light-mode tr:hover td              { background: rgba(0,0,0,.02); }
html.light-mode .edit-label-group        { background: rgba(0,0,0,.02); }

/* 배지 */
html.light-mode .badge-pending  { background: rgba(245,158,11,.15); color: #92400e; }
html.light-mode .badge-approved { background: rgba(16,185,129,.15); color: #065f46; }

/* 알림/토스트 */
html.light-mode .alert-error    { background: rgba(220,38,38,.08);  border-color: rgba(220,38,38,.25); color: #991b1b; }
html.light-mode .alert-success  { background: rgba(5,150,105,.08);  border-color: rgba(5,150,105,.25); color: #065f46; }
html.light-mode .toast-success  { background: rgba(5,150,105,.1);   border-color: rgba(5,150,105,.3);  color: #065f46; }

/* 점수표 태그/버튼 */
html.light-mode .score-tag      { background: rgba(5,150,105,.12);  color: #065f46; }
html.light-mode .score-tag-red  { background: rgba(220,38,38,.12);  color: #991b1b; }
html.light-mode .score-del-btn  { color: #991b1b; }
html.light-mode .score-add-btn  { color: #065f46; border-color: rgba(5,150,105,.4); }
html.light-mode .score-edit-btn { background: rgba(79,82,212,.12); border-color: rgba(79,82,212,.35); color: #4f52d4; }
html.light-mode .score-edit-btn-active { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.35); color: #991b1b; }

/* 배지/버튼 연한 라벤더 계열 */
html.light-mode .guild-badge     { background: rgba(79,82,212,.1); color: #4f52d4; }
html.light-mode .tab-add-btn     { background: rgba(79,82,212,.08); border-color: rgba(79,82,212,.25); color: #4f52d4; }
html.light-mode .section-edit-btn { background: rgba(79,82,212,.1); border-color: rgba(79,82,212,.3); color: #4f52d4; }
html.light-mode .notice-edit-btn  { background: rgba(79,82,212,.1); border-color: rgba(79,82,212,.25); color: #4f52d4; }

/* 강조 텍스트 */
html.light-mode .highlight-text { color: #c2410c; }
html.light-mode .highlight-red  { color: #dc2626; }
html.light-mode .diamond        { color: #2563eb; }
html.light-mode .notes-text     { color: #1d4ed8; }

/* 경매/입찰 배지 (auction 페이지 인라인 스타일 보조) */
html.light-mode .cat-legend  { background: rgba(180,130,0,.12);  color: #92400e; }
html.light-mode .cat-aquirun { background: rgba(126,58,180,.12); color: #6d28d9; }
html.light-mode .cat-etc     { background: rgba(80,80,80,.12);   color: #475569; }
html.light-mode .winner-name { color: #92400e; }
html.light-mode .winner-badge { background: rgba(180,130,0,.12); color: #92400e; }
html.light-mode .select-winner-btn:hover,
html.light-mode .select-winner-btn.is-winner { border-color: #92400e; color: #92400e; }

/* parse 결과 박스 */
html.light-mode .parse-ok   { color: #065f46; }
html.light-mode .parse-warn { color: #991b1b; }
html.light-mode .parse-matched-box   { background: rgba(5,150,105,.06);  border-color: rgba(5,150,105,.25); }
html.light-mode .parse-unmatched-box { background: rgba(220,38,38,.06);  border-color: rgba(220,38,38,.25); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── 인증 페이지 ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .6rem;
  margin-bottom: .25rem;
}
.auth-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}
.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0;
}

.auth-card .subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  text-align: center;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.alert-error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

/* ── 메인/어드민 레이아웃 ── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar .brand {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.navbar .brand:hover { color: var(--primary); }
.navbar .brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.navbar .nav-right a {
  color: var(--primary);
  text-decoration: none;
}

.navbar .nav-right a:hover { text-decoration: underline; }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ── 테이블 ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-wrap h2 {
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending  { background: rgba(245,158,11,0.2); color: #fcd34d; }
.badge-approved { background: rgba(16,185,129,0.2); color: #6ee7b7; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1.25rem; text-align: left; font-size: 0.875rem; }
th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.actions { display: flex; gap: 0.5rem; }

.empty-row td { text-align: center; color: var(--muted); padding: 2rem; }

/* ── 운영개요 ── */
.guild-title-bar {
  background: #ca8a04;
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  margin-bottom: 0;
}

.notice-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0 0 8px 8px;
}

.notice-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.notice-list {
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: #fde68a;
  line-height: 1.8;
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.top-section {
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
}

.top-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-left .section-card:last-child {
  flex: 1;
}

.main-content { width: 100%; }

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  overflow: hidden;
  display: flex;
}

.section-label {
  background: #1e293b;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 1rem;
  width: 150px;
  min-width: 150px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid var(--border);
}

.section-body {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.9;
  flex: 1;
}

.section-body p { margin-bottom: 0.25rem; }

.sub-list {
  margin-top: 0.5rem;
  padding-left: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.diamond { color: #60a5fa; }

.num-list {
  padding-left: 1.25rem;
  margin: 0;
}

.tip {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #ca8a04;
}

.muted { color: var(--muted); }
.small { font-size: 0.78rem; }

.dist-row {
  display: flex;
  gap: 1.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.dist-row:last-child { border-bottom: none; }

.dist-item-name {
  font-weight: 600;
  width: 300px;
  min-width: 300px;
  flex-shrink: 0;
  color: #e2e8f0;
  border-right: 1px solid var(--border);
  padding-right: 1rem;
}

.dist-item-desc { color: var(--muted); line-height: 1.8; }

/* ── 점수표 사이드바 ── */
.score-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.score-title {
  background: #1e293b;
  padding: 0.6rem 0.875rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.score-tag {
  background: rgba(16,185,129,0.2);
  color: #6ee7b7;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.highlight-text { color: #f97316; font-size: 0.85rem; }
.highlight-red  { color: #f87171; font-size: 0.85rem; }
.indent { padding-left: 1rem; color: var(--muted); font-size: 0.84rem; }

.score-tag-red {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

.score-table { width: 100%; border-collapse: collapse; }
.score-table td {
  padding: 0.4rem 0.875rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.score-table tr:last-child td { border-bottom: none; }
.score-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: #fde68a;
}

/* ── 토스트 ── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.toast-success {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.4);
  color: #6ee7b7;
}

.toast-hide { opacity: 0; }

.role-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.role-select:focus { border-color: var(--primary); }

/* ── 마이페이지 ── */
.mypage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.mypage-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mypage-info-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.mypage-info-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
}

.mypage-info-label {
  width: 80px;
  flex-shrink: 0;
  color: var(--muted);
}

.mypage-info-value { color: var(--text); }

/* ── 결사원명단 ── */
.member-table-wrap { overflow-x: auto; }

.member-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.8rem;
  white-space: nowrap;
}

.member-table th {
  background: #1e293b;
  color: var(--muted);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  line-height: 1.4;
}

.member-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  text-align: center;
}

.member-table tr:last-child td { border-bottom: none; }
.member-table tr:hover td { background: rgba(255,255,255,0.025); }

.col-no    { width: 44px; }
.col-cp    { width: 100px; text-align: right !important; }
.col-notes { min-width: 180px; white-space: normal; }
.col-legend{ width: 56px; }
.col-date  { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 400; }

.tc { text-align: center !important; }
.num-bold  { font-weight: 700; color: #e2e8f0; }
.muted-num { color: var(--muted); }
.muted-sm  { color: var(--muted); font-size: 0.78rem; }
.notes-text { color: #93c5fd; font-size: 0.78rem; }
.inc-pos   { color: #34d399; font-weight: 600; }
.inc-neg   { color: #f87171; font-weight: 600; }
.legend-myth-pvp { color: #a78bfa; font-weight: 700; }
.legend-myth-pve { color: #f472b6; font-weight: 700; }
.legend-pvp { color: #60a5fa; font-weight: 700; }
.legend-pve { color: #fb923c; font-weight: 700; }

.class-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(148,163,184,0.15);
  color: var(--text);
}

.guild-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
}

/* ── 마이페이지 캐릭터 폼 ── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.profile-legend-row {
  display: flex;
  gap: 2rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.legend-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.mypage-cp-display {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  min-height: 2.25rem;
  display: flex;
  align-items: center;
}

.cp-editable {
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.cp-editable:hover { background: rgba(99,102,241,0.08); }

/* ── 탭 바 ── */
.tab-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0;
}

.tab-scroll {
  display: flex;
  align-items: center;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  padding: 0 1rem;
  gap: 0;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
}
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-scroll.dragging { cursor: grabbing; }

.tab-item {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.tab-item:hover { color: var(--text); }

.tab-active {
  color: var(--primary) !important;
  border-bottom-color: var(--primary);
}

.tab-add-btn {
  flex-shrink: 0;
  margin: 0 0.75rem;
  padding: 0.3rem 0.75rem;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 6px;
  color: #a5b4fc;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab-add-btn:hover { background: rgba(99,102,241,0.2); }

/* ── 일반 페이지 ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sort-btn:hover { background: var(--border); color: var(--text); }
.sort-btn.sort-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.sort-arrow { font-size: 0.7rem; }

.page-content-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  min-height: 200px;
  font-size: 0.875rem;
  line-height: 1.9;
}

.page-empty-msg { color: var(--muted); }

/* ── 탭 관리 (어드민) ── */
.tab-order-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  font-size: 0.7rem;
}

.tab-order-btn:hover:not([disabled]) { color: var(--text); }
.tab-order-btn[disabled] { opacity: 0.3; cursor: default; }

.tab-rename-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  cursor: pointer;
  margin-left: 0.4rem;
}

.tab-title-input {
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 4px;
  color: var(--text);
  padding: 0.2rem 0.5rem;
  font-size: 0.875rem;
  outline: none;
  width: 140px;
}

.tab-toggle { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.8rem; color: var(--muted); }
.tab-toggle input[type=checkbox] { cursor: pointer; }

/* ── 섹션 편집 버튼 ── */
.section-label { flex-direction: column; gap: 0.5rem; }

.title-edit-btn {
  margin-left: 0.75rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.3);
  color: #000;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  cursor: pointer;
  font-weight: 600;
  vertical-align: middle;
}

.notice-edit-btn {
  display: block;
  margin-top: 0.5rem;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.35);
  color: #a5b4fc;
  border-radius: 4px;
  padding: 0.15rem 0.6rem;
  font-size: 0.7rem;
  cursor: pointer;
  font-weight: 600;
}

.edit-label-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.edit-label-text {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.edit-label-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

.edit-label-input:focus { border-color: var(--primary); }

.edit-hint {
  padding: 0.6rem 1.25rem;
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.7;
}

.section-edit-btn {
  background: rgba(99,102,241,0.2);
  border: 1px solid rgba(99,102,241,0.4);
  color: #a5b4fc;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.section-edit-btn:hover { background: rgba(99,102,241,0.35); }

/* ── 섹션 편집 모달 ── */
.section-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.section-edit-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 720px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.section-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.section-edit-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
}

.section-edit-close:hover { color: var(--text); }

.section-edit-textarea {
  flex: 1;
  background: var(--bg);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  resize: none;
  outline: none;
  min-height: 350px;
}

.section-edit-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  justify-content: flex-end;
}

/* ── 점수표 인라인 편집 ── */
.score-edit-btn {
  margin-left: auto;
  background: rgba(99,102,241,0.2);
  border: 1px solid rgba(99,102,241,0.4);
  color: #a5b4fc;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  cursor: pointer;
  font-weight: 600;
}

.score-edit-btn-active {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
}

.score-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  outline: none;
}

.score-input:focus { border-color: var(--primary); }
.score-input-pts  { width: 50px; margin-right: 4px; }
.score-input-note { width: calc(100% - 58px); }

.score-del-btn {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  cursor: pointer;
  font-size: 0.75rem;
}

.score-add-btn {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6ee7b7;
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.75rem;
  width: 100%;
}

/* ── 컨텐츠 참여도 ── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.week-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s;
}
.week-btn:hover { background: var(--border); }
.week-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  min-width: 200px;
  text-align: center;
}
.day-grid-wrap { overflow-x: auto; }
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  min-width: 700px;
}
.day-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.day-cell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.2rem;
}
.day-cell-header.day-weekend { color: #f87171; }
.day-sessions { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.session-card {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg);
  border-radius: 5px;
  padding: 0.22rem 0.4rem;
  font-size: 0.72rem;
}
.pt-badge {
  border-radius: 4px;
  padding: 0.08rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.pt-badge-1 { background: rgba(96,165,250,0.2); color: #60a5fa; }
.pt-badge-2 { background: rgba(251,146,60,0.2);  color: #fb923c; }
.pt-badge-5 { background: rgba(167,139,250,0.2); color: #a78bfa; }
.session-memo {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-count { color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.session-del-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.session-del-btn:hover { color: #f87171; }
.day-add-btn {
  margin-top: auto;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.25rem;
  width: 100%;
  transition: all 0.15s;
}
.day-add-btn:hover { border-color: var(--primary); color: var(--primary); }
.pt-selector { display: flex; gap: 0.5rem; }
.pt-sel-btn {
  padding: 0.35rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
}
.pt-sel-btn.pt-sel-active[data-pt="1"] { background: rgba(96,165,250,0.15); color:#60a5fa; border-color:#60a5fa; }
.pt-sel-btn.pt-sel-active[data-pt="2"] { background: rgba(251,146,60,0.15);  color:#fb923c; border-color:#fb923c; }
.pt-sel-btn.pt-sel-active[data-pt="5"] { background: rgba(167,139,250,0.15); color:#a78bfa; border-color:#a78bfa; }
.pt-sel-btn:not(.pt-sel-active)[data-pt="1"]:hover { color:#60a5fa; border-color:#60a5fa; }
.pt-sel-btn:not(.pt-sel-active)[data-pt="2"]:hover { color:#fb923c; border-color:#fb923c; }
.pt-sel-btn:not(.pt-sel-active)[data-pt="5"]:hover { color:#a78bfa; border-color:#a78bfa; }
.parse-matched-box {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.7;
}
.parse-unmatched-box {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.7;
}
.parse-ok   { color: #34d399; font-weight: 700; }
.parse-warn { color: #f87171; font-weight: 700; }

/* ── 시즌 네비게이션 ── */
.season-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 1rem;
}
.season-nav-left  { display: flex; align-items: center; gap: 0.75rem; }
.season-nav-right { display: flex; align-items: center; gap: 0.5rem; }
.season-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  min-width: 220px;
  text-align: center;
}
.season-mgmt-btn {
  padding: 0.28rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.season-mgmt-btn:hover { color: var(--text); border-color: var(--text); }
.season-mgmt-add { border-color: var(--primary); color: var(--primary); }
.season-mgmt-add:hover { background: rgba(99,102,241,0.1); }

/* ── 주차 탭 ── */
.week-tabs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.625rem;
}
.week-tab {
  padding: 0.35rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.week-tab:hover { color: var(--text); border-color: var(--text); }
.week-tab.week-tab-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.week-tab-range {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.5rem;
}

/* ── 대시보드 ── */
.dash-section {
  margin-bottom: 2.5rem;
}
.dash-table-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.dash-table-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.dash-season-meta {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}
.dash-empty {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 2rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rate-high { color: #4caf82; font-weight: 600; }
.rate-low  { color: #f08080; }
.muted-text { color: var(--muted); }
.col-num { width: 3rem; text-align: center; }
.text-editable { cursor: pointer; }
.text-editable:hover { background: rgba(99,102,241,0.08); }
.flag-editable { cursor: pointer; }
.flag-editable:hover { opacity: 0.75; }

/* ── 결사원 통계 차트 ── */
.member-charts-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.member-chart-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1rem;
}
.member-chart-title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .75rem;
}
.member-chart-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.member-chart-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}
.chart-legend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  max-height: 150px;
  overflow-y: auto;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}
.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .member-charts-row { flex-direction: column; }
}

/* ── 자원 및 에테르 ── */
.res-subtab-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.res-subtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.res-subtab:hover { color: var(--text); }
.res-subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.res-panel { }
.res-panel-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  min-height: 1em;
}
.res-col-date     { width: 6rem; }
.res-col-num      { width: 6rem; text-align: right; }
.res-col-del      { width: 2rem; }
.res-col-desc     { width: 18rem; }
.res-col-nickname { width: 5rem; }
.ldg-col-nick     { width: 6rem; }
.ldg-col-color    { width: 4rem; }
.ldg-col-stone    { width: 12rem; }
.res-sum-row { background: rgba(99,102,241,0.1); }
.res-sum-label {
  text-align: right;
  font-size: 0.78rem;
  color: var(--muted);
  padding-right: 0.75rem;
}
.res-sum-val {
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  padding-right: 0.5rem;
}
.res-editable { cursor: pointer; }
.res-editable:hover { background: rgba(99,102,241,0.09); }
.res-del-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1;
}
.res-del-btn:hover { color: var(--danger); }
.resource-add-btn {
  margin-top: 0.75rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
}
.resource-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── 가이드 링크 ── */
.guide-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 0.75rem;
}
.guide-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.guide-link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color .15s, box-shadow .15s;
}
.guide-link-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.guide-link-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.guide-link-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.guide-link-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.42rem 1rem;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
  transition: opacity .15s;
}
.guide-link-btn:hover { opacity: .82; color: #fff; }

/* ── 전쟁지원 패키지 ── */
.wp-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.85rem;
}
.wp-stat strong { color: var(--text); }
.wp-stat-ok    { border-color: #10b981; color: #10b981; }
.wp-stat-ok strong { color: #10b981; }
.wp-stat-pending { border-color: #f59e0b; color: #f59e0b; }
.wp-stat-pending strong { color: #f59e0b; }

.wp-empty { color: var(--muted); font-size: 0.85rem; }

.wp-badge-payback {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(99,102,241,.18);
  color: #818cf8;
}
.wp-badge-paid-y {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(16,185,129,.18);
  color: #10b981;
}
.wp-badge-paid-n {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(148,163,184,.12);
  color: var(--muted);
}
.wp-row-paid td {
  background: rgba(16,185,129,.06) !important;
}
html.light-mode .wp-badge-payback { background: rgba(99,102,241,.12); color: #4f46e5; }
html.light-mode .wp-badge-paid-y  { background: rgba(16,185,129,.12); color: #059669; }
html.light-mode .wp-row-paid td   { background: rgba(16,185,129,.08) !important; }

/* ── 모바일 반응형 ── */
@media (max-width: 768px) {
  html { font-size: 14px; }

  .navbar {
    padding: 0 0.75rem;
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  .navbar .brand { font-size: 1rem; }
  .navbar .brand-logo { height: 24px; }
  .navbar .nav-right {
    gap: 0.6rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
  }

  .tab-bar {
    padding: 0 0.5rem;
    gap: 0.1rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .tab-btn { font-size: 0.78rem; padding: 0.5rem 0.6rem; white-space: nowrap; }

  .container { padding: 0.75rem 0.75rem; }

  .page-title { font-size: 1.1rem; }

  th, td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }

  .member-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .res-subtab-bar { overflow-x: auto; flex-wrap: nowrap; }
  .res-subtab { white-space: nowrap; font-size: 0.78rem; padding: 0.4rem 0.6rem; }

  .btn { font-size: 0.8rem; padding: 0.5rem 0.9rem; }
  .btn-sm { font-size: 0.72rem; padding: 0.3rem 0.55rem; }
  .resource-add-btn { font-size: 0.78rem; padding: 0.35rem 0.7rem; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* ── 모바일: 공지사항(main) 카드 레이아웃 ── */
@media (max-width: 768px) {
  /* 상단 2단 → 1단 */
  .top-section {
    flex-direction: column;
  }
  .score-sidebar {
    width: 100%;
  }

  /* 카드: 가로 배치 → 세로 배치 */
  .section-card {
    flex-direction: column;
  }
  .section-label {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
  }
  .section-body {
    padding: 0.75rem 1rem;
  }

  /* 분배내역 고정폭 해제 */
  .dist-row {
    flex-direction: column;
    gap: 0.25rem;
  }
  .dist-item-name {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 0.25rem;
  }

  /* 공지 박스 */
  .notice-box {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}
