:root {
  --bg: #f4f5f7; --panel: #fff; --text: #15171c; --muted: #6b7280; --line: #e3e5e9;
  --accent: #16a34a; --accent-ink: #fff; --accent-soft: #e7f6ec;
  --blue: #1f6feb; --red: #c62828; --amber: #a15c00; --amber-bg: #fff6e5;
  --radius: 14px; --nav-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #181b21; --text: #e8eaed; --muted: #9aa0a6; --line: #2a2f37;
    --accent: #22c55e; --accent-ink: #06210f; --accent-soft: #14301e;
    --blue: #5b9bff; --red: #ff6b6b; --amber: #f0b45c; --amber-bg: #2a2112;
  }
}
* { box-sizing: border-box; touch-action: manipulation; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
body.noscroll { overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 2px 8px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.loading, .empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* layout */
.page { max-width: 640px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 14px calc(var(--nav-h) + var(--safe-b) + 24px); }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 40px; }
.top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav a { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.nav a.on { color: var(--accent); }
.nav .i { width: 23px; height: 23px; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 16px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; text-align: center; }
.btn:disabled { opacity: .55; }
.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.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 14px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.linkbtn { border: 0; background: none; color: var(--blue); font: inherit; font-size: 14px; padding: 4px 0; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag.green { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.amber { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.tag.red { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* login */
.login { max-width: 400px; margin: 0 auto; padding: calc(60px + var(--safe-t)) 20px 40px; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 0 18px; }
.login h1 { margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login .err { color: var(--red); font-size: 14px; margin: -4px 0 12px; }

/* job list */
.job { display: block; color: var(--text); }
.job-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.job-when { font-weight: 750; font-size: 15px; }
.job-name { font-size: 18px; font-weight: 750; margin: 2px 0 2px; }
.job-sub { color: var(--muted); font-size: 14px; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.job.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* job detail */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv span { color: var(--muted); }
.collect { text-align: center; padding: 16px 14px; border: 2px solid var(--accent); background: var(--accent-soft); }
.collect .lbl { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.collect .amt { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0; }
.collect.paid { border-color: var(--line); background: var(--panel); }
.collect.paid .lbl { color: var(--muted); }
.addr { display: flex; align-items: center; gap: 12px; }
.addr > div { flex: 1; min-width: 0; }
.addr b { display: block; font-size: 17px; }
.round { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 0; flex: none; }
.round.blue { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.clock-state { font-size: 15px; margin-bottom: 10px; }
.clock-state b { color: var(--accent); }
.shifts { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.notes { white-space: pre-wrap; font-size: 15px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.actions .btn { min-height: 54px; flex-direction: column; gap: 2px; font-size: 14px; }
.actions .btn .i { width: 22px; height: 22px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.row:first-child { border-top: 0; padding-top: 0; }
.row > span:first-child { min-width: 0; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 0; padding: 0; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph i { position: absolute; left: 4px; bottom: 4px; font-style: normal; font-size: 10.5px; font-weight: 700; background: rgba(0,0,0,.55); color: #fff; padding: 1px 6px; border-radius: 6px; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer button { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; }

/* days off */
.week { margin-bottom: 14px; }
.week-h { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 2px 6px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 7px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; cursor: pointer; }
.day span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day b { font-size: 17px; }
.day.off { background: var(--red); border-color: var(--red); color: #fff; }
.day.off span { color: #ffe3e3; }
.day.job { box-shadow: inset 0 -3px 0 var(--accent); }
.day:disabled { opacity: .35; }

/* training */
.video { display: flex; align-items: center; gap: 12px; color: var(--text); }
.video .round { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

/* sheet + toast */
#sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + var(--safe-b)); max-height: 88vh; overflow-y: auto; }
@media (min-width: 700px) { .sheet-panel { left: 50%; right: auto; bottom: 50%; transform: translate(-50%, 50%); width: 460px; border-radius: 18px; } }
.sheet-panel h2 { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 4px; }
.sheet-panel > p { margin: 0 0 14px; color: var(--muted); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 70; background: #111; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
