:root {
  --blue: #1d4ed8;
  --blue-soft: #e8efff;
  --red: #dc2626;
  --green: #15803d;
  --orange: #c2410c;
  --orange-soft: #fff1e6;
  --gray: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --text: #111827;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); }
[hidden] { display: none !important; }

.top {
  background: var(--blue);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.top-title { font-weight: 700; font-size: 18px; }
.top-sub { font-size: 13px; opacity: .9; }

.banner {
  background: var(--orange-soft);
  border-bottom: 1px solid #fed7aa;
  padding: 10px 16px;
  font-size: 14px;
}
.banner .btn-row { margin-top: 8px; }

.layout { display: flex; flex-direction: column; }
.map-wrap { position: relative; height: 38vh; min-height: 220px; transition: height .2s; }
.map-wrap.big { height: 70vh; }
#map { position: absolute; inset: 0; }
.map-size {
  position: absolute; z-index: 500; right: 10px; bottom: 26px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.panel { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.tabs {
  position: sticky; top: 0; z-index: 600;
  display: flex; background: #fff; border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; border: 0; background: none; padding: 12px 4px; font-size: 15px;
  color: var(--gray); border-bottom: 3px solid transparent; font-weight: 600;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-body { padding: 12px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.label { font-size: 13px; color: var(--gray); font-weight: 600; margin-bottom: 4px; }
.desc { font-size: 14px; color: #374151; margin: 4px 0 10px; }
.hint { font-size: 12.5px; color: var(--gray); margin: 6px 2px 12px; }
.muted { color: var(--gray); font-size: 14px; }
.status { font-size: 14px; margin: 4px 2px 10px; }
.status.err, .err { color: var(--red); }

.now-name { font-size: 24px; font-weight: 800; }
.next-name { font-size: 19px; font-weight: 700; }
.now-meta { font-size: 14px; color: #374151; margin-top: 2px; }
.now-remain { margin: 10px 0; padding: 10px 12px; background: var(--blue-soft); border-radius: 10px; }
.now-remain .big { font-size: 22px; font-weight: 800; color: var(--blue); }
.near { color: var(--green); font-weight: 700; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn-row.end { justify-content: flex-end; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid #cbd5e1; background: #fff; color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  font-family: inherit;
}
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.ok { background: var(--green); color: #fff; border-color: var(--green); }
.btn.ghost { border-color: transparent; color: var(--gray); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 13.5px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.danger { color: var(--red); }
.file-btn { position: relative; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.check.inline { display: inline-flex; margin: 6px 10px 0 0; }
.check input { width: 18px; height: 18px; }

input[type=search], input[type=text], input[type=date], textarea, select {
  font: inherit; font-size: 16px; /* iOS 확대 방지 */
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 10px; background: #fff;
  width: 100%;
}
textarea { resize: vertical; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }
.search-pos { margin-top: 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.search-pos select { width: auto; flex: 1; }
.results { list-style: none; padding: 0; margin: 8px 0 0; }
.results li {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px;
}
.food-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; }
.food-opts select { width: auto; margin-left: 4px; }

/* 경유지 목록 */
.totals { font-size: 14px; }
.totals b { font-size: 17px; }
.stops { list-style: none; padding: 0; margin: 0 0 12px; }
.stop {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 0;
}
.stop.current { border: 2px solid var(--red); }
.stop.done { opacity: .6; }
.stop.draft { background: var(--orange-soft); border-style: dashed; border-color: #fdba74; }
.stop-head { display: flex; gap: 10px; align-items: flex-start; }
.num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.stop.draft .num { background: var(--orange); }
.stop.current .num { background: var(--red); }
.stop.done .num { background: var(--gray); }
.stop-name { font-weight: 700; font-size: 16px; }
.stop-sub { font-size: 13px; color: var(--gray); }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}
.badge.draft { background: var(--orange); color: #fff; }
.badge.cur { background: var(--red); color: #fff; }
.badge.done { background: #d1d5db; color: #374151; }
.stop-memo { font-size: 13.5px; color: #374151; margin-top: 6px; white-space: pre-wrap; }
.stop details { margin-top: 8px; }
.stop summary { font-size: 14px; color: var(--blue); cursor: pointer; }
.stop .fields { display: grid; gap: 8px; margin-top: 8px; }
.stop .fields label { font-size: 13px; color: var(--gray); display: grid; gap: 3px; }
.leg {
  font-size: 13px; color: #374151; padding: 6px 0 6px 22px; margin-left: 13px;
  border-left: 3px solid #93c5fd; margin-top: 0; margin-bottom: 0;
}
.leg.draft { border-left: 3px dashed #fb923c; }
.leg.err { color: var(--red); }

/* 맛집 */
.food-list { list-style: none; padding: 0; margin: 0; }
.food-item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 8px;
}
.food-item.focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.food-name { font-weight: 700; }
.food-sub { font-size: 13.5px; color: #374151; }
.food-hours { font-size: 12.5px; color: var(--gray); margin-top: 2px; }

.share-out { margin-top: 10px; font-size: 13px; height: 80px; }
.small-print { font-size: 13px; color: #374151; }

/* 지도 마커 */
.pin {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue); color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.pin.draft { background: var(--orange); }
.pin.current { background: var(--red); width: 34px; height: 34px; font-size: 15px; }
.pin.done { background: var(--gray); }
.me-dot {
  width: 18px; height: 18px; border-radius: 50%; background: #2563eb;
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25);
}

.modal {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box { background: #fff; border-radius: 14px; padding: 18px; max-width: 440px; width: 100%; }
.modal-text { font-size: 15px; white-space: pre-wrap; }
.toast {
  position: fixed; z-index: 2100; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw;
}

/* PC: 지도 오른쪽, 패널 왼쪽 */
@media (min-width: 900px) {
  body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
  .layout { flex: 1; flex-direction: row-reverse; min-height: 0; }
  .map-wrap, .map-wrap.big { flex: 1; height: auto; }
  .map-size { display: none; }
  .panel { width: 440px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); }
}
