/* The desktop look: dense, quiet, keyboard-first.
 *
 * A chemist's counter is not a phone. Rows are tight enough that a shelf fits
 * on one screen, type is small but not thin, and nothing bounces or floats
 * over the thing being read. Colour is used for meaning only — an expiry that
 * matters, a stock that has run out — never for decoration. */

* { box-sizing: border-box; }

/* `hidden` has to win.
 *
 * The attribute only asks for `display: none` through the browser's own
 * stylesheet, so ANY rule of ours that sets display — `.shell{display:flex}`,
 * `.signin{display:grid}` — quietly beats it. Both screens then existed at
 * once, stacked: sign in at the top, the counter below it, and the shop
 * scrolled down to find its own app. */
[hidden] { display: none !important; }

:root {
  --bg:        #f4f6fa;
  --surface:   #ffffff;
  --line:      #e3e7ef;
  --ink:       #1c2333;
  --muted:     #6b7280;
  --accent:    #0f766e;   /* pharmacy green, not the retail blue */
  --accent-dk: #115e59;
  --danger:    #b91c1c;
  --warn:      #b45309;
  --row-alt:   #fafbfd;
  --font: 12.5px/1.45 "Segoe UI", system-ui, sans-serif;
}

/* The app is a window, not a document.
 *
 * Nothing scrolls the PAGE — each screen scrolls inside its own frame, so the
 * sidebar and the toolbar stay where the hand expects them. Without this the
 * whole shell grew past the viewport and the sidebar scrolled away with the
 * content, which is what “the design breaks when I scroll” was. */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font: var(--font);
  color: var(--ink);
  background: var(--bg);
}

/* The window is a column: the app's own title bar takes its height, and
 * whatever is under it takes the rest.
 *
 * Flex rather than `calc(100% - 34px)` on each screen, because there are two
 * screens under the bar and a third would have to remember the number. The
 * bar's height is declared once, on the bar. */
body { display: flex; flex-direction: column; }
body > .signin, body > .shell { flex: 1 1 auto; min-height: 0; }

/* ── Sign in ──────────────────────────────────────────────────────── */
.signin {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  padding: 26px;
  background:
    radial-gradient(1100px 520px at 12% 0%, #14877d 0%, transparent 62%),
    linear-gradient(160deg, #0f766e 0%, #0d3f3b 100%);
}

.card {
  width: 360px;
  background: var(--surface);
  border-radius: 10px;
  padding: 28px 26px 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.card h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.card h1 span { color: var(--accent); }
.card .sub { margin: 6px 0 20px; color: var(--muted); font-size: 12.5px; }

.card label {
  display: block;
  margin: 12px 0 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.card input {
  width: 100%;
  padding: 10px 11px;
  font: var(--font);
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}
.card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

/* A button is the size of its own words. Filling the width is something a
 * particular place asks for — the sign-in card, the Save on a bill — not
 * something every primary-coloured button should inherit. */
.primary {
  padding: 9px 16px;
  font: var(--font);
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.card .primary { width: 100%; margin-top: 18px; padding: 11px; font-size: 14px; }
.primary:hover { background: var(--accent-dk); }
.primary:disabled { opacity: .6; cursor: default; }

.error {
  margin: 14px 0 0;
  padding: 9px 11px;
  font-size: 12.5px;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.fineprint { margin: 14px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ── The counter ──────────────────────────────────────────────────── */
.shell { display: flex; height: 100%; min-height: 0; overflow: hidden; position: relative; }

/* The rail, closed and open. Two numbers, named once, because THREE rules have
 * to agree on the closed width — the rail, the margin that keeps the work
 * clear of it, and the padding that centres the icons in it. They were
 * literals in an earlier draft and one of them drifted. */
:root { --rail: 54px; --rail-open: 206px; }

/* Taken out of the flex flow deliberately. As a flex item it would widen by
 * pushing, and every table on the right would reflow each time the cursor
 * crossed the left edge — a whole screen twitching to reveal six words. */
.side {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #0f2a2a;
  color: #cbd5d1;
  transition: width .18s cubic-bezier(.22, .61, .36, 1), box-shadow .18s ease;
}
.side:hover, .side:focus-within {
  width: var(--rail-open);
  box-shadow: 5px 0 22px rgba(0, 0, 0, .32);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0 11px 12px;
  font-size: 14px;
  white-space: nowrap;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand b { color: #5eead4; }
/* The one thing that stays legible at 54px: the shop is looking at Bilzy. */
.brand .mark {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #06302c;
  background: #5eead4;
  border-radius: 8px;
}
.brand .word { transition: opacity .14s ease; }

/* Words appear when the rail does. They are not display:none — fading keeps
 * the row from jumping as the width animates past them. */
.side:not(:hover):not(:focus-within) .brand .word,
.side:not(:hover):not(:focus-within) .nav > span,
.side:not(:hover):not(:focus-within) .nav.grp .ico:last-child,
.side:not(:hover):not(:focus-within) .shop,
.side:not(:hover):not(:focus-within) .side-foot .link { opacity: 0; }

/* A folded group's children have nowhere to go in a 54px rail — indented
 * icons under an icon read as a second list, not as a group. */
.side:not(:hover):not(:focus-within) .subs { display: none; }

/* The sidebar's own rules live in nav.css, with the icons and groups. */

.side-foot {
  padding: 8px 0 10px;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
/* Who is signed in, and the way back to their own page. */
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 0 6px 12px;
  font: var(--font);
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.me:hover { background: rgba(255, 255, 255, .06); }
.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #06302c;
  background: #cbd5d1;
  border-radius: 50%;
}
/* With a logo on it there is no letter to centre, and the picture fills the
 * mark rather than sitting in a tinted circle. */
.avatar.haslogo, .hmark.haslogo {
  background-color: #fff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.shop {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  color: #fff;
  text-overflow: ellipsis;
  transition: opacity .14s ease;
}
.link {
  padding: 0;
  font: var(--font);
  font-size: 11.5px;
  color: #5eead4;
  background: none;
  border: 0;
  cursor: pointer;
  transition: opacity .14s ease;
}
.side-foot .link { margin-left: 52px; }

/* min-height: 0 is what stops this growing past the window: a flex item
 * defaults to min-height: auto and so refuses to shrink below its own content,
 * which pushed the whole shell — sidebar and all — off the bottom.
 *
 * And it SCROLLS rather than clips. Most screens scroll inside themselves
 * (.tablewrap, .formwrap, .set-pane), but clipping here meant any screen that
 * did not could not be scrolled at all — worse than the problem. This is the
 * net under all of them; the page itself still never moves. */
.main {
  flex: 1;
  /* The rail floats above this, so the work is held clear of it by a margin
   * rather than by the sidebar's own width. */
  margin-left: var(--rail);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* ── Every working screen is a page in a register ────────────────────
 *
 * The billing voucher was made to look like the program a chemist has kept
 * books in for fifteen years — a titled page, a boxed head, a ruled grid — and
 * then he clicked "Expiry" and landed on a web page. The shelf, the reports,
 * the expiry list and the reorder list are the same kind of document as the
 * voucher, so they are drawn the same way: one navy band saying what the page
 * is, one flat toolbar under it, and ruled paper below that.
 *
 * All of it hangs off the three pieces of furniture those eleven screens
 * already shared — the band, the toolbar and the grid — so this is one look
 * rather than eleven copies of one. */

/* The band: what this page is, what is on it, and the context on the right.
 * Three columns, the middle one centred, exactly as the voucher's own head. */
.pg-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  color: #fff;
  background: #102450;
  border-bottom: 2px solid #ffd479;
}
.pg-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #ffd479;
  white-space: nowrap;
}
.pg-sub { font-size: 12px; color: rgba(255, 255, 255, .82); }
.pg-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .62);
  text-align: right;
  white-space: nowrap;
}
/* Out of a drill-down. On the band rather than above the table, because that
 * is where the page says what it is — and a party's own page IS a different
 * page, not a filter somebody has to remember they applied. */
.pg-back {
  padding: 3px 10px;
  font: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  color: #ffd479;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 212, 121, .4);
  border-radius: 3px;
  cursor: pointer;
}
.pg-back:hover { background: rgba(255, 255, 255, .2); }

/* The toolbar under it. Flat and greyed like a program's own — the same strip
 * the billing style switch uses, so the two screens are plainly one app. */
.topbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  background: linear-gradient(#fbfcfe, #eef1f6);
  border-bottom: 1px solid #cdd5e2;
}
/* Nothing in a toolbar grows except the thing being typed into. */
.topbar > button { flex: 0 0 auto; }

.topbar input {
  flex: 1;
  padding: 8px 11px;
  font: var(--font);
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}
.topbar input:focus { outline: none; border-color: var(--accent); background: #fff; }

.count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.ghost {
  padding: 5px 12px;
  font: var(--font);
  font-size: 12.5px;
  color: var(--ink);
  background: linear-gradient(#ffffff, #eef1f6);
  border: 1px solid #c3ccdb;
  border-radius: 3px;
  cursor: pointer;
}
.ghost:hover { background: linear-gradient(#ffffff, #e3e9f2); }

/* The search box on the shelf sits in that toolbar, so it is square too. */
.topbar input {
  border-radius: 3px;
  border-color: #c3ccdb;
}

/* ── The shelf ────────────────────────────────────────────────────── */
/* Ruled paper. The lines are on the WRAPPER and the table is opaque over
 * them, so they show only in the space below the last row — a list of three
 * medicines still sits on a page instead of stopping in mid-air. Drawing them
 * as filler rows instead would have meant touching eleven screens and getting
 * the row height to agree in all of them. */
.tablewrap {
  flex: 1;
  overflow: auto;
  background: repeating-linear-gradient(to bottom, transparent 0 28px, #eceff5 28px 29px);
}
.tablewrap > .grid, .tablewrap > table { background: var(--surface); }

/* The month's return, offered where the month's GST is being read. */
.r-files {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.r-files-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.r-files-b { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.r-files .foot-note { margin: 0; }

.grid { width: 100%; border-collapse: collapse; }

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  color: #21365e;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #dfe6f2;
  border-bottom: 1px solid #b9c6dd;
}

/* Same rule as the bill: a figure's heading goes over the figure. */
.grid thead th.num { text-align: right; }

.grid td {
  padding: 6px 10px;
  border-bottom: 1px solid #eceff5;
  vertical-align: top;
}
/* Columns separated. A register is read ACROSS a row — which supplier, which
 * batch, which figure — and a table with no vertical rules is read down. */
.grid th + th, .grid td + td { border-left: 1px solid #eef1f6; }
/* No zebra: ruling and banding are two ways of saying the same thing, and
 * together they are noise. */
.grid tbody tr:hover { background: #fff6d8; }

/* A row that leads somewhere. Everything on these screens that names a real
 * thing — a bill, a medicine, a party — opens it, because a report you can
 * only read is a report you then go and look the row up from by hand. */
.grid tbody tr.pick { cursor: pointer; }
.grid tbody tr.pick:hover { background: #fff6d8; box-shadow: inset 3px 0 0 #d8a800; }
.grid tbody tr.pick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* Says so, quietly, on the row under the cursor. */
.grid tbody tr.pick td:last-child { position: relative; }
.grid tbody tr.pick:hover td:last-child::after {
  content: '›';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 700;
  color: #d8a800;
}

/* The H1 register is ten columns wide, and the last of them is the quantity
 * supplied — the one figure the whole register exists to record. Left to size
 * itself, the address column takes whatever room it likes and pushes that
 * figure past the right edge, which is the same fault that cut AMOUNT off the
 * invoice. The columns that have a known size are given it; the four that
 * carry names and addresses share what is left. */
.h1reg { table-layout: fixed; }
.h1reg td { overflow-wrap: anywhere; }
.h1reg th:nth-child(1),  .h1reg td:nth-child(1)  { width: 48px; }   /* Sl.    */
.h1reg th:nth-child(2),  .h1reg td:nth-child(2)  { width: 88px; }   /* Date   */
.h1reg th:nth-child(3),  .h1reg td:nth-child(3)  { width: 96px; }   /* Bill   */
.h1reg th:nth-child(4),  .h1reg td:nth-child(4)  { width: 50px; }   /* Sch.   */
.h1reg th:nth-child(9),  .h1reg td:nth-child(9)  { width: 96px; }   /* Batch  */
.h1reg th:nth-child(10), .h1reg td:nth-child(10) { width: 92px; }   /* Qty    */

.num { text-align: right; }
.w-name  { width: 34%; }
.w-pack  { width: 10%; }
.w-batch { width: 14%; }
.w-rack  { width: 8%; }

/* A rack number is read at a glance while walking to the shelf. */
.rack {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #115e59;
  background: #eefaf7;
  border: 1px solid #cdeee7;
  border-radius: 5px;
}
.w-exp   { width: 12%; }

.name { font-weight: 600; }
.salt { font-size: 11px; color: var(--muted); }

/* Stock and expiry are the two things a chemist scans for; they are the only
 * places colour is spent. */
.out  { color: var(--danger); font-weight: 700; }
.low  { color: var(--warn);   font-weight: 700; }
.soon { color: var(--warn);   font-weight: 700; }
.gone { color: var(--danger); font-weight: 700; }

.muted { color: var(--muted); }

.empty { padding: 26px 14px; color: var(--muted); text-align: center; }

/* The code a counter types instead of a name. */
.salt .code { color: var(--accent); font-weight: 700; }
/* The molecule, told apart from the company beside it. A chemist looking for
 * a substitute is reading this and nothing else on the row. */
.salt .comp { color: var(--accent); font-weight: 600; }

/* Yesterday's figures, said out loud. The colour is a warning's, because old
   numbers read as today's are how a shop trusts a report it should not. */
.stale-note {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #7a4e00;
  background: #fff4e5;
  border-bottom: 1px solid #f0d9b5;
}

/* ── The desktop tightening ───────────────────────────────────────────
   "Screen website ki tarah hai" — and the tells were exactly these: pill
   chips, floating rounded cards, airy paddings. A program a chemist sits in
   for eight hours reads better squared-off and dense, the way the register
   software this replaces always was. One override layer, so the whole look
   can be tuned — or reverted — in one place while the shop watches. */
.chip, .sug, .batch-row, .modal, .entry > input, .cust input,
.pu-party input, .pu-tot input, .pu-pay input,
.totals .grand, .totals input, .cell, .save, .primary, .ghost {
  border-radius: 3px;
}
.suggest { border-radius: 0 0 4px 4px; }
.bill td { padding: 1px 8px; }
.bill thead th { padding: 4px 8px; }
.sug { padding: 5px 11px; }
.batch-row { padding: 7px 10px; }
.entry { padding: 4px 8px; }
.totals { padding: 5px 10px; }

/* ── Narrower than a desktop ──────────────────────────────────────
 *
 * The furniture every working screen shares. A toolbar that cannot wrap
 * pushes its own buttons off the right-hand edge, which is where Refresh and
 * the export buttons were going on a laptop — present, reachable by nobody. */
@media (max-width: 1080px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar input { flex: 1 1 200px; }
  /* The band's middle line is the first thing worth losing: the page still
   * says what it is, and the context on the right is usually a date. */
  .pg-head { grid-template-columns: auto 1fr auto; gap: 8px; padding: 6px 10px; }
  .pg-sub { display: none; }
}

@media (max-width: 820px) {
  .pg-note { display: none; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 8px; }
  /* A grid narrower than its columns scrolls inside its own frame rather than
   * squeezing every figure into two characters. */
  .tablewrap > .grid { min-width: 680px; }
}

/* Creating a shop from the counter.
 *
 * There was no way to do it from this app at all: a chemist handed a Windows
 * installer had to find a phone, install the app there, register on it, and
 * come back — a step most people do not take on the day they are shown the
 * software. Same card, one column wider where two boxes belong side by side. */
#signupForm { width: 430px; }
.card .two { display: flex; gap: 12px; }
.card .two > * { flex: 1 1 0; min-width: 0; }

.card .otp-row { display: flex; gap: 8px; align-items: stretch; }
.card .otp-row input { flex: 1 1 auto; min-width: 0; }
.card .otp-row .ghost {
  flex: 0 0 auto;
  padding: 0 13px;
  font: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: #f1faf8;
  border: 1px solid #cfe9e4;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.card .otp-row .ghost:hover { background: #e6f5f2; }
.card .otp-row .ghost:disabled { opacity: .55; cursor: default; }

/* The parts of a bill that can wait. A shop being set up in front of a
 * customer should not be held up by a drug licence number nobody has to
 * hand — it goes in Settings later, and the bill says so until it does. */
.card .more { margin-top: 14px; }
.card .more summary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.card .more summary span { font-weight: 400; color: var(--muted); }
.card .more[open] summary { margin-bottom: 4px; }

.card .swap {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.card .swap button {
  padding: 0;
  font: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* The number to ring. On the sign-in screen because a shop that cannot get
 * in cannot reach any other part of the app to find it. */
.card .helpline {
  margin: 12px 0 0;
  padding-top: 11px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}
.card .helpline b { color: var(--ink); font-size: 13px; letter-spacing: .01em; }

.card .fineprint.ok { color: #15803d; font-weight: 600; }

@media (max-height: 720px) {
  .card { padding: 18px 22px 16px; }
  .card .sub { margin-bottom: 12px; }
  .card label { margin-top: 8px; }
}
@media (max-width: 480px) {
  #signupForm, .card { width: 100%; }
  .card .two { flex-direction: column; gap: 0; }
}

/* ── The window's own bar ────────────────────────────────────────────
 *
 * Windows' title bar is switched off, so this is the only one. It has to earn
 * the 34 pixels: the app's name, the shop's name beside it — which is how two
 * machines are told apart on the phone — and the three buttons where Windows
 * has always put them, at the sizes Windows uses, because muscle memory does
 * not care whose bar it is.
 *
 * `-webkit-app-region` is what lets the window be dragged by it, and the
 * buttons opt back out or they would drag instead of click. */
.titlebar {
  position: relative;
  z-index: 80;
  display: flex;
  align-items: stretch;
  height: 34px;
  flex: 0 0 34px;
  background: #0b3b37;
  color: #d8ece9;
  user-select: none;
  -webkit-user-select: none;
}
.tb-drag {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-left: 10px;
  -webkit-app-region: drag;
}
.tb-mark { width: 17px; height: 17px; opacity: .95; flex: 0 0 17px; }
.tb-shop {
  min-width: 0;
  font-size: 12px;
  color: #8fc3bd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-right { display: flex; align-items: stretch; -webkit-app-region: no-drag; }

/* 46 × 34 is what Windows itself uses. A close button that is nearly the
 * right size is worse than one that is plainly different. */
.tb-btn, .tb-menu {
  width: 46px;
  display: grid;
  place-items: center;
  color: #d8ece9;
  background: none;
  border: 0;
  cursor: pointer;
}
.tb-menu { width: 38px; font-size: 17px; line-height: 1; }
.tb-dots { display: block; margin-top: -2px; }
.tb-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.tb-btn:hover, .tb-menu:hover { background: rgba(255, 255, 255, .12); }
/* Red only on the one that ends the day. */
.tb-btn.close:hover { color: #fff; background: #c42b1c; }

.tb-pop {
  position: fixed;
  top: 34px;
  right: 8px;
  z-index: 90;
  min-width: 210px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
}
.tb-pop button {
  display: block;
  width: 100%;
  padding: 8px 11px;
  font: var(--font);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.tb-pop button:hover { background: var(--bg); }

/* Help, About, and the update offer — one box, three uses. */
.tb-back {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 16, 32, .55);
}
.tb-box {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px 24px 18px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, .28);
}
.tb-box h3 { margin: 0 0 4px; font-size: 17px; }
.tb-lead { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.tb-num {
  padding: 13px;
  text-align: center;
  background: #f1faf8;
  border: 1px solid #cfe9e4;
  border-radius: 9px;
}
.tb-num b { display: block; font-size: 24px; font-weight: 800; letter-spacing: .01em; }
.tb-num span { font-size: 11.5px; color: var(--muted); }
.tb-list { margin: 14px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink); }
.tb-list li { margin-bottom: 6px; }
.tb-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 13px; }
.tb-facts dt { color: var(--muted); }
.tb-facts dd { margin: 0; font-weight: 600; }
.tb-fine { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }
.tb-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* What changed, from the manifest — so "update now" is a decision and not a
 * leap. */
.up-notes {
  max-height: 190px;
  overflow: auto;
  margin: 0 0 12px;
  padding: 10px 13px;
  font-size: 12.5px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 7px 7px 0;
}
.up-notes p { margin: 0 0 5px; }
.up-notes p:last-child { margin: 0; }

.up-bar {
  height: 7px;
  margin: 12px 0 6px;
  overflow: hidden;
  background: var(--line);
  border-radius: 4px;
}
.up-bar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s; }
/* No content-length in the header: a moving stripe rather than a percentage
 * that would be a guess. */
.up-bar.unknown i {
  width: 100% !important;
  background: repeating-linear-gradient(90deg, var(--accent) 0 12px, #6cc6bd 12px 24px);
  animation: upslide 1s linear infinite;
}
@keyframes upslide { from { background-position: 0 0; } to { background-position: 24px 0; } }
.up-say { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* The two screens under the bar keep their own layout; the height comes from
 * the column above. `height: 100%` on either would be 100% of the BODY, which
 * includes the bar — so the app would run 34px off the bottom of the window. */
.signin { height: auto; }
.shell { height: auto; }

/* ── The sign-in panel ───────────────────────────────────────────────
 *
 * Two halves of one sheet: what this program is on the left, the boxes on the
 * right. The left is not decoration — a chemist who has just run an installer
 * and is looking at a login box has no other way of telling what they have
 * got, and somebody locked out cannot reach a helpline that lives inside the
 * app. */
.signin { gap: 0; }
.signside, .signmain {
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.signside {
  width: 340px;
  flex: 0 0 340px;
  justify-content: space-between;
  padding: 30px 28px;
  color: #d7ece9;
  background: rgba(4, 34, 31, .42);
  border: 1px solid rgba(255, 255, 255, .13);
  border-right: 0;
  border-radius: 10px 0 0 10px;
}
.ss-top { display: flex; align-items: flex-start; gap: 12px; }
.ss-mark { width: 34px; height: 34px; flex: 0 0 34px; }
.ss-top h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
}
.ss-top p {
  margin: 1px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .09em;
  color: #7fc0b9;
  text-transform: uppercase;
}
.ss-what {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b8dbd6;
}
.ss-what li { position: relative; margin-bottom: 11px; padding-left: 18px; }
.ss-what li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  background: #4fb3a6;
  border-radius: 2px;
}
.ss-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.ss-help { font-size: 11px; letter-spacing: .05em; color: #7fc0b9; text-transform: uppercase; }
.ss-help b {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  letter-spacing: 0;
  color: #fff;
  text-transform: none;
}
.ss-ver { font-size: 11px; color: #6ba9a2; white-space: nowrap; }

/* The right half holds whichever card is showing. Both are the same width,
 * so switching between them does not move the panel. */
.signmain {
  width: 420px;
  flex: 0 0 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 0 10px 10px 0;
}
.signin .card {
  width: 100%;
  padding: 30px 32px 24px;
  background: none;
  border-radius: 0;
  box-shadow: none;
}
#signupForm { width: 100%; }
.signin .card h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.signin .card .sub { margin: 5px 0 16px; }

/* A placeholder is a hint, and it was reading as an answer.
 *
 * "Rehman Medical Store" sitting in a box, in the same colour as typed text,
 * on a screen a real shop is filling in — several people will have assumed it
 * was already filled and moved past it. Now every one of them says what to
 * type, in a colour no typed value has. */
.card input::placeholder {
  color: #a9b3c4;
  opacity: 1;                 /* Firefox dims placeholders again on top of the colour */
  font-weight: 400;
}
.card input { font-weight: 500; }

/* Squarer and denser than a web form. A desktop field is read in a column
 * with five others, not tapped one at a time. */
.signin .card input {
  padding: 8px 10px;
  font-size: 13.5px;
  border-radius: 5px;
}
.signin .card label { margin: 11px 0 4px; font-size: 11px; }
.signin .card .primary { width: 100%; margin-top: 16px; padding: 10px; border-radius: 6px; }

@media (max-width: 900px), (max-height: 620px) {
  /* No room for the panel: the boxes are what matter, so the left half goes
   * and the right one keeps its corners. */
  .signside { display: none; }
  .signmain { border-radius: 10px; flex: 0 1 420px; }
}

/* The number to ring, on the bar itself.
 *
 * Our own name used to sit here — across the top of a program that is already
 * plainly ours: the installer said so, the icon says so, and the sign-in panel
 * says so twice. That space is better spent on the one thing a shop might
 * want at a glance and cannot otherwise find without opening a menu. */
.tb-help {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font: var(--font);
  color: #cfe6e2;
  background: none;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, .12);
  cursor: pointer;
  white-space: nowrap;
}
.tb-help:hover { background: rgba(255, 255, 255, .1); }
.tb-hl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #7fb8b1;
  text-transform: uppercase;
}
.tb-help b { font-size: 12.5px; font-weight: 700; letter-spacing: .01em; color: #fff; }
/* The shop's name is the label now, so it carries the weight our name had. */
.tb-shop { font-size: 12.5px; font-weight: 700; color: #eaf5f3; }

@media (max-width: 860px) {
  /* The number goes before the buttons do. */
  .tb-help .tb-hl { display: none; }
}
@media (max-width: 700px) {
  .tb-help { display: none; }
}

/* One saved bill, opened — what was on it, and the three things to do with it.
 *
 * Clicking a row used to go straight to the printer, which answers a question
 * nobody asked: what a chemist wants from a bill three weeks old is nearly
 * always "what was on it". */
.sv-back {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 16, 32, .55);
}
.sv-box {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: 92vh;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .3);
}
.sv-head {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.sv-head h3 { margin: 0; font-size: 18px; }
.sv-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.sv-who { text-align: right; padding-right: 34px; }
.sv-who b { display: block; font-size: 14px; }
.sv-who span { display: block; font-size: 12px; color: var(--muted); }
.sv-x {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.sv-x:hover { color: var(--ink); background: var(--bg); }

.sv-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 11px 22px 0; }
.sv-tag {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.sv-tag.paid { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.sv-tag.credit { color: #b45309; background: #fff7ed; border-color: #fed7aa; }
.sv-tag.due { color: #fff; background: var(--danger); border-color: var(--danger); }
.sv-tag.back { color: var(--danger); background: #fff1f1; border-color: #fecaca; }

.sv-wrap { flex: 1; overflow: auto; padding: 12px 22px 0; min-height: 0; }
.sv-items td, .sv-items th { white-space: nowrap; }
.sv-items td:nth-child(2) { white-space: normal; }

.sv-sums { padding: 12px 22px 0; margin-left: auto; width: 300px; }
.sv-sums div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.sv-sums .grand {
  margin-top: 5px;
  padding-top: 8px;
  font-size: 16px;
  font-weight: 700;
  border-top: 2px solid var(--ink);
}

.sv-acts {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 22px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.sv-acts .spacer { flex: 1; }
.sv-say { font-size: 12px; color: var(--muted); }
.sv-say.bad { color: var(--danger); }
.ghost.danger { color: var(--danger); border-color: #fecaca; }
.ghost.danger:hover { background: #fff1f1; }

/* The three buttons at the end of a history row. Print is most of what
 * anybody wants from an old bill, and opening it first was a click too many. */
td.rowacts { white-space: nowrap; text-align: right; }
.ract {
  padding: 3px 7px;
  margin-left: 2px;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  opacity: .55;
}
tr:hover .ract, tr:focus-within .ract { opacity: 1; }
.ract:hover { color: var(--ink); background: var(--bg); border-color: var(--line); }
.ract.del:hover { color: var(--danger); background: #fff1f1; border-color: #fecaca; }
