:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1f1c18;
  --muted: #6c655b;
  --line: #e4ddd1;
  --accent: #d9580a;
  --accent-ink: #ffffff;
  --field: #ffffff;
  --red: #c4271d;
  --red-bg: #fdeceb;
  --red-line: #f2b8b3;
  --amber: #a35c00;
  --amber-bg: #fff3df;
  --amber-line: #f3d29b;
  --green: #2c7a3a;
  --green-bg: #e9f5eb;
  --grey: #6c655b;
  --grey-bg: #f0ece6;
  --track: #ece6dc;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --card: #1f1c17;
    --ink: #f2ede4;
    --muted: #a69e90;
    --line: #36312a;
    --accent: #f07a2c;
    --accent-ink: #1a1208;
    --field: #17150f;
    --red: #ff7a6e;
    --red-bg: #361714;
    --red-line: #6e2a24;
    --amber: #ffbe5c;
    --amber-bg: #33260f;
    --amber-line: #6a4d1a;
    --green: #78d48a;
    --green-bg: #15291a;
    --grey: #a69e90;
    --grey-bg: #26221c;
    --track: #2e2a23;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* Phones: no double-tap zoom (pinch is stopped by the viewport line and script; the photo viewer zooms its own
   picture). Text boxes are 16px on phones (end of this file), so iPhones don't zoom in on them. */
html { touch-action: manipulation; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0; }
code { font-size: .9em; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- header ------------------------------------------------------------------------- */

.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.01em;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
.top nav a, .linkish {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: .95rem;
}
.top nav a:hover, .linkish:hover { color: var(--ink); background: var(--grey-bg); }
.top nav a.on { color: var(--ink); background: var(--grey-bg); font-weight: 600; }
.top nav form { margin: 0; }
.linkish { background: none; border: 0; cursor: pointer; }

/* --- layout ------------------------------------------------------------------------- */

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.page-title { font-size: 1.6rem; margin-bottom: 12px; }
.section-title { font-size: 1.1rem; margin: 24px 0 10px; }
.card .section-title { margin-top: 0; }

.flash {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  margin: 0 0 12px;
}
.flash-error { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.flash-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.flash-ok { background: var(--green-bg); border-color: transparent; color: var(--green); }

/* --- forms -------------------------------------------------------------------------- */

.stack { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
label .muted { font-weight: 400; }
input, textarea {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  min-width: 0;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: 6px; }
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.check:has(input:checked) { border-color: var(--accent); background: var(--amber-bg); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-small { padding: 6px 12px; font-size: .9rem; }
.btn-quiet { background: var(--grey-bg); color: var(--ink); font-weight: 600; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-soft { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-line); font-weight: 600; }

/* --- login -------------------------------------------------------------------------- */

.login {
  max-width: 360px;
  margin: 8vh auto 0;
  text-align: center;
}
.login h1 { font-size: 2rem; margin: 8px 0 20px; }
.login > p { margin: 4px 0 20px; }
.login form { text-align: left; }

/* --- dashboard ---------------------------------------------------------------------- */

.car {
  display: grid;
  gap: 14px 24px;
  grid-template-columns: 1fr;
  align-items: center;
}
.eyebrow {
  margin: 0 0 2px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.car h1 { font-size: 1.25rem; font-weight: 600; }
.odo-label { margin: 0; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.odo-km {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.odo-km span { font-size: 1rem; font-weight: 600; color: var(--muted); }
.odo-empty { color: var(--muted); font-size: 1.6rem; }
.odo .small { margin: 0; }
.odo-form { display: flex; gap: 8px; }
.odo-form input { flex: 1; }

@media (min-width: 760px) {
  .car { grid-template-columns: 1fr auto; }
  .odo { text-align: right; }
  .odo-form { grid-column: 1 / -1; max-width: 420px; }
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.pill-count {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .92rem;
  border: 1px solid var(--line);
  background: var(--card);
}
.pill-count b { font-size: 1.05rem; margin-right: 2px; }
.pill-count.is-overdue { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.pill-count.is-soon { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.pill-count.is-ok { color: var(--green); }
.pill-count.is-unknown { color: var(--muted); }

.tasks {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.task {
  --tone: var(--grey);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--tone);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task.is-overdue { --tone: var(--red); background: var(--red-bg); border-color: var(--red-line); border-left-color: var(--red); }
.task.is-soon { --tone: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); border-left-color: var(--amber); }
.task.is-ok { --tone: var(--green); }
.task header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task h2 { font-size: 1.02rem; }
.badge {
  flex: none;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--tone);
  border: 1px solid currentColor;
}
.task.is-overdue .badge { background: var(--red); color: #fff; border-color: var(--red); }
.task .due { margin: 0; }
.task.is-overdue .due strong { color: var(--red); }
.task.is-soon .due strong { color: var(--amber); }
.task > .small { margin: 0; }
.task footer {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--tone); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--tone); border-radius: 999px; }

.recent { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.recent span { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
section.card { margin-top: 20px; }

/* --- history ------------------------------------------------------------------------ */

.history { display: grid; gap: 12px; }
.entry header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.entry h2 { font-size: 1.05rem; }
.entry h2 .muted { font-weight: 500; }
.cost { font-weight: 700; font-variant-numeric: tabular-nums; }
.tags { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--grey-bg); border-radius: 999px; padding: 3px 10px; font-size: .88rem; }
.tags .tag-other { background: var(--amber-bg); }
.notes { margin: 10px 0 0; white-space: pre-wrap; color: var(--muted); }
.entry-delete { margin-top: 8px; }
.entry-delete summary { cursor: pointer; color: var(--muted); font-size: .85rem; width: fit-content; }
.entry-delete button { margin-top: 6px; }
.readings { margin-top: 20px; }
.readings summary { cursor: pointer; font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.num { text-align: right; }

/* --- schedule ----------------------------------------------------------------------- */

.sched { display: grid; gap: 10px; margin-top: 16px; }
.sched-item {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}
.sched-name, .sched-spec, .sched-actions { grid-column: 1 / -1; }
.sched-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sched-item.is-hidden { opacity: .6; }
@media (min-width: 760px) {
  .sched-item { grid-template-columns: 2fr 1fr 1fr; }
  .sched-name { grid-column: auto; }
  .sched-spec { grid-column: 1 / 3; }
  .sched-actions { grid-column: 3; align-self: end; justify-content: flex-end; }
}

/* The yin yang and Logout sit beside the logo on a phone, after the nav on a wider screen. */
.top-end { display: flex; align-items: center; gap: 8px; }
.logout { margin: 0; }
@media (max-width: 759px) {
  .top nav { order: 3; width: 100%; margin: 0 -10px; }
}

.ok-group { margin-top: 16px; }
.ok-group > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  margin-bottom: 12px;
  width: fit-content;
}
.ok-group > summary::-webkit-details-marker { display: none; }
.ok-group > summary .muted::after { content: " ▾"; }
.ok-group[open] > summary .muted { font-size: 0; }
.ok-group[open] > summary .muted::after { content: "Hide ▴"; font-size: .85rem; }
@media (min-width: 760px) {
  .top nav { margin-left: auto; }
}

/* --- settings ----------------------------------------------------------------------- */

.menu-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.menu-tile {
  display: grid;
  gap: 6px;
  align-content: start;
  color: var(--ink);
  text-decoration: none;
}
.menu-tile:hover { border-color: var(--accent); }
.menu-tile strong { font-size: 1.05rem; }
.menu-tile span { color: var(--muted); font-size: .92rem; }
.menu-tile small { color: var(--accent); font-weight: 600; }
.back { margin: 0 0 6px; }
.back a { text-decoration: none; font-size: .92rem; }
.narrow { max-width: 640px; }
.narrow + .narrow { margin-top: 16px; }
.hint { font-weight: 400; font-size: .82rem; color: var(--muted); }
.amber { color: var(--amber); }
.red { color: var(--red); }
select {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
/* Dropdowns open their list inside the page (where the browser can), so it's click to open,
   click to pick, the same in every Dosian app: Chromium on Linux draws the usual list as a
   separate popup, which there only picked on press-hold-release. iPhones keep their own picker. */
@supports (appearance: base-select) {
  select:not([multiple]):not([size]), ::picker(select) { appearance: base-select; }
  select:not([multiple]):not([size]):not([hidden]) { display: flex; align-items: center; gap: 8px; cursor: pointer; }
  select::picker-icon { color: var(--muted); transition: rotate .15s; }
  select:open::picker-icon { rotate: 180deg; }
  ::picker(select) {
    margin-top: 4px; padding: 4px; max-height: min(450px, 60vh);
    border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  option { padding: 9px 10px; border-radius: 7px; cursor: pointer; }
  option:hover, option:focus-visible { background: var(--grey-bg); outline: none; }
  option:checked { font-weight: 600; }
  option::checkmark { color: var(--accent); }
}
/* A <details> sliding shut keeps its contents in view until it has (the slide script). */
details.is-closing::details-content { content-visibility: visible; display: block; }
.confirm summary { cursor: pointer; color: var(--red); font-size: .9rem; width: fit-content; }
.confirm[open] summary { margin-bottom: 6px; }
.readings-table td form { margin: 0; display: flex; justify-content: flex-end; }
.stack > p, .stack > h2, .stack > details { margin: 0; }

/* --- history log (reads like the paper record: date, km, work done) ------------------ */

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.page-head .page-title { margin: 0; }
.log-group { margin-top: 22px; }
.owner-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.owner-head h2 { font-size: 1.15rem; }
.owner-head p { margin: 0; }
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.log-row {
  display: grid;
  grid-template-columns: 7.5em 6.5em 1fr auto;
  gap: 4px 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  align-items: start;
}
.log-row:first-child { border-top: 0; }
.log-labels {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--grey-bg);
}
.log-labels span:nth-child(2) { text-align: right; }
.log-date { font-weight: 600; white-space: nowrap; }
.log-km { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-km .unit { display: none; }
.log-desc .tags { margin: 0; }
.log-desc .tags li { font-size: .85rem; }
.log-title { margin: 0; }
.log-desc .tags + .log-title { margin-top: 6px; }
.log-desc .notes { margin: 4px 0 0; font-size: .9rem; }
.log-side { display: flex; gap: 12px; align-items: baseline; white-space: nowrap; }
.log-side .edit { font-size: .9rem; }
.danger-zone { margin-top: 16px; }

@media (max-width: 640px) {
  .log-labels { display: none; }
  .log-row { grid-template-columns: auto 1fr auto; }
  .log-km { text-align: left; color: var(--muted); }
  .log-km .unit { display: inline; }
  .log-desc { grid-column: 1 / -1; grid-row: 2; }
  .log-side { grid-column: 3; grid-row: 1; }
}
.task .due strong.plain { color: var(--ink); }

/* Fields line up across a row even when one has a hint under it: labels keep their
   natural height instead of stretching, and every box is the same height. */
.row { align-items: start; }
label { align-content: start; }
input:not([type="checkbox"]), select { height: 42px; }
/* Each field in a row takes three shared rows (caption, box, hint), so the boxes stay
   level even when one caption wraps onto two lines. */
.row { grid-auto-rows: auto; row-gap: 0; }
.row > label { grid-row: span 3; grid-template-rows: subgrid; gap: 4px; margin-bottom: 14px; }
.row > label:last-child { margin-bottom: 0; }
@media (min-width: 400px) { .row > label { margin-bottom: 0; } }

/* --- jobs --------------------------------------------------------------------------- */

.job-group .section-title { display: flex; align-items: center; gap: 8px; }
.job-group .section-title::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); }
.prio-urgent.section-title::before, .jobs-mini .prio-urgent .dot { background: var(--red); }
.prio-soon.section-title::before, .jobs-mini .prio-soon .dot { background: var(--amber); }
.prio-later.section-title::before, .jobs-mini .prio-later .dot { background: var(--grey); }
.job-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.job { display: flex; flex-direction: column; gap: 8px; border-left: 5px solid var(--grey); }
.job.prio-urgent { border-left-color: var(--red); }
.job.prio-soon { border-left-color: var(--amber); }
.job.is-overdue { background: var(--red-bg); border-color: var(--red-line); border-left-color: var(--red); }
.job header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.job h3 { margin: 0; font-size: 1.02rem; }
.job .notes { margin: 0; }
/* The whole card opens the job; photos and the buttons sit above that link. */
.job-list .job { position: relative; }
.job-link { color: var(--ink); text-decoration: none; }
.job-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.job-link:hover { text-decoration: underline; }
.job-list .photo-strip, .job-list .job-actions { position: relative; z-index: 1; }
.job-list .notes { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.job-page .page-title { margin: 0; }
.job-page .eyebrow { margin: 0 0 4px; }
.job-facts { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 28px; }
.job-facts dt { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.job-facts dd { margin: 2px 0 0; font-weight: 600; }
.job.job-page footer { justify-content: flex-start; }
.job-page footer form { margin: 0; }
.finished-list .job-title { color: var(--ink); font-weight: 700; }
.job footer { margin-top: auto; padding-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-actions { display: flex; align-items: center; gap: 12px; }
.job-due { margin: 0; font-weight: 600; }
.job-due.is-overdue { color: var(--red); }
.job-due.is-soon { color: var(--amber); }
.kind {
  flex: none; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 999px; background: var(--grey-bg); color: var(--muted);
}
.kind-upgrade { background: var(--green-bg); color: var(--green); }
.finished { margin-top: 24px; }
.finished summary { cursor: pointer; font-weight: 600; }
.finished-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.finished-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.finished-list form { margin: 0; }
.finished-list .linkish { padding: 0; color: var(--accent); }

.jobs-card { margin: 16px 0 0; }
.jobs-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.jobs-card .section-title { margin: 0 0 8px; }
.jobs-card > p { margin: 0; }
.jobs-mini { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.jobs-mini li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.jobs-mini .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; }
.jobs-mini a { color: var(--ink); font-weight: 600; text-decoration: none; }
.jobs-mini a:hover { text-decoration: underline; }
.jobs-mini .is-overdue a { color: var(--red); }

/* Five nav links fit on one line on a phone. */
@media (max-width: 479px) {
  .top nav a { padding: 6px 7px; font-size: .9rem; }
}
@media (max-width: 379px) {
  .top nav a { padding: 6px 5px; font-size: .86rem; }
}

/* --- job photos --------------------------------------------------------------------- */

input[type="file"] { height: auto; padding: 8px; }
.photo-strip, .photo-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.photo-strip { grid-template-columns: repeat(4, 1fr); }
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-strip a, .photo-grid a { position: relative; display: block; border-radius: 8px; overflow: hidden; background: var(--grey-bg); aspect-ratio: 1; }
.photo-strip img, .photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip .more {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.photo-grid li { display: grid; gap: 4px; }
.photo-grid form { margin: 0; }
.photo-delete { background: none; border: 0; padding: 2px 0; color: var(--red); font: inherit; font-size: .85rem; cursor: pointer; }
.photo-manage { margin-top: 16px; }
.photo-manage .section-title { margin: 0 0 10px; }

/* --- accounts ----------------------------------------------------------------------- */

.auth-switch { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.setup { max-width: 560px; margin: 4vh auto 0; }
.choice-list { display: grid; gap: 6px; }
.check input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.check:has(input[type="radio"]:checked) { border-color: var(--accent); background: var(--amber-bg); }

/* --- import from photos ------------------------------------------------------------- */

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.import-list { list-style: none; margin: 0; display: grid; gap: 8px; }
.import-list li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 16px; }

.reading { display: flex; align-items: center; gap: 16px; }
.reading p { margin: 0; }
.spinner {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  border: 3px solid var(--track); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.row-actions { display: flex; gap: 10px; }
.row-actions form { margin: 0; }
.import-rows { display: grid; gap: 10px; }
.import-row { display: grid; gap: 10px; border-left: 5px solid var(--green); }
.import-row.has-flags { border-left-color: var(--amber); }
.import-row.is-off { border-left-color: var(--grey); opacity: .65; }
.import-row .include { display: flex; align-items: center; gap: 8px; font-weight: 700; width: fit-content; }
.import-row .include input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.import-row .row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.import-tasks summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.import-tasks summary::-webkit-details-marker { display: none; }
.import-tasks .tag { background: var(--grey-bg); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.import-tasks .change { color: var(--accent); font-size: .85rem; margin-left: 4px; }
.import-tasks[open] .checks { margin-top: 10px; }
.import-flag { margin: 0; font-size: .88rem; color: var(--muted); }
.import-flag.is-bad { color: var(--amber); font-weight: 600; }
.import-save { position: sticky; bottom: 8px; margin-top: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); }
.discard { margin-top: 12px; text-align: center; }

/* --- floating success messages ------------------------------------------------------ */

.toasts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, calc(100% - 32px));
  display: grid;
  gap: 8px;
  z-index: 50;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px 12px 16px;
  border-radius: 10px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  font-weight: 500;
  animation: toast-in .25s ease-out, toast-out .6s ease-in 4.4s forwards;  /* gone at 5 s */
}
.toast:hover { animation-play-state: paused; }
.toast span { flex: 1; }
.toast-close {
  flex: none;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
  opacity: .7;
}
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: toast-out .01s linear 5s forwards; }
}
.toast-warn {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
}
.toast-error {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-line);
}
.login.signup { max-width: 440px; }
.signup .section-title { margin: 0; }
.login > p.step { margin: -12px 0 18px; }
.setup .step { margin: -6px 0 12px; }

/* --- import choices and the typing table -------------------------------------------- */

.import-options { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* Each card spans four shared rows (title, text, field, button) so the boxes are the same height
   and their fields and buttons line up across the row. */
.import-option { grid-row: span 4; grid-template-rows: subgrid; row-gap: 14px; align-items: start; }
.import-option > div:last-child { align-self: end; }
.import-option .section-title { margin: 0; }
.import-option p { margin: 0; }
.type-layout { display: grid; gap: 16px; }
.type-photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.type-photos img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--line); }
.type-head { display: none; }
.type-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: row; }
.type-row {
  display: grid; gap: 6px; grid-template-columns: 1fr 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.type-row.is-read { border-left: 4px solid var(--amber); }
.type-row input[name$="work"], .type-row input[name$="notes"] { grid-column: 1 / -1; }
.type-row input { height: 38px; padding: 6px 8px; font-size: .93rem; }
.type-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (min-width: 900px) { .type-actions { position: sticky; bottom: 8px; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); } }
@media (min-width: 900px) {
  .wrap:has(.type-layout) { max-width: 1400px; }
  .type-layout.has-photos { grid-template-columns: minmax(280px, 34%) 1fr; align-items: start; }
  .type-layout.has-photos .type-photos { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; grid-template-columns: 1fr; }
  .type-head, .type-row { grid-template-columns: 110px 90px 2fr 1.3fr 70px 100px; }
  .type-head { display: grid; gap: 6px; padding: 0 11px 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .type-rows { gap: 4px; }
  .type-row { padding: 4px; border-radius: 8px; }
  .type-row input[name$="work"], .type-row input[name$="notes"] { grid-column: auto; }
}

/* --- dashboard list view ------------------------------------------------------------- */

.view-toggle { margin: 0 0 0 auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.view-toggle button { font: inherit; font-size: .88rem; border: 0; background: none; color: var(--muted); padding: 6px 14px; cursor: pointer; }
.view-toggle button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.view-toggle button:not(.on):hover { color: var(--accent); }
.lines { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.line { border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: var(--ink); text-decoration: none; }
.line a:hover { background: var(--grey-bg); }
.line .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--grey); }
.line.is-overdue .dot { background: var(--red); }
.line.is-soon .dot { background: var(--amber); }
.line.is-ok .dot { background: var(--green); }
.line-name { flex: 1; min-width: 0; font-weight: 600; font-size: .95rem; }
.line-due { flex: none; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.line.is-overdue .line-due { color: var(--red); font-weight: 600; }
.line.is-soon .line-due { color: var(--amber); font-weight: 600; }
.line.is-overdue { background: var(--red-bg); }

/* --- photo viewer ------------------------------------------------------------------- */

dialog.viewer { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0c0a08; color: #fff; overflow: hidden; }
dialog.viewer::backdrop { background: transparent; }
html:has(dialog.viewer[open]) { overflow: hidden; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.viewer-stage img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; user-select: none; -webkit-user-select: none;
  transition: transform .18s ease; cursor: grab; will-change: transform; }
.viewer-stage img:active { cursor: grabbing; }
.viewer-bar { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; align-items: center; gap: 8px; }
.viewer-count { font-size: .9rem; color: rgba(255, 255, 255, .8); margin-right: 4px; font-variant-numeric: tabular-nums; }
.viewer button { font: inherit; font-size: 1.4rem; line-height: 1; width: 44px; height: 44px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; display: grid; place-items: center; }
.viewer button:hover { background: rgba(255, 255, 255, .26); }
.viewer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2rem !important; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer.single .viewer-nav { display: none; }
dialog.viewer:focus { outline: none; }
@media (max-width: 600px) { .viewer .viewer-nav { display: none; } }   /* swipe instead */

/* --- "are you sure?" pop-up ---------------------------------------------------------- */

dialog.ask { width: min(380px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
dialog.ask::backdrop { background: rgba(12, 10, 8, .55); }
dialog.ask h2 { margin: 0 0 6px; font-size: 1.15rem; }
dialog.ask p { margin: 0 0 18px; color: var(--muted); }
dialog.ask .ask-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* --- 3D car ------------------------------------------------------------------------- */

.car-3d { position: relative; grid-column: 1 / -1; height: 210px; margin: -6px -6px 0; touch-action: pan-y;
  cursor: grab; user-select: none; -webkit-user-select: none; }
.car-3d.dragging { cursor: grabbing; }
.car-3d canvas { display: block; width: 100%; height: 100%; }
.car-3d.no-3d { display: none; }
@media (min-width: 760px) { .car-3d { height: 260px; } }
.look .car-3d { margin: 0; height: 220px; border-radius: 10px; background: var(--grey-bg); }

.paints { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.paints legend { padding: 0; margin-bottom: 8px; }
.swatch { position: relative; width: 38px; height: 38px; border-radius: 999px; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 0 0 1px var(--line); cursor: pointer; }
.swatch input[type=radio] { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input[type=radio]:checked) { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch:has(input[type=radio]:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.sw-white { --sw: #f2f2ef; } .sw-silver { --sw: #b9bcc0; } .sw-grey { --sw: #6b6f74; } .sw-black { --sw: #1c1d1f; }
.sw-beige { --sw: #c9b48f; } .sw-gold { --sw: #a8874d; } .sw-green { --sw: #2f4a36; } .sw-blue { --sw: #24406b; }
.sw-red { --sw: #8e1f1f; }
.swatch-custom { background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935); }
.swatch-custom input[type=color] { position: absolute; inset: 6px; width: auto; height: auto; padding: 0; border: 0;
  border-radius: 999px; background: none; cursor: pointer; }
.swatch-custom input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-custom input[type=color]::-webkit-color-swatch { border: 0; border-radius: 999px; }
.swatch-custom input[type=color]::-moz-color-swatch { border: 0; border-radius: 999px; }

/* The small yin yang in the top bar: back to the dosiancreature.com home screen
   (the app keeps you logged in, so there's no login page to leave from). */
.dosian-home { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 50%; }
.dosian-home img { display: block; width: 24px; height: 24px; transition: transform .5s ease; }
.dosian-home:hover img, .dosian-home:focus-visible img { transform: rotate(180deg); }

/* Phones: text boxes at 16px (labels are smaller and fields take their size), so iPhones don't
   zoom in when you start typing. Last in the file so it wins. */
@media (max-width: 720px) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea, .type-row input { font-size: 16px; }
}
