/* Swept Cleaner Portal — mobile-first styles */
:root {
  --ink: #12262f;
  --muted: #566a74;
  --line: #e1e9ed;
  --bg: #f3f7f8;
  --card: #ffffff;
  --brand: #0a7a72;
  --brand-dark: #07605a;
  --brand-tint: #e4f4f2;
  --blue: #1d5fa8;   --blue-tint: #e6f0fb;
  --amber: #8a5a00;  --amber-tint: #fff3d6;
  --violet: #5b3fa6; --violet-tint: #eee9fb;
  --green: #1c6b3a;  --green-tint: #e3f5ea;
  --red: #b3261e;    --red-tint: #fde9e7;
  --gray: #4a5961;   --gray-tint: #eceff1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 38, 47, .06), 0 4px 14px rgba(18, 38, 47, .05);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
a { color: var(--brand-dark); }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #5fb3ab; outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand small { font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin-left: 2px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0a7a72); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.who { font-size: .85rem; opacity: .85; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.nav a {
  flex: 1; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; position: relative;
}
.nav a[aria-current="page"] { color: var(--brand-dark); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.nav .badge-dot {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 700;
}
main#view { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 980px; margin: 0 auto; outline: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); flex-direction: column; justify-content: flex-start;
         border-top: 0; border-right: 1px solid var(--line); padding: 14px 10px; gap: 4px; grid-row: 2; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; min-height: 46px; padding: 0 14px; gap: 12px; font-size: .95rem; border-radius: 10px; }
  .nav a[aria-current="page"] { background: var(--brand-tint); }
  .nav a[aria-current="page"]::before { display: none; }
  .nav .badge-dot { position: static; margin-left: auto; }
  main#view { padding: 28px 32px 48px; width: 100%; }
  .who { max-width: none; }
}

/* ---------- Page pieces ---------- */
.page-head { margin-bottom: 16px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .card + .section, .section + .card, .section + .section { margin-top: 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { font-size: 1.05rem; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .grid.three { grid-template-columns: repeat(3, 1fr); } .grid.four { grid-template-columns: repeat(4, 1fr); } }
.grid.four { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .grid.four { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .k { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat .v { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.stat.hero { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.hero .k, .stat.hero .s { color: #b9ccd3; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: .92rem; border: 1px solid; }
.notice-info { background: var(--blue-tint); border-color: #bcd5f2; color: #17426f; }
.notice-warn { background: var(--amber-tint); border-color: #f1d791; color: #5e3d00; }
.notice-error { background: var(--red-tint); border-color: #f4c2bd; color: #7d1a14; }
.notice-ok { background: var(--green-tint); border-color: #b9e0c7; color: #155029; }
.notice strong { display: block; margin-bottom: 2px; }

.banner { display: flex; align-items: center; gap: 12px; background: var(--violet-tint); border: 1px solid #d3c8f3; border-radius: var(--radius); padding: 14px; color: #3d2a7a; text-decoration: none; }
.banner .timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-open { background: var(--blue-tint); color: var(--blue); }
.b-assigned { background: var(--amber-tint); color: var(--amber); }
.b-accepted { background: var(--brand-tint); color: var(--brand-dark); }
.b-in_progress { background: var(--violet-tint); color: var(--violet); }
.b-completed, .b-paid { background: var(--green-tint); color: var(--green); }
.b-approved { background: var(--blue-tint); color: var(--blue); }
.b-pending { background: var(--amber-tint); color: var(--amber); }
.b-cancelled, .b-rejected, .b-draft { background: var(--gray-tint); color: var(--gray); }
.chip { display: inline-block; font-size: .74rem; font-weight: 600; color: var(--muted); background: var(--gray-tint); padding: 2px 8px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  font: inherit; font-weight: 700; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; line-height: 1;
  transition: background .15s, transform .05s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #c9d6dc; }
.btn-ghost:hover { background: #f1f6f8; }
.btn-danger { background: #fff; color: var(--red); border-color: #e6b4af; }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(120, 140, 150, .5); border-top-color: var(--ink); animation: spin .7s linear infinite; }
.btn-primary.is-busy::after { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.link { background: none; border: 0; padding: 6px 0; color: var(--brand-dark); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions > .btn { flex: 1 1 140px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; background: #e6edf0; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tabs .count { background: var(--red); color: #fff; border-radius: 9px; min-width: 18px; padding: 0 5px; font-size: .7rem; line-height: 18px; }

/* ---------- Job cards ---------- */
.jobs { display: grid; gap: 12px; }
@media (min-width: 760px) { .jobs { grid-template-columns: 1fr 1fr; } }
.job { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.job-main { display: block; padding: 14px 16px; color: inherit; text-decoration: none; }
.job-main:hover { background: #fafcfc; }
.job h3 { margin: 8px 0 2px; font-size: 1.08rem; }
.meta { display: grid; gap: 5px; margin-top: 8px; color: var(--muted); font-size: .92rem; }
.meta div { display: flex; gap: 8px; align-items: flex-start; }
.meta .ic { width: 17px; height: 17px; margin-top: 3px; }
.meta strong { color: var(--ink); }
.job-foot { padding: 12px 16px 14px; border-top: 1px solid var(--line); background: #fafcfc; margin-top: auto; }
.when { font-weight: 800; font-size: 1.05rem; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .ic { width: 38px; height: 38px; color: #a9bac2; margin-bottom: 6px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------- Job detail ---------- */
.kv { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .kv.two { grid-template-columns: 1fr 1fr; } }
.kv dt { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-size: 1.02rem; overflow-wrap: anywhere; }
.access { background: var(--amber-tint); border: 1px solid #f1d791; border-radius: 12px; padding: 12px 14px; }
.access dt { color: #6b4700; }
.photo-block + .photo-block { margin-top: 18px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(5, 1fr); } }
.photos figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--gray-tint); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .del { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(18,38,47,.8); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photos .del .ic { width: 16px; height: 16px; }
.photo-empty { color: var(--muted); font-size: .9rem; padding: 6px 0; }
.upload-btn:focus-within { outline: 3px solid #5fb3ab; outline-offset: 2px; }

/* ---------- Lists / tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.pay { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.pay + .pay { margin-top: 10px; }
.pay summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.pay summary::-webkit-details-marker { display: none; }
.pay summary .chev { transition: transform .15s; color: var(--muted); }
.pay[open] summary .chev { transform: rotate(90deg); }
.pay .amount { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pay-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; margin-top: 10px; }
table.t td, table.t th { padding: 7px 0; text-align: left; border-bottom: 1px solid var(--line); }
table.t td:last-child, table.t th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.total td { font-weight: 800; border-bottom: 0; }
table.t tr.sub td { color: var(--muted); }

/* ---------- Forms ---------- */
.field label, .label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 5px; }
.field input, .field select, .field textarea, .time-in {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid #c3d1d8; border-radius: 11px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .time-in:focus { border-color: var(--brand); outline: 3px solid #bfe3df; outline-offset: 0; }
.field input[readonly] { background: #f1f5f7; color: var(--muted); }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.fields { display: grid; gap: 14px; }
@media (min-width: 640px) { .fields.two { grid-template-columns: 1fr 1fr; } .fields .full { grid-column: 1 / -1; } }
.avail-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.avail-row:first-child { border-top: 0; }
.avail-times { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.avail-times[hidden] { display: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 48px; height: 28px; border-radius: 14px; background: #b8c7ce; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid #5fb3ab; outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check .ic { width: 20px; height: 20px; }
.check.ok { color: var(--green); } .check.todo { color: var(--amber); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #0f2a35 0%, #12262f 55%, #0a4a46 120%); }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; padding: 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-card .brand { color: var(--ink); margin-bottom: 14px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card form { margin-top: 18px; }
.auth-card .notice { margin-top: 14px; }

/* ---------- Dialog & toast ---------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 440px); box-shadow: 0 24px 60px rgba(0,0,0,.4); color: var(--ink); }
dialog.modal::backdrop { background: rgba(10, 25, 32, .55); }
.modal-body { padding: 22px; }
.modal-body h2 { margin-bottom: 8px; }
.modal-content { margin: 8px 0 16px; color: var(--muted); }
.modal-content .field { margin-top: 12px; color: var(--ink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { flex: 1; }
#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60; display: grid; gap: 8px; pointer-events: none; justify-items: center; }
.toast { pointer-events: auto; max-width: 460px; width: 100%; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: .94rem; box-shadow: 0 8px 24px rgba(0,0,0,.3); animation: pop .2s ease-out; }
.toast.error { background: #8f1f18; } .toast.ok { background: #0b5f58; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@media (min-width: 900px) { #toasts { bottom: 20px; left: 252px; justify-items: start; } }

/* ---------- Loading ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.skel { background: linear-gradient(90deg, #e8eef1 25%, #f4f8f9 37%, #e8eef1 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
.skel.h1 { height: 28px; width: 50%; margin-bottom: 16px; } .skel.card { height: 120px; margin-bottom: 12px; border: 0; box-shadow: none; }
@keyframes shimmer { to { background-position: -400% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }

.sprite { position: absolute; width: 0; height: 0; }
.pad { padding: 24px; }
.is-hidden { visibility: hidden; }

a.notice { display: block; text-decoration: none; }
a.notice strong { display: block; }
.topbar .btn-ghost { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; min-width: 44px; min-height: 44px; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.22); }
.week-nav { margin-bottom: 14px; }
