/* SEI Counselling & Follow-up — styles */
:root {
  color-scheme: light;
  --bg: #f2f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --ink: #13263a; --ink-2: #33475c; --muted: #5f7186;
  --line: #d8e1eb; --line-2: #e8eef4;
  --brand: #0b5c99; --brand-2: #0a6cb3; --brand-soft: #e5eff8;
  --op: #1f8a4c; --op-soft: #e3f3ea; --bk: #2f6fd0; --bk-soft: #e7eefb; --pd: #b26f0a; --pd-soft: #fbf0dc; --cl: #7b8896; --cl-soft: #edf0f3;
  --danger: #c0362c; --danger-soft: #fbe8e6; --warn-soft: #fff6e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 40, 64, .06), 0 2px 10px rgba(16, 40, 64, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
body.modal-open { overflow: hidden; }
a { color: var(--brand-2); }
h1 { font-size: 1.5rem; margin: 0 0 .15rem; line-height: 1.2; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--op); }
.bad { color: var(--danger); font-weight: 600; }
.ink { color: var(--ink); }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7fb3e6; outline-offset: 2px; }
.ico { flex: none; vertical-align: -3px; }
.boot { max-width: 520px; margin: 18vh auto; text-align: center; color: var(--muted); padding: 0 16px; }
.boot.err { color: var(--ink); }

/* header & nav */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand b { display: block; font-size: 1.02rem; }
.brand span { display: block; font-size: .8rem; color: var(--muted); }
.top-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.viewas { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.viewas select { font: inherit; font-size: .85rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); max-width: 260px; }
.me { display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.me small { color: var(--muted); }
.demo-bar { display: flex; gap: 8px; align-items: flex-start; background: var(--warn-soft); color: #6b4a07; border-bottom: 1px solid #f0dca8; padding: 7px 20px; font-size: .85rem; }
.nav { display: flex; gap: 4px; padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 20; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-i { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.nav-i:hover { background: var(--surface-2); }
.nav-i.on { background: var(--brand-soft); color: var(--brand); }
.nav-new { background: var(--brand); color: #fff; margin-left: auto; }
.nav-new:hover, .nav-new.on { background: var(--brand-2); color: #fff; }
.badge { background: var(--danger); color: #fff; font-size: .72rem; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; }

.main { max-width: 1240px; margin: 0 auto; padding: 18px 20px 40px; }
.foot { max-width: 1240px; margin: 0 auto; padding: 8px 20px 28px; color: var(--muted); font-size: .78rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.crumb { margin: 0 0 2px; font-size: .85rem; }
.crumb a { text-decoration: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: .92rem; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #c5d2df; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.good { background: var(--op); border-color: var(--op); color: #fff; }
.btn.good:hover { filter: brightness(1.07); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: #e9b9b4; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: .85rem; }
.btn.xs { padding: 3px 8px; font-size: .8rem; }
.btn.lg { padding: 11px 20px; font-size: 1rem; }
.btn.wide { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 6px; cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }
.seg-ctl { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-ctl.wrap { flex-wrap: wrap; margin-bottom: 14px; }
.seg-ctl button { font: inherit; font-size: .88rem; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.seg-ctl.small button { font-size: .8rem; padding: 5px 9px; }
.seg-ctl button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); font-weight: 600; }

/* cards, tiles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.count { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); border-radius: 999px; padding: 0 8px; font-size: .78rem; margin-left: 4px; vertical-align: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile b { font-size: 1.7rem; line-height: 1.1; }
.tile span { font-size: .86rem; color: var(--ink-2); }
.tile .ico { color: var(--muted); }
a.tile:hover { border-color: #b7c7d8; }
.tile.over { border-left-color: var(--danger); }
.tile.over b { color: var(--danger); }
.tile.due { border-left-color: var(--pd); }
.tile.good-t { border-left-color: var(--op); }
.tile.good-t b { color: var(--op); }
.tile.zero { border-left-color: var(--line); }
.tile.zero b { color: var(--muted); }
.stats .tile { border-left-color: var(--line); }

/* conversion */
.conv-body { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; }
.hero { display: flex; align-items: center; gap: 10px; }
.hero b { font-size: 3rem; line-height: 1; letter-spacing: -.02em; }
.hero > span { font-size: .9rem; line-height: 1.3; }
.stack { position: relative; display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: visible; background: var(--surface); }
.stack .seg { height: 100%; min-width: 3px; }
.stack .seg:first-child { border-radius: 4px 0 0 4px; }
.stack .seg:last-of-type { border-radius: 0 4px 4px 0; }
.stack .seg:only-of-type { border-radius: 4px; }
.seg.op, .sw.op { background: var(--op); }
.seg.bk, .sw.bk { background: var(--bk); }
.seg.pd, .sw.pd { background: var(--pd); }
.seg.cl, .sw.cl { background: var(--cl); }
.seg.empty { background: var(--line-2); border-radius: 4px; }
.stack .target { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 1px; }
.stack .target::after { content: "target"; position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--ink-2); }
.conv .stack { margin-top: 14px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 10px 0 4px; font-size: .88rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* chips & tags */
.chip { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; border: 1px solid transparent; }
.st-op { background: var(--op-soft); color: #176b3a; border-color: #bfe2cc; }
.st-bk { background: var(--bk-soft); color: #20539f; border-color: #c4d5f3; }
.st-pd { background: var(--pd-soft); color: #8a5406; border-color: #efd6a6; }
.st-cl { background: var(--cl-soft); color: #4f5b67; border-color: #d6dde4; }
.lk-high { background: #e3f3ea; color: #176b3a; }
.lk-medium { background: #f1f4f8; color: #45586c; }
.lk-low { background: #fbe8e6; color: #9a2c24; }
.due-tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.due-tag.over { background: var(--danger-soft); color: #9a2c24; }
.due-tag.due { background: var(--pd-soft); color: #8a5406; }
.due-tag.good { background: var(--op-soft); color: #176b3a; }

/* patient cards */
.plist { display: flex; flex-direction: column; gap: 10px; }
.pcard { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pcard:hover { border-color: #b7c7d8; }
.pc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pc-name { font-weight: 700; font-size: 1.02rem; text-decoration: none; color: var(--ink); }
.pc-name:hover { color: var(--brand-2); text-decoration: underline; }
.pc-sub { margin-top: 3px; color: var(--ink-2); }
.pc-meta { margin-top: 2px; font-size: .84rem; color: var(--muted); }
.pc-reason { margin-top: 5px; font-size: .86rem; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.pc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.pc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pc-phones { font-size: .8rem; color: var(--muted); text-align: right; }
.empty { padding: 22px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); display: flex; gap: 8px; align-items: center; justify-content: center; }
.more { text-align: center; margin: 12px 0 0; }
.intro { margin: 6px 0 14px; max-width: 900px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; scrollbar-width: thin; }
.tab { padding: 9px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tab b { font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; padding: 0 7px; margin-left: 4px; }
.tab b.hot { background: var(--danger); color: #fff; border-color: var(--danger); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.tbl thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr[data-href]:hover { background: #f5f9fd; }
.tbl td a { color: var(--ink); font-weight: 600; text-decoration: none; }
.tbl td a:hover { color: var(--brand-2); text-decoration: underline; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c { text-align: center !important; }
.sort { font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.sort.on { color: var(--brand); }
.sort.on.asc::after { content: " ▲"; font-size: .7em; }
.sort.on.desc::after { content: " ▼"; font-size: .7em; }
.tbl.rep th[scope=row] { white-space: nowrap; font-weight: 500; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .9rem; background: none; }
.tbl.rep .barcol { width: 34%; min-width: 160px; vertical-align: middle; }
.tbl.rep .stack { height: 14px; }
.tbl.rep .stack .target::after { content: none; }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }
.hbar { display: block; height: 12px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.hbar i.pd { background: var(--pd); }
.hbar i.cl { background: var(--cl); }
.tbl.edit td { padding: 5px 6px; vertical-align: middle; }
.tbl.edit input:not([type=checkbox]), .tbl.edit select { width: 100%; min-width: 110px; }
.result-line { margin: 0 0 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.two-col > .card { margin-bottom: 16px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .78rem; }
.req { color: var(--danger); font-style: normal; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #c9d5e2; border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; }
textarea { min-height: auto; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); padding: 0; flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); outline: 3px solid #cfe2f5; outline-offset: 0; }
input.ro, input[readonly] { background: var(--surface-2); color: var(--ink-2); }
[aria-invalid=true] { border-color: var(--danger) !important; background: #fffafa; }
.err { color: var(--danger); font-size: .8rem; font-style: normal; min-height: 0; }
.err:empty { display: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-bottom: 12px; }
.grid2.tight { margin-bottom: 0; }
.span2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; font-size: .92rem; cursor: pointer; }
.check.big { font-size: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 14px; }
.filters .field { width: 150px; }
.filters .field.grow { flex: 1 1 240px; width: auto; }
.filters.inline .field { width: 180px; }
.search { position: relative; }
.search .ico { position: absolute; left: 10px; top: 12px; color: var(--muted); }
.search input { padding-left: 32px; }
.inline-field { flex-direction: row; align-items: center; gap: 10px; margin: 8px 0 12px; }
.inline-field select { width: auto; min-width: 260px; }
.cform .card h2 { display: flex; align-items: center; gap: 9px; }
.cform .card h2 i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.radio-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.radio-row.compact { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; background: var(--surface); }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { color: var(--muted); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-pill { display: inline-flex; gap: 8px; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .92rem; }
.radio-pill:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.bill { width: 100%; border-collapse: collapse; }
.bill th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
.bill td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.bill td.lbl { width: 150px; font-size: .86rem; color: var(--ink-2); padding-top: 15px; }
.bill td.qty, .bill th.qty { width: 74px; }
.bill td.rate, .bill th.rate { width: 120px; }
.bill td.num { padding-top: 15px; width: 110px; }
.bill td select + input { margin-top: 6px; }
.bill tfoot td { border-bottom: 0; padding-top: 10px; font-weight: 600; }
.warn-text { display: block; color: #8a5406; font-size: .8rem; margin-top: 4px; }
.readout { min-height: 40px; display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; font-weight: 600; }
.final-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; background: var(--brand-soft); border-radius: 8px; }
.final-line b { font-size: 1.35rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.cform .form-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 14px; z-index: 5; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; background: var(--brand-soft); color: #18466e; margin: 8px 0; font-size: .9rem; }
.notice.warn { background: var(--warn-soft); color: #6b4a07; border: 1px solid #f0dca8; }
.notice.err { background: var(--danger-soft); color: #8d2a22; }
.notice .btn-row { margin-top: 8px; }

/* patient page */
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.detail-grid .span2 { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--muted); font-size: .84rem; }
.detail-grid .kv { grid-template-columns: minmax(84px, 36%) 1fr; }
.kv-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; margin-bottom: 8px; }
.kv-row .kv { grid-template-columns: 1fr; gap: 2px; border-bottom: 0; }
.phone-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.bill-view tr.sub td { font-weight: 600; border-top: 1px solid var(--line); }
.bill-view tr.disc td { color: #8a5406; }
.bill-view tr.total td { font-weight: 700; font-size: 1.05rem; background: var(--brand-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 9px 0 9px 14px; border-left: 3px solid var(--bk); margin-left: 4px; border-bottom: 1px solid var(--line-2); }
.timeline li.tl-update { border-left-color: var(--line); }
.timeline li.tl-whatsapp { border-left-color: var(--op); }
.tl-date { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.links { margin: 0; padding-left: 18px; }
.links li { margin: 4px 0; }

/* staff trial */
.fb-btn { border-color: #b9d3ea; color: var(--brand); }
.trial { border-left: 4px solid var(--op); }
.trial-list { margin: 0; padding-left: 22px; columns: 2; column-gap: 28px; }
.trial-list li { break-inside: avoid; margin-bottom: 2px; }
.trial-list .check { margin: 4px 0; align-items: flex-start; }
.trial-list .check input { margin-top: 2px; }
.trial-list .check:has(input:checked) span { color: var(--muted); text-decoration: line-through; }
.rating { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rating .radio-pill { padding: 6px 12px; }

/* green / yellow sheets */
.dz-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.dropzone { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface-2); min-height: 108px; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--brand-2); background: var(--brand-soft); }
.dropzone .dz-act { margin-top: auto; font-size: .84rem; color: var(--brand); display: flex; gap: 6px; align-items: center; }
.dz-green { background: #eef8ee; border-color: #a9d3ab; }
.dz-yellow { background: #fffbe6; border-color: #e8d27a; }
.dz-green b { color: #1e6b2a; } .dz-yellow b { color: #7a6105; }
.chip.doc-green { background: #e3f3e4; color: #1e6b2a; border-color: #b6dcb8; }
.chip.doc-yellow { background: #fff6cc; color: #6f5904; border-color: #ead27a; }
.doc-pending { list-style: none; padding: 0; margin: 0; }
.doc-pending li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.doc-tile { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.doc-thumb { display: flex; align-items: center; justify-content: center; height: 130px; border: 0; padding: 0; cursor: zoom-in; background: var(--surface-2); overflow: hidden; }
.doc-thumb.doc-green { background: #eef8ee; } .doc-thumb.doc-yellow { background: #fffbe6; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.doc-thumb .pdf { font-weight: 700; color: var(--danger); border: 2px solid currentColor; border-radius: 6px; padding: 6px 10px; }
.doc-tile figcaption { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; align-items: flex-start; }
.doc-name { word-break: break-all; }
.doc-view { text-align: center; background: var(--surface-2); border-radius: 8px; }
.doc-view img { max-width: 100%; max-height: 70vh; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 30, 45, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 16px 18px; }
.modal-body > .field, .modal-body > .grid2 { margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }

/* toast */
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); background: #15293d; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: .92rem; opacity: 0; transition: .2s; pointer-events: none; z-index: 200; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 420px; text-align: center; }
.login h1 { justify-content: center; margin-top: 8px; }
.login h2 { margin-top: 14px; }
.login .field { text-align: left; margin-bottom: 12px; }
.login-links { font-size: .9rem; }

/* settings */
.wa-row { border-bottom: 1px solid var(--line-2); padding: 10px 0; }
.grid-wa { display: grid; grid-template-columns: 220px 1fr auto; gap: 12px; align-items: start; }
.grid-wa .icon-btn { margin-top: 26px; }

/* print */
#print-slip { display: none; }
@media print {
  body { background: #fff; }
  body.printing-slip > *:not(#print-slip) { display: none !important; }
  .top, .nav, .demo-bar, .foot, .action-bar, .seg-ctl, .btn, .tabs, .form-actions { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  .main { padding: 0; }
}
body.printing-slip #print-slip { display: block; }
.slip { font-size: 12.5px; color: #000; }
.slip-head { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
.slip-head h1 { font-size: 20px; margin: 0; }
.slip-head .right { text-align: right; }
.slip h2 { font-size: 14px; margin: 14px 0 6px; }
.slip-t, .slip-bill { width: 100%; border-collapse: collapse; }
.slip-t th, .slip-t td, .slip-bill th, .slip-bill td { border: 1px solid #999; padding: 5px 7px; text-align: left; }
.slip-t th { width: 18%; background: #f2f2f2; }
.slip-bill td:nth-child(n+2), .slip-bill th:nth-child(n+2) { text-align: right; }
.slip-bill tr.total td { font-weight: 700; font-size: 14px; }
.slip-bill tr.sub td { font-weight: 600; }
.slip .sign { display: flex; justify-content: space-between; margin-top: 60px; }
.slip .sign div { border-top: 1px solid #000; width: 40%; padding-top: 4px; text-align: center; }

.fab { display: none; }

/* responsive */
@media (max-width: 1000px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 > .span2 { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .top { padding: 8px 16px; }
  .brand span, .hide-sm { display: none; }
  .viewas span { display: none; }
  .viewas select { max-width: 170px; }
  .nav { padding: 6px 10px; }
  .nav-i { padding: 8px 10px; }
  .nav-new { margin-left: 0; }
  .main { padding: 14px 16px 32px; }
  h1 { font-size: 1.3rem; }
  .card { padding: 14px; }
  .conv-body { grid-template-columns: 1fr; gap: 10px; }
  .pcard { grid-template-columns: 1fr; }
  .pc-side { align-items: flex-start; }
  .pc-actions { justify-content: flex-start; }
  .pc-phones { text-align: left; }
  .grid2, .grid3, .radio-row, .detail-grid, .two-col, .kv-row, .dz-row { grid-template-columns: 1fr; }
  .dropzone { min-height: 0; }
  .trial-list { columns: 1; }
  .fb-btn span { display: none; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2.tight { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .filters .field { width: calc(50% - 6px); }
  .filters .field.grow { flex-basis: 100%; }
  .bill thead { display: none; }
  .bill, .bill tbody, .bill tfoot { display: block; width: 100%; }
  .bill tbody tr { display: grid; grid-template-columns: 64px 1fr 1fr auto; gap: 6px 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .bill tbody td { display: block; border: 0; padding: 0; width: auto !important; }
  .bill tbody td.lbl { grid-column: 1 / -1; padding: 0; font-weight: 600; }
  .bill tbody td:nth-child(2) { grid-column: 1 / -1; }
  .bill tbody td.qty::before { content: "Qty"; display: block; font-size: .75rem; color: var(--muted); }
  .bill tbody td.rate::before { content: "Rate ₹"; display: block; font-size: .75rem; color: var(--muted); }
  .bill tbody td.num { padding: 0 0 10px; font-weight: 600; }
  .bill tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; }
  .bill tfoot td { display: block; padding: 0; border: 0; }
  .bill tfoot td:empty { display: none; }
  .bill tfoot td:nth-child(2) { flex: 1 1 100%; }
  .grid-wa { grid-template-columns: 1fr auto; }
  .grid-wa .field:first-child { grid-column: 1 / -1; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-field select { min-width: 0; }
  .fab { display: flex; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(11, 92, 153, .35); z-index: 30; }
  .nav-new { display: none; }
  .main { padding-bottom: 90px; }
}
@media print { .fab { display: none !important; } }

/* v1.3: consent, searchable procedure list */
.consent { margin-top: 4px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; }
.consent .check { margin: 6px 0 0; }
.bill-find { margin-bottom: 6px; }
.bill-find .ico { top: 11px; }
.bill select[size] { min-height: 120px; }
