/* Job Book: calm and tidy. Soft grey page, white cards, one indigo accent, quiet colour only where money needs it. */
:root {
  --page: #f3f4f7; --card: #fff; --text: #16181d; --muted: #6b7280; --line: #e7e9ee; --soft: #f6f7f9;
  --act: #3446c8; --act-hover: #2b3bb0; --on-act: #fff; --act-soft: #eef0fd; --on-act-soft: #2c3aa6;
  --red: #b42318; --red-soft: #fdeceb; --green: #18794e; --green-soft: #e8f5ee; --amber: #93590a; --amber-soft: #fdf3e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root { --page: #0f1115; --card: #181b21; --text: #e9ebf0; --muted: #9aa1ad; --line: #272b33; --soft: #1f232a;
    --act: #8796ff; --act-hover: #9aa7ff; --on-act: #0f1115; --act-soft: #232a4d; --on-act-soft: #c9d0ff;
    --red: #ff8f85; --red-soft: #3a1d1b; --green: #6fd3a0; --green-soft: #15302a; --amber: #f2b863; --amber-soft: #352914;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--text); }
body { font: 15px/1.45 Roboto, "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .red { color: var(--red); }
.off { opacity: .5; }

/* top bar, tabs */
.top { position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--card); }
.top b { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.btn { height: 38px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--act); color: var(--on-act); font-weight: 500; font-size: 14px; cursor: pointer; }
.btn:active { background: var(--act-hover); }
.tabs { position: sticky; top: 56px; z-index: 5; display: flex; gap: 26px; padding: 0 16px; background: var(--card); box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(16,24,40,.04); }
.tabs button { border: 0; background: none; padding: 12px 0; color: var(--muted); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--act); border-bottom-color: var(--act); }

/* home */
.hero { max-width: 760px; margin: 0 auto; padding: 14px 14px 0; }
.content { max-width: 760px; margin: 0 auto; padding: 0 14px 80px; }
.searchbar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 4px 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); box-shadow: var(--shadow); }
.searchbar:focus-within { border-color: var(--act); }
.searchbar svg { width: 20px; height: 20px; }
.searchbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 15px; color: var(--text); }
.searchbar .icon { width: 36px; height: 36px; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.stat3 div { padding: 10px 12px; }
.stat3 div + div { border-left: 1px solid var(--line); }
.stat3 span { display: block; font-size: 12px; color: var(--muted); }
.stat3 b { font-size: 17px; font-weight: 600; white-space: nowrap; }
.pills { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.pill { flex: none; height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--text); }
.pill.on { background: var(--act-soft); color: var(--on-act-soft); border-color: transparent; }
select.pill { appearance: none; -webkit-appearance: none; }
.hint { font-size: 13px; color: var(--muted); padding: 12px 2px; }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 2px 8px; }
.dayhead b { font-size: 13px; font-weight: 600; }
.dayhead span { font-size: 12px; color: var(--muted); }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.job, .cust { display: flex; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; }
.group > * + * { border-top: 1px solid var(--line); }
.job:active, .cust:active { background: var(--soft); }
.job .main, .cust .main { flex: 1; min-width: 0; }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); color: var(--muted); display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; }
.l1 { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .tags { font-size: 14px; margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .tags span + span::before { content: ', '; }
.l3 { font-size: 13px; color: var(--muted); }
.end { text-align: right; flex: none; }
.end b { font-weight: 600; }
.badge { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 10px; background: var(--soft); color: var(--muted); }
.badge.due { background: var(--red-soft); color: var(--red); } .badge.paid { background: var(--green-soft); color: var(--green); }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.cust > svg { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.dl { text-align: center; padding: 20px; font-size: 14px; color: var(--act); }
.dl a { color: var(--act); text-decoration: none; font-weight: 500; }
.plainbtn { display: block; width: 100%; margin-top: 8px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--red); font-weight: 500; cursor: pointer; }

/* full-screen pages */
#page { position: fixed; inset: 0; z-index: 20; background: var(--page); overflow-y: auto; }
.appbar { position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; gap: 2px; padding: 0 10px 0 4px; background: var(--card); box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(16,24,40,.04); }
.appbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: inherit; }
.icon:active { background: var(--soft); }
.savebtn { height: 38px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--act); color: var(--on-act); font-weight: 500; cursor: pointer; }
.pagebody { max-width: 760px; margin: 0 auto; padding: 14px 14px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card h3 svg { display: none; }

/* fields */
.field { position: relative; margin: 4px 0 10px; }
.field input, .field select, .field textarea { width: 100%; height: 52px; padding: 20px 12px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 15px; outline: 0; }
.field textarea { height: 84px; padding-top: 24px; resize: vertical; }
.field label { position: absolute; left: 13px; top: 6px; font-size: 12px; color: var(--muted); pointer-events: none; }
.field :focus { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.field :focus + label { color: var(--act); }
.field.pass input { padding-right: 48px; }
.field.pass .eye { position: absolute; right: 4px; top: 4px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin: 0 0 4px; }
.linkbtn { border: 0; background: none; padding: 0 0 10px; color: var(--act); font-weight: 500; font-size: 14px; cursor: pointer; }

/* choices */
.recent, .days, .people, .qgrid, .seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.recent button, .dayt, .people button, .qitem, .seg button {
  height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); font-size: 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; position: relative; color: var(--text); }
.dayt.on, .people button.on, .seg button.on { background: var(--act); color: var(--on-act); border-color: var(--act); }
.qitem { background: var(--soft); }
.qitem::before { content: '+'; color: var(--act); font-weight: 600; }
.qitem small { color: var(--muted); font-size: 12px; }
.dayt svg { width: 16px; height: 16px; }
.datefield { margin-top: 4px; }
.stat3.two { grid-template-columns: 1fr 1fr; }
.recent button .av, .people button .av { display: none; }
.recent button span:last-child, .people button span { overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.suggest { margin: -4px 0 10px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: var(--card); text-align: left; cursor: pointer; }
.suggest button + button { border-top: 1px solid var(--line); }
.suggest .av { width: 32px; height: 32px; font-size: 13px; }
.picked { display: flex; align-items: center; gap: 12px; }
.picked .main { flex: 1; min-width: 0; }
.picked .linkbtn { padding: 0; }

/* item lines */
.jline { padding: 10px 0; border-top: 1px solid var(--line); }
.jline .top { position: static; height: auto; padding: 0; background: none; display: flex; align-items: center; gap: 4px; }
.jline input.nm { flex: 1; min-width: 0; border: 0; background: none; padding: 4px 0; font-size: 15px; font-weight: 600; outline: 0; }
.jline .x { width: 36px; height: 36px; color: var(--muted); }
.jline .x svg { width: 18px; height: 18px; }
.jline .row2 { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.jline .amt { flex: 1; text-align: right; font-weight: 600; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; height: 38px; background: var(--soft); }
.stepper button { width: 36px; height: 36px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--act); }
.stepper button svg { width: 18px; height: 18px; }
.stepper input { width: 34px; text-align: center; border: 0; background: none; font-size: 15px; font-weight: 600; outline: 0; }
.price { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.price input { width: 90px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--card); font-size: 15px; text-align: right; outline: 0; color: var(--text); }
.price input:focus, .addother input:focus { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.addother { display: flex; gap: 8px; margin-top: 10px; }
.addother input { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--card); font-size: 15px; outline: 0; }
.addother button { height: 42px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--act-soft); color: var(--on-act-soft); font-weight: 500; cursor: pointer; }
.totalrow { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--act-soft); color: var(--on-act-soft); }
.totalrow span { font-weight: 500; } .totalrow b { font-size: 20px; font-weight: 700; }

/* buttons, switches */
.bigbtn { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; margin: 4px 0 12px; border: 0; border-radius: 10px; background: var(--act); color: var(--on-act); font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none; }
.bigbtn:active { background: var(--act-hover); }
.bigbtn.soft { background: var(--card); color: var(--act); border: 1px solid var(--line); box-shadow: var(--shadow); }
.bigbtn.danger { background: var(--card); color: var(--red); border: 1px solid var(--line); }
.bigbtn.wa { background: #1c8a52; color: #fff; }
.err { color: var(--red); font-size: 13px; min-height: 16px; margin: 6px 2px 0; }
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 0; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch:checked { background: var(--act); } .switch:checked::after { left: 21px; }

/* one job */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.kv > span:last-child { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.kv.due { color: var(--red); font-weight: 600; }
.kv .x { width: 30px; height: 30px; color: var(--muted); } .kv .x svg { width: 16px; height: 16px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.facts span { display: block; font-size: 12px; color: var(--muted); } .facts b { font-weight: 600; }
.receipt { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 0 14px 10px; margin-bottom: 12px; overflow: hidden; }
.receipt .head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 -14px 4px; padding: 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.receipt .head .small { color: var(--muted); } .receipt .head .big { font-size: 22px; font-weight: 700; }
.receipt .ln { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.receipt .ln b { font-weight: 600; }
.linkrow { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.linkrow .main { flex: 1; min-width: 0; }
.hist div { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
details summary { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); }

/* one customer */
.cust-head { display: flex; align-items: center; gap: 12px; }
.cust-head .av { width: 48px; height: 48px; font-size: 19px; }
.cust-head .main { flex: 1; min-width: 0; }
.call { width: 44px; height: 44px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.call svg { width: 20px; height: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--muted); }
.stats b { display: block; font-size: 17px; font-weight: 600; color: var(--text); }
.stats .due b { color: var(--red); }
.subhead { font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 2px 8px; }
.visit { cursor: pointer; }
.visit:active { background: var(--soft); }
.visit .when { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.visit .when .badge { margin: 0; }
.visit .things { margin: 6px 0; font-size: 14px; }
.visit .things span + span::before { content: ', '; }

/* login */
.login { max-width: 400px; margin: 0 auto; padding: 16vh 16px 40px; }
.login .head { padding: 0 4px; }
.login .head h2 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.login .head p { margin: 4px 0 18px; }
.login .card { padding: 18px; }

#snack { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 30; background: #1f2330; color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; max-width: 520px; margin: 0 auto; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

@media print {
  #app, .appbar, .noprint, #snack { display: none !important; }
  #page { position: static; background: #fff; } body { background: #fff; color: #000; } .card, .receipt, .facts div { box-shadow: none; }
}

/* discount, earlier pending, bill photos */
.discrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.discrow span { flex: 1; color: var(--muted); font-size: 14px; }
.discrow input { width: 96px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--card); font-size: 15px; text-align: right; outline: 0; }
.discrow input:focus { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.seg.mini { margin: 0; gap: 4px; flex-wrap: nowrap; }
.seg.mini button { height: 38px; padding: 0 12px; }
.pendrow { padding: 10px 12px; margin: 4px 0 6px; border-radius: 10px; background: var(--red-soft); }
#takenow { margin: 0 0 6px; }
.photobtn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 1px dashed var(--act); border-radius: 10px; color: var(--act); font-weight: 500; cursor: pointer; position: relative; }
.photobtn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.photobtn svg { width: 20px; height: 20px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.thumb .x { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; background: rgba(0,0,0,.55); color: #fff; }
.thumb .x svg { width: 16px; height: 16px; }
.fullphoto { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.linkbtn[data-earlier] { display: block; margin: 0 auto 8px; padding: 6px; }
@media print { .thumbs .thumb { width: 160px; height: 160px; } }

/* hisaab, reports */
.green { color: var(--green); }
.acts { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.acts .bigbtn { margin: 0 0 10px; }
.bigbtn:disabled { opacity: .4; cursor: default; }
.ledger .lrow { display: grid; grid-template-columns: 1fr auto 84px; gap: 8px; align-items: center; padding: 10px 14px; font-size: 14px; cursor: pointer; }
.ledger .lhead { font-size: 12px; color: var(--muted); padding: 8px 14px; cursor: default; background: var(--soft); }
.ledger .lrow .amt { white-space: nowrap; font-weight: 600; }
.ledger .lrow.pay .amt, .ledger .lrow.less .amt { color: var(--green); }
.ledger .lrow.less .amt { color: var(--amber); }
.ledger .bal { text-align: right; white-space: nowrap; color: var(--muted); }
.ledger .lrow:first-of-type + .lrow .bal { color: var(--text); font-weight: 600; }
.monthbar { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 2px; }
.monthbar b { font-size: 16px; }
.monthbar .flip svg { transform: rotate(180deg); }
.monthbar .icon:disabled { opacity: .3; }
.stat3 + .stat3 { margin-top: 8px; }
.rrow { display: grid; grid-template-columns: 1fr 34px auto auto; gap: 12px; padding: 10px 14px; font-size: 14px; align-items: center; }
.rrow span:not(:first-child) { text-align: right; white-space: nowrap; }
.act { padding: 10px 14px; font-size: 14px; }
.act[data-job] { cursor: pointer; }
.act:active { background: var(--soft); }
.offlist { margin-top: 14px; } .offlist summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 2px 8px; }
.shopset { margin-top: 16px; }
.linkbtn.danger { display: block; margin: 18px auto 0; color: var(--red); }
.card.warn { border-color: var(--red); background: var(--red-soft); }
.bigbtn.dangerfill { background: var(--red); color: #fff; }
