/*
  파일 역할: 휴대폰 크기 맞춤. 휴대폰 기준 너비 768px은 이 파일에만 적는다.
  (CSS 변수는 @media 안에서 쓸 수 없어서 숫자를 직접 적었다. JS 쪽 같은 값: js/constants.js의 BREAKPOINT_PX)
  기준을 바꾸려면 아래 767.98px과 BREAKPOINT_PX를 함께 바꾼다.
*/
@media (max-width: 767.98px) {
  /* 머리글은 앱 이름만 작게 */
  .site-header__inner {
    height: 52px;
  }

  .site-header__user {
    display: none;
  }

  /* 공통 메뉴: 화면 아래에 고정 */
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-header);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .main-nav__list {
    height: var(--bottom-nav-height);
    gap: 0;
  }

  .main-nav__list > li {
    flex: 1;
    min-width: 0;
  }

  .main-nav__item {
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 var(--space-1);
    font-size: var(--font-size-xs);
    border-radius: 0;
  }

  .main-nav__item .nav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 12px);
  }

  /* PC에서만 보이는 메뉴 (관리 → 휴대폰은 '내 정보' 안에서 들어감) */
  .main-nav .pc-only {
    display: none;
  }

  /* 아래 메뉴에 내용이 가리지 않게 */
  body.has-nav .main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-6) + env(safe-area-inset-bottom));
  }

  body.has-nav .toast-region {
    bottom: calc(var(--bottom-nav-height) + var(--space-3) + env(safe-area-inset-bottom));
  }

  body.has-nav .test-box {
    bottom: calc(var(--bottom-nav-height) + var(--space-2) + env(safe-area-inset-bottom));
  }

  .main {
    padding: var(--space-4) var(--space-3) var(--space-6);
  }

  /* S7 처리 버튼 묶음: 휴대폰은 아래 메뉴 바로 위에 고정 (PC는 제목 옆 그대로, 마스터 결정 2026-11-20) */
  .request-actions--page {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-header);
    flex-wrap: nowrap;
    height: var(--action-bar-height);
    align-items: center;
    padding: 0 var(--space-3);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }

  .request-actions--page .btn {
    flex: 1;
    min-width: 0;
    padding-inline: var(--space-2);
  }

  body.has-nav .request-actions--page {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  /* 고정 버튼 줄이 있으면 본문 끝·알림·시험 상자를 그만큼 위로 */
  body.has-nav .main:has(.request-actions--page) {
    padding-bottom: calc(var(--bottom-nav-height) + var(--action-bar-height) + var(--space-6) + env(safe-area-inset-bottom));
  }

  body.has-nav:has(.request-actions--page) .toast-region {
    bottom: calc(var(--bottom-nav-height) + var(--action-bar-height) + var(--space-3) + env(safe-area-inset-bottom));
  }

  body.has-nav:has(.request-actions--page) .test-box {
    bottom: calc(var(--bottom-nav-height) + var(--action-bar-height) + var(--space-2) + env(safe-area-inset-bottom));
  }

  /* S8 목록 카드 안의 처리 칸: 버튼을 줄 전체로 */
  .data-list td[data-label="처리"] {
    display: block;
  }

  .data-list td[data-label="처리"]::before {
    display: none;
  }

  .request-actions--row .btn {
    flex: 1;
  }

  /* 달력: 칸을 낮게, 이름은 한 줄 (자세한 이름은 아래 "이 달의 공휴일" 목록) */
  .cal__cell {
    min-height: 52px;
  }

  .cal__day {
    padding: var(--space-1);
  }

  .cal__label {
    -webkit-line-clamp: 1;
  }

  .cal__head .btn {
    padding-inline: var(--space-2);
  }

  .card {
    padding: var(--space-4);
  }

  .test-box {
    right: var(--space-2);
    max-width: calc(100vw - 2 * var(--space-2));
  }

  /* 목록 표 → 줄마다 카드 모양 */
  .data-list,
  .data-list tbody,
  .data-list tr,
  .data-list td {
    display: block;
    width: 100%;
  }

  .data-list {
    background: none;
    border: 0;
  }

  .data-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-list tr {
    margin-bottom: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }

  .data-list td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-1) 0;
    border: 0;
  }

  .data-list td::before {
    content: attr(data-label);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
  }

  .data-list td.is-number {
    text-align: right;
  }

  .info-list__row {
    grid-template-columns: 6.5em 1fr;
  }

  .stat-list__value {
    font-size: var(--font-size-xl);
  }

  .dialog__actions {
    flex-direction: column-reverse;
  }

  .dialog__actions .btn {
    width: 100%;
  }
}

/* 휴대폰에서만 보이는 것 (예: S11 "이 달의 공휴일" 목록) */
@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
}
