/* Pulse Hospital Billing. Direction: the pharmacy counter. Quiet graphite chrome, one chemist green,
   figures in mono like a printed bill, the dashed tear line only where a bill is totalled. */
:root {
  /* Light and dark from one set of tokens. color-scheme follows Windows unless the top-bar switch pinned one
     (the switch writes <meta name="color-scheme">; these two :has() rules carry it into CSS). */
  color-scheme: light dark;
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
  --bg: light-dark(#f7f7f6, #141415); --card: light-dark(#fff, #1b1b1d); --raised: light-dark(#f2f2f1, #252527);
  --line: light-dark(rgb(23 23 23 / .09), rgb(237 237 237 / .09)); --line-2: light-dark(rgb(23 23 23 / .16), rgb(237 237 237 / .16));
  --ink: light-dark(#171717, #ededed); --ink-2: light-dark(#4f4f4f, #b4b4b8); --mute: light-dark(#6f6f6f, #8f8f95);
  --hover: light-dark(#fafaf9, #202022); --faint: light-dark(#9b9b9b, #6a6a70); --bar: light-dark(#d6d6d3, #3a3a3e);
  --brand: #0f766e; --brand-ink: light-dark(#0b5f58, #5eead4); --brand-soft: light-dark(#e7f2f0, #11302d);
  --good: light-dark(#15803d, #4cc38a); --warn: light-dark(#a15c07, #f5b041); --warn-soft: light-dark(#fbf1df, #3a2b12);
  --bad: light-dark(#c22626, #f87171); --bad-soft: light-dark(#fbe9e9, #3b1a1a);
  accent-color: var(--brand);
  scrollbar-color: var(--faint) transparent;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: "IBM Plex Sans", "Noto Sans Telugu", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font: 15px/1.5 var(--sans);
  color: var(--ink); background: var(--bg);
}
:lang(te) body { font-family: "Noto Sans Telugu", "Nirmala UI", var(--sans); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .5; cursor: wait; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.n { text-align: right; } .c { text-align: center; } .nowrap { white-space: nowrap; }
.num, .n, td.n, .mono { font-variant-numeric: tabular-nums; }
h2, h3, h4 { font-weight: 500; }
h3 { margin: 0 0 16px; font-size: 16px; } h4 { margin: 24px 0 8px; font-size: 14px; color: var(--ink-2); }
b, strong { font-weight: 600; }

/* ---------- frame ---------- */
#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: 56px 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.brand strong { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; line-height: 20px; }
.brand small { display: block; color: var(--mute); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo svg { width: 18px; fill: #fff; stroke: none; }
.who { display: flex; gap: 16px; align-items: center; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.lang { display: flex; background: var(--raised); border-radius: 8px; padding: 2px; }
.lang button { padding: 4px 12px; border-radius: 6px; color: var(--ink-2); font-size: 13px; line-height: 20px; transition: background-color .15s var(--ease), color .15s var(--ease); }
.lang button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.user { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.user::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); } /* this PC is activated */

.side { position: sticky; top: 56px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; height: calc(100vh - 56px);
  border-right: 1px solid var(--line); background: var(--card); }
.side a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none;
  transition: background-color .15s var(--ease), color .15s var(--ease); }
.side a:hover { background: var(--raised); color: var(--ink); }
.side a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.side svg { width: 18px; height: 18px; flex: none; }
.side .gap { flex: 1; }

main { min-width: 0; padding: 24px 32px 48px; max-width: 1600px; }
.view { display: none; }
.view.on { display: block; animation: rise .3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.view > * + * { margin-top: 16px; }
.page-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 20px; }
.page-title h1 { margin: 0; font-size: 24px; font-weight: 500; line-height: 32px; }
.page-title small { color: var(--mute); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
input, select { border: 1px solid var(--line-2); border-radius: 8px; height: 40px; padding: 0 12px; background: var(--card); width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; padding: 0; accent-color: var(--brand); }
input::placeholder { color: var(--mute); }
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgb(15 118 110 / .14); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; } /* keyboard users see where they are */
input.n { text-align: right; }
.primary { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 8px; background: var(--brand); color: #fff;
  font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), transform .12s var(--ease); }
.primary:hover { background: color-mix(in oklab, var(--brand), black 18%); } .primary:active { transform: scale(.98); }
.primary.big { height: 48px; padding: 0 24px; font-size: 16px; }
.ghost { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 8px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); white-space: nowrap; transition: background-color .15s var(--ease); }
.ghost:hover { background: var(--raised); }
button.small, a.small { height: 32px !important; padding: 0 12px !important; font-size: 13px; } /* buttons only: the printed bill uses .small for its fine print */
.danger { color: var(--bad); }
.link { color: var(--brand-ink); font-weight: 500; height: 32px; padding: 0 8px; border-radius: 6px; transition: background-color .15s var(--ease); }
.link:hover { background: var(--brand-soft); }
.link.danger { color: var(--bad); } .link.danger:hover { background: var(--bad-soft); }
kbd { font: 500 12px/16px var(--mono); background: var(--card); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--ink-2); }
.seg { display: inline-flex; background: var(--raised); border-radius: 8px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 36px; padding: 0 16px; border-radius: 6px; color: var(--ink-2); transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; padding: 0 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.note { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.none { text-align: center; color: var(--mute); padding: 32px; margin: 0; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.head-row h3 { margin: 0; }
.bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.bar > input[type=search] { max-width: 360px; }
.bar .grow { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.inline input, .inline select { width: auto; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; line-height: 16px; color: var(--mute); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
td { padding: 8px; height: 44px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td small { display: block; color: var(--mute); font-size: 12px; line-height: 16px; }
td b { font-weight: 500; }
.grid td.n, .grid td b.mono, .mono { font-family: var(--mono); font-size: 13px; }
.scroll { overflow-x: auto; }
.grid td { white-space: nowrap; }
.grid tbody tr { transition: background-color .12s var(--ease); } .grid tbody tr:hover { background: var(--hover); }
.grid tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: 0; }
.grid tr.sub td { border-top: 0; height: 36px; }
.grid tr.first td { border-top: 1px solid var(--line-2); }
.grid tr.zero td:not(:empty) { color: var(--faint); }
.x { width: 32px; height: 32px; border-radius: 6px; color: var(--mute); font-size: 18px; line-height: 1; transition: background-color .15s var(--ease), color .15s var(--ease); }
.x:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- home ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { text-decoration: none; display: block; transition: border-color .15s var(--ease); }
a.stat:hover { border-color: var(--line-2); }
.stat small { color: var(--ink-2); font-size: 13px; display: block; }
.stat strong { display: block; margin: 8px 0 4px; font: 500 28px/32px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.stat span { font-size: 13px; color: var(--mute); }
.stat.alert strong { color: var(--warn); }
.stat.lead strong { color: var(--brand-ink); }
.two-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 240px; padding-top: 24px; border-bottom: 1px solid var(--line-2);
  background: repeating-linear-gradient(to top, transparent 0 59px, var(--line) 59px 60px); }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.chart .col span { font: 12px/16px var(--mono); color: var(--mute); white-space: nowrap; }
.chart i { width: 100%; max-width: 48px; height: var(--h); background: var(--bar); border-radius: 4px 4px 0 0; }
.chart .col.today i { background: var(--brand); }
.chart .col.today span { color: var(--brand-ink); font-weight: 500; }
.chart-days { display: flex; gap: 12px; padding-top: 8px; }
.chart-days small { flex: 1; text-align: center; font-size: 12px; color: var(--mute); }
.chart-days small.today { color: var(--ink); font-weight: 500; }
.top5 { margin: 0; padding: 0; list-style: none; counter-reset: n; }
.top5 li { display: grid; grid-template-columns: 24px 1fr auto; column-gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); counter-increment: n; align-items: center; }
.top5 li:last-child { border-bottom: 0; }
.top5 li::before { content: counter(n); font: 12px var(--mono); color: var(--mute); }
.top5 li.none { display: block; } .top5 li.none::before { display: none; }
.top5 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top5 small { grid-column: 2; color: var(--mute); font-size: 12px; }
.top5 b { grid-column: 3; grid-row: 1 / 3; font: 500 13px var(--mono); }

/* ---------- billing: the live bill is set like the paper bill ---------- */
#v-bill.on { display: grid; grid-template-columns: minmax(300px, 2fr) 3fr; gap: 16px; align-items: start; }
#v-bill > * { min-width: 0; margin: 0; }
.find { position: sticky; top: 80px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 20px; color: var(--mute); }
.search input { height: 48px; padding-left: 44px; font-size: 16px; }
.hint { color: var(--mute); font-size: 13px; margin: 8px 0 12px; }
.results { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 280px); overflow: auto; }
.results li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: background-color .12s var(--ease), border-color .12s var(--ease); }
.results li:hover { background: var(--raised); }
.results li.hl { background: var(--brand-soft); border-color: rgb(15 118 110 / .25); }
.results li.off { opacity: .5; cursor: not-allowed; }
.results b { font-weight: 500; }
.results .meta { grid-column: 1; color: var(--mute); font-size: 13px; }
.results .price { grid-row: 1 / 3; grid-column: 2; text-align: right; align-self: center; font: 500 14px var(--mono); }
.results .price small { display: block; color: var(--mute); font: 12px var(--sans); }
.cart { display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 104px); }
.patient { display: grid; grid-template-columns: 1.2fr 2fr 1.6fr; gap: 8px; }
.consent { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-top: -8px; }
.cart-wrap { flex: 1; overflow: auto; }
.lines td { height: 52px; }
.lines td:first-child { min-width: 200px; }
.lines input { width: 72px; height: 36px; padding: 0 8px; text-align: center; font-family: var(--mono); }
.lines select { width: auto; height: 36px; padding: 0 8px; font-size: 13px; }
.lines .amt { font: 500 14px var(--mono); white-space: nowrap; }
.empty { text-align: center; color: var(--mute); padding: 48px 0; }
.empty svg { width: 48px; color: var(--faint); }
.sum { border-top: 1px dashed var(--line-2); padding-top: 16px; display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; }
.pay { justify-self: start; }
.sum dl { display: flex; gap: 24px; margin: 0; justify-self: end; }
dt { font-size: 12px; color: var(--mute); } dd { margin: 0; font: 500 14px var(--mono); }
#s-saved { color: var(--good); }
.total { display: flex; align-items: baseline; gap: 12px; }
.total span { color: var(--ink-2); }
.total strong { font: 500 40px/44px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- purchases ---------- */
.form3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form3 label, .form label { font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; align-content: start; }
.with-btn { display: flex; gap: 8px; }
.pur-lines input { height: 36px; padding: 0 8px; min-width: 72px; }
.pur-lines td:first-child input { min-width: 220px; }
.pur-lines td { padding: 4px; height: 44px; }
.pur-foot { display: flex; justify-content: flex-end; align-items: center; gap: 32px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-2); flex-wrap: wrap; }
.pur-foot dl { display: flex; gap: 24px; margin: 0; }
.big-num { font: 500 24px var(--mono); }

/* ---------- privacy ---------- */
.privacy-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.notice { font-size: 14px; color: var(--ink-2); }
.notice p { margin: 0 0 12px; }
.notice ol { margin: 0; padding-left: 20px; } .notice li { margin-bottom: 8px; }
.found { margin-top: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; margin: 0 0 16px; }
.kv dt { font-size: 13px; } .kv dd { font: inherit; }

/* ---------- forms & modal ---------- */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 800px; }
.form h2, .form h3, .form .wide, .form .acts, .paper { grid-column: 1 / -1; }
.form h3 { margin: 8px 0 0; font-size: 15px; padding-top: 16px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 8px; font-size: 20px; line-height: 28px; }
h2 small { font-size: 13px; color: var(--mute); font-weight: 400; margin-left: 8px; }
.paper { border: 1px solid var(--line-2); border-radius: 8px; display: flex; gap: 24px; flex-wrap: wrap; padding: 12px 16px; margin: 0; }
.paper legend { font-size: 13px; color: var(--ink-2); padding: 0 4px; }
.paper label { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 8px 24px rgb(0 0 0 / .08); width: min(640px, 94vw); max-height: 90vh; color: var(--ink); }
dialog.wide { width: min(920px, 96vw); }
dialog[open] { animation: rise .22s var(--ease); }
dialog::backdrop { background: rgb(23 23 23 / .32); }
dialog .acts { margin-top: 16px; }
.meta-line { color: var(--ink-2); margin: 4px 0 16px; font-size: 14px; }
.modal-total { text-align: right; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-2); color: var(--ink-2); }
.modal-total b { color: var(--ink); font: 500 24px var(--mono); margin-left: 8px; }
dialog td input { width: 80px; height: 36px; text-align: center; font-family: var(--mono); }
#m-file { margin: 8px 0 12px; height: auto; padding: 8px; }
.ok-line { color: var(--good); font-weight: 500; }
.err-list { color: var(--bad); font-size: 14px; padding-left: 20px; }
.keybox { font: 500 20px/28px var(--mono); letter-spacing: .04em; background: var(--raised); border-radius: 8px; padding: 12px 16px; text-align: center; user-select: all; }

#toast { position: fixed; bottom: 24px; left: 50%; translate: -50% 8px; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 8px; max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), translate .2s var(--ease); z-index: 20; }
#toast.show { opacity: 1; translate: -50% 0; }
#toast.bad { background: var(--bad); color: light-dark(#fff, #1b1b1d); }

/* ---------- activate this PC / owner sign-in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: min(440px, 100%); padding: 32px; }
.gate .brand { margin: 0 0 24px; }
.gate h1 { font-size: 22px; font-weight: 500; line-height: 28px; margin: 0 0 8px; }
.gate p { color: var(--ink-2); font-size: 14px; margin: 0 0 24px; }
.gate label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.gate input[name=key] { font: 500 16px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.gate .primary { width: 100%; height: 48px; margin-top: 8px; }
.gate .lang { margin-left: auto; }

#print { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .two, .privacy-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .top { position: static; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .side { position: sticky; top: 0; z-index: 4; flex-direction: row; height: auto; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side a { flex: none; } .side .gap { display: none; }
  main { padding: 16px; }
  #v-bill.on { grid-template-columns: 1fr; }
  .find { position: static; } .results { max-height: 300px; }
  .patient, .form, .form3 { grid-template-columns: 1fr; }
  .cart { min-height: 0; }
  .sum { grid-template-columns: 1fr; } .sum dl { justify-self: start; }
  #save { flex: 1; }
}
@media (max-width: 520px) { .stats, .two-stats { grid-template-columns: 1fr; } .who #today { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- PRINT ---------- */
@media print {
  #app, #toast, dialog, .gate { display: none !important; }
  #print { display: block; }
  :root { color-scheme: light; }
  :root, body { background: #fff; font-size: 10.5px; }
}
.inv { color: #000; font-family: Arial, Helvetica, sans-serif; }
.inv table { width: 100%; border-collapse: collapse; }
.inv th, .inv td { border: 1px solid #000; padding: 2px 4px; height: auto; font-size: inherit; color: #000; text-transform: none; letter-spacing: 0; white-space: nowrap; font-family: inherit; }
.inv td.w { white-space: normal; }
.inv th { background: #eee; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv .head { display: flex; justify-content: space-between; gap: 10px; border: 1px solid #000; border-bottom: 0; padding: 4px 6px; }
.inv .head h1 { margin: 0; font-size: 1.7em; }
.inv .head p { margin: 1px 0; }
.inv .title { text-align: center; font-weight: 700; border: 1px solid #000; border-bottom: 0; padding: 2px; letter-spacing: .1em; }
.inv .foot { display: grid; grid-template-columns: 1.4fr 1fr; border: 1px solid #000; border-top: 0; }
.inv .foot > div { padding: 4px 6px; }
.inv .foot > div + div { border-left: 1px solid #000; }
.inv .foot-row { display: flex; gap: 8px; align-items: center; }
.inv .totals td { border: 0; padding: 1px 0; } .inv .totals .grand td { font-size: 1.35em; font-weight: 700; border-top: 1px solid #000; padding-top: 3px; }
.inv .words { font-weight: 700; margin: 4px 0; }
.inv .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 18px; }
.inv .small { font-size: .9em; }
.inv .qr { text-align: center; flex: none; }
.inv .qr svg { width: 22mm; height: 22mm; display: block; margin: 0 auto; fill: revert; stroke: none; }
.inv .qr small { font-size: .85em; }
.inv.cn .pad { border: 1px solid #000; padding: 6px; }
.inv.cn .totals { width: 40%; margin-left: auto; margin-top: 4px; }
.inv.t80 { width: 72mm; font-size: 11px; }
.inv.t80 .head { display: block; text-align: center; border: 0; padding: 0; }
.inv.t80 .head h1 { font-size: 1.5em; }
.inv.t80 .title { border: 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; margin: 4px 0; }
.inv.t80 th, .inv.t80 td { border: 0; padding: 1px 0; background: none; white-space: normal; }
.inv.t80 .items tr.l1 td { padding-top: 3px; }
.inv.t80 .rule { border-top: 1px dashed #000; margin: 4px 0; }
.inv.t80 .totals .grand td { border-top: 1px dashed #000; }
.inv.t80 .qr { margin: 6px 0; }
.rep-print { color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
.rep-print h2 { font-size: 18px; margin: 0; } .rep-print h3 { font-size: 13px; margin: 2px 0 10px; font-weight: 500; }
.rep-print th, .rep-print td { border: 1px solid #999; padding: 3px 5px; height: auto; color: #000; font-size: 11px; font-family: inherit; }
.rep-print .tag { border: 1px solid #999; background: none; color: #000; }
.rep-print .stats { display: flex; gap: 20px; margin-bottom: 8px; } .rep-print .card { border: 0; padding: 4px 0; } .rep-print .stat strong { color: #000; font-size: 16px; }

/* ---------- owner page ---------- */
.owner-main { margin: 0 auto; }
.owner-main > * + * { margin-top: 16px; }
.new-shop { display: grid; grid-template-columns: 2fr 1fr 1.5fr auto auto; gap: 16px; align-items: end; }
.new-shop label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.new-shop .check { display: flex; height: 40px; }
.head-row h3 small { color: var(--mute); font-weight: 400; font-size: 13px; margin-left: 8px; }
@media (max-width: 900px) { .new-shop { grid-template-columns: 1fr; } }
.notice-page { max-width: 800px; padding-block: 48px; }
.notice-page h1 { font-size: 24px; font-weight: 500; margin: 0 0 12px; }
.notice-page h3 { margin: 24px 0 8px; color: var(--ink); }
#pq { max-width: 240px; }

/* ---------- theme switch (two states: follow Windows, or the opposite of it) ---------- */
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); transition: background-color .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme .to-light { display: none; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme { .to-dark { display: none; } .to-light { display: contents; } }
@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme { .to-dark { display: none; } .to-light { display: contents; } }
}

/* ---------- shop logo ---------- */
.logo.img { background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.logo.img img { width: 100%; height: 100%; object-fit: contain; }
.logo-field { display: flex; align-items: center; gap: 16px; }
.logo-prev { width: 64px; height: 64px; border-radius: 12px; border: 1px dashed var(--line-2); display: grid; place-items: center; overflow: hidden; color: var(--mute); font-size: 12px; flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.inv .shop-logo { height: 14mm; max-width: 30mm; object-fit: contain; float: left; margin-right: 6px; }
.inv.t80 .shop-logo { float: none; display: block; margin: 0 auto 2px; height: 12mm; }

/* ---------- patients ---------- */
.pt-name { font-weight: 500; }

/* ---------- replace: credit note used on the new bill ---------- */
.credit { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font-size: 14px; }
.credit .cr-pay { margin-left: auto; color: var(--ink); font: 500 16px var(--mono); }

/* ---------- print preview: a sheet of paper, always light, at real size ---------- */
.sheet-wrap { margin-top: 16px; background: var(--raised); border-radius: 8px; padding: 16px; max-height: 64vh; overflow: auto; }
.sheet { color-scheme: light; background: #fff; color: #000; margin: 0 auto; font-size: 10.5px; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.sheet.p-a5 { width: 210mm; min-height: 148mm; padding: 7mm; }
.sheet.p-a4 { width: 210mm; min-height: 297mm; padding: 7mm; }
.sheet.p-t80 { width: 80mm; padding: 2mm; }

/* ---------- sync status (Windows app only) ---------- */
.sync { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); color: var(--ink-2); }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync.off::before { background: var(--warn); }
.sync.late { color: var(--bad); } .sync.late::before { background: var(--bad); }
