:root {
  color-scheme: light;
  --navy: #082a5e;
  --blue: #0b4dac;
  --blue-2: #e8f1ff;
  --green: #137a3d;
  --green-bg: #e9f8ef;
  --yellow: #8a5b00;
  --yellow-bg: #fff7df;
  --red: #b42318;
  --red-bg: #fff0ee;
  --ink: #132238;
  --muted: #627087;
  --line: #d9e1ec;
  --surface: #fff;
  --bg: #f3f6fa;
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #d8e8ff, transparent 40%), var(--bg); }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: 0 18px 60px rgba(15, 42, 80, .12); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--blue), var(--navy)); font-size: 24px; }
h1, h2, h3 { line-height: 1.35; }
h1 { margin: 0; font-size: 1.42rem; }
h2 { margin: 0 0 18px; font-size: 1.35rem; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }
p { line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.warning-box, .info-box, .danger-box { border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: .9rem; line-height: 1.55; }
.warning-box { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #f0d17a; }
.info-box { background: var(--blue-2); color: var(--navy); border: 1px solid #bcd3f3; }
.danger-box { background: var(--red-bg); color: var(--red); border: 1px solid #f3b9b2; }
.field { display: grid; gap: 7px; margin: 14px 0; }
.field label { font-weight: 700; font-size: .9rem; }
input, select, textarea { width: 100%; min-height: 48px; padding: 11px 13px; color: var(--ink); background: #fff; border: 1px solid #bfcadd; border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(20, 92, 190, .18); border-color: var(--blue); }
.btn { min-height: 48px; padding: 11px 18px; border: 1px solid transparent; border-radius: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-primary { color: #fff; background: var(--blue); }
.btn-primary:hover { background: #083f8e; }
.btn-secondary { color: var(--blue); background: #fff; border-color: #9db8dc; }
.btn-danger { color: #fff; background: var(--red); }
.btn-success { color: #fff; background: var(--green); }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.demo-credentials { display: grid; gap: 6px; margin-top: 20px; padding: 14px; border-radius: 12px; background: #f7f9fc; font-size: .84rem; }
.app-header { position: sticky; z-index: 10; top: 0; height: 64px; color: #fff; background: var(--navy); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 max(16px, env(safe-area-inset-left)); box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.header-title { font-weight: 900; letter-spacing: .02em; }
.user-chip { font-size: .83rem; opacity: .92; }
.shell { width: min(1100px, 100%); margin: 0 auto; padding: 22px 18px 94px; }
.bottom-nav { position: fixed; z-index: 9; bottom: 0; left: 0; right: 0; min-height: 68px; padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: flex; justify-content: center; box-shadow: 0 -5px 20px rgba(20, 40, 70, .08); }
.bottom-nav button { flex: 1; max-width: 180px; min-height: 64px; border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 800; }
.bottom-nav button.active { color: var(--blue); background: var(--blue-2); }
.page-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 5px 18px rgba(18, 42, 77, .05); }
.stat { font-size: 2rem; font-weight: 900; color: var(--navy); margin: 5px 0; }
.scan-card { margin-top: 18px; border: 2px solid #b7cce8; }
.scan-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.order-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.meta { padding: 10px 12px; background: #f7f9fc; border-radius: 10px; }
.meta dt { color: var(--muted); font-size: .76rem; }
.meta dd { margin: 4px 0 0; font-weight: 800; }
.item-list { display: grid; gap: 12px; }
.item-card { position: relative; overflow: hidden; }
.item-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #a8b6c9; }
.item-card.ok::before { background: var(--green); }
.item-card.ng::before { background: var(--red); }
.item-card.review::before { background: #d79600; }
.item-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.pill { white-space: nowrap; border-radius: 999px; padding: 5px 10px; font-size: .76rem; font-weight: 900; background: #edf1f6; color: #526174; }
.pill.ok { color: var(--green); background: var(--green-bg); }
.pill.ng { color: var(--red); background: var(--red-bg); }
.pill.review { color: var(--yellow); background: var(--yellow-bg); }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.image-box { min-height: 170px; border: 1px dashed #aebcd0; background: #f7f9fc; border-radius: 12px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .82rem; text-align: center; }
.image-box img { width: 100%; height: 200px; object-fit: contain; background: #fff; }
.result { padding: 13px; border-radius: 11px; border: 1px solid var(--line); margin: 12px 0; }
.result.match_candidate { background: var(--blue-2); color: var(--navy); border-color: #b7cff0; }
.result.mismatch_candidate { background: var(--red-bg); color: var(--red); border-color: #f0b6ae; }
.result.needs_review, .result.needs_reference { background: var(--yellow-bg); color: var(--yellow); border-color: #ecd184; }
.score { font-size: 1.7rem; font-weight: 900; }
.progress { height: 8px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin: 10px 0 20px; }
.progress > span { display: block; height: 100%; background: var(--green); }
.history-card { cursor: pointer; }
.history-card:hover { border-color: #93add0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; color: var(--muted); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 88px; transform: translateX(-50%); width: min(440px, calc(100% - 28px)); padding: 13px 16px; color: #fff; background: #172337; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.25); text-align: center; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.camera-modal { position: fixed; z-index: 30; inset: 0; background: #020916; display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.camera-modal header, .camera-modal footer { padding: 14px; display: flex; justify-content: space-between; align-items: center; }
.camera-modal video { width: 100%; height: 100%; object-fit: cover; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.capture-button { cursor: pointer; }
.capture-button.disabled { pointer-events: none; opacity: .65; }
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr; }
  .order-meta { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .scan-row { grid-template-columns: 1fr; }
  .shell { padding-inline: 12px; }
  .card { padding: 15px; border-radius: 14px; }
  .header-title { font-size: .92rem; }
}
