/* 더갓 차량일지 — 휴대폰 먼저. 글꼴 프리텐다드. 색은 남색 하나 + 경고(주황)·위험(빨강)만 */
:root {
  --bg: #f4f5f8; --card: #fff; --ink: #141a26; --sub: #5d6575; --mute: #8a91a0; --line: #e3e6ec;
  --brand: #16233f; --accent: #2f55d4; --accent-soft: #e8eefc;
  --warn: #b45309; --warn-soft: #fff4e5; --bad: #c22f2f; --bad-soft: #fdecec; --ok: #1f7a4d; --ok-soft: #e8f5ee;
  --r: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --tabh: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131b; --card: #181e2a; --ink: #e8ebf2; --sub: #a3abba; --mute: #788195; --line: #2a3242;
    --brand: #0b1222; --accent: #7d9bff; --accent-soft: #1d2a4d;
    --warn: #f0a447; --warn-soft: #33260f; --bad: #ff7b7b; --bad-soft: #3a1717; --ok: #5cc890; --ok-soft: #12301f;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f131b; --card: #181e2a; --ink: #e8ebf2; --sub: #a3abba; --mute: #788195; --line: #2a3242;
  --brand: #0b1222; --accent: #7d9bff; --accent-soft: #1d2a4d;
  --warn: #f0a447; --warn-soft: #33260f; --bad: #ff7b7b; --bad-soft: #3a1717; --ok: #5cc890; --ok-soft: #12301f;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif; font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.who { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }

.view { max-width: 760px; margin: 0 auto; padding: 16px; }
.loading { padding: 48px 0; text-align: center; color: var(--mute); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; height: var(--tabh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--mute); font-size: 11.5px; }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--accent); font-weight: 600; }

h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 22px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 6px; }
.sub { color: var(--sub); font-size: 13.5px; }
.mute { color: var(--mute); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--sub); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 19px; border-radius: 16px; }
.btn:disabled { opacity: .45; cursor: default; }

.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; font-weight: 600; }
.in { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.in:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea.in { min-height: 70px; resize: vertical; }
.odo-in { font-size: 34px; font-weight: 800; text-align: center; letter-spacing: .02em; min-height: 66px; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--sub); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--sub); border: 1px solid var(--line); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.note { padding: 10px 12px; border-radius: 11px; font-size: 13.5px; background: var(--bg); color: var(--sub); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }

/* 홈 */
.hero { background: var(--brand); color: #fff; border-radius: 18px; padding: 18px; }
.hero .sub, .hero .mute { color: rgba(255, 255, 255, .72); }
.hero .big-km { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.hero .btn { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; }
.hero .btn.pri { background: #fff; color: var(--brand); border-color: #fff; }
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #5ee39a; box-shadow: 0 0 0 0 rgba(94, 227, 154, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(94, 227, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 227, 154, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat b { display: block; font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--mute); }

/* 목록 */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.item:first-child { border-top: 0; }
.item .km { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 28px 16px; text-align: center; color: var(--mute); font-size: 14px; }

/* 촬영 */
.shot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; border: 2px dashed var(--line); border-radius: 16px; background: var(--card); color: var(--sub); font-weight: 600; cursor: pointer; text-align: center; padding: 14px; }
.shot svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.shot.sm { flex-direction: row; min-height: 0; padding: 10px; }
.shot.sm svg { width: 22px; height: 22px; }
.thumb { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: #000; display: block; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumbs figure { margin: 0; }
.thumbs figcaption { font-size: 12px; color: var(--mute); margin-top: 4px; }
.thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #000; cursor: zoom-in; }

.sec-t { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.sec-t .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
.dest-list { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; margin-top: 8px; }
.dest-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: var(--card); cursor: pointer; }
.dest-list button:first-child { border-top: 0; }

.map { width: 100%; height: 280px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }

table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tb th, .tb td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tb th { font-size: 12px; color: var(--mute); font-weight: 600; white-space: nowrap; }
.tb td { white-space: nowrap; }
.tb td.r, .tb th.r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); max-width: calc(100% - 32px); background: #1b2333; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #8e1f1f; }

.sheet-bg { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.img-full { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; justify-content: center; }
.img-full img { max-width: 100%; max-height: 100%; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 12px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.admin-tabs .chip { flex: none; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
