/* ==========================================================================
   Wunzaligu Pharmacy POS — application stylesheet
   Plain CSS. No frameworks, no CDN, no build step required.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --ink: #14342e;
  --ink-700: #1d4a41;
  --ink-600: #26604f;
  --ink-100: #d9e6e1;
  --lime: #d8ec5a;
  --lime-600: #c2d847;
  --mist: #f4f6f2;
  --paper: #ffffff;
  --line: #e3e8e1;
  --line-strong: #cfd8d2;
  --text: #22302c;
  --muted: #6c7b76;
  --danger: #b23a2c;
  --danger-600: #8f2f23;
  --danger-soft: #fdecea;
  --warn: #9a6b10;
  --warn-soft: #fdf3dc;
  --ok: #1d7a5c;
  --ok-soft: #e4f4ed;
  --info-soft: #e8eefc;
  --info: #33528f;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 52, 46, 0.06);
  --shadow-md: 0 12px 30px -18px rgba(20, 52, 46, 0.35);
  --shadow-lg: 0 30px 60px -30px rgba(20, 52, 46, 0.45);

  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;

  --sidebar-w: 264px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--mist);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: #16211e;
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
}

a {
  color: var(--ink-600);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

:focus-visible {
  outline: 2px solid var(--ink-600);
  outline-offset: 2px;
}

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

.hidden {
  display: none !important;
}

.flex-1 {
  flex: 1;
}

.table-note {
  padding: 12px 20px 0;
}

.text-center {
  text-align: center;
}

.mt-3 {
  margin-top: 16px;
}

.modal__hint {
  margin-bottom: 14px;
}

.summary {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.summary .totals div:first-child {
  padding-top: 0;
}

.is-invalid {
  border-color: var(--danger) !important;
}

/* ---------- Modal forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 14px;
}

.form-grid .field {
  margin-bottom: 14px;
}

.form-grid .field + .field {
  margin-top: 0;
}

.form-grid__wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #33413d;
  margin-bottom: 14px;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--ink-600);
}

.check span small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ---------- Bar chart (dashboard trend) ---------- */
.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
  height: 200px;
  align-items: stretch;
}

.bars__item {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  text-align: center;
  min-width: 0;
}

.bars__value {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bars__track {
  background: #eef2ef;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.bars__bar {
  width: 100%;
  background: linear-gradient(180deg, var(--ink-600), var(--ink));
  border-radius: 8px 8px 0 0;
}

.bars__label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Dense tables (administration) ---------- */
.table--compact {
  min-width: 720px;
}

.table--compact thead th {
  padding: 10px 14px;
}

.table--compact tbody td {
  padding: 10px 14px;
}

.cell-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Application shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: #e6f0ec;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: grid;
  place-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--lime);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.15rem;
}

.brand__tag {
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  color: #a9c6bb;
  display: block;
  font-weight: 600;
}

.nav {
  display: grid;
  gap: 3px;
  overflow-y: auto;
}

.nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #b9d2c9;
  font-size: 0.92rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav__link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav__link.is-active {
  background: var(--ink-600);
  color: #fff;
  font-weight: 600;
}

.nav__badge {
  background: var(--lime);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
}

.sidebar__footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
  font-size: 0.85rem;
}

.sidebar__user {
  font-weight: 600;
  color: #fff;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__meta {
  color: #9db8ae;
  font-size: 0.78rem;
}

/* ---------- Shop switcher (super admin only) ---------- */
.sidebar__shop {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-switch {
  display: block;
}

.shop-switch__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9db8ae;
}

.shop-switch__select {
  width: 100%;
  font-size: 0.85rem;
  padding: 7px 9px;
}

/* The switcher is the one control living on the dark sidebar, so it wears the
   accent — lime on ink, as the brand mark and the nav badges do — rather than the
   white used by the forms that sit on paper. The `.select` rules appear later in
   this file, so the extra `.sidebar__shop` is load-bearing: at equal specificity
   those later rules win on source order and would repaint the field white. */
.sidebar__shop .shop-switch__select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid var(--lime-600);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar__shop .shop-switch__select:hover {
  background: var(--lime-600);
}

.sidebar__shop .shop-switch__select:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(216, 236, 90, 0.4);
}

/* The popup list is painted by the browser, not by us, but its options inherit
   the control's colours in most of them. */
.sidebar__shop .shop-switch__select option {
  color: var(--ink);
  background: #fff;
}

.sidebar__shop + .sidebar__footer {
  margin-top: 12px;
}

.main {
  padding: 34px 40px 72px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.eyebrow {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.page-head p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

/* ---------- Cards & layout helpers ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.card__body {
  padding: 20px;
}

.card__body--flush {
  padding: 0;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid--stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid--split {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.grid--sidebar {
  grid-template-columns: 340px minmax(0, 1fr);
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.row--bottom {
  align-items: flex-end;
}

.field--compact {
  flex: 0 0 auto;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--ink-700);
}

.btn:disabled {
  background: #cfd6d3;
  color: #f3f5f4;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn--ghost:hover {
  background: #f1f4f2;
  border-color: var(--ink-600);
}

.btn--light {
  background: var(--lime);
  color: var(--ink);
}

.btn--light:hover {
  background: var(--lime-600);
}

.btn--danger {
  background: var(--danger);
}

.btn--danger:hover {
  background: #93291e;
}

.btn--sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.btn--block {
  width: 100%;
}

.btn--link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-600);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Forms ---------- */
.field {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: #33413d;
}

.field + .field {
  margin-top: 14px;
}

.field__hint {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 400;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ink-600);
  box-shadow: 0 0 0 3px rgba(38, 96, 79, 0.12);
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.form-error {
  background: var(--danger-soft);
  border: 1px solid #f2c9c3;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
}

.form-note {
  background: var(--info-soft);
  border: 1px solid #ccd9f5;
  color: var(--info);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
}

/* ---------- Inline notices ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
}

.notice--warn {
  background: var(--warn-soft);
  border: 1px solid #ecd9a8;
  color: var(--warn);
}

.notice--info {
  background: var(--info-soft);
  border: 1px solid #ccd9f5;
  color: var(--info);
}

.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* ---------- Search & filters ---------- */
.search {
  position: relative;
  flex: 1 1 260px;
}

.search .input {
  margin-top: 0;
  padding-left: 36px;
}

.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #43534e;
}

.chip:hover {
  border-color: var(--ink-600);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 600;
}

/* ---------- Product grid (POS) ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.product {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  cursor: pointer;
  display: grid;
  gap: 5px;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.product:hover:not(:disabled) {
  border-color: var(--ink-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.product:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.product__icon {
  display: grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ok-soft);
  color: var(--ink-600);
  font-weight: 700;
}

.product__name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}

.product__meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.product__price {
  font-weight: 700;
  font-size: 0.95rem;
}

.product__stock {
  font-size: 0.74rem;
  color: var(--muted);
}

.product__stock.is-low {
  color: var(--warn);
  font-weight: 600;
}

.product__stock.is-out {
  color: var(--danger);
  font-weight: 600;
}

/* ---------- Cart ---------- */
.cart {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 24px;
}

.cart__list {
  list-style: none;
  margin: 0;
  padding: 6px 18px 0;
  max-height: 42vh;
  overflow-y: auto;
}

.cart__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.cart__item:last-child {
  border-bottom: 0;
}

.cart__info {
  flex: 1;
  min-width: 0;
}

.cart__name {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart__unit {
  font-size: 0.75rem;
  color: var(--muted);
}

.qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.qty button {
  border: 0;
  background: #f4f7f5;
  width: 26px;
  height: 28px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.qty button:hover {
  background: var(--ink-100);
}

.qty span {
  min-width: 26px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.cart__line-total {
  font-size: 0.86rem;
  min-width: 74px;
  text-align: right;
}

.cart__totals {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
  font-size: 0.88rem;
}

.cart__totals div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.cart__grand {
  font-size: 1.05rem;
  font-weight: 700;
  border-top: 1px dashed var(--line-strong);
  margin-top: 8px;
  padding-top: 10px !important;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
}

.table {
  min-width: 640px;
  font-size: 0.88rem;
}

.table thead th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fafcfa;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table__actions {
  text-align: right;
  white-space: nowrap;
}

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: #eef2f0;
  color: #4d5b57;
}

.badge--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--info {
  background: var(--info-soft);
  color: var(--info);
}

/* ---------- Stats & alerts ---------- */
.stat {
  padding: 18px 20px;
}

.stat__label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.stat__value {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 600;
  margin-top: 6px;
  display: block;
  line-height: 1.1;
}

.stat__note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.87rem;
}

.alert-list li:last-child {
  border-bottom: 0;
}

/* ---------- Empty states ---------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty__icon {
  font-size: 1.9rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.7;
}

.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* ---------- Bootstrap / loading ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--ink-100);
  border-top-color: var(--ink-600);
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(90deg, #eef2ef 25%, #f7f9f7 50%, #eef2ef 75%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
  height: 12px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login__aside {
  background: var(--ink);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
}

.login__headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.4vw, 3rem);
  margin-top: auto;
  max-width: 15ch;
  line-height: 1.1;
}

.login__headline em {
  color: var(--lime);
  font-style: normal;
}

.login__copy {
  color: #a9c6bb;
  max-width: 42ch;
  margin-top: 16px;
}

.login__facts {
  margin-top: 34px;
  display: grid;
  gap: 10px;
  font-size: 0.86rem;
  color: #cfe0d9;
}

.login__facts span::before {
  content: "•";
  color: var(--lime);
  margin-right: 8px;
}

.login__panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.login__form {
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 14px;
}

.login__form h2 {
  font-size: 1.7rem;
  margin-top: 6px;
}

.code-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.2rem;
  font-family: var(--font-mono);
}

/* ---------- Dialog ---------- */
dialog.modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(520px, calc(100vw - 32px));
  background: var(--paper);
  color: var(--text);
  max-height: calc(100vh - 60px);
}

dialog.modal::backdrop {
  background: rgba(14, 32, 28, 0.5);
  backdrop-filter: blur(2px);
}

dialog.modal[open] {
  animation: pop 0.16s ease-out;
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.99);
    opacity: 0;
  }
}

.modal__head {
  position: relative;
  /* Room on the right for the close button. */
  padding: 20px 58px 0 22px;
}

.modal__head p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* One button, every modal: it belongs to the shared header rather than to the
   body each view replaces. Escape also closes a <dialog>. It sits outside the
   footer, so the Enter-key handling in bindModalSubmit cannot mistake it for the
   primary action, and inside .modal__head, which the print rules hide.

   Filled red on purpose: as a transparent grey glyph it was quiet enough that
   people did not realise the dialog could be dismissed at all. */
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.modal__close:hover {
  background: var(--danger-600);
}

.modal__close:active {
  transform: scale(0.94);
}

.modal__close:focus-visible {
  outline: 2px solid var(--ink-600);
  outline-offset: 2px;
}

.modal__body {
  padding: 18px 22px;
  overflow-y: auto;
}

.modal__foot {
  padding: 0 22px 20px;
  display: flex;
  gap: 10px;
}

.modal__foot .btn {
  flex: 1;
}

/* ---------- Line items (sale detail) ---------- */
.line-items {
  width: 100%;
  font-size: 0.87rem;
}

.line-items td {
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.line-items td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.totals {
  margin-top: 12px;
  font-size: 0.88rem;
}

.totals div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.totals .grand {
  font-weight: 700;
  font-size: 1rem;
  border-top: 1px solid var(--line-strong);
  margin-top: 6px;
  padding-top: 8px;
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 60;
  width: min(340px, calc(100vw - 36px));
}

.toast {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.87rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: slide-in 0.2s ease-out;
}

.toast--ok {
  background: var(--ok);
}

.toast--error {
  background: var(--danger);
}

.toast--warn {
  background: var(--warn);
}

@keyframes slide-in {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
}

/* ---------- Receipt ---------- */
.receipt {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #fcfdfc;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.receipt__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}
.receipt__head strong {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.receipt__head span {
  font-size: 0.76rem;
  color: var(--ink-600);
}

.receipt__foot {
  margin: 0;
  padding-top: 3px;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--ink-600);
}

.receipt__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.receipt__sep {
  border-top: 1px dashed var(--line-strong);
  margin: 9px 0;
}

/* A discontinued product stays listed, but reads as inactive. */
.row--muted td {
  color: var(--ink-600);
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid--split,
  .grid--sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .cart {
    position: static;
  }

  .cart__list {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px 14px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .nav__link {
    white-space: nowrap;
  }

  .sidebar__footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 0;
  }

  .main {
    padding: 22px 18px 60px;
  }

  .login {
    grid-template-columns: minmax(0, 1fr);
  }

  .login__aside {
    padding: 32px 24px;
  }

  .login__headline {
    margin-top: 24px;
    font-size: 2rem;
  }
}

/* ---------- Print (receipt only) ---------- */
@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .toast-stack,
  .modal__head,
  .modal__foot,
  .no-print {
    display: none !important;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .main {
    padding: 0;
  }

  dialog.modal {
    box-shadow: none;
    position: static;
    width: 100%;
    max-height: none;
  }

  .receipt {
    border: 0;
    border-radius: 0;
    background: #fff;
    padding: 0;
    width: 100%;
    /* 58 mm paper less the page margins. */
    max-width: 52mm;
    margin: 0 auto;
    font-size: 10pt;
  }

  /* Thermal printers are single colour, so muted greys print as washed out. */
  .receipt__head span,
  .receipt__foot {
    color: #000;
  }
}
