/* Pip design system. Mobile-first; the app is used mostly as a home-screen web app. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --ink: #17201c;
  --ink-2: #3c4842;
  --muted: #5f6a64;
  --line: #e6e3db;
  --accent: #1f6f5c;
  --accent-strong: #185a4a;
  --accent-soft: #e3f1ec;
  --accent-ink: #ffffff;
  --leaf: #7ecfa7;
  --danger: #b3390a;
  --danger-soft: #fdebe1;
  --attention: #a15c00;
  --attention-soft: #fdf1dc;
  --info: #2459a8;
  --info-soft: #e5edfa;
  --success: #1f7a4d;
  --success-soft: #e2f3e9;
  --shadow-sm: 0 1px 2px rgb(23 32 28 / .06);
  --shadow: 0 1px 2px rgb(23 32 28 / .05), 0 6px 18px rgb(23 32 28 / .06);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #171d1a;
    --surface-2: #1e2622;
    --ink: #edf2ef;
    --ink-2: #c9d3ce;
    --muted: #93a19a;
    --line: #29322e;
    --accent: #5cc3a3;
    --accent-strong: #79d3b6;
    --accent-soft: #19332b;
    --accent-ink: #08130f;
    --danger: #ff8a5c;
    --danger-soft: #3a1f14;
    --attention: #f0b45a;
    --attention-soft: #33270f;
    --info: #8db4ff;
    --info-soft: #172338;
    --success: #6fd29c;
    --success-soft: #14291d;
    --shadow-sm: none;
    --shadow: 0 0 0 1px var(--line);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; }
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { flex: none; vertical-align: middle; }

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.12rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.strong { font-weight: 650; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- App header & tab bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.appbar-inner { width: 100%; max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark img { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px;
  color: var(--ink-2); background: transparent; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; max-width: 640px; height: var(--tabbar-h); }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none;
}
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] .icon { stroke-width: 2.2; }

/* ---- Page header ---- */
.page-head { margin: 8px 0 16px; }
.page-head .eyebrow { color: var(--muted); font-size: .9rem; font-weight: 500; }
.back { display: inline-flex; align-items: center; gap: 2px; margin: 4px 0 8px -6px; color: var(--ink-2); font-weight: 600; font-size: .95rem; }

/* ---- Cards & lists ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 0 14px; }
.card.flush { padding: 6px 0; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card.flush .card-title { padding: 12px 18px 4px; margin: 0; }
.card-title a { font-size: .9rem; font-weight: 600; }
.section-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 10px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: var(--ink); text-decoration: none;
  border-top: 1px solid var(--line);
}
.list li:first-child > .list-row, .list > .list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .grow > * { display: block; }
.list-row .title { font-weight: 600; line-height: 1.3; }
.list-row .sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.list-row .chev { color: var(--muted); }

.avatar {
  width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); flex: none;
}
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; }
.avatar.tone-danger { background: var(--danger-soft); color: var(--danger); }
.avatar.tone-attention { background: var(--attention-soft); color: var(--attention); }
.avatar.tone-info { background: var(--info-soft); color: var(--info); }
.avatar.tone-success { background: var(--success-soft); color: var(--success); }

/* ---- Pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 650; line-height: 1;
  padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.plain::before { display: none; }
.pill.tone-danger { background: var(--danger-soft); color: var(--danger); }
.pill.tone-attention { background: var(--attention-soft); color: var(--attention); }
.pill.tone-info { background: var(--info-soft); color: var(--info); }
.pill.tone-success { background: var(--success-soft); color: var(--success); }
.pill.tone-muted { color: var(--muted); }
.pill.tone-muted::before { opacity: .5; }

/* ---- Buttons & forms ---- */
button, .button {
  font: inherit; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .08s ease, background .15s ease;
}
button:active, .button:active { transform: scale(.98); }
.button:hover { text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px rgb(31 111 92 / .22); }
button.primary:hover, .button.primary:hover { background: var(--accent-strong); }
button.soft, .button.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
button.danger, .button.danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
button.block, .button.block { width: 100%; }
button.small, .button.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; border-radius: 11px; }
button.link { border: none; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 600; box-shadow: none; }
button.link.danger { color: var(--danger); background: none; }

label, .label { font-weight: 600; font-size: .92rem; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink);
  width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field small, .helptext { color: var(--muted); font-weight: 400; font-size: .82rem; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.check .block { display: block; font-weight: 400; margin-top: 2px; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: .85rem; }
.error { color: var(--danger); }

/* Styled file picker: a real <input type=file> hidden behind a button-looking label */
.filepick { position: relative; display: inline-flex; }
.filepick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---- Flash messages ---- */
.toast {
  display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: var(--bg); padding: 12px 14px;
  border-radius: 14px; margin: 0 0 12px; font-weight: 500; box-shadow: var(--shadow);
}
.toast.error { background: var(--danger-soft); color: var(--danger); }

/* ---- Dashboard ---- */
.hero { margin: 4px 2px 18px; }
.hero h1 { font-size: 1.6rem; }
.hero .address { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 500; margin-top: 4px; }

.attention-card {
  display: flex; gap: 14px; align-items: center; padding: 16px; margin: 0 0 12px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; border-left: 4px solid var(--attention);
}
.attention-card:hover { text-decoration: none; background: var(--surface-2); }
.attention-card .title { font-weight: 700; }

.cta {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); margin: 0 0 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: var(--accent-ink); text-decoration: none;
  box-shadow: 0 10px 24px rgb(31 111 92 / .25);
}
.cta:hover { text-decoration: none; filter: brightness(1.04); }
.cta .avatar { background: rgb(255 255 255 / .18); color: var(--accent-ink); }
.cta .sub { opacity: .85; font-size: .88rem; }

/* Equipment */
.equip-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px; overflow-x: auto; padding: 2px 18px 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.equip-scroller::-webkit-scrollbar { display: none; }
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.equip-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface-2);
  color: var(--ink); text-decoration: none; scroll-snap-align: start; min-height: 168px; position: relative; overflow: hidden;
}
.equip-grid .equip-card { background: var(--surface); box-shadow: var(--shadow); }
.equip-card:hover { text-decoration: none; filter: brightness(.98); }
.equip-card .thumb { width: 100%; height: 76px; object-fit: cover; border-radius: 11px; }
.equip-card .name { font-weight: 700; line-height: 1.25; }
.equip-card .meta { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.equip-card .pill { align-self: flex-start; margin-top: auto; }
.equip-card.add { align-items: flex-start; justify-content: center; border: 1.5px dashed var(--line); background: transparent; box-shadow: none; }
.equip-card.add .avatar { background: var(--accent-soft); }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 16px;
  background: var(--surface-2); color: var(--ink); text-decoration: none; font-weight: 650; font-size: .92rem;
}
.tile:hover { text-decoration: none; filter: brightness(.97); }

/* Detail pages */
.detail-hero { display: flex; gap: 14px; align-items: center; margin: 4px 0 16px; }
.detail-hero h1 { font-size: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); color: var(--ink-2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0; }
.kv-row { display: contents; }
.facts .fact { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.facts .fact:first-child { border-top: 0; }
.facts .fact .k { color: var(--muted); font-size: .8rem; font-weight: 600; }
.facts .fact .v { font-weight: 600; }
.facts details summary { list-style: none; cursor: pointer; }
.facts details summary::-webkit-details-marker { display: none; }
.facts details[open] { background: var(--surface-2); }
.fact-edit { padding: 0 18px 14px; }

details > summary { cursor: pointer; }
.disclosure > summary { list-style: none; display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent); padding: 4px 0; }
.disclosure > summary::-webkit-details-marker { display: none; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid a { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }

/* Task progress */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 14px 0 6px; }
.progress span { height: 6px; border-radius: 999px; background: var(--line); }
.progress span.done { background: var(--accent); }
.progress-labels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; font-size: .68rem; color: var(--muted); font-weight: 600; }
.progress-labels .done { color: var(--accent); }

.price { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.quote-lines { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.quote-lines li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.quote-lines .icon { margin-top: 2px; color: var(--muted); }

.stars { display: flex; gap: 6px; flex-direction: row-reverse; justify-content: flex-end; }
.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.stars label { cursor: pointer; color: var(--line); font-size: 2rem; line-height: 1; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: #f5b301; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .avatar { width: 36px; height: 36px; border-radius: 11px; }

/* Brand pages (sign-in) */
.brand-hero { text-align: center; padding: 36px 8px 8px; }
.brand-hero img { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 12px 30px rgb(31 111 92 / .3); }
.brand-hero h1 { font-size: 2rem; margin-top: 18px; }
.brand-hero p { color: var(--muted); font-size: 1.05rem; margin: 6px 0 0; }
.benefits { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.benefits li { display: flex; gap: 10px; align-items: center; color: var(--ink-2); font-weight: 500; }
.benefits .icon { color: var(--accent); }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .avatar { margin: 0 auto 10px; }

/* Operator pages are desktop-ish tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.operator main { max-width: 900px; }

.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.one-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.equip-card { min-height: 0; }
.equip-card .name { display: -webkit-box; }
.equip-card .pill { margin-top: 4px; }
.field > label, .field > .label { display: block; }

/* Photo-first scanning */
.scan-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.scan-card .avatar { margin-bottom: 4px; }
.scan-card .filepick { width: 100%; }
.tips { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; text-align: left; font-size: .88rem; color: var(--ink-2); }
.tips li { display: flex; gap: 8px; align-items: center; }
.tips .icon { color: var(--accent); }
.busy-note { display: none; color: var(--muted); }
form.busy .busy-note { display: block; }
form.busy .filepick { opacity: .5; pointer-events: none; }
.scan-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; display: block; }
.spinner { width: 34px; height: 34px; margin: 18px auto 10px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

fieldset.same-kind { border: 1.5px solid var(--attention); border-radius: 14px; padding: 12px 14px; margin: 0; display: grid; gap: 8px; }
fieldset.same-kind legend { font-weight: 650; padding: 0 4px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; padding: 8px; border-radius: 10px; }
.choice:has(input:checked) { background: var(--accent-soft); }
.choice input { margin-top: 3px; }
[hidden] { display: none !important; }
/* Document type tiles: the whole tile is a file picker */
.type-tile { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); }
.type-tile input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.type-tile:active { transform: scale(.99); }
.type-tile.busy { opacity: .55; pointer-events: none; }

/* The house: every kind of equipment has a slot; added ones pop in */
.house-wrap { text-align: center; }
.house { width: 100%; max-width: 360px; margin: 0 auto; }
.house-roof {
  position: relative; height: 70px; margin: 0 -6px; background: var(--accent);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.house-roof::after { content: ""; position: absolute; inset: 9px 16px 0; background: var(--accent-soft); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.house-body {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 6px; padding: 16px 10px 14px;
  background: var(--accent-soft); border: 3px solid var(--accent); border-top: 0; border-radius: 0 0 16px 16px;
}
.slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slot-icon { width: 100%; max-width: 46px; aspect-ratio: 1; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.slot-label { font-size: .64rem; font-weight: 650; line-height: 1.1; color: var(--ink-2); max-width: 100%; hyphens: auto; overflow-wrap: anywhere; }
.slot.in .slot-icon { background: var(--surface); color: var(--accent); box-shadow: 0 3px 8px rgb(31 111 92 / .18);
  animation: pop-in .5s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(var(--i) * 55ms); }
.slot.out .slot-icon { border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); color: color-mix(in srgb, var(--accent) 40%, transparent); }
.slot.out .slot-label { color: var(--muted); opacity: .7; }
.slot-count { position: absolute; top: -6px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 700; line-height: 18px; }
.slot.just-added .slot-icon { animation: drop-in .9s cubic-bezier(.34, 1.4, .64, 1) both .25s; background: var(--accent); color: var(--accent-ink); }
.slot.just-added::after { content: ""; position: absolute; top: 0; left: 50%; width: 46px; height: 46px; margin-left: -23px;
  border-radius: 14px; border: 2px solid var(--accent); animation: ring 1.1s ease-out 1s both; pointer-events: none; }
.house-caption { margin: 12px 0 0; color: var(--muted); }
.house-caption strong { color: var(--ink); }
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes drop-in { 0% { transform: translateY(-150px) scale(.6) rotate(-12deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .slot.in .slot-icon, .slot.just-added .slot-icon, .slot.just-added::after { animation: none; } }

/* Selects: custom chevron instead of the browser's */
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7670' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
optgroup { font-weight: 700; color: var(--muted); }
input[type=date] { min-height: 48px; }
.history-block { display: grid; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line); }

.label-hint { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink-2);
  font-size: .88rem; text-align: left; width: 100%; }
.label-hint .icon { color: var(--accent); }
.what-we-see { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
a.slot { text-decoration: none; color: inherit; }
a.slot:hover { text-decoration: none; }
a.slot:active .slot-icon { transform: scale(.94); }
.slot-plus { position: absolute; top: -5px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface);
  color: var(--accent); font-weight: 800; font-size: .8rem; line-height: 17px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.equip-card { scroll-margin-top: 80px; }

.equip-row { scroll-margin-top: 80px; }
.equip-row .pill { flex: none; }
/* Compact category tiles: icon beside the name */
.tile { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; font-size: .9rem; line-height: 1.2; }
.tile .avatar { width: 36px; height: 36px; border-radius: 11px; }
.tile-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

/* "What if I skip it?" */
details.skip > summary { list-style: none; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
details.skip > summary::-webkit-details-marker { display: none; }
.qmark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); font-size: .72rem; font-weight: 800; color: var(--muted); }
details.skip[open] .qmark { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* iPhone Safari gives date inputs an intrinsic width that overflows their box: make them behave like other inputs */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; width: 100%;
  text-align: left; background: var(--surface); }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.row > input[type=date] { width: auto; flex: 1 1 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.stat { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 600; line-height: 1.2; }
.operator main { max-width: 720px; }

.safety { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  background: var(--attention-soft); color: var(--attention); font-size: .88rem; line-height: 1.4; }
.safety .icon { margin-top: 1px; }

/* ---- Pip mascot: the "i" in a hard hat catches falling tools and tosses them into the toolbox it carries ---- */
.pip-mascot { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto; color: var(--ink); overflow: visible; }
.pip-mascot.solo { max-width: 96px; }
.pip-mascot * { transform-box: view-box; }
.pip-letters { animation: pip-fade .6s ease-out both; }
/* every catch-and-toss cycle is 3.6s; the three tools take turns (10.8s loop) */
.pip-i { transform-origin: 140px 126px; animation: pip-body 3.6s ease-in-out 1s infinite; }
.pip-head { transform-origin: 140px 51px; animation: pip-drop .9s cubic-bezier(.34, 1.6, .64, 1) both, pip-head 3.6s ease-in-out 1s infinite; }
.pip-eyes { transform-origin: 140px 37px; animation: pip-blink 4.3s steps(1) 1.6s infinite; }
.pip-arm.right { transform-origin: 149px 82px; animation: pip-throw-arm 3.6s ease-in-out 1s infinite; }
.pip-arm.left { transform-origin: 131px 82px; animation: pip-carry 3.6s ease-in-out 1s infinite; }
.pip-toolbox-lid { transform-origin: 122px 109px; animation: pip-lid 3.6s ease-out 1s infinite; }
.pip-prop { opacity: 0; transform-origin: 172px 68px; animation: pip-toss 10.8s 1s infinite; }
.pip-prop.calendar { animation-delay: 4.6s; }
.pip-prop.clipboard { animation-delay: 8.2s; }

@keyframes pip-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pip-drop { 0% { transform: translateY(-70px); opacity: 0; } 55% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes pip-blink { 0%, 96% { transform: none; } 97% { transform: scaleY(.1); } }
/* one tool: falls, is caught, then tossed in an arc into the toolbox (first third of its 10.8s loop) */
@keyframes pip-toss {
  0% { opacity: 0; transform: translateY(-110px) rotate(-25deg); animation-timing-function: ease-in; }
  2% { opacity: 1; }
  7.3% { opacity: 1; transform: none; animation-timing-function: ease-out; }
  9% { transform: translateY(-4px); }
  10.5%, 13% { opacity: 1; transform: none; animation-timing-function: ease-out; }
  15.5% { opacity: 1; transform: translate(-30px, -72px) rotate(-150deg) scale(.9); }
  17.5% { opacity: 1; transform: translate(-62px, -22px) rotate(-260deg) scale(.7); animation-timing-function: ease-in; }
  19.5% { opacity: 1; transform: translate(-50px, 38px) rotate(-340deg) scale(.45); }
  20.5%, 100% { opacity: 0; transform: translate(-50px, 44px) scale(.3); }
}
/* right arm: reach up and catch, hold, wind up and throw over to the left, settle */
@keyframes pip-throw-arm {
  0% { transform: none; } 14% { transform: rotate(-62deg); } 22%, 36% { transform: rotate(-38deg); }
  40% { transform: rotate(-8deg); } 47% { transform: rotate(-125deg); } 58% { transform: rotate(-70deg); } 72%, 100% { transform: none; }
}
/* left arm carries the box: dips when the tool lands, sways with the hop */
@keyframes pip-carry {
  0%, 52% { transform: none; } 58% { transform: rotate(7deg); } 63% { transform: rotate(-3deg); }
  70% { transform: rotate(-6deg); } 78%, 100% { transform: none; }
}
/* squash on the catch, lean into the throw, happy hop after the tool lands */
@keyframes pip-body {
  0%, 18% { transform: none; } 23% { transform: scale(1.07, .92); } 30%, 40% { transform: none; }
  46% { transform: rotate(-4deg); } 54%, 62% { transform: none; }
  69% { transform: translateY(-10px) scale(.97, 1.04); } 77% { transform: scale(1.04, .95); } 82%, 100% { transform: none; }
}
@keyframes pip-head {
  0%, 12% { transform: none; } 17% { transform: rotate(8deg) translateY(-2px); } 23% { transform: translateY(3px); }
  30%, 42% { transform: none; } 50% { transform: rotate(-10deg); } 56%, 62% { transform: none; }
  69% { transform: translateY(-13px) rotate(-5deg); } 78%, 100% { transform: none; }
}
@keyframes pip-lid { 0%, 55% { transform: none; } 58% { transform: translateY(-4px) rotate(-10deg); } 64%, 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .pip-mascot *, .pip-mascot { animation: none !important; }
  .pip-prop.wrench { opacity: 1; }
}
.legal h1 { font-size: 1.6rem; margin-bottom: 4px; }
.legal h2 { margin: 22px 0 6px; font-size: 1.05rem; }
.legal p, .legal li { color: var(--ink-2); line-height: 1.6; }
.legal ul { padding-left: 20px; }
.welcome { display: flex; gap: 14px; align-items: center; border: 1.5px solid var(--accent-soft); }
.install-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.install-steps li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); }
.step-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }

/* Large text or narrow screens: the status pill drops under the title (right-aligned) instead of squeezing it */
.list-row:has(> .pill) { flex-wrap: wrap; row-gap: 6px; }
.list-row:has(> .pill) > .grow { flex: 1 1 0; min-width: 7em; }
.list-row > .pill { margin-left: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
