/* 모바일 개편(2026-12-01 차장 "폰 기종마다 화면 비율·크기가 안 맞는다, 데스크 전환이 이상하다, 재고는 표로 두고 가운데 정렬, 직원 폰·아이폰도")
   ec.css 뒤에 싣는다. nx-m.css 는 나중에 붙으므로, 겹치는 규칙은 앞에 html:root 를 달아 이긴다.
   1) 위 줄: 로고 + 화면 이름 + 보기 설정 단추 하나(48)  2) 재고 표: 머리·숫자·판정 가운데, 제품명 칸 왼쪽 고정
   3) 아이폰·여러 안드로이드: 글자 크기 자동 키움 끄기, 입력칸 16(아이폰이 화면을 확대하지 않게), 누를 때 회색 번쩍임 끄기, 노치 여백
   4) 펼친 폴드·태블릿에서 모바일 보기: 폭 640 으로 잡아 폰 화면을 크게(shell.js)  5) 폰에서 PC 화면: 축소 보기의 "모바일로 돌아가기" 단추 */

/* ---- 3. 기종 공통 ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-view-mode="mobile"] body { -webkit-tap-highlight-color: transparent; }
html[data-view-mode="mobile"] :is(button, a, [role="button"], [role="tab"]) { touch-action: manipulation; }
@media (pointer: coarse) {
  html[data-view-mode="mobile"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: 16px !important; }
}

/* ---- 1. 위 줄 ---- */
html:root body .dm-topbar.dm-tb2 {
  position: sticky; top: 0; flex-wrap: nowrap; height: auto; min-height: 52px; row-gap: 0;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
}
html:root body .dm-tb2 .dm-brand { flex: 1 1 auto; min-width: 0; height: auto; display: flex; align-items: center; gap: 8px; overflow: hidden; }
html:root body .dm-tb2 .dm-page-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html:root body .dm-tb2 .dm-topright { flex: none; display: flex; gap: 0; }
.dm-tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 48px; height: 48px; margin-right: -6px; padding: 0 8px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 13px; cursor: pointer;
}
.dm-tb-ico { display: inline-flex; }
.dm-tb-btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dm-tb-btn:active { background: rgba(127, 127, 127, .16); }
.dm-tb-btn:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: -2px; }
@media (hover: hover) { .dm-tb-btn:hover { background: rgba(127, 127, 127, .12); } }

/* 보기 설정 시트 */
.dm-vs-row { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.dm-vs-l { font-size: 13px; color: var(--ec-muted, #9ba0ab); }
.dm-vs-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; overflow: hidden; }
.dm-vs-btn { height: 48px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 15px; cursor: pointer; }
.dm-vs-btn + .dm-vs-btn { border-left: 1px solid var(--ec-line, #3b414e); }
.dm-vs-btn.on { background: var(--ec-brand, #ff7500); color: var(--ec-brand-ink, #141413); font-weight: 600; }   /* 흰 글자는 대비 2.66 → 진한 글자 6.92(ec.css 와 같은 규칙) */
.dm-vs-btn:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: -3px; }
/* 시트가 아래 메뉴(z 900) 밑에 깔려 마지막 줄이 가리던 것 */
html[data-view-mode="mobile"] .m-layer { z-index: 1000; }
.dm-vs-me { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 4px; color: inherit; text-decoration: none; font-size: 15px; border-top: 1px solid var(--ec-line2, #2d323d); }
.dm-vs-me svg { fill: none; stroke: currentColor; stroke-width: 2; }

/* ---- 2. 재고 표: 가운데 정렬 + 제품명 칸 고정 ---- */
html:root body .dm-st-table :is(th, td) { text-align: center; }
html:root body .dm-st-table :is(thead th:first-child, td.name, tfoot td:first-child) {
  position: sticky; left: 0; z-index: 1; text-align: left;
  background: var(--ec-panel, #1a1d22);
  box-shadow: 1px 0 0 var(--ec-line-strong, #5c6475);
}
html:root body .dm-st-table thead th:first-child,
html:root body .dm-st-table tfoot td:first-child { background: var(--ec-head, #272a31); z-index: 2; }
/* 칸 폭 고정: 제품명 104 · 판정 66, 나머지 숫자 칸은 똑같이 나눔 → 어느 카드든 같은 칸이 같은 자리(검수 지적: 카드마다 5~7px 어긋남) */
html:root body .dm-st-table { table-layout: fixed; width: 100%; min-width: max(360px, calc(170px + var(--nc, 5) * var(--nw, 38px))); }   /* --nw = 가장 긴 숫자에 맞춘 칸 폭(m-app.js stockNumW) */   /* 숫자 칸 하나 38 이상: 칸이 늘면 표가 넓어지고 가로로 민다 */
html:root body .dm-st-table thead th:first-child { width: 104px; }
html:root body .dm-st-table thead th:last-child { width: 66px; }
html:root body .dm-st-table td.name { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.25; text-overflow: clip; }
html:root body .dm-st-table :is(th, td):not(:first-child) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* 그래도 넘치면 "…" 로(잘린 숫자가 다른 숫자처럼 보이지 않게) */
@media (max-width: 400px) {
  /* 실측(360폭): 숫자 최대 33px · 판정 표시 53px → 숫자 칸 40(여백 2+2) · 판정 58 · 제품명 78 = 336, 360 폰(표 자리 338)에 가로 밀기 없이 */
  html:root body #page-stock .dm-st-table { min-width: max(336px, calc(136px + var(--nc, 5) * max(40px, var(--nw, 40px)))); }
  html:root body #page-stock .dm-st-table thead th:first-child { width: 78px; }
  html:root body #page-stock .dm-st-table thead th:last-child { width: 58px; }
  html:root body #page-stock .dm-st-table :is(th, td) { padding-left: 2px; padding-right: 2px; }
  html:root body #page-stock .dm-st-table :is(td.name, thead th:first-child, tfoot td:first-child) { padding-left: 6px; }
}

/* ---- 4. 펼친 폴드·태블릿에서 모바일 보기: shell.js 가 화면 폭을 640 으로 잡아 폰 화면 모양이 그대로 맞는다(여기 규칙 없음) ---- */

/* ---- 5. 폰에서 PC 화면(축소 보기) ---- */
/* 화면 폭을 1280 으로 잡아 ec.css 의 "폭 640 이하" 규칙이 안 맞으므로 여기서 보이게 하고, 축소 배율(--vm-z)만큼 키워 실제 손가락 크기 48 을 지킨다 */
html.vm-zoom[data-view-mode="desk"] .vm-back {
  display: inline-flex; align-items: center; justify-content: center; position: fixed; z-index: 400;
  right: calc(12px * var(--vm-z, 1)); bottom: calc((12px + env(safe-area-inset-bottom)) * var(--vm-z, 1));
  min-height: calc(48px * var(--vm-z, 1)); padding: 0 calc(18px * var(--vm-z, 1)); border: 0; border-radius: calc(24px * var(--vm-z, 1));
  background: var(--ec-brand, #ff7701); color: var(--ec-brand-ink, #141413); font-size: calc(15px * var(--vm-z, 1)); font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); cursor: pointer;
}
html.vm-zoom[data-view-mode="desk"] body { padding-bottom: calc(72px * var(--vm-z, 1)); }

/* ---- 6. 달력: 오늘이 1일이면 날짜가 "12/1" 로 적히는데 오늘 원이 24px 고정이라 "/1" 이 잘리거나 삐져나왔다(2026-12-01 서브폰 실측) → 글자 길이만큼 늘어나는 알약 모양 ---- */
html:root body .mc-cell.today .mc-num { width: auto; min-width: 24px; padding: 0 6px; box-sizing: border-box; border-radius: 12px; white-space: nowrap; }

/* ---- 7. 매출 화면 달 고르기(2026-12-02 차장 "과거 달도 볼 수 있어야"): ‹ 2026년 11월 › 가운데, 손가락 48 ---- */
.dm-mon { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 12px 8px; }
.dm-mon[hidden] { display: none; }
.dm-mon-btn { flex: none; width: 48px; height: 48px; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; background: transparent; color: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.dm-mon-btn:disabled { opacity: .35; cursor: default; }
.dm-mon-sel { flex: 0 1 220px; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; background: var(--ec-panel, #1a1d22); color: inherit; font: inherit; font-size: 16px; font-weight: 600; text-align: center; text-align-last: center; }
.dm-mon-btn:focus-visible, .dm-mon-sel:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: 1px; }

/* ---- 8. 새 판 띠(ver.js): 입력 중이라 바로 다시 읽지 못할 때만 아래에 뜬다. 아래 메뉴 위, 손가락 48 ---- */
.ver-bar { position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%);
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)); min-height: 48px; max-width: calc(100vw - 24px); padding: 0 18px;
  border: 0; border-radius: 24px; background: var(--ec-brand, #ff7500); color: var(--ec-brand-ink, #141413);
  font: inherit; font-size: 15px; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); cursor: pointer; white-space: nowrap; }
html[data-view-mode="desk"]:not(.vm-zoom) .ver-bar { bottom: 16px; }
.ver-bar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- 9. 폰 업무함(2026-12-02 차장 "추천대로 진행해"): 홈 4칸 + 통화 요약·대화방·견적서·서류함 목록 화면(m-work.js). 글자 12 이상, 누르는 곳 48 이상. 되돌리기 = 이 9절을 통째로 지운다 ---- */
html[data-view-mode="mobile"] :is(#page-wcall, #page-wroom, #page-wquote, #page-wdocs).on {
  display: block !important; max-width: 780px; margin: 0 auto; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; height: 100%;
}
html[data-view-mode="mobile"] :is(body[data-page="wcall"], body[data-page="wroom"], body[data-page="wquote"], body[data-page="wdocs"]) .main { padding: 0 0 calc(72px + env(safe-area-inset-bottom, 0px)); }
html:root body .wk-root { padding: 0 12px 24px; color: var(--ec-fg, inherit); font-variant-numeric: tabular-nums; }
html:root body .wk-root .dm-topbar { margin: 0 -10px 8px; }
html:root body .wk-root .dm-page-tag { font-size: 12px; }
html:root body .wk-shd { min-height: 48px; padding-right: 64px; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
html:root body .wk-shd .m-sheet-t { flex: 1 1 100%; min-width: 0; word-break: keep-all; overflow-wrap: break-word; }

/* 홈 4칸 */
html:root body #page-home .wk-hd { margin: 14px 2px 6px; font-size: 13px; font-weight: 600; color: var(--ec-muted, #9ba0ab); }
html:root body #page-home .wk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
html:root body .wk-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 56px; padding: 0 12px; border: 1px solid var(--ec-line, #3b414e); border-radius: 6px;
  background: var(--ec-panel, #1a1d22); color: inherit; text-decoration: none; font-size: 15px; font-weight: 600; word-break: keep-all; }
html:root body .wk-cell:active { background: var(--ec-raised, #2b2f36); }
html:root body .wk-cell:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: 1px; }
.wk-cell svg, .wk-row > svg, .wk-back svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .6; }

/* 화면 틀 */
html:root body .wk-top { display: flex; align-items: center; gap: 4px; min-height: 52px; }
html:root body .wk-back { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; min-height: 48px; min-width: 48px; margin-left: -8px; padding: 0 12px 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
html:root body .wk-back:active { background: rgba(127, 127, 127, .16); }
html:root body .wk-back:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: -2px; }
html:root body .wk-crumb { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ec-muted, #9ba0ab); }
.wk-chips { display: flex; gap: 8px; margin: 2px 0 8px; }
.wk-chip { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 4px; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 15px; cursor: pointer; word-break: keep-all; }
.wk-chip[aria-pressed="true"] { background: var(--ec-brand, #ff7500); border-color: transparent; color: var(--ec-brand-ink, #141413); font-weight: 700; }
.wk-chip:focus-visible, .wk-more:focus-visible, .wk-row:focus-visible, .wk-open:focus-visible, .wk-q:focus-visible { outline: 2px solid var(--ec-brand, #ff7500); outline-offset: 1px; }
.wk-meta { display: flex; justify-content: space-between; gap: 8px; margin: 0 2px 6px; font-size: 12px; color: var(--ec-muted, #9ba0ab); }
.wk-old { color: var(--ec-warn, #ff8a2b); }
.wk-stalebox { margin: 0 2px 8px; font-size: 12px; }
.wk-qbox { margin: 2px 0 8px; }
.wk-q { width: 100%; box-sizing: border-box; min-height: 48px; padding: 0 12px; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; background: var(--ec-panel, #1a1d22); color: inherit; font: inherit; font-size: 16px; }
.wk-lbox > .wk-list + .wk-meta { margin-top: 10px; }

/* 목록 */
.wk-list { margin-bottom: 8px; background: var(--ec-panel, #1a1d22); border: 1px solid var(--ec-line, #3b414e); border-radius: 6px; overflow: hidden; }
.wk-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 12px; border: 0; border-top: 1px solid var(--ec-line2, #2d323d); background: transparent;
  color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.wk-row:first-child { border-top: 0; }
.wk-row:active { background: var(--ec-raised, #2b2f36); }
.wk-row-b { flex: 1 1 auto; min-width: 0; }
.wk-r1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wk-rt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.wk-rt.full { white-space: normal; word-break: keep-all; overflow-wrap: break-word; }
.wk-rs { flex: none; font-size: 12px; color: var(--ec-muted, #9ba0ab); white-space: nowrap; }
.wk-amt { flex: none; font-size: 15px; font-weight: 700; white-space: nowrap; }
.wk-amt.none { font-size: 12px; font-weight: 500; color: var(--ec-muted, #9ba0ab); }
.wk-r2 { margin-top: 2px; font-size: 13px; line-height: 1.4; color: var(--ec-fg2, #eceef2); word-break: keep-all; overflow-wrap: break-word; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wk-r2.one { display: block; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--ec-muted, #9ba0ab); -webkit-line-clamp: unset; }
.wk-r2.name { margin-top: 0; font-size: 15px; font-weight: 600; }
.wk-r2.meta { margin-top: 2px; }
.wk-tag { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--ec-raised, #2b2f36); color: var(--ec-fg2, #eceef2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.wk-tag.good { background: var(--ec-tint-good, #1f3b2d); color: var(--ec-good, #62c08f); }
.wk-tag.info { background: var(--ec-tint-info, #25334a); color: var(--ec-info, #6fa8e8); }
.wk-tag.warn { background: var(--ec-tint-warn, #3f2a17); color: var(--ec-warn, #ff8a2b); }
.wk-tag.bad { background: var(--ec-tint-bad, #43232a); color: var(--ec-bad, #ff7a7e); }
.wk-tag.ext { min-width: 52px; border-radius: 6px; }
.wk-more { display: block; width: 100%; min-height: 48px; margin: 0 0 8px; border: 1px solid var(--ec-line, #3b414e); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.wk-note { padding: 18px 12px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--ec-muted, #9ba0ab); word-break: keep-all; }
.wk-deny { display: flex; align-items: center; justify-content: center; min-height: 56px; margin: 8px 0; padding: 0 12px; border: 1px solid var(--ec-line, #3b414e); border-radius: 6px; background: var(--ec-panel, #1a1d22); font-size: 15px; color: var(--ec-fg2, #eceef2); }
.wk-body .es-fail, .wk-body .ui-error { margin: 8px 0; }
.wk-body :is(.es-fail, .ui-error) :is(.es-cause, .es-next, .es-t, .ui-error-text) { font-size: 13px; }
.wk-body :is(.es-fail, .ui-error) :is(button, .ui-btn, a) { min-height: 48px; font-size: 14px; }

/* 아래 창 */
.wk-sub { margin: -2px 0 10px; font-size: 13px; color: var(--ec-muted, #9ba0ab); word-break: keep-all; }
.wk-sec { margin: 12px 0 0; }
.wk-sec h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ec-muted, #9ba0ab); }
.wk-p { margin: 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: keep-all; overflow-wrap: break-word; }
.wk-ol, .wk-ul { margin: 0; padding: 0; list-style: none; }
.wk-ol { counter-reset: wk; }
.wk-ol > li, .wk-ul > li { position: relative; padding: 8px 0; border-top: 1px solid var(--ec-line2, #2d323d); font-size: 15px; line-height: 1.5; word-break: keep-all; overflow-wrap: break-word; }
.wk-ol > li:first-child, .wk-ul > li:first-child { border-top: 0; }
.wk-ol > li { counter-increment: wk; padding-left: 26px; }
.wk-ol > li::before { content: counter(wk); position: absolute; left: 0; top: 8px; width: 20px; font-size: 13px; font-weight: 700; color: var(--ec-muted, #9ba0ab); }
.wk-li-t { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.wk-li-s { margin-top: 2px; font-size: 12px; color: var(--ec-muted, #9ba0ab); }
.wk-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--ec-line2, #2d323d); }
.wk-kv dt { font-size: 12px; color: var(--ec-muted, #9ba0ab); }
.wk-kv dd { margin: 0; font-size: 14px; word-break: keep-all; overflow-wrap: break-word; }
.wk-big { margin: 4px 0 12px; font-size: 24px; font-weight: 700; }
.wk-big small { font-size: 12px; font-weight: 500; color: var(--ec-muted, #9ba0ab); }
.wk-opens { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.wk-open { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 14px; border-radius: 8px; background: var(--ec-brand, #ff7500); color: var(--ec-brand-ink, #141413);
  font-size: 15px; font-weight: 700; text-align: center; text-decoration: none; word-break: keep-all; overflow-wrap: break-word; }
.wk-open.alt { background: transparent; border: 1px solid var(--ec-line, #3b414e); color: inherit; font-weight: 600; }
