:root {
  color-scheme: light;
  /* 바탕은 차가운 들판 회녹색, 면은 흰색. 초록은 '채취 완료'와 주 버튼에만 쓴다 */
  --bg: #edf1ec;
  --card: #ffffff;
  --ink: #16201a;
  --muted: #4d5a51;
  --faint: #66726a;
  --line: #dce3db;
  --accent: #1f6b45;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe6;
  --done-bg: #f1f8f3;
  --warn-bg: #fff1d6;
  --warn-ink: #774800;
  --warn-line: #ebc27a;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --focus: #1f6b45;
  --toast-bg: #16201a;
  --toast-ink: #ffffff;
  --toast-action: #8ee0ae;
  --scrim: rgba(12, 18, 14, 0.45);
  /* 순서 그림(읍면 색: 검증된 색 3개 + 그 밖 회색) */
  --sk-1: #2a78d6;
  --sk-2: #eb6834;
  --sk-3: #1baf7a;
  --sk-other: #8a8a85;
  --sk-line: #8b9187;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1411;
    --card: #19201b;
    --ink: #eef2ee;
    --muted: #b4bfb6;
    --faint: #95a198;
    --line: #2c3630;
    --accent: #5bbe84;
    --accent-ink: #0a140e;
    --accent-soft: #1e3326;
    --done-bg: #15231a;
    --warn-bg: #3a2c10;
    --warn-ink: #f6d58e;
    --warn-line: #7a5a1c;
    --bad: #ff8a80;
    --bad-bg: #3b1714;
    --focus: #5bbe84;
    --toast-bg: #eef2ee;
    --toast-ink: #0f1411;
    --toast-action: #1f6b45;
    --scrim: rgba(0, 0, 0, 0.6);
    --sk-1: #3987e5;
    --sk-2: #d95926;
    --sk-3: #199e70;
    --sk-other: #7d7d78;
    --sk-line: #6f766c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg);
}
.topbar .brand {
  width: auto; min-height: 44px; justify-content: flex-start;
  border: 0; background: none; padding: 6px 0; color: var(--ink);
  font-weight: 800; font-size: 19px;
}
.topbar .ghost { flex: 0 0 auto; white-space: nowrap; }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; }

h1 { font-size: 26px; line-height: 1.3; margin: 8px 0 6px; }
h2 { font-size: 19px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.hint { color: var(--faint); font-size: 15px; margin: 8px 0 0; }
.hint.center { text-align: center; }
.value { font-weight: 700; }
.label { color: var(--faint); font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.hero { padding: 22px 16px; }
.hero h1 { margin-top: 0; }

label { display: block; font-weight: 700; margin-bottom: 8px; }
input[type="password"], input[type="search"], input[type="text"], select {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-size: 19px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}

button, .file-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  margin: 0;
}
.primary { border: 0; background: var(--accent); color: var(--accent-ink); }
.secondary { border: 2px solid var(--accent); background: var(--card); color: var(--accent); }
.danger { border: 2px solid var(--bad); background: var(--card); color: var(--bad); }
.ghost {
  width: auto; min-height: 44px; padding: 6px 14px; font-size: 17px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
button:disabled { opacity: 0.55; cursor: default; }
.file-button { margin-top: 8px; }
.card button + button, .card .secondary + .danger { margin-top: 10px; }

.button-row { display: grid; gap: 10px; margin-top: 12px; }
.button-row.spaced { margin: 18px 0 8px; }

.actionbar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  margin: 16px -16px 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 78%, transparent);
}

.error { color: var(--bad); font-weight: 700; margin: 10px 0 0; }
.notice { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.notice.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

.help { margin: 0 0 12px; padding: 4px 2px; color: var(--muted); }
.help summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 10px 0; }
.help ul { margin: 4px 0 0; padding-left: 20px; }

.last { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.last .secondary { width: auto; min-width: 120px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 16px; font-weight: 700;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.chip.good { background: var(--accent-soft); color: var(--ink); border-color: transparent; }

.field-grid { display: grid; gap: 12px; }
.field-grid label { margin-bottom: 4px; }
.field-grid .req { color: var(--bad); }

.clean-preview { list-style: none; margin: 8px 0 0; padding: 0; }
.clean-preview li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 16px; }
.clean-preview li:first-child { border-top: 0; }
.clean-preview .from { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.clean-preview .to { font-weight: 700; }

.check { display: flex; gap: 10px; align-items: center; font-weight: 700; min-height: 48px; margin: 0 0 8px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }
.inline-label { margin-top: 8px; }

.steps { list-style: none; padding: 0; margin: 0 0 16px; }
.steps li {
  display: flex; gap: 12px; align-items: center; padding: 12px 0;
  border-top: 1px solid var(--line); font-size: 18px;
}
.steps li:first-child { border-top: 0; }
.steps .mark {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  border: 2px solid var(--line); color: var(--faint);
}
.steps li.active .mark { border-color: var(--accent); color: var(--accent); }
.steps li.done .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.bad .mark { border-color: var(--bad); color: var(--bad); }
.steps .count { margin-left: auto; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 16px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.error-card { margin-top: 18px; border-color: var(--bad); }
.error-title { color: var(--bad); font-weight: 800; margin: 0 0 6px; }

.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.inline-form button { width: auto; min-width: 88px; }

table.compare { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
table.compare th, table.compare td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.compare td:first-child { white-space: normal; }
table.compare th:first-child, table.compare td:first-child { text-align: left; }
table.compare thead th { border-top: 0; color: var(--faint); font-weight: 700; font-size: 14px; }
.plain-list { margin: 0; padding-left: 20px; font-size: 16px; }
.plain-list li { margin: 4px 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid var(--accent); border-radius: 12px; overflow: hidden; margin: 6px 0 10px; }
.seg button { min-height: 48px; border: 0; border-radius: 0; background: var(--card); color: var(--accent); font-size: 17px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.sketch { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.sketch-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.sk-route { fill: none; stroke: var(--sk-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sk-dot { stroke: var(--card); stroke-width: 2; }
.sk-1 { fill: var(--sk-1); }
.sk-2 { fill: var(--sk-2); }
.sk-3 { fill: var(--sk-3); }
.sk-other { fill: var(--sk-other); }
.sk-center { fill: var(--ink); stroke: var(--card); stroke-width: 2; }
.sk-label {
  font-size: 13px; font-weight: 800; fill: var(--ink);
  paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round;
}
.sk-hit { fill: transparent; cursor: pointer; }
.sk-hit:focus { outline: none; }
.sk-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink); color: var(--card); border-radius: 10px; padding: 6px 10px;
  font-size: 14px; line-height: 1.35; pointer-events: none; display: grid; text-align: center; max-width: 220px;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sk-legend-1 { background: var(--sk-1); }
.sk-legend-2 { background: var(--sk-2); }
.sk-legend-3 { background: var(--sk-3); }
.sk-legend-other { background: var(--sk-other); }
.legend .sq { width: 12px; height: 12px; border-radius: 2px; background: var(--ink); display: inline-block; }
.legend .ln { width: 18px; height: 2px; background: var(--sk-line); display: inline-block; }

.pick-list { list-style: none; padding: 0; margin: 10px 0 0; }
.pick-list li button {
  justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start;
  min-height: 56px; margin-top: 8px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-size: 17px;
}
.pick-list li button span { font-weight: 400; color: var(--faint); font-size: 15px; }

/* 알림은 화면 아래에 띄운다(현장 화면에서는 아래 탭 바로 위). 목록과 카드의 버튼을 가리지 않는다 */
.toast {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 40; width: calc(100% - 32px); max-width: 448px; min-height: 54px;
  display: flex; align-items: center; gap: 12px;
  background: var(--toast-bg); color: var(--toast-ink); padding: 8px 18px; border-radius: 16px; font-weight: 700; font-size: 16px; line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}
.toast > span { flex: 1; min-width: 0; }
.toast.has-action { padding: 6px 8px 6px 18px; }
.toast-action {
  flex: 0 0 auto; width: auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--toast-action); font-size: 16px; font-weight: 800; white-space: nowrap;
}
body[data-screen="result"] .toast { bottom: calc(76px + env(safe-area-inset-bottom)); background: #17202B; color: #FFFFFF; }
body[data-screen="result"] .toast-action { color: #FEE500; }

/* 한 번 더 묻는 창: 화면 아래에서 올라오고, 맨 아래 버튼이 안전한 쪽이다 */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: flex-end; justify-content: center; background: var(--scrim);
}
.sheet {
  width: 100%; max-width: 560px; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18); animation: sheet-in 0.18s ease-out;
}
.sheet h2 { font-size: 20px; line-height: 1.35; margin: 0 0 6px; }
.sheet p { color: var(--muted); margin: 0 0 18px; }
.sheet-actions { display: grid; gap: 10px; }
.quiet { border: 0; background: transparent; color: var(--muted); }
@keyframes sheet-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────────── 현장 화면(결과): 위 한 줄 + 상세 카드(고정) + 밀어서 고르는 목록 ─────────────
   햇빛 아래에서 잘 보이게 이 화면은 폰이 어두운 모드여도 늘 밝은 색으로 둔다. */
body[data-screen="result"] { overflow: hidden; overscroll-behavior: none; background: #F4F5F7; }
body[data-screen="result"] .topbar,
body[data-screen="result"] main { display: none; }

.field {
  color-scheme: light;
  --bg: #F4F5F7; --card: #FFFFFF; --ink: #17202B; --muted: #4E5968; --faint: #6B7684; --line: #E5E8EB;
  --accent: #17202B; --accent-ink: #FFFFFF; --focus: #2F6BFF; --bad: #B3261E; --bad-bg: #FDECEA;
  --hero: #17202B; --hero-muted: #AEB6C2;
  --done: #00875A; --hold: #F5B83D; --hold-ink: #3D2400; --hold-text: #8F5200; --hold-soft: #FFF3D6;
  --kakao: #FEE500; --kakao-ink: #191919;
  --sk-1: #2a78d6; --sk-2: #eb6834; --sk-3: #1baf7a; --sk-other: #8a8a85; --sk-line: #8b9187;
  --row: 60px; --gap: 6px;
  position: relative; height: 100vh; height: 100dvh; max-width: 480px; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
/* 앱 전체의 큰 버튼·라벨 모양을 이 화면에서는 쓰지 않는다(:where는 우선순위가 낮아 아래 규칙이 이긴다) */
:where(.field) button, :where(.field) .bs-item {
  width: auto; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
:where(.field) label { display: block; margin: 0; font-weight: inherit; }
.field :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 위쪽 한 줄: 진행 + 엑셀 + 메뉴 */
.f-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 16px 0; }
.f-prog { flex: 1; min-width: 0; height: 46px; display: flex; align-items: center; gap: 10px; }
.f-ring { flex: 0 0 auto; display: block; }
.f-ring circle { fill: none; stroke-width: 5; transition: stroke-dasharray 0.25s ease, stroke-dashoffset 0.25s ease; }
.f-ring .bg { stroke: var(--line); }
.f-ring .done { stroke: var(--done); }
.f-ring .hold { stroke: var(--hold); }
.f-count { font-size: 18px; font-weight: 900; letter-spacing: -0.3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.f-count span { font-size: 14px; font-weight: 800; color: var(--faint); }
.f-pill {
  height: 26px; padding: 0 9px; border-radius: 999px; background: var(--hold-soft); color: var(--hold-text);
  font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; white-space: nowrap;
}
.field .f-chipbtn {
  flex: 0 0 auto; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--card);
  font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.field .f-iconbtn { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; background: var(--card); display: grid; place-items: center; }
.field .f-chipbtn:disabled { opacity: 0.55; }

.f-pane { grid-row: 2; min-height: 0; }
.f-order-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); }

/* 상세 카드(고정) */
.f-card {
  position: relative; margin: 8px 16px 0; height: 160px; border-radius: 24px;
  background: var(--hero); color: #FFFFFF; padding: 14px; display: flex; flex-direction: column;
}
.f-card-main { flex: 1; min-height: 0; display: flex; gap: 12px; }
.f-order {
  width: 60px; height: 72px; flex: 0 0 auto; border-radius: 18px; background: rgba(255, 255, 255, 0.09);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.f-order b { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; }
.f-order span { font-size: 11px; font-weight: 800; color: var(--hero-muted); white-space: nowrap; }
.f-order.out b { font-size: 19px; letter-spacing: -0.4px; }
/* 순서 번호 칸도 목록과 같은 상태 색: 채취 전 = 카드와 같은 바탕, 완료 = 초록, 보류 = 노랑 */
.f-order.st-done { background: var(--done); color: #FFFFFF; }
.f-order.st-done span { color: rgba(255, 255, 255, 0.85); }
.f-order.st-hold { background: var(--hold); color: var(--hold-ink); }
.f-order.st-hold span { color: rgba(61, 36, 0, 0.8); }
.f-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.f-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.f-id { flex: 0 0 auto; font-size: 25px; font-weight: 900; letter-spacing: -0.6px; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.f-chips { margin-left: auto; min-width: 0; display: flex; justify-content: flex-end; overflow: hidden; }
.f-chip {
  min-width: 0; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 900;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.f-chip svg { flex: 0 0 auto; }
.f-chip span { overflow: hidden; text-overflow: ellipsis; }
.f-chip.done { background: var(--done); color: #FFFFFF; }
.f-chip.hold { background: var(--hold); color: var(--hold-ink); }
.f-chip.walk { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; font-weight: 800; }
.f-chip.bad { background: #FFDAD6; color: #8C1D18; }
.f-addr { margin-top: 4px; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-sub { margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--hero-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-flag { color: #FFC95C; font-weight: 800; margin-right: 6px; }
.f-acts { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field .f-act {
  height: 48px; border-radius: 15px; font-size: 15px; font-weight: 800; padding: 0 8px; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: transform 0.08s ease;
}
.field .f-act.kakao { background: var(--kakao); color: var(--kakao-ink); }
.field .f-act.rec { background: #FFFFFF; color: var(--ink); }
.field .f-act:active, .field .f-row:active { transform: scale(0.97); }
@media (max-width: 374px) {
  .field .f-act { font-size: 14px; gap: 4px; letter-spacing: -0.3px; }
  .field .f-act svg { width: 16px; height: 16px; }
  .f-count span { display: none; }
}
.tick-down { animation: f-tick-down 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tick-up { animation: f-tick-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes f-tick-down { from { transform: translateY(10px); opacity: 0.15; } to { transform: none; opacity: 1; } }
@keyframes f-tick-up { from { transform: translateY(-10px); opacity: 0.15; } to { transform: none; opacity: 1; } }

/* 목록 + 칸(카드 바로 아래) */
.f-listwrap { position: relative; min-height: 0; margin-top: 8px; }
.f-tail {
  position: absolute; left: 50px; top: -8px; width: 0; height: 0; z-index: 2; pointer-events: none;
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 11px solid var(--hero);
}
.f-list {
  position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scroll-padding-top: 8px; padding: 8px 16px 0;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.f-list::-webkit-scrollbar { display: none; }
.field .f-row {
  width: 100%; height: var(--row); margin: 0 0 var(--gap); border-radius: 16px; background: var(--card); color: var(--ink);
  display: flex; align-items: center; gap: 12px; padding: 0 14px; scroll-snap-align: start;
  transition: opacity 0.2s ease, transform 0.08s ease;
}
.f-row.past { opacity: 0.45; }
.f-badge {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums;
  border: 2px solid #D7DCE2; background: #FFFFFF; color: var(--muted);
}
.f-row.out .f-badge { font-size: 12px; letter-spacing: -0.3px; border-style: dashed; }
.f-row.st-done .f-badge { background: var(--done); border: 2px solid var(--done); color: #FFFFFF; }
.f-row.st-hold .f-badge { background: var(--hold); border: 2px solid var(--hold); color: var(--hold-ink); }
.f-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.f-rid { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 900; line-height: 1.3; }
.f-rtag { padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 800; }
.f-rsub { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-rst { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 900; }
.f-row.st-done .f-rst { color: var(--done); }
.f-row.st-hold .f-rst { color: var(--hold-text); }
/* 마을(읍면 + 리)이 바뀌는 곳의 작은 제목. 칸에 맞춰 멈추는 자리는 아니다 */
.f-vhead {
  height: 26px; margin: 4px 4px 2px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 800; color: var(--faint);
}
.f-vhead span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.f-end {
  min-height: 96px; margin: 0 0 var(--gap); border-radius: 20px; border: 2px dashed #CDD3DB; padding: 12px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; color: var(--muted);
}
.f-end b { font-size: 15px; font-weight: 900; color: var(--ink); }
.f-end span { font-size: 13px; font-weight: 700; }
.f-outhead { margin: 14px 4px 8px; display: flex; align-items: center; gap: 10px; }
.f-outhead div { flex: 1; min-width: 0; }
.f-outhead b { display: block; font-size: 15px; font-weight: 900; color: var(--bad); }
.f-outhead span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.field .f-outbtn { flex: 0 0 auto; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--card); font-size: 14px; font-weight: 800; white-space: nowrap; }
.f-slot {
  position: absolute; left: 11px; right: 11px; top: 3px; height: 70px; z-index: 2; pointer-events: none;
  border: 2.5px solid var(--ink); border-radius: 21px;
}
.f-slot.pulse { animation: f-slot-pulse 0.32s ease-out; }
@keyframes f-slot-pulse {
  0% { transform: scale(1.025); box-shadow: 0 0 0 0 rgba(23, 32, 43, 0.35); }
  100% { transform: none; box-shadow: 0 0 0 9px rgba(23, 32, 43, 0); }
}
.f-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(70px + env(safe-area-inset-bottom)); z-index: 3; pointer-events: none;
  background: linear-gradient(to top, var(--bg) 45%, rgba(244, 245, 247, 0));
}

/* 아래 탭 */
.f-tabs {
  position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4;
  width: 224px; height: 52px; border-radius: 26px; background: var(--ink); padding: 4px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; box-shadow: 0 8px 20px rgba(23, 32, 43, 0.22);
}
.field .f-tab { border-radius: 22px; color: #C3CAD4; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.field .f-tab[aria-current="page"] { background: #FFFFFF; color: var(--ink); font-weight: 800; }

/* 순서 비교 탭 */
.f-compare { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.f-sec { margin-top: 10px; padding: 16px; border-radius: 20px; background: var(--card); }
.f-sec h3 { margin: 0 0 10px; font-size: 16px; font-weight: 900; }
.f-sec .hint { font-size: 14px; }
.f-compare table.compare { font-size: 15px; }
.f-compare .plain-list { font-size: 15px; }

/* 지도: 추천 순서만. 파랑 = 추천 순서(선·번호·표의 추천 칸이 같은 색), 회색 = 엑셀 순서(표에만) */
/* 지도·비교표에서 쓰는 색. 어느 화면에서나 쓸 수 있게 뿌리에 둔다
   (예전엔 .f-compare 안에만 있어서, 지도를 다른 화면으로 옮기자 색이 통째로 빠졌다) */
:root { --rec: #2F6BFF; --listed: #4E5968; }
.rm-sec { padding: 12px; }
.f-sec h3.rm-title { display: flex; align-items: center; gap: 7px; margin: 4px 4px 10px; }
.rm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rm-dot.recommended { background: var(--rec); }
.rm-dot.listed { background: var(--listed); }
.rm-wrap { position: relative; }
.rm-map {
  position: relative; isolation: isolate; height: 58vh; min-height: 280px; max-height: 540px; border-radius: 16px; overflow: hidden;
  background: #E9EDF1; touch-action: none;
}
.rm-map.fallback { height: auto; min-height: 0; max-height: none; background: var(--card); border: 1px solid var(--line); touch-action: auto; }
.rm-loading { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; font-weight: 700; }
.field .rm-fit {
  position: absolute; top: 10px; right: 10px; z-index: 10; height: 40px; padding: 0 12px; border-radius: 12px;
  background: #FFFFFF; color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px rgba(23, 32, 43, 0.22);
}
.rm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 10px 2px 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.rm-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rm-sec.is-fallback .rm-legend { display: none; }
.rm-key-pin {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--rec); color: #FFFFFF; font-size: 11px; font-weight: 800;
}
.rm-key-arrow { font-weight: 900; color: var(--rec); }
.rm-key-dash { display: inline-block; width: 20px; border-top: 3px dashed var(--rec); }
.rm-note { margin: 6px 2px 0; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--faint); }
.rm-note.warn { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--hold-soft); color: var(--hold-text); }
.rm-note.warn span { flex: 1; min-width: 0; }
.rm-retry { flex: 0 0 auto; width: auto; min-height: 0; margin: 0; height: 40px; padding: 0 12px; border-radius: 10px; background: #FFFFFF; color: var(--ink); font-size: 14px; font-weight: 800; }

/* 지도 위 표시(카카오 지도 안에 들어가는 요소) */
/* 번호 동그라미. .field 안에만 두면 지도를 다른 화면으로 옮겼을 때 스타일이 통째로 빠져
   기본 버튼 모양(아주 큼)으로 떨어진다. 지도에서만 쓰는 이름이라 화면을 가리지 않는다. */
.rm-pin {
  position: relative; display: grid; place-items: center; width: auto; min-width: 26px;
  height: 26px; min-height: 0; /* 공통 button의 min-height(48px 이상)를 풀지 않으면 세로로 길어져 지도를 가린다 */
  margin: 0; padding: 0 6px; border-radius: 13px;
  border: 2px solid #FFFFFF; background: var(--rec); color: #FFFFFF; font-size: 13px; font-weight: 800; line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap;
}
.rm-pin::after { content: ""; position: absolute; inset: -9px; } /* 손가락으로 누르기 쉽게 누르는 자리를 넓힌다 */
.rm-pin.st-done { background: var(--done); }
.rm-pin.st-hold { background: var(--hold); color: var(--hold-ink); }
.rm-center {
  padding: 3px 7px; border-radius: 8px; border: 2px solid #FFFFFF; background: var(--ink); color: #FFFFFF;
  font-size: 12px; font-weight: 800; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); white-space: nowrap;
}
.rm-tipwrap { padding-bottom: 22px; cursor: pointer; }
.rm-tip {
  display: grid; gap: 2px; padding: 8px 12px; border-radius: 12px; background: #FFFFFF; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(23, 32, 43, 0.24); font-size: 13px; font-weight: 600; color: var(--muted);
}
.rm-tip b { font-size: 14px; font-weight: 800; color: var(--ink); }

/* 표: 지도에 그린 추천 순서 칸을 같은 색으로 강조 */
.f-compare table.compare th { white-space: nowrap; }
.f-compare table.compare th .rm-dot { margin-right: 5px; vertical-align: 0; }
.f-compare table.compare .c-rec { font-weight: 800; color: var(--ink); background: #F1F5FF; }


/* 아래에서 올라오는 창(기록·주소 고치기·메뉴) */
.bs-wrap {
  position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 30;
  display: flex; flex-direction: column; justify-content: flex-end; background: rgba(23, 32, 43, 0.55);
}
.bs {
  width: calc(100% - 16px); max-width: 464px; max-height: calc(100% - 16px); margin: 0 auto 8px;
  overflow-y: auto; overscroll-behavior: contain; background: #FFFFFF; border-radius: 30px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: bs-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bs:focus { outline: none; }
@keyframes bs-in { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.bs-head { display: flex; align-items: center; gap: 12px; }
.bs-order {
  width: 54px; height: 54px; flex: 0 0 auto; border-radius: 16px; background: var(--ink); color: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.bs-order b { font-size: 22px; font-weight: 900; }
.bs-order span { margin-top: 3px; font-size: 11px; font-weight: 800; color: var(--hero-muted); white-space: nowrap; }
.bs-order.out b { font-size: 16px; }
.bs-title { flex: 1; min-width: 0; }
.bs-id { font-size: 24px; font-weight: 900; letter-spacing: -0.6px; line-height: 1.15; }
.bs-id.small { font-size: 18px; letter-spacing: -0.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-sub { margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field .bs-close { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: var(--bg); display: grid; place-items: center; }
.bs-seg {
  margin-top: 16px; height: 60px; border-radius: 20px; background: var(--bg); padding: 5px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px;
}
.field .bs-seg-btn { border-radius: 15px; font-size: 17px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.field .bs-seg-btn[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; box-shadow: 0 2px 8px rgba(23, 32, 43, 0.14); }
.field .bs-seg-btn[aria-pressed="true"][data-st="done"] { background: var(--done); }
.field .bs-seg-btn[aria-pressed="true"][data-st="hold"] { background: var(--hold); color: var(--hold-ink); }
.field .bs-label { display: flex; align-items: baseline; gap: 6px; margin: 18px 4px 8px; font-size: 15px; font-weight: 900; }
.bs-label span { font-size: 13px; font-weight: 600; color: var(--faint); }
.bs-reasons { display: flex; flex-direction: column; gap: 8px; }
.field .bs-reason {
  min-height: 52px; border-radius: 16px; border: 2px solid transparent; background: var(--bg); padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.bs-reason input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: #C77700; }
.field .bs-reason.on { background: var(--hold-soft); border-color: var(--hold); color: var(--hold-text); font-weight: 800; }
#memo {
  display: block; width: 100%; min-height: 76px; resize: none; border-radius: 16px; border: 2px solid transparent;
  background: var(--bg); padding: 12px 16px; font: inherit; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--ink);
}
#memo:focus { outline: none; border-color: var(--hold); background: #FFFFFF; }
.field .bs-save { margin-top: 16px; width: 100%; height: 56px; border-radius: 18px; background: var(--ink); color: #FFFFFF; font-size: 17px; font-weight: 800; text-align: center; }
.field .bs-save:disabled { background: #C9CED6; opacity: 1; cursor: default; }
.field .bs-reset { margin-top: 6px; width: 100%; height: 48px; color: var(--bad); font-size: 15px; font-weight: 800; text-align: center; }
.bs-note { margin: 12px 4px 4px; font-size: 14px; font-weight: 600; line-height: 1.55; color: var(--muted); }
.bs-fix { margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--bg); }
.bs-fix-head { display: flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 900; }
.bs-fix-head span { font-size: 14px; font-weight: 600; color: var(--muted); }
.bs-fix-why { margin: 4px 0 10px; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--faint); }
.bs-fix-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.field .bs-fix-row input {
  min-height: 48px; border: 2px solid var(--line); border-radius: 14px; background: #FFFFFF;
  font-size: 16px; font-weight: 600; padding: 8px 12px;
}
.field .bs-fix-row input:focus { outline: none; border-color: var(--ink); }
.field .bs-fix-row button { height: 48px; padding: 0 14px; border-radius: 14px; background: var(--ink); color: #FFFFFF; font-size: 15px; font-weight: 800; white-space: nowrap; }
.bs-menu { margin-top: 14px; display: grid; gap: 8px; }
.field .bs-item {
  min-height: 56px; border-radius: 18px; background: var(--bg); padding: 0 16px;
  display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 800; color: var(--ink);
}
.bs-item span { flex: 1; min-width: 0; }
.bs-item b { font-size: 14px; font-weight: 900; }
.field .bs-item.warn { color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  .sheet, .bs { animation: none; }
  .field *, .field *::before, .field *::after { animation: none !important; transition: none !important; }
}

/* ───── 경로 확인 화면(지시서 6장 흐름 2-1) ─────
   숫자는 '차를 몇 번 세우는지' 하나만 보여 준다. 시간·거리는 여기 두지 않는다. */

/* 현장 화면과 같은 밝은 색으로 둔다. 출발 전 햇빛 아래에서도 보려면 어두운 모드를
   따라가면 안 된다(지시서 9장 '현장 화면은 폰이 어두운 모드여도 밝게 둔다'). */
body[data-screen='route'] {
  color-scheme: light;
  --bg: #F4F5F7; --card: #FFFFFF; --ink: #17202B; --muted: #4E5968; --faint: #6B7684; --line: #E5E8EB;
  --accent: #17202B; --accent-ink: #FFFFFF; --focus: #2F6BFF; --bad: #B3261E; --bad-bg: #FDECEA;
  --done: #00875A; --hold: #F5B83D;
  background: var(--bg); color: var(--ink);
}
.rt-h1 { font-size: 24px; margin: 4px 0 2px; }
.rt-h1 b { font-size: 30px; color: var(--accent); }
.rt-sum { color: var(--muted); margin: 0 0 14px; font-size: 15px; line-height: 1.45; }
[data-screen='route'] .rm-sec { padding: 0; }
.rt-wrap .rm-map { height: 46vh; min-height: 240px; max-height: 460px; }
[data-screen='route'] .rm-fit {
  position: absolute; top: 10px; right: 10px; z-index: 10; height: 40px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 800; width: auto; min-height: 0; margin: 0;
}
.rt-label { font-weight: 800; margin: 18px 0 8px; }
.rt-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rt-preset {
  width: auto; min-height: 52px; margin: 0; font-size: 17px; font-weight: 800;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
}
.rt-preset[aria-pressed='true'] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.rt-preset[disabled] { opacity: 0.55; }
.rt-hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.rt-go { margin-top: 20px; }

/* 아래에서 올라오는 창 안의 긴 내용(계산 정보) */
.bs-scroll { max-height: 62vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
