:root {
  --blue: #0b4f8a; --blue-2: #e8f1fa; --ink: #16202b; --muted: #5d6b7a; --line: #dde3ea; --bg: #f4f6f9;
  --good: #1a7f37; --good-bg: #e6f4ea; --warn: #9a6700; --warn-bg: #fff4d6; --bad: #b42318; --bad-bg: #fde8e7;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Telugu", sans-serif; }
body.worker { font-size: 18px; line-height: 1.7; }
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; background: #fff; padding-bottom: 80px; }
h1, h2, h3 { margin: 12px 0 6px; line-height: 1.3; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 22px; display: flex; gap: 8px; align-items: center; }
a { color: var(--blue); }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
.good-text { color: var(--good); font-weight: 600; }
.center { text-align: center; padding: 24px 16px; }
.pad-x { padding-left: 16px; padding-right: 16px; }
.break { word-break: break-all; }
.big { font-size: 20px; }
.huge { font-size: 32px; font-weight: 700; margin: 8px 0 0; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--blue); color: #fff; }
.bar .muted { color: #cfe0f1; }
.bar .chip { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }
.bar input[type=month] { border-radius: 8px; border: 0; padding: 6px; }

.btn { appearance: none; border: 0; border-radius: 12px; background: var(--blue); color: #fff; font: inherit; font-weight: 600;
  padding: 12px 18px; min-height: 48px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.ghost { background: var(--blue-2); color: var(--blue); }
.btn.small { min-height: 40px; padding: 8px 14px; }
.btn.tall { min-height: 72px; font-size: 20px; }
.btn.wide { width: 100%; margin: 6px 0; }
.btn:disabled { opacity: .45; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; }
.row { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.row .btn { flex: 1; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }

.search { width: 100%; font: inherit; font-size: 20px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; margin-top: 12px; }
.search:focus { outline: none; border-color: var(--blue); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px; }
.stats.two { padding-left: 0; padding-right: 0; }
.stat { background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.stat[role=button] { cursor: pointer; }
.stat small { display: block; color: var(--muted); }
.stat b { font-size: 22px; }
.stat.bad b { color: var(--bad); } .stat.good b { color: var(--good); } .stat.warn b { color: var(--warn); }

.list { display: flex; flex-direction: column; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; font: inherit; text-align: left; color: inherit; width: 100%; }
button.lrow { cursor: pointer; }
.lrow small { display: block; color: var(--muted); }
.lrow .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lrow.focus { background: var(--blue-2); }
.lrow.struck b { text-decoration: line-through; color: var(--muted); }
.st { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.st-paid, .st-active { background: var(--good-bg); color: var(--good); }
.st-partial { background: var(--warn-bg); color: var(--warn); }
.st-hold { background: #ece8ff; color: #4b2fb3; }
.btn.danger { color: var(--bad); background: var(--bad-bg); }
small.lines { display: block; color: var(--muted); font-size: 12px; }
.st-unpaid, .st-off { background: var(--bad-bg); color: var(--bad); }
.alert { margin: 10px 16px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: #5c3d00; }

/* worker */
.vlist { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.vcard { display: flex; align-items: center; gap: 14px; border: 2px solid var(--line); border-radius: 16px; background: #fff;
  padding: 14px; min-height: 84px; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.vcard:active { background: var(--blue-2); }
.vcard .plate { font-size: 30px; font-weight: 800; letter-spacing: .06em; min-width: 92px; text-align: center; background: #fff8c4;
  border: 2px solid #222; border-radius: 8px; padding: 2px 6px; }
.vcard .vinfo { flex: 1; line-height: 1.4; }
.vcard .vinfo small { display: block; color: var(--muted); font-size: 15px; }
.vcard .tick { font-size: 22px; }
.vcard.done { opacity: .55; border-color: var(--good); }
.vcard.done .tick { color: var(--good); font-size: 16px; font-weight: 700; }
.late-banner { background: var(--warn-bg); color: #5c3d00; padding: 10px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qbadge { margin-top: 8px; background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 6px 10px; font-weight: 700; }
.foot { display: flex; gap: 10px; justify-content: space-between; padding-top: 16px; }

/* pin pad */
.dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0 6px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blue); }
.dots i.on { background: var(--blue); }
.pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; justify-content: center; }
.key { height: 72px; border-radius: 50%; border: 0; background: var(--blue-2); font-size: 26px; font-weight: 700; color: var(--blue); cursor: pointer; }
.key:active { background: var(--blue); color: #fff; }

/* owner nav */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--line); z-index: 6;
  padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; max-width: 144px; border: 0; background: none; padding: 8px 0 10px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.tabs button span { display: block; font-size: 20px; }
.tabs button.on { color: var(--blue); font-weight: 700; }

/* modal + forms */
.modal { position: fixed; inset: 0; background: rgba(10, 20, 30, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 18px; } }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form > * { grid-column: 1 / -1; }
.form > .fld.half { grid-column: auto; }
.form .fld { min-width: 0; }
.form label, .form .lbl { display: block; font-size: 14px; color: var(--muted); margin: 8px 0; }
.form h4 { margin: 14px 0 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); border-top: 1px solid var(--line); padding-top: 12px; }
.seg { display: flex; gap: 6px; margin-top: 4px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--ink); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qrbox { width: 240px; max-width: 80vw; margin: 10px auto; }
.qrbox svg { width: 100%; height: auto; display: block; }
.photo { width: 100%; border-radius: 12px; margin-bottom: 10px; }

/* customer page */
.paybox { border: 2px solid var(--blue-2); border-radius: 16px; padding: 14px; text-align: center; margin: 8px 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal b { font-size: 12px; color: var(--muted); }
.day { position: relative; aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--bg); font: inherit; font-size: 14px; color: var(--muted); }
.day.yes { background: var(--good-bg); color: var(--good); font-weight: 700; cursor: pointer; }
.day i { position: absolute; right: 4px; top: 2px; font-style: normal; font-size: 11px; }
.privacy { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  z-index: 30; font-weight: 600; transition: opacity .4s; max-width: 90vw; text-align: center; }
.toast.good { background: var(--good); } .toast.bad { background: var(--bad); } .toast.warn { background: var(--warn); }
.toast.out { opacity: 0; }
[hidden] { display: none !important; }

/* worker card: main area opens camera; right column = camera + "Not here" under it */
.vcard { padding: 0; overflow: hidden; cursor: default; }
.vcard .vmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px 0 14px 14px; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.vcard .vmain:active { background: var(--blue-2); }
.vside { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; padding: 8px 10px 8px 4px; min-width: 76px; }
.vside .cam { border: 0; background: var(--blue-2); border-radius: 12px; font-size: 26px; padding: 6px 0; cursor: pointer; }
.vside .nabtn { border: 1px solid var(--line); background: #fff; border-radius: 10px; font: inherit; font-size: 12px; padding: 6px 4px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.vside .tick { border: 0; background: none; font: inherit; cursor: pointer; padding: 8px 0; }
.vcard.na { opacity: .65; border-color: var(--warn); }
.vcard.na .tick { color: var(--warn); font-size: 14px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
/* customer calendar */
.day.na { background: var(--warn-bg); color: var(--warn); }
.legend { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day.mini { display: inline-flex; width: 22px; height: 22px; aspect-ratio: auto; align-items: center; justify-content: center; font-size: 12px; border-radius: 6px; }
/* receipt */
.receipt { font-size: 14px; }
.rc-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 10px; }
.rc-head b { font-size: 18px; } .rc-head span { font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.rc-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-bottom: 10px; }
.rc-grid span { color: var(--muted); }
.rc-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rc-table td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.rc-table td:last-child { text-align: right; white-space: nowrap; }
.rc-table tr.tot td { font-weight: 700; border-bottom: 2px solid var(--ink); }
@media print {
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; left: 0; top: 0; width: 100%; padding: 24px; }
  .modal { background: none; } .noprint { display: none; }
}

/* in-app camera */
.cam-screen { position: fixed; inset: 0; background: #000; z-index: 40; display: flex; flex-direction: column; }
.cam-screen video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.cam-guide { position: absolute; left: 10%; right: 10%; top: 50%; height: 22%; transform: translateY(-60%); border: 3px dashed #ffd54a; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.25); display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.cam-guide span { transform: translateY(150%); color: #fff; font-weight: 700; text-align: center; text-shadow: 0 1px 3px #000; font-size: 16px; }
.cam-bar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.cam-bar .btn { min-width: 96px; background: rgba(255,255,255,.18); color: #fff; }
.cam-shot { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #ffd54a; cursor: pointer; }
.cam-shot:active { transform: scale(.94); }
small.flag { display: block; color: var(--bad); font-weight: 600; }

.paste { width: 100%; font: 13px/1.4 ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 6px 0 10px; }
.cols { word-break: break-word; }
