/* Cleaning Panda Team portal. Built for one hand on a phone, on site, sometimes with gloves:
   big targets, one primary action per screen, the shift's progress always visible. */
@font-face { font-family: "Fredoka"; font-weight: 500 700; font-display: swap; src: url(fonts/fredoka.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 400 700; font-display: swap; src: url(fonts/figtree.woff2) format("woff2"); }

:root {
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-2: #F7F9FC; --ink: #0F1217; --muted: #556072; --line: #DDE4EE;
  --blue: #1769D3; --blue-ink: #0D4FA6; --blue-soft: #E4EEFC; --on-blue: #FFFFFF;
  --panda: #0C0E12; --on-panda: #EEF2F7; --on-panda-muted: #8E99A8;
  --ok: #17804A; --ok-soft: #E2F4EA; --warn: #A15C00; --warn-soft: #FFF1DC; --bad: #B42318; --bad-soft: #FDE7E5;
  --font-display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 16px; --shadow: 0 1px 2px rgb(15 18 23 / 0.05), 0 10px 28px -14px rgb(15 18 23 / 0.2);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1117; --surface: #161C25; --surface-2: #1B222D; --ink: #E9EEF5; --muted: #9AA6B6; --line: #283241;
    --blue: #4D95F2; --blue-ink: #8FBCFA; --blue-soft: #172942; --on-blue: #05122A;
    --panda: #07090C;
    --ok: #4CC38A; --ok-soft: #12291F; --warn: #F0B355; --warn-soft: #2C2213; --bad: #F97066; --bad-soft: #2D1716;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px -14px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; accent-color: var(--blue); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--blue-ink); text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons: 48px minimum, press feedback on every one */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; text-decoration: none; color: var(--ink); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--blue); color: var(--on-blue); border-color: transparent; }
.btn.go { background: var(--ok); color: #fff; border-color: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 1.08rem; border-radius: 14px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
@media (hover: hover) { .btn:not([disabled]):hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); } .btn.primary:not([disabled]):hover { background: var(--blue-ink); } }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--blue-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; min-height: 44px; }

/* Forms (16px+ text so iOS doesn't zoom) */
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.95rem; }
input[type=email], input[type=password], input[type=text], input[inputmode] { width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: 400 1rem var(--font-body); }
input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input[aria-invalid=true] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 0.9rem; min-height: 1.2em; }
.code-input { font-size: 1.5rem !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }

/* Sign-in */
.auth { min-height: 100dvh; display: grid; align-content: center; justify-items: center; padding: 28px 16px calc(28px + var(--safe-b)); background: var(--panda); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 22px; padding: 26px 22px 22px; display: grid; gap: 16px; box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6); position: relative; }
.auth-card .peek { position: absolute; top: -78px; right: 18px; width: 104px; pointer-events: none; }
.auth-card .logo { height: 30px; width: auto; }
.auth-card form { display: grid; gap: 14px; }
.auth-foot { color: var(--on-panda-muted); font-size: 0.85rem; margin-top: 18px; text-align: center; max-width: 360px; }
.auth-foot a { color: var(--on-panda); }

/* App shell */
.top { position: sticky; top: 0; z-index: 10; background: var(--panda); color: var(--on-panda); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; }
.top .back { color: var(--on-panda); border-color: rgb(255 255 255 / 0.18); background: transparent; min-height: 44px; padding: 0 12px; }
.top .title { font: 600 1.05rem/1.2 var(--font-display); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .me { font-size: 0.85rem; color: var(--on-panda-muted); }
.top .out { color: var(--on-panda); border-color: rgb(255 255 255 / 0.18); background: transparent; }
main { padding: 16px 16px calc(32px + var(--safe-b)); max-width: 640px; margin: 0 auto; display: grid; gap: 18px; }
main:focus { outline: none; }

.hello { background: var(--panda); color: var(--on-panda); margin: -16px -16px 0; padding: 4px 16px 22px; display: grid; gap: 6px; }
.hello h1 { font-size: 1.9rem; }
.hello p { color: var(--on-panda-muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stats div { background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.08); border-radius: 12px; padding: 10px 12px; }
.stats b { display: block; font: 600 1.5rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stats span { font-size: 0.8rem; color: var(--on-panda-muted); }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.list { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }

/* Job card */
.job { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform 140ms var(--ease-out); }
.job:active { transform: scale(0.985); }
.job .when { display: grid; gap: 2px; text-align: center; padding-right: 12px; border-right: 2px dashed var(--line); }
.job .when b { font: 600 1.15rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.job .when span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.job .who { display: grid; gap: 2px; min-width: 0; }
.job .who b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .who span { font-size: 0.875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .chev { color: var(--muted); }
.job.now { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft), var(--shadow); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; justify-self: start; }
.pill.blue { background: var(--blue-soft); color: var(--blue-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.empty { background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--r); padding: 22px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.empty img { width: 84px; height: auto; }

/* Job detail */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; }
.kv { display: grid; gap: 10px; }
.kv .row { display: flex; gap: 12px; align-items: flex-start; }
.kv .row .icon { margin-top: 2px; color: var(--muted); }
.kv .row b { display: block; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.notes { background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; }

/* Progress rail: before photos → check in → clean → after photos → check out */
.rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rail li { display: grid; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-align: center; }
.rail li::before { content: ""; height: 6px; border-radius: 3px; background: var(--line); transition: background-color 300ms var(--ease-out); }
.rail li.done { color: var(--ok); }
.rail li.done::before { background: var(--ok); }
.rail li.cur { color: var(--blue-ink); }
.rail li.cur::before { background: var(--blue); }

.step { display: grid; gap: 12px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .rm { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 0.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photo .rm .icon { width: 16px; height: 16px; }
.photo.uploading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.35), transparent); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
.photo .bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 5px; border-radius: 3px; background: rgb(0 0 0 / 0.35); overflow: hidden; }
.photo .bar i { display: block; height: 100%; background: #fff; width: 0; transition: width 200ms linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.add-photo { aspect-ratio: 1; border: 2px dashed color-mix(in srgb, var(--blue) 45%, var(--line)); border-radius: 12px; background: var(--blue-soft); color: var(--blue-ink); display: grid; place-items: center; align-content: center; gap: 4px; font-weight: 700; font-size: 0.85rem; cursor: pointer; position: relative; }
.add-photo:active { transform: scale(0.97); }
.add-photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.add-photo:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.stamp { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; font-weight: 650; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist label { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.checklist input { width: 22px; height: 22px; flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }

.done-card { text-align: center; justify-items: center; }
.done-card img { width: 120px; height: auto; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in 220ms var(--ease-out); }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
