body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

/* Header */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: calc(var(--s3) + env(safe-area-inset-top, 0px)) var(--s4) var(--s3);
  background: rgba(246, 245, 241, .86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(21, 32, 27, .06);
}
.who { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #fff; font-weight: 650; font-size: 15px; position: relative;
}
.avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink-3); border: 2px solid var(--bg); transition: background var(--mid) var(--ease);
}
body.is-online .avatar::after { background: #2e9a5e; }
.hello { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: block; font-size: 13px; color: var(--ink-2); transition: color var(--mid) var(--ease); }
body.is-online .status { color: var(--ok); }

main { padding: var(--s4); max-width: 560px; margin: 0 auto; }
main:focus { outline: none; }
main button, main .btn { min-height: 50px; border-radius: 12px; }
.big { width: 100%; font-size: 16px; }
.section-title { font-size: 13px; font-weight: 580; color: var(--ink-3); margin: var(--s5) 0 var(--s3); }
main > .section-title:first-child { margin-top: var(--s1); }

/* Online switch */
.switch { position: relative; display: inline-block; width: 58px; height: 34px; margin: 0; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.track { position: absolute; inset: 0; border-radius: 999px; background: #d9d7d0; transition: background var(--mid) var(--ease); }
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(21, 32, 27, .2); transition: transform 380ms var(--spring), width var(--fast) var(--ease);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(24px); }
.switch input:active + .track::after { width: 32px; }
.switch input:checked:active + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Bottom tab bar */
.tabsbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabsbar a, .tabsbar button {
  flex: 1; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink-3); font-weight: 560; font-size: 12px; text-decoration: none;
  transition: color var(--fast) var(--ease);
}
.tabsbar a:hover, .tabsbar button:hover:not(:disabled) { background: none; color: var(--ink); }
.tabsbar a[aria-current="page"] { color: var(--accent); }
.tabsbar a[aria-current="page"] .ic { animation: pop 320ms var(--spring); }

/* Job cards */
.job { margin-bottom: var(--s3); padding: var(--s4); }
.job-top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.svc-chip { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.job-top .kind { font-size: 13px; color: var(--ink-2); font-weight: 540; }
.job-top h2 { margin: 0; font-size: 18px; }
.fare-big { margin-left: auto; text-align: right; }
.fare-big .money { font-size: 22px; display: block; line-height: 1.1; }
.fare-big small { font-size: 12px; }
.route { list-style: none; margin: 0 0 var(--s3); padding: 0; }
.route li { display: flex; gap: var(--s2); align-items: flex-start; padding: 6px 0; font-size: 14px; }
.route li .ic { color: var(--ink-3); width: 16px; height: 16px; margin-top: 2px; }
.route b { font-weight: 560; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s3); font-size: 14px; color: var(--ink-2); }
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s2); }

/* Stop timeline */
.steps { margin-top: var(--s4); }
.step { border-left: 2px solid var(--line); padding: 0 0 var(--s5) var(--s6); margin-left: 13px; position: relative; }
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step.done { border-left-color: var(--accent); }
.step h3 { margin-bottom: var(--s1); font-size: 16px; }
.step h3::before {
  content: attr(data-n); position: absolute; left: -15px; top: -2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-2); font-size: 12px; font-weight: 650; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.step.current h3::before { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.done h3::before { background: var(--accent); border-color: var(--accent); color: #fff; content: "✓"; font-size: 14px; }
.enter .step.done h3::before { animation: pop 420ms var(--spring) both; }
.step > p { font-size: 14px; }
.step .btn.big, .step button.big { margin-bottom: var(--s2); }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s3) 0; border: 0; padding: 0; min-width: 0; }
.choice label {
  display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 50px; margin: 0; position: relative;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 15px; font-weight: 560; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.choice label:active { transform: scale(.97); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice label.bad:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.thumbs { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.thumbs img { width: 68px; height: 68px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* Empty / offline hero */
.hero { text-align: center; padding: var(--s8) var(--s5); }
.hero .ring {
  position: relative; width: 88px; height: 88px; margin: 0 auto var(--s4); border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--ink-3);
}
.hero.on .ring { color: var(--accent); }
.hero.on .ring::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
.hero h2 { font-size: 20px; margin-bottom: var(--s2); }
.hero p { color: var(--ink-2); max-width: 280px; margin: 0 auto; }
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.6); opacity: 0; } }

/* Pay history */
.pay-hero { background: var(--accent); color: #fff; border: 0; }
.pay-hero small { color: rgba(255, 255, 255, .75); }
.pay-hero .money { font-size: 34px; display: block; margin: var(--s1) 0; }
.week { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.week:last-child { border-bottom: 0; padding-bottom: 0; }
.week:first-child { padding-top: 0; }
.pill { font-size: 12px; font-weight: 560; padding: 3px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.pill.paid { background: var(--accent-soft); color: var(--ok); }
.hist { display: flex; align-items: center; gap: var(--s3); }
.hist .svc-chip { width: 36px; height: 36px; border-radius: 10px; }
.hist .grow { flex: 1; min-width: 0; }
.hist .grow small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Camera */
.camera { position: fixed; inset: 0; z-index: 3000; background: #000; display: flex; flex-direction: column; animation: fade 200ms var(--ease); }
.camera video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.camera-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center;
  padding: var(--s5) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
}
.camera-bar button { min-width: 88px; background: rgba(255,255,255,.16); color: #fff; border-color: transparent; box-shadow: none; border-radius: 999px; }
.camera-bar button:hover:not(:disabled) { background: rgba(255,255,255,.26); border-color: transparent; }
.shutter {
  width: 76px; height: 76px; min-width: 76px !important; padding: 0 !important; border-radius: 50% !important;
  background: #fff !important; border: 5px solid rgba(255,255,255,.4) !important; background-clip: padding-box !important;
}
.shutter:active:not(:disabled) { transform: scale(.9) !important; }
.camera-count { min-width: 88px; color: #fff; text-align: right; font-weight: 560; }
.flash { position: fixed; inset: 0; background: #fff; z-index: 3001; pointer-events: none; animation: flash 260ms ease-out forwards; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
