:root {
  --bg: #f3f4f1;
  --card: #ffffff;
  --ink: #1b221e;
  --sub: #5d6862;
  --line: #dde2dc;
  --brand: #17463a;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe9;
  --amber: #8a5a00;
  --amber-bg: #fff3d6;
  --red: #a3291b;
  --red-bg: #fde9e5;
  --green: #1d6b3a;
  --green-bg: #e2f3e7;
  --blue: #1f4f8f;
  --blue-bg: #e4edf9;
  --chip: #eef1ec;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--sub); }

/* ---------- 머리 */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--brand); color: var(--brand-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 12px;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.pc {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 6px 12px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 14px;
}
.pc .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa59f; }
.pc.on .dot { background: #5fe08a; }
.pc.wait .dot { background: #ffc94a; }
.pc.err { background: #b3261e; }
.pc.err .dot { background: #fff; }
.search {
  margin-top: 10px; width: 100%; height: 46px; border: 0; border-radius: 12px;
  padding: 0 14px; background: #fff; color: var(--ink); font-size: 17px;
}
.days { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 auto; border: 0; border-radius: 999px; height: 38px; padding: 0 14px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 15px; white-space: nowrap;
}
.day.sel { background: #fff; color: var(--brand); font-weight: 700; }
.sec { align-items: center; }
.step-row { display: inline-flex; align-items: center; gap: 6px; }
.step {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--brand); font-size: 22px; line-height: 1; padding: 0;
}

/* ---------- 목록 */
main.list { padding: 12px 12px calc(110px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
.sec { margin: 18px 4px 8px; font-size: 15px; font-weight: 700; color: var(--sub); display: flex; justify-content: space-between; }
.sec:first-child { margin-top: 4px; }
.card {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line);
  background: var(--card); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 8px;
}
.card.inbox { border-color: #e9cf8f; background: #fffaf0; }
.card.hold { border-color: #efb7ad; background: #fff6f4; }
.row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.route { font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money { font-size: 17px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row2 { display: flex; justify-content: space-between; gap: 10px; margin-top: 3px; color: var(--sub); font-size: 15px; }
.row2 .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-grey { background: var(--chip); color: var(--sub); }
.msg { margin-top: 6px; font-size: 14px; color: var(--red); }
.empty { text-align: center; color: var(--sub); padding: 40px 10px; }
.note { font-size: 14px; color: var(--sub); margin: 0 4px 8px; }

.fab {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 6;
  max-width: 696px; margin: 0 auto;
  height: 58px; border: 0; border-radius: 16px; background: var(--brand); color: #fff;
  font-size: 20px; font-weight: 700; box-shadow: 0 6px 18px rgba(23,70,58,.35);
}

/* ---------- 덮는 화면 (입력·상세) */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px 8px; background: var(--card); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 19px; flex: 1; text-align: center; }
.icon-btn { border: 0; background: transparent; height: 44px; min-width: 64px; font-size: 16px; color: var(--brand); font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 14px 24px; max-width: 720px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 10px 12px calc(10px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
.sheet-foot .inner { max-width: 696px; margin: 0 auto; display: flex; gap: 8px; }

.f { margin-bottom: 16px; }
.f > label, .f > .lab { display: block; font-size: 15px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
.in {
  width: 100%; height: 50px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 0 13px; font-size: 18px;
}
textarea.in { height: auto; min-height: 70px; padding: 10px 13px; resize: vertical; }
.in:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.with-btn { display: flex; gap: 8px; }
.with-btn .in { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--chip); border-radius: 10px;
  min-height: 42px; padding: 0 13px; font-size: 16px;
}
.chip.sel { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.hint { font-size: 14px; color: var(--sub); margin-top: 6px; }
.won { font-size: 15px; color: var(--brand); font-weight: 700; margin-top: 6px; min-height: 20px; }
.btn {
  flex: 1; height: 54px; border: 0; border-radius: 14px; background: var(--brand); color: #fff; font-size: 18px; font-weight: 700;
}
.btn.ghost { background: var(--card); color: var(--brand); border: 1px solid var(--line); }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid #efc4bc; }
.btn:disabled { opacity: .55; }
.err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 15px; }
.ok { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 15px; }

/* 자동완성 */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 3; margin-top: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.12);
  max-height: 290px; overflow-y: auto;
}
.ac-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 13px; border-bottom: 1px solid #eef0ec; }
.ac-item:last-child { border-bottom: 0; }
.ac-item b { font-size: 17px; }
.ac-item small { display: block; color: var(--sub); font-size: 14px; }

.contact { margin-top: 8px; background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.recent { margin-top: 8px; }
.recent-item {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left;
  border: 1px dashed #b9c9bf; background: #fff; border-radius: 10px; padding: 9px 12px; margin-top: 6px; font-size: 15px;
}
.recent-item span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.more { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
details.more summary { font-size: 16px; font-weight: 700; color: var(--brand); padding: 6px 0 14px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

/* 상세 */
.kv { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kv-row { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #eef0ec; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { flex: 0 0 74px; color: var(--sub); font-size: 15px; }
.kv-row .v { flex: 1; font-size: 17px; word-break: break-all; }
.kv-row a { color: var(--blue); font-weight: 700; text-decoration: none; }
.detail-title { font-size: 22px; font-weight: 800; margin: 2px 2px 4px; }
.detail-sub { color: var(--sub); margin: 0 2px 12px; }
.actions { display: grid; gap: 8px; margin-top: 14px; }

/* 등록 */
.join { max-width: 420px; margin: 0 auto; padding: 18vh 20px 40px; }
.join h1 { font-size: 26px; margin: 0 0 6px; }
.join p { color: var(--sub); margin: 0 0 20px; }
.join .in { text-align: center; letter-spacing: 3px; font-size: 22px; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); z-index: 30;
  background: #1b221e; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 16px; max-width: 90vw;
}
