:root {
  --bg: #f3f4f6; --card: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #f59e0b; --accent-ink: #111827; --blue: #2563eb; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
  --chip: #f3f4f6; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --card: #151b26; --text: #f3f4f6; --muted: #9ca3af; --line: #263041;
  --chip: #1f2735; --shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --card: #151b26; --text: #f3f4f6; --muted: #9ca3af; --line: #263041;
    --chip: #1f2735; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: #111827; color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.topbar-right { display: flex; gap: 6px; align-items: center; }
.icon-btn { background: transparent; border: 0; color: #fff; font-size: 20px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; text-decoration: none; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.net { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--warn); color: #111; font-weight: 600; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px); }
h1 { font-size: 22px; margin: 4px 0 2px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 10px; }
.btn { border: 1px solid var(--line); background: var(--card); padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.fab { position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 15; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
label.f { display: block; margin: 10px 0; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=number], input[type=tel], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-height: 44px;
}
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 10px 0; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 999px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.st-survey { background: #dbeafe; color: #1e40af; } .st-survey_review { background: #fef3c7; color: #92400e; }
.st-approved { background: #dcfce7; color: #166534; } .st-scheduled { background: #e0e7ff; color: #3730a3; }
.st-install { background: #ffedd5; color: #9a3412; } .st-inspection { background: #fae8ff; color: #86198f; }
.st-complete { background: #d1fae5; color: #065f46; } .st-on_hold { background: #e5e7eb; color: #374151; }
.plist a.card { display: block; text-decoration: none; color: inherit; }
.plist .title { font-weight: 700; }
.bar { height: 8px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.done > i { background: var(--ok); }
.tabs { display: flex; gap: 4px; background: var(--chip); padding: 4px; border-radius: 12px; margin: 12px 0; position: sticky; top: 56px; z-index: 10; }
.tab { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font-weight: 600; font-size: 14px; }
.tab.on { background: var(--card); box-shadow: var(--shadow); }
details.sec { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; }
details.sec > summary { list-style: none; padding: 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
details.sec > summary::-webkit-details-marker { display: none; }
.sec-body { padding: 0 14px 10px; }
.item { border-top: 1px solid var(--line); padding: 12px 0; }
.item.missing .ilabel::before { content: "●"; color: var(--warn); margin-right: 6px; font-size: 11px; vertical-align: middle; }
.item.done .ilabel::before { content: "✓"; color: var(--ok); margin-right: 6px; font-weight: 800; }
.item.issue { background: color-mix(in srgb, var(--bad) 8%, transparent); margin: 0 -14px; padding: 12px 14px; }
.ilabel { font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumb { width: 74px; height: 74px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; background: var(--chip); position: relative; display: grid; place-items: center; font-size: 26px; text-decoration: none; }
.thumb.pending { outline: 2px dashed var(--warn); outline-offset: -2px; }
.addph { width: 74px; height: 74px; border-radius: 10px; border: 2px dashed var(--line); background: transparent; cursor: pointer; font-size: 24px; color: var(--muted); }
.count { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 8px 12px; cursor: pointer; font-weight: 600; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on-ok { background: var(--ok); color: #fff; } .seg button.on-issue { background: var(--bad); color: #fff; } .seg button.on-na { background: var(--muted); color: #fff; }
.lock { text-align: center; padding: 26px 16px; }
.lock .big { font-size: 40px; }
.sumrow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.sumrow b { font-weight: 600; } .sumrow span { text-align: right; }
.actions { display: grid; gap: 8px; margin: 12px 0; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 40; display: flex; flex-direction: column; }
.modal-bar { display: flex; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; align-items: center; justify-content: space-between; color: #fff; flex-wrap: wrap; }
.modal-body { flex: 1; display: grid; place-items: center; overflow: auto; padding: 8px; touch-action: none; }
.modal-body img, .modal-body canvas { max-width: 100%; max-height: calc(100vh - 150px); border-radius: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
.activity li { margin: 6px 0; font-size: 14px; }
.center { max-width: 380px; margin: 40px auto; }
.warnbox { border-left: 4px solid var(--warn); padding: 8px 12px; background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: 8px; margin: 8px 0; font-size: 14px; }
.okbox { border-left: 4px solid var(--ok); padding: 8px 12px; background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 8px; margin: 8px 0; font-size: 14px; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }

/* tarefas */
.tp-open { background: #dbeafe; color: #1e40af; } .tp-reopened { background: #fee2e2; color: #991b1b; }
.tp-done { background: #fef3c7; color: #92400e; } .tp-approved { background: #dcfce7; color: #166534; }
.task-card.st-t-reopened { border-left: 4px solid var(--bad); }
.step { position: relative; padding-left: 52px; }
.step h2 { margin-top: 2px; }
.stepn { position: absolute; left: 14px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #111; font-weight: 800; display: grid; place-items: center; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
.media { margin: 0; }
.media video, .media img { width: 100%; max-height: 420px; border-radius: 10px; background: #000; display: block; object-fit: contain; }
.media figcaption { margin-top: 4px; }
.done-btn { background: var(--ok); border-color: var(--ok); color: #fff; font-size: 20px; min-height: 60px; margin-top: 8px; letter-spacing: .05em; }
.linkbtn { background: none; border: 0; color: var(--bad); cursor: pointer; font-size: 12px; padding: 0 4px; }
@media (max-width: 520px) { .step { padding-left: 14px; padding-top: 48px; } }
