/* 제일동산 관리 — 모바일 퍼스트 (family_ledger 디자인 시스템 이식, 수원제일교회 CI 팔레트) */

:root {
  --font-stack: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", sans-serif;
}

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface2: #f2f4f7;
  --text: #1a1d21;
  --text2: #5a6270;
  --muted: #8a919c;
  --border: #e3e7ec;
  --primary: #1f2a44;
  --on-primary: #ffffff;
  --income: #35618e;
  --expense: #e5484d;
  --accent: #35618e;
  --accent-bg: #e7eef7;
  --danger: #c62f35;
  --danger-bg: #fdecec;
  --success: #1a7f4e;
  --success-bg: #e6f5ec;
  --warn: #9a6a10;
  --warn-bg: #fbf1dc;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 20, 28, .05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #12171f;
    --surface: #1a212c;
    --surface2: #232c39;
    --text: #eceded;
    --text2: #a6acb8;
    --muted: #7c828d;
    --border: #2c3644;
    --primary: #7da7d9;
    --on-primary: #12171f;
    --income: #7da7d9;
    --expense: #ff8a8f;
    --accent: #7da7d9;
    --accent-bg: #22344d;
    --danger: #ff8a8f;
    --danger-bg: #3a2225;
    --success: #5ecf96;
    --success-bg: #1c3328;
    --warn: #e8b458;
    --warn-bg: #3a3120;
    --shadow: none;
  }
}

[data-theme="light"] { /* 기본값과 동일 — 명시 선택용 */ }

[data-theme="dark"] {
  --bg: #12171f;
  --surface: #1a212c;
  --surface2: #232c39;
  --text: #eceded;
  --text2: #a6acb8;
  --muted: #7c828d;
  --border: #2c3644;
  --primary: #7da7d9;
  --on-primary: #12171f;
  --income: #7da7d9;
  --expense: #ff8a8f;
  --accent: #7da7d9;
  --accent-bg: #22344d;
  --danger: #ff8a8f;
  --danger-bg: #3a2225;
  --success: #5ecf96;
  --success-bg: #1c3328;
  --warn: #e8b458;
  --warn-bg: #3a3120;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden], .check-row[hidden], .seg-btn[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

/* 글자 크기 — 모든 글자 크기가 rem이라 루트 크기(10~30px, 슬라이더)만 바꾸면 전체 적용 */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 4px; border-radius: 2px;
  background: var(--border); outline: none; padding: 0; border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}
.size-val { font-size: 0.8125rem; color: var(--text2); min-width: 34px; text-align: right; }
body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0; font-weight: 700; }
h2 { margin: 0; }
p { margin: 0; }
input, select, button, textarea { font: inherit; color: inherit; }

/* 레이아웃 — PC(≥768px)는 상단 헤더+넓은 본문, 모바일은 하단 탭 내비게이션 */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}
.content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

/* 상단 내비게이션 (PC 전용 — 모바일에서는 숨김) */
.top-nav { display: none; }

@media (min-width: 768px) {
  .app { max-width: 1100px; }
  .content { padding-bottom: 32px; }
  /* !important: 아래쪽의 .bottom-nav{display:flex} 기본 정의가 뒤에 와서 순서로는 못 이김 */
  .bottom-nav { display: none !important; }
  .top-nav {
    display: flex; align-items: center; gap: 20px;
    padding: 10px 20px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
  }
  .top-nav .brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; }
  .top-nav .brand img { height: 30px; display: block; }
  .top-nav .brand strong { font-size: 1.0625rem; white-space: nowrap; }
  .top-menu { display: flex; align-items: center; gap: 4px; flex: 1; }
  .top-menu a {
    padding: 8px 14px; border-radius: var(--radius);
    font-size: 0.9375rem; color: var(--text2); white-space: nowrap;
  }
  .top-menu a:hover { background: var(--surface2); color: var(--text); }
  .top-menu a.active { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
  .top-user { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text2); white-space: nowrap; }
  .top-user-name { color: var(--text); font-weight: 600; }
  .top-user-name:hover { color: var(--accent); text-decoration: underline; }
}
.page-pad { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; }

/* 헤더 */
.page-head, .home-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-head .muted { font-size: 0.8125rem; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head h1 { font-size: 1.0625rem; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.125rem; color: var(--text2); background: transparent; border: none; cursor: pointer;
}
.icon-btn:active { background: var(--surface2); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; font-size: 0.8125rem; }

/* 카드 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.section-title { font-size: 0.875rem; font-weight: 700; margin-bottom: 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.sm-link { font-size: 0.8125rem; }

.hero { text-align: left; }
.hero .label { margin-bottom: 2px; }
.big-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.5px; }
.big-num .unit, .stat-num .unit { font-size: 0.875rem; font-weight: 400; color: var(--muted); margin-left: 2px; }
.hero-sub { display: flex; gap: 16px; margin-top: 6px; font-size: 0.8125rem; color: var(--text2); }
.sub-note { font-size: 0.8125rem; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat .stat-num { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }
.label { font-size: 0.75rem; color: var(--muted); }

/* 배너 */
.banner {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius-lg); padding: 12px 14px;
  border: 1px solid var(--border);
}
.banner.danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.banner strong { display: block; font-size: 0.875rem; }
.banner small { font-size: 0.75rem; opacity: .9; }
.banner-icon { font-size: 1.25rem; }
.chev { color: var(--muted); font-size: 1.125rem; }

/* 리스트 행 */
.tx-row, .row-line {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.tx-row:first-of-type, .row-line:first-of-type { border-top: none; }
.row-icon { font-size: 1.25rem; width: 28px; text-align: center; flex-shrink: 0; }
.grow { flex: 1; min-width: 0; }
.tx-title { display: block; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row small, .row-line small { display: block; font-size: 0.75rem; }
.amount { font-weight: 600; font-size: 0.875rem; white-space: nowrap; }
.amount.income, .income { color: var(--income); }
.amount.expense, .expense { color: var(--expense); }
.b { font-weight: 700; }
.ta-right { text-align: right; }
.ta-right small { display: block; font-size: 0.6875rem; }
.date-cell { font-size: 0.75rem; width: 42px; flex-shrink: 0; }

/* 배지 */
.badge {
  display: inline-block; font-size: 0.625rem; padding: 1px 7px; border-radius: 999px;
  background: var(--surface2); color: var(--text2); vertical-align: 1px; margin-left: 4px;
}
.badge.accent { background: var(--accent-bg); color: var(--accent); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 0.875rem; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text2); }
.btn.sm { padding: 6px 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn.block { width: 100%; }

/* 폼 */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8125rem; color: var(--text2); }
input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface2); color: var(--text); font-size: 0.9375rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.inline-form .btn { white-space: nowrap; flex-shrink: 0; }
.inline-form input, .inline-form select { min-width: 0; }
.inline-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--text2); }
.amount-input { font-size: 1.25rem !important; font-weight: 700; }
.icon-input { width: 56px !important; text-align: center; flex-shrink: 0; }
.day-label { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text2); white-space: nowrap; }
.inline-form .day-label { flex: 0 0 auto; flex-direction: row; align-items: center; }

.check-row {
  display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.check-row input { margin-top: 3px; accent-color: var(--accent); }
.check-row strong { font-size: 0.875rem; color: var(--text); display: block; }
.check-row small { display: block; }
.check-row.slim { padding: 6px 10px; align-items: center; white-space: nowrap; }
.option-rows { display: flex; flex-direction: column; gap: 8px; }
.share-hint { font-size: 0.75rem; padding: 2px 2px 0; margin: 0; }
.sm-note { font-size: 0.75rem; margin: 0 0 6px; }

/* 세그먼트 토글 */
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; text-align: center; padding: 8px 0; font-size: 0.8125rem; font-weight: 600;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg-btn.on, .seg-btn:has(input:checked) { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }

/* 칩 */
.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip {
  font-size: 0.75rem; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text2); background: var(--surface);
}
.chip.on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.chip-spacer { flex: 1; }
.sub-chips { margin-top: -6px; padding-left: 10px; }
.sub-chips .chip { font-size: 0.71875rem; padding: 4px 10px; }
.sub-chips .chip.on { background: var(--accent-bg); color: var(--accent); }

/* 월 요약 바 */
.summary-bar { display: flex; padding: 10px 0; }
.summary-bar > div { flex: 1; text-align: center; border-left: 1px solid var(--border); }
.summary-bar > div:first-child { border-left: none; }
.summary-bar .b { font-size: 0.875rem; margin-top: 1px; }

/* 날짜 그룹 — 날짜 줄 클릭으로 접기/펼치기 */
.day-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.day-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 4px; font-size: 0.8125rem; font-weight: 700;
  border-bottom: 1px solid var(--border);
  cursor: pointer; list-style: none; user-select: none;
}
.day-head::-webkit-details-marker { display: none; }
.day-caret {
  display: inline-block; font-size: 0.6875rem; color: var(--muted);
  transition: transform .15s ease;
}
.day-group:not([open]) .day-caret { transform: rotate(-90deg); }
.day-group:not([open]) { padding-bottom: 6px; }
.day-group:not([open]) .day-head { border-bottom: none; padding-bottom: 8px; }
.day-sums { display: flex; gap: 8px; font-size: 0.75rem; font-weight: 600; }
.tx-row.readonly { opacity: .75; }

/* 달력 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-dow { font-size: 0.75rem; color: var(--muted); padding: 6px 0; }
.cal-dow.sun { color: var(--expense); }
.cal-dow.sat { color: var(--income); }
.cal-cell {
  min-height: 52px; padding: 4px 1px; border-top: 1px solid var(--border);
  font-size: 0.75rem; cursor: pointer; border-radius: 8px;
}
.cal-cell .d { font-weight: 600; }
.cal-cell.out { opacity: .35; cursor: default; }
.cal-cell.today .d { color: var(--accent); }
.cal-cell.sel { background: var(--accent-bg); }
.cal-cell .ci { display: block; font-size: 0.625rem; color: var(--income); line-height: 1.3; }
.cal-cell .ce { display: block; font-size: 0.625rem; color: var(--expense); line-height: 1.3; }

/* 그래프 (막대) */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 72px; margin-top: 12px; }
.bars.tall { height: 140px; }
.bars.dense { gap: 3px; }
.bars.dense .bar-val { font-size: 0.5625rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; height: 100%; }
.bar { width: 100%; background: var(--border); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.hl { background: var(--accent); }
.bar-col small { font-size: 0.625rem; }
.bar-val { color: var(--text2); }

/* 도넛 */
.donut-wrap { display: flex; align-items: center; gap: 16px; padding: 6px 0 10px; }
.donut {
  width: 128px; height: 128px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.donut-hole {
  width: 78px; height: 78px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole b { font-size: 0.9375rem; }
.legend { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 0.8125rem; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.rank-no { width: 18px; text-align: center; font-size: 0.8125rem; }
.hbar { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin: 4px 0 8px; }
.hbar-fill { height: 100%; border-radius: 4px; }
.member-stat + .member-stat { margin-top: 4px; }

/* 정산 */
.pay-route { border: 1px dashed var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 4px 0; }
.pay-route .inline-form { margin-top: 4px; }
.member-card summary { list-style: none; cursor: pointer; }
.member-card summary::-webkit-details-marker { display: none; }
.member-detail { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.member-detail form { margin: 4px 0; }

/* 메뉴 */
.menu { padding: 8px 16px; }
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 0; border-top: 1px solid var(--border); font-size: 0.875rem;
  width: 100%; background: none; border-left: none; border-right: none; border-bottom: none;
  text-align: left; cursor: pointer;
}
.menu .section-title { padding-top: 8px; }
.menu .section-title + .menu-row { border-top: none; }
.theme-row select { width: auto; padding: 6px 10px; font-size: 0.8125rem; }
.install-hint { font-size: 0.75rem; padding: 8px 0 10px; }

.invite-code { font-size: 1.625rem; font-weight: 800; letter-spacing: 4px; margin: 4px 0; }
.center { text-align: center; }
.fixed-item summary { list-style: none; cursor: pointer; }
.fixed-item summary::-webkit-details-marker { display: none; }
.fixed-item.inactive { opacity: .55; }
.fixed-edit { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 4px; }
.row-block .danger-zone { padding: 8px 0; }

/* 하단 내비게이션 */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; align-items: center;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}

.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 0.625rem; color: var(--muted); padding: 3px 0;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); font-weight: 700; }
.nav-add {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.nav-add svg {
  width: 44px; height: 44px; padding: 10px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
}

/* 인증 페이지 */
.auth-page {
  min-height: 90dvh; display: flex; flex-direction: column; justify-content: center;
  padding: 24px; gap: 10px; text-align: center;
}
.auth-logo { font-size: 2.75rem; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8125rem; color: var(--text2); }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 20px 0; font-size: 0.8125rem; }

/* 플래시 */
.flash-wrap { position: sticky; top: 8px; z-index: 20; padding: 8px 16px 0; }
.flash {
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius); padding: 10px 14px; font-size: 0.8125rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.15); margin-bottom: 6px;
  animation: flash-in .25s ease;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

/* 인증/공개 페이지 폼은 PC에서도 좁게 유지 */
.auth-form { width: 100%; max-width: 380px; margin-left: auto; margin-right: auto; }

/* 반응형 유틸 — 모바일 전용 요소는 PC에서 숨김 */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* ==== 배치도 / 묘소 대장 ==== */
.chip.active { background: var(--primary); color: var(--on-primary); border-color: transparent; }

/* 상태 배지 */
.stat {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.st-occupied { background: var(--accent-bg); color: var(--accent); }
.st-reserved { background: var(--warn-bg); color: var(--warn); }
.st-empty { background: var(--surface2); color: var(--muted); border: 1px dashed var(--border); }

/* 위성사진 + 구역 오버레이 */
.map-card { padding: 10px; }
.map-wrap { position: relative; max-width: 720px; margin: 0 auto; }
.map-wrap img { width: 100%; display: block; border-radius: var(--radius); }
.map-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-path {
  fill: none; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round;
  opacity: .5; cursor: pointer; transition: opacity .15s;
}
.map-path:hover { opacity: .85; }
.band-1 { stroke: #f2d98c; }
.band-2 { stroke: #f0a3c0; }
.band-3 { stroke: #8fd4ee; }
.band-4 { stroke: #f5993d; }
.band-5 { stroke: #b9b3e8; }
.band-6 { stroke: #9fd6a8; }
.band-7 { stroke: #f2b3a0; }
.band-8 { stroke: #a9c8f0; }
.band-9 { stroke: #d8c98f; }
.map-path.ossuary { stroke: #4d86c8; stroke-width: 8; fill: rgba(77,134,200,.10); opacity: .9; }
.map-label {
  fill: #ffffff; font-size: 30px; font-weight: 700; text-anchor: middle;
  paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 4px; pointer-events: none;
}
.map-hint { font-size: 0.8125rem; margin-top: 8px; }
.band-label { font-size: 24px; }

/* ==== 인증 화면 (로그인/가입) ==== */
.auth-bg {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(125,167,217,.28), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(53,97,142,.25), transparent 60%),
    linear-gradient(160deg, #16233b, #0f1726 65%);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 28px 26px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(6, 12, 24, .45);
}
.auth-card h1 { font-size: 1.375rem; margin-top: 14px; }
.auth-card > .muted { margin-top: 4px; font-size: 0.875rem; }
.auth-card .auth-form { margin-top: 20px; }
.auth-logo-img {
  width: 74px; height: 74px; object-fit: contain;
  border-radius: 18px; background: #1e2a44; padding: 10px;
  box-shadow: 0 6px 18px rgba(6, 12, 24, .35);
}
.auth-form input:not([type="checkbox"]) {
  padding: 11px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface2);
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.auth-foot { margin-top: 16px; font-size: 0.875rem; }
.dot-sep { margin: 0 6px; color: var(--muted); }

/* ==== 대시보드 ==== */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 0.6875rem; font-weight: 700;
}
.notice-card {
  display: block; border-color: var(--warn);
  background: var(--warn-bg); color: var(--warn);
  font-size: 0.9375rem;
}
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.kpi:hover { border-color: var(--accent); }
.kpi-label { font-size: 0.8125rem; color: var(--text2); }
.kpi-num { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
.kpi-num small { font-size: 0.875rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.dash-grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .dash-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.dash-col { display: flex; flex-direction: column; gap: 12px; }

/* ==== 공개 홈 ==== */
.pub { min-height: 100dvh; }
.hero {
  color: #eef3fa;
  background:
    radial-gradient(1000px 500px at 85% -20%, rgba(125,167,217,.35), transparent 60%),
    linear-gradient(165deg, #1c2a45, #101a2c 70%);
  padding: 18px 20px 56px;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; max-width: 960px; margin: 0 auto; }
.hero-brand { height: 26px; opacity: .95; }
.hero-login {
  font-size: 0.8125rem; color: rgba(238,243,250,.75);
  padding: 6px 12px; border: 1px solid rgba(238,243,250,.25); border-radius: 999px;
}
.hero-login:hover { background: rgba(238,243,250,.1); }
.hero-body { max-width: 960px; margin: 48px auto 0; text-align: center; }
.hero-logo {
  width: 92px; height: 92px; object-fit: contain;
  border-radius: 22px; background: rgba(255,255,255,.06); padding: 12px;
  border: 1px solid rgba(238,243,250,.14);
}
.hero-body h1 { font-size: 2.25rem; margin-top: 18px; letter-spacing: 2px; }
.hero-sub { margin-top: 10px; font-size: 1.0625rem; color: rgba(238,243,250,.85); }
.hero-addr { margin-top: 6px; font-size: 0.875rem; color: rgba(238,243,250,.55); }
.hero-cta { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-btn {
  background: #7da7d9; color: #101a2c; font-weight: 700;
  padding: 11px 22px; border-radius: 999px;
}
.hero-btn.ghost2 { background: transparent; color: #eef3fa; border: 1px solid rgba(238,243,250,.3); }
.pub-body { max-width: 960px; margin: -30px auto 0; padding: 0 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.pub-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pub-card { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.pub-ico { font-size: 1.5rem; }
.pub-photo { padding: 10px; }
.pub-photo img { width: 100%; border-radius: var(--radius); display: block; max-height: 420px; object-fit: cover; object-position: center 30%; }
.pub-photo p { margin-top: 6px; }
.pub-foot { text-align: center; font-size: 0.8125rem; padding: 12px 0 4px; }
.center { text-align: center; }

/* 공개 하위 페이지 내비게이션 */
.pub-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: #16233b; color: #eef3fa;
  position: sticky; top: 0; z-index: 30;
}
.pub-nav-brand { display: flex; align-items: center; gap: 8px; }
.pub-nav-brand img { width: 28px; height: 28px; object-fit: contain; border-radius: 7px; background: rgba(255,255,255,.08); padding: 3px; }
.pub-nav-links { display: flex; gap: 2px; }
.pub-nav-links a { padding: 7px 11px; border-radius: 999px; font-size: 0.875rem; color: rgba(238,243,250,.8); white-space: nowrap; }
.pub-nav-links a.active, .pub-nav-links a:hover { background: rgba(238,243,250,.12); color: #fff; }
.pub-page { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.pub-title { font-size: 1.5rem; }
.prewrap { white-space: pre-wrap; line-height: 1.65; }
.notice-row { display: flex; align-items: baseline; gap: 8px; }
.notice-row:hover strong { color: var(--accent); }

/* 통계 막대 */
.bar { display: flex; height: 10px; border-radius: 5px; background: var(--surface2); overflow: hidden; margin-top: 6px; }
.bar-occ { background: var(--accent); display: block; height: 100%; }
.bar-res { background: var(--warn); display: block; height: 100%; }
.bar-exp { background: var(--expense); display: block; height: 100%; }
.mini-bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; margin: 2px 0; }

/* 매뉴얼 */
.manual-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; line-height: 1.6; font-size: 0.9375rem; }
.manual .card { display: flex; flex-direction: column; gap: 12px; }
.manual-shot { margin: 0; flex: 1; min-width: 0; }
.manual-shot img {
  width: 100%; display: block; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.manual-shot img:hover { border-color: var(--accent); }
.manual-shot figcaption { margin-top: 5px; text-align: center; }
.manual-cols { display: grid; gap: 12px; }
@media (min-width: 768px) { .manual-cols { grid-template-columns: 1fr 1fr; align-items: start; } }

/* 법정 서식 (앞쪽/뒤쪽) */
.legal-form-head { text-align: center; margin-bottom: 10px; }
.legal-form-head p { font-size: 0.8125rem; color: var(--text2); text-align: left; }
.legal-form-head .right-note { float: right; }
.legal-form-head h2 { font-size: 1.125rem; margin-top: 4px; }
.form-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 8px; }
.form-table th, .form-table td { border: 1px solid var(--border); padding: 7px 9px; }
.form-table th { background: var(--surface2); font-weight: 600; text-align: left; }
.form-table thead th { text-align: center; }
.form-table .form-group { text-align: center; width: 76px; }
.form-table td.hand { background: var(--surface2); min-width: 60px; }
.form-table td.tall { height: 72px; }
.form-table .center-th { text-align: center; }
.form-table [contenteditable="true"]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ===== 관리부 회계 서식 (월별 수입지출현황 / 연말 결산보고서 / 월×코드 매트릭스) ===== */
.fin-report { position: relative; }
.fin-title { text-align: center; font-size: 1.375rem; margin: 6px 0 4px; }
.fin-title .fin-org { color: var(--accent); }
.fin-sub { text-align: center; color: var(--text2); font-size: 0.875rem; margin: 2px 0; }
.fin-sub.left-sub { text-align: left; margin: 10px 0 6px; color: var(--text); }
.fin-sign { border-collapse: collapse; margin-left: auto; }
.fin-sign th, .fin-sign td { border: 1px solid var(--border); width: 64px; text-align: center; }
.fin-sign th { padding: 4px 6px; background: var(--surface2); font-size: 0.75rem; }
.fin-sign td { height: 44px; }
.fin-carry { border-collapse: collapse; margin: 12px 0 6px auto; margin-left: 120px; }
.fin-carry th, .fin-carry td { border: 1px solid var(--border); padding: 5px 12px; font-size: 0.8125rem; }
.fin-carry th { background: var(--surface2); }
.fin-carry td { min-width: 110px; text-align: right; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.fin-table th, .fin-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.fin-table th { background: var(--surface2); font-weight: 600; }
.fin-table td.num, .fin-table th.num { text-align: right; }
.fin-table td.left { text-align: left; min-width: 130px; }
.fin-table td:not(.left) { white-space: nowrap; }
.fin-table .fin-inc-h { background: color-mix(in srgb, #f2d98c 22%, var(--surface2)); }
.fin-table .fin-exp-h { background: color-mix(in srgb, #9fd6a8 22%, var(--surface2)); }
.fin-table td.fin-inc { background: color-mix(in srgb, #f2d98c 10%, var(--surface)); }
.fin-table td.fin-exp { background: color-mix(in srgb, #9fd6a8 10%, var(--surface)); }
.fin-table .fin-total { background: color-mix(in srgb, #f5993d 25%, var(--surface2)); }
.fin-legend { border: 1px solid var(--border); padding: 8px 12px; margin-top: 12px;
  font-size: 0.8125rem; line-height: 1.9; }
.fin-legend b { color: #d0342c; }
.fin-legend-inc { background: color-mix(in srgb, #f2d98c 14%, var(--surface)); }
.fin-legend-exp { background: color-mix(in srgb, #9fd6a8 14%, var(--surface)); }
.fin-year-table { max-width: 640px; margin: 12px auto 0; }
.fin-year-table .fin-vert { width: 44px; }
.fin-year-table td { height: 30px; }
.fin-year-table .fin-sum th, .fin-year-table .fin-sum td { background: color-mix(in srgb, #f2e05c 35%, var(--surface2)); font-weight: 700; }
.fin-year-table .fin-balance th, .fin-year-table .fin-balance td { background: color-mix(in srgb, #9fd6a8 30%, var(--surface2)); font-weight: 700; }
.fin-matrix th, .fin-matrix td { white-space: nowrap; padding: 6px 7px; }
.fin-matrix .fin-cum th, .fin-matrix .fin-cum td { background: color-mix(in srgb, #f2e05c 30%, var(--surface2)); font-weight: 600; }
.fin-matrix .fin-bal { background: color-mix(in srgb, #9fd6a8 12%, var(--surface)); }
.fin-matrix tbody th a { text-decoration: underline; }

/* 홈 — 관리 종합 표 (관리부 엑셀 종합표 스타일) */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.summary-block { overflow-x: auto; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.summary-table th, .summary-table td {
  border: 1px solid var(--border); padding: 7px 10px; text-align: center; white-space: nowrap;
}
.summary-table .summary-caption {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface2));
  font-size: 0.9375rem; font-weight: 700; padding: 8px;
}
.summary-table thead tr:last-child th { background: var(--surface2); font-weight: 600; }
.summary-table tbody th { background: var(--surface2); font-weight: 600; }
.summary-table tbody td { background: color-mix(in srgb, #f2e05c 12%, var(--surface)); font-weight: 600; }
.summary-table .col-reserved { background: color-mix(in srgb, #35a860 20%, var(--surface)) !important; }
.summary-table thead .col-reserved,
.summary-table .summary-total .col-reserved { background: color-mix(in srgb, #35a860 32%, var(--surface2)) !important; }
.summary-table .summary-total th, .summary-table .summary-total td {
  background: color-mix(in srgb, #f2e05c 30%, var(--surface2)); font-weight: 800;
}
.form-sub { font-weight: 700; margin-top: 14px; font-size: 0.9375rem; }
.form-paper-note { text-align: right; font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.form-footer { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.form-date { text-align: center; font-size: 0.9375rem; }
.form-sign th { width: 40%; }
.sign-cell { text-align: right; color: var(--muted); width: 120px; }
.form-to { font-weight: 700; margin-top: 4px; }

/* 인쇄 (결산/법정보고/매뉴얼) */
.print-only { display: none; }
@media print {
  .no-print, .top-nav, .bottom-nav, .flash-wrap { display: none !important; }
  .print-only { display: block; }
  .print-title { text-align: center; margin-bottom: 12px; }
  .print-title h1 { font-size: 18pt; }
  .print-title p { color: #555; font-size: 10pt; }
  body { background: #fff; }
  .app { max-width: none; }
  .card { border: 1px solid #bbb; box-shadow: none; break-inside: avoid; background: #fff; }
  .print-page { color: #000; }
  .table th, .table td { border-bottom: 1px solid #ccc; }
  .page-break { break-before: page; }
  /* 법정 서식 A4 맞춤 — 원본 서식 비율대로 페이지를 채움 */
  @page { size: A4 portrait; margin: 11mm 12mm; }
  .print-page .page-pad, .page-pad { padding: 0; gap: 0; }
  .content { padding-bottom: 0 !important; }  /* 하단 내비 여백이 빈 페이지를 만들지 않게 */
  .legal-form { border: none !important; padding: 0 !important; box-shadow: none !important; }
  .legal-form .form-table { font-size: 10pt; margin-top: 7px; }
  .legal-form .form-table th, .legal-form .form-table td { padding: 8px 8px; border: 1px solid #555; }
  .legal-form .form-table th { background: #efefef; }
  .legal-form .form-table td.hand { background: #f8f8f8; }
  .legal-form .form-table td { height: 24px; }
  .legal-form-head { margin-bottom: 4mm; }
  .legal-form-head h2 { font-size: 15pt; margin-top: 3mm; }
  .legal-form-head p { font-size: 9pt; }
  .form-table td.tall { height: 52mm; }
  .form-paper-note { margin-top: 4mm; }
  .form-sub { font-size: 10.5pt; margin-top: 4mm; }
  .form-footer { margin-top: 5mm; gap: 3.5mm; font-size: 10pt; }
  .form-date { font-size: 11pt; }
  /* 뒤쪽 명부 — 시신 13행+개장 5행이 1장을 꽉 채우는 고정 크기 (초과 시 2장) */
  .legal-back .form-table { font-size: 9.5pt; margin-top: 4px; }
  .legal-back .form-table th, .legal-back .form-table td { padding: 3.5px 7px; }
  .legal-back .form-table td { height: 13px; }
  .legal-back .legal-form-head { margin-bottom: 2mm; }
  .legal-back .legal-form-head h2 { font-size: 13pt; margin-top: 1.5mm; }
  .legal-back .form-sub { font-size: 10pt; margin-top: 2.2mm; }
  .legal-back .form-footer { margin-top: 2.5mm; gap: 2.2mm; font-size: 9.5pt; }
  .legal-back .form-date { font-size: 10pt; }
  /* 관리부 회계 서식 — 흑백 인쇄 대비 실선/옅은 배경 */
  .fin-report { border: none !important; box-shadow: none !important; padding: 0 !important; }
  .fin-title { font-size: 17pt; margin-top: 8mm; }
  .fin-title .fin-org { color: #1a7a2e; }
  .fin-sub { color: #333; }
  .fin-table { font-size: 9.5pt; }
  .fin-table th, .fin-table td { border: 1px solid #555; padding: 5px 7px; }
  .fin-table th { background: #f3e8d8; }
  .fin-table .fin-inc-h { background: #fdf6d8; }
  .fin-table .fin-exp-h { background: #e4ecd4; }
  .fin-table td.fin-inc { background: #fffcf0; }
  .fin-table td.fin-exp { background: #f4f8ee; }
  .fin-table .fin-total { background: #f8d8b8; }
  .fin-sign th, .fin-sign td { border: 1px solid #555; }
  .fin-sign th { background: #efefef; }
  .fin-carry th, .fin-carry td { border: 1px solid #555; }
  .fin-carry th { background: #efefef; }
  .fin-legend { border: 1px solid #555; }
  .fin-legend-inc { background: #fdf6d8; }
  .fin-legend-exp { background: #e4ecd4; }
  .fin-year-table .fin-sum th, .fin-year-table .fin-sum td { background: #f7ef9e; }
  .fin-year-table .fin-balance th, .fin-year-table .fin-balance td { background: #d9e8cf; }
  .fin-matrix .fin-cum th, .fin-matrix .fin-cum td { background: #f7ef9e; }
  .fin-matrix { font-size: 8pt; }
  .fin-matrix th, .fin-matrix td { padding: 3.5px 4px; }
  /* 브라우저 머리글/바닥글(날짜·URL) 제거 — 페이지 여백 0 + 본문 패딩으로 대체.
     서식류(.no-hf)에만 적용 (매뉴얼처럼 여러 장 흐르는 문서는 기존 여백 유지) */
  @page clean { size: A4 portrait; margin: 0; }
  .no-hf { page: clean; padding: 11mm 12mm !important; }
  .no-hf .page-break { padding-top: 11mm; }
  /* 매트릭스는 가로 인쇄 */
  @page fin-wide { size: A4 landscape; margin: 0; }
  .fin-landscape { page: fin-wide; padding: 9mm 10mm !important; }
  .fin-landscape .grid-scroll { overflow: visible; }
}

/* 오버레이 편집기 */
#ed-svg { cursor: crosshair; }
.ed-dim { opacity: .18 !important; pointer-events: none; }
.ed-handle {
  fill: #ffffff; stroke: #1f2a44; stroke-width: 3; cursor: grab;
}
.ed-handle:hover { fill: #ffd76a; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.section-card .stat-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* 구역 격자 — 줄 단위 카드형 (화면 폭에 맞춰 자동 줄바꿈) */
.map-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.8125rem; }
.grid-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-row-block { display: flex; flex-direction: column; gap: 7px; }
.grid-row-block + .grid-row-block { border-top: 1px dashed var(--border); padding-top: 12px; }
.grid-row-label { font-size: 0.8125rem; font-weight: 700; color: var(--text2); }
.grid-row { display: flex; flex-wrap: wrap; gap: 6px; }
.plot-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  width: 86px; min-height: 62px; padding: 6px 4px;
  border-radius: 10px; border: 1px solid var(--border);
  text-align: center; overflow: hidden;
}
.plot-cell b { font-size: 0.9375rem; line-height: 1.1; }
.plot-cell span {
  font-size: 0.75rem; line-height: 1.2; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; opacity: .85;
}
.plot-cell.st-empty { border-style: dashed; }
.plot-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
@media (max-width: 480px) {
  .plot-cell { width: calc((100% - 12px) / 3); }  /* 폰에서 3열 맞춤 */
}

/* 검색/테이블 */
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.search-main { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.search-main input { flex: 1; }
.search-bar select {
  padding: 9px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}
.search-bar input {
  flex: 1; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}
.table-card { padding: 6px 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th { color: var(--text2); font-size: 0.75rem; font-weight: 600; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }

/* 상세 폼 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; color: var(--text2); }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}
.span-all { grid-column: 1 / -1; }
.right { text-align: right; }
.row-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.row-item:last-child { border-bottom: none; }
.small-text { font-size: 0.8125rem; margin-top: 2px; }

/* 인라인 편집 (details) */
.edit-item summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.edit-item summary::-webkit-details-marker { display: none; }
.edit-item summary::after { content: '✎'; color: var(--muted); font-size: 0.75rem; margin-left: auto; }
.inner-form { margin-top: 10px; padding: 10px; background: var(--surface2); border-radius: var(--radius); }
.add-form { margin-top: 8px; }
.add-form summary { list-style: none; cursor: pointer; display: inline-block; }
.add-form summary::-webkit-details-marker { display: none; }
.btn.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

/* 관리비 / 장부 */
.summary-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; }
.summary-row > div { display: flex; flex-direction: column; gap: 2px; }
.warn-text { color: var(--warn); }
.income-text { color: var(--income); }
.expense-text { color: var(--expense); }
.inline-form { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.inline-form input {
  padding: 6px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); font-size: 0.8125rem;
}
.inline-form input[type="date"] { width: 132px; }
/* 납부 관리 표: 긴 안내문은 줄바꿈 허용 (표가 카드 밖으로 밀려 잘리는 것 방지) */
.fee-table td.col-act { white-space: normal; min-width: 260px; }
.fee-table .note { display: block; white-space: normal; max-width: 170px; line-height: 1.4; }
.fee-table td:not(.col-act) .small-text { white-space: nowrap; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.charge-card summary { cursor: pointer; list-style: none; }
.charge-card summary::-webkit-details-marker { display: none; }
.fee-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.page-head select, .head-actions select {
  padding: 7px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}

/* 금액 계산기 패드 */
#calc-pad {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.calc-disp {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 10px;
  padding: 4px 6px 10px; min-height: 34px;
  font-size: 1.375rem; font-weight: 700; letter-spacing: .5px;
  overflow-x: auto; white-space: nowrap;
}
.calc-disp .muted { font-size: 0.9375rem; font-weight: 500; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calc-keys button {
  padding: 12px 0; font-size: 1.125rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface2); color: var(--text); cursor: pointer;
}
.calc-keys button:active { transform: scale(.96); }
.calc-keys .calc-ok { background: var(--primary); color: var(--on-primary); border-color: transparent; }

/* 2분할 복귀 버튼 — 홈 헤더(그룹명 ↔ 설정 사이), 2분할을 꺼둔 넓은 화면에서만 표시 */
#dual-btn.dual-icon {
  border: 1px solid var(--border); background: var(--surface);
  font-size: 1rem; font-weight: 700;
}

/* 2분할(듀얼) 화면 — 폴드 펼침 / 와이드 PC
   높이를 100dvh로 잡으면 안드로이드 엣지투엣지에서 제스처 바 아래까지
   포함되어 패널 하단이 잘림 → 고정 배치(bottom:0)로 단일 화면 메뉴와
   같은 기준선을 사용 */
.dual-body { margin: 0; padding: 0 !important; background: var(--bg); }
.dual-wrap {
  display: flex;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
}
.dual-wrap iframe {
  flex: 1; min-width: 0; height: 100%; border: none;
  background: var(--bg);
}
.dual-div {
  width: 14px; flex-shrink: 0; position: relative;
  background: var(--surface2); border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.dual-div button {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 48px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 0.8125rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
