/* Site Passport pages. Phone-first; the site page goes two-column on a laptop. Tokens from theme.css. */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 17px; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 19px; margin-bottom: 10px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
p { margin: 0; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sp-danger { background: #c62828; border-color: #c62828; color: #fff; }

.sp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--panel); }
.sp-brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.sp-wrap { max-width: 680px; margin: 0 auto; padding: var(--gutter); padding-bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.sp-wrap > * { min-width: 0; }
.sp-wide { max-width: 1180px; }
.sp-loading { color: var(--muted); }
.sp-foot { text-align: center; padding: 6px 0 20px; }

/* header card */
.sp-head { display: grid; gap: 6px; }
.sp-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sp-head h1 { font-size: 28px; overflow-wrap: anywhere; }
.sp-up { font-size: 15px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; }
.sp-sub { font-size: 16px; }
.sp-code { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 14px; }

.sp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.sp-stat { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.sp-stat b { display: block; font-size: 24px; line-height: 1.1; }
.sp-stat span { font-size: 13px; color: var(--muted); }
.sp-stat.bad b { color: var(--bad); } .sp-stat.warn b { color: var(--warn); }

.sp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-big { min-height: 58px; font-size: 17px; padding: 0 10px; text-align: center; line-height: 1.15; }
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-row .btn { flex: 1 1 140px; }

/* status */
.sp-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; border: 1px solid currentColor; }
.sp-pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.sp-pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.sp-pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.sp-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-block; background: var(--ok); }
.sp-dot.warn { background: var(--warn); } .sp-dot.bad { background: var(--bad); }

/* equipment list */
.sp-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.sp-filters select, .sp-field input, .sp-field textarea, .sp-field select {
  font: inherit; font-weight: 400; font-size: 17px; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); }
.sp-eqlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.sp-eqlist li { border-bottom: 1px solid var(--line); }
.sp-eqlist li:last-child { border-bottom: 0; }
.sp-eqlist a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 2px; min-height: 60px; color: var(--ink); text-decoration: none; }
.sp-eqlist a:hover .sp-eq-tag { color: var(--accent); }
.sp-eqlist .sp-dot { grid-row: 1 / span 2; }
.sp-eq-tag { font-weight: 700; font-size: 18px; }
.sp-eq-meta { grid-column: 2; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.sp-eq-st { grid-row: 1 / span 2; grid-column: 3; font-size: 13px; font-weight: 700; text-align: right; color: var(--muted); max-width: 9em; }
.sp-eq-st.bad { color: var(--bad); } .sp-eq-st.warn { color: var(--warn); }
.sp-empty { color: var(--muted); padding: 8px 0; }

/* specs */
.sp-specs { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sp-specs > div { background: var(--panel); padding: 8px 10px; min-width: 0; }
.sp-specs > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sp-specs dt { font-size: 13px; color: var(--muted); }
.sp-specs dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sp-specs .sp-q { display: block; font-weight: 400; font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.sp-svc { font-size: 15px; }
.sp-svc b.bad { color: var(--bad); } .sp-svc b.warn { color: var(--warn); }

/* documents */
.sp-docs { margin: 0 0 6px; padding: 0; list-style: none; }
.sp-docs li { min-height: 48px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sp-docs li:last-child { border-bottom: 0; }
.sp-docs a { padding: 10px 0; font-weight: 600; }
.sp-chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.sp-locked { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; }

/* timeline */
.sp-tl-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sp-tl-filter button { min-height: 36px; border-radius: 999px; padding: 0 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.sp-tl-filter button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sp-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-ev { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; min-width: 0; }
.sp-ev.service { border-left-color: var(--ok); }
.sp-ev.problem { border-left-color: var(--bad); }
.sp-ev.visit, .sp-ev.meeting { border-left-color: var(--accent); }
.sp-ev.created { border-left-color: var(--muted); }
.sp-ev-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sp-ev-head time { margin-left: auto; font-size: 14px; color: var(--muted); }
.sp-ev-head a { font-weight: 700; }
.sp-ev-text { overflow-wrap: anywhere; white-space: pre-line; }
.sp-ev-by { font-size: 14px; }
.sp-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.sp-ev.problem .sp-badge { color: var(--bad); border-color: currentColor; }
.sp-ev.visit .sp-badge, .sp-ev.meeting .sp-badge { color: var(--accent); border-color: currentColor; }
.sp-fixed { font-size: 14px; font-weight: 600; color: var(--ok); }
.sp-open { font-size: 14px; font-weight: 600; color: var(--bad); }
.sp-new { animation: sp-flash 2.4s ease-out; }
@keyframes sp-flash { 0% { background: var(--hi); } 100% { background: transparent; } }

.sp-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.sp-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); display: block; }

/* sheets */
.sp-sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 92vh; border-radius: 16px 16px 0 0; background: var(--panel); color: var(--ink); }
.sp-sheet::backdrop { background: rgb(0 0 0 / .5); }
.sp-sheet form { padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sp-sheet h2 { margin: 0; font-size: 22px; }
.sp-field { display: grid; gap: 6px; font-weight: 600; min-width: 0; }
.sp-field small { font-weight: 400; color: var(--muted); }
.sp-choices { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-choices legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.sp-choices label { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.sp-choices label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sp-choices input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.sp-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-file input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sp-file img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.sp-sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.sp-sheet-actions .btn { min-height: 52px; font-size: 17px; }
.sp-err { color: var(--bad); font-weight: 600; }
.sp-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sp-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 24px rgb(0 0 0 / .25); z-index: 60; }

/* walk mode */
.sp-steps { display: grid; gap: 12px; }
.sp-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-kinds button { min-height: 52px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-align: left; padding: 6px 12px; cursor: pointer; line-height: 1.2; }
.sp-kinds button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chips button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.sp-np { display: grid; gap: 8px; }
.sp-np .sp-field input.low { border-color: var(--warn); background: var(--hi); }
.sp-np .sp-q { font-size: 12px; font-weight: 400; color: var(--muted); font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.sp-walked { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sp-walked li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.sp-walked li .meta { grid-column: 2 / -1; color: var(--muted); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.sp-walked li .btn { grid-column: 3; grid-row: 1; }
.sp-label-box { display: grid; gap: 10px; justify-items: center; }
.sp-label-box canvas { width: 100%; max-width: 420px; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .12); }
.sp-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sp-seg button { min-height: 40px; padding: 0 14px; border: 0; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.sp-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.sp-banner { padding: 12px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }

/* home */
.sp-go { display: grid; gap: 10px; }
.sp-go a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 16px; text-decoration: none; color: var(--ink); }
.sp-go a b { font-size: 18px; }
.sp-go a span { grid-column: 1; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.sp-go a i { grid-row: 1 / span 2; grid-column: 2; font-style: normal; font-size: 22px; color: var(--accent); }
.sp-go a:hover { border-color: var(--accent); }
.sp-loop { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.sp-type { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sp-type input { font: inherit; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); min-width: 0; text-transform: uppercase; }

/* labels page (screen) */
.sp-sheetgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sp-sheetgrid canvas { width: 100%; height: auto; border: 1px dashed var(--line); background: #fff; }
.sp-poster { background: #fff; color: #000; border-radius: 10px; padding: 24px; display: grid; justify-items: center; gap: 12px; text-align: center; }
.sp-poster svg { width: min(100%, 360px); height: auto; }
.sp-poster h2 { font-size: 28px; margin: 0; color: #000; }
.sp-poster p { color: #222; }
.sp-poster .sp-code { font-size: 22px; font-weight: 700; color: #000; }

/* laptop: site page two columns */
@media (min-width: 960px) {
  .sp-site { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .sp-site > .sp-col { display: grid; gap: 14px; min-width: 0; }
  .sp-site > .sp-full { grid-column: 1 / -1; }
}
@media (max-width: 359px) { .sp-actions, .sp-choices, .sp-specs, .sp-kinds, .sp-two, .sp-filters { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .sp-new { animation: none; } }

/* printing */
#label-print { display: none; }
@media print {
  body.printing-labels > *:not(#label-print) { display: none !important; }
  body.printing-labels #label-print { display: block; }
  body.printing-labels #label-print img { display: block; page-break-after: always; break-after: page; }
  .no-print, .sp-top, .sp-toast { display: none !important; }
  body { background: #fff; color: #000; }
  .print-sheet .sp-sheetgrid { grid-template-columns: repeat(3, 1fr); gap: 0.12in; }
  .print-sheet .sp-sheetgrid canvas { border: 0; break-inside: avoid; }
  .card { border: 0; padding: 0; }
}
