:root {
  color-scheme: light;
  --brand-cream: #f4efe4;
  --brand-moss: #4a6b4d;
  --bg: #f4efe4;
  --surface: #fbf8f0;
  --surface-soft: #eee7d8;
  --line: #d8cebd;
  --line-strong: #b8ad99;
  --text: #253228;
  --muted: #6c715f;
  --primary: #4a6b4d;
  --primary-strong: #314a34;
  --primary-soft: #e3eadb;
  --accent: #8d6848;
  --amber: #9a7441;
  --blue: #506b71;
  --danger: #a64035;
  --shadow: 0 18px 44px rgba(74, 107, 77, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Pretendard",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button,
select,
input[type="file"] {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  transition:
    border 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

select[multiple] {
  min-height: 128px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 107, 77, 0.16);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.helper-spacer {
  visibility: hidden;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
}

.check-label input {
  width: auto;
  min-width: 18px;
  height: 18px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 520px);
  background: var(--brand-cream);
}

.login-brand {
  display: flex;
  min-height: 100vh;
  align-items: center;
  padding: 48px;
  color: var(--primary);
}

.brand-stack {
  max-width: 560px;
}

.brand-logo {
  width: min(100%, 470px);
  display: block;
  margin-bottom: 28px;
}

.brand-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.brand-stack h1 {
  margin: 0 0 18px;
  font-size: 34px;
  font-weight: 850;
  line-height: 1.16;
  color: var(--primary-strong);
}

.brand-stack p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(74, 107, 77, 0.08);
}

.auth-box {
  width: min(100%, 440px);
  display: grid;
  gap: 18px;
}

.auth-box h2 {
  margin: 0;
  font-size: 24px;
}

.auth-box p {
  margin: 0;
  color: var(--muted);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #efe9dc;
}

.sidebar-head {
  display: grid;
  gap: 8px;
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.church-name {
  display: block;
}

.church-logo {
  width: 100%;
  max-width: 205px;
  display: block;
  object-fit: contain;
}

.shortcut-status {
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.role-pill {
  width: fit-content;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 14px 12px;
}

.nav button,
.user-line,
.quick-account,
.tab-button,
.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav button {
  justify-content: flex-start;
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: #596650;
  padding: 0 12px;
  font-weight: 800;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.nav svg,
.button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-foot > .secondary-button {
  justify-content: flex-start;
}

.user-line {
  justify-content: flex-start;
  min-width: 0;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-line strong,
.user-line span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 239, 228, 0.9);
  backdrop-filter: blur(16px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sync-pill.saving,
.sync-pill.loading {
  background: #f0dfc2;
  color: var(--amber);
}

.sync-pill.saved {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.sync-pill.error {
  background: #f0ded8;
  color: var(--danger);
}

.main {
  min-width: 0;
  padding: 24px 28px 42px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(74, 107, 77, 0.07);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.section-title {
  margin: 0;
  font-size: 17px;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 18px;
}

.stat {
  display: grid;
  gap: 8px;
  padding: 17px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat strong {
  font-size: 28px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.stat em {
  color: var(--primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar .grow {
  flex: 1 1 240px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button,
.tab-button,
.quick-account {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 850;
  transition:
    transform 130ms ease,
    background 130ms ease,
    color 130ms ease,
    border 130ms ease;
}

.primary-button {
  background: var(--primary);
  color: var(--brand-cream);
}

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

.secondary-button {
  border: 1px solid var(--line-strong);
  background: #fffdf8;
  color: var(--text);
}

.secondary-button:hover,
.ghost-button:hover {
  background: var(--surface-soft);
}

.danger-button {
  background: #f0ded8;
  color: var(--danger);
}

.danger-button:hover {
  background: #e8d0c8;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--muted);
}

.icon-button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.sort-button,
.link-button {
  min-height: 30px;
  padding: 0;
  background: transparent;
  color: inherit;
  font-weight: 900;
  text-align: left;
}

.sort-button {
  color: var(--muted);
}

.sort-button:hover,
.sort-button.active,
.link-button:hover {
  color: var(--primary-strong);
}

.link-button {
  color: var(--primary);
}

.tabbar {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tab-button {
  min-height: 34px;
  flex: 1;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: #fffdf8;
  color: var(--primary-strong);
  box-shadow: 0 5px 14px rgba(74, 107, 77, 0.1);
}

.quick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-account {
  justify-content: flex-start;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--text);
  text-align: left;
}

.quick-account:hover {
  border-color: var(--primary);
}

.quick-account span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  min-height: 22px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.success {
  color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.photo-edit {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.photo-edit .avatar {
  width: 72px;
  height: 72px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

td {
  color: var(--text);
}

tbody tr:hover {
  background: #f8f1e6;
}

.nowrap {
  white-space: nowrap;
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.member-cell .avatar {
  width: 38px;
  height: 38px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.green {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge.orange {
  background: #f0dfc2;
  color: var(--amber);
}

.badge.blue {
  background: #dfe8e5;
  color: var(--blue);
}

.badge.public {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge.care {
  background: #dfe8e5;
  color: var(--blue);
}

.badge.pastor {
  background: #edddd3;
  color: var(--accent);
}

.badge.private {
  background: #f0dfc2;
  color: var(--amber);
}

.badge.urgent {
  background: #f0ded8;
  color: var(--danger);
}

.badge.period {
  background: #f0dfc2;
  color: var(--amber);
}

.badge.normal {
  background: var(--surface-soft);
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.person-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
  color: inherit;
  text-align: left;
}

.person-card-button:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(74, 107, 77, 0.1);
}

.person-card-button:focus-visible {
  outline: 3px solid rgba(74, 107, 77, 0.24);
  outline-offset: 2px;
}

.person-card .avatar {
  width: 66px;
  height: 66px;
}

.person-card h3 {
  margin: 0;
  font-size: 16px;
}

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

.person-card p + p {
  margin-top: 4px;
}

.photo-view {
  display: grid;
  gap: 14px;
}

.photo-view img {
  width: 100%;
  max-height: 68vh;
  display: block;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-soft);
}

.photo-view h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.photo-view p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.qt-detail {
  display: grid;
  gap: 16px;
}

.qt-detail h3 {
  margin: 0;
  font-size: 24px;
}

.qt-detail p {
  margin: 0;
  white-space: pre-wrap;
}

.qt-detail.compact h3 {
  font-size: 21px;
}

.video-frame {
  overflow: hidden;
  border-radius: 8px;
  background: #1f2b22;
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.inline-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.bulk-table {
  min-width: 1080px;
}

.bulk-table input,
.bulk-table select {
  min-width: 140px;
  min-height: 46px;
  padding: 12px;
  font-size: 15px;
}

.bulk-table .bulk-name input {
  min-width: 170px;
}

.bulk-table .bulk-match {
  min-width: 150px;
}

.bulk-table .bulk-amount input {
  min-width: 150px;
}

.bulk-table .bulk-memo input {
  min-width: 240px;
}

.match-text {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.match-text.ok {
  color: var(--primary-strong);
}

.match-text.warn {
  color: var(--amber);
}

.match-text.bad {
  color: var(--danger);
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list.compact {
  gap: 6px;
}

.info-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.info-row span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.care-card-list {
  display: grid;
  gap: 12px;
}

.care-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.care-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.care-card h3 {
  margin: 0;
  font-size: 16px;
}

.care-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.care-search-results {
  display: grid;
  gap: 14px;
}

.care-search-card {
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.care-search-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.certificate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.certificate-button {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.certificate-button:disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.shortcut-hero {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
}

.shortcut-hero strong {
  font-size: 18px;
}

.shortcut-hero span {
  color: var(--muted);
  font-weight: 750;
}

.prayer-list {
  display: grid;
  gap: 12px;
}

.prayer-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.prayer-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #fffdf8;
  color: inherit;
  padding: 14px;
  text-align: left;
}

.prayer-card.public {
  border-left-color: var(--primary);
  background: #fffdf8;
}

.prayer-card.care {
  border-left-color: var(--blue);
  background: #f6f4ea;
}

.prayer-card.pastor {
  border-left-color: var(--accent);
  background: #fbf0e6;
}

.prayer-card.private {
  border-left-color: var(--amber);
  background: #fbf4e5;
}

.prayer-card.completed {
  border-left-color: var(--line-strong);
  background: #f2eadc;
}

.prayer-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(74, 107, 77, 0.1);
}

.prayer-card:focus-visible {
  outline: 3px solid rgba(74, 107, 77, 0.24);
  outline-offset: 2px;
}

.prayer-card h3 {
  margin: 0;
  font-size: 16px;
}

.prayer-card p {
  min-height: 58px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.prayer-detail {
  display: grid;
  gap: 14px;
}

.prayer-detail h3 {
  margin: 0;
  font-size: 22px;
}

.prayer-detail p {
  margin: 0;
  white-space: pre-wrap;
}

.completion-note {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.completion-note p {
  margin: 0;
}

.comment-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.comment-section h4 {
  margin: 0;
  font-size: 15px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 11px;
}

.comment-item p {
  margin: 0;
}

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

.comment-form textarea {
  min-height: 84px;
}

.comment-empty {
  min-height: 84px;
}

.prayer-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.prayer-item header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prayer-item h3 {
  margin: 0;
  font-size: 16px;
}

.prayer-item p {
  margin: 0;
  color: var(--text);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(251, 248, 240, 0.55);
  text-align: center;
  padding: 22px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgba(37, 50, 40, 0.36);
}

.drawer {
  width: min(100%, 560px);
  height: 100%;
  overflow: auto;
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(37, 50, 40, 0.18);
}

.drawer.wide-drawer {
  width: min(100%, 980px);
}

.drawer header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.95);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.drawer h2 {
  margin: 0;
  font-size: 20px;
}

.drawer .body {
  padding: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.mobile-menu {
  display: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .login-shell,
  .app-shell,
  .grid.two,
  .grid.three,
  .grid.four,
  .certificate-grid {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 270px;
    padding: 30px;
  }

  .brand-stack h1 {
    font-size: 31px;
  }

  .login-panel {
    min-height: auto;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 14px 16px;
  }

  .main {
    padding: 18px 16px 34px;
  }
}

@media (max-width: 620px) {
  .login-brand {
    min-height: 220px;
  }

  .login-panel {
    padding: 20px;
  }

  .auth-card,
  .panel-body {
    padding: 15px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .quick-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .photo-edit {
    grid-template-columns: 1fr;
  }
}
