:root {
  --bg: #ffffff; --soft: #f5f6f8; --line: #e4e7ec; --text: #101828; --muted: #5b6474; --faint: #98a2b3;
  --accent: #1d4ed8; --accent-soft: #eef3ff;
  --good: #15803d; --fair: #b45309; --bad: #b91c1c;
  --p-normal: #e8f3ec; --p-normal-line: #8cc3a0; --p-repaint: #fde7c7; --p-repaint-line: #e0a64b; --p-sheet: #fbd0c4; --p-sheet-line: #d9734f; --p-replaced: #f4b4b4; --p-replaced-line: #c43d3d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 16px; max-width: 1180px; margin: 0 auto; }
.topbar .title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); white-space: nowrap; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-left: -8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 20px; }
.back:hover { background: var(--soft); }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 96px; }
.phone { max-width: 480px; margin: 0 auto; }
.page.phone { padding-top: 16px; }

h1 { font-size: 26px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--text); font-size: 15px; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1b45c2; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.btn.block { width: 100%; min-height: 48px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* landing */
.landing .lead { color: var(--muted); font-size: 17px; max-width: 720px; }
.entries { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 24px 0 8px; border-top: 1px solid var(--line); }
.entry { display: block; padding: 18px 20px 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.entry b { display: block; font-size: 17px; margin-bottom: 4px; color: var(--accent); }
.entry span { color: var(--muted); font-size: 14.5px; }
.checklist { padding-left: 20px; margin: 6px 0 0; }
.checklist li { margin-bottom: 8px; }
.note { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }

/* lists */
.list { border-top: 1px solid var(--line); }
.list-row { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.list-row .main { flex: 1; min-width: 0; }
.list-row .main b { display: block; }
.list-row .main span { font-size: 13.5px; color: var(--muted); }
.list-row .side { text-align: right; font-size: 14px; white-space: nowrap; }
.status { font-size: 13px; font-weight: 600; white-space: nowrap; }
.status.draft { color: var(--fair); }
.status.done { color: var(--muted); }
.status.issued { color: var(--good); }
.status.revoked { color: var(--bad); }
.thumb { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--soft); flex: none; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; }

/* forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section { padding: 4px 0 8px; border-bottom: 8px solid var(--soft); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.section:last-of-type { border-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head h2 { margin-top: 20px; }
.section-head .count { font-size: 13px; color: var(--muted); }

/* segmented control */
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row .name { flex: 1; min-width: 0; font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: #fff; padding: 0 12px; min-height: 38px; font-size: 14px; cursor: pointer; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on.good { background: #e7f5ec; color: var(--good); font-weight: 700; }
.seg button.on.fair { background: #fdf1e1; color: var(--fair); font-weight: 700; }
.seg button.on.bad { background: #fde8e8; color: var(--bad); font-weight: 700; }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-cell { position: relative; }
.photo-cell img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: var(--soft); }
.photo-cell select { width: 100%; margin-top: 4px; font-size: 13px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.photo-cell .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.55); color: #fff; cursor: pointer; font-size: 14px; line-height: 26px; padding: 0; }
.photo-cell .size { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(0,0,0,0.55); color: #fff; padding: 1px 6px; border-radius: 4px; }
.add-photo { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 1.5px dashed #c6ccd6; border-radius: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; background: #fafbfc; text-align: center; padding: 6px; }
.add-photo input { display: none; }
.upload-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* car diagram */
.car-wrap { display: flex; justify-content: center; padding: 8px 0 4px; }
.car { width: 100%; max-width: 300px; height: auto; display: block; }
.car .panel { stroke-width: 1.5; cursor: pointer; transition: fill 0.15s; }
.car .panel.none { fill: #ffffff; stroke: #b8bfca; stroke-dasharray: 3 3; }
.car .panel.normal { fill: var(--p-normal); stroke: var(--p-normal-line); }
.car .panel.repaint { fill: var(--p-repaint); stroke: var(--p-repaint-line); }
.car .panel.sheet { fill: var(--p-sheet); stroke: var(--p-sheet-line); }
.car .panel.replaced { fill: var(--p-replaced); stroke: var(--p-replaced-line); }
.car .panel.sel { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.car.readonly .panel { cursor: default; }
.car .body { fill: #f3f4f6; stroke: #c4c9d2; stroke-width: 1.5; }
.car .glass { fill: #dfe6ef; stroke: #c4c9d2; stroke-width: 1; }
.car text { font-size: 10px; fill: #344054; text-anchor: middle; pointer-events: none; font-weight: 600; }
.car text.sub { font-size: 8.5px; fill: #667085; font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); justify-content: center; margin: 4px 0 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid; }
.legend .normal i { background: var(--p-normal); border-color: var(--p-normal-line); }
.legend .repaint i { background: var(--p-repaint); border-color: var(--p-repaint-line); }
.legend .sheet i { background: var(--p-sheet); border-color: var(--p-sheet-line); }
.legend .replaced i { background: var(--p-replaced); border-color: var(--p-replaced-line); }
.panel-editor { background: var(--soft); border-radius: var(--radius); padding: 12px; margin: 6px 0 12px; }
.panel-editor .pe-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.panel-editor .pe-head b { font-size: 16px; }
.um-row { display: flex; gap: 8px; align-items: center; }
.um-row .input { flex: 1; font-size: 18px; font-weight: 600; text-align: right; }
.um-row .unit { color: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.toggle { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14.5px; }
.toggle input { width: 20px; height: 20px; }

/* sticky score bar */
.scorebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16,24,40,0.06); }
.scorebar-in { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.scorebar .sc { font-size: 26px; font-weight: 800; line-height: 1; }
.scorebar .gr { font-size: 14px; font-weight: 700; }
.scorebar .meta { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); line-height: 1.35; }

/* admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 600; font-size: 15px; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
.score-cell b { font-size: 16px; }
.delta-up { color: var(--good); font-weight: 600; }
.delta-down { color: var(--bad); font-weight: 600; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14.5px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.urlbox { display: flex; gap: 8px; align-items: center; background: var(--soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13.5px; word-break: break-all; }
.urlbox span { flex: 1; min-width: 0; }
.log { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13.5px; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.log li time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.alim { max-width: 330px; background: #b9cfe0; border-radius: 12px; padding: 14px; margin: 10px 0; }
.alim .bubble { background: #fff; border-radius: 10px; overflow: hidden; font-size: 14px; }
.alim .bubble .bh { background: #f2f2f2; padding: 8px 12px; font-size: 12.5px; color: #555; font-weight: 600; }
.alim .bubble .bb { padding: 12px; white-space: pre-line; line-height: 1.55; }
.alim .bubble .bbtn { display: block; margin: 0 12px 12px; padding: 9px; text-align: center; border: 1px solid #ddd; border-radius: 6px; font-size: 13.5px; color: #333; }
.alim .from { font-size: 12px; color: #33475b; margin-bottom: 6px; }
.dialog-back { position: fixed; inset: 0; background: rgba(16,24,40,0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: #fff; width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
@media (min-width: 700px) { .dialog-back { align-items: center; } .dialog { border-radius: 14px; } }
.dialog h2 { margin-top: 0; }
.crit-table input.input { min-height: 36px; padding: 4px 8px; }
.crit-table td { padding: 6px 8px; }
.w-num { width: 84px; text-align: right; }
.item-list { display: flex; flex-wrap: wrap; gap: 6px; }
.item-tag { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13.5px; background: #fff; }
.item-tag input { border: 0; width: 7.5em; font-size: 13.5px; padding: 2px 0; }
.item-tag button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; font-size: 15px; }
.banner { background: var(--accent-soft); color: #1e3a8a; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.banner.warn { background: #fff4e5; color: #8a4b08; }

/* report */
.report { padding-bottom: 40px; }
.r-brand { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.r-brand b { font-size: 15px; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; background: #0b0f14; }
.gallery img { width: 100%; flex: none; scroll-snap-align: center; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.g-count { text-align: right; font-size: 12px; color: var(--muted); padding: 6px 16px 0; }
.r-sec { padding: 0 16px; }
.r-title { padding: 14px 16px 4px; }
.r-title h1 { font-size: 22px; margin: 0 0 4px; }
.r-title .spec { color: var(--muted); font-size: 14.5px; }
.score-hero { display: flex; gap: 16px; align-items: center; padding: 18px 16px; margin: 12px 16px; background: var(--soft); border-radius: 14px; }
.ring { width: 96px; height: 96px; flex: none; }
.ring .bgc { fill: none; stroke: #e1e5eb; stroke-width: 9; }
.ring .fgc { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { text-anchor: middle; font-weight: 800; fill: var(--text); }
.score-hero .sum b { display: block; font-size: 17px; margin-bottom: 4px; }
.score-hero .sum span { font-size: 14px; color: var(--muted); }
.bars { margin: 6px 0 4px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 36px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14.5px; }
.bar { height: 8px; border-radius: 99px; background: #e9ecf1; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.r-items details { border-bottom: 1px solid var(--line); }
.r-items summary { display: flex; justify-content: space-between; padding: 12px 0; cursor: pointer; font-weight: 600; list-style: none; }
.r-items summary::-webkit-details-marker { display: none; }
.r-items summary span { color: var(--muted); font-weight: 500; font-size: 14px; }
.r-items .it { display: flex; justify-content: space-between; padding: 6px 0 6px 2px; font-size: 14.5px; border-top: 1px dashed #edf0f3; }
.r-items .it:first-of-type { border-top: 0; }
.st-good { color: var(--good); font-weight: 600; }
.st-fair { color: var(--fair); font-weight: 600; }
.st-bad { color: var(--bad); font-weight: 600; }
.panel-list { margin: 4px 0; font-size: 14.5px; }
.panel-list div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.photo-wall { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo-wall figure { margin: 0; }
.photo-wall img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.photo-wall figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }
.r-foot { margin: 24px 16px 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.r-foot .kv { font-size: 13px; grid-template-columns: 96px 1fr; }
.closed { text-align: center; padding: 80px 24px; }
.closed b { display: block; font-size: 19px; margin-bottom: 8px; }

@media (max-width: 760px) {
  .entries { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 8px; }
  h1 { font-size: 23px; }
  .hide-sm { display: none; }
}
