/* ============================================================
   v2 mobile canvas (P0-d) — @media (max-width: 767px)
   하단 5탭(홈·일보·＋·사진·전체) + 모바일 헤더. 사이드바·상단바는 숨긴다.
   ============================================================ */
@media (max-width: 767px) {
  :root { --fs-2xs: 11px; }   /* 폰에서는 10.5px 칩 글자를 11px 로 (작은 글자 보정) */
  body { font-size: var(--fs-md); }

  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
  .sidebar, .topbar { display: none !important; }
  .m-header { display: flex; }
  .tabbar   { display: flex; }

  .app-content { padding: 12px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
  .view { gap: 10px; }

  /* PC 전용 요소 숨김 */
  .pc-only { display: none !important; }

  /* 형태: 카드 반경 16, 탭 타겟 44 */
  .card, .section-card { border-radius: var(--r-2xl); }
  .btn { min-height: 38px; font-size: var(--fs-base); }
  .btn-sm { min-height: 32px; }
  .btn-icon { width: 38px; }
  .input, .form-input, .select { min-height: var(--hit); font-size: 16px; } /* iOS 확대 방지 16px */
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl { font-size: var(--fs-sm); }

  /* 모든 모달은 바텀시트 모양 (uiOpenModal은 .sheet를 붙이고, 옛 JS 모달도 같은 모양) */
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal, .modal[data-size], .modal-lg, .modal[data-mode="sheet"] {
    width: 100%; max-width: 100%; min-width: 0 !important;
    max-height: 90vh;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .ui-dlg { padding: var(--sp-5) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px)); }
  .ui-dlg .btn { min-height: 48px; flex: 1; }

  .toast { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px)); }

  /* ── 모바일 일보 캔버스 (R3) — .dm-* : 카드 16px · 헤더 색 점 · 금액 우측 tabular · 하단 네이비 합계 바 ── */
  #daily-mobile-root { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }   /* 하단 합계 바(≈64px)에 마지막 카드의 버튼이 가리지 않게 */
  .dm-datebar {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 10px; padding: 6px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-2xl);
  }
  .dm-dnav, .dm-tool {
    flex: 0 0 var(--hit); min-height: var(--hit);
    border-radius: var(--r-lg); color: var(--navy-ink);
    font-size: 20px; font-weight: var(--fw-bold); line-height: 1;
  }
  .dm-dnav:active, .dm-tool:active { background: var(--navy-soft); }
  .dm-tool { background: var(--gray-soft); font-size: 17px; }
  /* 라벨 있는 도구 버튼 (전일복사·도구) — 아이콘만 있으면 뜻을 알기 어렵다 */
  .dm-tool.dm-tool-l { flex: 0 0 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  .dm-tool-l small { font-size: 10px; font-weight: var(--fw-semi); line-height: 1; color: var(--mute); }
  .dm-date {
    position: relative; flex: 1; min-width: 0; min-height: var(--hit);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; cursor: pointer;
  }
  .dm-date-t { font-size: var(--fs-lg); font-weight: var(--fw-extra); letter-spacing: -.01em; }
  .dm-date-w { font-size: var(--fs-xs); color: var(--mute); font-weight: var(--fw-semi); }
  .dm-status { margin-left: 4px; vertical-align: 1px; }
  .dm-date input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
  .dm-banners { display: flex; flex-direction: column; gap: 8px; }
  .dm-banners:empty { display: none; }
  .dm-banners:not(:empty) { margin-bottom: 10px; }
  .dm-banners .banner { border-radius: var(--r-lg); }
  .dm-banners .btn { min-height: var(--hit); }
  /* 배너 접기 — 여러 줄 대신 한 줄 칩 "⚠ 요약 ▾", 누르면 펼침 (js/ui/daily-tools.js _uiBannerFoldSync) */
  .dm-banners[data-fold="1"] .banner-chip {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--hit); padding: 0 14px;
    border-radius: var(--r-lg); background: var(--amber-soft); color: var(--ink);
    font-size: var(--fs-sm); font-weight: var(--fw-semi); text-align: left;
  }
  .dm-banners[data-fold="1"] .banner-chip-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dm-banners[data-fold="1"][data-open="1"] .banner-chip > svg:last-child { transform: rotate(180deg); }
  .dm-banners[data-fold="1"][data-open="0"] .banner { display: none; }

  .dm-card {
    margin-bottom: 10px; padding: 0 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-2xl);
  }
  .dm-card[data-cat="eq"] { --cat: var(--cat-eq); }
  .dm-card[data-cat="lb"] { --cat: var(--cat-lb); }
  .dm-card[data-cat="mt"] { --cat: var(--cat-mt); }
  .dm-card[data-cat="ex"] { --cat: var(--cat-ex); }
  .dm-card[data-cat="os"] { --cat: var(--cat-os); }
  .dm-card[data-cat="wk"] { --cat: var(--ink); }
  .dm-sec-head { display: flex; align-items: center; gap: 8px; min-height: 52px; cursor: pointer; user-select: none; }
  /* 이모지 아이콘은 가리고 카테고리 색 점으로 대신한다 */
  .dm-sec-ico { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cat, var(--mute)); font-size: 0; overflow: hidden; }
  .dm-sec-label { font-size: var(--fs-lg); font-weight: var(--fw-extra); }
  .dm-sec-cnt { font-size: var(--fs-xs); color: var(--mute); font-weight: var(--fw-semi); }
  .dm-sec-amt { margin-left: auto; font-size: var(--fs-md); font-weight: var(--fw-extra); font-variant-numeric: tabular-nums; }
  .dm-sec-arr { flex: none; width: 16px; text-align: center; font-size: var(--fs-sm); color: var(--mute); }
  .dm-row {
    display: flex; align-items: center; gap: 10px;
    min-height: 56px; padding: 8px 0;
    border-top: 1px solid var(--row-line);
    cursor: pointer; touch-action: pan-y; transition: transform .15s;
  }
  .dm-row:active { background: var(--surface-2); }
  .dm-row.dm-swipe-armed { background: var(--red-soft); box-shadow: inset -6px 0 0 var(--red); }
  .dm-r-main { flex: 1; min-width: 0; }
  .dm-r-t { font-size: var(--fs-md); font-weight: var(--fw-semi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dm-r-s { margin-top: 2px; font-size: var(--fs-sm); color: var(--mute); font-weight: var(--fw-semi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dm-r-amt { flex: none; text-align: right; font-size: var(--fs-md); font-weight: var(--fw-bold); white-space: nowrap; font-variant-numeric: tabular-nums; }
  .dm-r-note { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--mute); }
  .dm-add {
    display: block; width: calc(100% - 0px); min-height: var(--hit); margin: 2px 0 12px;
    border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
    color: var(--navy-ink); font-size: var(--fs-base); font-weight: var(--fw-bold);
  }
  .dm-add:active { background: var(--navy-soft); }
  #dm-total-bar {
    position: fixed; left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    z-index: calc(var(--z-tabbar) - 1);   /* 탭바 아래 — ＋ FAB 윗부분이 가려지지 않게 */
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 9px 16px;
    background: var(--navy); color: var(--on-navy-mute);
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    font-size: var(--fs-base); font-weight: var(--fw-semi);
  }
  #dm-total-bar b { font-size: var(--fs-lg); font-weight: var(--fw-extra); color: var(--on-navy); font-variant-numeric: tabular-nums; }
  #dm-total-bar b.dm-pl.is-pos { color: var(--green-soft); }
  #dm-total-bar b.dm-pl.is-neg { color: var(--red-soft); }
  #dm-total-bar[hidden] { display: none; }
  .dm-tb-sep { width: 1px; height: 16px; margin: 0 8px; background: rgba(255, 255, 255, .22); }

  /* ── 행 편집·작업량·도구 시트 (row-sheet.js · daily-mobile.js) — .rs-* ── */
  .rs-sheet { gap: 0; }
  .rs-sheet[data-cat="equip"]     { --cat: var(--cat-eq); }
  .rs-sheet[data-cat="labor"]     { --cat: var(--cat-lb); }
  .rs-sheet[data-cat="mat"]       { --cat: var(--cat-mt); }
  .rs-sheet[data-cat="expense"]   { --cat: var(--cat-ex); }
  .rs-sheet[data-cat="outsource"] { --cat: var(--cat-os); }
  .rs-sheet[data-cat] { border-top: 3px solid var(--cat); }
  .rs-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 16px 6px; }
  .rs-amt { margin-left: auto; font-size: var(--fs-xl); font-weight: var(--fw-extra); color: var(--navy-ink); font-variant-numeric: tabular-nums; }
  .rs-body { flex: 1 1 auto; min-height: 0; gap: 12px; padding: 6px 16px 10px; }
  /* 장비 행 시트의 접힘 섹션 "기사·시간·유류" */
  .rs-more { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
  .rs-more > summary { min-height: var(--hit); display: flex; align-items: center; font-weight: var(--fw-semi); color: var(--mute); cursor: pointer; }
  .rs-more[open] > summary { color: var(--ink); }
  .rs-more-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
  /* 행 시트의 접힘 섹션 "공종(선택)" — 내역서 세부 항목 연결 */
  .rs-boq-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
  .rs-boq-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
  .rs-boq-sec { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--amber-ink); margin-top: 4px; }
  .rs-boq-sub { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--mute); margin-top: 4px; }
  .rs-boq-opt { min-height: var(--hit); padding: 4px 14px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--ink); font-weight: var(--fw-semi); }
  .rs-boq-opt[aria-pressed="true"] { background: var(--navy-soft); border-color: var(--navy); color: var(--navy-ink); }
  .rs-boq-gone { color: var(--red-ink); font-size: var(--fs-sm); font-weight: var(--fw-semi); }
  .dm-bl { color: var(--navy-ink); font-weight: var(--fw-semi); }
  .dm-bl[data-state="gone"] { color: var(--red-ink); }
  .rs-sub { font-size: var(--fs-sm); color: var(--mute); font-weight: var(--fw-semi); }
  .rs-field { gap: 4px; color: var(--mute); font-weight: var(--fw-semi); }
  .rs-in { min-height: 48px; font-size: 16px; padding: 8px 12px; color: var(--ink); }
  .rs-in-big { min-height: 60px; font-size: 24px; font-weight: var(--fw-bold); }
  .rs-foot { flex: none; padding: 10px 16px 12px; border-top: 1px solid var(--line); }
  .rs-btn { min-height: 52px; padding: 0 18px; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
  .rs-st { min-height: var(--hit); }
  .rs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .rs-chips button {
    min-height: var(--hit); max-width: 46vw; padding: 4px 14px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill);
    font-size: var(--fs-base); font-weight: var(--fw-semi); color: var(--ink-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .rs-chips button:active { border-color: var(--navy); background: var(--navy-soft); color: var(--navy-ink); }
}

@media (max-width: 767px) {
  /* ── 모바일 홈 달력 (D1) — .m-cal-* ── */
  .m-cal { padding: 6px 10px 12px; overflow: hidden; }
  .m-cal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 8px 0 8px; }
  .m-cal-head small { display: block; color: var(--mute); font-size: var(--fs-sm); font-weight: var(--fw-semi); }
  .m-cal-head h3 { margin-top: 2px; font-size: var(--fs-2xl); font-weight: var(--fw-extra); letter-spacing: -.02em; }
  .m-cal-nav { display: flex; gap: 6px; }
  .m-cal-nav .btn { min-height: var(--hit); min-width: var(--hit); color: var(--navy-ink); font-weight: var(--fw-bold); }
  .m-cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 4px; text-align: center; font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: var(--mute); }
  .m-cal-dow i { font-style: normal; }
  .m-cal-dow i.sun { color: var(--red); }
  .m-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }   /* 7×44 + 6×2 = 320 ≤ 375 − 패딩 */
  .m-cal-d {
    position: relative; aspect-ratio: 1 / 1.15; min-height: var(--hit); min-width: var(--hit);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: var(--r-lg); background: transparent;
    font-size: 11.5px; font-weight: var(--fw-bold); color: var(--ink-2);
  }
  .m-cal-d.sun { color: var(--red); }
  .m-cal-d.o { color: var(--faint); }
  .m-cal-d.w { background: var(--gray-soft); }
  .m-cal-d.w::after { content: attr(data-a); font-size: 8.5px; font-weight: var(--fw-bold); color: var(--mute); }
  .m-cal-d.rain { background: var(--blue-soft); }
  .m-cal-d.rain::after { content: attr(data-a); font-size: 8.5px; font-weight: var(--fw-bold); color: var(--blue-ink); }
  .m-cal-d.off { background: var(--red-soft); color: var(--red); }
  .m-cal-d.today { background: var(--amber); color: var(--on-amber); }
  .m-cal-d.today::after { color: var(--on-amber); }
  .m-cal-d.sel { outline: 2px solid var(--navy); outline-offset: -2px; }
  .m-cal-d .dots { display: flex; gap: 2px; min-height: 4px; }
  .m-cal-d .dots i { width: 4px; height: 4px; border-radius: 2px; }
  .m-cal-d .d-eq { background: var(--cat-eq); }
  .m-cal-d .d-lb { background: var(--cat-lb); }
  .m-cal-d .d-mt { background: var(--cat-mt); }

  .m-cal-body { display: flex; flex-direction: column; gap: 10px; }
  .m-cal-tot { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; background: var(--navy); color: var(--on-navy); border-radius: var(--r-2xl); }
  .m-cal-tot span { display: block; font-size: var(--fs-sm); color: var(--on-navy-mute); font-weight: var(--fw-semi); }
  .m-cal-tot strong { font-size: 18px; font-weight: var(--fw-extra); }
  .m-cal-card { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-2xl); }
  .m-cal-card h5 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); }
  .m-cal-card h5 b { color: var(--navy-ink); }
  .m-cal-go { min-height: 32px; padding: 0 4px; color: var(--navy-ink); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
  .m-cal-card-foot { display: flex; justify-content: center; padding-top: 4px; }
  .m-cal-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--row-line); font-size: 13.5px; font-weight: var(--fw-semi); }
  .m-cal-row:last-child { border-bottom: 0; }
  .m-cal-row > div { min-width: 0; }
  .m-cal-row span { margin-left: 5px; color: var(--mute); font-size: 11.5px; font-weight: var(--fw-semi); }
  .m-cal-row .m-cal-k { margin: 0 8px 0 0; color: var(--mute); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
  .m-cal-row b { white-space: nowrap; font-weight: var(--fw-bold); }
  .m-cal-memo { white-space: pre-wrap; font-size: var(--fs-base); color: var(--ink-2); line-height: 1.5; }
}

@media (max-width: 767px) {
  /* ── 대시보드 카드 — 한 열, 폭 전환 숨김 (D2) ── */
  .dcards { grid-template-columns: minmax(0, 1fr); }
  .dcard .pc-only { display: none; }
  /* 카드 머리줄: 제목·부제·분할 선택·▲▼·숨기기가 한 줄에 안 들어가면 도구 묶음이 아래 줄로 내려온다 */
  .dcard .section-head { flex-wrap: wrap; row-gap: 6px; }
  .dcard .section-tools { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; max-width: 100%; }
  .dc-cmp-row { grid-template-columns: 30px minmax(0, 1fr) 80px; }

  /* ── 모바일 홈 카드 — .mh-* (D2) ── */
  #home-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
  #home-cards:empty { display: none; }
  .mh-missing { flex-wrap: wrap; border-radius: var(--r-2xl); }
  .mh-missing > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
  .mh-missing-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
  .mh-missing-chips .btn { min-height: 36px; background: var(--card); }
  .mh-card { padding: 12px 14px; border-radius: var(--r-2xl); }
  .mh-nums { display: grid; grid-template-columns: 62px repeat(3, minmax(0, 1fr)); align-items: center; gap: 6px; padding: 6px 0; }
  .mh-nums + .mh-nums { border-top: 1px solid var(--row-line); }
  .mh-nums > b { font-size: var(--fs-sm); color: var(--mute); font-weight: var(--fw-bold); }
  .mh-nums > div span { display: block; font-size: var(--fs-2xs); color: var(--mute); font-weight: var(--fw-semi); }
  .mh-nums > div i { font-style: normal; font-size: var(--fs-base); font-weight: var(--fw-extra); white-space: nowrap; }
  .mh-nums i[data-tone="red"] { color: var(--red); }
  .mh-nums i[data-tone="green"] { color: var(--green); }
  .mh-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .mh-quick.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mh-quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-2xl); color: var(--navy-ink); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
  .mh-quick-btn:active { background: var(--navy-soft); }
  .mh-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: var(--fs-md); }
  .mh-more { min-height: 32px; padding: 0 4px; color: var(--navy-ink); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
  .mh-photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .mh-photo { aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: var(--r-lg); background: var(--gray-soft); }
  .mh-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .mh-chip-row { display: flex; }
  .mh-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; background: var(--gray-soft); border-radius: var(--r-pill); color: var(--mute); font-size: var(--fs-xs); font-weight: var(--fw-semi); }
  .mh-storage { padding: 0; }

  /* 조회 표 카드화 (.m-cards) — table-wrap 또는 상위에 클래스, td에 data-label (S1) */
  .m-cards .tbl-wrap { overflow: visible; }
  .m-cards .tbl, .m-cards .tbl tbody { display: block; }
  .m-cards .tbl thead { display: none; }
  .m-cards .tbl tr { display: block; margin: 8px 12px; padding: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); }
  .m-cards .tbl tbody tr:hover td { background: transparent; }
  .m-cards .tbl td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--row-line); text-align: right; }
  .m-cards .tbl td:last-child { border-bottom: 0; }
  .m-cards .ml-ins-tbl td.ml-ins-extra, .m-cards .ml-ins-tbl td.ml-ins-spec { display: none; }   /* 당월 입고 내역 카드: 단가·비고·규격 칸은 폰에서 생략(규격은 자재 옆에 작게, 행을 누르면 그날 일보로) */
  .ml-ins-spec-m { color: var(--mute); font-weight: var(--fw-semi); }
  .m-cards .tbl td:has(> .chip) { flex-wrap: wrap; justify-content: flex-end; gap: 4px 6px; }   /* 비목 칩이 많으면 줄바꿈(월별집계 합계 행 잘림) */
  .m-cards .tbl td[data-label]::before { content: attr(data-label); flex: none; color: var(--mute); font-size: var(--fs-xs); font-weight: var(--fw-semi); text-align: left; }
  .m-cards .tbl td:empty { display: none; }
  .m-cards .tbl td.empty-cell { display: block; padding: 0; border: 0; }
  .m-cards .tbl tr:has(td.empty-cell) { margin: 0; padding: 0; border: 0; background: transparent; }
  .m-cards .tbl td.sum-name { font-weight: var(--fw-bold); }
  .m-cards .tbl tr.sum-hd { padding: 0; background: var(--navy-soft); border-color: transparent; }
  .m-cards .tbl tr.sum-hd:not(.sum-bundle) td { display: block; padding: 8px 12px; border: 0; text-align: left; }
  .m-cards .tbl tr.sum-bundle { padding: 6px 12px; }
  .m-cards .sum-gauge { min-width: 120px; }
  .sum-bar { padding: 8px 10px; }
  .sum-range { width: 100%; margin-left: 0; }
  .sum-kpis .kpi:last-child { grid-column: 1 / -1; }
}

/* 노무대장 인부 카드 · 근로자명단 카드 입력 (S2) */
@media (max-width: 767px) {
  .ls-cards { display: flex; flex-direction: column; gap: 8px; }
  .ls-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 4px 12px 10px; }
  .ls-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--hit); cursor: pointer; }
  .ls-card-main { min-width: 0; }
  .ls-card-name { font-size: var(--fs-md); }
  .ls-card-sub { color: var(--mute); font-size: var(--fs-xs); }
  .ls-card-amt { font-weight: var(--fw-extra); color: var(--amber-ink); white-space: nowrap; }
  .ls-card-amt small { color: var(--mute); font-weight: var(--fw-regular); margin-left: 1px; }
  .ls-card-sign { padding: 2px 0 6px; }
  .ls-dlist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--row-line); font-size: var(--fs-sm); }
  .ls-dlist div { display: flex; justify-content: space-between; gap: 6px; }
  .ls-dlist span { color: var(--mute); }
  .ls-card-edit { display: none; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--row-line); }
  .ls-card.is-open .ls-card-edit { display: flex; }
  .ls-card-sum { display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); padding: 10px 12px; }
  .ls-bar { gap: 8px; }
  .ls-mstep { display: inline-flex; }
  .ls-mtools { display: inline-flex; }
  .ls-bar .sum-range { flex-basis: 100%; margin-left: 0; order: 9; }
  .wl-add .input { flex: 1 1 140px; }
  .m-cards .tbl td input.cell { max-width: 62%; text-align: right; }
  .m-cards .tbl td.ls-in { min-width: 0 !important; }
}

/* S3 거래처현황·이력조회 모바일 */
@media (max-width: 767px) {
  .vs-search { flex: 1 1 100%; }
  .vs-mtools, .hs-mtools { display: inline-flex; }
  .vs-bar .sum-range { display: none; }
  .vs-tbl td.vs-acts { justify-content: flex-end; flex-wrap: wrap; }
  .m-cards .vs-tbl td.vs-role input.cell { max-width: 62%; text-align: right; }
  .hs-search { flex: 1 1 100%; }
  .hs-range .input, .hs-amtr .input { width: 100%; min-width: 0; }
  .hs-range, .hs-amtr { flex: 1 1 100%; }
  .kpi-strip.hs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .hs-kpis .kpi-value { font-size: var(--fs-md); }
  .m-cards .hs-tbl td input.cell { max-width: 62%; text-align: right; }
  .m-cards .hs-tbl td:last-child { justify-content: flex-end; }
  .hs-sumline { margin-left: 0; width: 100%; }
  .vr-form, .ha-form { grid-template-columns: 1fr; }
  .claim-doc { padding: var(--sp-3); }
  .claim-vcard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .claim-vc:nth-child(4n) { border-right: 1px solid var(--line); }
  .claim-vc:nth-child(2n) { border-right: 0; }
  .modal-head-actions { gap: 4px; }
  .modal-head-actions .btn { min-height: var(--hit); padding-inline: 10px; white-space: nowrap; }
  .claim-modal .modal-x { min-width: var(--hit); min-height: var(--hit); }
  .claim-title { font-size: 18px; letter-spacing: 6px; }
}

/* M1 자재 모바일 */
@media (max-width: 767px) {
  .mh-search { flex: 1 1 100%; max-width: none; }
  .mh-add { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .mh-add [data-field="ma-date"], .mh-add [data-field="ma-qty"] { width: 100%; }
  .mh-add-spec, .mh-add > .btn { grid-column: 1 / -1; }
  .mh-add-chips .input { width: 100%; flex: 1 1 100%; }
  .m-cards .mt-tbl td input.cell, .m-cards .mh-tbl td input.cell { max-width: 62%; text-align: right; }
  .m-cards .mt-tbl td:last-child, .m-cards .mh-tbl td:last-child { justify-content: flex-end; }
  .m-cards .mh-tbl td select.cell { max-width: 62%; }
  .m-cards .mh-tbl td .mt-tag, .m-cards .mh-tbl td .item-tag { max-width: 100%; }
  .maf-grid { grid-template-columns: 1fr; }
  .mp-item { padding: 12px 10px; }
}
@media (max-width: 767px) {
  .m-cards .mt-tbl td:has(> span[data-warn]:empty) { display: none; }
  .m-cards .mt-tbl td:has(> .mh-amtwrap) { white-space: normal; }
}

/* 내역서 — 읽기 전용 카드 (M2, .m-cards 패턴) */
@media (max-width: 767px) {
  .bq-m-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 12px; }
  .bq-m-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-lg); }
  .bq-m-sum span { color: var(--mute); font-size: var(--fs-xs); font-weight: var(--fw-semi); }
  .bq-m-sum b { font-size: var(--fs-base); font-weight: var(--fw-extra); word-break: keep-all; }
  /* 내역서 폰 편집(js/ui/boq-mobile.js) */
  .bqm-tools { display: flex; gap: 8px; margin: 8px 12px; }
  .bqm-tools .btn { flex: 1; }
  .m-cards .bq-m tr[data-action] { cursor: pointer; }
  .m-cards .bq-m tr[data-action]:active { background: var(--navy-soft); }
  .bqm-form { display: flex; flex-direction: column; gap: var(--sp-3); }
  .bqm-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .bqm-lb { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--mute); }
  .bqm-f .input { min-height: var(--hit); font-size: var(--fs-md); }
  .bqm-num { text-align: right; font-variant-numeric: tabular-nums; }
  .bqm-row { display: flex; gap: 8px; }
  .bqm-grow { flex: 1 1 0; }
  .bqm-unit { flex: 0 0 84px; }
  .bqm-err { color: var(--red); font-size: var(--fs-xs); }
  .bqm-note { margin: 0; padding: 8px 10px; background: var(--amber-soft); border-radius: var(--r-lg); font-size: var(--fs-sm); color: var(--ink); }
  .bqm-sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--mute); font-size: var(--fs-sm); }
  .bqm-sum b { color: var(--navy); font-size: var(--fs-md); }
  .bqm-menu { display: flex; flex-direction: column; gap: 8px; }
  .bqm-menu-btn { justify-content: flex-start; min-height: var(--hit); }
  .modal-foot:has([data-action^="bqm-"]) .btn { flex: 1 1 auto; min-height: var(--hit); }   /* 내역서 편집 시트의 바닥 버튼만(다른 시트는 그대로) */

  /* 내역서 폰 엑셀 올리기 (js/ui/boq-mobile-import.js) */
  .bqm-imp { display: flex; flex-direction: column; gap: var(--sp-3); }
  .bqm-lbl { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--mute); }
  .bqm-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px; border: 2px dashed var(--line); border-radius: var(--r-xl); background: transparent; min-height: var(--hit); }
  .bqm-drop b { font-size: var(--fs-lg); }
  .bqm-drop small { color: var(--mute); }
  .bqm-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); min-height: var(--hit); }
  .bqm-radio:has(input:checked) { border: 2px solid var(--navy); padding: 9px 11px; }
  .bqm-radio span { display: flex; flex-direction: column; gap: 2px; }
  .bqm-radio small { color: var(--mute); font-size: var(--fs-xs); }
  .bqm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .bqm-chip { min-height: var(--hit); padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: transparent; }
  .bqm-chip[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
  .bqm-map-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--row-line); }
  .bqm-map-row .input { max-width: 58%; min-height: var(--hit); }
  .bqm-imp-nav { display: flex; gap: 8px; }
  .bqm-imp-nav .btn { flex: 1; min-height: var(--hit); }
  .bqm-imp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .bqm-all { display: flex; align-items: center; gap: 8px; min-height: var(--hit); font-weight: var(--fw-semi); }
  .bqm-imp-list { display: flex; flex-direction: column; gap: 6px; }
  .bqm-imp-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-lg); min-height: var(--hit); }
  .bqm-imp-row.is-off { opacity: .55; }
  .bqm-imp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .bqm-imp-main small, .bqm-imp-sub { color: var(--mute); font-size: var(--fs-xs); }
  .bqm-diff { color: var(--amber-ink); font-size: var(--fs-xs); font-weight: var(--fw-semi); }
  .bqm-tag { flex: none; padding: 1px 6px; border-radius: 4px; font-size: var(--fs-2xs); font-weight: var(--fw-semi); background: var(--gray-soft); color: var(--gray-ink); }
  .bqm-tag[data-tone="green"] { background: var(--green-soft); color: var(--green-ink); }
  .bqm-tag[data-tone="amber"] { background: var(--amber-soft); color: var(--amber-ink); }
  .bqm-tag[data-tone="navy"] { background: var(--navy-soft); color: var(--navy-ink); }
  .bqm-imp-bar { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; background: var(--card); border-top: 1px solid var(--line); }
  .bqm-imp-sum { font-size: var(--fs-sm); font-weight: var(--fw-semi); text-align: center; }
  .m-cards .bq-m tr.bq-hd { background: var(--navy-soft); border-color: transparent; }
  .m-cards .bq-m tr.bq-hd[data-lv="3"] { background: color-mix(in srgb, var(--navy-soft) 55%, transparent); }
  .m-cards .bq-m td.bq-m-hd { font-weight: var(--fw-bold); text-align: left; }
  .m-cards .bq-m td.bq-m-hd b { flex: none; color: var(--green-ink); }
  .m-cards .bq-m td.bq-m-name { display: block; text-align: left; font-weight: var(--fw-bold); }
  .m-cards .bq-m small { color: var(--mute); font-weight: var(--fw-regular, 400); }
  /* ── 공사계획·사진·로그인 (M4) ── */
  /* 공정표: 보기 전용 — 편집 UI(끌기 핸들·추가 버튼)는 렌더러가 그리지 않는다. 왼쪽 열 120px */
  .gantt-scroll { --gantt-lw: 120px; max-height: calc(100dvh - 250px); }
  .gantt-label { gap: 4px; padding: 0 6px 0 2px; }
  .gantt-row[data-depth="1"] .gantt-label { padding-left: 12px; }
  .gantt-dot, .gantt-late[data-tone="behind"] { display: none; }
  .gantt-late { padding: 0 5px; }
  .gantt-late-x { display: none; }
  .gantt-name { min-width: 36px; }
  .gantt-pct { min-width: 30px; }
  .gantt-tg { width: 28px; height: 32px; }
  .gantt-handle, .gantt-edit { display: none; }
  .gantt-seg button, .gantt-delay { min-height: var(--hit); }
  .plan-form-dates { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .photo-toolbar { flex-direction: column; align-items: stretch; }
  .photo-add-m { margin-left: 0; }
  .photo-viewer-body img { max-height: 55vh; }
  .guest-bar { padding: 8px 14px; align-items: flex-start; flex-wrap: wrap; }
  .guest-bar .banner-act { margin-left: 0; }
  #uiShareBanner { margin: 8px 14px 0; }

  /* ── T1: 옛 동적 모달 → 바텀시트 (인라인 width·max-width·max-height를 !important로 덮는다) ── */
  .modal-bg > .modal { width: 100% !important; max-width: 100% !important; max-height: 90vh !important; }
  :is(#photoCleanupModal, #signModal, #safetyModal, #claimLogModal, #equipReportModal, #priceHistModal,
      #siteCompareModal, #siteCopyModal, #integrityModal, #companyModal, #errLogModal, #shortcutHelpModal) > .modal {
    padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  }
  :is(#photoCleanupModal, #signModal, #safetyModal, #claimLogModal, #equipReportModal, #priceHistModal,
      #siteCompareModal, #siteCopyModal, #integrityModal, #companyModal, #errLogModal, #shortcutHelpModal) > .modal::before {
    content: ""; flex: none; width: 40px; height: 4px; margin: -6px auto -4px;
    border-radius: 2px; background: var(--line);
  }
  :is(#contactModal, #inqModal, #shareModal, #csvExportModal) > .modal::before {
    content: ""; display: block; flex: none; width: 40px; height: 4px; margin: 8px auto 0;
    border-radius: 2px; background: var(--line);
  }
}

/* ============================================================
   모바일 탭 타겟 ≥ 44px (R2-수정) — 보이는 button·a·[data-action]·input·select의 높이·너비가 44 미만이면 안 된다.
   :root를 앞에 붙여 (.btn-sm 등) 앞선 단일 클래스 규칙보다 우선한다. 표 안 셀은 .m-cards 카드로 풀려 있어 행 높이 손해가 작다.
   ============================================================ */
@media (max-width: 767px) {
  :root :is(button, [role="button"], [data-action], select, textarea,
            input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"])) {
    min-height: var(--hit);
  }
  :root :is(button, [role="button"], a[data-action], b[data-action], span[data-action], i[data-action]) { min-width: var(--hit); }
  /* 글자만 있는 클릭 요소(b·span·i)는 박스를 가져야 높이가 선다 */
  :root :is(b, span, i, em, strong, a)[data-action] { display: inline-flex; align-items: center; justify-content: center; }
  .app-content a[href] { display: inline-flex; align-items: center; justify-content: center; min-height: var(--hit); min-width: var(--hit); }
  :root .btn, :root .btn-sm, :root .btn-icon { min-height: var(--hit); min-width: var(--hit); }
  :root .btn-icon { width: var(--hit); }

  /* 드래그 손잡이: 터치에는 HTML5 드래그가 없다 — 모바일에서는 숨긴다 */
  .card-grip { display: none; }

  /* 표 안 항목명·날짜 링크: 카드 행 전체 폭을 탭 영역으로 */
  .m-cards .tbl td b[data-action] { display: flex; width: 100%; justify-content: flex-end; }
  .m-cards .tbl td .item-tag, .m-cards .tbl td .mt-tag { min-height: var(--hit); display: inline-flex; align-items: center; justify-content: flex-end; }
  .m-cards .tbl td .hs-date { text-decoration: underline; }

  /* 체크박스: 마크업을 바꾸지 않고 입력 자체를 44×44 터치 영역으로 두고 22px 상자를 가운데에 그린다 (근로자명단·할 일·모달 목록 공통) */
  :root:root input[type="checkbox"] {
    -webkit-appearance: none; appearance: none;
    display: inline-grid; place-content: center; flex: none;
    width: var(--hit); height: var(--hit); margin: 0; padding: 0;
    background: transparent; border: 0; cursor: pointer;
  }
  :root:root input[type="checkbox"]::before {
    content: ""; width: 22px; height: 22px; box-sizing: border-box;
    border: 2px solid var(--border-strong); border-radius: 6px; background: var(--card);
  }
  :root:root input[type="checkbox"]:checked::before {
    border-color: var(--navy);
    background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
  }
  :root:root input[type="checkbox"]:disabled { opacity: .5; }
  :root:root input[type="checkbox"]:focus-visible { outline: none; }
  :root:root input[type="checkbox"]:focus-visible::before { box-shadow: 0 0 0 3px var(--navy-soft); }

  /* 대시보드 월별 손익 카드 — 추이 막대 칸은 숨기고, 이번 달은 테두리로 표시 */
  .m-cards .dc-monthly td:last-child { display: none; }
  .m-cards .dc-monthly td { background: transparent; }
  .m-cards .dc-monthly tr.is-cur { border-color: var(--navy); background: var(--navy-soft); }

  /* 공사계획: 모바일은 일정 확인만 — 목록 비었을 때의 ＋ 일정 추가 안내 버튼도 숨김 */
  #view-plan .empty-state .btn { display: none; }
}

/* 장비대장 모바일 카드는 노무대장 .ls-card 를 재사용 — 펼침이 없으니 머리글을 누르는 모양으로 두지 않는다 */
@media (max-width: 767px) {
  .eq-card .ls-card-head { cursor: default; }
}

/* 자재관리대장 모바일 카드 — 노무대장 .ls-card 를 재사용. 카드 전체가 눌러서 일자별 시트를 여는 버튼 */
@media (max-width: 767px) {
  .ml-card { cursor: pointer; }
  .ml-card .ls-card-sub { line-height: 1.5; }
  .ml-card .ls-card-sub b { font-weight: var(--fw-extra); }
  .ml-spec { color: var(--mute); font-size: var(--fs-sm); }
  .ml-card-plan { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; font-size: var(--fs-xs); color: var(--mute); }
  .ml-card-plan .ml-bar { width: 72px; }
  .ml-card-warn { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 6px; }
  .ml-bar-tools { width: 100%; margin-left: 0; }
  .ml-bar-tools .btn { flex: 1; min-height: var(--hit); }
  .ml-sh-sum { padding-bottom: var(--sp-2); font-size: var(--fs-sm); color: var(--mute); line-height: 1.6; }
  .ml-sh-row { display: flex; align-items: center; gap: 10px; min-height: var(--hit); border-bottom: 1px solid var(--line); }
  .ml-sh-date { width: 56px; font-weight: var(--fw-bold); }
  .ml-sh-date small { color: var(--mute); font-weight: var(--fw-regular); }
  .ml-sh-f { flex: 1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--mute); }
  .ml-sh-f .ml-dqw { flex: 1; }
  .ml-sh-f .ml-dq { height: 40px; font-size: var(--fs-md, 14px); background: var(--surface-2); }
  .ml-sh-none { padding: var(--sp-3) 0; color: var(--mute); text-align: center; }
  .ml-sh-addbox { padding-top: var(--sp-3); }
  .ml-sh-addrow { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
  .ml-sh-addrow .input { min-width: 0; flex: 1; }
  .ml-sh-addrow input[type="date"] { flex: 1 1 100%; }
  .ml-sh-foot { display: flex; justify-content: flex-end; padding-top: var(--sp-3); }
}

@media (max-width: 767px) {
  /* 출역 확인 시트 · TBM 참석자 (js/ui/attend.js) */
  .att-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
  .att-tools .btn { white-space: nowrap; flex: 0 0 auto; }
  .att-tools .btn:first-of-type { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .att-sum { font-weight: var(--fw-bold); flex: 1 0 100%; }   /* 요약은 윗줄, 버튼 두 개는 아랫줄 한 줄 */
  .att-chk { min-width: 0; }
  .att-nm { white-space: nowrap; }
  .att-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .att-find { width: 100%; margin-bottom: 8px; }
  .att-list { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
  .att-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: var(--hit); padding: 4px 10px; border-bottom: 1px solid var(--line); }
  .att-row:last-child { border-bottom: 0; }
  .att-row[hidden] { display: none; }
  .att-row.is-on { background: var(--amber-soft); }
  .att-chk { display: flex; align-items: center; gap: 8px; flex: 1 1 160px; min-height: var(--hit); cursor: pointer; }
  .att-chk input { width: 20px; height: 20px; accent-color: var(--navy); }
  .att-nm { font-weight: var(--fw-bold); }
  .att-sub { color: var(--mute); font-size: var(--fs-xs); }
  .att-qty { display: inline-flex; gap: 4px; }
  .att-q.is-on { background: var(--navy); color: #fff; }
  .att-empty { padding: 14px; color: var(--mute); text-align: center; }
  .att-addnew { margin-top: 8px; }
  .att-tbm { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
  .att-tbm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .att-sign { height: 26px; max-width: 80px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
  .att-edu { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: var(--fs-sm); color: var(--mute); }
  .att-list { max-height: 46vh; }
}

@media (max-width: 767px) {
  /* 공정표 폰 "오늘" 화면 (js/ui/gantt-today.js) — 분할 탭 오늘 | 주간 | 전체 · 카드 · 진행률 시트. 토큰만 쓴다 */
  .gt-seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); }
  .gt-seg button { flex: 1 1 0; min-height: var(--hit); border: 0; border-radius: calc(var(--r-card) - 3px); background: transparent; color: var(--mute); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold); cursor: pointer; }
  .gt-seg button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); }
  .gt-body { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
  .gt-today-date { font-size: var(--fs-sm); color: var(--mute); font-weight: var(--fw-semi); }
  .gt-sec { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
  .gt-sec-h { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-extra); color: var(--ink); }
  .gt-sec-h .num { color: var(--mute); font-weight: var(--fw-bold); }
  .gt-sec-h[data-tone="late"] { color: var(--red); }
  .gt-empty, .gt-none { padding: var(--sp-4); color: var(--mute); text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
  .gt-none { padding: var(--sp-3); font-size: var(--fs-sm); }
  .gt-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
  .gt-card[data-kind="late"] { border-left: 3px solid var(--red); }
  .gt-card-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
  .gt-card-top .badge { flex: 0 0 auto; margin-top: 2px; }
  .gt-name-w { flex: 1 1 auto; min-width: 0; }
  .gt-name { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--ink); line-height: 1.35; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .gt-parent { font-size: var(--fs-xs); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gt-when { font-size: var(--fs-sm); color: var(--mute); }
  .gt-prog { display: flex; align-items: center; gap: 8px; }
  .gt-bar { flex: 1 1 auto; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
  .gt-bar i { display: block; height: 100%; background: var(--navy); }
  .gt-bar[data-tone="behind"] i { background: var(--amber); }
  .gt-bar[data-tone="done"] i { background: var(--green); }
  .gt-pct { flex: 0 0 auto; min-width: 38px; text-align: right; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--ink); }
  .gt-planned { font-size: var(--fs-sm); color: var(--ink); line-height: 1.45; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .gt-acts { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
  /* 버튼은 글자 폭만큼(flex-basis auto) — 한 줄에 안 들어가면 줄을 바꿔 넘어가고, 그래도 넘치면 글자가 줄바꿈된다(삐져나오지 않음) */
  .gt-acts .btn { flex: 1 1 auto; min-width: 0; min-height: var(--hit); padding: 4px 10px; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.25; }
  .gt-card-up { gap: 4px; padding: 10px 14px; }
  /* 주간 탭 — 날짜별 블록(머리글 = 그날 일보로 가는 버튼, 오늘은 amber) */
  .gt-week { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
  .gt-wd { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
  .gt-wd[data-today="true"] { border-color: var(--amber); }
  .gt-wd-h { display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--hit); padding: 0 14px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold); text-align: left; cursor: pointer; }
  .gt-wd[data-today="true"] .gt-wd-h { background: var(--amber-soft); }
  .gt-wd-h .badge { flex: 0 0 auto; }
  .gt-wd-go { margin-left: auto; flex: 0 0 auto; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--mute); }
  .gt-wd-none { padding: 0 14px 10px; font-size: var(--fs-sm); color: var(--mute); }
  .gt-wd-list { margin: 0; padding: 0 14px; list-style: none; }
  .gt-wi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 8px 0; border-top: 1px solid var(--line); }
  .gt-wi-top { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
  .gt-wi-chips { display: flex; flex: 0 0 auto; gap: 4px; margin-top: 2px; }
  .gt-wi .gt-name { font-size: var(--fs-sm); }
  .gt-wi .gt-bar { height: 6px; }
  .gt-wi .gt-pct { font-size: var(--fs-xs); }
  .gt-wd-res { padding: 8px 14px 10px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink); line-height: 1.45; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  /* 진행률 시트 */
  .gt-pct-sheet { display: flex; flex-direction: column; gap: var(--sp-3); }
  .gt-pct-cur { margin: 0; color: var(--ink); }
  .gt-pct-cur small { color: var(--mute); }
  .gt-pct-pre { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .gt-pct-pre .btn { min-height: var(--hit); padding: 0; }
  .gt-pct-pre .btn[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
  .gt-pct-f { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--mute); }
  .gt-pct-msg { margin: 0; min-height: 1em; font-size: var(--fs-sm); color: var(--red); }
  .gt-pct-msg:empty { display: none; }
  .gt-pct-note { margin: 0; padding: 8px 10px; font-size: var(--fs-sm); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); line-height: 1.5; }
  .modal-foot .btn[data-action="gt-pct-save"], .modal:has(.gt-pct-sheet) .modal-foot .btn { min-height: var(--hit); }
}
