/* Garage — screen-specific styles (lock, home shell, settings) */

/* LOCK (ported from mockup; top padding adds the real safe-area inset) */
.lock-inner {
  min-height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 80px) 28px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(124,94,74,0.12), transparent 60%),
    var(--bg);
}
.lock-logo {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
}
.lock-logo svg { width: 30px; height: 30px; }
.wordmark {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  margin: 16px 0 0;
}
.wordmark-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.pin-prompt { margin: 40px 0 16px; font-size: 15px; color: var(--muted); font-weight: 550; text-align: center; min-height: 22px; }
.pin-prompt.warn { color: var(--due-ink); }
.pin-dots { display: flex; gap: 14px; margin-bottom: 36px; }
.pin-dots i {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--beige);
  background: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.pin-dots i.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 16px 22px;
  justify-content: center;
  margin-top: auto;
}
.pin-pad { display: contents; }
.keypad.is-disabled { opacity: 0.45; pointer-events: none; }
.key {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 26px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 0;
}
.key:active { transform: scale(0.96); background: var(--bg-2); }
.key.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.key svg { width: 22px; height: 22px; }
.lock-foot { margin-top: 16px; min-height: 48px; display: flex; align-items: center; }
.link-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: underline;
}

/* PIN pad inside a sheet: keys sit on the sheet background */
.sheet .pin-prompt { margin: 0 0 12px; }
.sheet .pin-dots { justify-content: center; margin-bottom: 20px; }
.sheet .keypad { margin-top: 0; }

/* Install note on Home */
.note-text b { display: block; font-size: 13px; margin-bottom: 2px; }
.note-text b svg { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-inline-end: 6px; color: var(--accent-ink); }
.note-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

/* Empty / placeholder screens */
.empty-card { padding: 16px; }

/* ---- Batch 2: identity, status, cars, parts, lists (ported from mockup/styles.css) ---- */

/* Qatar plate */
.qplate {
  display: flex;
  width: 100%;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 2px solid #1a1a1a;
  box-shadow: 0 6px 16px rgba(17,24,39,0.12), inset 0 1px 0 #fff;
  position: relative;
}
.qplate.lg { height: 120px; }
.qplate.sm { height: 56px; width: 148px; flex-shrink: 0; }
.qband {
  width: 42px;
  background: var(--maroon);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 0;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-size: 9px;
  line-height: 1.15;
  flex-shrink: 0;
}
.qplate.lg .qband { width: 52px; font-size: 11px; }
.qplate.sm .qband { width: 24px; font-size: 6px; }
.qface {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px 8px;
  position: relative;
}
.qar {
  font-family: "Noto Naskh Arabic", serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  color: #111;
  margin-bottom: 2px;
}
.qplate.lg .qar { font-size: 20px; }
.qplate.sm .qar { font-size: 10px; margin-bottom: 0; }
.qnum {
  font-weight: 800;
  font-size: 36px;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #111;
  font-variant-numeric: tabular-nums;
}
.qplate.lg .qnum { font-size: 48px; }
.qplate.sm .qnum { font-size: 20px; letter-spacing: 0.04em; }

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #E5E7EB;
  color: var(--neutral);
  white-space: nowrap;
}
.pill.good { background: #DCFCE7; color: var(--good-ink); }
.pill.watch { background: #FEF3C7; color: #B45309; }
.pill.plan { background: #FFEDD5; color: var(--plan-ink); }
.pill.due { background: #FEE2E2; color: var(--due-ink); }
.pill.overdue, .pill.expired { background: #FEE2E2; color: #7F1D1D; }
.pill.none { background: #E5E7EB; color: #4B5563; }

.car-card, .part {
  width: 100%;
  text-align: start;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.car-card { display: block; padding: 12px; margin-bottom: 12px; }
.car-card .car-meta-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.car-card .cname { font-size: 14px; font-weight: 650; }
.car-card .csub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Car screen */
.hero-plate { margin-bottom: 12px; }
.car-name { margin: 0 0 4px; font-weight: 750; font-size: 18px; }
.spend { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.spend.tight { margin-bottom: 4px; }
#parts-anchor { scroll-margin-top: 56px; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.stat-box { padding: 14px; }
.stat-box .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-box .v { font-size: 22px; font-weight: 750; letter-spacing: -0.03em; margin: 6px 0 4px; }
.stat-box .s { font-size: 11px; color: var(--muted); }
.stat-box .s-pill { margin-top: 8px; }
.stat-box.watch .v { color: #B45309; }
.stat-box.plan .v { color: #C2410C; }
.stat-box.due .v { color: var(--due-ink); }
.stat-box.overdue .v, .stat-box.expired .v { color: var(--overdue); }

.legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 8px; margin: 0 0 12px; padding: 10px 12px; }
.legend span {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted);
}
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend i.good { background: var(--good); }
.legend i.watch { background: var(--watch); }
.legend i.plan { background: var(--plan); }
.legend i.due { background: var(--due); }
.legend i.overdue { background: var(--overdue); }
.legend i.none { background: var(--neutral); }

.part { display: block; padding: 14px 16px; margin-bottom: 8px; border-inline-start: 4px solid var(--neutral); }
.part.good { border-inline-start-color: var(--good); }
.part.watch { border-inline-start-color: var(--watch); }
.part.plan { border-inline-start-color: var(--plan); }
.part.due { border-inline-start-color: var(--due); }
.part.overdue { border-inline-start-color: var(--overdue); }
.part.none { border-inline-start-color: var(--neutral); }
.part-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.part h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.part .ago { font-size: 12px; color: var(--text); }
.part .due-line { font-size: 12px; font-weight: 650; margin-top: 2px; }
.part.good .due-line { color: var(--good-ink); }
.part.watch .due-line { color: #B45309; }
.part.plan .due-line { color: var(--plan-ink); }
.part.due .due-line { color: var(--due-ink); }
.part.overdue .due-line { color: var(--overdue); }
.part.none .due-line, .part.none .ago { color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: #EDE8E3; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--neutral); }
.part.good .bar > i { background: var(--good); }
.part.watch .bar > i { background: var(--watch); }
.part.plan .bar > i { background: var(--plan); }
.part.due .bar > i { background: var(--due); }
.part.overdue .bar > i { background: var(--overdue); }
.custom-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--info-ink); background: #DBEAFE; padding: 2px 6px; border-radius: 999px;
  margin-inline-start: 6px; vertical-align: middle;
}
.auto-tag { font-size: 10px; color: var(--info-ink); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 6px; }

.svc-list { padding: 4px 16px; }
.svc-row { display: flex; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--stroke); }
.svc-row:last-child { border-bottom: 0; }
.svc-row .sd { font-size: 12px; color: var(--muted); }
.svc-row .sw { font-size: 14px; font-weight: 650; }
.svc-row .sc { font-size: 13px; font-weight: 650; white-space: nowrap; }
.stack-gap { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mt-6 { margin-top: 6px; }
.mt-2 { margin-top: 2px; }
.pad-sm { padding: 12px 14px; }
.part-info { padding: 14px 16px; margin-bottom: 12px; }
.empty-line { padding: 12px 0; margin: 0; }

/* Lists (cars, garages, services, intervals) */
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; margin-bottom: 8px; width: 100%; text-align: start; color: inherit; font: inherit;
}
button.list-item { cursor: pointer; }
.list-item h3 { margin: 0 0 3px; font-size: 15px; font-weight: 650; }
.list-item p { margin: 0; font-size: 12px; color: var(--muted); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item.is-archived { opacity: 0.7; }
.row .r-sub.warn { color: var(--overdue); font-weight: 650; }
.import-tab { padding: 14px 16px; margin-bottom: 8px; }
.import-tab-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.import-tab-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
#import-summary, #import-errors { padding: 0; overflow: hidden; margin-bottom: 12px; }
#restore-counts { margin: 8px 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field .hint.warn { margin-top: 6px; }
.field input[aria-invalid="true"] { border-color: var(--due); }
.field textarea { min-height: 48px; resize: none; }
.sheet > .danger-btn, .sheet > .ghost-wide { margin-top: 10px; }
.sheet .primary { margin-top: 6px; }

/* ---- Batch 3: orders, bills, documents (ported from mockup/styles.css) ---- */

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 16px; }
.filters button {
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.filters button.is-on { background: var(--text); color: #fff; border-color: transparent; }

/* Totals (Average days / Longest) */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.totals .card { padding: 14px 16px; }
.totals .k { font-size: 11px; color: var(--muted); font-weight: 600; }
.totals .v { font-size: 22px; font-weight: 750; letter-spacing: -0.03em; margin-top: 4px; }

/* Order card */
.order, .order-head { display: block; padding: 14px 16px; margin-bottom: 8px; }
button.order { width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.order-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.chip { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: 0.04em; }
.order-status { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.order.amber .order-status, .order-head.amber .order-status { color: var(--plan-ink); }
.order.red .order-status, .order-head.red .order-status { color: var(--due-ink); }
.order.done .order-status, .order-head.done .order-status { color: var(--good-ink); }
.order h3 { margin: 2px 0 6px; font-size: 16px; font-weight: 650; }
.order-head { margin-bottom: 12px; }
.order-head .hint { margin: 2px 0 0; font-size: 12px; }
.order-head h2 { margin: 4px 0 6px; font-size: 22px; font-weight: 600; font-family: var(--serif); }
.meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Auto grid, garage suggest */
.auto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; margin-bottom: 10px; }
.auto-grid .k { display: block; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.auto-grid .v { font-size: 13px; font-weight: 700; margin-top: 1px; }
/* Chips are 32px tall with 16px between rows, so their 48px hit areas (8px beyond each edge) never overlap. */
.suggest { display: flex; flex-wrap: wrap; gap: 16px 6px; margin-top: 10px; }
.suggest button {
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.suggest button.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* Attach (camera) */
.camera-btn {
  width: 100%;
  border: 1px dashed var(--beige);
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 48px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.camera-btn svg { width: 26px; height: 26px; color: var(--accent); }
.camera-btn small { color: var(--muted); font-weight: 450; font-size: 11px; }
.attach { margin-bottom: 10px; }
.attach-choice { margin-top: 8px; }
.attach-choice[hidden] { display: none; }
.pending-file {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 650; padding: 4px 0 8px;
}
.pending-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Detail timeline */
.timeline { padding: 10px 12px; margin-bottom: 12px; }
.tl-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .rail { display: flex; flex-direction: column; align-items: center; position: relative; }
.tl-item .rail::after { content: ""; position: absolute; top: 16px; bottom: -16px; width: 1.5px; background: var(--beige); }
.tl-item:last-child .rail::after { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--beige); background: var(--card); z-index: 1; margin-top: 3px; }
.tl-item.done .tl-dot, .tl-item.current .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-item.current .tl-dot { box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-title { font-size: 14px; font-weight: 650; }
.tl-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Bills */
.bill-row { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 12px; }
.bill-row .grow { flex: 1; min-width: 0; }
.bill-open { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 10px; flex-shrink: 0; }
.bill-thumb {
  width: 64px; height: 72px; border-radius: 10px; background: #E8E0D8; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; color: var(--accent);
}
.bill-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bill-thumb.is-file { align-content: center; justify-items: center; gap: 2px; font-size: 10px; font-weight: 700; }
.bill-thumb.is-file svg { width: 22px; height: 22px; }
.b-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.b-cost { font-size: 22px; font-weight: 750; letter-spacing: -0.03em; }

/* Full-screen image viewer */
.viewer {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(17, 24, 39, 0.92);
  display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer .icon-btn { position: absolute; inset-block-start: calc(env(safe-area-inset-top, 0px) + 8px); inset-inline-start: 8px; }

/* Documents on the car screen */
.doc-row { margin-bottom: 8px; }
.doc-row .hint { margin-top: 2px; }

/* ---- Batch 4: Coming up, fines, search (ported from mockup/styles.css) ---- */

.field[hidden] { display: none; }
#documents-anchor { scroll-margin-top: 56px; }

/* Home: Coming up. The mockup nests the Calendar span inside the row button; here the row is a div with two sibling buttons. */
#home-coming { margin-bottom: 16px; }
.coming-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-inline-end: 12px;
  border-bottom: 1px solid var(--stroke);
}
.coming-item:last-child { border-bottom: 0; }
.coming-item .ci-main {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 10px 12px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.coming-item .ci-text { display: block; min-width: 0; }
.coming-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--due); }
.coming-item .dot.overdue, .coming-item .dot.expired { background: var(--overdue); }
.coming-item .dot.plan { background: var(--plan); }
.coming-item .dot.watch { background: var(--watch); }
.coming-item .dot.good { background: var(--good); }
.coming-item .ci-title { display: block; font-size: 13px; font-weight: 650; }
.coming-item .ci-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.cal-btn {
  flex-shrink: 0;
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

/* Fines */
.totals .card.unpaid .v { color: var(--due-ink); }
.fine { display: block; padding: 14px 16px; margin-bottom: 8px; }
button.fine { width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.fine-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.fine h3 { margin: 2px 0 6px; font-size: 16px; font-weight: 650; }
.fine.unpaid .order-status, .fine.unpaid .amt { color: var(--due-ink); }
.fine.paid .order-status, .fine.paid .amt { color: var(--good-ink); }
.amt { font-weight: 700; }

/* Search */
.search-box {
  width: 100%;
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: 16px;
  padding: 12px 16px;
  font: inherit;
  font-size: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  outline: none;
}
.search-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-hit {
  display: block;
  width: 100%;
  text-align: start;
  padding: 12px 14px;
  margin-bottom: 8px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.search-hit .k { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.search-hit .t { font-size: 15px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
