:root {
  --bg: #f4f6f8; --card: #fff; --ink: #14181f; --sub: #5b6573; --line: #e3e7ec;
  --brand: #0f766e; --brand-soft: #e6f4f2;
  --disp: #1d4ed8; --disp-soft: #e8eefc;   /* 배차 */
  --deli: #b45309; --deli-soft: #fdf1e3;   /* 딜버 */
  --ok: #15803d; --warn: #b91c1c;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --card: #171b21; --ink: #e7ebf0; --sub: #9aa4b2; --line: #272d36;
    --brand: #2dd4bf; --brand-soft: #12302d; --disp: #8fb0ff; --disp-soft: #1a2442; --deli: #f5b35c; --deli-soft: #3a2a14;
    --ok: #4ade80; --warn: #f87171;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --card: #171b21; --ink: #e7ebf0; --sub: #9aa4b2; --line: #272d36;
  --brand: #2dd4bf; --brand-soft: #12302d; --disp: #8fb0ff; --disp-soft: #1a2442; --deli: #f5b35c; --deli-soft: #3a2a14;
  --ok: #4ade80; --warn: #f87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 17px; color: var(--brand); }
.brand span { color: var(--sub); font-weight: 600; font-size: 13px; margin-left: 4px; }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.live.on i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.live.off i { background: var(--warn); }

.tabs { position: sticky; top: 49px; z-index: 4; display: flex; gap: 4px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; max-width: 160px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 10px; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs b { font-weight: 700; opacity: .8; font-size: 12px; }

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 80px; }
.tab { display: none; }
.tab.on { display: block; }

.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 10px; text-align: center; cursor: pointer; min-width: 62px; }
.day small { display: block; font-size: 11px; color: var(--sub); }
.day b { font-size: 15px; }
.day em { display: block; font-style: normal; font-size: 11px; color: var(--brand); font-weight: 700; min-height: 16px; }
.day.on { border-color: var(--brand); background: var(--brand-soft); }
.day.today small { color: var(--brand); font-weight: 700; }

h3.sec { margin: 18px 2px 8px; font-size: 13px; color: var(--sub); font-weight: 700; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; position: relative; }
.card:hover { border-color: var(--brand); }
.card.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 0 transparent; } }
.row1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.b-disp { background: var(--disp-soft); color: var(--disp); }
.b-deli { background: var(--deli-soft); color: var(--deli); }
.b-st { background: var(--brand-soft); color: var(--brand); }
.b-err { background: #fde8e8; color: var(--warn); }
.time { font-weight: 800; font-size: 16px; }
.who { font-weight: 700; font-size: 16px; }
.car { color: var(--sub); }
.lines { margin-top: 6px; display: grid; gap: 2px; font-size: 14px; }
.lines div { display: flex; gap: 8px; }
.lines span.k { color: var(--sub); flex: 0 0 52px; font-size: 13px; }
.lines span.v { flex: 1; min-width: 0; word-break: keep-all; overflow-wrap: anywhere; }
.tel { color: var(--brand); font-weight: 600; text-decoration: none; }
.empty, .state { color: var(--sub); text-align: center; padding: 24px 8px; font-size: 14px; }
.state:empty { display: none; }

.tools { display: grid; gap: 8px; margin-bottom: 10px; }
.tools input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 15px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chip small { opacity: .7; margin-left: 3px; }

.chat { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; max-height: calc(100vh - 210px); overflow-y: auto; }
.chat .dsep { text-align: center; font-size: 12px; color: var(--sub); margin: 12px 0 6px; }
.msg { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.msg:last-child { border-bottom: 0; }
.msg .h { font-size: 12px; color: var(--sub); }
.msg .h b { color: var(--ink); font-size: 13px; margin-right: 4px; }
.msg .t { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.msg.ack .t { color: var(--sub); }
.msg.sys { text-align: center; font-size: 12px; color: var(--sub); }
.msg.resv { border-left: 3px solid var(--brand); padding-left: 8px; }
.msg.flash { background: var(--brand-soft); transition: background 2s; }
.msg .room { font-size: 11px; color: var(--brand); margin-left: 4px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 88vh; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
#detailBody { padding: 16px 18px 4px; overflow-y: auto; max-height: calc(88vh - 60px); }
#detailBody h2 { margin: 0 0 4px; font-size: 18px; }
#detailBody table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
#detailBody th { text-align: left; color: var(--sub); font-weight: 600; width: 96px; padding: 4px 6px 4px 0; vertical-align: top; }
#detailBody td { padding: 4px 0; word-break: break-word; }
#detailBody tr.g th { padding-top: 12px; color: var(--brand); }
#detailBody pre { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px; font: 13px/1.5 inherit; margin: 6px 0 12px; }
dialog form { padding: 8px 16px 14px; text-align: right; }
.close { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 18px; cursor: pointer; }

.card.done { opacity: .62; }
.b-ok { background: #e7f6ec; color: var(--ok); }
.hint { font-size: 11px; color: var(--sub); border: 1px dashed var(--line); border-radius: 6px; padding: 0 5px; }
.foot1 { margin-top: 8px; font-size: 12px; color: var(--sub); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rtag { font-size: 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; color: var(--ink); }
#detailBody h2 small { color: var(--sub); font-size: 14px; font-weight: 600; }
#detailBody h3.sub { font-size: 14px; color: var(--brand); margin: 16px 0 6px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); font-size: 13px; }
.tl li { position: relative; padding: 3px 0 3px 10px; display: grid; grid-template-columns: 78px 70px 1fr; gap: 2px 6px; }
.tl li::before { content: ''; position: absolute; left: -16px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.tl li.approx::before { background: var(--card); border: 2px solid var(--sub); width: 6px; height: 6px; }
.tl li.approx { color: var(--sub); }
.tl .t { white-space: nowrap; color: var(--sub); }
.tl .s { font-weight: 700; }
.tl .l { min-width: 0; overflow-wrap: anywhere; }
.tl .w { grid-column: 3; font-size: 11px; color: var(--sub); }
@media (max-width: 480px) { .tl li { grid-template-columns: 70px 1fr; } .tl .l, .tl .w { grid-column: 1 / -1; padding-left: 0; } }
.note { font-size: 12px; color: var(--sub); margin: 6px 0; }
.raw { margin-bottom: 8px; }
.raw .h { font-size: 12px; color: var(--sub); }
.raw pre { margin: 2px 0 0; }

.foot { position: fixed; bottom: 0; left: 0; right: 0; padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); font-size: 12px; color: var(--sub); background: var(--card); border-top: 1px solid var(--line); text-align: center; }
