:root {
  --purple: #2b1250;
  --purple-2: #3a1a6b;
  --gold: #d4af37;
  --gold-2: #f4c542;
  --bg: #f4f1f8;
  --card: #ffffff;
  --ink: #201a2c;
  --muted: #6b6478;
  --line: #e4dfee;
  --ok: #1f8a52;
  --warn: #b5750a;
  --danger: #b5342a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-top: env(safe-area-inset-top, 0px);
}
h1, h2, h3, .brand-name, .invoice-no { font-family: "Oswald", "Inter", sans-serif; }

#app { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 12px; position: sticky; top: env(safe-area-inset-top, 0px);
  background: var(--bg); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 10px; background: var(--purple);
  color: var(--gold-2); border: 2px solid var(--gold); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-family: "Oswald", sans-serif; flex-shrink: 0;
}
.brand-badge.big { width: 64px; height: 64px; font-size: 22px; margin: 0 auto 8px; }
.brand-name { font-size: 18px; font-weight: 600; color: var(--purple); }
.brand-sub { font-size: 12px; color: var(--muted); }

.icon-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.icon-btn.small { width: 32px; height: 32px; font-size: 14px; }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok, .pill-online { background: #e3f5ea; color: var(--ok); }
.pill-warn, .pill-offline { background: #fbeed6; color: var(--warn); }
.pill-busy, .pill-syncing { background: #e7e2f5; color: var(--purple-2); }
.driver-tag { font-size: 13px; color: var(--muted); }

.link-btn { background: none; border: none; color: var(--purple-2); font-weight: 600; cursor: pointer; padding: 4px; font-size: 13px; }
.link-btn.danger { color: var(--danger); }

.list-controls { display: flex; gap: 10px; margin-bottom: 14px; }
.select { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }

.btn { border: none; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn-primary { background: var(--purple); color: var(--gold-2); }
.btn-primary:active { background: var(--purple-2); }
.btn-ghost { background: var(--card); color: var(--purple-2); border: 1px solid var(--line); }

.job-cards { display: flex; flex-direction: column; gap: 10px; }
.job-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; }
.job-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.invoice-no { font-weight: 700; color: var(--purple); font-size: 16px; }
.status-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.s-open { background: #e7e2f5; color: var(--purple-2); }
.s-stored { background: #fbeed6; color: var(--warn); }
.s-released { background: #e3f5ea; color: var(--ok); }
.s-paid { background: #dff0ff; color: #1a5f9c; }
.s-voided { background: #f5e3e3; color: var(--danger); }
.job-card-vehicle { font-size: 14px; margin-bottom: 6px; }
.job-card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.ticket { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0 0 2px; font-size: 15px; color: var(--purple); text-transform: uppercase; letter-spacing: .03em; }
.card h3 .hint { text-transform: none; color: var(--muted); font-size: 12px; letter-spacing: 0; font-family: "Inter", sans-serif; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }
input, select, textarea {
  font-family: "Inter", sans-serif; font-size: 15px; color: var(--ink);
  padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  width: 100%; min-width: 0; max-width: 100%;
}
textarea { resize: vertical; }

.row2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; min-width: 0; }
.row3 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); gap: 10px; min-width: 0; }
@media (max-width: 420px) { .row2, .row3 { grid-template-columns: minmax(0,1fr); } }

.charge-row { display: grid; grid-template-columns: minmax(0,1fr) 56px 70px 64px 32px; gap: 6px; align-items: center; margin-bottom: 6px; min-width: 0; }
.charge-amount { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.charges-total { text-align: right; font-weight: 700; font-size: 16px; color: var(--purple); border-top: 1px solid var(--line); padding-top: 8px; }
.storage-calc { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.storage-note-row { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.sig-pad { width: 100%; height: 160px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; touch-action: none; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb { aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { text-align: center; cursor: pointer; }

.lpsc-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.danger-row { text-align: center; padding: 10px 0 30px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(20,10,40,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal { background: var(--card); border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; max-height: 90vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.gate { text-align: center; padding: 60px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gate-input { max-width: 240px; text-align: center; }
.gate-msg { color: var(--danger); font-size: 13px; min-height: 18px; }

@media print { .topbar, .status-row, .icon-btn, .danger-row { display: none !important; } }
