:root {
  color-scheme: light;
  --ink: #27324a;
  --muted: #596981;
  --blue: #4165ed;
  --blue-hover: #3151cc;
  --line: #e3e7ef;
  --paper: #f7f8fb;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
h1,h2,p { margin: 0; }
h1,h2 { line-height: 1.15; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.055em; font-weight: 800; }
h2 { font-size: 1.28rem; font-weight: 750; letter-spacing: -.035em; }
p,small { color: var(--muted); }
small,.caption { font-size: .875rem; }
small { display: block; font-weight: 450; line-height: 1.6; }
button,input,a { font: inherit; }
button,.action-link,.text-link { cursor: pointer; }
button,.action-link { font-weight: 650; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #6773f1; outline-offset: 3px; }
[hidden] { display: none !important; }
.primary,.secondary,.action-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 10px 20px; border-radius: 11px; text-decoration: none;
  line-height: 1.3; transition: background .15s, border-color .15s, box-shadow .15s;
}
.primary { background: var(--blue); border: 1px solid var(--blue); color: white; }
.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.secondary { background: white; border: 1px solid #bdc3dc; color: #343c6d; }
.secondary:hover { background: #f1f2ff; border-color: #979fcd; }
.text-link,.link-button { color: var(--blue); font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; }
.link-button,.bare { border: 0; padding: 4px 2px; min-height: 44px; background: transparent; }
.mark {
  display: inline-grid; place-items: center; width: 37px; height: 37px; flex: none; border-radius: 11px 11px 11px 3px;
  background: var(--blue); color: white; font: italic 900 27px/1 Arial, sans-serif; padding-right: 3px;
}
form { display: grid; gap: 17px; margin-top: 22px; }
label,legend { min-width: 0; font-size: .94rem; font-weight: 650; }
label { display: grid; gap: 7px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]) {
  min-width: 0; width: 100%; min-height: 48px; padding: 10px 13px; border-radius: 10px;
  border: 1px solid #bbc1d7; background: #fbfbfe; color: var(--ink); font-size: 1rem;
  font-weight: 500; line-height: 1.4;
}
input::placeholder { color: #737a91; opacity: 1; }
input:not([type=checkbox]):not([type=radio]):focus-visible { border-color: var(--blue); outline: 2px solid #bdc4ff; outline-offset: 0; background: white; }
.message:not(:empty) { margin-top: 14px; padding: 9px 13px; border-radius: 9px; background: #fff1df; color: #7b4418; font-size: .94rem; }
.message:empty { display: none; }
#edit-message[data-saved="true"]:not(:empty) { color: #18553e; background: #e6f6ed; }

/* The public pass has a printed cover and a separate, perforated contact slip. */
.scan-page {
  --blue: #852639; --blue-hover: #681a2b; --paper: #f6f4f4;
  min-height: 100vh; min-height: 100svh;
  background: radial-gradient(ellipse at 80% 5%, #eee6e7 0, transparent 59%), var(--paper);
  display: grid; place-items: center; padding: max(32px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
}
.pass-wrap { width: min(830px, 100%); }
.pass-brand,.bar { display: flex; align-items: center; gap: 11px; }
.pass-brand { padding: 0 3px; margin: 0 0 18px; }
.pass-brand strong,.bar>strong { font-size: 1.13rem; letter-spacing: -.03em; }
.pass {
  overflow: hidden; border-radius: 24px; background: #fff;
  box-shadow: 0 26px 68px -34px #383b7955, 0 0 0 1px #1a245613;
}
.pass-cover { position: relative; isolation: isolate; background: #131e1e; overflow: hidden; min-height: 295px; display: flex; align-items: center; }
.cover-type { z-index: 1; padding: 42px 0 40px 42px; width: 47%; }
.pass-status {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid #83938e;
  color: #f5f7f6; background: #253430; padding: 3px 10px; border-radius: 24px;
  font-size: .875rem; font-weight: 650;
}
.pass-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #b8d5c5; }
.pass-cover h1 { font-size: clamp(2.65rem, 5.2vw, 4.5rem); margin: 13px 0 0; line-height: 1.06; color: #fff; }
.scan-photo {
  position: absolute; z-index: -1; inset: 0 0 0 auto; width: 60%; height: 100%;
  display: block; object-fit: cover; object-position: center 95%;
  mask-image: linear-gradient(90deg, transparent 0, #000 12%); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%);
}
.tear { position: relative; height: 20px; margin-top: -10px; z-index: 1; background: linear-gradient(to bottom, transparent 50%, white 50%); }
.tear::before {
  content: ''; position: absolute; left: 13px; right: 13px; top: 50%; height: 1px;
  background: repeating-linear-gradient(90deg,#a8afca 0 5px,transparent 5px 10px);
}
.tear::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at left center, var(--paper) 9px, transparent 10px), radial-gradient(circle at right center, var(--paper) 9px, transparent 10px);
}
.pass-action { padding: 21px 42px 36px; }
.pass-action #hint { color: #515a77; }
#contact { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; margin-top: 18px; }
#contact:has(#challenge[hidden]) { grid-template-columns: 1fr; }
#contact:has(#challenge[hidden]) .primary { justify-self: start; }
#verify,#dial { min-height: 51px; padding-inline: 25px; }
#answer { min-height: 51px; font-size: 1.06rem; }
#result { margin-top: 14px; display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.number { display: block; color: var(--ink); font: 700 clamp(1.85rem,4.5vw,2.8rem)/1.2 "SFMono-Regular", Consolas, monospace; letter-spacing: -.035em; }
#retry,#admin-link { margin-top: 18px; }

/* Owner workspace */
.mast, body>header:has(.bar) { background: #fff; border-bottom: 1px solid var(--line); }
.bar { max-width: 1220px; min-height: 66px; margin: auto; padding: 9px 34px; }
.divider { border-left: 1px solid var(--line); margin-left: 3px; padding-left: 15px; font-size: .94rem; color: var(--muted); }
.bare { margin-left: auto; color: var(--muted); }
.bare:hover { color: var(--blue); }
.garage { width: 100%; min-width: 0; }
.admin-page { background: var(--paper); min-height: 100vh; }
.admin-page .mark { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 5px 10px #4165ed26; }
#workspace { display: grid; min-height: 100vh; grid-template-columns: 222px minmax(0,1fr); grid-template-rows: 68px 1fr; grid-template-areas: "side bar" "side work"; }
.owner-topbar {
  grid-area: bar; position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px;
  min-width: 0; padding: 0 clamp(22px,3vw,42px); background: white; border-bottom: 1px solid var(--line);
}
.breadcrumbs { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: .9rem; }
.breadcrumbs b { color: #a7b1c1; font-weight: 400; }
.owner-sidebar {
  grid-area: side; align-self: start; position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 28px 17px 0; background: white; border-right: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; }
.sidebar-brand strong { font-size: 1.35rem; letter-spacing: .03em; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; margin: 38px 11px 10px; color: var(--muted); font-size: .88rem; }
#car-count { background: #eef2ff; color: #465eac; border-radius: 5px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.sidebar-account { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 2px; display: flex; gap: 8px; align-items: center; font-size: .875rem; }
.account-avatar { width: 32px; height: 32px; display: grid; place-items: center; background: #eaf0ff; color: #4867a9; border-radius: 50%; }
#nav-toggle { display: none; }
.work-area { grid-area: work; width: min(1230px, 100%); margin-inline: auto; min-width: 0; padding: 29px clamp(22px,3vw,42px) 48px; }
.work-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 23px; }
.work-head h1 { font-size: clamp(1.65rem,2.1vw,1.9rem); font-weight: 680; letter-spacing: -.03em; }
.admin-page h2 { font-size: 1.15rem; font-weight: 650; }
.admin-page .primary,.admin-page .secondary { min-height: 42px; padding: 9px 16px; border-radius: 8px; }
.admin-page .secondary { border-color: #d8deeb; color: #485872; }
.admin-page input:not([type=checkbox]):not([type=radio]):not([type=file]) { background: white; border-color: #d5dce8; border-radius: 8px; min-height: 44px; }
.admin-page input:not([type=checkbox]):not([type=radio]):focus-visible { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px #4165ed26; }
.plus { display: inline-block; width: 15px; height: 15px; background: linear-gradient(currentColor,currentColor) center/13px 2px no-repeat, linear-gradient(currentColor,currentColor) center/2px 13px no-repeat; }
#cars { display: grid; align-content: start; gap: 5px; overflow-y: auto; padding: 4px 2px 12px; color: var(--muted); }
.car {
  flex: 0 0 auto; display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 0 10px;
  text-align: left; width: 100%; min-width: 0; padding: 9px 10px;
  background: white; border: 1px solid transparent; border-radius: 8px;
}
.car strong { overflow-wrap: anywhere; line-height: 1.4; }
.car small { grid-column: 2; font-size: .83rem; }
.car::before {
  content: ''; grid-row: span 2; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(currentColor,currentColor) center/16px 10px no-repeat, #eff0fb;
  color: #7984bd;
}
.car::after { content: ''; grid-column: 1; grid-row: 1 / span 2; margin: auto; width: 10px; height: 2px; background: #fff; pointer-events: none; }
.car::before { grid-area: 1 / 1 / span 2 / 2; }
.car:hover { background: #f5f7fc; }
.car[aria-current=true] { background: #eef2ff; color: #3857c6; }
.car[aria-current=true] small { color: #52699f; }
.car[aria-current=true]::before { color: #5273db; background-color: #e0e7ff; }
.garage-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr); gap: 20px; align-items: start; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 12px; padding: clamp(17px,2vw,27px); box-shadow: 0 3px 16px #27324a06; }
.panel-title { display: flex; gap: 10px; align-items: center; }
.section-icon { flex: none; display: block; width: 34px; height: 34px; border-radius: 10px; background-color: #edf0ff; color: #414cb9; position: relative; }
.tuning::before,.tuning::after { content: ''; position: absolute; width: 15px; height: 2px; left: 10px; background: currentColor; }
.tuning::before { top: 12px; } .tuning::after { top: 20px; }
.tuning { background-image: radial-gradient(circle at 15px 13px,#414cb9 2.4px,transparent 3px),radial-gradient(circle at 21px 21px,#414cb9 2.4px,transparent 3px); }
.sticker-icon::before { content: ''; position: absolute; inset: 9px; border: 2px solid currentColor; border-radius: 3px 3px 7px 3px; transform: rotate(-8deg); }
.pair,.choice-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.settings { border-top: 1px solid var(--line); }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 41px; height: 25px; flex: none; margin: 0; border: 1px solid #929ab5; border-radius: 20px; background: #a8aec0; cursor: pointer; }
.switch input::before { content: ''; display: block; width: 17px; height: 17px; margin: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #17214744; transition: transform .15s; }
.switch input:checked { background: var(--blue); border-color: var(--blue); }
.switch input:checked::before { transform: translateX(16px); }
fieldset { padding: 0; margin: 13px 0 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.choice-row label { cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 9px; border-radius: 9px; border: 1px solid var(--line); font-weight: 550; }
.choice-row label:has(:checked) { border-color: #a5ade8; color: var(--blue); background: #f2f3ff; }
input[type=radio] { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; flex: none; }
#save { justify-self: start; min-width: 118px; }
.proof {
  padding: clamp(15px,2.25vw,30px); margin: 21px 0 14px; border-radius: 13px; background-color: #eef0fa;
  background-image: radial-gradient(#c7cbdf .8px, transparent 1px); background-size: 8px 8px;
}
.sticker-preview { width: 100%; height: auto; display: block; box-shadow: 0 6px 13px #1b25402e; }
.sticker-preview[width="720"] { max-width: 260px; margin-inline: auto; }
.sticker-panel p { font-size: .94rem; }
.sticker-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 16px 0 10px; }
.panel-links { margin-top: 18px; padding-top: 5px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 0 18px; }
.panel-links a { font-size: .875rem; }
.touch-save { display: none; }
.login-panel {
  width: min(1000px,92%); margin: clamp(25px,11vh,110px) auto; display: grid; grid-template-columns: 1.15fr 1fr;
  gap: clamp(20px,4vw,65px); align-items: center;
}
.login-art { border-radius: 14px; overflow: hidden; background: #13201e; }
.login-art img { width: 100%; height: auto; display: block; }
.login-body { padding: clamp(23px,3vw,36px); background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 50px #5275c40a; }
.login-body h1 { font-size: 2.3rem; }
.login-body p,.card.login p { margin-top: 10px; }
.card.login { width: min(425px,calc(100% - 32px)); margin: 65px auto; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.card.login h1 { font-size: 1.8rem; }
@media (pointer:coarse) { .touch-save { display: block; } }
@media (min-width:761px) and (max-width:980px) {
  #workspace { grid-template-columns: 185px minmax(0,1fr); }
  .garage-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width:760px) {
  #workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "bar" "side" "work"; }
  .owner-topbar { min-height: 57px; padding: 6px 16px; justify-content: space-between; }
  #nav-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; border: 0; background: transparent; color: var(--blue); font-size: .94rem; font-weight: 650; }
  #nav-toggle::before { content: ''; width: 16px; height: 12px; border-block: 2px solid currentColor; background: linear-gradient(currentColor,currentColor) center/100% 2px no-repeat; }
  .owner-sidebar { display: none; position: static; height: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-open .owner-sidebar { display: flex; }
  .sidebar-brand { display: none; }
  .nav-heading { margin: 6px 10px; }
  #cars { max-height: 40vh; }
  .sidebar-account { padding-block: 4px; }
  .work-area { padding: 23px 16px 40px; }
  .bar { padding-inline: 20px; }
  .garage-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width:600px) {
  .scan-page { display: block; padding: max(19px,env(safe-area-inset-top)) 16px max(30px,env(safe-area-inset-bottom)); }
  .pass-wrap { max-width: 435px; margin: auto; }
  .pass-brand { margin-bottom: 16px; }
  .pass { border-radius: 20px; }
  .pass-cover { min-height: 0; display: block; }
  .cover-type { padding: 22px 22px 0; width: 100%; }
  .pass-cover h1 { margin-top: 9px; font-size: clamp(2.5rem,10.8vw,3.2rem); }
  .scan-photo { position: relative; width: 100%; height: auto; aspect-ratio: 1.9; object-fit: cover; object-position: 50% 96%; mask-image: linear-gradient(180deg,transparent,#000 12%); -webkit-mask-image: linear-gradient(180deg,transparent,#000 12%); }
  .pass-action { padding: 16px 22px 24px; }
  #contact { grid-template-columns: 1fr; gap: 13px; margin-top: 15px; }
  #contact:has(#challenge[hidden]) .primary { justify-self: stretch; }
  #result { display: grid; gap: 16px; }
  .bar { padding-inline: 16px; min-height: 59px; }
  .panel { padding: 19px; }
  .work-head { margin-bottom: 13px; }
  .choice-row { gap: 6px; }
  .login-panel { display: grid; grid-template-columns: minmax(0,1fr); margin-top: 18px; max-width: 420px; gap: 12px; }
  .login-art { height: 152px; }
  .login-art img { height: 100%; object-fit: cover; object-position: 50% 76%; }
  .touch-save { margin-top: 4px; }
}
@media (max-width:400px) {
  .pair { grid-template-columns: minmax(0,1fr); }
  .panel-links { gap: 0 12px; }
}
@media (max-height:620px) and (max-width:600px) {
  .scan-page { padding-top: 10px; }
  .pass-brand { margin-bottom: 9px; }
  .cover-type { padding-top: 14px; }
  .scan-photo { aspect-ratio: 2.05; }
  .pass-action { padding-block: 11px 18px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition-duration: 0s !important; } }
