/* KeiSpot Driver PWA（Phase 2・2026-08-26）
   外部依存ゼロの自前CSS。ドライバー向け＝大きな文字・大きなタップ領域を最優先 */

:root {
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-bg: #eff6ff;
  --orange: #f97316;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber-bg: #fffbeb;
  --amber-text: #92400e;
  --radius: 14px;
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* ── ヘッダー・ナビ ── */
.header {
  position: sticky; top: 0; z-index: 20;
  background: var(--blue);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.header .brand { font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.header .brand .dot { color: var(--orange); }
.header .who { font-size: 13px; opacity: .92; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; height: var(--nav-h);
  background: none; border: none;
  font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer;
}
.nav button .ic { font-size: 22px; line-height: 1; }
.nav button.active { color: var(--blue); font-weight: 700; }

/* ── 汎用 ── */
.main { padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.card.tappable { cursor: pointer; }
.card.tappable:active { background: #f8fafc; }
.section-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 20px 0 8px; }
.section-title:first-child { margin-top: 0; }
.empty { color: var(--muted); font-size: 14px; padding: 20px 8px; text-align: center; }

.btn {
  display: block; width: 100%;
  padding: 14px; border-radius: 12px; border: none;
  font-size: 16px; font-weight: 700; cursor: pointer;
  text-align: center;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-accept { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: var(--card); color: var(--text); border: 1.5px solid var(--line); font-weight: 600; }
.btn-ghost { background: none; color: var(--blue); font-weight: 600; }
.btn + .btn { margin-top: 10px; }
.btn.arming { outline: 3px solid rgba(29, 78, 216, .35); }

.input {
  width: 100%; padding: 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
}
.input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.label { font-size: 13px; font-weight: 700; color: var(--muted); display: block; margin: 14px 0 6px; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; vertical-align: middle;
}
.chip-new { background: var(--blue-bg); color: var(--blue); }
.chip-wait { background: var(--amber-bg); color: var(--amber-text); }
.chip-mine { background: var(--green-bg); color: var(--green); }
.chip-closed { background: #f1f5f9; color: var(--muted); }
.chip-declined { background: var(--red-bg); color: var(--red); }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.notice-info { background: var(--blue-bg); color: var(--blue-dark); }
.notice-warn { background: var(--amber-bg); color: var(--amber-text); }
.notice-error { background: var(--red-bg); color: var(--red); }
.notice-ok { background: var(--green-bg); color: var(--green); }

/* ── 案件カード ── */
.order-route { font-size: 15px; font-weight: 700; margin: 6px 0 2px; word-break: break-all; }
.order-route .arr { color: var(--muted); font-weight: 400; margin: 0 4px; }
.order-meta { font-size: 13px; color: var(--muted); }
.order-payout { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 6px; }
.order-payout small { font-size: 12px; font-weight: 600; color: var(--muted); }

.detail-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { font-size: 12px; font-weight: 700; color: var(--muted); }
.detail-row .v { font-size: 15px; word-break: break-all; }

.reason-list { margin: 10px 0; }
.reason-list label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 8px;
  font-size: 15px; cursor: pointer; background: var(--card);
}
.reason-list input { width: 20px; height: 20px; accent-color: var(--blue); }

/* ── 設定 ── */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .t { font-size: 15px; font-weight: 600; }
.setting-row .d { font-size: 12px; color: var(--muted); }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: #cbd5e1; transition: background .15s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: .5; cursor: default; }

.guide-steps { counter-reset: st; margin: 10px 0; }
.guide-steps li {
  list-style: none; counter-increment: st;
  display: flex; gap: 10px; margin-bottom: 10px; font-size: 14px;
}
.guide-steps li::before {
  content: counter(st);
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* ── ログイン ── */
.login-wrap { padding: 40px 20px calc(var(--nav-h) + 24px); max-width: 420px; margin: 0 auto; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 84px; height: 84px; border-radius: 20px; }
.login-logo h1 { font-size: 22px; margin-top: 10px; }
.login-logo h1 .dot { color: var(--orange); }
.login-logo p { font-size: 13px; color: var(--muted); }

/* ── トースト ── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 50; max-width: 90%;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.footnote { font-size: 12px; color: var(--muted); text-align: center; margin-top: 20px; }
.spin { text-align: center; color: var(--muted); padding: 24px; }

/* ── ユーティリティ（CSP: style-src 'self' のためインラインstyleは使わない） ── */
.sp6 { height: 6px; }
.sp14 { height: 14px; }
.mt8 { margin-top: 8px; }
.mt10 { margin-top: 10px; }
.mt12 { margin-top: 12px; }
.login-note { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.hint-link { padding: 6px 0 0; }
.btn-back { text-align: left; padding: 0 0 10px; }
.v-payout { font-size: 22px; font-weight: 800; }
.subnote { font-size: 12px; color: var(--muted); }
.block-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }

/* ── 完了報告・完了写真（Phase 4A・2026-08-28） ── */
textarea.input { resize: vertical; min-height: 56px; font-family: inherit; }
.input-file { padding: 10px; font-size: 14px; }
.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px;
}
.photo-cell {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-ph { color: var(--muted); font-size: 18px; }

/* ── アカウント削除（Phase 4A・ストア審査要件） ── */
.danger-link { color: var(--red); padding: 4px 0; text-align: left; }
.ack-row {
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  padding: 10px 0; cursor: pointer;
}
.ack-row input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.legal-link { color: var(--muted); text-decoration: underline; }
