/* =========================================================
   바이크 닥터 시안 D · Center Proof
   다크 운영 화면 → paper 증명 화면. 외부 의존성 0.
   ========================================================= */

:root {
  /* 운영(다크) 토큰 — A(앰버)/B(라임)/C(레드)와 겹치지 않는 틸 계열 */
  --bg:        #0A0E13;
  --surface:   #151B23;
  --surface-2: #1D2530;
  --line:      #2A3440;
  --text:      #E8EDF4;
  --muted:     #93A1B4;
  --accent:    #F9CA12;   /* 브랜드 옐로 · 센터 확인 / 진행 */
  --accent-dim:#7A5F06;
  --warn:      #F5A524;
  --danger:    #FF6B60;
  --ok:        #3DDC84;

  /* 증명(paper) 토큰 */
  --paper:     #F4F1E7;
  --paper-2:   #EAE5D6;
  --ink:       #22201A;
  --ink-soft:  #6B6455;
  --ink-line:  #CFC7B2;

  --r: 14px;
  --ease: cubic-bezier(.22, .68, 0, 1);
  --dur: .55s;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
          "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: #05070A;
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 브라우저 스테이지 (폰 프레임 바깥) ---------- */
.stage {
  min-height: 100vh;
  padding: clamp(8px, 2vw, 28px) clamp(4px, 2vw, 28px) clamp(16px, 3vw, 36px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background:
    radial-gradient(120% 60% at 50% 0%, #101822 0%, #05070A 62%);
}
.stage-note, .stage-foot {
  max-width: 460px; margin: 0; text-align: center;
  font-size: 12px; line-height: 1.6; color: #7C8AA0;
}
.stage-note strong { color: var(--accent); font-weight: 600; }

/* ---------- 폰 프레임 360×780 ---------- */
.phone {
  width: 360px; max-width: 100%; height: 780px; max-height: none;
  border-radius: 26px; padding: 8px;
  background: #0A0D12;
  border: 1px solid #212B36;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(255, 255, 255, .02);
  flex: none;
}

.app {
  position: relative; height: 100%; overflow: hidden;
  border-radius: 20px;
  display: grid; grid-template-rows: 48px 1fr auto auto;
  background: var(--bg); color: var(--text);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* ---------- 앱바 ---------- */
.appbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.bd {
  display: block; flex: none;
  width: 26px; height: 26px;
  object-fit: contain;
}
.appbar-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.appbar-reset {
  margin-left: auto; height: 48px; min-width: 64px; padding: 0 10px;
  background: none; border: 0; cursor: pointer;
  font-size: 12px; color: var(--muted);
}
.appbar-reset:active { color: var(--text); }

/* ---------- 스크린 영역 ---------- */
.screens {
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screens::-webkit-scrollbar { width: 0; }
.screen { padding: 14px 12px 18px; }
.screen:focus { outline: none; }
.screen-h { margin: 2px 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.screen-sub { margin: 0 0 12px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* ---------- 공통 카드 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 10px;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card-h {
  margin: 0 0 10px; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--muted); text-transform: none;
}
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* =========================================================
   1. 작업현황 — 히어로
   ========================================================= */
.hero {
  border-radius: var(--r); padding: 16px 14px 14px; margin-bottom: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, #17222C 0%, #121820 70%);
}
.hero-kicker {
  margin: 0 0 8px; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hero-state {
  margin: 0 0 8px; font-size: 19px; line-height: 1.35; font-weight: 700;
  letter-spacing: -.03em; word-break: keep-all;
}
.hero-line {
  margin: 0 0 16px; font-size: 13px; line-height: 1.65; color: #C3CEDC;
  word-break: keep-all;
}
.hero-line strong { color: var(--text); font-weight: 700; }

.app[data-stage="inspected"] .hero { border-color: #3A4250; }
.app[data-stage="approved"] .hero { border-color: var(--accent-dim); }
.app[data-stage="done"] .hero {
  border-color: var(--accent);
  background: linear-gradient(165deg, #133029 0%, #111A20 72%);
}

/* 진행선 — 상태 변경당 하나의 모션 */
.steps { position: relative; padding-top: 4px; }
.steps-track {
  position: absolute; top: 13px; left: 10%; right: 10%; height: 2px;
  background: #2E3947; border-radius: 2px;
}
.steps-fill {
  display: block; height: 100%; width: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transform: scaleX(var(--p, 0)); transform-origin: 0 50%;
  transition: transform .8s var(--ease);
}
.steps-list {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr);
  margin: 0; padding: 0; list-style: none;
}
.steps-list li { display: grid; justify-items: center; gap: 6px; }
.node {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid #3A4655;
  transition: background-color .3s, border-color .3s, box-shadow .3s;
}
.step-label {
  font-size: 10px; line-height: 1.2; color: #7F8DA0; white-space: nowrap;
}
li[data-state="done"] .node { background: var(--accent); border-color: var(--accent); }
li[data-state="done"] .step-label { color: #A9BACB; }
li[data-state="now"] .node {
  background: var(--bg); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 202, 18, .18);
}
li[data-state="now"] .step-label { color: var(--accent); font-weight: 700; }

/* 워크오더 카드 */
.kv { margin: 0; display: grid; gap: 8px; }
.kv > div { display: flex; align-items: baseline; gap: 10px; }
.kv dt { flex: none; width: 62px; font-size: 11px; color: var(--muted); }
.kv dd { margin: 0; font-size: 13px; font-weight: 600; word-break: keep-all; }
.wo-order {
  margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11px; line-height: 1.6; color: var(--muted);
}
.wo-order .num { color: #C3CEDC; }

/* CTA */
.cta-zone { margin: 4px 0 10px; }
.cta {
  display: block; width: 100%; min-height: 56px; padding: 14px 16px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #172331;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
}
.cta:active { background: #2BB49B; }
.cta:disabled {
  background: var(--surface-2); color: var(--muted); cursor: default;
  border: 1px solid var(--line);
}
.cta-sm { min-height: 56px; font-size: 15px; margin-top: 12px; }
.cta-note {
  margin: 8px 2px 0; font-size: 11px; line-height: 1.6; color: var(--muted);
  word-break: keep-all;
}
.done-card { border-color: var(--accent-dim); }
.done-line {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 1.6; color: #D6E2EC; word-break: keep-all;
}
.seal-mini {
  flex: none; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 10px; font-weight: 800;
}

/* =========================================================
   2. 점검표 — DVI
   ========================================================= */
.dvi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 10px; overflow: hidden;
}
/* 상태를 색만으로 구분하지 않는다: 아이콘 + 문구 + 테두리 두께/형태 */
.dvi[data-level="replace"] { border-left: 5px solid var(--danger); }
.dvi[data-level="watch"]   { border-left: 5px dashed var(--warn); }
.dvi[data-level="ok"]      { border-left: 5px dotted var(--ok); }

.dvi-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 64px; padding: 12px 12px;
  background: none; border: 0; text-align: left; cursor: pointer;
}
.dvi-icon { flex: none; width: 22px; height: 22px; }
.dvi-icon svg { width: 100%; height: 100%; }
.dvi-icon svg path, .dvi-icon svg rect, .dvi-icon svg circle { fill: currentColor; }
.dvi-icon svg circle, .dvi-icon svg .glyph { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dvi[data-level="replace"] .dvi-icon { color: var(--danger); }
.dvi[data-level="watch"]   .dvi-icon { color: var(--warn); }
.dvi[data-level="ok"]      .dvi-icon { color: var(--ok); }

.dvi-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.dvi-name { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.dvi-fact { font-size: 11px; line-height: 1.5; color: var(--muted); word-break: keep-all; }
.dvi-badge {
  flex: none; padding: 4px 7px; border-radius: 6px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
  border: 1px solid currentColor;
}
.dvi[data-level="replace"] .dvi-badge { color: var(--danger); background: rgba(255, 107, 96, .1); }
.dvi[data-level="watch"]   .dvi-badge { color: var(--warn);   background: rgba(245, 165, 36, .1); }
.dvi[data-level="ok"]      .dvi-badge { color: var(--ok);     background: rgba(61, 220, 132, .1); }

.dvi-chev {
  flex: none; width: 9px; height: 9px; margin-right: 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .3s var(--ease);
}
.dvi-head[aria-expanded="true"] .dvi-chev { transform: rotate(225deg) translate(-2px, -2px); }

.dvi-panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .34s var(--ease);
}
.dvi-panel.is-open { grid-template-rows: 1fr; }
.dvi-panel > .dvi-panel-in { overflow: hidden; }
.dvi-panel-in > :first-child { margin-top: 0; }
.dvi-panel-in { padding: 0 12px; }
.dvi-panel-in > :last-child { margin-bottom: 14px; }

.gauge-cap {
  margin: 2px 0 10px; font-size: 10px; letter-spacing: .04em; color: var(--muted);
}
.gauge { position: relative; margin-bottom: 30px; }
.gauge-bar {
  display: block; height: 10px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--line); overflow: hidden;
}
.gauge-fill {
  display: block; height: 100%; width: var(--v, 0%);
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}
.dvi[data-level="replace"] .gauge-fill { background: linear-gradient(90deg, #7A2A26, var(--danger)); }
.dvi[data-level="watch"]   .gauge-fill { background: linear-gradient(90deg, #7A5714, var(--warn)); }
.dvi[data-level="ok"]      .gauge-fill { background: linear-gradient(90deg, #1C6B3C, var(--ok)); }

.gauge-mark {
  position: absolute; top: 19px; left: var(--at, 0%);
  transform: translateX(-50%);
  font-size: 10px; color: #C3CEDC; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gauge-mark i {
  position: absolute; left: 50%; top: -17px; width: 2px; height: 15px;
  background: #C3CEDC; transform: translateX(-50%);
}
.gauge-mark-end { color: var(--muted); }
.gauge-mark-end i { background: var(--muted); }
.ticks {
  position: absolute; left: 0; right: 0; top: 12px;
  display: flex; justify-content: space-between;
}
.ticks b { width: 1px; height: 4px; background: #46525F; }

.gauge-read {
  margin: 0 0 8px; font-size: 12px; line-height: 1.6; color: #C3CEDC; word-break: keep-all;
}
.gauge-read strong { color: var(--text); font-weight: 700; }
.dvi-why {
  margin: 0 0 10px; font-size: 11px; line-height: 1.65; color: var(--muted); word-break: keep-all;
}
.dvi-sign {
  margin: 0; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; font-variant-numeric: tabular-nums;
}
.chip-verified {
  padding: 3px 6px; border-radius: 5px; font-size: 10px; font-weight: 700;
  color: var(--accent); border: 1px solid var(--accent-dim); background: rgba(249, 202, 18, .12);
}

/* 견적 카드 */
.est-card { border-color: #3A4250; }
.est-work { margin: 0 0 12px; font-size: 14px; font-weight: 700; word-break: keep-all; }
.est-rows { margin: 0; display: grid; gap: 7px; }
.est-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.est-rows dt { font-size: 12px; color: var(--muted); }
.est-rows dd { margin: 0; font-size: 13px; font-weight: 600; }
.est-total {
  margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line);
}
.est-total dt { color: var(--text); font-weight: 700; font-size: 13px; }
.est-total dd { font-size: 17px; font-weight: 800; color: var(--accent); }
.est-time { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.est-time strong { color: #C3CEDC; }

/* =========================================================
   3. 정비증명
   ========================================================= */
.locked-card { border-style: dashed; }
.locked-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.locked-sub { margin: 0 0 16px; font-size: 12px; line-height: 1.65; color: var(--muted); word-break: keep-all; }
.locked-cap { margin: 0 0 8px; font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.cond-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cond-list li {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; min-height: 28px;
}
.cond-box {
  flex: none; width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid #3A4655; position: relative;
}
.cond-list li[data-done="true"] .cond-box { background: var(--accent); border-color: var(--accent); }
.cond-list li[data-done="true"] .cond-box::after {
  content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px;
  border-right: 2px solid #172331; border-bottom: 2px solid #172331; transform: rotate(42deg);
}
.cond-state { margin-left: auto; font-style: normal; font-size: 11px; color: var(--muted); }
.cond-list li[data-done="true"] .cond-state { color: var(--accent); font-weight: 700; }
.proof-hint {
  margin: 2px 2px 0; font-size: 11px; line-height: 1.7; color: var(--muted); word-break: keep-all;
}

/* 증명서 (paper) */
.cert {
  background: #FFFDF6; border: 1px solid var(--ink-line); border-radius: 10px;
  padding: 16px 14px 14px; color: var(--ink);
  box-shadow: 0 14px 30px -18px rgba(60, 52, 30, .5);
}
.cert-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.cert-kicker { margin: 0 0 4px; font-size: 11px; color: var(--ink-soft); }
.cert-title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.seal {
  flex: none; margin-left: auto; display: grid; place-items: center; gap: 1px;
  width: 62px; height: 62px; border-radius: 50%;
  border: 2px solid #B23A2E; color: #B23A2E;
  box-shadow: inset 0 0 0 3px #FFFDF6, inset 0 0 0 4px rgba(178, 58, 46, .55);
  transform: rotate(-7deg);
}
.seal b { font-size: 11px; line-height: 1.15; font-weight: 800; text-align: center; }
.seal i { font-size: 10px; font-style: normal; font-weight: 700; }

.cert-rows { margin: 0; display: grid; gap: 6px; }
.cert-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cert-rows dt { flex: none; font-size: 11px; color: var(--ink-soft); }
.cert-rows dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; word-break: keep-all; }
.cert-total { margin-top: 5px; padding-top: 8px; border-top: 1px solid var(--ink-line); }
.cert-total dt { font-size: 13px; font-weight: 700; color: var(--ink); }
.cert-total dd { font-size: 18px; font-weight: 800; }
.cert-rule { margin: 12px 0; border: 0; border-top: 1px dashed var(--ink-line); }
.cert-cap { margin: 0 0 5px; font-size: 10px; letter-spacing: .08em; color: var(--ink-soft); }
.cert-work { margin: 0 0 12px; font-size: 14px; font-weight: 700; word-break: keep-all; }
.cert-evi { margin: 0; padding-left: 15px; display: grid; gap: 5px; }
.cert-evi li { font-size: 11.5px; line-height: 1.55; color: #4A4437; word-break: keep-all; }
.cert-receipt {
  margin: 14px 0 0; padding: 11px 12px; border-radius: 8px;
  background: var(--paper-2); border: 1px dashed #BCB39B;
  font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 8px;
}
.receipt-tick {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: #2F7D5B; position: relative;
}
.receipt-tick::after {
  content: ""; position: absolute; left: 5px; top: 3px; width: 4px; height: 7px;
  border-right: 2px solid #FFFDF6; border-bottom: 2px solid #FFFDF6; transform: rotate(42deg);
}
.cert-foot {
  margin: 10px 0 0; text-align: center; font-size: 10.5px; color: var(--ink-soft);
}

/* paper 모드 — 완료 후 증명 화면에서 전체 명도 반전 */
.app[data-paper="on"] {
  background: var(--paper);
  color: var(--ink);
}
.app[data-paper="on"] .appbar {
  background: var(--paper-2); border-bottom-color: var(--ink-line);
}
.app[data-paper="on"] .appbar-reset { color: var(--ink-soft); }
.app[data-paper="on"] .demo-strip {
  background: var(--paper-2); color: var(--ink-soft); border-top-color: var(--ink-line);
}
.app[data-paper="on"] .tabbar {
  background: var(--paper-2); border-top-color: var(--ink-line);
}
.app[data-paper="on"] .tab { color: var(--ink-soft); }
.app[data-paper="on"] .tab[aria-current="page"] { color: #6B5200; }

/* =========================================================
   4. 내 바이크
   ========================================================= */
.bike-card { padding-top: 12px; }
.bike-art {
  height: 96px; border-radius: 10px; margin-bottom: 12px;
  background:
    radial-gradient(60% 70% at 22% 78%, rgba(249, 202, 18, .20), transparent 62%),
    linear-gradient(150deg, #26313D 0%, #182029 100%);
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.bike-art { display: grid; place-items: center; }
.bike-svg { width: 82%; max-width: 232px; height: auto; }
.bike-svg circle, .bike-svg path {
  fill: none; stroke: #6C7E90; stroke-width: 4;
  stroke-linecap: round; stroke-linejoin: round;
}
.bike-svg circle { stroke: #5D6E80; }
.bike-name { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.bike-odo { margin: 0; font-size: 13px; color: var(--muted); }
.bike-odo .num { font-size: 20px; font-weight: 800; color: var(--text); }
.bike-odo .unit { font-size: 13px; font-weight: 700; color: var(--text); margin-right: 4px; }

.last-line { margin: 0; font-size: 13px; line-height: 1.6; word-break: keep-all; }
.last-meta {
  margin: 8px 0 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 6px;
}
.row-line { margin: 0; font-size: 12.5px; color: #C3CEDC; font-variant-numeric: tabular-nums; }
.shop-line { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; word-break: keep-all; }
.shop-sub { margin: 0; font-size: 11px; line-height: 1.65; color: var(--muted); word-break: keep-all; }

/* =========================================================
   고지 + 탭바
   ========================================================= */
.demo-strip {
  margin: 0; padding: 7px 10px; text-align: center;
  font-size: 10.5px; letter-spacing: .01em; color: var(--muted);
  background: var(--surface); border-top: 1px solid var(--line);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab {
  display: grid; justify-items: center; align-content: center; gap: 4px;
  min-height: 56px; padding: 6px 2px; background: none; border: 0; cursor: pointer;
  font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: -.01em;
}
.tab-ico { width: 20px; height: 20px; display: block; }
.tab-ico svg { width: 100%; height: 100%; }
.tab-ico svg path, .tab-ico svg rect, .tab-ico svg circle { fill: currentColor; }
.tab-ico svg circle, .tab-ico svg .glyph, .tab-ico svg rect {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tab[data-tab="status"] .tab-ico svg path { fill: currentColor; stroke: none; }
.tab[aria-current="page"] { color: var(--accent); }

/* 발행 대기 배지 */
.tab[data-tab="proof"] { position: relative; }
.app[data-stage="done"] .tab[data-tab="proof"]::after {
  content: ""; position: absolute; top: 8px; right: 22px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* =========================================================
   반응형 / 모션
   ========================================================= */
@media (max-width: 400px) {
  .stage { padding-left: 4px; padding-right: 4px; }
  .phone { border-radius: 20px; padding: 5px; }
}
@media (max-height: 860px) {
  .phone { height: min(780px, calc(100vh - 120px)); min-height: 620px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}
