/* Garage — night-instrument palette shared with the other personal apps. */
:root {
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #161a21;
  --panel-2: #1d222b;
  --line: #2a303b;
  --text: #ece9e1;
  --muted: #8f97a3;
  --dim: #5d6572;
  --amber: #e2a63b;
  --amber-2: #f2c25e;
  --red: #e0604f;
  --green: #5cb87a;
  --radius: 14px;
  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: calc(96px + var(--safe-b));
}
a { color: var(--amber-2); text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; color: var(--muted); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--amber-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Header */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--pad) 10px;
  max-width: 760px; margin: 0 auto;
}
.brand { color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.cars { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.cars::-webkit-scrollbar { display: none; }
.cars a {
  color: var(--muted); padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; font-size: 14px;
}
.cars a.on { color: var(--text); border-color: var(--line); background: var(--panel); }
.cars a.add { color: var(--amber-2); }

.view { max-width: 760px; margin: 0 auto; padding: 4px var(--pad) 0; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head .link { font-size: 14px; }

/* Vehicle card with the odometer readout */
.car {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px;
}
.car .name { font-size: 22px; font-weight: 700; }
.car .spec { color: var(--muted); font-size: 14px; margin-top: 2px; }
.car .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.car .gear { background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px;
  display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.car .gear:hover { color: var(--text); }
.odo { margin-top: 18px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.drums { display: inline-flex; gap: 3px; }
.drum {
  width: 30px; height: 44px; border-radius: 5px; display: grid; place-items: center;
  background: linear-gradient(180deg, #05070a 0%, #1a1f27 45%, #1a1f27 55%, #05070a 100%);
  border: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  font-size: 26px; font-weight: 600; color: #f4f1e8; font-variant-numeric: tabular-nums;
}
.drum.last { color: var(--amber-2); }
.odo .unit { color: var(--muted); font-size: 14px; padding-bottom: 8px; }
.odo .meta { color: var(--dim); font-size: 13px; width: 100%; }
.odo .meta button { background: none; border: 0; padding: 0; color: var(--amber-2); cursor: pointer; }
.carstats { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.carstats b { color: var(--text); font-weight: 600; }

/* Reminders */
.rem { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rem:last-child { border-bottom: 0; }
.rem .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.rem.overdue .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(224,96,79,.18); }
.rem.soon .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(226,166,59,.18); }
.rem.ok .dot { background: var(--green); }
.rem .t { font-weight: 500; line-height: 1.3; }
.rem .s { color: var(--muted); font-size: 13px; }
.rem .when { text-align: right; font-size: 14px; color: var(--muted); max-width: 44%; line-height: 1.3; }
.rem.overdue .when { color: var(--red); font-weight: 600; }
.rem.soon .when { color: var(--amber-2); font-weight: 600; }
.rem .when.cat { color: var(--dim); font-weight: 400; }

/* History */
.year { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted);
  font-size: 13px; margin: 18px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.year:first-child { margin-top: 0; }
.svc { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; padding: 11px 0; align-items: start;
  border-bottom: 1px dashed var(--line); cursor: pointer; }
.svc:last-child { border-bottom: 0; }
.svc .d { color: var(--muted); font-size: 13px; line-height: 1.3; padding-top: 2px; }
.svc .d b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.svc .t { font-weight: 500; }
.svc .s { color: var(--muted); font-size: 13px; }
.svc .c { text-align: right; font-weight: 500; white-space: nowrap; }
.svc .clip { color: var(--dim); font-size: 12px; margin-left: 6px; }

/* Generic */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.empty { color: var(--muted); padding: 22px 16px; text-align: center; }
.empty a { display: inline-block; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; font-weight: 500; min-height: 44px;
}
.btn:hover { border-color: #3a4250; }
.btn.primary { background: var(--amber); color: #14110a; border-color: var(--amber); font-weight: 600; }
.btn.primary:hover { background: var(--amber-2); }
.btn.danger { color: var(--red); }
.btn.ghost { background: none; }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* Floating add button */
.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--safe-b)); z-index: 5;
  padding: 14px 22px; border-radius: 999px; background: var(--amber); color: #14110a; border: 0;
  font-weight: 700; font-size: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.45); cursor: pointer;
}
.fab:hover { background: var(--amber-2); }

/* Forms */
.form { display: grid; gap: 14px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .form .grid2.stack { grid-template-columns: 1fr; } }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label.f > span { padding-left: 2px; }
.f input, .f select, .f textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; min-height: 44px;
}
.f textarea { min-height: 84px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--amber); outline: none; }
.f select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238f97a3' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.f .money { position: relative; }
.f .money input { padding-left: 26px; }
.f .money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--amber); }
.hint { color: var(--dim); font-size: 13px; }
.err { color: var(--red); font-size: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.page-head .back { color: var(--muted); font-size: 14px; }
.page-head h1 { font-size: 22px; }

/* Attachments */
.files { display: flex; gap: 10px; flex-wrap: wrap; }
.file { position: relative; width: 96px; }
.file a.thumb { display: block; width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: var(--red); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.file .n { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.upload { display: block; border: 1px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted);
  cursor: pointer; font-size: 14px; }
.upload input { display: none; }
.upload.busy { color: var(--amber-2); }

/* Detail */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 15px; }
.kv .k { color: var(--muted); }
.notes { white-space: pre-wrap; }
.big { font-size: 28px; font-weight: 700; }

/* Inline confirm */
.confirm { background: rgba(224,96,79,.1); border: 1px solid rgba(224,96,79,.4); border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.login .drums { margin: 0 auto 26px; }
.login p { color: var(--muted); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: #262c36; color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 640px) {
  .drum { width: 34px; height: 50px; font-size: 30px; }
}

/* Visits */
.items { display: grid; gap: 10px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 10px; display: grid; gap: 10px; position: relative; }
.item .remove { justify-self: end; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.line .t { font-weight: 500; }
.line .s { color: var(--muted); font-size: 13px; }
.line .c { white-space: nowrap; color: var(--muted); }
.big2 { font-size: 20px; font-weight: 700; }

/* Car photo */
.car { position: relative; overflow: hidden; }
.car .carpic { position: absolute; right: 10px; top: 56px; width: 42%; max-height: 92px; object-fit: contain; object-position: right center;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.55)); pointer-events: none; }
.car.has-photo .head { min-height: 150px; }
.car.has-photo .head > div:first-child { padding-right: 44%; }
.carpic-preview { max-width: 220px; max-height: 120px; object-fit: contain; background: var(--panel-2); border-radius: 10px; padding: 8px; }
@media (min-width: 640px) { .car .carpic { max-height: 120px; width: 36%; top: 50px; right: 16px; } .car.has-photo .head { min-height: 170px; } }

/* History: one card per visit */
.yearhead { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 18px 2px 8px; }
.section-head + .yearhead { margin-top: 0; }
.visit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 12px; margin-bottom: 10px; cursor: pointer; }
.visit:hover { border-color: #3a4250; }
.vtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.vdate { font-weight: 600; font-size: 16px; }
.vsub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.vtotal { font-size: 22px; font-weight: 700; white-space: nowrap; color: var(--amber-2); }
.vitems { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.vitems li { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 14px; }
.vclip { color: var(--dim); font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
