/* AWR Customers — mobile-first, touch-friendly. No external fonts/CDN. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1c20;
  --muted: #666b73;
  --border: #d8dbe0;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --danger: #c53030;
  --danger-text: #ffffff;
  --accent-on: #1f6feb;
  --accent-on-text: #ffffff;
  --radius: 10px;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1c1e22;
    --text: #eceef1;
    --muted: #9aa0a8;
    --border: #33363c;
    --primary: #4c8dff;
    --primary-text: #0a0e14;
    --danger: #ff6b6b;
    --danger-text: #1a0000;
    --accent-on: #4c8dff;
    --accent-on-text: #0a0e14;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

body {
  padding-bottom: 96px; /* room for floating action button */
}

a { color: var(--primary); }

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 14px 24px;
}

header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

header.topbar h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 600;
}

header.topbar .user {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

h2 { font-size: 1.1rem; margin: 18px 0 10px; }
h3 { font-size: 1rem; margin: 14px 0 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 14px 0 6px;
}
label:first-child { margin-top: 0; }

input[type="text"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-width: 0; /* iOS Safari otherwise lets type="date" ignore width:100% and overflow */
  font-size: 16px; /* prevents iOS auto-zoom on focus */
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: var(--tap);
}

textarea { min-height: 100px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.btn-row .btn { width: auto; flex: 1; }

.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.search-form input[type="search"] { flex: 1; }
.search-form .btn { width: auto; padding: 10px 16px; }

.job-list { list-style: none; margin: 0; padding: 0; }

.job-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
}

.job-item .job-name {
  font-weight: 700;
  font-size: 1.02rem;
}

.job-item .job-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.job-item .job-vin {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 5px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
}

/* Wheel selector: 2x2 grid matching car orientation (LF/RF top, LR/RR bottom) */
.wheel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0 4px;
}

.wheel-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  height: 72px; /* fixed, not min-height — keeps all four tiles identical regardless of content */
  margin: 0;
  box-sizing: border-box;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  text-align: center;
}

.wheel-tile input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-on);
  flex-shrink: 0;
}

.wheel-tile.checked {
  background: var(--accent-on);
  color: var(--accent-on-text);
  border-color: var(--accent-on);
}

/* Photo previews / gallery */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0;
}

.photo-grid a, .photo-grid .photo-thumb-wrap {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.file-input-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: var(--muted);
}
.file-input-wrap input[type="file"] {
  width: 100%;
  margin-top: 8px;
  font-size: 0.9rem;
}

/* Floating action button */
.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  background: var(--primary);
  color: var(--primary-text);
  border-radius: 999px;
  min-width: 56px;
  min-height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.error-banner {
  background: rgba(197, 48, 48, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -2px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 18px;
}
