/* ==========================================================================
   Panel styles (login, admin panel, shopkeeper panel)

   The look is a shop's bill book: white paper sheets lying on a counter,
   ledger ruling in the tables, and every order shown as a slip (पर्ची)
   with a rubber stamp for its status.

   To re-colour everything, change the values under :root below.
   ========================================================================== */

/* ---------- fonts: bundled with the app, SIL Open Font License (see fonts/) ---------- */
@font-face {
  font-family: "Mukta"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/mukta-devanagari-400-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: "Mukta"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/mukta-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Mukta"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/mukta-devanagari-600-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: "Mukta"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/mukta-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Baloo 2"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/baloo-2-devanagari-700-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: "Baloo 2"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/baloo-2-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- colours and type ---------- */
:root {
  --counter: #e9edf4;      /* the counter the papers lie on: page background */
  --paper: #ffffff;        /* bill paper */
  --paper-shade: #f5f7fb;  /* table headings, dialog footers */
  --ink: #16213b;          /* pen ink: main text */
  --ink-soft: #4f5c77;     /* secondary text */
  --pen: #1e46b4;          /* ballpoint blue: buttons, links */
  --pen-dark: #17378f;
  --pen-wash: #e6ecfb;
  --cover: #14275c;        /* bill-book cover: top bar and side menu */
  --rule: #c3cee2;         /* ledger ruling */
  --rule-soft: #dfe5f0;
  --margin: #e58a98;       /* the red margin line of a ledger page */
  --stamp: #c4262e;        /* rubber-stamp red: cancel, errors, new-order count */
  --stamp-wash: #fbe9ea;
  --carbon: #fde4ec;       /* pink duplicate copy: orders waiting to be accepted */
  --carbon-edge: #f2b4c6;
  --marker: #ffef9f;       /* yellow highlighter: stock running low */
  --leaf: #1a7a46;         /* green stamp: delivered, switched on */
  --leaf-wash: #e3f3ea;

  --display: "Baloo 2", "Mukta", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", system-ui, sans-serif;
  --text: "Mukta", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", "Mangal", system-ui, sans-serif;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--counter);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
strong, b { font-weight: 600; }
a { color: var(--pen); }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

.title { font-family: var(--display); font-weight: 700; font-size: 1.625rem; line-height: 1.25; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.1875rem; line-height: 1.3; }
.sub { color: var(--ink-soft); }
.title + .sub { margin-top: 2px; }
.hint { display: block; font-size: .875rem; line-height: 1.45; color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }
.ic { flex: none; display: block; }

/* ---------- shopkeeper panel frame: side menu on wide screens, bar + dock on phones ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.side { display: none; }

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 2px;
  padding: 8px 6px 8px 16px;
  background: var(--cover); color: #fff;
}
.bar-title { flex: 1; min-width: 0; }
.bar-title strong {
  display: block;
  font-family: var(--display); font-weight: 700; font-size: 1.125rem; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-title span {
  display: block; font-size: .8125rem; line-height: 1.35; color: #c5cfec;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-btn {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: none; color: #fff;
}
.bar-btn:hover, .bar-btn.active { background: rgba(255, 255, 255, .15); }
.bar-btn:focus-visible { outline-color: #fff; }

main { padding: 16px 0 96px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.dock button {
  position: relative;
  display: grid; justify-items: center; align-content: center; gap: 1px;
  min-height: 58px; padding: 7px 2px 6px;
  border: 0; background: none;
  color: var(--ink-soft); font-size: .75rem; line-height: 1.3;
}
.dock button.active { color: var(--pen); font-weight: 600; }
.dock button.active::before {
  content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 3px;
  background: var(--pen); border-radius: 0 0 3px 3px;
}
.dock button:focus-visible { outline-offset: -3px; }

.pip {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--stamp); color: #fff;
  font-size: .8125rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.dock .pip { position: absolute; top: 4px; left: 50%; margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px; font-size: .6875rem; }

.gutter { padding-left: 16px; padding-right: 16px; }
.tab { display: none; }
.tab.active { display: block; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }

@media (min-width: 1000px) {
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    padding: 22px 12px 14px;
    background: var(--cover); color: #fff;
    overflow-y: auto;
  }
  .bar, .dock { display: none; }
  main { padding: 28px 32px 56px; max-width: 1100px; }
  .gutter { padding-left: 0; padding-right: 0; }
  .title { font-size: 1.75rem; }
}

.side-brand { padding: 0 10px 18px; margin-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, .16); }
.side-brand .app { font-size: .875rem; color: #b9c6ea; }
.side-brand .shop { font-family: var(--display); font-weight: 700; font-size: 1.3125rem; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.side-brand .bot { font-size: .875rem; line-height: 1.4; color: #c5cfec; margin-top: 3px; overflow-wrap: anywhere; }
.side-nav { display: grid; gap: 2px; }
.side-nav button, .side-foot button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: 0; border-radius: 8px; background: none;
  color: #dbe2f6; text-align: left;
}
.side-nav button:hover, .side-foot button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-nav button.active { background: var(--paper); color: var(--ink); font-weight: 600; }
.side-nav button:focus-visible, .side-foot button:focus-visible { outline-color: #fff; }
.side-nav .pip { margin-left: auto; }
.side-foot { margin-top: auto; padding-top: 12px; }

/* ---------- admin panel frame ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--cover); color: #fff;
}
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.topbar-title strong { font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.3; }
.topbar-title span { font-size: .875rem; color: #c5cfec; }
main.admin-main { padding-bottom: 48px; margin: 0 auto; }
@media (min-width: 1000px) { .topbar { padding: 12px 32px; } }

/* ---------- paper sheets ---------- */
.sheet {
  background: var(--paper);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 16px;
  margin-bottom: 12px;
}
.sheet.flush { padding: 0; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px 10px; }
@media (min-width: 1000px) {
  .sheet { border: 1px solid var(--rule); border-radius: 6px; padding: 20px 22px; margin-bottom: 18px; overflow: hidden; }
  .sheet-head { padding: 16px 22px 12px; }
}

/* today's figures, ruled like the head of a ledger page */
.hisab { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule-soft); }
.hisab.top { border-top: 0; }
.hisab > div { padding: 12px 16px 12px; border-bottom: 1px solid var(--rule-soft); }
.hisab > div:nth-child(odd) { border-right: 1px solid var(--rule-soft); }
.hisab > div:nth-last-child(-n+2) { border-bottom: 0; }
.hisab dt { font-size: .875rem; line-height: 1.4; color: var(--ink-soft); }
.hisab dd { font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1.25; }
@media (min-width: 720px) {
  .hisab { grid-template-columns: repeat(4, 1fr); }
  .hisab > div { padding: 14px 22px; border-bottom: 0; border-right: 1px solid var(--rule-soft); }
  .hisab > div:last-child { border-right: 0; }
  .hisab dd { font-size: 2rem; }
}

/* a strip of pink duplicate paper: orders waiting for the shopkeeper */
.carbon-strip {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px; margin-bottom: 12px;
  border: 0; border-top: 1px solid var(--carbon-edge); border-bottom: 1px solid var(--carbon-edge);
  background: var(--carbon); color: var(--ink); text-align: left;
}
.carbon-strip .say { flex: 1; min-width: 0; }
.carbon-strip .say strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1.125rem; line-height: 1.3; }
.carbon-strip .go { flex: none; color: var(--pen-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 1000px) { .carbon-strip { border: 1px solid var(--carbon-edge); border-radius: 6px; margin-bottom: 18px; padding: 14px 22px; } }

/* ruled rows */
.ledger > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--rule-soft); }
.ledger .grow { flex: 1; min-width: 0; }
.ledger .name { font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 1000px) { .ledger > li { padding: 12px 22px; } }

.mark { background: linear-gradient(transparent 14%, var(--marker) 14%, var(--marker) 90%, transparent 90%); padding: 0 4px; margin: 0 -2px; border-radius: 2px; }

/* ---------- ledger tables ---------- */
.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th {
  padding: 10px 14px;
  background: var(--paper-shade);
  border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule);
  font-size: .875rem; font-weight: 600; color: var(--ink-soft); text-align: left; white-space: nowrap;
}
.ledger-table td { padding: 12px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.ledger-table tbody tr:last-child td { border-bottom: 0; }
.ledger-table .num { text-align: right; white-space: nowrap; }
.ledger-table .amt-col { border-left: 1px solid var(--margin); }
.ledger-table tr.is-off td { color: var(--ink-soft); }
.ledger-table .name { font-weight: 600; overflow-wrap: anywhere; }
.ledger-table small { display: block; font-size: .875rem; line-height: 1.45; color: var(--ink-soft); overflow-wrap: anywhere; }
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ledger-table a[href^="tel:"] { white-space: nowrap; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; }
@media (min-width: 1000px) {
  .ledger-table th:first-child, .ledger-table td:first-child { padding-left: 22px; }
  .ledger-table th:last-child, .ledger-table td:last-child { padding-right: 22px; }
}
@media (max-width: 719px) {
  .ledger-table, .ledger-table tbody { display: block; }
  .ledger-table thead { display: none; }
  .ledger-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--rule-soft); }
  .ledger-table tbody tr:last-child { border-bottom: 0; }
  .ledger-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .ledger-table td.wide { grid-column: 1 / -1; }
  .ledger-table td.blank { display: none; }
  .ledger-table td[data-label]::before { content: attr(data-label); display: block; font-size: .8125rem; line-height: 1.4; color: var(--ink-soft); }
  .ledger-table .num { text-align: left; }
  .ledger-table .amt-col { border-left: 0; }
  .cell-actions { justify-content: flex-start; flex-wrap: wrap; }

  /* rate list: name on the left, rate and stock on the right, like a rate board */
  .ledger-table.rates tr, .ledger-table.buys tr { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; }
  .rates td[data-label]::before, .buys td[data-label]::before { content: none; }
  .rates .c-name { grid-column: 1; grid-row: 1 / span 2; }
  .rates .c-rate { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
  .rates .c-rate small { display: inline; margin-left: 4px; font-weight: 400; }
  .rates .c-stock { grid-column: 2; grid-row: 2; text-align: right; font-size: .9375rem; }
  .rates td.c-stock::before { content: "स्टॉक "; display: inline; font-size: inherit; color: var(--ink-soft); }
  .rates .c-bot { display: none; }
  .rates .c-actions { grid-column: 1 / -1; grid-row: 3; margin-top: 10px; }

  /* purchase record: item and quantity first, date and cost under them */
  .buys .c-name { grid-column: 1; grid-row: 1; }
  .buys .c-qty { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
  .buys .c-when { grid-column: 1; grid-row: 2; font-size: .875rem; color: var(--ink-soft); }
  .buys .c-cost { grid-column: 2; grid-row: 2; text-align: right; font-size: .875rem; color: var(--ink-soft); }
  .buys td.c-cost::before { content: "खरीद रेट "; display: inline; font-size: inherit; }
  .buys .c-note { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; font-size: .875rem; color: var(--ink-soft); }
}


/* ---------- order slips (पर्ची) ---------- */
.slips { display: grid; grid-template-columns: 1fr; gap: 26px 18px; align-items: start; padding: 4px 16px 10px; }
@media (min-width: 720px) { .slips { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); } }
@media (min-width: 1000px) { .slips { padding-left: 0; padding-right: 0; } }

.slip {
  --slip: var(--paper);
  position: relative;
  padding: 18px 16px 12px;
  background: var(--slip);
  border-radius: 3px 3px 0 0;
  filter: drop-shadow(0 1px 1.5px rgba(22, 33, 59, .24));
}
/* punched holes where the slip was torn from the book */
.slip::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: radial-gradient(circle at 50% 0, var(--hole, var(--counter)) 3.1px, transparent 3.6px) 3px 0 / 14px 5px repeat-x;
}
/* torn zigzag edge */
.slip::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 7px;
  background: conic-gradient(from -45deg at 50% 100%, var(--slip) 90deg, transparent 0) 0 0 / 12px 7px repeat-x;
}
.slip.is-NEW { --slip: var(--carbon); }
.slip.is-CANCELLED { color: var(--ink-soft); }
.slip.is-CANCELLED .slip-total strong { text-decoration: line-through; }

.slip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.slip-no { font-family: var(--display); font-weight: 700; font-size: 1.125rem; line-height: 1.3; }
.slip-when { font-size: .875rem; line-height: 1.4; color: var(--ink-soft); }
.slip-who { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--rule); overflow-wrap: anywhere; }
.slip.is-NEW .slip-who { border-top-color: var(--carbon-edge); }
.slip-lines { margin-top: 6px; }
.slip-lines li { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; }
.slip-lines .what { min-width: 0; overflow-wrap: anywhere; }
.slip-lines .dots { flex: 1; min-width: 14px; height: 0; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.slip.is-NEW .slip-lines .dots { border-bottom-color: var(--carbon-edge); }
.slip-lines .amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.slip-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 6px; border-top: 1.5px solid currentColor; }
.slip-total strong { font-family: var(--display); font-weight: 700; font-size: 1.375rem; line-height: 1.3; }
.slip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-bottom: 4px; }

.stamp {
  flex: none; display: inline-block;
  margin: 3px 4px 0 0; padding: 1px 10px 0;
  border: 2px solid currentColor; border-radius: 4px;
  box-shadow: 0 0 0 2px var(--slip, var(--paper)), 0 0 0 3px currentColor;
  font-family: var(--display); font-weight: 700; font-size: .9375rem; line-height: 1.5; white-space: nowrap;
  transform: rotate(-5deg);
}
.stamp.NEW { color: var(--stamp); }
.stamp.ACCEPTED { color: var(--pen); }
.stamp.DELIVERED { color: var(--leaf); }
.stamp.CANCELLED { color: #7f899d; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--pen); border-radius: 8px;
  background: var(--pen); color: #fff;
  font-weight: 600; line-height: 1.3; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--pen-dark); border-color: var(--pen-dark); }
.btn.quiet { background: var(--paper); border-color: var(--rule); color: var(--ink); }
.btn.quiet:hover { background: var(--paper-shade); border-color: #a9b7d3; }
.btn.warn { background: var(--paper); border-color: #e6b4b7; color: var(--stamp); }
.btn.warn:hover { background: var(--stamp-wash); border-color: var(--stamp); }
.btn.stop { background: var(--stamp); border-color: var(--stamp); }
.btn.stop:hover { background: #a51f26; border-color: #a51f26; }
.btn.on-dark { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.btn.on-dark:hover { background: rgba(255, 255, 255, .14); border-color: #fff; }
.btn.on-dark:focus-visible { outline-color: #fff; }
.btn.sm { min-height: 38px; padding: 5px 12px; font-size: .9375rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.is-busy { position: relative; color: transparent; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.quiet.is-busy::after, .btn.warn.is-busy::after { border-color: var(--rule); border-top-color: var(--pen); }
@media (min-width: 1000px) { .btn { min-height: 40px; } .btn.sm { min-height: 34px; } }

.icon-btn {
  flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border: 1.5px solid var(--rule); border-radius: 8px;
  background: var(--paper); color: var(--ink-soft);
}
.icon-btn:hover { background: var(--paper-shade); color: var(--ink); border-color: #a9b7d3; }
.icon-btn.warn:hover { background: var(--stamp-wash); color: var(--stamp); border-color: var(--stamp); }
.icon-btn.bare { border-color: transparent; background: none; }

.link { padding: 0; border: 0; background: none; color: var(--pen); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--pen-dark); }

/* ---------- forms ---------- */
.field { display: block; min-width: 0; }
.field > span:first-child { display: block; margin-bottom: 4px; font-size: .9375rem; font-weight: 600; }
.field input, .field select, .field textarea, .input {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1.5px solid var(--rule); border-radius: 8px;
  background: var(--paper);
}
.field input::placeholder, .input::placeholder { color: #76809a; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-wash);
}
.field .hint { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid legend, .group-title { grid-column: 1 / -1; padding: 0; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.form-grid .group-title:not(:first-child) { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.form-msg { grid-column: 1 / -1; min-height: 1.4em; color: var(--stamp); font-weight: 600; }
.form-msg:empty { display: none; }
@media (min-width: 560px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
}

.with-btn { display: flex; gap: 8px; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn .icon-btn { width: 44px; height: 44px; }

/* two-way choice shown as a pair of buttons */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1.5px solid var(--rule); border-radius: 8px; overflow: hidden; }
.pick label { position: relative; display: block; }
.pick input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; min-height: 0; cursor: pointer; }
.pick span { display: grid; place-items: center; min-height: 41px; padding: 6px 10px; text-align: center; line-height: 1.3; }
.pick label + label span { border-left: 1.5px solid var(--rule); }
.pick input:checked + span { background: var(--pen-wash); color: var(--pen-dark); font-weight: 600; }
.pick input:focus-visible + span { outline: 2px solid var(--pen); outline-offset: -3px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { flex: none; position: relative; width: 42px; height: 24px; border-radius: 12px; background: #b5c0d6; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--leaf); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--pen); outline-offset: 2px; }
.switch em { font-style: normal; font-size: .875rem; line-height: 1.3; color: var(--ink-soft); }

.toolbar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; }
.search .ic { position: absolute; left: 12px; top: 50%; margin-top: -9px; color: var(--ink-soft); pointer-events: none; }
.search .input { padding-left: 38px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.chips::-webkit-scrollbar { display: none; }
.toolbar .chips { margin-bottom: 0; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 4px 14px;
  border: 1.5px solid var(--rule); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: .9375rem; line-height: 1.3;
}
.chip b { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: #a9b7d3; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active b { color: #c9d3ea; }

.tag { display: inline-block; padding: 0 8px; border-radius: 4px; background: var(--pen-wash); color: var(--pen-dark); font-size: .8125rem; font-weight: 600; line-height: 1.65; white-space: nowrap; }
.tag.plain { background: #edf0f6; color: var(--ink-soft); }
.tag.off { background: var(--stamp-wash); color: var(--stamp); }
.tag.narrow-only { display: none; }   /* a note shown only in the phone layout */
@media (max-width: 719px) { .tag.narrow-only { display: inline-block; } }

.avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--pen-wash); color: var(--pen-dark);
  font-family: var(--display); font-weight: 700; font-size: 1.125rem; line-height: 1;
}

.empty { padding: 30px 20px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; margin-bottom: 2px; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; color: var(--ink); }
.empty .btn { margin-top: 12px; }

.notice { margin: 0 0 14px; padding: 12px 16px; background: var(--marker); border-radius: 0; line-height: 1.5; }
@media (min-width: 1000px) { .notice { border-radius: 6px; } }
.sai-status { padding: 12px 14px; border-radius: 8px; background: var(--paper-shade); border: 1px solid var(--rule-soft); }
.sai-status.on { background: var(--leaf-wash); border-color: #b9dfc8; }
.sai-status.bad { background: var(--stamp-wash); border-color: #efc5c8; }
.sai-status strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; }
.sai-status .kv { margin-top: 8px; font-size: .9375rem; }
.tag.on { background: var(--leaf-wash); color: var(--leaf); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; }
.kv dt { color: var(--ink-soft); }
.kv dd { font-weight: 600; overflow-wrap: anywhere; }

code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: .875rem; }
pre { padding: 12px 14px; border-radius: 6px; background: var(--paper-shade); border: 1px solid var(--rule-soft); overflow-x: auto; line-height: 1.5; }

details.help > summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; line-height: 1.4; }
details.help > summary + * { margin-top: 12px; }
details.help > * + * { margin-top: 12px; }

/* ---------- dialogs: centred on wide screens, a sheet from the bottom on phones ---------- */
dialog {
  width: min(600px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 40px);
  padding: 0; border: 0; border-radius: 12px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 50px rgba(22, 33, 59, .35);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; animation: rise .18s ease-out; }
dialog::backdrop { background: rgba(20, 39, 92, .5); }
dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px 12px 20px; border-bottom: 1px solid var(--rule-soft); }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 20px; }
/* an error from the server: shown just above the buttons, where it cannot scroll out of view */
.form-msg.dlg-msg { flex: none; min-height: 0; padding: 10px 20px; background: var(--stamp-wash); border-top: 1px solid #efc5c8; }
.dlg-body > p + * { margin-top: 12px; }
.dlg-foot { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--paper-shade); border-top: 1px solid var(--rule-soft); }
dialog.confirm { width: min(440px, calc(100vw - 32px)); }
dialog.confirm h2 { margin-bottom: 6px; }
@media (max-width: 599px) {
  dialog, dialog.confirm { width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .dlg-foot .btn { flex: 1; }
}

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: 78px; z-index: 60; display: grid; justify-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.toast {
  max-width: 460px; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 600; line-height: 1.4;
  box-shadow: 0 8px 22px rgba(22, 33, 59, .3);
  animation: rise .18s ease-out;
}
.toast.err { background: var(--stamp); }
@media (min-width: 1000px) { #toasts { bottom: 28px; } }
body.no-dock #toasts { bottom: 28px; }
dialog #toasts { bottom: 92px; }   /* clear of the dialog's buttons */

/* ---------- bot test chat ---------- */
.chat { display: flex; flex-direction: column; height: min(64vh, 540px); }
.chat-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--rule-soft); }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head strong { display: block; line-height: 1.3; overflow-wrap: anywhere; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--counter); }
.bubble { max-width: 86%; padding: 8px 12px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--pen); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; }
.bubble small { display: block; margin-top: 3px; font-size: .75rem; line-height: 1.4; color: var(--ink-soft); }
.bubble.wait { color: var(--ink-soft); }
.bot-buttons { align-self: flex-start; display: flex; flex-direction: column; gap: 6px; width: min(86%, 420px); margin-top: -2px; }
.bot-button-row { display: flex; gap: 6px; }
.bot-button {
  flex: 1 1 0; min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid #b9c6e4; border-radius: 10px;
  background: var(--paper); color: var(--pen); font: inherit; font-weight: 600; line-height: 1.3; cursor: pointer; overflow-wrap: anywhere;
}
.bot-button:hover:not(:disabled) { border-color: var(--pen); }
.bot-button:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.bot-button:disabled { color: var(--ink-soft); border-color: var(--rule-soft); cursor: default; opacity: .75; }
.chat-suggest { flex: none; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 16px 0; }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-form { flex: none; display: flex; gap: 8px; padding: 10px 16px 14px; }
.chat-form .input { flex: 1; min-width: 0; }
@media (min-width: 1000px) { .chat-head, .chat-log, .chat-form { padding-left: 22px; padding-right: 22px; } .chat-suggest { padding-left: 22px; padding-right: 22px; } }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; background: var(--paper); }
.login-cover { padding: 28px 24px 26px; background: var(--cover); color: #fff; }
.login-cover h1 { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1.25; }
.login-cover > p { margin-top: 6px; max-width: 28em; color: #cfd8f3; }
.login-demo { display: none; }
.login-form { width: 100%; max-width: 420px; margin: 0 auto; padding: 28px 24px 40px; }
.login-form h2 { font-size: 1.5rem; margin-bottom: 4px; }
.login-form .field { margin-top: 16px; }
.login-form .btn { margin-top: 20px; }
.login-form .form-msg { margin-top: 12px; }
@media (min-width: 1000px) {
  .login { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: 1fr; }
  .login-cover { display: flex; flex-direction: column; padding: 56px 60px 52px; }
  .login-cover h1 { font-size: 3.25rem; line-height: 1.15; }
  .login-cover > p { font-size: 1.125rem; margin-top: 10px; }
  .login-form { align-self: center; padding: 40px; }
  /* what the product does, shown with its own parts: a customer's message becomes a slip */
  .login-demo { display: block; margin: auto 0; padding: 40px 0 8px; max-width: 420px; }
  .login-demo .bubble { margin-left: auto; width: fit-content; background: #dfe7fb; color: var(--ink); }
  .login-demo .slip { --hole: var(--cover); margin: 18px 0 8px; max-width: 330px; color: var(--ink); transform: rotate(-1.5deg); }
}

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes settle { from { opacity: 0; transform: translateY(26px) rotate(2deg); } to { opacity: 1; transform: rotate(-1.5deg); } }
@media (min-width: 1000px) and (prefers-reduced-motion: no-preference) {
  .login-demo .bubble { animation: rise .35s ease-out .15s both; }
  .login-demo .slip { animation: settle .5s cubic-bezier(.2, .8, .3, 1) .6s both; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   Counter bill, khata diary, printer (v0.4)
   ========================================================================== */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the shop's awning over the top bar and the side menu */
.bar, .side-brand { position: relative; }
.bar::after, .side::before {
  content: ""; display: block; height: 8px;
  background:
    radial-gradient(circle at 9px -3px, transparent 8px, var(--counter) 8.5px) 0 2px / 18px 8px repeat-x,
    repeating-linear-gradient(90deg, #f3c623 0 18px, #fff 18px 36px);
}
.bar::after { position: absolute; left: 0; right: 0; bottom: -8px; }
.side::before { margin: -22px -12px 16px; height: 12px;
  background:
    radial-gradient(circle at 10px -4px, transparent 9px, var(--cover) 9.5px) 0 2px / 20px 10px repeat-x,
    repeating-linear-gradient(90deg, #f3c623 0 20px, #fff 20px 40px); }
main { padding-top: 22px; }
@media (min-width: 1000px) { main { padding-top: 28px; } }

/* more figures on the home page */
.hisab .due-cell dd { color: var(--stamp); }
.hisab.three > div:first-child { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
.hisab.three > div:nth-child(2) { border-right: 1px solid var(--rule-soft); }
.hisab.three > div:nth-child(3) { border-right: 0; }
.hint .ic { display: inline-block; vertical-align: -3px; }
@media (min-width: 720px) {
  .hisab > div:nth-child(4n) { border-right: 0; }
  .hisab > div:nth-child(n+5) { border-top: 1px solid var(--rule-soft); }
  .hisab.three { grid-template-columns: repeat(3, 1fr); }
  .hisab.three > div:first-child { grid-column: auto; border-right: 1px solid var(--rule-soft); border-bottom: 0; }
}

/* big buttons for the jobs done all day */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.tile {
  display: grid; justify-items: center; align-content: center; gap: 4px;
  min-height: 78px; padding: 10px 6px;
  border: 1.5px solid var(--rule); border-radius: 10px; background: var(--paper);
  color: var(--ink); font-weight: 600; font-size: .9375rem; line-height: 1.25; text-align: center;
}
.tile .ic { color: var(--pen); }
.tile:hover { border-color: var(--pen); }
.tile.main { background: var(--pen); border-color: var(--pen); color: #fff; }
.tile.main .ic { color: #fff; }
.tile.main:hover { background: var(--pen-dark); }
.tile.active { border-color: var(--rule); }
.tile.main.active { border-color: var(--pen); }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(6, 1fr); } }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.big { min-height: 52px; padding: 8px 22px; font-size: 1.0625rem; }
.btn .ic { margin-right: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pen); margin: 0; }
.check input:disabled + span { color: var(--ink-soft); }
.tag.due { background: var(--stamp-wash); color: var(--stamp); }

/* segmented choice: नकद / UPI / उधार */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 46px; padding: 6px 16px; font-weight: 600; line-height: 1.25; text-align: center; }
.seg label + label span { border-left: 1.5px solid var(--rule); }
.seg input:checked + span { background: var(--pen); color: #fff; }
.seg .udhaar input:checked + span { background: var(--stamp); }
.seg input:focus-visible + span { outline: 2px solid var(--pen); outline-offset: -4px; }
.seg.small span { min-height: 40px; font-weight: 400; }

/* ---------- बिल बनाओ ---------- */
.billdesk { display: grid; gap: 14px; }
@media (min-width: 1000px) { .billdesk { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }

/* the bill pad: a printed letterhead and ruled lines with a red margin */
.billpad {
  position: relative;
  background:
    linear-gradient(90deg, transparent 40px, var(--margin) 40px, var(--margin) 41.5px, transparent 41.5px) 0 0 / 100% 100% no-repeat,
    var(--paper);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
@media (min-width: 1000px) { .billpad { border: 1px solid var(--rule); border-radius: 6px; } }
.pad-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px 56px;
  border-bottom: 2px solid var(--cover);
  background: var(--paper);
}
.pad-shop { font-family: var(--display); font-weight: 700; font-size: 1.375rem; line-height: 1.2; color: var(--cover); overflow-wrap: anywhere; }
.pad-sub { font-size: .8125rem; color: var(--ink-soft); line-height: 1.4; margin-top: 2px; }
.pad-no { flex: none; text-align: right; line-height: 1.2; }
.pad-no span { display: block; font-size: .8125rem; color: var(--ink-soft); }
.pad-no strong { font-family: var(--display); font-size: 1.375rem; color: var(--stamp); font-variant-numeric: tabular-nums; }

.finder { position: relative; padding: 14px 16px 8px 56px; }
.search.big { max-width: none; }
.search.big .input { min-height: 52px; font-size: 1.0625rem; border-width: 2px; }
.hits {
  position: absolute; left: 56px; right: 16px; top: calc(100% - 4px); z-index: 15;
  background: var(--paper); border: 1.5px solid var(--rule); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(22, 33, 59, .18); overflow: hidden;
}
.hits li { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--rule-soft); }
.hits li:first-child { border-top: 0; }
.hits li.on, .hits li:hover { background: var(--pen-wash); }
.hits .nm { flex: 1; min-width: 0; font-weight: 600; }
.hits .rt { flex: none; font-variant-numeric: tabular-nums; }
.hits small { flex: none; font-size: .8125rem; color: var(--ink-soft); }
.hits li.typed { align-items: center; color: var(--pen-dark); font-weight: 600; }
.hits li.typed .ic { margin-right: 4px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px 56px; }
.quick .chip { min-height: 36px; padding: 3px 12px; }

.bill-lines-wrap { padding: 0 0 4px; }
.bill-lines { width: 100%; border-collapse: collapse; }
.bill-lines th { padding: 6px 8px; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); text-align: left; border-bottom: 1px solid var(--rule); }
.bill-lines th:first-child, .bill-lines td:first-child { padding-left: 56px; }
.bill-lines th.num { text-align: right; }
.bill-lines td { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.bill-lines td:last-child { width: 48px; padding-right: 12px; }
.bill-lines .name { font-weight: 600; overflow-wrap: anywhere; }
.bill-lines small { display: block; font-size: .8125rem; color: var(--ink-soft); line-height: 1.3; }
.bill-lines .amt { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bill-lines .icon-btn { width: 36px; height: 36px; }
.cell {
  width: 84px; min-height: 40px; padding: 6px 8px; margin-left: auto; display: block;
  border: 1.5px solid var(--rule); border-radius: 8px; background: var(--paper);
  text-align: right; font-variant-numeric: tabular-nums;
}
.cell:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-wash); }
.pad-empty { padding: 18px 16px 18px 56px; color: var(--ink-soft); border-bottom: 1px solid var(--rule-soft); }
@media (max-width: 559px) {
  .bill-lines th:first-child, .bill-lines td:first-child { padding-left: 52px; }
  .cell { width: 64px; padding: 6px; }
  .bill-lines td { padding: 6px 4px; }
}

.pad-foot { padding: 14px 16px 16px 56px; display: grid; gap: 12px; }
.bill-who { gap: 10px 14px; }
.khata-note { padding: 8px 12px; border-radius: 8px; background: var(--paper-shade); font-size: .9375rem; line-height: 1.45; }
.khata-note.warn { background: var(--stamp-wash); color: var(--stamp); font-weight: 600; }
.bill-pay { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.bill-pay .seg { flex: 1 1 260px; }
.bill-pay .disc { flex: 0 0 120px; }
.bill-total {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-top: 12px; border-top: 2px solid var(--cover);
}
.bill-total .sum span { display: block; font-size: .875rem; color: var(--ink-soft); }
.bill-total .sum strong { display: block; font-family: var(--display); font-size: 2.25rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bill-total .sum small { display: block; font-size: .8125rem; color: var(--ink-soft); }
.bill-go { display: flex; gap: 8px; align-items: center; }
.keys { display: none; }
@media (min-width: 1000px) { .keys { display: block; } }
@media (max-width: 719px) {
  .pad-head, .finder, .quick, .pad-foot, .pad-empty { padding-left: 52px; }
  .hits { left: 52px; }
  .bill-total { position: sticky; bottom: 58px; z-index: 5; margin: 0 -16px -16px -52px; padding: 10px 16px 12px; background: var(--paper); box-shadow: 0 -6px 16px rgba(22, 33, 59, .08); }
  .bill-total .sum strong { font-size: 1.75rem; }
  .bill-go { flex: 1; justify-content: flex-end; }
}

/* the receipt on its paper roll */
.receipt-side { background: var(--paper); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 14px 16px 18px; }
@media (min-width: 1000px) { .receipt-side { position: sticky; top: 20px; border: 1px solid var(--rule); border-radius: 6px; } }
.receipt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.receipt-head h2 { font-size: 1.0625rem; }
.paper-roll { display: grid; justify-items: center; padding: 14px 10px; background: #d9dee8; border-radius: 6px; }
.paper-roll img {
  display: block; width: 100%; max-width: 230px; background: #fff;
  -webkit-mask: radial-gradient(circle at 6px 100%, transparent 5px, #000 5.5px) 0 0 / 12px 100% repeat-x;
          mask: radial-gradient(circle at 6px 100%, transparent 5px, #000 5.5px) 0 0 / 12px 100% repeat-x;
  padding-bottom: 6px; box-shadow: 0 2px 8px rgba(22, 33, 59, .18);
  image-rendering: pixelated;
}

.bill-list > li { flex-wrap: wrap; }
.bill-list .amt { font-family: var(--display); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.bill-list li.is-off .name, .bill-list li.is-off .amt { color: var(--ink-soft); text-decoration: line-through; }
.cell-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 559px) { .bill-list .cell-actions { width: 100%; justify-content: flex-end; } }

/* ---------- खाता डायरी: a register with a red margin ---------- */
.diary {
  background:
    linear-gradient(90deg, transparent 58px, var(--margin) 58px, var(--margin) 59.5px, transparent 59.5px),
    var(--paper);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  margin-bottom: 12px;
}
@media (min-width: 1000px) { .diary { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; } }
.register > li + li { border-top: 1px solid var(--rule-soft); }
.reg-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px 12px 10px; border: 0; background: none; text-align: left;
}
.reg-row:hover { background: rgba(230, 236, 251, .55); }
.reg-row .avatar { width: 38px; height: 38px; font-size: 1rem; }
.reg-row .grow { flex: 1; min-width: 0; padding-left: 10px; }
.reg-row .name { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.reg-row .hint { font-size: .8125rem; }
.sai { color: var(--leaf); display: inline-flex; }
.reg-row > strong, .due-box strong { flex: none; text-align: right; font-family: var(--display); font-size: 1.25rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.reg-row > strong small { display: block; font-family: var(--text); font-size: .75rem; font-weight: 600; }
.due { color: var(--stamp); }
.adv { color: var(--leaf); }
.clear { color: var(--ink-soft); }

dialog.wide-dlg { width: min(760px, calc(100vw - 32px)); }
@media (max-width: 599px) { dialog.wide-dlg { width: 100vw; } }
.diary-page { display: grid; gap: 14px; }
.due-box { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 10px; background: var(--paper-shade); border: 1px solid var(--rule-soft); }
.due-box span { color: var(--ink-soft); font-weight: 600; }
.due-box strong { font-size: 2rem; }
.money-form { display: grid; gap: 10px; padding: 14px; border: 1.5px dashed var(--rule); border-radius: 10px; }
.money-form .seg { width: 100%; }
.money-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.money-row .field { flex: 0 0 130px; }
.money-row .field.grow { flex: 1 1 180px; }
.money-row .btn { min-height: 44px; }
.diary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.diary-actions a.btn { text-decoration: none; }
.diary-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.diary-table th { position: sticky; top: -18px; background: var(--paper-shade); padding: 8px; text-align: left; font-size: .8125rem; color: var(--ink-soft); border-bottom: 1px solid var(--rule); }
.diary-table th.num, .diary-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.diary-table td { padding: 8px; border-bottom: 1px solid var(--rule-soft); }

/* ---------- printer settings ---------- */
.ways { display: grid; gap: 10px; margin-bottom: 16px; }
.way { position: relative; display: flex; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 10px; cursor: pointer; }
.way input { flex: none; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--pen); }
.way-body strong { display: block; line-height: 1.35; }
.way-body small { display: block; margin-top: 2px; color: var(--ink-soft); line-height: 1.45; font-size: .875rem; }
.way:has(input:checked) { border-color: var(--pen); background: var(--pen-wash); }
.way.off { opacity: .55; cursor: not-allowed; }
.printer-opts { align-items: end; }
.printer-state { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--paper-shade); font-weight: 600; }
.row-head.inline { margin: 0 0 6px; }
.printer-sheet .hint { margin-top: 4px; }
