/* MG Parking — Mobile-first, high-contrast, huge tap targets */

:root {
  --green:   #16a34a;
  --green-bg:#f0fdf4;
  --blue:    #1d4ed8;
  --blue-bg: #eff6ff;
  --orange:  #ea580c;
  --red:     #dc2626;
  --red-bg:  #fef2f2;
  --gray:    #6b7280;
  --bg:      #f3f4f6;
  --card:    #ffffff;
  --text:    #111827;
  --muted:   #4b5563;
  --border:  #d1d5db;
  --tap:     72px;
  --r:       12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; -webkit-tap-highlight-color: transparent; }

body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 20px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  max-width: 480px;
  margin: 0 auto;
}

#root { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Loading ─────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-size: 56px;
}

/* ── Screen shell ─────────────────────────────────────── */
.screen {
  flex: 1;
  padding: 16px;
  padding-bottom: 32px;
}

/* ── Header ──────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 60px;
}
.header-title {
  font-size: 22px;
  font-weight: 700;
  flex: 1;
}
.btn-back {
  all: unset;
  cursor: pointer;
  font-size: 26px;
  padding: 8px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Buttons ─────────────────────────────────────────── */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 22px;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity .12s, transform .1s;
}
button:active           { opacity: .82; transform: scale(.97); }
button:disabled         { opacity: .45; cursor: not-allowed; transform: none; }

.btn-green  { background: var(--green);  color: #fff; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-gray   { background: var(--border); color: var(--text); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
}
.btn-outline-red {
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red);
}

/* Home big buttons */
.btn-home {
  font-size: 30px;
  min-height: 100px;
  border-radius: 16px;
  letter-spacing: .02em;
}

/* Inline / small buttons */
.btn-sm {
  min-height: 48px;
  width: auto;
  padding: 0 18px;
  font-size: 16px;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.09);
}

/* ── Big number (home) ───────────────────────────────── */
.big-number {
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}
.big-label {
  font-size: 20px;
  text-align: center;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Brand / title ───────────────────────────────────── */
.brand {
  text-align: center;
  padding: 24px 0 8px;
}
.brand-icon { font-size: 64px; line-height: 1; }
.brand h1   { font-size: 28px; font-weight: 900; letter-spacing: -.02em; margin-top: 6px; }
.brand p    { font-size: 17px; color: var(--muted); margin-top: 4px; }

/* ── User tiles (login) ──────────────────────────────── */
.user-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 8px 0;
}
.user-tile {
  background: var(--card);
  border-radius: 16px;
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 110px;
  touch-action: manipulation;
  transition: transform .15s;
}
.user-tile:active      { transform: scale(.94); }
.user-tile-icon        { font-size: 48px; line-height: 1; }
.user-tile-name        { font-size: 22px; font-weight: 700; }
.user-tile-role        { font-size: 14px; color: var(--muted); text-transform: capitalize; }

/* ── PIN keypad ──────────────────────────────────────── */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 24px 0 16px;
}
.pin-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--text);
  background: transparent;
  transition: background .1s;
}
.pin-dot.filled { background: var(--text); }

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}
.pin-key {
  min-height: 82px;
  background: var(--card);
  color: var(--text);
  font-size: 34px;
  font-weight: 700;
  border-radius: var(--r);
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.pin-key:active   { background: var(--border); }
.pin-key.key-del  { font-size: 26px; }
.pin-key.key-back { font-size: 14px; min-height: 64px; }
.pin-key.key-blank { visibility: hidden; }

/* ── Car-in: photo placeholder ───────────────────────── */
.photo-placeholder {
  width: 100%;
  min-height: 220px;
  background: #e5e7eb;
  border-radius: var(--r);
  border: 3px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 56px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .12s;
  margin-bottom: 8px;
}
.photo-placeholder:active { background: #d1d5db; }
.photo-placeholder p { font-size: 18px; color: var(--muted); }

.photo-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--r);
  background: #111;
  display: block;
  margin-bottom: 8px;
}

/* ── Size selection ──────────────────────────────────── */
.size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.size-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  border: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 130px;
  justify-content: center;
  touch-action: manipulation;
  transition: border-color .12s, background .12s;
}
.size-card.selected { border-color: var(--blue); background: var(--blue-bg); }
.size-card:active   { opacity: .85; }
.size-icon          { font-size: 48px; line-height: 1; }
.size-label         { font-size: 24px; font-weight: 700; }
.size-price         { font-size: 15px; color: var(--muted); }

/* ── Car-out grid ────────────────────────────────────── */
.car-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.car-card {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .14s;
  -webkit-user-select: none;
  user-select: none;
}
.car-card:active { transform: scale(.95); }
.car-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e5e7eb;
  display: block;
}
.car-thumb-ph {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.car-info   { padding: 10px 12px 14px; }
.car-size   { font-size: 22px; }
.car-plate  { font-size: 15px; color: var(--muted); font-family: monospace; margin-top: 2px; }
.car-time   { font-size: 13px; color: var(--muted); margin-top: 2px; }
.car-fee    { font-size: 24px; font-weight: 900; color: var(--green); margin-top: 4px; }

/* ── Checkout / fields ───────────────────────────────── */
.checkout-photo {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--r);
  background: #111;
  display: block;
}
.checkout-photo-ph {
  width: 100%;
  height: 180px;
  background: #e5e7eb;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  flex-direction: column;
  gap: 8px;
}
.checkout-photo-ph p { font-size: 14px; color: var(--muted); }

.field { margin: 14px 0; }
.field label { display: block; font-size: 16px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 22px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r);
  width: 100%;
  color: var(--text);
  background: var(--card);
  min-height: var(--tap);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field input[type=number] { -moz-appearance: textfield; }

/* Amount editable */
.amount-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.amount-wrap span { font-size: 32px; font-weight: 900; flex-shrink: 0; }
.amount-wrap input {
  font-size: 40px;
  font-weight: 900;
  border: none;
  border-bottom: 3px solid var(--border);
  border-radius: 0;
  padding: 4px 8px;
  min-height: unset;
  width: 100%;
  background: transparent;
  text-align: left;
}
.amount-wrap input:focus { border-bottom-color: var(--blue); outline: none; }

/* Breakdown */
.breakdown {
  background: #f9fafb;
  border-radius: var(--r);
  padding: 14px;
  margin: 10px 0;
}
.breakdown-line {
  font-size: 17px;
  padding: 6px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.breakdown-line:last-child {
  border-bottom: none;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

/* ── Reason chips ────────────────────────────────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}
.chip {
  all: unset;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 40px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  background: var(--card);
  color: var(--text);
  touch-action: manipulation;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  transition: border-color .12s, background .12s, color .12s;
}
.chip.selected { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }
.chip:active   { opacity: .8; }

/* ── Payment method ──────────────────────────────────── */
.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0;
}
.payment-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  border: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 110px;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  touch-action: manipulation;
  transition: border-color .12s, background .12s;
}
.payment-card.selected { border-color: var(--green); background: var(--green-bg); }
.payment-card:active   { opacity: .85; }
.payment-icon          { font-size: 40px; line-height: 1; }

/* ── Pending uploads chip ────────────────────────────── */
.pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: #fff;
  border-radius: 40px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Messages ────────────────────────────────────────── */
.msg-error   { background: var(--red-bg);   border: 2px solid var(--red);    color: var(--red);    border-radius: var(--r); padding: 14px 16px; font-size: 17px; font-weight: 600; margin: 10px 0; }
.msg-success { background: var(--green-bg); border: 2px solid var(--green);  color: var(--green);  border-radius: var(--r); padding: 14px 16px; font-size: 17px; font-weight: 600; margin: 10px 0; }
.msg-warn    { background: #fffbeb;         border: 2px solid var(--orange); color: var(--orange); border-radius: var(--r); padding: 14px 16px; font-size: 17px; font-weight: 600; margin: 10px 0; }

/* ── Report / dashboard ──────────────────────────────── */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.report-stat {
  background: var(--card);
  border-radius: var(--r);
  padding: 18px 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.report-stat-value { font-size: 36px; font-weight: 900; line-height: 1; }
.report-stat-label { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  min-width: 80px;
  padding: 16px 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  touch-action: manipulation;
  transition: color .12s, border-color .12s;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  overscroll-behavior: contain;
}
.modal {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal h2 { font-size: 22px; margin-bottom: 14px; }

/* ── Disk / storage bar ──────────────────────────────── */
.bar-track { width: 100%; height: 18px; background: var(--border); border-radius: 9px; overflow: hidden; margin: 8px 0; }
.bar-fill  { height: 100%; border-radius: 9px; background: var(--green); transition: width .3s; }
.bar-fill.warn   { background: var(--orange); }
.bar-fill.danger { background: var(--red); }

/* ── Section label ───────────────────────────────────── */
.section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 18px 0 8px;
}

/* ── Dividers & misc ─────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 16px; }
.text-xs    { font-size: 13px; }
.bold       { font-weight: 700; }
.mt-8       { margin-top: 8px; }
.mt-12      { margin-top: 12px; }
.mt-16      { margin-top: 16px; }
.mt-24      { margin-top: 24px; }
.flex-row   { display: flex; align-items: center; gap: 10px; }
.flex-row .spacer { flex: 1; }

/* ── Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-parked    { background: #dbeafe; color: var(--blue); }
.badge-out       { background: #dcfce7; color: var(--green); }
.badge-exception { background: var(--red-bg); color: var(--red); }

/* ── History list ────────────────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  touch-action: manipulation;
}
.history-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  background: #e5e7eb;
  flex-shrink: 0;
}
.history-thumb-ph {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.history-info   { flex: 1; min-width: 0; }
.history-amount { font-size: 22px; font-weight: 700; }
.history-meta   { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Admin user row ──────────────────────────────────── */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.user-row-icon   { font-size: 32px; flex-shrink: 0; }
.user-row-info   { flex: 1; }
.user-row-name   { font-size: 20px; font-weight: 700; }
.user-row-role   { font-size: 14px; color: var(--muted); text-transform: capitalize; }
.user-row.inactive { opacity: .5; }

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Day summary ─────────────────────────────────────── */
.summary-topline {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.summary-car-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.summary-thumb,
.summary-thumb-ph {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  flex-shrink: 0;
}
.summary-thumb {
  object-fit: cover;
  background: #e5e7eb;
}
.summary-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  font-size: 30px;
}
.summary-car-info {
  flex: 1;
  min-width: 0;
}
.summary-car-title {
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.summary-car-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}
.summary-car-amount {
  flex-shrink: 0;
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
  text-align: right;
}

/* ── Close-day confirm screen (legacy) ───────────────── */
.close-day-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 0;
  text-align: center;
}
.close-day-icon { font-size: 80px; }
.close-day-title { font-size: 28px; font-weight: 900; }
.close-day-sub   { font-size: 18px; color: var(--muted); max-width: 280px; }
