/* ============================================================
   v2 base (P0-d) — reset · Pretendard · tabular-nums · 기본 타이포
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  /* 숫자는 전역 고정폭 — 표·금액 정렬 */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: var(--fw-bold); letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: var(--fw-extra); letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl);  font-weight: var(--fw-extra); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

a { color: inherit; text-decoration: none; }
img, svg, video, canvas { display: inline-block; vertical-align: middle; max-width: 100%; }
svg { flex-shrink: 0; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
input, select, textarea { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }

table { border-collapse: collapse; border-spacing: 0; }
th { font-weight: var(--fw-bold); text-align: left; }

ul, ol { list-style: none; }

/* hidden 속성은 언제나 이긴다 (뷰 전환이 hidden에 의존) */
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); }

::selection { background: var(--amber-soft); color: var(--ink); }

/* 스크롤바 — 얇고 조용하게 (PC) */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--ff-mono); }
.mute { color: var(--mute); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 기준정보 수정·붙여넣기 · 새 현장 복사 · 자재 입고 폼/모바일 카드 · 내역서 묶음 · 도구 (기준정보/자재 UX 개선) ── */
.mst-row[data-action="mst-edit"] { cursor: pointer; }
.mst-row[data-action="mst-edit"]:hover { background: var(--navy-soft); }
.mst-edit { flex-shrink: 0; color: var(--mute); }
.mst-mode { display: flex; gap: 6px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.mst-form-note { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); color: var(--mute); line-height: 1.5; }
.mst-paste { width: 100%; min-height: 120px; font-family: inherit; line-height: 1.5; resize: vertical; }
.mst-prev-sum { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--ink); margin: var(--sp-2) 0 4px; }
.mst-prev { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.mst-prev-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.mst-prev-row:last-child { border-bottom: 0; }
.mst-prev-n { font-weight: var(--fw-semi); }
.mst-prev-s { color: var(--mute); font-size: var(--fs-xs); }
.mst-prev-m { margin-left: auto; font-size: var(--fs-xs); color: var(--amber-ink, var(--mute)); }
.mst-prev-row[data-status="dup"] { opacity: .6; }
.mst-prev-row[data-status="err"] .mst-prev-m { color: var(--red); }
.mst-prev-row[data-status="err"] { background: var(--red-soft); }

.nsc { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.nsc-on { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-semi); cursor: pointer; }
.nsc-body { margin-top: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); }
.nsc-items { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.nsc-item { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); cursor: pointer; }
.nsc-item.is-empty { opacity: .5; cursor: default; }
.nsc-item small { color: var(--mute); }
.nsc-note { margin: 0; font-size: var(--fs-xs); color: var(--mute); line-height: 1.5; }

.tool-stamp { font-weight: var(--fw-semi); color: var(--ink); }

.mh-add .mh-add-day { display: flex; align-items: center; gap: 6px; }
.mh-add .mh-add-day [data-field="ma-date"] { width: 150px; }
.mh-add [data-field="ma-price"] { width: 104px; }
.mh-add .mh-add-remark { flex: 1 1 160px; }
.mh-add .mh-add-remark .input { width: 100%; }
@media (max-width: 767px) {
  .mh-add .mh-add-day [data-field="ma-date"] { width: auto; flex: 1; min-width: 0; }
  .mh-add [data-field="ma-price"] { width: 100%; }
  .mh-add .mh-add-remark { grid-column: 1 / -1; }
}

/* 모바일 재고 카드: 이름 줄 / 입고·출고·재고 한 줄 / 보조 줄 */
.mt-cards { display: flex; flex-direction: column; }
.mt-card { padding: 8px 14px 9px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mt-card:last-child { border-bottom: 0; }
.mt-card.is-unreg { background: var(--amber-soft); }
.mt-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.mt-card-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-card-nm b { font-size: var(--fs-md, 14px); }
.mt-card-spec, .mt-card-unit { color: var(--mute); font-size: var(--fs-xs); }
.mt-card-acts { display: flex; gap: 4px; flex-shrink: 0; }
.mt-card-stat { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-sm); color: var(--mute); }
.mt-card-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mt-card-stat b.mt-stock { font-size: var(--fs-md, 14px); }
.mt-card-meta { margin-top: 2px; font-size: var(--fs-xs); color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 내역서 묶음: 묶음 아래 항목의 금액은 흐리게(참고용) */
.bq-dim td.amt, .bq-dim td[data-label="계약금액"], .bq-dim td[data-label="기성금액"] { opacity: .45; }
.bq-bundle-hint { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--mute); line-height: 1.35; white-space: normal; }
