/* 13번: 상·하 카드 섹션 (다른 기능 페이지와 동일한 card + h2 위계) */
.page-bk {
  overflow-x: clip;
  max-width: 100%;
}

.page-bk .bk-section h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-bk .bk-secure-section-hint {
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--border-default) 88%, transparent);
  max-width: 62ch;
  line-height: 1.5;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.8125rem;
}

.page-bk .bk-section-foot {
  color: var(--color-text-secondary);
  line-height: 1.55;
}

.page-bk #excel-control-root {
  margin-top: 10px;
}

.page-bk .bk-export-lead {
  max-width: 68ch;
  line-height: 1.6;
}

/* 백업: 암호화 영역 — 오토레이아웃 랩 */
.page-bk .bk-section--secure .bk-panel--backup .bk-action-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.page-bk .bk-section--secure .bk-pass-input {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.page-bk .bk-panel--backup .bk-pass-wrap--compact {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  width: auto;
}

/* 복원: 파일 선택 → 파일명 → 비밀번호·눈 → 복원 (가로, 추후 수치 조정용 그리드) */
.bk-restore-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.35fr) auto;
  gap: 8px 10px;
  align-items: center;
  margin-top: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.bk-pass-wrap--restore-inline {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.page-bk .bk-pass-wrap--restore-inline .bk-pass-input {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 480px) {
  .page-bk .bk-pass-wrap--restore-inline {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .page-bk .bk-pass-wrap--restore-inline .bk-pass-input {
    max-width: 16rem;
    width: 100%;
    box-sizing: border-box;
  }
}

.bk-h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

.bk-card .bk-h2,
.page-bk .bk-section .bk-h2 {
  margin: 0;
}

.bk-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.bk-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bk-panel__lead {
  margin: 0;
  line-height: 1.55;
  color: var(--color-text-secondary);
}

.bk-pass-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-text-muted);
  font-weight: 500;
}

.bk-pass-hint--below-title {
  margin: 8px 0 0;
  max-width: 52ch;
}

.bk-restore-err {
  margin: 8px 0 0;
  min-height: 0;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.45;
  color: var(--color-expense);
}

.bk-restore-err:empty {
  display: none;
}

@media (max-width: 900px) {
  .bk-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .bk-restore-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .bk-restore-toolbar .bk-file-name {
    flex: 1 1 140px;
    min-width: 0;
  }

  .bk-restore-toolbar .bk-pass-wrap--restore-inline {
    flex: 1 1 min(100%, 280px);
    min-width: 12ch;
  }

  .bk-restore-toolbar #btn-restore {
    flex: 0 0 auto;
  }
}

/* 한 줄: 비밀번호(축소) + 눈 아이콘 + 실행 버튼 */
.bk-action-line {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.bk-pass-wrap--compact {
  flex: 1 1 220px;
  max-width: min(100%, 380px);
  min-width: 0;
  width: auto;
}

.bk-action-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding-left: 18px;
  padding-right: 18px;
  align-self: stretch;
}

.bk-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  width: 100%;
}

.bk-file-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding-left: 16px;
  padding-right: 16px;
}

.bk-file-name {
  flex: 1 1 140px;
  min-width: 0;
  padding: 6px 2px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .bk-action-line {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-pass-wrap--compact {
    max-width: none;
  }

  .page-bk .bk-panel--backup .bk-pass-wrap--compact {
    max-width: none;
  }

  .bk-action-btn {
    width: 100%;
  }

  .bk-restore-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-restore-toolbar #btn-restore {
    width: 100%;
  }
}

.mc-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
}

.mc-modal__panel {
  width: min(720px, calc(100vw - 32px));
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--border-default) 70%, transparent);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  padding: 18px 18px;
  color: var(--color-text-primary);
}

.mc-modal__title {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.mc-modal__desc {
  margin-top: 10px;
  color: var(--color-text-secondary);
  line-height: 1.65;
  font-weight: 650;
}

.mc-modal__actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mc-modal__btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  font-weight: 850;
}

.mc-modal__btn--primary {
  border-color: color-mix(in srgb, var(--color-primary) 42%, var(--border-default));
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface));
}

/* 비밀번호: 머니 캘린더 공통 입력 높이·테두리와 정렬 */
.bk-pass-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.bk-pass-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--color-surface);
  color: var(--color-text-primary);
  min-height: 48px;
  font-size: 1rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

html[data-theme="dark"] .bk-pass-input {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

.bk-pass-toggle {
  flex: 0 0 auto;
  width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

html[data-theme="dark"] .bk-pass-toggle {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.32);
}

.bk-pass-toggle:hover {
  color: var(--color-text-primary);
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--border-default));
}

.bk-pass-toggle[aria-pressed="true"] {
  color: var(--color-primary);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--border-default));
}

.bk-pass-toggle__icon {
  display: block;
  pointer-events: none;
}

/* 13번 — 2~12번과 동일한 선이 있는 데이터 표 */
.page-bk .table-wrap--data {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-sizing: border-box;
}

.page-bk .table-wrap--data .data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  table-layout: auto;
}

.page-bk .table-wrap--data .data-table th,
.page-bk .table-wrap--data .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  text-align: center;
  font-size: 0.9375rem;
  vertical-align: middle;
  font-weight: 500;
}

.page-bk .table-wrap--data .data-table thead th {
  background: var(--color-bg-soft);
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
  text-align: center;
}

.page-bk .table-wrap--data .data-table tbody th[scope="row"] {
  font-weight: 800;
  color: var(--color-text-primary);
  background: color-mix(in srgb, var(--color-bg-soft) 75%, var(--color-surface));
}

.page-bk .table-wrap--data .data-table tbody tr:last-child th,
.page-bk .table-wrap--data .data-table tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 600px) {
  .page-bk .table-wrap--data .data-table th,
  .page-bk .table-wrap--data .data-table td {
    padding: 10px 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: keep-all;
  }

  .page-bk .table-wrap--data .data-table thead th {
    font-size: 0.75rem;
  }
}
