/* Colours and fonts follow the TD Cloud UI design system: brand purple for actions, navy for the header.
   docs/internal_portal/design_systems/ui/02-brand-colours.html. Roboto is used when the phone has it, because
   this page loads no font from another site. */
:root {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --line: #d1d5db;
  --accent: #c300ff;
  --accent-text: #ffffff;
  --navy: #001e3d;
  --navy-text: #ffffff;
  --notice-bg: #fef3c7;
  --notice-text: #78350f;
  --error-bg: #fee2e2;
  --error-text: #7f1d1d;
  --dev-bg: #e5e7eb;
  --dev-text: #374151;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #1a1d23; --text: #f3f4f6; --muted: #aab0bb;
    --line: #343a46; --navy: #001020;
    --notice-bg: #422006; --notice-text: #fde68a;
    --error-bg: #450a0a; --error-text: #fecaca;
    --dev-bg: #262b34; --dev-text: #cbd1da; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #1a1d23; --text: #f3f4f6; --muted: #aab0bb;
  --line: #343a46; --navy: #001020;
  --notice-bg: #422006; --notice-text: #fde68a;
  --error-bg: #450a0a; --error-text: #fecaca;
  --dev-bg: #262b34; --dev-text: #cbd1da; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 17px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app {
  min-height: 100%;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  max-width: 560px; margin: 0 auto;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--navy); color: var(--navy-text); min-height: 56px;
}
header h1 { font-size: 18px; margin: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
header button { min-height: 44px; padding: 0 8px; background: none; border: 0; color: var(--navy-text); font: inherit; font-weight: 600; text-decoration: underline; }
main { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input {
  width: 100%; min-height: 52px; padding: 0 14px; font: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
}
select {
  width: 100%; min-height: 52px; padding: 0 14px; font: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
}
.customer { margin: 0; font-size: 18px; font-weight: 700; }
.result .customer { margin-top: 8px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary {
  width: 100%; min-height: 56px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font: inherit; font-size: 19px; font-weight: 700;
}
button.secondary {
  width: 100%; min-height: 56px; border-radius: 12px; font: inherit; font-size: 19px; font-weight: 700;
  background: transparent; color: var(--text); border: 2px solid var(--line);
}
button.primary:disabled { opacity: .5; }
button.scan { min-height: 96px; font-size: 24px; border-radius: 16px; }
.notice { background: var(--notice-bg); color: var(--notice-text); padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.error { background: var(--error-bg); color: var(--error-text); padding: 14px; border-radius: 10px; font-weight: 600; }
.hint { color: var(--muted); font-size: 16px; margin: 0; }
.need { color: var(--error-text); font-size: 16px; font-weight: 600; margin: 0; }
.dev { background: var(--dev-bg); color: var(--dev-text); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.details { white-space: pre-wrap; word-break: break-word; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }
.camera { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #000; border-radius: 16px; overflow: hidden; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .frame { position: absolute; inset: 15%; border: 3px solid #ffffff; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }

/* position screen */
.mapbox { position: relative; width: 100%; height: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mapbox #map { position: absolute; inset: 0; }
.mapwait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: var(--muted); font-weight: 600; z-index: 500; pointer-events: none; }
.acc { font-size: 20px; font-weight: 700; margin: 0; }
.pin { background: transparent; border: 0; }
.pin-dot { width: 28px; height: 28px; margin: 8px; border-radius: 50%; background: var(--accent); border: 4px solid #ffffff; box-shadow: 0 1px 6px rgba(0,0,0,.6); }
.leaflet-container { font: inherit; }

/* sign-in page: the TD Cloud UI login (design_systems/ui/09-login.html). White page, logo, rounded white card.
   The version line is darker than the design's gray-400,
   which is under 4.5:1 on white. */
body.on-login { background: #ffffff; }
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: #ffffff; color: #111827; color-scheme: light; }
.login-inner { width: 100%; max-width: 384px; }
.login-logo { display: block; height: 56px; width: auto; margin: 0 auto 32px; }
.login-card { background: #ffffff; border-radius: 25px; box-shadow: 0 12px 20px -2px rgba(0, 0, 0, .25); padding: 32px; }
.login-card h2 { font-size: 18px; font-weight: 600; color: #136f97; margin: 0 0 24px; }
.login-help { margin: 0 0 16px; font-size: 14px; color: #4b5563; }
.login-status { margin: 0 0 16px; font-size: 16px; color: #111827; }
.login-btn { width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 16px; border: 0; border-radius: 8px; background: #c300ff; color: #ffffff; font: inherit; font-size: 16px; font-weight: 500; }
.login-btn:disabled { opacity: .5; }
.login-link { display: block; box-sizing: border-box; text-align: center; text-decoration: none; line-height: 28px; }
.login-notice { background: #fef3c7; color: #78350f; border-radius: 8px; padding: 8px 12px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.version { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.login .version { color: #6b7280; }
