/* =============================================================
   ABC Vehicle Inspection — base stylesheet
   Designed for mobile-first; scales up to desktop.
============================================================= */

:root {
  --c-bg:        #f3f5f8;
  --c-surface:   #ffffff;
  --c-ink:       #1a2333;
  --c-ink-soft:  #54627a;
  --c-muted:     #8a93a6;
  --c-line:      #e3e7ee;
  --c-line-soft: #eef1f6;

  --c-primary:       #0f2a44;
  --c-primary-hover: #163a5c;
  --c-accent:        #1d6fb6;
  --c-accent-soft:   #e7f0fa;

  --c-success:  #2c8a4f;
  --c-success-soft: #e6f4ea;
  --c-warning:  #d68a00;
  --c-warning-soft: #fdf3e0;
  --c-danger:   #c93030;
  --c-danger-soft:  #fce8e6;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(15,42,68,.06), 0 1px 1px rgba(15,42,68,.04);
  --shadow-md: 0 4px 12px rgba(15,42,68,.08), 0 1px 2px rgba(15,42,68,.04);
  --shadow-lg: 0 10px 30px rgba(15,42,68,.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.muted { color: var(--c-muted); }
.small { font-size: 13px; }

/* ----------------------------------------------------------- */
/*  Top bar                                                    */
/* ----------------------------------------------------------- */
.topbar {
  background: var(--c-primary);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  max-width: 720px; margin: 0 auto;
}
.topbar-greet { font-size: 14px; }
.topbar-hi { display:block; opacity:.7; font-size:11px; letter-spacing:1px; text-transform:uppercase; }
.topbar-greet strong { font-weight: 600; font-size: 16px; }
.topbar-logout, .topbar-back {
  color: #fff;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  transition: background .15s;
}
.topbar-logout:hover, .topbar-back:hover {
  background: rgba(255,255,255,.16); text-decoration: none;
}
.topbar--inspect .topbar-inner { padding: 10px 16px; }
.topbar-title {
  font-weight: 600; font-size: 16px; text-align: center; line-height: 1.2;
}
.topbar-sub { display:block; font-size:11px; opacity:.7; font-weight:400; }

/* step indicator */
.step-indicator {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 8px 12px;
  max-width: 720px; margin: 0 auto;
  flex-wrap: nowrap;
}
.step-dot {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
  opacity: .55;
  transition: opacity .2s;
}
.step-dot::after {
  content: ""; position: absolute;
  top: 12px; right: -50%; width: 100%; height: 2px;
  background: rgba(255,255,255,.25);
}
.step-dot:last-child::after { display: none; }
.step-dot span {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  font-size: 12px; font-weight: 700;
  display:flex; align-items:center; justify-content:center;
  border: 2px solid transparent;
}
.step-dot label {
  font-size: 10px; letter-spacing: .5px; text-transform: uppercase;
  font-weight: 600; opacity: .85;
}
.step-dot.is-active { opacity: 1; }
.step-dot.is-active span {
  background: #fff; color: var(--c-primary);
}
.step-dot.is-done span {
  background: var(--c-success); color: #fff;
}
.step-dot.is-done::after { background: var(--c-success); }

/* ----------------------------------------------------------- */
/*  Page container                                             */
/* ----------------------------------------------------------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--c-muted);
  margin: 0 0 12px;
  font-weight: 700;
}

.alert-card {
  background: linear-gradient(180deg, #fff8e8 0%, #fff 100%);
  border: 1px solid #f0d586;
}
.alert-head {
  display:flex; align-items:center; gap:8px;
  color: #875a00; font-size: 14px; margin-bottom: 4px;
}
.alert-card p { margin: 6px 0 12px; color: #6f5118; font-size: 14px; }

/* ----------------------------------------------------------- */
/*  Action tiles (home)                                        */
/* ----------------------------------------------------------- */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.action-tile {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 22px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--c-ink);
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.action-tile:active { transform: scale(.97); text-decoration: none; }
.action-tile:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.action-tile__icon {
  width: 56px; height: 56px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  color: #fff;
}
.action-tile--out .action-tile__icon { background: var(--c-accent); }
.action-tile--in  .action-tile__icon { background: var(--c-success); }
.action-tile--out:hover { border-color: var(--c-accent); }
.action-tile--in:hover  { border-color: var(--c-success); }
.action-tile__title { font-size: 17px; font-weight: 700; }
.action-tile__sub   { font-size: 12px; color: var(--c-muted); }
.action-tile--disabled { opacity: .4; }

/* ----------------------------------------------------------- */
/*  History list                                               */
/* ----------------------------------------------------------- */
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-line-soft);
}
.history-item:last-child { border-bottom: 0; }
.history-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-badge--checkout { background: var(--c-accent-soft);  color: var(--c-accent); }
.history-badge--checkin  { background: var(--c-success-soft); color: var(--c-success); }
.history-line1 { font-weight: 600; }
.history-line2 { font-size: 12px; color: var(--c-muted); }

/* ----------------------------------------------------------- */
/*  Buttons                                                    */
/* ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  border: 0; cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); text-decoration: none; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #237040; text-decoration: none; }
.btn-ghost   { background: transparent; color: var(--c-ink-soft); }
.btn-ghost:hover { background: var(--c-line-soft); text-decoration: none; }
.btn-danger  { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #a82828; text-decoration: none; }
.btn-block   { width: 100%; }
.btn-lg      { padding: 14px 22px; font-size: 16px; }
.btn-sm      { padding: 8px 12px; font-size: 13px; }
.btn-sub     { display:block; font-size:11px; font-weight:400; opacity:.85; margin-top:2px; }

/* ----------------------------------------------------------- */
/*  AUTH SCREEN (PIN keypad)                                   */
/* ----------------------------------------------------------- */
.auth-screen {
  background:
    radial-gradient(circle at 30% 0%, #1a4a78 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, #0a1f33 0%, transparent 50%),
    #0f2a44;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.auth-card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: 32px 24px 20px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-brand {
  text-align: center;
  margin-bottom: 26px;
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 6px 20px rgba(15,42,68,.3);
}
.auth-title { font-size: 20px; font-weight: 700; }
.auth-subtitle { font-size: 12px; color: var(--c-muted); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
.auth-label {
  display: block; text-align: center;
  font-size: 12px; color: var(--c-muted); letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 12px; font-weight: 600;
}

.pin-display {
  display: flex; justify-content: center; gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  min-height: 16px;
}
.pin-display span {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--c-line);
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}
.pin-display span.is-filled {
  background: var(--c-primary);
  transform: scale(1.15);
}
.pin-display.is-error span {
  background: var(--c-danger);
  animation: shake .35s;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pin-keypad button {
  height: 60px;
  font-size: 24px; font-weight: 500;
  border: 0;
  background: var(--c-line-soft);
  color: var(--c-ink);
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.pin-keypad button:active { transform: scale(.95); background: var(--c-line); }
.pin-keypad .pin-back {
  font-size: 13px; font-weight: 600; color: var(--c-ink-soft);
  background: transparent;
}
.pin-keypad .pin-back:active { background: var(--c-line-soft); }
.pin-keypad .pin-ok {
  background: var(--c-success, #2c8a4f);
  color: #fff;
}
.pin-keypad .pin-ok:active { background: #257443; transform: scale(.95); }
.pin-keypad .pin-ok:disabled {
  background: var(--c-line-soft);
  color: var(--c-line);
  cursor: not-allowed;
  opacity: .6;
}
.pin-keypad .pin-ok:disabled:active { transform: none; }

.auth-msg {
  min-height: 22px;
  text-align: center;
  font-size: 14px; color: var(--c-danger);
  margin-top: 14px;
}
.auth-footer {
  text-align: center; font-size: 11px; color: var(--c-muted);
  margin-top: 18px; letter-spacing: .5px;
}

/* ----------------------------------------------------------- */
/*  Form fields                                                */
/* ----------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; font-size: 12px; color: var(--c-ink-soft);
  font-weight: 600; margin-bottom: 6px; letter-spacing: .3px;
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--c-ink);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field-input--lg { padding: 14px 16px; font-size: 17px; font-weight: 500; }
.field-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
textarea.field-input { resize: vertical; min-height: 80px; }

.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.info-pill {
  background: var(--c-accent-soft);
  color: var(--c-primary);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin: 4px 0 14px;
}

/* ----------------------------------------------------------- */
/*  Overlays / spinner                                         */
/* ----------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15,42,68,.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.overlay[hidden] {
  display: none !important;
}
.overlay-card {
  background: #fff;
  border-radius: var(--r-xl);
  padding: 28px 24px;
  width: 100%; max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.overlay-card--success { padding-top: 20px; }
.overlay-title { font-size: 17px; font-weight: 700; margin: 14px 0 4px; }
.overlay-msg   { font-size: 14px; color: var(--c-muted); margin-bottom: 16px; }
.overlay-check {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--c-success-soft);
  color: var(--c-success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  animation: pop .4s;
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--c-line);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  height: 6px; background: var(--c-line-soft); border-radius: 3px; overflow: hidden;
  margin-top: 6px;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--c-accent), var(--c-success));
  transition: width .25s;
}

/* ----------------------------------------------------------- */
/*  Step actions                                               */
/* ----------------------------------------------------------- */
.step-actions {
  display: flex; gap: 8px; justify-content: space-between;
  margin-top: 16px;
}
.step-actions .btn { flex: 1; }
.step-actions .btn-block { flex: 1 1 100%; }

/* ----------------------------------------------------------- */
/*  Responsive                                                 */
/* ----------------------------------------------------------- */
@media (max-width: 380px) {
  .pin-keypad button { height: 54px; font-size: 22px; }
  .auth-card { padding: 26px 18px 16px; }
}