/* 폰 전용 화면 (mobile.js) — KRDS 표준형(krds.css) 위에 덮어씀 (index.html 맨 마지막)
   KRDS 규격 그대로: 간격 8px 단위(8·16·24) · 모서리 배지 4 · 버튼·입력칸 6 · 카드 10 · 창 12 · 버튼 높이 48(큰)·40(보통)
   · 글자 13·15·17·19, 굵기 보통·굵게 둘 · 탭은 선 탭(고른 탭 남색 글자 + 밑줄 3px) · 고른 칩은 남색 칠
   PC 는 손대지 않음: 폰에만 쓰는 칸(.m-only · .nav-m · .lbl-m …)을 숨기는 것만 */
.m-only, .nav-m, .lbl-m, .m-list-tools, .m-sub, .m-dtabs, .m-actions, .m-seg, #m-site-add, .m-chart-selects, .sites td.m-meta { display: none; }

/* ── 원격 명령 확인 창 (폰 상세의 "원격 명령") — 아래서 올라오는 창 (KRDS 창 모서리 12) ── */
.m-sheet {
  position: fixed; inset: auto 0 0 0; box-sizing: border-box; width: 100%; max-width: 640px; margin: 0 auto;
  padding: var(--s1) var(--s3) calc(var(--s3) + env(safe-area-inset-bottom)); border: 0; border-radius: 12px 12px 0 0;
  background: var(--bg); color: var(--text); box-shadow: var(--elev-modal);
}
.m-sheet::backdrop { background: rgba(0, 0, 0, 0.5); }
.m-grab { width: 40px; height: 4px; margin: 0 auto var(--s2); border-radius: 2px; background: var(--border); }
.m-sheet h2 { margin: 0; font-size: 19px; font-weight: 700; }
.m-sheet-sub { margin: 4px 0 var(--s2); color: var(--muted); font-size: 15px; }
/* 모드 고르기 (KRDS 선택 상자): 상자 테두리 gray30 · 모서리 10, 고르면 주 색 2px 테두리 + 옅은 주 색 바탕
   동그라미(라디오)는 직접 그림 — 빈 원(gray60) → 고르면 주 색 테두리 + 가운데 점 */
.m-opts { display: flex; flex-direction: column; gap: var(--s1); }
.m-opt { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); cursor: pointer; }
.m-opt input {
  appearance: none; -webkit-appearance: none; display: grid; flex: none; place-content: center; box-sizing: border-box; width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0; /* 입력칸 기본 안쪽 여백(krds)이 붙으면 타원이 됨 */
  border: 2px solid var(--border-input); border-radius: 50%; background: var(--bg); box-shadow: none; cursor: inherit;
}
.m-opt input::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--on); transform: scale(0); transition: transform 0.12s; }
.m-opt input:checked { border-color: var(--on); }
.m-opt input:checked::before { transform: scale(1); }
.m-opt input:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; }
.m-opt span { flex: 1; min-width: 0; }
.m-opt b { display: flex; align-items: center; gap: var(--s1); font-size: 17px; font-weight: 700; }
.m-opt small { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; }
.m-opt:has(input:checked) { padding: 15px; border: 2px solid var(--on); background: var(--on-soft); }
.m-opt.stop b { color: var(--bad); }
.m-opt.stop input:checked { border-color: var(--bad); }
.m-opt.stop input::before { background: var(--bad); }
.m-opt.stop:has(input:checked) { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--bg)); }
/* 지금 모드: 고를 필요 없음 — 흐리게 지우지 않고 회색 바탕 + 칠한 회색 동그라미 + '현재' 배지 */
.m-opt.now { border-color: var(--border); background: var(--hover); cursor: default; }
.m-opt.now input { border-color: var(--muted); }
.m-opt.now input::before { background: var(--muted); transform: scale(1); }
.m-opt.now b::after { content: '현재'; padding: 0 var(--s1); border-radius: 4px; background: var(--sub-strong); color: #fff; font-size: 13px; line-height: 24px; }
:root[data-theme="dark"] .m-opt.now b::after { color: #000; }
.m-sheet-note { margin: var(--s2) 0 0; padding: var(--s2); border-radius: 10px; background: var(--hover); color: var(--muted); font-size: 15px; line-height: 1.5; }
.m-sheet-btns { display: flex; gap: var(--s1); margin-top: var(--s3); }
.m-sheet-btns .btn { flex: 1; min-height: 48px; font-size: 17px; font-weight: 700; }
.m-sheet-btns .btn.primary { flex: 1.6; }
.m-sheet-btns .btn.danger-fill { border-color: var(--bad); background: var(--bad); color: #fff; }
.m-sheet-btns .btn.primary:disabled { border-color: var(--border); background: var(--border); color: var(--faint); } /* 고르기 전: KRDS 비활성 (파랗게 안 보이게) */

/* ── 더보기 (#/more) — 폰 탭에서 오지만 주소로 열면 PC 에서도 보이게 기본 모양은 화면 폭 상관없이 ── */
.m-more { max-width: 640px; }
.m-profile { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: 10px; background: var(--bg); box-shadow: var(--raised); }
.m-avatar { display: flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--sub-soft); color: var(--sub-text); font-size: 19px; font-weight: 700; }
.m-profile b { display: block; font-size: 17px; }
.m-profile small { color: var(--muted); font-size: 15px; }
.m-sec { margin: var(--s3) 0 var(--s1); color: var(--muted); font-size: 15px; font-weight: 700; }
.m-menu { display: flex; flex-direction: column; margin-top: var(--s2); padding: 0 var(--s3); border-radius: 10px; background: var(--bg); box-shadow: var(--raised); }
.m-sec + .m-menu { margin-top: 0; }
.m-menu > a, .m-menu > button {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 56px; padding: 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: none; box-shadow: none; color: var(--text); font: inherit; font-size: 17px; text-align: left; text-decoration: none; cursor: pointer;
}
.m-menu > :last-child { border-bottom: 0; }
.m-menu small { color: var(--muted); font-size: 15px; }
.m-menu .m-danger { color: var(--bad); }
/* 켜고 끄는 스위치 (어두운 화면 · 글자 크게) — KRDS 스위치 크기 (krds.css .switch 와 같음: 40×24, 손잡이 18) */
.m-switch { position: relative; flex: none; width: 40px; height: 24px; border-radius: 12px; background: var(--track-off); transition: background-color 0.15s; }
.m-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
[aria-checked="true"] > .m-switch { background: var(--on); }
[aria-checked="true"] > .m-switch::after { transform: translateX(16px); }

@media screen and (max-width: 860px) {
  /* 바탕은 홈과 같은 옅은 회청색 (사용자가 고른 색 — KRDS 기본은 gray5) — 흰 카드가 면으로 떠 보이게 (다크는 KRDS 검정 그대로, PC 는 홈만)
     카드 테두리: 기본(gray20)은 흐려서 한 단계 진하게(gray30) — 현장 카드 · 홈 카드 · 더보기 */
  :root { --page: #eef2f9; --m-card: 0 0 0 1px var(--border-strong), var(--shadow-1); }
  /* 고장 통계 검색: 두 칸씩 놓이면 시작일이 시/군/구 옆으로 올라감 → 시작일은 새 줄 첫 칸부터 (시작일 · 종료일 한 줄) */
  .stats-search { grid-auto-flow: row; } /* 빈칸을 앞에서부터 채우면 종료일이 시/군/구 옆으로 올라가서 순서대로만 */
  .stats-search label:has(#st-from) { grid-column: 1; }
  .m-card, .m-profile, .m-menu { box-shadow: var(--m-card); }

  /* ── 아래 탭 5개: 홈 · 현장 · 지도 · 알림 · 더보기 (고장·운영 통계·공지는 더보기 안) — 화면 아래 끝까지 붙은 막대,
        고른 탭은 남색 글자·아이콘 + 위쪽 밑줄 3px (KRDS 선 탭, PC 메뉴와 같은 표시) ── */
  .nav-m { display: flex; }
  .nav-pc, .nav-notices { display: none !important; }
  .lbl { display: none; }        /* PC 이름 (모니터링 · 현장 지도 · 알람 이력) */
  .lbl-m { display: inline; }    /* 폰 이름 (현장 · 지도 · 알림) */
  .nav-item[data-view="home"] { order: 1; }
  .nav-item[data-view="list"] { order: 2; }
  .nav-item[data-view="map"] { order: 3; }
  .nav-item[data-view="alarms"] { order: 4; }
  .nav-item[data-view="more"] { order: 5; }
  .nav { right: 0; bottom: 0; left: 0; gap: 0; padding: 0 0 env(safe-area-inset-bottom); border-radius: 0; box-shadow: 0 -1px 0 var(--border); }
  .nav-item { gap: 4px; min-height: 64px; padding: var(--s1) 0; border-radius: 0; color: var(--muted); font-size: 13px; font-weight: 400; }
  .nav-item:hover { background: none; }
  .nav-item svg { width: 24px; height: 24px; }
  .nav-item.active { background: none; box-shadow: inset 0 3px 0 var(--sub-strong); color: var(--sub-text); font-weight: 700; }

  /* ── 헤더: 해·달 토글 · 이름 · 로그아웃 · 공지 글자는 더보기로 — 종(알림)만 남김 ── */
  #top-notices, #theme, #who, #logout { display: none !important; }

  /* ── 홈: 가람 영상 → 지금 확인할 현장 → 내 주변 현장 → 흡착분해제 · 공지 · 바로가기
        전광판·작은 지도 카드는 폰에서 뺌 (지도 탭이 대신) ── */
  .m-only { display: block; }
  #home-ticker, .home-card:has(#home-map) { display: none; }
  .m-block { margin-bottom: var(--s3); }
  .m-title { margin: 0 0 var(--s1); font-size: 19px; font-weight: 700; }
  .dday-list { padding-right: var(--s2); } /* 흡착분해제 목록: 스크롤바가 D-day 칸에 딱 붙지 않게 */
  .home-card .home-head { flex-wrap: wrap; row-gap: var(--s1); } /* 좁은 폰: 제목이 길면 "지남 1" 같은 칸은 아래 줄로 */
  .dday-sum span { white-space: nowrap; }
  .m-cards { display: flex; flex-direction: column; gap: var(--s1); }
  .m-card { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: 10px; background: var(--bg); color: var(--text); text-decoration: none; }
  .m-card-text { display: flex; flex: 1; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
  .m-card-text b { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  .m-card-text small { color: var(--muted); font-size: 15px; }
  .m-card .badge { flex: none; }
  .m-empty { margin: 0 0 var(--s1); padding: var(--s2); border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 15px; text-align: center; }
  .m-locate { width: 100%; min-height: 48px; }
  .m-route { flex: none; min-height: 40px; }

  /* ── 현장 목록: 제목 옆 "현장 추가", 빠르게 거르기 칩은 가운데 (넘치면 다음 줄)
        표시 개수(10개 고정) · 갱신 시각 · 원래 현장 추가가 있던 줄은 폰에서 숨김 ── */
  #board .page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
  #m-site-add { display: inline-flex; flex: none; }
  #board .result-line { display: none; }
  .m-list-tools { display: block; margin-bottom: var(--s2); }
  /* 폰 검색 줄: 검색어 한 줄 가득, 그 아래 [상세 검색][초기화] 반반 (초기화만 아랫줄로 삐져나오지 않게) */
  .search.has-toggle > label.q { flex: 1 1 100%; }
  .search.has-toggle > :is(.filter-toggle, .filter-reset) { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
  .m-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); } /* 한 줄에 3개씩 같은 폭 */
  .m-chip:last-child:nth-child(3n + 1) { grid-column: 1 / -1; } /* 마지막 줄에 하나만 남으면 한 줄 가득 */
  .m-chip { min-width: 0; min-height: 40px; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; letter-spacing: -0.2px; white-space: nowrap; cursor: pointer; }
  .m-chip.bad { color: var(--bad); font-weight: 700; }
  .m-chip[aria-pressed="true"] { border-color: var(--sub-strong); background: var(--sub-strong); color: #fff; font-weight: 700; }
  :root[data-theme="dark"] .m-chip[aria-pressed="true"] { color: #000; }

  /* ── 현장 카드: 1줄 현장명 | 운전모드 · 2줄 지역 · 거리 (+ 이상일 때만 빨간 표시) · 3줄 황화수소 크게 | 송풍기
        시리얼·원격 주소·함내 온습도는 카드에서 빼고 상세에서 ── */
  .table-panel { box-shadow: none; } /* 카드를 감싸는 바깥 판 테두리(그림자 1px 선) 없이 — 카드만 */
  /* 카드 테두리는 진짜 border 로 — 표 줄(tr)에 그림자로 그린 선은 크롬·사파리가 좌우를 빼먹어 모서리만 남음 */
  .sites { border-collapse: separate; border-spacing: 0; }
  .sites tbody tr:not(.empty) { row-gap: var(--s1); margin-bottom: var(--s1); padding: var(--s2); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-1); }
  /* 다른 쪽 현장 카드(.off)는 자리도 차지하지 않게 — 카드 모양(display: grid)이 숨김을 덮으면 안 보이는 카드 20개가 목록 아래 빈 공간으로 남음 */
  .sites tbody tr.off:not(.empty), .st-list tbody tr.off:not(.empty) { display: none; } /* 고장 통계 현장별 목록도 같은 문제 */
  .sites tbody tr:not(.empty) td.serial, .sites tbody tr:not(.empty) td[data-label="함내온도 / 함내습도"] { display: none; }
  .sites td.name .m-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; font-weight: 400; }
  .sites td.name .tag.dev.ok { display: none; } /* 평소 '정상 가동중'은 빼고 이상일 때만 */
  .sites tbody tr:not(.empty) td[data-label^="황화수소"] { grid-row: 2; align-items: baseline; gap: 0 var(--s1); }
  .sites tbody tr:not(.empty) td[data-label^="황화수소"]::before { content: none; }
  .sites tbody tr:not(.empty) td .h2s-pre { font-size: 24px; font-weight: 700; }
  .sites tbody tr:not(.empty) td .h2s-post { font-size: 15px; }
  .sites tbody tr:not(.empty) td .h2s-post::before { content: '여과후 '; color: inherit; }
  .sites tbody tr:not(.empty) td[data-label="송풍기 동작상태"] { grid-row: 2; align-self: center; font-size: 15px; font-weight: 700; }
  /* 현장 지도 목록과 같은 모양 세 줄: ● 현장명(한 줄, 길면 …) / 기기번호 · 모델명 · 거리 [LED] / [상태] 운전 · 여과전 / 여과후
     (운전모드 · 황화수소 · 송풍기 칸은 셋째 줄 m-meta 가 대신 — app.js phoneMetaCell) */
  .sites tbody tr:not(.empty) { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .sites tbody tr:not(.empty) :is(td[data-label="운전모드"], td[data-label^="황화수소"], td[data-label="송풍기 동작상태"]) { display: none; }
  .sites tbody tr:not(.empty) td.name { grid-column: 1; grid-row: 1; }
  .sites td.name .name-row { display: flex; align-items: center; gap: 8px; }
  .sites td.name .name-row > span:not(.net-dot) { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .sites td.name .name-row .tag, .sites td.name .addr { display: none; } /* 배지는 둘째 줄 끝, 기기 이상은 셋째 줄 상태 배지로 */
  .sites td.name .m-sub { margin-top: 4px; }
  .sites td.name .m-sub .tag { margin-left: 6px; vertical-align: 1px; }
  .sites tbody tr:not(.empty) td.m-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; grid-column: 1; grid-row: 2; color: var(--muted); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .sites tbody tr:not(.empty) td.m-meta .badge { padding: 0 var(--s1); font-size: 15px; }
  .sites tbody tr:not(.empty) td.m-meta .h2s-pre { font-size: inherit; font-weight: 700; }
  .sites tbody tr:not(.empty) td.m-meta .h2s-post { font-size: inherit; }
  .sites tbody tr:not(.empty) td.m-meta .h2s-post::before { content: none; }

  /* ── 선 탭 (KRDS): 현장 상세 그래프·이력·정보 · 알림 전체·진행 중·지난 알람 — 아래 회색 선 위에 칸을 나란히,
        고른 탭은 남색 굵은 글자 + 밑줄 3px ── */
  .m-seg, body.view-detail:not(.view-ops-detail) .m-dtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); box-shadow: inset 0 -1px 0 var(--border); }
  .m-seg { margin: var(--s2) 0 0; }
  body.view-detail:not(.view-ops-detail) .m-dtabs { margin: 0 0 var(--s2); }
  .m-seg button, .m-dtabs button { min-height: 48px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--muted); font: inherit; font-size: 17px; cursor: pointer; }
  .m-seg button[aria-selected="true"], .m-dtabs button[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--sub-strong); color: var(--sub-text); font-weight: 700; }

  /* ── 현장 상세: 황화수소 칸을 맨 위 크게 → 탭(그래프 · 이력 · 정보) → 아래 고정 길찾기 · 원격 명령
        (자동/수동/정지 버튼 줄은 숨기고 확인 창으로, 메뉴 탭도 숨김 — 뒤로 가기로 돌아감). 운영 통계 상세는 그대로 ── */
  body.view-detail:not(.view-ops-detail) .nav { display: none; }
  /* 머리 줄: "← 목록"과 "현장 설정"을 위쪽 끝에 맞춤 (현장 설정 밑 안내 줄 높이 때문에 가운데 맞춤이면 목록 버튼이 내려감) */
  body.view-detail .detail-head, body.view-config .detail-head { align-items: flex-start; }
  /* 실시간 그래프: 위아래 밀기는 화면 스크롤, 두 손가락 확대·좌우 밀기는 그래프가 받음 (detail.js attachInteractions) */
  #chart .u-over { touch-action: pan-y; }
  body.view-detail:not(.view-ops-detail) main { padding-bottom: 112px; }
  body.view-detail:not(.view-ops-detail) #d-ctl { display: none; }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile { gap: 4px; padding: var(--s2); }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile .label { font-size: 13px; }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile b { font-size: 19px; }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile:nth-child(3) { grid-column: 1 / -1; order: -1; padding: var(--s3); }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile:nth-child(3) b { font-size: 28px; }
  body.view-detail:not(.view-ops-detail) #d-tiles .tile:nth-child(6) { grid-column: 1 / -1; } /* 전력(값 두 개씩 두 줄)은 폰 한 줄 가득 */
  body.view-detail:not(.view-ops-detail) #d-tiles .power-row { font-size: 19px; line-height: 1.5; }
  /* 그래프 위: 탭 줄 셋 대신 드롭다운 셋 한 줄 [실시간] [날짜 · 평균 기준] [황화수소] (mobile.js) */
  body.view-detail:not(.view-ops-detail) .chart-left, body.view-detail:not(.view-ops-detail) .chart-right { display: none; }
  body.view-detail:not(.view-ops-detail) .m-chart-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); width: 100%; }
  .m-chart-select { width: 100%; min-width: 0; min-height: 40px; padding: 0 28px 0 10px; background-position: right 8px center; font-size: 15px; } /* 칸이 좁아 화살표 자리를 줄여 글자가 안 잘리게 */
  .m-chart-select[hidden] { display: none; }
  body.view-detail:not(.view-ops-detail) #detail[data-mtab="graph"] :is(.map-panel, .info-panel, .ad-panel, .issue-panel),
  body.view-detail:not(.view-ops-detail) #detail[data-mtab="history"] :is(.chart-panel, .map-panel, .info-panel),
  body.view-detail:not(.view-ops-detail) #detail[data-mtab="info"] :is(.chart-panel, .ad-panel, .issue-panel) { display: none; }
  body.view-detail:not(.view-ops-detail) .m-actions {
    position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: flex; gap: var(--s1);
    padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -1px 0 var(--border);
  }
  /* 길찾기(흰 바탕 · gray60 테두리) | 운전 모드 설정(주 색) — 글자만 (아이콘 넣지 않음) */
  .m-actions .btn { flex: 1; min-height: 48px; padding: 0 var(--s2); font-size: 17px; font-weight: 700; white-space: nowrap; }
  .m-actions .btn.primary { flex: 1.7; }

  /* ── 현장 지도: 핀을 누르면 말풍선 대신 화면 아래 창(메뉴 탭 위)에 현장 카드 — 지도 빈 곳을 누르거나 × 로 닫힘 ── */
  .m-map-sheet:not([hidden]) {
    position: fixed; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); left: 0; z-index: 25; max-height: 58vh; overflow-y: auto;
    padding: var(--s1) var(--s2) var(--s2); border-radius: 12px 12px 0 0; background: var(--bg); box-shadow: var(--elev-pop);
  }
  .m-map-sheet::before { content: ''; display: block; width: 40px; height: 4px; margin: 0 auto var(--s1); border-radius: 2px; background: var(--border); }
  .m-map-sheet .pop-wrap { padding: 0; }
  .m-map-sheet .pop { width: auto; max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .m-map-sheet .pop::after { content: none; }
  .m-map-sheet .pop-actions .btn { flex: 1; min-height: 48px; font-size: 17px; font-weight: 700; }

  /* ── 알림(알람 이력): 상태는 선 탭 세 칸으로, "상태" 선택칸은 숨김. 기간 · 종류 한 줄, 검색어는 아래 줄 가득 ── */
  #al-state { display: none; }
  .al-search select { flex: 1 1 calc(50% - var(--s1)); }
  .al-search #al-q { flex: 1 1 100%; }

  /* ── 글자 크게 (더보기): 본문만 키움 — 지도 화면은 지도 좌표가 어긋나서 그대로 ── */
  :root[data-text="big"] body:not(.view-map) main { zoom: 1.12; }

  /* 위치 판의 길찾기는 숨김 — 화면 아래 고정 길찾기와 겹침 (아래 버튼이 이걸 대신 누르므로 지우진 않음, mobile.js) */
  body.view-detail:not(.view-ops-detail) #d-route { display: none; }

  /* ── 현장 상세 머리 줄: PC 접속 (RustDesk 앱) ── */
  .detail-head .d-pc { display: inline-flex; flex: none; }
  /* 카카오톡 전송은 현장명 오른쪽 버튼(m-share)으로 — 버튼 줄의 것(d-share)은 숨김 (m-share 가 대신 누름, mobile.js) */
  #d-share { display: none; }
  #m-share { display: inline-flex; }

  /* ── 카드 줄 나눔 공통: tr::before · ::after 를 한 줄 가득 차는 빈칸으로 써서 줄을 끊음 (order 로 자리 지정) ── */
  :is(#alarms-view .al-table, #users-view .us-table, #users-view .ul-table) tbody tr:not(.empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
  :is(#alarms-view .al-table, #users-view .us-table, #users-view .ul-table) td { display: block; margin: 0; padding: 2px 0; text-align: left; } /* 칸별 규칙(아래)이 이기게 우선순위 낮게 */
  :is(#alarms-view .al-table, #users-view .us-table, #users-view .ul-table) tbody tr:not(.empty)::before,
  :is(#users-view .us-table) tbody tr:not(.empty)::after { content: ''; flex-basis: 100%; height: 0; }

  /* 알람 이력: [상태] 종류 ··· [지속] / 현장 / 발생 / 해제 (진행 중이면 해제 줄 없음) */
  #alarms-view .al-table td.state { order: 1; }
  #alarms-view .al-table td.kind { order: 2; flex: 1; min-width: 0; }
  #alarms-view .al-table td.dur { order: 3; padding: 2px 10px; border-radius: 999px; background: var(--sub-soft); color: var(--text); font-size: 13px; font-weight: 700; }
  #alarms-view .al-table tr::before { order: 4; }
  #alarms-view .al-table td.site { order: 5; flex-basis: 100%; margin: 4px 0 2px; }
  #alarms-view .al-table td.date { order: 6; flex-basis: 100%; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
  #alarms-view .al-table td.date::before { display: inline-block; width: 2.6em; color: var(--faint); }
  #alarms-view .al-table td.date.none { display: none; }

  /* 계정: 이름 아이디 ··· 권한 [활성] / 이메일 · 전화번호 / 생성일 ··· [수정][삭제] */
  #users-view .us-table td.name { order: 1; font-size: 17px; font-weight: 700; }
  #users-view .us-table td.uid { order: 2; flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
  #users-view .us-table td.role { order: 3; color: var(--muted); font-size: 14px; }
  #users-view .us-table td.active { order: 3; }
  #users-view .us-table tr::before { order: 4; }
  #users-view .us-table :is(td.email, td.phone) { order: 6; color: var(--muted); font-size: 14px; }
  #users-view .us-table td.phone::before { content: '· '; color: var(--faint); }
  #users-view .us-table td.email.none + td.phone::before { content: none; } /* 이메일이 없으면 전화번호 앞 점 없이 */
  #users-view .us-table :is(td.email, td.phone).none { display: none; }
  #users-view .us-table tr::after { order: 7; }
  #users-view .us-table td.date { order: 8; flex: 1; color: var(--faint); font-size: 13px; }
  #users-view .us-table td.date::before { content: '생성 '; }
  #users-view .us-table td.act { order: 9; min-width: 0; margin-top: 4px; }

  /* 접속기록: 사용자명 아이디 ··· [종류] / 접속일시 · IP */
  #users-view .ul-table td.name { order: 1; font-weight: 700; }
  #users-view .ul-table td.uid { order: 2; flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
  #users-view .ul-table td.kind { order: 3; }
  #users-view .ul-table tr::before { order: 4; }
  #users-view .ul-table :is(td.date, td.ip) { order: 5; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
  #users-view .ul-table td.ip::before { content: '· '; color: var(--faint); }
}
