/* Lambkin — 중앙성결교회 출석부
   미니멀/모던 톤: 따뜻한 오프화이트 + 캐러멜 포인트 컬러, 앱처럼 보이는 하단 내비게이션 */

@font-face {
  font-family: "Pretendard Variable";
  src: url("/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-muted: #f3efe9;
  --border: #ece5da;
  --text: #2b2622;
  --text-muted: #8a8078;
  --accent: #c08552;
  --accent-strong: #a86a3c;
  --accent-soft: #f3e4d2;
  --danger: #cf6a52;
  --ok: #5c8a63;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --nav-h: 76px;
  --shadow: 0 8px 24px rgba(43, 38, 34, 0.08);
  color-scheme: light;
}

/* 다크모드는 시스템 설정이 아니라 마이 > 화면 설정에서 직접 켠 경우에만 적용된다 (기본값: 화이트). */
:root[data-theme="dark"] {
  --bg: #1c1a18;
  --surface: #262320;
  --surface-muted: #2d2a26;
  --border: #3a3530;
  --text: #f1ece5;
  --text-muted: #a89e92;
  --accent: #d99a63;
  --accent-strong: #e3ab7a;
  --accent-soft: #3a2f24;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font-family: inherit;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 20px calc(var(--nav-h) + 28px);
  position: relative;
}

/* 헤더 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 12px;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand .mark {
  font-size: 22px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* 카드 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card + .card {
  margin-top: 0;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}

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

.dept-name {
  font-weight: 700;
  font-size: 15px;
}

.dept-stat {
  font-size: 13px;
  color: var(--text-muted);
}

.dept-stat b {
  color: var(--accent-strong);
  font-weight: 700;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
}

.btn:active {
  background: var(--accent-strong);
}

.btn.secondary {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.small {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}

/* 로그인 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-mark {
  font-size: 44px;
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.field {
  text-align: left;
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.field input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.error-box {
  background: #fbeae4;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 출석체크 */
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}

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

/* 출석체크 화면 — 토글 줄 + 메모 입력 줄이 세로로 쌓인다 (명단관리 등 .member-row와는 다른 레이아웃이라 분리) */
.attendance-row {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

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

.member-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.member-info {
  display: flex;
  align-items: baseline;
}

.member-name,
.member-name-btn {
  font-weight: 600;
  font-size: 15px;
}

.member-name-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.member-name-btn:active {
  color: var(--accent-strong);
}

.member-tag {
  display: inline-block;
  min-width: 40px;
  margin-right: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.member-checks {
  display: flex;
  align-items: center;
  gap: 18px;
}

.member-checks-header .member-checks span {
  display: inline-block;
  width: 22px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.attendance-check {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ok);
  cursor: pointer;
}

.offering-check {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.date-bar input[type="date"] {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
}

/* 캘린더 */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 14px;
}

.calendar-nav .month-label {
  font-weight: 800;
  font-size: 16px;
}

.calendar-nav a {
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px 10px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays {
  margin-bottom: 4px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}

.calendar-day.out-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.calendar-day.is-today {
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.calendar-day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.calendar-day .dots {
  display: flex;
  gap: 3px;
  height: 5px;
}

.calendar-day .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.calendar-day.is-selected .dot {
  background: rgba(255, 255, 255, 0.85);
}

.calendar-day .dot.special {
  background: var(--danger);
}

.day-list-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 10px;
}

.day-list-header .date {
  font-weight: 800;
  font-size: 15px;
}

.day-item {
  border-bottom: 1px solid var(--border);
}

.day-item:last-child {
  border-bottom: none;
}

.day-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

button.day-item-row {
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}

button.day-item-row:active,
a.day-item-row:active,
a.day-item-row.active {
  background: var(--surface-muted);
}

.day-item .name {
  font-weight: 700;
  font-size: 14px;
}

.day-item .scope {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.day-item .time {
  font-size: 13px;
  color: var(--text-muted);
}

.day-item .time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.badge.special {
  color: var(--danger);
  background: #fbeae4;
}

/* 일정 */
.event-row {
  display: flex;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}

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

.event-date {
  flex-shrink: 0;
  width: 52px;
  text-align: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: var(--radius-sm);
  padding: 6px 0;
  font-weight: 700;
  font-size: 13px;
}

.event-date .dow {
  display: block;
  font-size: 10px;
  font-weight: 500;
}

.event-title {
  font-weight: 700;
  font-size: 14px;
}

.event-scope {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 마이 */
.profile-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px 20px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.profile-name {
  font-weight: 800;
  font-size: 17px;
}

.badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

/* 맨 위로 — 목록이 긴 화면(출석체크 등)에서 스크롤 없이 위로 돌아가는 버튼 */
.scroll-top-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + 14px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.scroll-top-wrap .inner {
  width: 100%;
  max-width: 480px;
  position: relative;
}

.scroll-top-btn {
  position: absolute;
  right: 20px;
  bottom: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 18px;
  cursor: pointer;
  pointer-events: auto;
}

/* 하단 내비게이션 — 앱처럼 보이는 바 */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.bottom-nav .bar {
  pointer-events: auto;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 10px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item.active {
  color: var(--accent-strong);
}

.nav-item.home {
  margin-top: -26px;
  color: #fff;
}

.nav-item.home .home-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 16px rgba(192, 133, 82, 0.45);
  border: 4px solid var(--bg);
}

.nav-item.home span.label {
  color: var(--text-muted);
  margin-top: 1px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 22px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

form.inline-form {
  display: grid;
  gap: 10px;
}

form.inline-form input,
form.inline-form select {
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* 계정 관리 */
.account-row {
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
}

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

.account-row .account-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.account-row .account-name {
  font-weight: 700;
  font-size: 14px;
}

.account-row .account-username {
  font-size: 12px;
  color: var(--text-muted);
}

a.account-row {
  color: inherit;
}

a.account-row:active {
  background: var(--surface-muted);
}

.dept-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dept-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
}

.dept-check input {
  width: auto;
}

/* 계정 생성 모달 */
dialog.modal {
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  box-shadow: var(--shadow);
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h2 {
  font-size: 17px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* 계정 목록 페이지네이션 */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 16px 0;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.page-link.current {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
