/* 워크체크 — design tokens (그라디언트 X, 다중 box-shadow X, 이모지 X) */
:root {
  /* color */
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #5b6573;            /* AAA 7:1 (이전 #6b7280 = AA 마지노 4.66) */
  --primary: #1f2937;
  --primary-hover: #111827;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --warn: #b45309;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --ok-fg: #065f46;
  --ok-border: #6ee7b7;
  --placeholder: #9aa3b2;
  /* 카카오톡 문의 전용 (도입 문의 = 카톡 채널 — 노랑, 서비스 액션은 --accent 파랑) */
  --kakao: #FEE500;
  --kakao-h: #F4DB00;
  --kakao-fg: #181600;
  /* 상태 뱃지 색 (status badge) — info/warn/ok, neutral 은 --bg/--muted 재사용 */
  --badge-info-bg: #eef2ff;
  --badge-info-fg: #3730a3;
  --badge-warn-bg: #fef3c7;
  --badge-warn-fg: #92400e;
  --badge-ok-bg: #ecfdf5;
  /* 사이드바 다크 surface 팔레트 (#111827 바탕) — 밝은배경 토큰과 역할 분리 */
  --sidebar-bg: #111827;
  --sidebar-fg: #e5e7eb;
  --sidebar-fg-strong: #d1d5db;
  --sidebar-muted: #9ca3af;
  --sidebar-label: #6b7280;
  --focus-ring: rgba(37, 99, 235, 0.15);
  --on-primary: #ffffff;
  --accent-hover-bg: #eff6ff;
  --cell-1:    #e6f4ea;
  --cell-half: #fff4d6;
  --cell-15:   #fde2c8;
  --cell-2:    #fcd9bd;
  /* radius·shadow */
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.10);
  --shadow: var(--shadow-sm);
  /* spacing scale (4·8·12·16·24·32·48) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  /* typography scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  /* z-index */
  --z-base: 1;
  --z-sticky: 10;
  --z-dialog: 100;
  --z-toast: 1000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;                          /* iOS auto-zoom 방지 */
  line-height: 1.5;
  letter-spacing: -0.01em;                  /* 한국어 자간 */
  font-feature-settings: "tnum" 1;          /* 등폭 숫자 */
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: var(--text-2xl); line-height: 1.25; margin: 0 0 var(--space-3); }
h2 { font-size: var(--text-xl); line-height: 1.3;  margin: var(--space-5) 0 var(--space-3); }
h3 { font-size: var(--text-lg); line-height: 1.35; }

/* focus-visible — 마우스 클릭 시 outline X, 키보드 nav 시만 */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 모션 줄이기 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.muted { color: var(--muted); }
.error { color: var(--error); }
.ok { color: var(--ok); }
/* `.muted.small` 조합은 가이드·잡설 텍스트 — 시각 노이즈로 전역 차단 (CLAUDE.md UI 룰) */
.muted.small { display: none !important; }

/* HTML `hidden` 속성은 페이지 CSS `display: flex/grid` 가 cascade 우선이라 무효화됨.
   글로벌 강제로 모든 hidden 토글 안전 보장 (vm-loading 등 스피너 안 꺼지는 버그 차단). */
[hidden] { display: none !important; }

/* 핵심 가이드 (사용자 행동·이유 설명) 는 `.form-help` 사용 — 차단 대상 X */
.form-help { margin: 4px 0 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* mobile topbar (워크체크 브랜딩) */
.m-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.m-brand { font-weight: 700; color: var(--text); font-size: 17px; }
.m-office { flex: 1; }
.m-bigtext-btn { font-weight: 700; flex: 0 0 auto; }

/* ── 큰 글씨 모드 (노인·시력저하 — 헤더 '가+' 토글) ── */
.big-text .m-brand { font-size: 19px; }
/* 인원 목록 */
.big-text .m-rows .name { font-size: 18px; }
.big-text .m-rows .age { font-size: 16px; }
.big-text .m-rows .sex { font-size: 15px; }
.big-text .m-rows .m-group-label { font-size: 13px; }
.big-text .m-list-bar input[type="search"] { font-size: 16px; }
.big-text .m-detail-info { font-size: 14.5px; }
.big-text .m-detail-info dt { font-size: 13px; }
.big-text .m-detail-head h3 { font-size: 18px; }
/* 출역 — 가장 자주 보는 화면 */
.big-text .at-dlabel { font-size: 19px; }
.big-text .at-q { font-size: 15px; }
/* 촬영 화면 */
.big-text .m-field select { font-size: 16px; }
.big-text .cap-shoot-btn strong { font-size: 16px; }
.big-text .cap-hint { font-size: 15px; }
.big-text .cap-send-big { font-size: 19px; }
.big-text .cap-send-photo { font-size: 15px; }
/* 캘린더 */
.big-text .mc-head #mc-title { font-size: 21px; }
.big-text .mc-dow { font-size: 14px; }
.big-text .mc-cell .d { font-size: 17px; }
.big-text .mc-cell .cnt { font-size: 13px; }
.big-text .mc-day h3 { font-size: 19px; }
.big-text .mc-pj .pn { font-size: 17px; }
.big-text .mc-pj .cl { font-size: 13px; }
.big-text .mc-pj .wk { font-size: 15px; }
/* 진행 공사 */
.big-text .mp-f { font-size: 14px; }
.big-text .mp-card .pn { font-size: 17px; }
.big-text .mp-card .sub { font-size: 13px; }
.big-text .mp-mgr .who { font-size: 15px; }
.big-text .mp-call { font-size: 13px; }
.big-text .mp-wk { font-size: 14px; }
.big-text .at-search { font-size: 16px; }
.big-text .at-summary .at-sum-main { font-size: 15px; }
.big-text .at-summary .at-sum-main b { font-size: 18px; }
.big-text .at-jobs { font-size: 14px; color: var(--text); }
.big-text .at-ch .pn { font-size: 18px; }
.big-text .at-ch .cnt { font-size: 15px; }
.big-text .at-wk { font-size: 16px; }
.big-text .at-empty { font-size: 16px; }
.big-text .at-hrow { font-size: 15px; }
/* 하단 탭 */
.big-text .m-tabbar a { font-size: 13px; }

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; color: var(--text); font-size: 18px; }
.topbar nav { display: flex; gap: 12px; flex: 1; }
.topbar nav a { color: var(--text); font-weight: 500; }
.topbar .logout { margin: 0; }

/* buttons — 사각 radius 6px 고정. pill(9999px) 사용 금지. (CLAUDE.md UI 룰) */
.btn-primary, .btn-ghost, button.btn-primary, button.btn-ghost,
a.btn-primary, a.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  line-height: 1;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
  background: var(--surface);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg); }
.btn-sm {
  height: 28px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
}

/* CTA 카드 — 작업 유도 버튼 (거래처 추가·공사 추가·인원 추가·프로필 편집) */
.btn-cta {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--accent);
  font-weight: 700;
  position: relative;
  animation: btn-cta-glow 1.8s ease-in-out infinite;
}
.btn-cta:hover {
  background: var(--accent-hover-bg);
}
@keyframes btn-cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-cta { animation: none; }
}

/* forms */
input, select, textarea, button {
  font: inherit;
  color: inherit;
}
input[type="text"], input[type="tel"], input[type="date"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}
label > input, label > select, label > textarea { margin-top: 4px; }

/* page-head wl-head — 전 페이지 공통 우측 상단 액션바 표준 (CLAUDE.md UI 룰)
   클래스명 통일: 모든 페이지가 <section class="page-head wl-head"> 사용 */
.page-head, .wl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  flex-wrap: nowrap;
}
.page-head h1 { margin: 0; font-size: 18px; white-space: nowrap; }
.page-head .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
/* 액션바 안의 모든 input·button·a·label 은 한 줄 정렬 */
.page-head .actions > * { white-space: nowrap; }
.page-head .actions input[type="search"],
.page-head .actions input[type="text"] {
  width: 240px;
  max-width: 240px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.page-head .actions select {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.page-head .actions label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.page-head .actions label > input { margin: 0; }
/* 버튼 크기·radius·폰트는 글로벌 .btn-primary/.btn-ghost 룰이 처리 (높이 32px 통일) */
/* 좁은 화면(<900px)에서만 줄바꿈 허용 */
@media (max-width: 900px) {
  .page-head { flex-wrap: wrap; }
  .page-head .actions { flex-wrap: wrap; }
  .page-head .actions input[type="search"],
  .page-head .actions input[type="text"] { width: 100%; max-width: 100%; }
}

/* 좁은 창: KPI 그리드 4·3열 → 2열 (카드 짜부·숫자 넘침 방지)
   페이지 <style> 의 repeat(N) 이 main.css 보다 나중 로드라 !important 로 오버라이드 */
@media (max-width: 640px) {
  .b-summary, .o-summary, .cb-summary, .ov-kpi-grid, .kpi-row { grid-template-columns: repeat(2, 1fr) !important; }
}

/* login */
.login {
  max-width: 360px;
  margin: 80px auto;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login p { margin: 0 0 20px; }

/* ─── auth (login / signup) — 가운데 정렬 카드형 ─── */
.auth-wrap {
  max-width: 400px;
  margin: 0 auto;
  padding: 56px var(--space-4) var(--space-7);
  text-align: center;
}
.auth-brand {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.auth-tag {
  margin: var(--space-2) 0 var(--space-6);
  color: var(--muted);
  font-size: var(--text-sm);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 360px;
  margin: 0 auto;
  padding: 52px 40px 36px;
  box-shadow: 0 12px 32px -12px rgba(17, 24, 39, 0.10);
  text-align: left;
}
.auth-error {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 8px; }
.auth-field > span {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-field .req { color: var(--error); font-style: normal; }
.auth-field input {
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  letter-spacing: -0.01em;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}
.auth-field input::placeholder { color: var(--placeholder); }
.auth-field input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.auth-submit {
  height: 44px;
  margin-top: 8px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 120ms ease;
}
.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.auth-foot {
  margin: var(--space-5) 0 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--muted);
}
.auth-foot a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.auth-foot a:hover { text-decoration: underline; }
.auth-foot-sep { margin: 0 6px; color: var(--border); }

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  margin-top: -2px;
}
.auth-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* 로그인 카드 — 카드 안 브랜드 + 우측상단 홈으로 + 비밀번호 보기 토글
   (수치 = autoblog layout.html 로그인 정본과 동일) */
.auth-card { position: relative; }
.auth-home {
  position: absolute; top: 18px; right: 20px;
  font-size: 12px; font-weight: 400;
  color: var(--muted); text-decoration: none;
}
.auth-home:hover { color: var(--text); }
.auth-brand-in {
  display: block; text-align: center;
  font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 32px;
}
.auth-pw-wrap { position: relative; display: block; }
.auth-pw-wrap input { padding-right: 56px; }
.auth-pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  height: 28px; padding: 0 10px;
  font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer;
}
.auth-pw-toggle:hover { background: var(--surface); border-color: var(--accent); }
.auth-card .auth-foot { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border); line-height: 1.7; }
.auth-divider { margin: 24px 0 18px; border: none; border-top: 1px solid var(--border); }
.auth-byline {
  margin: 0; text-align: center;
  font-size: 11px; letter-spacing: -0.01em; color: var(--muted);
}
/* 카톡 문의 칩 — 문의 액션은 노랑, 서비스 액션(로그인·가입)은 --accent 파랑 */
.kakao-chip {
  display: inline-block; padding: 5px 12px; border-radius: 6px;
  background: var(--kakao); color: var(--kakao-fg) !important;
  font-weight: 700; text-decoration: none !important;
}
.kakao-chip:hover { background: var(--kakao-h); }

@media (max-width: 480px) {
  .auth-wrap { padding-top: 32px; }
  .auth-brand { font-size: 30px; }
  .auth-card { padding: var(--space-5) var(--space-4); border-radius: 10px; }
}

/* worker table — 엑셀 표준 (zebra·hover·sticky·우정렬) */
.worker-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.worker-table th, .worker-table td {
  padding: var(--space-3) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.worker-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.worker-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.015); }
.worker-table tbody tr:hover td { background: rgba(37, 99, 235, 0.06); }
.worker-table tr:last-child td { border-bottom: none; }
/* 숫자 컬럼 우정렬·등폭 */
.worker-table .num,
.worker-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 액션 컬럼 가운데 */
.worker-table .center { text-align: center; }

/* info-grid */
.info-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.info-grid dt { color: var(--muted); font-size: 14px; }
.info-grid dd { margin: 0; }

.bank-list { padding: 0; list-style: none; }
.bank-list li {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* doc-grid */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.doc-item {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.doc-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.doc-item figcaption {
  padding: 6px 8px;
  font-size: 13px;
  color: var(--muted);
}

/* form-grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .req { color: var(--error); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* dialog — 폼 2열 들어가도록 폭 확대, 가로 스크롤 차단 */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  max-width: min(560px, 92vw);
  width: 100%;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
dialog::backdrop { background: rgba(17, 24, 39, 0.5); backdrop-filter: blur(2px); }
dialog .form-grid { padding: var(--space-5); max-width: 100%; }
@media (max-width: 600px) {
  dialog { max-width: 96vw; }
  dialog .form-grid { grid-template-columns: 1fr; }
}
.qr-form { padding: 20px; text-align: center; }
.qr-form h3 { margin: 0 0 8px; }
.qr-form img { max-width: 240px; width: 100%; margin: 12px 0; }
.qr-form menu { padding: 0; margin: 12px 0 0; display: flex; justify-content: flex-end; }
.qr-url { font-size: 12px; word-break: break-all; }

/* mobile camera */
.mobile-cam { padding: 16px 0; }
.mobile-cam h1 { margin: 0 0 8px; font-size: 22px; }
.kind-pick { margin: 16px 0; }
.cam-btn { display: block; margin: 16px 0; cursor: pointer; }
.big-btn {
  display: block;
  padding: 32px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}
#preview-wrap {
  margin: 16px 0;
  text-align: center;
}
#preview {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: var(--bg);
}
#preview-wrap button { width: 100%; margin-bottom: 8px; padding: 14px; font-size: 16px; }
.uploaded-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.uploaded-list li {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  color: var(--ok);
}

/* empty state — 5 페이지 공통 */
.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
}
.empty-state h3 { color: var(--text); margin: 0 0 var(--space-2); }
.empty-state p { margin: 0 0 var(--space-4); }

/* 모바일 하단 탭바 */
.m-tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.m-tabbar a {
  padding: var(--space-3) 0 var(--space-3);
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.m-tabbar a.active { color: var(--accent); font-weight: 600; }
.m-tabbar a strong { font-size: var(--text-lg); line-height: 1; }
/* 모바일 앱셸 — 헤더 고정 + 본문만 스크롤 + 하단탭 항상 노출 (주소창 떠도 안 사라짐) */
body.has-tabbar { display: flex; flex-direction: column; height: 100vh; height: 100svh; overflow: hidden; }
body.has-tabbar .m-topbar { position: static; flex: 0 0 auto; }
/* 플렉스 항목에 margin:0 auto(.container) 가 걸리면 폭이 내용너비로 줄어들어 칸이 좁아짐 → 꽉 차게 강제 */
/* overflow-x:hidden — 숨긴 날짜 input(at-picker) 등 빗나간 요소가 가로 스크롤바를 만들어 손가락에 화면이 옆으로 밀리던 것 차단. 세로 스크롤만 유지 */
body.has-tabbar > main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; align-self: stretch; width: 100%; max-width: none; margin: 0; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 1000;
  max-width: 90%;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* form cards (PC 상세화면) */
.form-cards { display: flex; flex-direction: column; gap: 16px; margin: 12px 0; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.form-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.form-date { color: var(--muted); font-size: 13px; }
.form-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slot-thumb { margin: 0; }
.slot-thumb figcaption { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.slot-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: zoom-in;
}
.slot-empty {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

/* mobile home / list */
.mobile-home { padding: 8px 0; }
.mobile-home h1 { font-size: 22px; margin: 0 0 4px; }
.back-link {
  display: inline-block;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 14px;
}
.big-btn.primary {
  display: block;
  text-align: center;
  background: var(--primary);
  color: #fff;
  padding: 18px;
  border-radius: var(--radius);
  margin: 12px 0;
  text-decoration: none;
  font-weight: 600;
}
.m-worker-list { list-style: none; padding: 0; margin: 12px 0; }
.m-worker-list li { margin-bottom: 6px; }
.m-worker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}
.m-worker-row strong { font-size: 16px; }
.form-grid-m {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.form-grid-m .req { color: var(--error); }
.form-grid-m .form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.phone-url { font-family: ui-monospace, "Cascadia Code", "Consolas", monospace; word-break: break-all; }

/* mobile camera — step ui */
.step { margin: 16px 0; }
.step h2 { font-size: 16px; margin: 0 0 4px; }
.step .small { font-size: 13px; }
.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.step-actions button { flex: 1; padding: 14px; font-size: 16px; }

.canvas-wrap {
  position: relative;
  margin: 12px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: inline-block;
  max-width: 100%;
}
#bg-canvas { display: block; max-width: 100%; }
.boxes {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}
.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(37, 99, 235, 0.08);
  pointer-events: auto;
  touch-action: none;
  cursor: move;
  user-select: none;
}
.crop-label {
  position: absolute;
  top: 2px; left: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}
.handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 50%;
  touch-action: none;
}
.handle-tl { top: -8px; left: -8px; cursor: nwse-resize; }
.handle-tr { top: -8px; right: -8px; cursor: nesw-resize; }
.handle-bl { bottom: -8px; left: -8px; cursor: nesw-resize; }
.handle-br { bottom: -8px; right: -8px; cursor: nwse-resize; }

.slot-list { display: flex; flex-direction: column; gap: 12px; }
.slot-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.slot-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 4px;
}

/* small screens */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar nav { gap: 8px; }
  .topbar nav a { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 80px 1fr; }
  .worker-table th, .worker-table td { padding: 8px 10px; font-size: 14px; }
  .form-slots { grid-template-columns: 1fr; }
  .slot-thumb img { height: 200px; }
}

/* ── 프로필 모달 (사이드 좌측상단) ── */
#profile-dialog::backdrop { background: rgba(0,0,0,0.4); }
#profile-dialog {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px; max-width: 640px; width: 90vw;
  background: var(--surface); color: var(--text);
}
.profile-form h3 { margin: 0 0 4px; font-size: 16px; }
.profile-form h4 { margin: 14px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-form .muted.small { margin: 0 0 8px; font-size: 11px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
.profile-grid .full { grid-column: 1 / -1; }
.profile-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.profile-grid input {
  height: 30px; padding: 0 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
}
.profile-actions { display: flex; gap: 8px; justify-content: flex-end; margin: 14px 0 0; padding: 0; }

/* 프로필 모달 — 직인 섹션 */
.pf-stamp-bar { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; margin-top: 14px; background: #f5f5f4; border: 1px solid var(--border); border-radius: 8px; }
.pf-stamp-info { display: flex; flex-direction: column; gap: 4px; }
.pf-stamp-title { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-stamp-hint { font-size: 11px; color: var(--muted); line-height: 1.4; }
.pf-stamp-preview-wrap { position: relative; width: 56px; height: 56px; background: #fff; border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.pf-stamp-preview { width: 100%; height: 100%; object-fit: contain; }
.pf-stamp-empty { font-size: 10px; color: var(--muted); }
.pf-stamp-actions { display: flex; gap: 6px; flex-direction: column; }
.pf-stamp-upload { cursor: pointer; text-align: center; position: relative; }

/* file input 숨김 utility — rules/frontend.md §file input sr-only 강제 패턴.
   `hidden` / `display:none` 사용 시 Chrome 일부 환경에서 label click 전파 차단됨 → 반드시 이 클래스 사용. */
input[type="file"].sr-only,
.pf-stamp-upload input[type="file"] {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
}

/* ── 직인 크롭·누끼 다이얼로그 (stamp-crop) — layout_pc 인라인 추출 ── */
.scd { padding: 0; border: none; border-radius: 10px; max-width: 500px; width: 92vw; overflow: hidden; }
.scd-body { padding: 16px; }
.scd-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.scd-canvas { background: var(--bg); border-radius: 6px; overflow: hidden; max-height: 52vh; }
.scd-canvas img { display: block; max-width: 100%; }
.scd-controls { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.scd-slider { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.scd-slider-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); }
.scd-slider-label { white-space: nowrap; min-width: 72px; }
.scd-slider-row input[type="range"] { flex: 1; }
.scd-th-val { min-width: 26px; text-align: right; }
.scd-hint { font-size: 10px; color: var(--muted); margin: 0; }
.scd-preview { flex-shrink: 0; text-align: center; }
.scd-preview-cap { font-size: 10px; color: var(--muted); margin: 0 0 4px; }
.scd-preview-box { width: 80px; height: 64px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.scd-preview-box img { max-width: 76px; max-height: 60px; object-fit: contain; }
.scd-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ── 글로벌 리스트 표 (.w-list) — 인원·공사·거래처 등 모든 목록 페이지 SSOT ── */
.w-list-wrap { overflow-x: auto; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); }
.w-list { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; table-layout: fixed; }
.w-list th, .w-list td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-list thead th { background: var(--bg); position: sticky; top: 0; z-index: 2; font-weight: 700; font-size: 12px; border-bottom: 1px solid var(--border-strong); }
.w-list thead th.sortable { cursor: pointer; user-select: none; }
.w-list thead th.sortable:hover { background: var(--accent-hover-bg); }
.w-list thead th.sort-asc::after { content: ' ▲'; font-size: 10px; color: var(--accent); }
.w-list thead th.sort-desc::after { content: ' ▼'; font-size: 10px; color: var(--accent); }
.w-list td.col-no { color: var(--muted); font-weight: 600; }
.w-list td.num { text-align: right; padding-right: 12px; }
.w-list tbody tr { cursor: pointer; }
.w-list tbody tr:hover { background: var(--accent-hover-bg); }
.w-list td.name-cell { font-weight: 700; text-align: center; }
.w-list td.name-cell a { color: var(--accent); text-decoration: none; cursor: pointer; }
.w-list td.muted-cell { color: var(--muted); }
.w-list td.addr-cell { text-align: center; font-size: 12px; }

/* 행 삭제 버튼 — 인원·공사 등 모든 리스트 공통 */
.col-del { text-align: center; }
.row-del { padding: 2px 6px; font-size: 12px; background: none; border: none; color: #b91c1c; cursor: pointer; font-family: inherit; }
.row-del:hover { text-decoration: underline; }
