:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #6b7486;
  --line: #e3e7ef;
  --brand: #1f5eff;
  --brand-ink: #ffffff;
  --brand-soft: #e8efff;
  --accent: #0a8f5a;
  --warn: #b4540a;
  --warn-soft: #fff4e6;
  --danger: #c0392b;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141c; --surface: #181e29; --text: #e6e9f0; --muted: #98a1b3; --line: #2a3242;
    --brand: #5b8bff; --brand-soft: #1d2a47; --accent: #3ccf8e; --warn: #f0a050; --warn-soft: #2e2416; --danger: #ff6b5b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55; word-break: keep-all;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.2rem; margin: 1.4rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: .8rem 0 .4rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; margin: 0; }

/* nav */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); white-space: nowrap; }
.nav nav { display: flex; align-items: center; gap: 14px; overflow-x: auto; }
.nav nav a, .nav nav .link { color: var(--text); font-size: .95rem; white-space: nowrap; }
.nav nav a.on { color: var(--brand); font-weight: 700; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* buttons */
.btn {
  display: inline-block; background: var(--brand); color: var(--brand-ink) !important; border: 1px solid var(--brand);
  padding: .6rem 1.1rem; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand) !important; }
.btn.sm { padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.block { display: block; width: 100%; margin-top: .5rem; }

/* flash */
.flash { margin-top: 16px; padding: .8rem 1rem; background: var(--brand-soft); border-radius: var(--radius); border: 1px solid var(--line); }
.errors { padding: .8rem 1rem; background: var(--warn-soft); color: var(--danger); border-radius: var(--radius); margin-bottom: 1rem; }

/* hero */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center; padding: 36px 0 12px; }
.hero h1 { font-size: 2rem; line-height: 1.3; }
.hero p { color: var(--muted); font-size: 1.05rem; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1rem; }
.quick { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.quick h2 { margin-top: 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 20px 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stats b { display: block; font-size: 1.6rem; color: var(--brand); }
.stats span { color: var(--muted); font-size: .9rem; }

/* cards */
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; color: var(--text); transition: transform .12s, box-shadow .12s;
}
.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.card h3 { margin: .5rem 0 .2rem; }
.card p { margin: 0 0 .6rem; font-size: .9rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.courier { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.tag.st-open, .tag.ap-accepted { color: var(--accent); border-color: var(--accent); }
.tag.st-pending, .tag.ap-pending { color: var(--warn); border-color: var(--warn); }
.tag.st-rejected, .tag.ap-rejected { color: var(--danger); border-color: var(--danger); }
.badge { background: var(--danger); color: #fff; font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.nums div { background: var(--bg); border-radius: 8px; padding: 8px; }
.nums dt { font-size: .75rem; color: var(--muted); }
.nums dd { margin: 0; font-weight: 700; }
.nums dd.hl { color: var(--accent); }
.nums.big dd { font-size: 1.2rem; }
.empty { color: var(--muted); padding: 2rem; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: .5rem; }
.filters select, .filters input { flex: 1 1 140px; }

/* forms */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; margin-top: .25rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .6rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.stack label { margin-bottom: .8rem; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.form .full { grid-column: 1 / -1; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.detail h1 { margin-top: .6rem; }
.side { position: sticky; top: 76px; }
.side h3 { margin-top: 0; }
.side form { margin: 0; }
.spec { width: 100%; border-collapse: collapse; margin: 16px 0; }
.spec th, .spec td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); }
.spec th { color: var(--muted); font-weight: 500; width: 140px; }
.desc { white-space: pre-wrap; }
.note { padding: .6rem .8rem; border-radius: 8px; background: var(--brand-soft); font-size: .9rem; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: var(--brand-soft); color: var(--accent); }
.safety { margin-top: 16px; background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; font-size: .88rem; }
.safety b, .safety h2 { color: var(--warn); }
.safety ul { margin: .4rem 0 0; padding-left: 1.1rem; }

/* tables */
.scroll { overflow-x: auto; }
.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.list td.msg { max-width: 280px; white-space: pre-wrap; font-size: .9rem; }
.list td.actions { white-space: nowrap; }

/* auth */
.auth { max-width: 440px; margin: 32px auto; }
.auth h1 { margin-top: 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 1rem; }
.role { margin: 0; cursor: pointer; }
.role input { position: absolute; opacity: 0; width: 1px; }
.role span { display: block; border: 2px solid var(--line); border-radius: 10px; padding: 10px; height: 100%; }
.role small { display: block; color: var(--muted); font-weight: 400; }
.role input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.role input:focus-visible + span { outline: 2px solid var(--brand); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.steps ol li { margin-bottom: .4rem; }
.foot { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

@media (max-width: 820px) {
  .hero, .detail, .cols, .form { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }
  .side { position: static; }
  .nav nav { gap: 10px; }
  .nav nav a, .nav nav .link { font-size: .88rem; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .brand .logo { display: none; }
}

/* ---- 용차 조인 ---- */
.sub { margin-top: -.4rem; }
.cta .btn { margin: 0; }
.yc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.price { white-space: nowrap; color: var(--muted); font-size: .85rem; }
.price b { font-size: 1.35rem; color: var(--accent); }
.period { font-size: .9rem; }
.tag.urgent { background: var(--danger); color: #fff; border-color: transparent; font-weight: 700; }
.tag.yc-open { color: var(--accent); border-color: var(--accent); }
.tag.yc-filled { color: var(--brand); border-color: var(--brand); }
.nums.four { grid-template-columns: repeat(4, 1fr); }

.ratio { margin: .3rem 0 .7rem; }
.ratio .bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.ratio .bar span { display: block; height: 100%; }
.apt { background: var(--brand); }
.house { background: #f2a33a; }
.ratio .legend { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.chip { flex: none; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem; }
.chip small { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.on small { color: var(--brand-ink); opacity: .85; }
.chip.zero { opacity: .5; }
.chip:hover { text-decoration: none; border-color: var(--brand); }

fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 .8rem; }
legend { font-weight: 700; font-size: .9rem; padding: 0 4px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row label { flex: 1 1 150px; margin-bottom: 0; }
.row .grow { flex: 3 1 200px; }
.calc { flex: 0 0 auto; padding-bottom: .55rem; display: flex; gap: 6px; align-items: baseline; }
.calc.wide { min-width: 190px; font-weight: 600; }
.calc b.bad { color: var(--danger); }
input[type=range] { padding: 0; accent-color: var(--brand); }
.price-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.price-pick label { margin: 0; cursor: pointer; }
.price-pick input { position: absolute; opacity: 0; width: 1px; }
.price-pick span { display: block; text-align: center; padding: .6rem 0; border: 2px solid var(--line); border-radius: 10px; font-weight: 700; }
.price-pick input:checked + span { border-color: var(--accent); background: var(--brand-soft); color: var(--accent); }
.price-pick input:focus-visible + span { outline: 2px solid var(--brand); }
.estimate { margin: .8rem 0 0; }
.estimate b { color: var(--accent); }

@media (max-width: 820px) {
  .nums.four { grid-template-columns: repeat(2, 1fr); }
  .price-pick { grid-template-columns: repeat(3, 1fr); }
}

/* ---- 택자콜 브랜드 ---- */
.brand-sub { font-size: .7rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
.eyebrow { color: var(--brand); font-weight: 700; margin: 0 0 -.4rem; }

/* ---- 지도 ---- */
.map { height: 380px; border-radius: 12px; border: 1px solid var(--line); isolation: isolate; z-index: 0; margin: .4rem 0; }
.board { position: relative; }
.board-map { height: 460px; }
.board-locate { position: absolute; right: 12px; bottom: 24px; z-index: 500; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg a { padding: .35rem .8rem; color: var(--text); font-size: .9rem; }
.seg a.on { background: var(--brand); color: var(--brand-ink); }
.seg a:hover { text-decoration: none; }

.map-search { display: flex; gap: 8px; align-items: center; }
.map-search input { margin: 0; }
.map-search .btn { flex: none; }
.map-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.map-modes button { font: inherit; font-size: .88rem; padding: .4rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.map-modes button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.map-modes .spacer { flex: 1; }
.map-hint { margin: .2rem 0 0; }
.map-status { margin: .2rem 0 .6rem; font-weight: 600; color: var(--accent); }
.map-status.bad { color: var(--warn); }
.road-entry { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.road-entry input { margin: 0; flex: 1 1 90px; }
.road-entry .road-name { flex: 3 1 180px; }
.road-entry .btn { flex: none; }
.road-chips { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.road-chips li { background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: .25rem .4rem .25rem .75rem; font-size: .88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.road-chips.static li { padding-right: .75rem; }
.road-chips button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }
.roads-title { margin: .8rem 0 0; font-size: .95rem; }

/* 단가 핀 (카카오T 콜처럼) */
.pin-wrap { background: none; border: 0; }
.pin { position: absolute; transform: translate(-50%, -100%); background: var(--brand); color: #fff; border-radius: 10px; padding: 3px 8px; white-space: nowrap; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); line-height: 1.25; font-family: inherit; }
.pin::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--brand); border-bottom: 0; }
.pin b { display: block; font-size: .85rem; }
.pin span { display: block; font-size: .68rem; opacity: .9; }
.pin.urgent { background: var(--danger); animation: pulse 1.6s infinite; }
.pin.urgent::after { border-top-color: var(--danger); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.5); } 50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); } }
@media (prefers-reduced-motion: reduce) { .pin.urgent { animation: none; } }

.pop { font-family: inherit; font-size: .85rem; line-height: 1.5; min-width: 200px; }
.pop .pop-price b { font-size: 1.1rem; color: #0a8f5a; }
.pop .pop-title { font-weight: 700; font-size: .95rem; margin: 2px 0; }
.pop .muted { color: #6b7486; }
.pop-roads { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.pop-roads span { background: #e8efff; color: #1f5eff; border-radius: 999px; padding: 0 6px; font-size: .75rem; }
.pop .btn { margin-top: 6px; }
.leaflet-popup-content a.btn { color: #fff !important; }

@media (max-width: 820px) {
  .map { height: 320px; }
  .board-map { height: 60vh; }
}

/* ---- 카카오맵 오버레이 ---- */
.map.kakao .pin { position: relative; transform: none; margin-bottom: 7px; cursor: pointer; }
.kdot { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #1f5eff; color: #1f5eff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.kpop { position: relative; margin-bottom: 52px; background: #fff; color: #1a2233; border-radius: 12px; padding: 12px 14px; width: 250px; box-shadow: 0 4px 16px rgba(0,0,0,.25); white-space: normal; }
.kpop::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: #fff; border-bottom: 0; }
.kpop-close { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 1.2rem; line-height: 1; color: #6b7486; cursor: pointer; }
.kpop .btn { color: #fff !important; }

/* ---- 기간 빠른 선택 ---- */
.period-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.period-pick button { font: inherit; font-size: .9rem; font-weight: 600; padding: .45rem .85rem; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.period-pick button:hover { border-color: var(--brand); }
.period-pick button.on { border-color: var(--accent); background: var(--brand-soft); color: var(--accent); }
.period-help { margin: .4rem 0 .6rem; }

/* ---- 장기 할인 ---- */
.discount-box { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--brand-soft); }
.discount-box.off { border-color: var(--line); background: transparent; }
.discount-box.off label { opacity: .5; }
.discount-box label.check { align-items: flex-start; margin: 0; font-weight: 500; }
.discount-box label.check input { margin-top: 4px; }
.discount-note { margin: .3rem 0 0; }
.sched { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .88rem; background: var(--surface); border-radius: 8px; overflow: hidden; }
.sched th, .sched td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--line); }
.sched th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.sched:empty { display: none; }
.disc-badge { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: 0 .45rem; margin-left: 4px; vertical-align: middle; }
.price .to { font-size: .95rem; color: var(--muted); font-weight: 700; }
.hl-free { color: var(--accent); }

/* ---- 알림 ---- */
.bell { position: relative; font-size: 1.05rem; }
.bell .badge { position: absolute; top: -6px; right: -10px; font-size: .65rem; line-height: 1.2; }
.bell .badge[hidden] { display: none; }
.nudge { display: block; margin: 4px 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--text); border: 1px solid var(--line); }
.nudge span { color: var(--brand); font-weight: 700; white-space: nowrap; }
.nudge:hover { text-decoration: none; border-color: var(--brand); }
.push-state { margin: .2rem 0 .8rem; }
.help { margin-top: 12px; }
.help summary { cursor: pointer; color: var(--brand); }
.help ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-form fieldset { margin-top: 12px; }
.alert-form .btn { margin-top: 12px; }
.alert-form select { max-width: 260px; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-checks label { margin: 0; cursor: pointer; font-weight: 600; }
.chip-checks input { position: absolute; opacity: 0; width: 1px; }
.chip-checks span { display: inline-block; padding: .3rem .75rem; border: 2px solid var(--line); border-radius: 999px; font-size: .88rem; }
.chip-checks input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.chip-checks input:focus-visible + span { outline: 2px solid var(--brand); }
.notif-list { list-style: none; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--line); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a { display: grid; gap: 2px; padding: 12px 6px; color: var(--text); }
.notif-list a:hover { text-decoration: none; background: var(--bg); }
.notif-list li.unread b::before { content: '●'; color: var(--danger); font-size: .7rem; margin-right: 6px; vertical-align: middle; }
.notif-list li:not(.unread) { opacity: .7; }
