:root {
  --brand: #0f5b4f;
  --brand-ink: #ffffff;
  --bg: #f4f5f3;
  --card: #ffffff;
  --ink: #1b1d1c;
  --muted: #66706c;
  --line: #dde1de;
  --amber: #b26a00; --amber-bg: #fff3dc;
  --red: #b3261e; --red-bg: #fde7e5;
  --green: #1d6b3a; --green-bg: #e2f4e8;
  --blue: #1f5fa8; --blue-bg: #e3eefb;
  --grey-bg: #eceeed;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121514; --card: #1c201f; --ink: #eef1ef; --muted: #9aa5a0; --line: #2f3533;
    --amber-bg: #3a2a0c; --amber: #ffc46b; --red-bg: #3d1614; --red: #ff9b92;
    --green-bg: #12301d; --green: #7fd69b; --blue-bg: #13263d; --blue: #8dbdf5; --grey-bg: #2a2f2d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
@media (prefers-color-scheme: dark) { a { color: #6fd0bd; } }
h1 { font-size: 1.4rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
.card h2 { margin-top: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

header.top { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; max-width: 980px; margin: 0 auto; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; flex: 1; }
.back { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 6px 4px 0; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin: 0; }
.who .link { color: #fff; opacity: .85; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px 8px; max-width: 980px; margin: 0 auto; scrollbar-width: none; }
nav.tabs a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.12); white-space: nowrap; font-size: .9rem; }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px 96px; }
.narrow { max-width: 420px; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.two, .three { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } .three { grid-template-columns: 1fr 1fr 1fr; } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; min-height: 46px; }
textarea { resize: vertical; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: 26px; height: 26px; min-height: 0; accent-color: var(--brand); flex: none; }
input[type=file] { padding: 8px; }

button, .primary, .secondary { font: inherit; cursor: pointer; border-radius: 10px; padding: 11px 18px; border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; }
.primary { background: var(--brand); color: #fff !important; font-weight: 600; }
.secondary { background: var(--card); color: var(--ink) !important; border-color: var(--line); }
.big { font-size: 1.08rem; padding: 14px 20px; min-height: 54px; }
.block { display: flex; width: 100%; margin-bottom: 14px; }
button.link { background: none; border: 0; padding: 4px; min-height: 0; color: var(--brand); text-decoration: underline; }
.danger { color: var(--red) !important; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions .big { flex: 1; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); z-index: 5; }
.filebtn { position: relative; overflow: hidden; flex-direction: row; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
.note { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; background: var(--blue-bg); }
.warn-h { color: var(--red); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.grey { background: var(--grey-bg); color: var(--muted); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.green { background: var(--green-bg); color: var(--green); }
.count { background: var(--amber-bg); color: var(--amber); border-radius: 999px; padding: 0 10px; font-size: 1rem; }

.list { display: flex; flex-direction: column; gap: 8px; }
.job { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.job-main { display: flex; flex-direction: column; min-width: 0; }
.job-main span { font-size: .9rem; }
.job-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .82rem; text-align: right; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.job-head p { margin: 0; }

.checks { display: flex; flex-direction: column; gap: 2px; }
.check { flex-direction: row; align-items: center; gap: 12px; padding: 10px 0; font-weight: 400; font-size: 1rem; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.taskrow { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; }
.taskrow label { flex-direction: row; align-items: center; gap: 4px; }
.taskrow label input { width: 18px; height: 18px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 12px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--grey-bg); }
.photos form { margin: 0; text-align: center; }

.charges { display: flex; flex-direction: column; gap: 6px; }
.charge { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.total { font-size: 1.15rem; margin: 6px 0 0; }
.files { padding-left: 18px; margin: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters > input { flex: 1 1 220px; width: auto; }
.filters > select { width: auto; }

.week { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, 1fr); } }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 80px; }
.day.today { border-color: var(--brand); border-width: 2px; }
.day h3 { margin: 0; font-size: .9rem; }
.mini { display: block; padding: 8px; border-radius: 8px; background: var(--bg); margin-top: 6px; text-decoration: none; color: var(--ink); font-size: .85rem; }
.inactive { opacity: .55; }
.logo-preview { max-width: 180px; max-height: 80px; object-fit: contain; }
.danger-zone { margin-top: 24px; text-align: center; }
.tpl { border-top: 1px solid var(--line); padding-top: 12px; }
[hidden] { display: none !important; }
.files label, .taskrow label { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; font-weight: 400; }
.files label input { width: 18px; height: 18px; }
.jobcheck { display: grid; grid-template-columns: 26px 1fr auto; } .jobcheck .amt { white-space: nowrap; }
.propertyrow { align-items: center; }

.sigpad canvas { width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--muted); border-radius: 10px; touch-action: none; display: block; }
.sig-img { max-width: 320px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.flash.warn { background: var(--amber-bg); color: var(--amber); }
.flash.warn ul { margin: 6px 0 0; padding-left: 18px; }

.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tbl .num { text-align: right; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.filters label { flex: 0 1 auto; font-size: .8rem; }
.filters label input, .filters label select { width: auto; }
.filters button { align-self: flex-end; }
.filters { align-items: flex-end; }
.filters label input, .filters label select { height: 46px; }
.tbl td:nth-child(2) a, .tbl td:first-child { white-space: nowrap; }
.pushbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pushbar span { flex: 1 1 220px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.backup-card { margin-top: 24px; } .backup-card.due { border-color: #e0a100; } .backup-card h2 { margin: 0 0 4px; }
