/* ============================================================
   신흥중 야구부 — 새 앱 (완전 리뉴얼)
   밝고 깔끔한 테마 · 모바일 우선 · 달력 중심
   ============================================================ */
@font-face {
  font-family: "Alfa Slab One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/vendor/fonts/alfa-slab-one.woff2") format("woff2");
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/vendor/fonts/oswald-700.woff2") format("woff2");
}
:root {
  --bg: #f3ecdd;          /* 크림 (로고 배경 톤) */
  --card: #fffdf7;        /* 아이보리 카드 */
  --card-soft: #f6efe0;
  --ink: #1d2430;         /* 짙은 네이비/차콜 */
  --ink-2: #5c5a52;
  --ink-3: #948f81;
  --line: #e7ddc8;
  --line-2: #d9cdb3;

  --brand: #c8102e;       /* 팀 레드 */
  --brand-deep: #a30d24;
  --accent: #10233f;      /* 네이비 (주요 액션) */
  --accent-deep: #0a1830;
  --accent-bg: #ece4d2;   /* 활성/포커스 (짙은 크림) */
  --ring: rgba(16,35,63,0.18);
  --today: #c8102e;       /* 오늘 강조 (레드) */
  --today-bg: #fbeae9;

  --meal: #0f9d74;        /* 야간훈련 (teal) */
  --meal-bg: #e3f6ef;
  --vehicle: #c0820f;     /* 차량 (amber) */
  --vehicle-bg: #fbf1dd;
  --tour: #6a5bd6;        /* 대회당번 (purple) */
  --tour-bg: #eeebfc;
  --memo: #5a6573;        /* 메모 (gray) */
  --memo-bg: #eef1f5;
  --notice: #e0612a;      /* 대회공지 (brand) */
  --notice-bg: #fcece2;

  --pos: #0f9d74;         /* 입금 */
  --neg: #d2493f;         /* 출금 */

  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 6px 20px rgba(20, 30, 45, 0.08);
  --shadow-sheet: 0 -10px 40px rgba(20, 30, 45, 0.18);
  --header-h: 56px;
  --tabbar-h: 64px;
  --maxw: 720px;

  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
}
/* 탭마다 스크롤바가 생겼다 사라지며 화면이 8px 씩 흔들리는 것 방지 */
html { scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- 앱 셸 ---------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

/* ---------- 상단 헤더 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--header-h) + var(--sat));
  padding-top: var(--sat);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  padding-right: 14px;
}
.app-header img.brand-mark {
  height: 30px;
  width: auto;
  display: block;
  flex: 0 0 auto;
}
/* 로고 영역 = 일정 화면으로 가는 버튼 */
.app-header .brand-home {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: none;
  background: none;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.app-header .brand-home:hover { background: var(--card-soft); }
.app-header .brand-home:active { background: var(--accent-bg); }
.app-header .brand-text { min-width: 0; display: block; }
.app-header .brand-title,
.app-header .brand-sub { display: block; }
.app-header .brand-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.1;
}
.app-header .header-spacer { flex: 1 1 auto; }
.app-header .header-btn {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.app-header .header-btn:active { background: var(--card-soft); }

/* ---------- 스크롤 본문 ---------- */
.app-main {
  padding: 14px 14px calc(var(--tabbar-h) + var(--sab) + 18px);
}
.screen { display: none; }
.screen.is-active { display: block; }

/* ---------- 하단 탭바 ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: calc(var(--tabbar-h) + var(--sab));
  padding-bottom: var(--sab);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 14px rgba(20, 30, 45, 0.05);
  display: flex;
}
.tabbar .tab {
  flex: 1 1 0;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding-top: 8px;
}
.tabbar .tab .tab-ico { display: inline-flex; line-height: 1; }
.tabbar .tab .tab-ico svg { width: 23px; height: 23px; display: block; }
.tabbar .tab.is-active { color: var(--accent); }
.tabbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  display: flex;
}
/* 사이드바 요약은 넓은 화면(사이드바)에서만 — 모바일 하단바에서는 숨김 */
.side-extra { display: none; padding: 0 4px; }

/* ---------- 공통: 카드 / 섹션 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.card + .card { margin-top: 12px; }
.section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  margin: 20px 4px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 15px;
  background: var(--brand);
  border-radius: 2px;
  flex: 0 0 auto;
}

/* ---------- 칩 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.chip .chip-ico { font-size: 13px; }
.chip-meal { color: var(--meal); background: var(--meal-bg); }
.chip-vehicle { color: var(--vehicle); background: var(--vehicle-bg); }
.chip-tour { color: var(--tour); background: var(--tour-bg); }
.chip-memo { color: var(--memo); background: var(--memo-bg); }
.chip-notice { color: var(--notice); background: var(--notice-bg); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { transform: scale(0.985); }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-deep); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--neg); }
.btn-sm { height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- 폼 ---------- */
.field { margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============================================================
   일정 홈 — 달력
   ============================================================ */
.cal-card { padding: 10px 8px 12px; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 6px 10px;
}
.cal-title { font-size: 17px; font-weight: 800; min-width: 130px; text-align: center; }
.cal-nav {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-today-btn {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--accent-deep);
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 2px 0 6px;
}
.cal-dow.sun { color: var(--neg); }
.cal-dow.sat { color: var(--accent); }
.cal-cell {
  position: relative;
  min-height: 56px;
  border-radius: 10px;
  background: var(--card-soft);
  border: 1px solid transparent;
  padding: 4px 3px 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  overflow: hidden;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.is-today { border-color: var(--today); background: var(--today-bg); }
.cal-cell .cell-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  flex: 0 0 auto;
}
/* 날짜 옆에 그 날 제목(메모 첫 줄)을 같이 보여준다 */
.cell-top { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.cell-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-cell.sun .cell-date { color: var(--neg); }
.cal-cell.sat .cell-date { color: var(--accent); }
.cal-cell.holiday .cell-date { color: var(--neg); }
.cal-cell.is-today .cell-date { color: var(--today); }
.cell-dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.cell-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-meal { background: var(--meal); }
.dot-vehicle { background: var(--vehicle); }
.dot-tour { background: var(--tour); }
.dot-memo { background: var(--memo); }
.dot-notice { background: var(--notice); }
.cell-notice-tag {
  font-size: 9px;
  font-weight: 800;
  color: var(--notice);
  background: var(--notice-bg);
  border-radius: 4px;
  padding: 1px 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 달력 칸 당번 이름 — 모바일에서는 숨김, 데스크톱에서 표시 */
.cell-names { display: none; flex-direction: column; gap: 1px; margin-top: 2px; overflow: hidden; }
.cell-names .cn {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cn-meal { color: var(--meal); }
.cn-vehicle { color: var(--vehicle); }
.cn-tour { color: var(--tour); }
.cn-memo { color: var(--ink-2); }

/* 달력 범례 */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 6px 2px;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-2); font-weight: 600; }
.legend-item .cell-dot { width: 8px; height: 8px; }

/* ---------- 오늘/선택일 요약 ---------- */
.today-card .today-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.today-card .today-date { font-size: 16px; font-weight: 800; }
.today-card .today-badge { font-size: 11px; font-weight: 700; color: var(--accent); }
.today-rows { display: flex; flex-direction: column; gap: 8px; }
.duty-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.duty-row .duty-names { font-size: 14px; font-weight: 600; color: var(--ink); }
.today-memo {
  font-size: 14px;
  color: var(--ink);
  background: var(--notice-bg);
  border-left: 4px solid var(--notice);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
}
.empty-hint {
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
  padding: 18px 8px;
}

/* ============================================================
   바텀시트 (날짜 통합 편집)
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 30, 45, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 81;
  max-width: var(--maxw);
  margin: 0 auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.sheet.is-open { transform: translateY(0); pointer-events: auto; }
.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: var(--line-2);
  margin: 10px auto 4px;
  flex: 0 0 auto;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 10px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.sheet-title { font-size: 17px; font-weight: 800; }
.sheet-close {
  width: 34px; height: 34px; border-radius: 9px;
  border: none; background: var(--card-soft); color: var(--ink-2);
  font-size: 18px; cursor: pointer;
}
.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px;
  flex: 1 1 auto;
}
.sheet-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--sab));
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  background: var(--card);
}
.sheet-footer .btn { flex: 1; }

/* 카테고리 탭 (시트 내부) */
.cat-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.cat-tab {
  flex: 1;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 10px;
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.cat-tab .cat-ico { display: inline-flex; line-height: 1; }
.cat-tab .cat-ico svg { width: 19px; height: 19px; display: block; }
.cat-tab.is-active { color: #fff; }
.cat-tab[data-cat="meal"].is-active { background: var(--meal); border-color: var(--meal); }
.cat-tab[data-cat="vehicle"].is-active { background: var(--vehicle); border-color: var(--vehicle); }
.cat-tab[data-cat="tour"].is-active { background: var(--tour); border-color: var(--tour); }
.cat-tab[data-cat="notice"].is-active { background: var(--notice); border-color: var(--notice); }

.cat-pane { display: none; }
.cat-pane.is-active { display: block; }

/* 로테이션 자동 카드 */
.rota-card {
  background: var(--accent-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.rota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rota-head .rota-label { font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.rota-names { display: flex; gap: 6px; }
.rota-names .rota-name {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border-radius: 9px;
  padding: 9px 4px;
}
.rota-names .rota-name small { display: block; font-size: 10px; color: var(--ink-3); font-weight: 600; }

.grade-picker { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grade-picker .gp-col > label { font-size: 11px; color: var(--ink-3); font-weight: 700; display: block; margin-bottom: 4px; text-align: center; }
.pill-list { display: flex; flex-direction: column; gap: 6px; max-height: 168px; overflow-y: auto; }
/* 차량 탭은 칸 안 스크롤 없이 전부 펼쳐 보여준다 (안쪽 스크롤이 3개면 찾기 힘듦) */
[data-pane="vehicle"] .pill-list { max-height: none; overflow: visible; }
[data-pane="vehicle"] .pill { padding: 7px 6px; font-size: 12.5px; }
.sub-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-deep);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
/* 차량: 학년 탭 + 차량 카드 */
.vg-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.vg-tab {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.vg-tab.is-active { background: var(--vehicle); border-color: var(--vehicle); color: #fff; }
.sub-hint { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.pill-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-wrap .pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pill-wrap .pill.is-other { opacity: 0.5; }
.pr-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--card-soft);
  color: var(--ink-3);
  border-radius: 5px;
  padding: 1px 5px;
}
.car-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.car-chip {
  flex: 0 0 auto;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.car-chip.is-active { background: var(--vehicle); border-color: var(--vehicle); color: #fff; }
.cc-cnt {
  font-size: 11px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}
.car-chip.is-active .cc-cnt { background: rgba(255, 255, 255, 0.28); }
.cs-grade-block { margin-bottom: 10px; }
.cs-grade-h { font-size: 12px; font-weight: 800; color: var(--vehicle); margin-bottom: 5px; }

/* 차량 선택 요약 */
.car-summary { margin-top: 14px; }
.cs-title { font-size: 12px; font-weight: 800; color: var(--accent-deep); margin-bottom: 7px; }
.cs-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--accent-bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.cs-grade {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--vehicle);
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 2px;
}
.cs-body { flex: 1 1 auto; min-width: 0; color: var(--ink); }
.cs-ride { color: var(--ink-2); }
.cs-none { color: var(--ink-3); }
.cs-empty {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  padding: 12px;
  background: var(--card-soft);
  border-radius: 10px;
}
.pill {
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  color: var(--ink);
}
.pill.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint-line { font-size: 12px; color: var(--ink-3); margin: 0 0 10px; }

/* 이전 공지 가져오기 목록 */
.prev-notice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.prev-notice-list .pn-empty { font-size: 12px; color: var(--ink-3); text-align: center; padding: 6px; }
.prev-notice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.prev-notice-item:active { background: var(--card-soft); }
.prev-notice-item .pn-date { font-size: 12px; font-weight: 800; color: var(--notice); flex: 0 0 auto; }
.prev-notice-item .pn-title { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 행 입력 에디터 (대회 일정 / 당번표) */
.row-editor { display: flex; flex-direction: column; gap: 8px; }
.re-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: var(--card-soft);
}
.re-row .re-input {
  flex: 1 1 42%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.re-row .re-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.re-row .re-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border: none; background: none;
  color: var(--ink-3); font-size: 18px; cursor: pointer;
  border-radius: 8px;
}
.re-row .re-del:active { background: var(--card); }
@media (min-width: 760px) {
  .re-row .re-input { flex: 1 1 0; }
}

/* ============================================================
   예비비 장부
   ============================================================ */
.ledger-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.ledger-month .cal-nav { width: 34px; height: 34px; font-size: 18px; }
.ledger-month .lm-label { font-size: 15px; font-weight: 800; min-width: 96px; text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat {
  background: var(--card-soft);
  border-radius: var(--radius);
  padding: 11px 10px;
  text-align: center;
}
.stat .stat-label { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.stat .stat-val { font-size: 16px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .stat-val.pos { color: var(--pos); }
.stat .stat-val.neg { color: var(--neg); }
.grand-balance {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 12px;
}
.grand-balance .gb-label { font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.grand-balance .gb-val { font-size: 18px; font-weight: 800; color: var(--accent-deep); font-variant-numeric: tabular-nums; }

.ledger-list { display: flex; flex-direction: column; gap: 7px; }
.ledger-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--card);
}
.ledger-item .li-main { flex: 1 1 auto; min-width: 0; }
.ledger-item .li-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-item .li-sub { font-size: 11px; color: var(--ink-3); }
.ledger-item .li-bal {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-right: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ledger-item .li-bal-lbl { font-size: 10px; font-weight: 600; color: var(--ink-3); opacity: 0.75; }
/* 좁은 화면에서는 잔액을 숨겨 내역·금액이 눌리지 않게 */
@media (max-width: 480px) {
  .ledger-item .li-bal { display: none; }
}
.ledger-item .li-amt { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; flex: 0 0 auto; min-width: 92px; text-align: right; }
.ledger-item .li-amt.pos { color: var(--pos); }
.ledger-item .li-amt.neg { color: var(--neg); }
.ledger-item .li-del {
  border: none; background: none; color: var(--ink-3);
  font-size: 18px; cursor: pointer; flex: 0 0 auto; padding: 0 2px;
}

/* 비밀번호 게이트 */
.gate {
  text-align: center;
  padding: 30px 18px;
}
.gate .gate-ico { font-size: 38px; }
.gate h3 { font-size: 17px; margin: 12px 0 4px; }
.gate p { font-size: 13px; color: var(--ink-3); margin: 0 0 16px; }
.gate .gate-form { max-width: 280px; margin: 0 auto; }
.gate .err { color: var(--neg); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ============================================================
   설정
   ============================================================ */
.roster-grade { margin-bottom: 14px; }
.roster-grade .rg-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.roster-grade .rg-title { font-size: 14px; font-weight: 800; }
.roster-grade .rg-count { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.roster-grade .rg-title .gdot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.gdot-1 { background: var(--meal); }
.gdot-2 { background: var(--accent); }
.gdot-3 { background: var(--vehicle); }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--sab) + 16px);
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 데스크톱: 살짝 넓게, 가운데 정렬된 모바일 폭 유지 */
@media (min-width: 760px) {
  .app { box-shadow: 0 0 0 1px var(--line); }

  /* 넓은 화면에서는 바텀시트를 화면 가운데 모달처럼 띄움 */
  .sheet {
    bottom: auto;
    top: 50%;
    border-radius: 18px;
    max-height: 86vh;
    transform: translateY(-44%);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.18s ease;
  }
  .sheet.is-open { transform: translateY(-50%); opacity: 1; }
  .sheet-footer { border-radius: 0 0 18px 18px; }
}

/* ============================================================
   데스크톱(PC) 최적화 — 왼쪽 사이드바 + 넓은 달력
   ============================================================ */
@media (min-width: 980px) {
  .app {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .app-header { grid-column: 1 / -1; }

  /* 하단 탭바 → 왼쪽 세로 사이드바로 전환 */
  .tabbar {
    position: sticky;
    top: var(--header-h);
    bottom: auto;
    left: auto;
    right: auto;
    align-self: start;
    grid-column: 1;
    grid-row: 2;
    height: auto;
    padding: 14px 10px;
    border-top: none;
    border-right: 1px solid var(--line);
    box-shadow: none;
    background: var(--card);
  }
  .tabbar-inner { flex-direction: column; gap: 4px; }
  /* 사이드바 하단 요약 */
  .side-extra {
    display: block;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
  .se-block { margin-bottom: 14px; }
  .se-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: var(--ink-3);
    margin-bottom: 5px;
  }
  .se-dday {
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    background: var(--brand);
    border-radius: 999px;
    padding: 1px 7px;
  }
  .se-line {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.5;
    word-break: keep-all;
  }
  .se-none { font-size: 11px; color: var(--ink-3); }
  .se-foot {
    font-size: 11px;
    color: var(--ink-3);
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }
  .tabbar .tab {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
  }
  .tabbar .tab .tab-ico svg { width: 21px; height: 21px; }
  .tabbar .tab.is-active { background: var(--accent-bg); }

  .app-main {
    grid-column: 2;
    grid-row: 2;
    padding: 22px 26px 48px;
  }

  /* 큰 달력 + 칸 안 당번 이름 */
  .cal-card { padding: 18px; }
  .cal-title { font-size: 21px; }
  .cal-grid { gap: 6px; }
  .cal-cell {
    min-height: 96px;
    padding: 7px 8px 6px;
    align-items: stretch;
  }
  .cal-cell .cell-date { text-align: left; font-size: 13px; }
  .cell-dots { display: none; }
  .cell-names { display: flex; }
  .cal-dow { font-size: 12px; text-align: left; padding-left: 4px; }

  /* 모든 화면이 같은 폭을 쓴다 — 화면마다 다르게 걸면 좌우가 어긋나 보인다 */
  .screen { max-width: 980px; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* 오타 점검 모달 */
.typo-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  z-index: 90;
  width: min(560px, calc(100vw - 24px));
  max-height: 86vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-sheet);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.typo-modal.is-open { display: flex; transform: translate(-50%, -50%); }
.typo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
}
.typo-body { padding: 14px 16px; overflow-y: auto; }
.typo-list { margin: 0 0 12px; padding-left: 20px; font-size: 13px; color: var(--ink); }
.typo-list li { margin-bottom: 3px; }
.typo-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.typo-lbl { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.typo-lbl-after { color: var(--brand); }
.typo-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
  font-family: inherit;
}
.typo-pre-after { background: #fbf3ea; border-color: var(--line-2); }
.typo-foot {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--sab));
  border-top: 1px solid var(--line);
}
.typo-foot .btn { flex: 1; }
@media (max-width: 520px) {
  .typo-cols { grid-template-columns: 1fr; }
}

/* ---------- 당번 이름 검색 ---------- */
.pick-search {
  position: relative;
  margin-bottom: 10px;
}
.pick-search .input { padding-right: 74px; }
.ps-count {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  pointer-events: none;
}
.pill.is-filtered { display: none; }
.gp-col.is-empty .pill-list::after {
  content: "검색 결과 없음";
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  padding: 10px 0;
}

/* ---------- 대회공지 목록 ---------- */
.notice-list { display: flex; flex-direction: column; gap: 9px; }
.notice-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.notice-card:active { background: var(--accent-bg); }
.nc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.nc-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nc-state {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.nc-state.is-now { background: var(--brand); color: #fff; }
.nc-state.is-soon { background: var(--accent-bg); color: var(--accent-deep); }
.nc-state.is-done { background: var(--card-soft); color: var(--ink-3); }
.nc-meta { font-size: 12px; color: var(--ink-2); line-height: 1.6; }

/* ---------- 통계 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
}
.sc-label { font-size: 11px; font-weight: 700; color: var(--ink-3); margin-bottom: 5px; }
.sc-val {
  font-size: 19px;
  font-weight: 800;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-val.pos { color: var(--pos); }
.sc-val.neg { color: var(--neg); }
.sc-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-chart { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 9px; }
.bar-label {
  flex: 0 0 42px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: right;
}
.bar-track {
  flex: 1 1 auto;
  height: 20px;
  background: var(--card-soft);
  border-radius: 6px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  min-width: 2px;
}
.bar-row.is-top .bar-fill { background: var(--brand); }
.bar-val {
  flex: 0 0 auto;
  min-width: 96px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.bar-sub { display: block; font-size: 10px; font-weight: 600; color: var(--ink-3); }

.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.rank-row:last-child { border-bottom: none; }
.rk-no {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--card-soft);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rk-1 { background: var(--brand); color: #fff; }
.rk-2 { background: var(--accent); color: #fff; }
.rk-3 { background: var(--accent-bg); color: var(--accent-deep); }
.rk-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rk-sub { font-size: 11px; color: var(--ink-3); margin-left: 6px; font-weight: 500; }
.rk-val {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--neg);
}
@media (max-width: 420px) {
  .bar-val { min-width: 74px; font-size: 11px; }
  .bar-label { flex-basis: 34px; }
}

/* 예비비 입력 시트 */
.kind-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.kind-btn {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.kind-btn.kind-out.is-active {
  background: var(--neg);
  border-color: var(--neg);
  color: #fff;
}
.kind-btn.kind-in.is-active {
  background: var(--pos);
  border-color: var(--pos);
  color: #fff;
}
.amt-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.amt-sign {
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 800;
  width: 22px;
  text-align: center;
  color: var(--neg);
}
.amt-sign.is-in { color: var(--pos); }
.amt-input {
  flex: 1 1 auto;
  text-align: right;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  height: 56px;
}
.amt-won { flex: 0 0 auto; font-size: 15px; font-weight: 700; color: var(--ink-3); }
.amt-quick {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.amt-chip {
  flex: 1 1 auto;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--card-soft);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.amt-chip:active { background: var(--accent-bg); }
.amt-chip-clear { color: var(--ink-3); }
.ledger-item { cursor: pointer; }
.ledger-item:active { background: var(--accent-bg); }

/* 이미지 미리보기 모달 */
.img-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  z-index: 90;
  width: min(680px, calc(100vw - 24px));
  max-height: 90vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-sheet);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.img-modal.is-open { display: flex; transform: translate(-50%, -50%); }
/* 확대 모드: 창을 최대로 키우고 원본 크기로 스크롤해서 본다 */
.img-modal.is-zoom { width: calc(100vw - 20px); max-height: 96vh; }
.img-modal.is-zoom .img-stage {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  justify-content: flex-start;
  max-height: 78vh;
}
.img-modal.is-zoom .img-stage img {
  max-width: none;
  max-height: none;
  width: auto;
  cursor: zoom-out;
}
.img-head-actions { display: flex; align-items: center; gap: 8px; }
.img-body {
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.img-stage {
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.img-stage img {
  display: none;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(20, 30, 45, 0.16);
}
.img-stage.is-ready img { display: block; cursor: zoom-in; }
.img-stage.is-ready .img-spinner { display: none; }
.img-spinner { font-size: 13px; color: var(--ink-3); }
#imgMeta { margin: 10px 0 0; text-align: center; }
