/*
 * Tilldeck - POS & Inventory Admin Template
 * Main stylesheet
 *
 * Colours: tokens.css
 *
 * Table of contents
 *  1. Foundation
 *  2. Base
 *  3. Components
 *  4. Counter components
 *  5. Register
 *  6. Back office: base and layout
 *  7. Back office components
 *  8. Counter screens
 *  9. Cash drawer
 * 10. Receipts and paper
 * 11. Apps
 * 12. Account pages
 * 13. UI kit
 * 14. UI kit: forms
 * 15. Chart libraries
 * 16. Icon sets
 * 17. Layouts
 * 18. Right to left
 * 19. Print
 * 20. Focus
 * 21. Documentation
 * 22. High contrast
 */

/* ==========================================================================
   1. Foundation
   ========================================================================== */

:root {
  --paper: #ffffff;
  --paper-ink: #111827;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px;
  --lh-xs: 16px;
  --fs-sm: 13px;
  --lh-sm: 20px;
  --fs-md: 14px;
  --lh-md: 20px;
  --fs-lg: 16px;
  --lh-lg: 24px;
  --fs-xl: 18px;
  --lh-xl: 28px;
  --fs-2xl: 20px;
  --lh-2xl: 28px;
  --fs-3xl: 24px;
  --lh-3xl: 32px;
  --fs-4xl: 30px;
  --lh-4xl: 36px;
  --fs-5xl: 36px;
  --lh-5xl: 44px;
  --fs-d1: 48px;
  --lh-d1: 56px;
  --fs-d2: 72px;
  --lh-d2: 80px;
  --sp-0-5: 2px;
  --sp-1: 4px;
  --sp-1-5: 6px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --r-xs: 4px;
  --r-sm: 6px;
  --r-control: 8px;
  --r-card: 12px;
  --r-sheet: 16px;
  --r-full: 999px;
  --dur-fast: 100ms;
  --dur-base: 150ms;
  --dur-enter: 200ms;
  --dur-overlay: 250ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.19, .91, .38, 1);
  --sidebar-w: 260px;
  --rail-w: 72px;
  --icon-nav: 20px;
  --topbar-h: 64px;
  --page-pad: 24px;
  --gutter: 24px;
  --spark-w: 300px;
  --kiosk-w: 560px;
  --count-w: 480px;
  --cart-w: 400px;
  --pay-h: 72px;
  --dialog-w: 440px;
  --dialog-w-sm: 360px;
  --dialog-w-lg: 640px;
  --drawer-w: 360px;
  --toast-max: 560px;
  --chip-max: 280px;
  --settings-nav-w: 248px;
  --tip-grid: 520px;
  --shop-max: 1200px;
  --track-max: 880px;
  --qty-field: 160px;
  --cell-main-min: 200px;
  --loyalty-w: 340px;
  --barcode-w: 200px;
  --photo-max: 300px;
  --qr-w: 120px;
  --totals-w: 320px;
  --a4-w: 794px;
  --mail-w: 560px;
  --phone-w: 375px;
  --phone-r: 40px;
  --sms-min: 400px;
  --md-min: 560px;
  --note-min: 180px;
  --wizard-w: 720px;
  --email-w: 640px;
  --email-h: 820px;
  --scroll-demo-h: 200px;
  --form-h-label: 200px;
  --icon-tile-h: 104px;
  --subnav-w: 240px;
  --boxed-w: 1320px;
  --auth-w: 420px;
  --art-w: 440px;
  --status-w: 560px;
  --status-art-w: 240px;
  --photo-sharp: 600px;
  --kb-col-w: 272px;
  --kb-col-min: 240px;
  --field-min: 240px;
  --pinned-foot: 96px;
  --pinned-foot-sm: 160px;
  --search-max: 360px;
  --menu-min: 200px;
  --menu-max: 320px;
  --float-max-h: 520px;
  --tip-max: 240px;
  --arrow: 12px;
  --lb-max: 1200px;
  --lb-gap: 160px;
  --chart-h: 280px;
}

/* Density */
:root,
[data-density="desk"] {
  --body-fs: var(--fs-md);
  --body-lh: var(--lh-md);
  --control-h-sm: 32px;
  --control-h: 36px;
  --control-h-lg: 40px;
  --control-h-xl: 48px;
  --control-px: 14px;
  --control-fs: 14px;
  --icon: 18px;
  --check: 18px;
  --switch-w: 36px;
  --switch-h: 20px;
  --row-h: 48px;
  --card-pad: 20px;
  --badge-h: 22px;
  --badge-fs: 12px;
  --badge-px: 8px;
  --stepper: 32px;
  --gap-touch: 8px;
}

[data-density="counter"] {
  --body-fs: var(--fs-lg);
  --body-lh: var(--lh-lg);
  --control-h-sm: 48px;
  --control-h: 56px;
  --control-h-lg: 64px;
  --control-h-xl: 72px;
  --control-px: 20px;
  --control-fs: 16px;
  --icon: 24px;
  --check: 24px;
  --switch-w: 52px;
  --switch-h: 32px;
  --row-h: 56px;
  --card-pad: 16px;
  --badge-h: 28px;
  --badge-fs: 14px;
  --badge-px: 10px;
  --stepper: 48px;
  --gap-touch: 8px;
  --key-h: 72px;
  --tile-min: 136px;
}

/* ==========================================================================
   2. Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.num,
.money {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

svg.ti {
  width: 1em;
  height: 1em;
  font-size: var(--icon);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
}

[hidden] {
  display: none !important;
}

/* Single-column grids */
:where(
  .register,
  .register-work,
  .payment,
  .cart,
  .lines,
  .line-tools,
  .totals,
  .totals-rows,
  .pay-foot,
  .drawer,
  .drawer-body,
  .dialog-body,
  .stack,
  .field,
  .stat,
  .change,
  .pin,
  .empty,
  .amount,
  .nav,
  .tile .meta,
  .toasts)
 {
  grid-template-columns: minmax(0, 1fr);
}

/* Screen reader only */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

html:has(.register),
html:has(.register) body {
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }

  *:not(.spin),
  *:not(.is-loading)::after {
    animation: none !important;
  }
}

/* ==========================================================================
   3. Components
   ========================================================================== */

/* Button */
.btn {
  --_bg: var(--bg-surface);
  --_fg: var(--text);
  --_bd: var(--border-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 var(--control-px);
  min-width: var(--control-h);
  border-radius: var(--r-control);
  border: 1px solid var(--_bd);
  background: var(--_bg);
  color: var(--_fg);
  font: 500 var(--control-fs)/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.btn:not(.btn-block, .w-100) {
  flex-shrink: 0;
}

.btn .ti {
  font-size: calc(var(--icon) - 2px);
}

.btn:hover,
.btn.is-hover {
  background: var(--bg-subtle);
}

.btn:active,
.btn.is-active {
  background: var(--bg-muted);
  transform: translateY(1px);
}

.btn:focus-visible,
.btn.is-focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label.btn:has(> input[type="file"]:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn[disabled],
.btn.is-disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  --_bg: var(--accent);
  --_fg: var(--on-accent);
  --_bd: transparent;
}

.btn-primary:hover,
.btn-primary.is-hover {
  background: var(--accent-hover);
}

.btn-primary:active,
.btn-primary.is-active {
  background: var(--accent-pressed);
}

.btn-ghost {
  --_bg: transparent;
  --_bd: transparent;
  box-shadow: none;
}

.btn-ghost:hover,
.btn-ghost.is-hover {
  background: var(--bg-muted);
}

.btn-danger {
  --_bg: var(--danger);
  --_fg: #fff;
  --_bd: transparent;
}

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

.btn-danger:active,
.btn-danger.is-active {
  background: var(--danger-pressed);
}

.btn-danger-soft {
  --_bg: var(--danger-subtle);
  --_fg: var(--danger-text);
  --_bd: transparent;
  box-shadow: none;
}

.btn-danger-soft:hover,
.btn-danger-soft.is-hover,
.btn-danger-soft:active,
.btn-danger-soft.is-active {
  background: var(--danger-muted);
}

.btn-sm {
  height: var(--control-h-sm);
  padding: 0 calc(var(--control-px) - 4px);
  font-size: calc(var(--control-fs) - 1px);
}

.btn-lg {
  height: var(--control-h-lg);
  padding: 0 calc(var(--control-px) + 4px);
}

.btn-xl {
  height: var(--control-h-xl);
  padding: 0 calc(var(--control-px) + 8px);
  font-size: calc(var(--control-fs) + 2px);
}

.btn-icon {
  padding: 0;
  width: var(--control-h);
}

.btn.is-loading {
  color: transparent !important;
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: var(--_fg) var(--_fg) var(--_fg) transparent;
  animation: spin .8s linear infinite;
}

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

/* Field / input */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

.label {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  color: var(--text);
}

.hint {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
}

.error-msg {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--danger-text);
  font-weight: 500;
}

.error-msg .ti {
  font-size: 14px;
  color: var(--danger-icon);
}

.input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  color: var(--text);
  font: 400 var(--body-fs)/var(--body-lh) var(--font-sans);
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input input {
  all: unset;
  flex: 1;
  min-width: 0;
  font: inherit;
  color: inherit;
}

.input input::placeholder {
  color: var(--text-secondary);
}

.input .ti {
  color: var(--text-secondary);
  font-size: calc(var(--icon) - 2px);
}

.input .affix {
  color: var(--text-secondary);
  font-weight: 500;
}

.input:hover {
  border-color: var(--text-secondary);
}

.input.is-focus,
.input:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

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

.input.is-disabled {
  background: var(--bg-muted);
  color: var(--text-disabled);
  border-color: var(--border);
}

.kbd {
  font: 500 var(--fs-xs)/1 var(--font-mono);
  color: var(--text-secondary);
  border: 1px solid var(--border-control);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  padding: 2px 6px;
  background: var(--bg-subtle);
}

select.input {
  appearance: none;
  padding-inline-end: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

[dir="rtl"] select.input {
  background-position: 13px 50%, 18px 50%;
}

/* Check / radio / switch */
.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: max(24px, var(--check));
  cursor: pointer;
  font-size: var(--body-fs);
}

.choice > input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.choice > input:focus-visible + .box,
.choice > input:focus-visible + .switch {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.box {
  width: var(--check);
  height: var(--check);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}

.box.round {
  border-radius: 50%;
}

.choice.on .box,
.choice > input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}

.choice.on .box.round,
.choice > input:checked + .box.round {
  background: var(--bg-surface);
  border: calc(var(--check) * .3) solid var(--accent);
}

.box .ti {
  font-size: calc(var(--check) - 4px);
  visibility: hidden;
}

.choice.on .box .ti,
.choice > input:checked + .box .ti {
  visibility: visible;
}

.choice > input:indeterminate + .box {
  background: var(--accent);
  border-color: var(--accent);
}

.choice > input:indeterminate + .box::after {
  content: "";
  grid-area: 1 / 1;
  width: 12px;
  height: 2px;
  border-radius: var(--r-full);
  background: #fff;
}

.box .ti {
  grid-area: 1 / 1;
}

.switch {
  width: var(--switch-w);
  height: var(--switch-h);
  border-radius: var(--r-full);
  background: var(--bg-muted);
  border: 1.5px solid var(--border-strong);
  position: relative;
  flex: none;
  transition: background var(--dur-base) var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 2px;
  width: calc(var(--switch-h) - 7px);
  height: calc(var(--switch-h) - 7px);
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--border-strong);
  transition: left var(--dur-base) var(--ease), background var(--dur-base);
}

.choice.on .switch,
.choice > input:checked + .switch {
  background: var(--accent);
  border-color: var(--accent);
}

.choice.on .switch::after,
.choice > input:checked + .switch::after {
  inset-inline-start: calc(100% - var(--switch-h) + 5px);
  background: #fff;
}

/* Badge */
.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--badge-h);
  padding: 0 var(--badge-px);
  border-radius: var(--r-full);
  font-size: var(--badge-fs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--neutral-subtle);
  color: var(--neutral-text);
}

.badge .ti {
  font-size: calc(var(--badge-fs) + 2px);
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning-text);
}

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

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

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.badge-solid-success {
  background: var(--success);
  color: #fff;
}

.badge-solid-warning {
  background: var(--warning);
  color: var(--on-warning);
}

.badge-solid-danger {
  background: var(--danger);
  color: #fff;
}

.badge-count {
  min-width: var(--badge-h);
  justify-content: center;
  padding: 0 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: var(--card-pad);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px var(--card-pad);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
  margin: 0;
}

/* Stat card */
.stat {
  display: grid;
  gap: 12px;
  padding: var(--card-pad);
  container-type: inline-size;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.stat-label {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 600;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat[style*="--fit"] .stat-value {
  font-size: min(var(--fs-4xl), calc((100cqi - 2 * var(--card-pad) - 52px) / var(--fit)));
}

.stats.five .stat-ico {
  display: none;
}

.stats.five .stat[style*="--fit"] .stat-value {
  font-size: min(var(--fs-4xl), calc((100cqi - 2 * var(--card-pad)) / var(--fit)));
}

.stat-ico {
  width: 40px;
  height: 40px;
  border-radius: var(--r-card);
  display: grid;
  place-items: center;
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.stat-ico .ti {
  font-size: calc(var(--icon) + 4px);
}

.stat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.stat.solid {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}

.stat.solid .stat-label,
.stat.solid .stat-foot {
  color: var(--on-accent);
}

.stat.solid .stat-ico {
  background: rgb(255 255 255 / .16);
  color: #fff;
}

/* Tabs / segmented */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  margin: 0 0 -1px;
  height: var(--control-h);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--control-fs);
  cursor: pointer;
}

.tab.on,
.tab[aria-selected="true"] {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.tab .badge {
  height: 20px;
  font-size: var(--fs-xs);
  padding: 0 6px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--bg-muted);
  border-radius: var(--r-card);
}

.segmented button {
  all: unset;
  height: calc(var(--control-h) - 8px);
  padding: 0 12px;
  border-radius: var(--r-control);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--control-fs);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.segmented button.on {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

[data-density="counter"] .segmented {
  gap: var(--gap-touch);
}

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--body-fs);
}

.table th {
  text-align: start;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 6px 16px;
  height: var(--row-h);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table td .mono {
  white-space: nowrap;
}

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

.table tbody tr:hover td {
  background: var(--bg-subtle);
}

.table .r {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .muted {
  color: var(--text-secondary);
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-muted);
  color: var(--accent-text-strong);
  flex: none;
}

/* Alert / toast */
.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--info-subtle);
  color: var(--info-text);
  border: 1px solid transparent;
}

.alert .ti {
  font-size: 20px;
  color: var(--info-icon);
  margin-top: 1px;
}

.alert b {
  display: block;
  font-weight: 600;
}

.alert p {
  margin: 2px 0 0;
}

.alert > .btn {
  align-self: center;
}

.alert-warning {
  background: var(--warning-subtle);
  color: var(--warning-text);
}

.alert-warning .ti {
  color: var(--warning-icon);
}

.alert-danger {
  background: var(--danger-subtle);
  color: var(--danger-text);
}

.alert-danger .ti {
  color: var(--danger-icon);
}

.alert-success {
  background: var(--success-subtle);
  color: var(--success-text);
}

.alert-success .ti {
  color: var(--success-icon);
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--bg-inverse);
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
}

.toast .ti {
  font-size: 20px;
  color: var(--green-400);
}

.toast a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Dialog */
.dialog {
  width: 100%;
  max-width: var(--dialog-w);
  background: var(--bg-raised);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.dialog-body {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.dialog-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--danger-subtle);
  color: var(--danger-icon);
}

.dialog-ico .ti {
  font-size: 24px;
}

.dialog-ico.success {
  background: var(--success-subtle);
  color: var(--success-icon);
}

.dialog-ico.warning {
  background: var(--warning-subtle);
  color: var(--warning-icon);
}

.dialog-ico.info {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.dialog-title {
  margin: 0;
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
}

.dialog p {
  margin: 0;
  color: var(--text-secondary);
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--r-sheet) var(--r-sheet);
}

/* Sidebar nav item */
.nav {
  display: grid;
  gap: 2px;
}

.nav-sec {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 12px 6px;
  letter-spacing: .02em;
}

.nav-item {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: max(40px, var(--control-h-sm));
  padding: 0 12px;
  border-radius: var(--r-control);
  color: var(--text);
  font-weight: 500;
}

.nav-item .ti {
  font-size: 20px;
  color: var(--text-secondary);
}

.nav-item:hover {
  background: var(--bg-muted);
}

.nav-item.on {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.nav-item.on .ti {
  color: var(--accent-text);
}

.nav-item .badge {
  margin-inline-start: auto;
}

/* ==========================================================================
   4. Counter components
   ========================================================================== */

/* Category tabs */
.cats {
  display: flex;
  gap: var(--gap-touch);
  overflow: auto;
  padding: 4px;
  margin: -4px;
  scrollbar-width: none;
}

.cat {
  font: inherit;
  flex: none;
  height: var(--control-h-sm);
  padding: 0 16px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-control);
  font-weight: 500;
  font-size: var(--control-fs);
  color: var(--text);
  cursor: pointer;
}

.cat .count {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

.cat.on {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent-text);
}

.cat.on .count {
  color: var(--accent-text);
}

/* Product tile */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-min), 100%), 1fr));
  grid-auto-rows: 1fr;
  gap: var(--gap-touch);
}

/* Tile kinds */
.tile {
  --cue: 0 0 #0000;
  --ring: 0 0 #0000;
  --halo: var(--bg-surface);
  font: inherit;
  color: var(--text);
  margin: 0;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 120px;
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  text-align: start;
  box-shadow: var(--ring), var(--cue);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tile:active {
  transform: scale(.97);
}

.tile.photo {
  --cue: inset 0 4px 0 var(--tile-strip, transparent);
}

.tile .img {
  flex: none;
  position: relative;
  margin: 8px 8px 0;
  width: calc(100% - 16px);
  aspect-ratio: 4 / 3;
  border-radius: var(--r-control);
  overflow: hidden;
  background: var(--bg-muted);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.tile .img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile .img .ti {
  font-size: calc(var(--icon) * 1.667);
}

.tile .meta {
  flex: 1;
  min-width: 0;
  padding: 8px 12px 12px;
  display: grid;
  gap: 2px;
  align-content: end;
}

.tile .name {
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  font-weight: 500;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile .price {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tile .stock {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.tile.color {
  --halo: var(--tile-bg);
  background: var(--tile-bg);
  color: var(--tile-fg);
  border-color: transparent;
}

.tile.color .initials {
  flex: none;
  font-size: var(--fs-4xl);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.02em;
  padding: 12px 12px 0;
}

.tile.color .stock,
.tile.color .price {
  color: var(--tile-fg);
}

.tile.text {
  --cue: inset 4px 0 0 var(--tile-strip, transparent);
  min-height: 96px;
}

.tile.text .meta {
  align-content: space-between;
  padding-block: 12px;
  padding-inline: 16px 12px;
}

.tile.text .qty-badge ~ .meta .name {
  padding-inline-end: 32px;
}

.tile .qty-badge {
  position: absolute;
  z-index: 1;
  top: 8px;
  inset-inline-end: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--halo);
}

.tile.added {
  --ring: inset 0 0 0 1px var(--accent);
  border-color: var(--accent);
}

.tile.out.photo {
  --cue: inset 0 4px 0 var(--border-control);
}

.tile.out .img {
  opacity: .5;
}

.tile.out .name,
.tile.out .price {
  color: var(--text-secondary);
}

.tile.out .stock {
  color: var(--danger-text);
  font-weight: 600;
}

/* Cart */
.cart {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
}

.cart-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.cust {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  height: var(--control-h);
  padding-block: 0;
  padding-inline: 8px 12px;
  border-radius: var(--r-control);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.cust .avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.cust-meta {
  min-width: 0;
}

.cust-meta b {
  display: block;
  font-size: var(--fs-md);
  line-height: var(--lh-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-meta small {
  display: block;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lines {
  display: grid;
  align-content: start;
}

.line {
  border-bottom: 1px solid var(--border);
}

.line-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 12px 16px;
  min-height: var(--row-h);
}

.line-head[role="button"] {
  cursor: pointer;
}

.line .q {
  height: 32px;
  min-width: 32px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--bg-muted);
  font-weight: 600;
  font-size: var(--fs-md);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.line .t {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.line .mods {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.line .disc {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--success-text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.line .amt {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: end;
  white-space: nowrap;
}

.line .was {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
  text-decoration: line-through;
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.line.open {
  background: var(--accent-subtle);
  box-shadow: inset 3px 0 0 var(--accent);
}

[dir="rtl"] .line.open {
  box-shadow: inset -3px 0 0 var(--accent);
}

/* Line tools */
.line-tools {
  display: grid;
  gap: var(--gap-touch);
  padding: 0 16px 16px;
}

.line-tools .stepper {
  display: flex;
  width: 100%;
}

.line-tools .stepper output {
  flex: 1;
}

.lt-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.stepper .remove {
  color: var(--danger-icon);
}

.lt-row .btn {
  height: var(--control-h-sm);
  min-width: 0;
  padding: 0 8px;
  font-size: var(--fs-md);
}

/* Quantity stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  height: var(--stepper);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-control);
}

.stepper button {
  all: unset;
  box-sizing: border-box;
  width: var(--stepper);
  height: var(--stepper);
  border: 1px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-control);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}

.stepper button:hover {
  background: var(--bg-muted);
}

.stepper button:active {
  background: var(--bg-muted);
  transform: scale(.95);
}

.stepper button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.stepper button .ti {
  font-size: calc(var(--icon) - 2px);
}

.stepper output {
  min-width: 40px;
  text-align: center;
  font-size: var(--fs-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.totals {
  padding: 12px 16px 16px;
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.totals .row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-md);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.totals .row.save {
  color: var(--success-text);
  font-weight: 500;
}

.totals .grand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 4px;
  color: var(--text);
}

.totals .grand span {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.totals .grand strong {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.actions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-touch);
  margin-top: 6px;
}

.actions-row .btn {
  height: var(--control-h-sm);
  padding: 0 8px;
  font-size: var(--fs-md);
}

@media (max-width: 359px) {
  .pay {
    padding: 0 16px;
  }

  .pay .lbl .ti {
    display: none;
  }

  .actions-row .btn,
  .lt-row .btn {
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    font-size: var(--fs-sm);
    line-height: var(--lh-xs);
  }

  .cart-title .btn {
    width: var(--control-h-sm);
    padding: 0;
  }

  .cart-title .btn .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Pay button */
.pay {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--pay-h);
  border-radius: var(--r-card);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 6px 16px -6px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.pay .lbl {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pay .lbl .ti {
  font-size: 24px;
}

.pay .amt {
  font-variant-numeric: tabular-nums;
  font-size: 24px;
}

.pay:hover {
  background: var(--accent-hover);
}

.pay:active {
  background: var(--accent-pressed);
  transform: translateY(1px);
}

.pay:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.pay[aria-disabled="true"] {
  background: var(--bg-muted);
  color: var(--text-disabled);
  box-shadow: none;
  cursor: not-allowed;
}

.pay.busy {
  background: var(--accent-pressed);
  cursor: progress;
}

.pay.busy .amt {
  display: none;
}

.pay.long .lbl,
.pay.long .amt {
  font-size: var(--fs-lg);
}

.pay.busy .spin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / .35);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

.pay.done {
  background: var(--success);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--success) 55%, transparent);
}

.pay-foot {
  padding: 0 16px 16px;
  display: grid;
  gap: var(--gap-touch);
}

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.key {
  all: unset;
  box-sizing: border-box;
  height: var(--key-h);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 1px solid var(--border-control);
  display: grid;
  place-items: center;
  font-size: var(--fs-4xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border-control);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.key:hover {
  background: var(--bg-subtle);
}

.key:active {
  background: var(--bg-muted);
  transform: translateY(1px);
  box-shadow: none;
}

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

.key.fn {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
}

.key.fn .ti {
  font-size: calc(var(--icon) + 4px);
}

.key.cash {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--accent-text);
}

.key.cash.long {
  font-size: var(--fs-md);
}

.key.cash.longer {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  padding: 0 4px;
  text-align: center;
  overflow-wrap: anywhere;
}

.amount {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 2px solid var(--accent);
}

.amount .lbl {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.amount .val {
  font-size: var(--fs-d1);
  line-height: var(--lh-d1);
  font-weight: 600;
  letter-spacing: -.02em;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.amount .val .cur {
  color: var(--text-secondary);
  font-weight: 500;
  margin-inline-end: 4px;
}

.amount.long .val {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
}

/* Tender tiles */
.tenders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.tender {
  all: unset;
  box-sizing: border-box;
  min-height: var(--control-h-xl);
  line-height: 1.2;
  border-radius: var(--r-card);
  border: 1px solid var(--border-control);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-weight: 600;
  font-size: var(--fs-lg);
  cursor: pointer;
  position: relative;
}

.tender .ti {
  font-size: 24px;
  color: var(--text-secondary);
}

.tender.on {
  background: var(--accent-subtle);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-text);
}

.tender.on .ti {
  color: var(--accent-text);
}

.tender.on::after {
  content: "";
  position: absolute;
  inset-inline-end: 16px;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--ico-check) center / contain no-repeat;
  mask: var(--ico-check) center / contain no-repeat;
}

/* Change due */
.change {
  display: grid;
  gap: 4px;
  padding: 20px;
  border-radius: var(--r-card);
  background: var(--success-subtle);
  color: var(--success-text);
  text-align: center;
}

.change .lbl {
  font-weight: 600;
  font-size: var(--fs-lg);
}

.change .val {
  font-size: var(--fs-d1);
  line-height: var(--lh-d1);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.change .sub {
  font-size: var(--fs-md);
}

.receipts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.receipts .btn {
  height: var(--control-h-lg);
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-md);
}

.receipts .btn .ti {
  font-size: calc(var(--icon) - 2px);
}

/* Offline banner */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  min-height: calc(var(--control-h-sm) + 16px);
  border-radius: var(--r-card);
  background: var(--warning);
  color: var(--on-warning);
  font-weight: 600;
}

.banner .ti {
  font-size: calc(var(--icon) - 2px);
}

.banner .sp {
  flex: 1;
}

.banner .btn {
  flex: none;
  height: var(--control-h-sm);
  background: rgb(0 0 0 / .12);
  border: 0;
  color: inherit;
  box-shadow: none;
  font-weight: 600;
}

.banner .btn:focus-visible {
  outline-color: var(--on-warning);
}

/* PIN */
.pin {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
}

.pin .dots {
  display: flex;
  gap: 16px;
}

.pin .dots i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}

.pin .dots i.f {
  background: var(--text);
  border-color: var(--text);
}

/* ==========================================================================
   5. Register
   ========================================================================== */

/* Status dot */
.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Register layout */
.register {
  --cart-w: clamp(360px, 30vw, 460px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg-app);
  color: var(--text);
  font-size: var(--body-fs);
  line-height: var(--body-lh);
}

.register-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cart-w);
  min-height: 0;
}

.register-work {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
}

/* Work area tabs */
.register-work > [role="tabpanel"]:not([hidden]) {
  grid-row: 2 / -1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.register-side {
  min-width: 0;
  min-height: 0;
  border-inline-start: 1px solid var(--border);
  background: var(--bg-surface);
}

.register[data-hand="left"] .register-main {
  grid-template-columns: var(--cart-w) minmax(0, 1fr);
}

.register[data-hand="left"] .register-side {
  order: -1;
  border-inline-start: 0;
  border-inline-end: 1px solid var(--border);
}

.scroll {
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 4px;
  margin: -4px;
}

.register-work {
  container: work / inline-size;
}

.search-row {
  display: flex;
  gap: var(--gap-touch);
  min-width: 0;
}

.search-row .input {
  flex: 1;
}

@container work (max-width: 560px) {
  .search-row .btn {
    width: var(--control-h);
    padding: 0;
    flex: none;
  }

  .search-row .btn .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 899px) {
  html:has(.register),
  html:has(.register) body {
    height: auto;
  }

  .register {
    height: auto;
  }

  .register-main,
  .register[data-hand="left"] .register-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .register-side,
  .register[data-hand="left"] .register-side {
    order: 0;
    border: 0;
    border-top: 1px solid var(--border);
  }

  .register {
    padding-bottom: calc(var(--pay-h) + 24px + env(safe-area-inset-bottom, 0px));
  }

  html:has(.register) {
    scroll-padding-bottom: calc(var(--pay-h) + 40px);
  }

  .toasts {
    bottom: calc(var(--pay-h) + 40px + env(safe-area-inset-bottom, 0px));
  }

  .cart.panel .pay-foot {
    position: fixed;
    z-index: 30;
    inset-inline: 0;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
  }

  .register:not(.cart-in-view) #pay {
    display: none;
  }

  .register:not(.cart-in-view) .pay.review {
    display: flex;
  }

  .cart.panel .pay-foot:has(> .send-btn) {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .send-btn .send-more {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.pay.review {
  display: none;
}

.pay-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-full);
  background: var(--on-accent);
  color: var(--accent);
  font-size: var(--fs-md);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Register bar */
.regbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.regbar .sp {
  flex: 1;
}

.regbar .vr {
  width: 1px;
  align-self: stretch;
  margin: 6px 4px;
  background: var(--border);
}

.regbar .btn {
  height: var(--control-h-sm);
}

.store {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 4px;
}

.store-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--r-card);
  flex: none;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
}

.store b {
  display: block;
  font-size: var(--fs-lg);
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store > div {
  min-width: 0;
}

.store small {
  display: block;
  font-size: var(--fs-sm);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.regbar .store small {
  white-space: normal;
  overflow: visible;
}

.cashier {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--control-h-sm);
  padding-block: 0;
  padding-inline: 6px 16px;
  min-width: 0;
  max-width: var(--chip-max);
  border-radius: var(--r-control);
  border: 1px solid var(--border-control);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: start;
}

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

@media (max-width: 899px) {
  .regbar > .btn:first-child {
    width: var(--control-h-sm);
    padding: 0;
    flex: none;
  }

  .regbar > .btn:first-child .btn-label,
  .regbar .badge-label,
  .regbar .cashier > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .regbar .cashier {
    flex: none;
    width: var(--control-h-sm);
    max-width: none;
    padding: 0;
    border: 0;
    justify-content: center;
  }

  .regbar > .badge:has(> .badge-label) {
    flex: none;
    padding: 0 8px;
  }

  .regbar .store {
    flex: 0 1 auto;
  }

  .regbar .store b,
  .regbar .store small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .regbar:has(.kds-counts) {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .regbar .kds-counts {
    order: 1;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-block: 4px;
  }

  .regbar .kds-counts li {
    flex: none;
  }
}

@media (max-width: 767px) {
  .regbar {
    padding-inline: 8px;
  }

  .regbar .vr,
  .regbar .sp {
    display: none;
  }

  .regbar .store {
    flex: 1 1 0;
    margin-inline-end: auto;
  }

  .regbar .btn {
    position: relative;
    flex: none;
    width: var(--control-h-sm);
    padding: 0;
  }

  .regbar .btn .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .regbar .btn .badge-count {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    font-size: var(--fs-xs);
  }

  .regbar .store b,
  .regbar .store small {
    white-space: normal;
    overflow: visible;
  }

  .regbar > .badge:has(> .badge-label) {
    padding: 0 6px;
  }

  .regbar .badge-more {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .regbar .regbar-lock {
    display: none;
  }
}

@media (max-width: 599px) {
  .regbar .store-mark {
    display: none;
  }
}

@media (max-width: 359px) {
  .regbar .store small {
    display: none;
  }
}

.cashier .avatar {
  width: 36px;
  height: 36px;
}

.cashier > span:last-child {
  min-width: 0;
}

.cashier b {
  display: block;
  font-size: var(--fs-md);
  line-height: var(--lh-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cashier small {
  display: block;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cart panel */
.cart.panel {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.cart .lines {
  overflow: auto;
  min-height: 0;
}

.cart-top {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.cart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h-sm);
  min-width: 0;
}

.cart-name {
  display: grid;
  min-width: 0;
}

.cart-title h2 {
  margin: 0;
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cart-title .meta {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-xs);
  font-variant-numeric: tabular-nums;
}

.cart-title .sp {
  flex: 1;
}

.cart-title .btn {
  height: var(--control-h-sm);
  padding: 0 16px;
  flex: none;
}

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

.cust .chev {
  margin-inline-start: auto;
  color: var(--text-secondary);
}

.cust.add {
  border-style: dashed;
  border-color: var(--border-control);
  background: transparent;
  color: var(--accent-text);
  font-weight: 600;
}

.cust.add .avatar {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.line-head:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.pay-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--pay-h);
  padding: 0 20px;
  border-radius: var(--r-card);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--fs-lg);
}

.pay-status strong {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Short screens */
@media (min-width: 900px) and (max-height: 639px) {
  .cart.panel {
    display: block;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-bottom: calc(var(--pay-h) + 28px);
  }

  .cart.panel .cart-foot {
    display: contents;
  }

  .cart.panel .lines {
    overflow: visible;
  }

  .cart.panel .pay-foot {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding-top: 12px;
    background: var(--bg-surface);
  }

  .cart.panel .pay-foot:has(> .send-btn) {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .cart.panel .pay-foot:has(> .send-btn) .send-more {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.pay-foot:has(> .send-btn) .pay .lbl .ti {
  display: none;
}

.pay-foot:has(> .send-btn) .pay {
  padding-inline: 12px;
  gap: 8px;
}

.pay-foot > .send-btn {
  padding-inline: 12px;
}

/* Empty state */
.empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.lines:has(> .empty) {
  align-content: stretch;
}

.empty-ico {
  width: 64px;
  height: 64px;
  border-radius: var(--r-sheet);
  display: grid;
  place-items: center;
  background: var(--bg-muted);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-ico .ti {
  font-size: 30px;
}

.empty b {
  color: var(--text);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.empty p {
  margin: 0;
  max-width: 30ch;
  font-size: var(--fs-md);
  line-height: 20px;
}

/* Back header */
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--control-h-sm);
  flex-wrap: wrap;
}

.sheet-head h2 {
  margin: 0;
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
  flex: 1 1 0;
  min-width: min(100%, 8em);
}

.sheet-head > .sp {
  display: none;
}

.sheet-head .sp {
  flex: 1;
}

.sheet-head .meta {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}

.sheet-head .meta b {
  color: var(--text);
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-inline-start: 6px;
}

/* Payment panel */
.payment {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  gap: 16px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.payment-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.payment-body > .stack {
  gap: var(--gap-touch);
}

.tender-due {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: var(--fs-md);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.tender-due b {
  color: var(--text);
  font-weight: 600;
}

.tender-due.short b {
  color: var(--danger-text);
}

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

/* Dialog parts */
.modal .dialog {
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
}

.dialog.dialog-lg {
  max-width: var(--dialog-w-lg);
}

.dialog.dialog-sm {
  max-width: var(--dialog-w-sm);
  text-align: center;
}

.dialog.dialog-sm .dialog-ico {
  margin-inline: auto;
}

.dialog.dialog-sm .dialog-foot {
  justify-content: center;
}

.dialog-step {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal .dialog-body {
  overflow: auto;
  min-height: 0;
}

.dialog-foot {
  flex: none;
}

/* Three-column keypad */
.keypad.pad-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dialog .keypad {
  --key-h: var(--control-h);
}

/* Text area */
textarea.input {
  display: block;
  width: 100%;
  height: auto;
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  line-height: var(--body-lh);
}

/* Line note */
.line .note,
.cart-note {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.line .note .ti,
.cart-note .ti {
  flex: none;
  font-size: 16px;
  margin-top: 2px;
}

/* Toasts */
.toasts {
  position: fixed;
  z-index: 60;
  inset-inline: 16px;
  bottom: 24px;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}

.toasts .toast {
  pointer-events: auto;
  max-width: min(var(--toast-max), 100%);
}

.toast.toast-info .ti {
  color: var(--sky-300);
}

/* Overlays */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--overlay);
}

.drawer {
  position: fixed;
  z-index: 41;
  inset-block: 0;
  inset-inline-start: 0;
  width: min(var(--drawer-w), 88vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  border-inline-end: 1px solid var(--border);
}

.drawer.static {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100%;
  max-width: var(--drawer-w);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.drawer-head,
.drawer-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.drawer-head {
  border-bottom: 1px solid var(--border);
}

.drawer-head .sp,
.drawer-foot .sp {
  flex: 1;
}

.drawer-foot {
  border-top: 1px solid var(--border);
}

.drawer-foot .cust-meta b,
.drawer-foot .cust-meta small,
.drawer-head .store b,
.drawer-head .store small {
  white-space: normal;
}

.drawer-body {
  overflow: auto;
  padding: 8px 12px 16px;
  display: grid;
  align-content: start;
  gap: 2px;
}

.drawer .nav-sec {
  padding-top: 8px;
  padding-bottom: 4px;
}

.setting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: var(--control-h-sm);
  padding: 4px 12px;
  border-radius: var(--r-control);
}

.setting > .segmented {
  margin-inline-start: auto;
}

.setting:has(> .choice) {
  flex-wrap: nowrap;
}

.setting:has(> .choice) > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.form-grid > .setting,
.form-grid > .setting-hinted > .setting {
  padding-inline: 0;
}

.form-grid > .setting-hinted > .hint {
  padding-inline: 0;
}

.form-grid > .setting-hinted.has-ico > .hint {
  padding-inline-start: calc(20px + 12px);
}

.setting > span {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.setting > span .ti {
  color: var(--text-secondary);
  font-size: 20px;
}

.setting-hinted {
  display: grid;
  gap: 2px;
}

.setting-hinted > .hint {
  padding-inline: 12px;
}

.setting-hinted.has-ico > .hint {
  padding-inline-start: calc(12px + 20px + 12px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.totals-rows {
  display: grid;
  gap: 6px;
}

.stack {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.stack.tight {
  gap: var(--gap-touch);
}

.btn-block {
  width: 100%;
}

.payment.finish {
  grid-template-rows: auto minmax(min-content, 1fr) auto;
}

.payment.finish > .change {
  align-self: center;
  padding-block: 40px;
}

@media (max-width: 640px) {
  .tenders,
  .receipts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tender {
    padding: 0 12px;
    gap: 8px;
  }

  .actions-row .btn,
  .receipts .btn {
    min-width: 0;
    padding: 0 6px;
    font-size: var(--fs-md);
    gap: 6px;
  }
}

/* ==========================================================================
   6. Back office: base and layout
   ========================================================================== */

/* Links and headings */
a {
  color: var(--accent-text);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.link {
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-quiet {
  color: inherit;
  text-decoration: none;
}

.link-quiet:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

p {
  margin: 0;
}

.title-1 {
  font-size: var(--fs-3xl);
  line-height: var(--lh-3xl);
  font-weight: 600;
  letter-spacing: -.01em;
}

.title-2 {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
}

.title-3 {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  color: var(--text-secondary);
}

.muted,
.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success-text);
}

.text-danger {
  color: var(--danger-text);
}

.text-warning {
  color: var(--warning-text);
}

.text-accent {
  color: var(--accent-text);
}

.fs-xs {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.fs-sm {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.fs-md {
  font-size: var(--fs-md);
  line-height: var(--lh-md);
}

.fs-lg {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

.fs-xl {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
}

.fs-2xl {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
}

.fs-3xl {
  font-size: var(--fs-3xl);
  line-height: var(--lh-3xl);
}

.fs-4xl {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
}

.fw-400 {
  font-weight: 400;
}

.fw-500 {
  font-weight: 500;
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.justify-center {
  justify-content: center;
}

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

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

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

.nowrap {
  white-space: nowrap;
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
}

/* Layout utilities */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.row > * {
  grid-column: span 12;
  min-width: 0;
}

.row.gap-4 {
  gap: var(--sp-4);
}

.col-1 {
  grid-column: span 1;
}

.col-2 {
  grid-column: span 2;
}

.col-3 {
  grid-column: span 3;
}

.col-4 {
  grid-column: span 4;
}

.col-5 {
  grid-column: span 5;
}

.col-6 {
  grid-column: span 6;
}

.col-7 {
  grid-column: span 7;
}

.col-8 {
  grid-column: span 8;
}

.col-9 {
  grid-column: span 9;
}

.col-10 {
  grid-column: span 10;
}

.col-11 {
  grid-column: span 11;
}

.col-12 {
  grid-column: span 12;
}

@media (min-width: 576px) {
  .col-sm-3 {
    grid-column: span 3;
  }

  .col-sm-4 {
    grid-column: span 4;
  }

  .col-sm-6 {
    grid-column: span 6;
  }

  .col-sm-8 {
    grid-column: span 8;
  }

  .col-sm-12 {
    grid-column: span 12;
  }
}

@media (min-width: 768px) {
  .col-md-3 {
    grid-column: span 3;
  }

  .col-md-4 {
    grid-column: span 4;
  }

  .col-md-5 {
    grid-column: span 5;
  }

  .col-md-6 {
    grid-column: span 6;
  }

  .col-md-7 {
    grid-column: span 7;
  }

  .col-md-8 {
    grid-column: span 8;
  }

  .col-md-12 {
    grid-column: span 12;
  }
}

@media (min-width: 992px) {
  .col-lg-3 {
    grid-column: span 3;
  }

  .col-lg-4 {
    grid-column: span 4;
  }

  .col-lg-5 {
    grid-column: span 5;
  }

  .col-lg-6 {
    grid-column: span 6;
  }

  .col-lg-7 {
    grid-column: span 7;
  }

  .col-lg-8 {
    grid-column: span 8;
  }

  .col-lg-9 {
    grid-column: span 9;
  }

  .col-lg-12 {
    grid-column: span 12;
  }
}

@media (min-width: 1200px) {
  .col-xl-2 {
    grid-column: span 2;
  }

  .col-xl-3 {
    grid-column: span 3;
  }

  .col-xl-4 {
    grid-column: span 4;
  }

  .col-xl-5 {
    grid-column: span 5;
  }

  .col-xl-6 {
    grid-column: span 6;
  }

  .col-xl-7 {
    grid-column: span 7;
  }

  .col-xl-8 {
    grid-column: span 8;
  }

  .col-xl-9 {
    grid-column: span 9;
  }
}

@media (min-width: 1400px) {
  .col-xxl-3 {
    grid-column: span 3;
  }

  .col-xxl-4 {
    grid-column: span 4;
  }

  .col-xxl-6 {
    grid-column: span 6;
  }

  .col-xxl-8 {
    grid-column: span 8;
  }
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 240px), 100%), 1fr));
  gap: var(--sp-4);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

/* Avatar with text */
.cluster:is(:has(> .avatar:first-child), :has(> .swatch:first-child)):has(> :nth-child(2):last-child) {
  flex-wrap: nowrap;
}

.cluster:is(:has(> .avatar:first-child), :has(> .swatch:first-child)):has(> :nth-child(2):last-child) > :first-child {
  flex: none;
}

.cluster:is(:has(> .avatar:first-child), :has(> .swatch:first-child)):has(> :nth-child(2):last-child) > :last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.spread {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-width: 0;
}

.d-none {
  display: none !important;
}

.d-flex {
  display: flex;
}

.d-grid {
  display: grid;
}

.d-block {
  display: block;
}

@media (max-width: 767px) {
  .hide-sm {
    display: none !important;
  }
}

@media (max-width: 991px) {
  .hide-md {
    display: none !important;
  }
}

@media (min-width: 992px) {
  .show-md {
    display: none !important;
  }
}

.gap-0 {
  gap: 0;
}

.gap-1 {
  gap: var(--sp-1);
}

.gap-2 {
  gap: var(--sp-2);
}

.gap-3 {
  gap: var(--sp-3);
}

.gap-4 {
  gap: var(--sp-4);
}

.gap-6 {
  gap: var(--sp-6);
}

.gap-8 {
  gap: var(--sp-8);
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: var(--sp-1);
}

.mt-2 {
  margin-top: var(--sp-2);
}

.mt-3 {
  margin-top: var(--sp-3);
}

.mt-4 {
  margin-top: var(--sp-4);
}

.mt-6 {
  margin-top: var(--sp-6);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: var(--sp-1);
}

.mb-2 {
  margin-bottom: var(--sp-2);
}

.mb-3 {
  margin-bottom: var(--sp-3);
}

.mb-4 {
  margin-bottom: var(--sp-4);
}

.mb-6 {
  margin-bottom: var(--sp-6);
}

.p-3 {
  padding: var(--sp-3);
}

.pt-3 {
  padding-top: var(--sp-3);
}

.ms-auto {
  margin-inline-start: auto;
}

.me-auto {
  margin-inline-end: auto;
}

.ps-4 {
  padding-inline-start: var(--sp-4);
}

.p-0 {
  padding: 0;
}

.p-4 {
  padding: var(--sp-4);
}

.p-6 {
  padding: var(--sp-6);
}

.w-100 {
  width: 100%;
}

.w-auto {
  width: auto;
}

.minw-0 {
  min-width: 0;
}

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

.flex-none {
  flex: none;
}

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

.items-start {
  align-items: flex-start;
}

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

.place-center {
  justify-items: center;
  text-align: center;
}

.justify-end {
  justify-content: flex-end;
}

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

.ratio {
  position: relative;
  aspect-ratio: var(--ratio, 16 / 9);
  overflow: hidden;
}

.ratio > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ratio-1x1 {
  --ratio: 1;
}

.ratio-4x3 {
  --ratio: 4 / 3;
}

.ratio-16x9 {
  --ratio: 16 / 9;
}

.ratio-21x9 {
  --ratio: 21 / 9;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* App frame */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text);
}

.app-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}

/* Sidebar header */
.sidebar-head {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-head .brand {
  flex: 1;
  border-bottom: 0;
}

.drawer-close {
  display: none;
  margin-inline-end: 12px;
}

.rail-toggle {
  display: none;
}

@media (min-width: 992px) {
  .rail-toggle {
    --t: 28px;
    all: unset;
    box-sizing: border-box;
    position: absolute;
    inset-inline-end: calc(var(--t) / -2);
    top: calc((var(--topbar-h) - var(--t)) / 2);
    z-index: 1;
    display: grid;
    place-items: center;
    width: var(--t);
    height: var(--t);
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
  }

  .rail-toggle:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }

  .rail-toggle .ti {
    font-size: 16px;
    transition: rotate var(--dur-base) var(--ease);
  }

  .app[data-sidebar="rail"] .rail-toggle .ti {
    rotate: 180deg;
  }
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--r-control);
  flex: none;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
}

.brand-mark .ti {
  font-size: 20px;
}

.brand-name {
  display: grid;
  min-width: 0;
}

.brand-name b {
  font-size: var(--fs-lg);
  line-height: var(--lh-sm);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-name small {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 16px;
  display: grid;
  align-content: start;
  gap: 2px;
  scrollbar-width: thin;
}

/* Collapsible nav group */
.nav-group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary .ti {
  font-size: var(--icon-nav);
  color: var(--text-secondary);
}

.nav-group > summary .chev {
  margin-inline-start: auto;
  font-size: 16px;
  transition: transform var(--dur-base) var(--ease);
}

.nav-group[open] > summary .chev {
  transform: rotate(90deg);
}

.nav-group > summary:hover {
  background: var(--bg-muted);
}

.nav-group.on > summary {
  color: var(--accent-text);
}

.nav-group.on > summary > .ti:first-child {
  color: var(--accent-text);
}

.nav-sub {
  display: grid;
  gap: 2px;
  padding: 2px 0 6px;
}

.nav-sub .nav-item {
  min-height: 36px;
  padding-inline-start: calc(var(--sp-3) * 2 + var(--icon-nav));
  font-weight: 400;
  color: var(--text-secondary);
  position: relative;
}

.nav-sub .nav-item::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--sp-3) + var(--icon-nav) / 2 - 3px);
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  transform: translateY(-50%);
}

.nav-sub .nav-item:hover {
  color: var(--text);
}

.nav-sub .nav-item.on {
  color: var(--accent-text);
  font-weight: 500;
}

.nav-sub .nav-item.on::before {
  background: var(--accent);
}

.nav-item[aria-current="page"] {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.nav-sub .nav-item[aria-current="page"] {
  background: var(--accent-subtle);
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 8px var(--page-pad);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.topbar .sp {
  flex: 1;
}

.topbar-search {
  flex: 0 1 380px;
  min-width: 0;
  margin: 0;
}

.topbar-search .input {
  width: 100%;
}

.topbar-brand {
  display: none;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-inline-end: 8px;
  color: var(--text);
  text-decoration: none;
}

.topbar-search-btn {
  display: none;
}

.store-switch {
  flex: none;
  white-space: nowrap;
}

.store-switch .chev {
  font-size: 16px;
  color: var(--text-secondary);
}

@media (max-width: 991px) {
  .store-switch [data-store-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.avatar-btn {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 50%;
  cursor: pointer;
  flex: none;
}

.avatar-btn:hover .avatar {
  box-shadow: 0 0 0 2px var(--border-strong);
}

.topbar .avatar {
  width: 32px;
  height: 32px;
}

.dot-badge {
  position: relative;
}

.dot-badge::after {
  content: "";
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg-surface);
}

/* Page */
.page {
  width: 100%;
  max-width: var(--page-max, none);
  margin-inline: auto;
  padding: 24px var(--page-pad) 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-content: start;
  min-width: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.page-head .title-1 {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
}

.page-head .title-1 + nav {
  margin-top: 2px;
}

.page-head .sub {
  color: var(--text-secondary);
  margin-top: 4px;
}

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

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--border-strong);
}

.breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.breadcrumb [aria-current] {
  color: var(--text);
  font-weight: 500;
}

.page-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px var(--page-pad);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.page-foot a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

/* Collapsed sidebar */
@media (min-width: 992px) {
  .app[data-sidebar="rail"] {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .app[data-sidebar="rail"] .sidebar {
    width: var(--rail-w);
    transition: width var(--dur-base) var(--ease);
  }

  .app[data-sidebar="rail"] .sidebar:is(:hover, :focus-within) {
    width: var(--sidebar-w);
    box-shadow: var(--shadow-lg);
  }

  .app[data-sidebar="rail"] .sidebar:not(:hover, :focus-within) :is(
    .nav-group > summary .chev,
    .nav-sub,
    .nav-sec:first-child)
   {
    display: none;
  }

  .app[data-sidebar="rail"] .sidebar:not(:hover, :focus-within) .nav-sec:not(:first-child) {
    height: 1px;
    padding: 0;
    margin: 8px 16px;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    letter-spacing: 0;
    color: transparent;
    background: var(--border);
  }

  .app[data-sidebar="rail"] .sidebar:not(:hover, :focus-within) :is(.brand-name, .nav-group > summary span) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .app[data-sidebar="rail"] .sidebar:not(:hover, :focus-within) :is(.nav-group > summary, .brand) {
    justify-content: center;
    padding: 0;
  }

  .app[data-sidebar="rail"] .sidebar :is(.brand, .nav-group > summary) {
    position: relative;
  }
}

/* Mobile sidebar */
.nav-toggle {
  display: none;
}

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

  .nav-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(var(--sidebar-w), 86vw);
    height: 100dvh;
    z-index: 45;
    box-shadow: var(--shadow-lg);
  }

  .sidebar:not(.open) {
    display: none;
  }

  .topbar {
    padding-inline: 16px;
  }

  .page {
    padding: 16px 16px 32px;
    gap: 16px;
  }

  .page-foot {
    padding-inline: 16px;
  }
}

@media (max-width: 991px) {
  .topbar-brand {
    display: flex;
  }

  .topbar-brand .brand-name {
    display: none;
  }

  .topbar-brand .brand-mark {
    width: 32px;
    height: 32px;
  }

  .sidebar.open .drawer-close {
    display: inline-flex;
  }
}

@media (max-width: 767px) {
  .store-switch {
    display: none;
  }
}

@media (max-width: 575px) {
  .topbar-search,
  .lang-btn {
    display: none;
  }

  .topbar-search-btn {
    display: inline-flex;
  }
}

@media (max-width: 359px) {
  .topbar {
    gap: 4px;
    padding-inline: 12px;
  }

  .topbar-brand {
    margin-inline-end: 4px;
  }
}

/* Card extras */
.card-body {
  padding: var(--card-pad);
}

.card-foot {
  padding: 16px var(--card-pad);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-sub {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.row > * > .card:only-child {
  height: 100%;
}

.card > .table-wrap {
  border: 0;
  border-radius: 0;
}

.card > .table-wrap:last-child {
  border-end-start-radius: calc(var(--r-card) - 1px);
  border-end-end-radius: calc(var(--r-card) - 1px);
}

.card > .list,
.card > [data-by-period] > .list {
  padding-inline: var(--card-pad);
}

:is(.card > .list, .card > [data-by-period] > .list, .card-body .list:not(.popover .list)) > li {
  padding-inline: 0;
}

:is(.card > .list, .card > [data-by-period] > .list, .card-body .list:not(.popover .list)) .list-link {
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: var(--r-sm);
}

/* ==========================================================================
   7. Back office components
   ========================================================================== */

/* Data table */
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
}

.table-wrap:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.table td,
.table th {
  vertical-align: middle;
}

.table th.sel,
.table td.sel {
  width: 48px;
  padding-inline-end: 0;
}

.table th .sort {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  cursor: pointer;
  border-radius: var(--r-sm);
  color: inherit;
  font: inherit;
}

.table th .sort:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.table th .sort .ti {
  font-size: 14px;
  color: var(--text-disabled);
}

.table th[aria-sort="ascending"] .sort .ti,
.table th[aria-sort="descending"] .sort .ti {
  color: var(--accent-text);
}

.table th .sort:hover {
  color: var(--text);
}

.table tbody tr[aria-selected="true"] td {
  background: var(--accent-subtle);
}

.table tfoot td {
  font-weight: 600;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.table .group-row :is(td, th) {
  background: none;
  font-weight: 700;
  color: var(--text);
  text-align: start;
}

.table.statement :is(tbody, tfoot) th {
  padding: 6px 16px;
  height: var(--row-h);
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  font-weight: 400;
  color: var(--text);
  background: none;
  white-space: normal;
}

.table.statement tfoot th {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.table.statement .account {
  padding-inline-start: 32px;
}

.table.statement .group-row th {
  font-weight: 700;
}

.table.statement .sub-row :is(th, td) {
  font-weight: 700;
}

.table.statement tfoot :is(th, td) {
  height: 56px;
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: start;
}

.table.statement tfoot td.r {
  text-align: end;
}

/* Product thumbnail */
.thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex: none;
  background: var(--bg-muted);
}

.thumb-ico {
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.thumb-ico .ti {
  font-size: 18px;
}

.table td a:not(.btn),
.card-foot > a,
.popover-head > a,
.breadcrumb a,
.dl dd > a,
.stat-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.table .cell-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: var(--cell-main-min);
}

.table .cell-main b {
  display: block;
  font-weight: 500;
}

.table .cell-main small {
  display: block;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
}

.table .cell-main > span {
  min-width: 0;
}

.table .actions {
  text-align: end;
  white-space: nowrap;
}

.table.compact td {
  height: 40px;
}

.bulk-bar b {
  font-weight: 600;
}

/* Table in a card */
.card > [data-table-box] {
  padding-block: var(--card-pad);
}

.card > [data-table-box] > :not(.table-wrap, [data-table-empty]) {
  margin-inline: var(--card-pad);
}

.card > [data-table-box] > .table-wrap {
  border-inline: 0;
  border-radius: 0;
}

.chips:empty {
  display: none;
}

/* Row actions */
.row-actions {
  display: inline-flex;
  gap: 4px;
  justify-content: flex-end;
}

.row-action-gap {
  visibility: hidden;
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-bar .input {
  flex: 1 1 240px;
  max-width: var(--search-max);
}

.filter-bar select.input {
  flex: 0 1 180px;
}

@media (min-width: 768px) {
  .filter-bar .bar-end {
    flex-wrap: nowrap;
  }
}

@media (max-width: 767px) {
  .filter-bar .bar-end {
    width: 100%;
  }
}

@media (max-width: 575px) {
  .filter-bar .bar-end {
    width: 100%;
  }

  .filter-bar .bar-end select.input {
    flex: 1 1 100%;
    max-width: none;
  }
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding-block: 0;
  padding-inline: 12px 4px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.table td > .cluster:has(> .chip) {
  padding-block: 4px;
}

.chip button {
  all: unset;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
}

.chip button:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.chip button .ti {
  font-size: 14px;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 359px) {
  .pager {
    gap: 0;
  }

  .pager a,
  .pager button {
    padding: 0 4px;
  }
}

.pager a,
.pager button {
  all: unset;
  box-sizing: border-box;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.pager a:hover,
.pager button:hover {
  background: var(--bg-muted);
}

.pager [aria-current="page"],
.pager [aria-current="page"]:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.pager li {
  display: flex;
  align-items: center;
}

.pager li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
}

.pager [aria-disabled="true"] {
  color: var(--text-disabled);
  cursor: default;
  background: none;
}

.pager .ti {
  font-size: 16px;
}

.per-page {
  display: flex;
  align-items: center;
  gap: 8px;
}

.per-page select.input {
  height: 32px;
  padding-block: 0;
}

@media (max-width: 575px) {
  .pagination {
    justify-content: center;
  }
}

/* Menu */
.menu {
  position: fixed;
  z-index: 55;
  min-width: var(--menu-min);
  max-width: min(var(--menu-max), calc(100vw - 32px));
  max-height: min(var(--float-max-h), calc(100dvh - 32px));
  overflow: auto;
  padding: 4px;
  display: grid;
  gap: 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
}

.menu [role="group"] {
  display: grid;
  gap: 2px;
}

.menu-item {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-md);
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover {
  background: var(--bg-muted);
}

.menu-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  background: var(--bg-muted);
}

.menu-item .ti {
  font-size: 18px;
  color: var(--text-secondary);
}

.menu-item.danger {
  color: var(--danger-text);
}

.menu-item.danger .ti {
  color: var(--danger-icon);
}

.menu-item .kbd {
  margin-inline-start: auto;
}

.menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

.menu-item[aria-checked="true"] {
  color: var(--accent-text);
  font-weight: 600;
}

.menu-item[aria-checked="true"] .ti {
  color: var(--accent-text);
}

.menu-head {
  padding: 8px 12px 4px;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 70;
  max-width: var(--tip-max);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-inverse);
  color: var(--text-inverse);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.tooltip::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  translate: -50% 0;
  border: 6px solid transparent;
}

.tooltip[data-side="top"]::after {
  top: 100%;
  border-top-color: var(--bg-inverse);
  border-bottom-width: 0;
}

.tooltip[data-side="bottom"]::after {
  bottom: 100%;
  border-bottom-color: var(--bg-inverse);
  border-top-width: 0;
}

/* Popover */
.popover {
  position: fixed;
  z-index: 55;
  width: min(var(--popover-w, 360px), calc(100vw - 32px));
  max-height: min(var(--float-max-h), calc(100dvh - 32px));
  overflow: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px var(--card-pad);
  border-bottom: 1px solid var(--border);
}

.popover-foot {
  padding: 8px var(--card-pad);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* In-page popover */
.popover.has-arrow {
  --popover-w: 276px;
  overflow: visible;
}

.popover.has-arrow::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: var(--arrow);
  height: var(--arrow);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  rotate: 45deg;
}

.popover.has-arrow:is([data-side="right"], [data-side="left"])::before {
  top: calc(var(--arrow-y) - var(--arrow) / 2);
}

.popover.has-arrow:is([data-side="top"], [data-side="bottom"])::before {
  left: calc(var(--arrow-x) - var(--arrow) / 2);
}

.popover.has-arrow[data-side="right"]::before {
  left: calc(var(--arrow) / -2 - 1px);
  border-top-color: transparent;
  border-right-color: transparent;
}

.popover.has-arrow[data-side="left"]::before {
  right: calc(var(--arrow) / -2 - 1px);
  border-bottom-color: transparent;
  border-left-color: transparent;
}

.popover.has-arrow[data-side="bottom"]::before {
  top: calc(var(--arrow) / -2 - 1px);
  border-bottom-color: transparent;
  border-right-color: transparent;
}

.popover.has-arrow[data-side="top"]::before {
  bottom: calc(var(--arrow) / -2 - 1px);
  border-top-color: transparent;
  border-left-color: transparent;
}

/* Avatars */
.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: var(--fs-xs);
}

.avatar.lg {
  width: 40px;
  height: 40px;
  font-size: var(--fs-md);
}

.avatar.xl {
  width: 56px;
  height: 56px;
  font-size: var(--fs-lg);
}

.avatar.xxl {
  width: 96px;
  height: 96px;
  font-size: var(--fs-3xl);
}

.avatar.square {
  border-radius: var(--r-control);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar {
  position: relative;
  overflow: visible;
}

.avatar .status {
  position: absolute;
  bottom: 0;
  inset-inline-end: 0;
  width: 25%;
  height: 25%;
  min-width: 8px;
  min-height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--bg-surface);
}

.avatar .status.away {
  background: var(--warning);
}

.avatar .status.busy {
  background: var(--danger);
}

.avatar .status.offline {
  background: var(--gray-400);
}

.avatar-group .avatar.more {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  width: 32px;
  height: 32px;
  font-size: var(--fs-xs);
  box-shadow: 0 0 0 2px var(--bg-surface);
}

.avatar-group .avatar + .avatar {
  margin-inline-start: -8px;
}

.avatar.tone-violet {
  background: var(--violet-100);
  color: var(--violet-800);
}

.avatar.tone-amber {
  background: var(--amber-100);
  color: var(--amber-800);
}

.avatar.tone-green {
  background: var(--green-100);
  color: var(--green-800);
}

.avatar.tone-pink {
  background: var(--pink-100);
  color: var(--pink-800);
}

.avatar.tone-gray {
  background: var(--gray-100);
  color: var(--gray-800);
}

[data-theme="dark"] .avatar.tone-violet,
[data-theme="dark"] .avatar.tone-amber,
[data-theme="dark"] .avatar.tone-green,
[data-theme="dark"] .avatar.tone-pink,
[data-theme="dark"] .avatar.tone-gray {
  background: var(--bg-muted);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar[class*="tone-"] {
    background: var(--bg-muted);
    color: var(--text);
  }
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 768px) {
  .form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.two > .span-2,
  .form-grid.two > .setting {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid.three > .span-2 {
    grid-column: 1 / -1;
  }
}

/* Form sections */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.form-actions .sp {
  flex: 1;
}

@media (max-width: 575px) {
  .form-actions:has(> .btn ~ .btn ~ .btn) {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .form-actions:has(> .btn ~ .btn ~ .btn) > .sp {
    display: none;
  }
}

.input-group {
  display: flex;
  min-width: 0;
}

.input-group > .input {
  flex: 1;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-group > .btn {
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  margin-inline-start: -1px;
}

.input .btn-reveal {
  all: unset;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-secondary);
}

.input .btn-reveal:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.input .btn-reveal:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.required::after {
  content: " *";
  color: var(--danger-text);
}

/* Description list */
.dl {
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  column-gap: 24px;
  margin: 0;
  container-type: inline-size;
}

.dl > div {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 2px;
  padding-block: 12px;
}

.dl > div + div {
  border-top: 1px solid var(--border);
}

.dl > div:first-child {
  padding-top: 0;
}

.dl > div:last-child {
  padding-bottom: 0;
}

.dl dt {
  color: var(--text-secondary);
  font-size: var(--fs-md);
}

.dl dd {
  margin: 0;
  margin-inline-start: auto;
  min-width: 0;
  font-weight: 500;
  text-align: end;
  overflow-wrap: anywhere;
}

.dl > div:has(> dd > svg, > dd > img, > dd > .badge:only-child) {
  align-items: center;
}

.dl-stacked > div {
  flex-direction: column;
  align-items: stretch;
}

.dl-stacked dd {
  margin-inline-start: 0;
  text-align: start;
}

@container (min-width: 520px) {
  .dl > div {
    display: grid;
    grid-template-columns: subgrid;
  }

  .dl dd {
    margin-inline-start: 0;
    text-align: start;
  }
}

/* Progress and meter */
.progress {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--accent);
}

.progress.success > span {
  background: var(--success);
}

.progress.warning > span {
  background: var(--warning);
}

.progress.danger > span {
  background: var(--danger);
}

.progress-row {
  display: grid;
  gap: 6px;
}

.progress-row .spread {
  font-size: var(--fs-sm);
}

.progress.stacked {
  display: flex;
  gap: 4px;
  background: none;
  border-radius: 0;
}

.progress.stacked > span {
  flex: none;
  width: var(--value);
  border-radius: var(--r-full);
  background: var(--c, var(--accent));
}

/* Change indicator */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.delta.good {
  color: var(--success-text);
}

.delta.bad {
  color: var(--danger-text);
}

.delta .ti {
  font-size: 16px;
}

/* List group */
.list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--card-pad);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

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

.list > li:has(> .list-link) {
  padding: 0;
}

.list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 12px var(--card-pad);
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}

.list-link:hover {
  background: var(--bg-subtle);
}

.list-link:hover .grow b {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.list-link:focus-visible {
  outline-offset: -2px;
}

.list .grow {
  flex: 1;
  min-width: 0;
}

.list .grow b {
  display: block;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.list .grow small {
  display: block;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.list .end {
  text-align: end;
  font-variant-numeric: tabular-nums;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 50%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.list-ico {
  width: 36px;
  height: 36px;
  border-radius: var(--r-control);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.list-ico .ti {
  font-size: 18px;
}

.list-ico.accent {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.list-ico.success {
  background: var(--success-subtle);
  color: var(--success-text);
}

.list-ico.warning {
  background: var(--warning-subtle);
  color: var(--warning-text);
}

.list-ico.danger {
  background: var(--danger-subtle);
  color: var(--danger-text);
}

/* Timeline */
.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline > li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
}

.timeline > li:last-child {
  padding-bottom: 0;
}

.timeline > li::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(32px / 2);
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline > li:last-child::before {
  content: none;
}

.timeline .t-ico {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.timeline .t-ico .ti {
  font-size: 16px;
}

.timeline .t-ico.accent {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.timeline .t-ico.success {
  background: var(--success-subtle);
  color: var(--success-text);
}

.timeline .t-ico.danger {
  background: var(--danger-subtle);
  color: var(--danger-text);
}

.timeline > li > div {
  padding-top: 6px;
}

.timeline b {
  display: block;
  font-weight: 500;
}

.timeline small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

/* Steps */
.steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  gap: 8px;
  counter-increment: step;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.steps > li::before {
  content: "";
  height: 4px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
}

.steps > li.done::before,
.steps > li[aria-current="step"]::before {
  background: var(--accent);
}

.steps > li[aria-current="step"] {
  color: var(--text);
  font-weight: 600;
}

.steps > li.done {
  color: var(--text);
}

@media (max-width: 575px) {
  .steps:has(> li:nth-child(5)) {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .steps:has(> li:nth-child(5)) > li {
    flex: 1 1 calc(33.333% - 8px);
  }
}

/* Spinner and skeleton */
.spinner.sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner.lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

.spinner.grow {
  border: 0;
  background: var(--accent);
  animation: grow .8s ease-out infinite;
}

@keyframes grow {
  0% {
    transform: scale(0);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-control);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  display: inline-block;
}

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%) 0 0 / 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  min-height: 12px;
}

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

[dir="rtl"] .skeleton {
  animation-direction: reverse;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* Chart frame */
.chart {
  position: relative;
  min-height: var(--chart-h);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
  background: var(--c, var(--accent));
}

/* Chart legend */
.legend-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto minmax(40px, auto);
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: var(--fs-md);
}

.legend-list i {
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
  background: var(--c, var(--accent));
}

.legend-list b {
  font-weight: 600;
  text-align: end;
}

.legend-list .muted {
  text-align: end;
}

/* Sparkline cell */
.spark {
  width: var(--spark-w);
  max-width: 100%;
}

/* Upload */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-card);
  background: var(--bg-subtle);
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.dropzone:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dropzone .ti {
  font-size: calc(var(--icon) + 14px);
}

.dropzone b {
  color: var(--text);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg-surface);
}

.file-item .grow {
  flex: 1;
  min-width: 0;
}

.file-item b {
  display: block;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.file-item small {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.file-item .file-thumb {
  width: 48px;
  height: 36px;
  flex: none;
  object-fit: cover;
  border-radius: var(--r-sm);
}

.photo-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.photo-tile {
  position: relative;
  width: 120px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
}

.photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-tile .btn {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

/* Copy field */
.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-block: 4px;
  padding-inline: 12px 4px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

.copy-field code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Option card */
.option-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  cursor: pointer;
}

.option-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-subtle);
}

.option-card:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.option-card > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option-card::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  box-sizing: border-box;
  width: var(--check);
  height: var(--check);
  margin-top: 1px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-surface);
}

.option-card:has(input:checked)::before {
  border: calc(var(--check) * .3) solid var(--accent);
}

.option-card > :not(input) {
  grid-column: 2;
}

div.option-card > label {
  display: grid;
  gap: 4px;
  cursor: pointer;
}

div.option-card > label::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.option-card b {
  font-weight: 600;
}

.option-card small {
  color: var(--text-secondary);
}

/* Accordion */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  overflow: hidden;
}

.accordion details + details {
  border-top: 1px solid var(--border);
}

.accordion summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary .ti {
  transition: transform var(--dur-base) var(--ease);
  color: var(--text-secondary);
}

.accordion details[open] summary .ti {
  transform: rotate(180deg);
}

.accordion summary:focus-visible {
  outline-offset: -2px;
}

.accordion .acc-body {
  padding: 0 16px 16px;
  color: var(--text-secondary);
}

/* Key figures */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--stat-min, 220px), 100%), 1fr));
  gap: var(--gutter);
}

.stats.five {
  --stat-min: 180px;
}

.stats:has(> :nth-child(4):last-child) {
  --m: var(--stat-min, 220px);
  --g: var(--gutter);
  grid-template-columns: repeat(auto-fit, minmax(max(calc((100% - 3 * var(--g)) / 4 - .5px), min(calc((100% - var(--g)) / 2 - .5px), calc((4 * var(--m) + 3 * var(--g) - 100%) * 999)), min(100%, calc((2 * var(--m) + var(--g) - 100%) * 999))), 1fr));
}

html:has(.app) {
  scroll-padding-top: calc(var(--topbar-h) + var(--hnav-h, 0px) + 16px);
}

/* Skip link */
.skip {
  position: fixed;
  z-index: 80;
  top: 8px;
  inset-inline-start: 8px;
  padding: 8px 16px;
  border-radius: var(--r-control);
  background: var(--bg-raised);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

.m-0 {
  margin: 0;
}

.chart-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

@media (max-width: 767px) {
  .btn-collapse {
    padding: 0;
    width: var(--control-h);
  }

  .btn-collapse .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Blank layout */

/* Totals */
.totals-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.totals-list > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.totals-list dt {
  color: var(--text-secondary);
}

.totals-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.totals-list .grand {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

.totals-list .grand:first-child {
  padding-top: 0;
  border-top: 0;
}

.totals-list .grand dt,
.totals-list .grand dd {
  color: var(--text);
  font-weight: 700;
}

/* Line items editor */
.line-editor {
  display: grid;
  gap: 16px;
}

.line-editor .table td {
  padding-block: 8px;
  height: auto;
}

.line-editor .table .input {
  width: 100%;
}

.line-editor .table td:first-child .input {
  min-width: var(--field-min);
}

.line-editor .qty,
.line-editor .disc {
  width: 96px;
}

.line-editor .price {
  width: 120px;
}

.line-editor .table .input input {
  width: 0;
}

.line-editor .foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.line-editor .foot > .totals-list:not(:has(input)) > div:first-child {
  min-height: var(--control-h);
}

.line-editor .totals-list {
  width: min(100%, var(--totals-w));
  margin-inline-start: auto;
}

/* Documents */
.doc {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  box-shadow: var(--shadow-xs);
}

.doc-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.doc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-title {
  text-align: end;
}

.doc-title h2 {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
  letter-spacing: -.01em;
}

.doc-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  margin: 12px 0 0;
}

.doc-meta > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  column-gap: 6px;
}

.doc-meta dt {
  color: var(--text-secondary);
}

.doc-meta dd {
  margin: 0;
  font-weight: 500;
}

.doc-parties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 24px;
}

.doc-parties h3 {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.doc-parties p {
  color: var(--text-secondary);
}

.doc-parties b {
  color: var(--text);
}

.doc .table-wrap {
  border-radius: var(--r-control);
}

.doc-sum {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}

.doc-sum .totals-list {
  width: min(100%, var(--totals-w));
  margin-inline-start: auto;
}

.doc-note {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  max-width: 48ch;
}

/* Document templates */
.doc.tpl-modern {
  padding-top: 0;
  overflow: hidden;
}

.doc.tpl-modern .doc-head {
  margin-inline: -40px;
  padding: 32px 40px;
  background: var(--accent);
  color: var(--on-accent);
}

.doc.tpl-modern .doc-head :is(p, .muted, .doc-meta dt) {
  color: inherit;
}

.doc.tpl-modern .doc-head .brand-mark {
  background: var(--on-accent);
  color: var(--accent);
}

.doc.tpl-modern .table-wrap,
.doc.tpl-minimal .table-wrap {
  border: 0;
  border-radius: 0;
}

.doc.tpl-modern .table thead th {
  background: none;
  border-bottom: 2px solid var(--text);
}

.doc.tpl-minimal {
  padding: 64px;
  box-shadow: none;
}

.doc.tpl-minimal .brand-mark {
  display: none;
}

.doc.tpl-minimal .doc-title h2 {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
}

.doc.tpl-minimal .table thead th {
  background: none;
  color: var(--text-secondary);
  font-weight: 500;
}

@media (max-width: 575px) {
  .doc.tpl-modern .doc-head {
    margin-inline: -20px;
    padding: 24px 20px;
  }

  .doc.tpl-minimal {
    padding: 24px;
  }
}

.tpl-thumb {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-muted);
}

.tpl-page {
  display: block;
  width: var(--a4-w);
}

.tpl-page .doc {
  min-height: calc(var(--a4-w) * 297 / 210);
  border: 0;
  border-radius: 0;
}

.tpl-card .tpl-in-use {
  display: none;
}

.tpl-card:has(input:checked) .tpl-in-use {
  display: inline-flex;
}

@media (max-width: 575px) {
  .doc {
    padding: 20px;
    gap: 24px;
  }

  .doc-title {
    text-align: start;
  }

  .doc-meta {
    justify-items: start;
  }

  .doc-meta > div {
    justify-content: flex-start;
  }
}

/* Print area */
@media print {
  .sidebar,
  .topbar,
  .page-foot,
  .page-actions,
  .form-actions,
  .skip,
  .toasts,
  .no-print {
    display: none !important;
  }

  .app {
    display: block;
  }

  .page {
    padding: 0;
    max-width: none;
  }

  body {
    background: #fff;
  }

  .doc {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Barcode */
.barcode {
  display: block;
  width: 100%;
  max-width: var(--barcode-w);
  height: auto;
  color: var(--text);
  background: #fff;
}

.barcode-digits {
  font-family: var(--font-mono);
  font-weight: 500;
  fill: currentColor;
}

[data-theme="dark"] .barcode {
  color: #000;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .barcode {
    color: #000;
  }
}

.qr {
  width: var(--qr-w);
  aspect-ratio: 1;
  background: #fff;
  color: #000;
  padding: 8px;
  border-radius: var(--r-sm);
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Product cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--card-min, 240px), 100%), 1fr));
  gap: 16px;
}

@media (max-width: 575px) {
  .product-grid {
    --card-min: 150px;
    gap: 12px;
  }

  .product-card {
    padding: 8px;
  }

  .pc-body {
    padding: 8px 0 0;
  }
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  padding: 12px;
  box-shadow: var(--shadow-xs);
}

.product-card:hover {
  border-color: var(--border-strong);
}

.product-card:hover .pc-name {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-card:focus-visible {
  outline-offset: 2px;
}

.product-card img,
.product-card .pc-ph {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

.product-card .pc-ph {
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.product-card .pc-ph .ti {
  font-size: var(--fs-4xl);
}

.pc-body {
  display: grid;
  gap: 4px;
  padding: 12px 4px 4px;
  align-content: start;
  overflow-wrap: anywhere;
}

.pc-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pc-meta {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.pc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.pc-price {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Misc */
.swatch {
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
  background: var(--c, var(--accent));
  flex: none;
}

.range {
  width: 100%;
  height: 24px;
  accent-color: var(--accent);
}

.input.qty-sm {
  width: 96px;
}

.count-search {
  max-width: var(--search-max);
}

img.w-100 {
  height: auto;
}

.rounded {
  border-radius: var(--r-card);
}

.product-photo {
  max-width: var(--photo-max);
}

.readout {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Product labels */
.print-label {
  width: var(--label-w);
  height: var(--label-h);
  padding: 2mm 3mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  background: #fff;
  color: #000;
  border: 1px dashed var(--gray-400);
  border-radius: var(--r-xs);
  overflow: hidden;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

/* Label sheet */
.sheet-stage {
  padding: 16px;
  background: var(--bg-muted);
  border-radius: var(--r-control);
  overflow: hidden;
}

.label-sheet {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--label-w));
  grid-auto-rows: var(--label-h);
  column-gap: var(--gap-x);
  row-gap: var(--gap-y);
  align-content: start;
  width: var(--page-w);
  min-height: var(--page-h);
  margin-inline: auto;
  padding: var(--m-top) var(--m-side);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.label-sheet .print-label {
  width: auto;
  height: auto;
  border-color: var(--gray-300);
}

.label-sheet .print-label.blank {
  background: none;
}

.avery-5160 {
  --page-w: 8.5in;
  --page-h: 11in;
  --label-w: 2.625in;
  --label-h: 1in;
  --cols: 3;
  --gap-x: .125in;
  --gap-y: 0in;
  --m-top: .5in;
  --m-side: .1875in;
}

.avery-l7159 {
  --page-w: 210mm;
  --page-h: 297mm;
  --label-w: 63.5mm;
  --label-h: 33.9mm;
  --cols: 3;
  --gap-x: 2.5mm;
  --gap-y: 0mm;
  --m-top: 12.9mm;
  --m-side: 6.4mm;
}

.avery-l7163 {
  --page-w: 210mm;
  --page-h: 297mm;
  --label-w: 99.1mm;
  --label-h: 38.1mm;
  --cols: 2;
  --gap-x: 2.5mm;
  --gap-y: 0mm;
  --m-top: 15.1mm;
  --m-side: 4.7mm;
}

.dymo-30334 {
  --page-w: 65mm;
  --page-h: 0mm;
  --label-w: 57mm;
  --label-h: 32mm;
  --cols: 1;
  --gap-x: 0mm;
  --gap-y: 3mm;
  --m-top: 4mm;
  --m-side: 4mm;
}

.label-sheet.avery-l7159 .print-label:nth-child(n+25),
.label-sheet.avery-l7163 .print-label:nth-child(n+15),
.label-sheet.dymo-30334 .print-label.blank {
  display: none;
}

.print-label .lbl-store {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.print-label .lbl-code {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
}

.print-label .lbl-code .barcode {
  height: 100%;
}

:is(.label-sheet, .print-label).code-sku [data-code="gtin"],
:is(.label-sheet, .print-label).code-gtin [data-code="sku"] {
  display: none;
}

.sort-list .setting {
  flex: 1;
  min-width: 0;
  padding-inline: 0;
  flex-wrap: nowrap;
}

.sort-list .setting > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.print-label b {
  font-weight: 600;
}

.print-label .ld-name {
  font-size: var(--name-size, var(--fs-md));
  line-height: 1.25;
}

.print-label .label-price {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.print-label .barcode,
.print-label [data-part="barcode"] {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  background: transparent;
  color: #000;
}

.print-label [data-part="barcode"] {
  display: flex;
}

.print-label [data-part="barcode"] .barcode {
  height: 100%;
}

.label-stage {
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg-muted);
  border-radius: var(--r-control);
  overflow-x: auto;
}

.shelf-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, 57mm);
  gap: 8px;
}

.shelf-label {
  position: relative;
  width: 57mm;
  height: 32mm;
  padding: 2mm 3mm;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr auto;
  column-gap: 8px;
  background: #fff;
  color: #000;
  border: 1px dashed var(--gray-400);
  border-radius: var(--r-xs);
  overflow: hidden;
}

.shelf-label .sl-name {
  grid-column: 1 / -1;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.shelf-label .sl-price {
  grid-column: 1;
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.shelf-label:not(.promo) .sl-price {
  grid-column: 1 / -1;
}

.shelf-label .sl-was {
  grid-column: 2;
  align-self: center;
  font-size: var(--fs-xs);
  text-decoration: line-through;
}

.shelf-label .sl-unit {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.shelf-label .barcode {
  grid-column: 1;
  grid-row: 4;
  width: 100%;
  height: 6mm;
  max-width: none;
  background: transparent;
  color: #000;
}

.shelf-label .sl-sku {
  grid-column: 2;
  grid-row: 4;
  align-self: center;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.shelf-label.promo {
  background: var(--amber-100);
}

.promo-tag {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  padding: 2px 8px;
  background: #000;
  color: #fff;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 700;
  border-end-start-radius: var(--r-xs);
}

.qr-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: 16px;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-card);
  text-align: center;
}

.qr-card figcaption {
  display: grid;
  gap: 2px;
}

/* Loyalty card */
.loyalty-card {
  width: min(100%, var(--loyalty-w));
  aspect-ratio: 85.6 / 54;
  padding: 20px;
  border-radius: var(--r-sheet);
  display: grid;
  align-content: space-between;
  gap: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-800), var(--violet-800));
  box-shadow: var(--shadow-md);
}

.loyalty-card .ti {
  font-size: var(--fs-3xl);
}

.lc-code {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--r-control);
  background: #fff;
  color: #000;
}

.lc-code .barcode {
  display: block;
  width: 100%;
  height: 36px;
  max-width: none;
  background: none;
  color: #000;
}

.lc-num {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  letter-spacing: .08em;
}

/* Roster */
.shift-chip {
  display: grid;
  gap: 0;
  width: 100%;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 55%, transparent);
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--bg-surface));
  color: var(--text);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shift-chip b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shift-chip > span {
  color: var(--text-secondary);
}

/* Gift card */
.gift-card-art {
  width: min(100%, var(--loyalty-w));
  aspect-ratio: 85.6 / 54;
  padding: 20px;
  border-radius: var(--r-sheet);
  display: grid;
  align-content: space-between;
  color: #fff;
  background: linear-gradient(135deg, var(--green-800), var(--teal-800));
  box-shadow: var(--shadow-md);
}

.gift-card-art .ti {
  font-size: var(--fs-3xl);
}

.gc-amount {
  font-size: var(--fs-5xl);
  line-height: var(--lh-5xl);
  font-weight: 700;
}

/* Feature list */
.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.check-list .ti {
  color: var(--success-icon);
  margin-top: 2px;
}

.check-list li.off {
  color: var(--text-secondary);
}

.check-list li.off .ti {
  color: var(--text-disabled);
}

/* Financial statement */
.report-doc {
  gap: 24px;
  padding: 32px;
}

.stmt h3 {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}

.stmt-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--text);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

@media (max-width: 575px) {
  .report-doc {
    padding: 20px;
  }
}

/* Storefront */
.shop {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-app);
}

.shop-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  min-height: var(--topbar-h);
  padding: 8px var(--page-pad);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.shop-head .brand {
  height: auto;
  padding: 0;
  border: 0;
}

.shop-head .sp {
  flex: 1;
}

.shop-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.shop-menu-btn {
  display: none;
}

.shop-nav-phone {
  display: none;
}

@media (max-width: 991px) {
  .shop-head {
    column-gap: 8px;
  }

  .shop-head .brand-name small,
  .shop-desk {
    display: none;
  }

  .shop-cart {
    padding-inline: 8px;
  }

  .shop-cart-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .shop-menu-btn,
  .shop-nav-phone {
    display: inline-flex;
  }

  .shop-nav {
    display: none;
    order: 9;
    flex-basis: 100%;
    flex-direction: column;
  }

  .shop-head:has(.shop-menu-btn[aria-expanded="true"]) .shop-nav {
    display: flex;
  }
}

.shop-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 12px;
  border-radius: var(--r-control);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.shop-nav a:hover {
  background: var(--bg-muted);
}

.shop-nav a[aria-current="page"] {
  color: var(--accent-text);
  background: var(--accent-subtle);
}

.shop-main {
  width: 100%;
  max-width: var(--shop-max);
  margin-inline: auto;
  padding: 24px var(--page-pad) 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-content: start;
}

.shop-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding: 16px var(--page-pad);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  background: var(--bg-surface);
}

.shop-foot a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

html:has(.shop) {
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

@media (max-width: 991px) {
  .shop-head {
    position: static;
  }

  .shop-head,
  .shop-main,
  .shop-foot {
    padding-inline: 16px;
  }

  .shop-nav {
    order: 3;
    width: 100%;
  }

  html:has(.shop) {
    scroll-padding-top: 16px;
  }
}

@media (max-width: 991px) {
  .shop-head {
    position: relative;
    flex-wrap: nowrap;
  }

  .shop-head .brand,
  .shop-head .brand-name {
    min-width: 0;
  }

  .shop-head .brand-name b {
    display: block;
    white-space: nowrap;
  }

  .shop-head .sp {
    min-width: 0;
  }

  .shop-head .shop-nav {
    position: absolute;
    z-index: 21;
    top: 100%;
    inset-inline: 0;
    width: auto;
    padding: 8px 16px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
}

@media (max-width: 359px) {
  .shop-head .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Product page */
.pdp {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}

@media (min-width: 992px) {
  .pdp {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.pdp-photo {
  display: block;
  width: 100%;
  max-width: var(--photo-sharp);
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-sheet);
  background: var(--bg-muted);
}

.pdp-price {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
}

.option-set {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.option-chip {
  position: relative;
  display: inline-flex;
}

.option-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option-chip span {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 16px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-full);
  cursor: pointer;
  font-weight: 500;
}

.option-chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option-chip input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.qty-field {
  max-width: var(--qty-field);
}

.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--amber-500);
}

.stars .ti {
  font-size: 16px;
  color: var(--border-strong);
}

.stars .ti {
  fill: currentColor;
}

.stars .ti.on {
  color: var(--amber-500);
}

.star-half {
  display: inline-grid;
}

.star-half > .ti {
  grid-area: 1 / 1;
}

.star-half > .ti.on {
  clip-path: inset(0 50% 0 0);
}

[dir="rtl"] .star-half > .ti.on {
  clip-path: inset(0 0 0 50%);
}

.track {
  max-width: var(--track-max);
  margin-inline: auto;
  width: 100%;
  display: grid;
  gap: 16px;
}

/* Featured plan */
.plan-featured {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Settings */
.settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 992px) {
  .settings {
    grid-template-columns: var(--settings-nav-w) minmax(0, 1fr);
  }

  .settings-mobile {
    display: none;
  }
}

.settings-nav {
  position: sticky;
  top: calc(var(--topbar-h) + var(--hnav-h, 0px) + 24px);
  padding: 12px;
  display: grid;
  gap: 4px;
  max-height: calc(100dvh - var(--topbar-h) - var(--hnav-h, 0px) - 48px);
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 991px) {
  .settings-nav {
    display: none;
  }
}

.settings-group {
  display: grid;
  gap: 2px;
}

.settings-group h2 {
  padding: 0 12px 4px;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  color: var(--text);
}

details.settings-group {
  gap: 0;
}

details.settings-group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  font-weight: 600;
  cursor: pointer;
}

details.settings-group > summary::-webkit-details-marker {
  display: none;
}

details.settings-group > summary:hover {
  background: var(--bg-muted);
}

details.settings-group > summary > .ti:first-child {
  color: var(--text-secondary);
  font-size: var(--icon-nav);
}

details.settings-group > summary .chev {
  margin-inline-start: auto;
  color: var(--text-secondary);
  transition: rotate var(--dur-fast) var(--ease);
}

details.settings-group[open] > summary .chev {
  rotate: 180deg;
}

details.settings-group > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.settings-links {
  display: grid;
  gap: 2px;
  padding: 2px 0 8px;
  padding-inline-start: 32px;
}

.settings-nav > div.settings-group + div.settings-group {
  margin-top: 12px;
}

.settings-group a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-control);
  color: var(--text);
  text-decoration: none;
}

.settings-group a:hover {
  background: var(--bg-muted);
}

.settings-group a:is([aria-current="page"], [aria-current="location"]) {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 600;
}

.settings-mobile {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
}

.settings-mobile > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
}

.settings-mobile > summary::-webkit-details-marker {
  display: none;
}

.settings-mobile .chev {
  margin-inline-start: auto;
  transition: transform var(--dur-base) var(--ease);
}

.settings-mobile[open] .chev {
  transform: rotate(180deg);
}

.settings-mobile nav {
  display: grid;
  gap: 12px;
  padding: 8px;
  border-top: 1px solid var(--border);
}

/* Template thumbnail */

/* ==========================================================================
   8. Counter screens
   ========================================================================== */

html:has(.till-page),
.till-page {
  height: 100%;
}

.till-page .register {
  height: 100%;
  min-height: 100dvh;
}

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

.solo-work {
  grid-template-rows: auto auto minmax(auto, 1fr);
  align-content: start;
  overflow: auto;
}

.seg-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.seg-row .btn[aria-checked="true"] {
  --_bg: var(--accent);
  --_fg: var(--on-accent);
  --_bd: transparent;
}

.seg-row .btn[aria-checked="true"]:hover {
  background: var(--accent-hover);
}

.seg-row .btn[aria-checked="true"]:active {
  background: var(--accent-pressed);
}

/* Order type */
.cart-top .order-type {
  width: 100%;
}

.cart-top .order-type button {
  flex: 1;
}

/* Floor plan */
.floor-work {
  grid-template-rows: auto minmax(0, 1fr);
}

.floor-room {
  --cell: 64px;
  display: grid;
  grid-template-columns: repeat(12, minmax(48px, 1fr));
  grid-auto-rows: var(--cell);
  gap: 12px;
  min-width: 0;
  overflow: auto;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  align-content: start;
}

.floor-room > * {
  min-width: 0;
}

.tbl {
  position: relative;
  container-type: inline-size;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  border: 2px solid var(--border-strong);
  background: var(--bg-surface);
  border-radius: var(--r-card);
}

.tbl.round {
  border-radius: 50%;
  aspect-ratio: 1;
  width: 100%;
  height: auto;
  max-height: 100%;
  align-self: center;
  justify-self: center;
}

.tbl.free {
  border-style: dotted;
  background: transparent;
}

.tbl.busy {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.tbl.busy.warn {
  border-color: var(--amber-500);
  background: var(--warning-subtle);
}

.tbl.busy.late {
  border-color: var(--danger);
  background: var(--danger-subtle);
}

.tbl.on {
  box-shadow: 0 0 0 3px var(--focus);
}

.tbl-no {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 700;
}

.tbl-sub {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.tbl.busy .tbl-sub {
  color: var(--text);
}

.tbl-stage {
  font-weight: 600;
}

.tbl-sub > .num,
.tbl-guests {
  white-space: nowrap;
}

@container (max-width: 139px) {
  .tbl-guests {
    display: none;
  }
}

.tbl-who {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.tbl.round .tbl-who {
  top: 0;
  inset-inline-end: 0;
}

.room-fixture {
  display: grid;
  place-items: center;
  border-radius: var(--r-card);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

@media (max-width: 767px) {
  .floor-room {
    grid-template-columns: repeat(12, 56px);
  }
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.legend-row li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tbl-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
  border: 2px solid var(--border-control);
}

.tbl-dot.free {
  border-style: dotted;
  border-color: var(--border-strong);
}

.tbl-dot.busy {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.tbl-dot.warn {
  border-color: var(--amber-500);
  background: var(--warning-subtle);
}

.tbl-dot.late {
  border-color: var(--danger);
  background: var(--danger-subtle);
}

/* Kitchen display */
.kds {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg-app);
  color: var(--text);
}

.kds-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  padding: 16px;
  align-content: start;
}

.kds-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.kds-counts b {
  color: var(--text);
  font-size: var(--fs-lg);
}

.kds-counts .late b {
  color: var(--danger-text);
}

.ticket {
  --tk: var(--gray-500);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.ticket[data-state="preparing"] {
  --tk: var(--accent);
}

.ticket[data-state="ready"] {
  --tk: var(--success);
}

.ticket[data-age="delayed"] {
  --tk: var(--amber-400);
}

.ticket[data-age="late"] {
  --tk: var(--danger);
}

.ticket header {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-top: 6px solid var(--tk);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--tk) 14%, var(--bg-surface));
}

.ticket header b {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
}

.ticket header span {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.ticket .tk-time {
  font-weight: 700;
  color: var(--text);
  font-size: var(--fs-lg);
}

.ticket .tk-state {
  font-weight: 600;
  color: var(--text);
}

.ticket .tk-age {
  color: var(--danger-text);
}

.ticket[data-age="delayed"] .tk-age {
  color: var(--warning-text);
}

.ticket ul {
  margin: 0;
  padding: 8px 16px;
  list-style: none;
  display: grid;
  gap: 8px;
  align-content: start;
}

.ticket li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.ticket .tk-q {
  font-weight: 700;
  font-size: var(--fs-lg);
}

.ticket li b {
  display: block;
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.ticket .tk-mod {
  display: block;
  color: var(--danger-text);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.ticket footer {
  padding: 12px 16px 16px;
}

/* Bar tabs */
.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: var(--gap-touch);
  align-content: start;
}

.tab-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-control);
  background: var(--bg-surface);
  color: var(--text);
  text-decoration: none;
}

.tab-card span,
.tab-card small {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.tab-card .tc-amt {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 700;
  color: var(--text);
}

.tab-card.on {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Scale */
.scale-read {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--r-control);
  background: var(--bg-inverse);
  color: var(--text-inverse);
  text-align: center;
}

.scale-read .lbl {
  font-size: var(--fs-sm);
}

.scale-read b {
  font-size: var(--fs-d1);
  line-height: var(--lh-d1);
  font-weight: 700;
}

.disclose > summary {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent-text);
  font-weight: 500;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap-touch);
}

.option-chip.size span {
  display: grid;
  place-items: center;
  gap: 2px;
  width: 100%;
  min-height: var(--control-h-lg);
  padding: 8px;
  border-radius: var(--r-control);
}

.option-chip.size small {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-weight: 400;
}

.option-chip input:disabled + span {
  opacity: .5;
  text-decoration: line-through;
  cursor: not-allowed;
}

.option-chip .swatch {
  width: 16px;
  height: 16px;
  margin-inline-end: 8px;
  border: 1px solid var(--border-strong);
}

/* Bookings */
.day-grid {
  --rowh: 48px;
  display: grid;
  grid-template-columns: 56px repeat(var(--cols), minmax(160px, 1fr));
  grid-template-rows: auto repeat(var(--rows), var(--rowh));
  column-gap: 8px;
  row-gap: 8px;
  overflow: auto;
  min-width: 0;
  scroll-padding-block-start: var(--rowh);
}

.dg-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  background: var(--bg-app);
  font-weight: 600;
}

.dg-time {
  align-self: start;
  padding-top: 4px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  text-align: end;
  padding-inline-end: 4px;
}

.slot-free {
  all: unset;
  box-sizing: border-box;
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--r-control);
  cursor: pointer;
}

.slot-free:hover {
  background: var(--accent-subtle);
}

.slot-free:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.slot-book {
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 2px;
  margin-block: 2px;
  padding: 8px 12px;
  border-radius: var(--r-control);
  background: var(--accent-subtle);
  color: var(--text);
  text-decoration: none;
  border-inline-start: 4px solid var(--accent);
  overflow: hidden;
}

.slot-book:focus-visible {
  outline-offset: -2px;
}

.slot-book[data-staff="1"] {
  background: var(--success-subtle);
  border-inline-start-color: var(--success);
}

.slot-book b {
  font-weight: 600;
}

.slot-book span {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* Self-checkout kiosk */
.kiosk-screen {
  min-height: 100dvh;
  display: grid;
  background: var(--bg-app);
  color: var(--text);
}

.kiosk-start,
.kiosk-review,
.kiosk-done {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  padding: 32px 16px;
  text-align: center;
}

.kiosk-start .store-mark {
  width: 72px;
  height: 72px;
  font-size: var(--fs-3xl);
}

.kiosk-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-touch);
  width: min(100%, var(--kiosk-w));
}

.kiosk-big {
  all: unset;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 16px;
  border-radius: var(--r-sheet);
  background: var(--bg-surface);
  border: 1px solid var(--border-control);
  cursor: pointer;
  font-size: var(--fs-2xl);
}

.kiosk-big .ti {
  font-size: 48px;
  color: var(--accent-text);
}

.kiosk-big:hover {
  border-color: var(--accent);
}

.kiosk-big:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.kiosk-shop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cart-w, 400px);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100dvh;
}

.kiosk-head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-2xl);
}

.kiosk-head .sp {
  flex: 1;
}

.kiosk-main {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 24px;
  min-width: 0;
}

.kiosk-cart {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 24px;
  background: var(--bg-surface);
  border-inline-start: 1px solid var(--border);
}

.kc-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

.kc-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-block: 8px;
  border-bottom: 1px solid var(--border);
  text-align: start;
}

.kc-name {
  flex: 1 1 140px;
  display: grid;
  min-width: 0;
}

.kc-total {
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xl);
}

.kiosk-review {
  width: min(100%, var(--kiosk-w));
  margin-inline: auto;
  justify-items: stretch;
  text-align: start;
}

.kiosk-review .kiosk-choice {
  width: 100%;
}

.kd-check .ti {
  font-size: var(--fs-d1);
  color: var(--success-text);
}

.kd-no {
  font-size: var(--fs-d2);
  line-height: var(--lh-d2);
  font-weight: 700;
}

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

  .kiosk-cart {
    border: 0;
    border-top: 1px solid var(--border);
  }
}

/* Device frame */
.device-stage {
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.device {
  border: 12px solid var(--gray-900);
  border-radius: calc(var(--r-sheet) * 2 + 4px);
  background: var(--gray-900);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.device iframe {
  display: block;
  border: 0;
  background: var(--bg-app);
}

.device.tablet iframe {
  zoom: .62;
}

.device.phone iframe {
  zoom: .8;
}

@media (max-width: 575px) {
  .device.tablet iframe {
    zoom: .3;
  }

  .device.phone iframe {
    zoom: .62;
  }
}

.device iframe:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: -4px;
}

/* Held sales */
.held-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-touch);
}

.held-bar > .input:first-child {
  flex: 1 1 260px;
}

.held-bar select.input {
  flex: 0 1 220px;
}

@media (max-width: 899px) {
  .held-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .held-bar > .segmented {
    justify-self: start;
  }
}

@media (max-width: 599px) {
  .held-bar > .input:first-child,
  .held-bar > [data-held-delete] {
    grid-column: 1 / -1;
  }
}

.held-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--gap-touch);
  align-content: start;
}

.held-card {
  position: relative;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.held-card:has(:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.held-open {
  display: grid;
  gap: 8px;
  padding: 16px;
  padding-inline-end: calc(var(--control-h) + 16px);
  color: var(--text);
  text-decoration: none;
  border-radius: inherit;
}

.held-open:hover {
  background: var(--bg-subtle);
}

.held-open:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.held-items {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.held-pick {
  position: absolute;
  z-index: 1;
  top: 8px;
  inset-inline-end: 8px;
  width: var(--control-h);
  height: var(--control-h);
  display: grid;
  place-items: center;
}

.actions-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mod-total {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Split payments */
.split-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-touch);
}

.split-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.payment[data-split] {
  grid-template-rows: none;
}

.split-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: var(--control-h);
  padding: 8px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.split-list .sl-what {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.split-list .sl-what > span {
  min-width: 0;
}

.split-list .sl-what > .num {
  flex: none;
}

@media (max-width: 575px) {
  .split-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .split-list li > .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.split-list li.done {
  background: var(--success-subtle);
  border-color: transparent;
}

.split-list li.now {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.dl-box {
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

/* Refund */
.refund-lines {
  display: grid;
  gap: var(--gap-touch);
  margin: 0;
  padding: 0;
  list-style: none;
}

.refund-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: var(--control-h-lg);
  padding: 8px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

@media (max-width: 575px) {
  .refund-line {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .refund-line .restock {
    grid-column: 1 / -1;
  }
}

.rl-name b {
  display: block;
}

.rl-name small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.refund-ticket {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.restock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.line.return .amt {
  color: var(--warning-text);
}

.tender-chip {
  display: grid;
}

.tender-chip span {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: var(--control-h-xl);
  padding: 8px;
  border-radius: var(--r-card);
  text-align: center;
}

/* Handover */
.xchg-arrow {
  display: grid;
  place-items: center;
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 50%;
  background: var(--bg-muted);
}

@media (max-width: 899px) {
  .handover .xchg-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-touch);
}

/* Customer search */
.cust-results {
  display: grid;
  gap: var(--gap-touch);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cust-results .cust {
  width: 100%;
}

.cust.on {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.sync-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sync-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  min-height: var(--control-h);
  padding: 8px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

@media (max-width: 575px) {
  .kiosk-head .btn .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .kiosk-head .btn {
    width: var(--control-h);
    padding: 0;
  }
}

.sync-list li b.num {
  margin-inline-start: auto;
}

.dialog .segmented {
  display: flex;
}

.dialog .segmented button {
  flex: 1;
  justify-content: center;
}

/* Customer display */
.cfd {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  background: var(--bg-app);
  color: var(--text);
}

.cfd-order {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 32px;
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border);
}

.cfd-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-2xl);
}

.cfd-lines {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  align-content: start;
}

.cfd-lines li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
}

.cfd-lines small {
  display: block;
  font-size: var(--fs-md);
  color: var(--text-secondary);
}

.cfd-total {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-lg);
}

.cfd-grand {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
}

.cfd-ask {
  display: grid;
  gap: 16px;
  align-content: center;
  justify-items: center;
  padding: 32px;
  text-align: center;
}

.tip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(100%, var(--tip-grid));
}

.tip {
  all: unset;
  box-sizing: border-box;
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 24px 16px;
  border-radius: var(--r-sheet);
  border: 2px solid var(--border-control);
  background: var(--bg-surface);
  cursor: pointer;
}

.tip b {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
}

.tip span {
  color: var(--text-secondary);
  font-size: var(--fs-lg);
}

.tip:hover {
  border-color: var(--accent);
}

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

/* Tips */
.tip small {
  color: var(--text-secondary);
  font-size: var(--fs-md);
}

.tip.tip-top {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.tip-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap-touch);
}

@media (max-width: 599px) {
  .tip-more {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

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

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

  .cfd-order {
    border: 0;
    border-bottom: 1px solid var(--border);
  }
}

.batch-row.is-disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ==========================================================================
   9. Cash drawer
   ========================================================================== */

/* Cash count */
.count-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--count-pad-w, 300px));
  gap: 16px 24px;
  align-items: start;
}

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

.count-table th[scope="row"] {
  padding-block: 2px;
}

.count-pick {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding-inline: 12px;
  border-radius: var(--r-control);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--text);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.count-pick:hover {
  background: var(--bg-muted);
}

.count-pick:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.count-row.on td,
.count-row.on th {
  background: var(--accent-subtle);
}

.count-row.on .count-pick {
  color: var(--accent-text);
}

.count-row [data-count-out] {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}

.count-row [data-denom-total] {
  color: var(--text-secondary);
}

.count-total {
  display: grid;
  gap: 16px;
  max-width: var(--count-w);
}

.count-work {
  grid-template-rows: auto;
  align-content: start;
  gap: 16px;
  overflow: auto;
}

.count-work > p {
  margin: 0;
  max-width: 64ch;
}

/* Summary panel */
.count-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.count-panel .pay-foot {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.count-body {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.count-body h2 {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
}

.count-figure {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.count-figure .lbl {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.count-figure b {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.count-figure .verdict {
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  color: var(--text-secondary);
}

.blind-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.blind-note .ti {
  flex: none;
  margin-top: calc((1lh - var(--icon)) / 2);
}

.count-panel .totals-list .grand dd,
.count-panel .totals-list .grand dt {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

@media (max-width: 899px) {
  .count-panel {
    height: auto;
    display: block;
  }

  .count-body {
    overflow: visible;
  }

  .count-panel .pay-foot {
    position: fixed;
    z-index: 30;
    inset-inline: 0;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
  }
}

.handover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.handover .person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.handover .person > span {
  min-width: 0;
}

.handover .person small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

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

  .handover .xchg-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }
}

/* ==========================================================================
   10. Receipts and paper
   ========================================================================== */

.paper-stage {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 24px 16px;
  border-radius: var(--r-card);
  background: var(--bg-muted);
  container-type: inline-size;
}

.paper {
  --cols: 48;
  box-sizing: content-box;
  width: min(calc(var(--cols) * 1ch), calc(100cqi - 32px));
  padding: 24px 16px 32px;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: min(var(--fs-sm), calc((100cqi - 32px - 32px) / var(--cols) / 0.6));
  line-height: 1.45;
  box-shadow: var(--shadow-md);
  position: relative;
}

.paper.w58 {
  --cols: 32;
}

.paper::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -8px;
  height: 8px;
  background:
    linear-gradient(-45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 8px repeat-x,
    linear-gradient(45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 8px repeat-x;
}

.paper .pl {
  display: flex;
  justify-content: space-between;
  gap: 1ch;
}

.paper .pl > :not(:first-child) {
  flex: none;
  text-align: end;
  white-space: nowrap;
}

.paper .pl > :first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.paper .pr {
  border: 0;
  border-top: 1px dashed currentColor;
  margin: 8px 0;
  height: 0;
}

.paper .pr.double {
  border-top-style: double;
  border-top-width: 3px;
}

.paper .big {
  font-size: 2em;
  line-height: 1.25;
  font-weight: 600;
}

.paper .wide {
  font-size: 1.5em;
  line-height: 1.3;
  font-weight: 600;
}

.paper b,
.paper strong {
  font-weight: 700;
}

.paper .ind {
  padding-inline-start: 2ch;
}

.paper .logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 12px;
  background: var(--paper-ink);
  color: var(--paper);
}

.paper .logo .ti {
  font-size: 24px;
}

.paper .barcode {
  display: block;
  width: min(100%, 26ch);
  height: auto;
  margin: 8px auto 0;
  color: var(--paper-ink);
}

.paper .barcode-digits {
  fill: currentColor;
  font-family: var(--font-mono);
}

.paper .qr {
  width: 14ch;
  margin: 8px auto 0;
}

.paper .qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.paper .stamp {
  display: block;
  margin: 8px auto;
  padding: 4px 1ch;
  border: 2px solid currentColor;
  text-align: center;
  font-weight: 700;
  letter-spacing: .3em;
}

@media print {
  .paper-stage {
    background: none;
    padding: 0;
  }

  .paper {
    box-shadow: none;
  }

  .paper::after {
    display: none;
  }
}

.paper [data-text] {
  white-space: pre-line;
}

.paper .head::first-line {
  font-size: 1.5em;
  font-weight: 700;
}

.paper .pl > .tc {
  min-width: 1ch;
}

.paper .big > .tc {
  min-width: 0;
}

/* A4 page */
.a4-stage {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding: 24px 16px;
  border-radius: var(--r-card);
  background: var(--bg-muted);
}

.a4-stage .doc {
  width: min(100%, var(--a4-w));
  min-height: calc(min(100cqi, var(--a4-w)) * 297 / 210);
  align-content: start;
  box-shadow: var(--shadow-md);
}

@media print {
  .a4-stage {
    background: none;
    padding: 0;
  }

  .a4-stage .doc {
    min-height: 0;
    box-shadow: none;
  }
}

/* Email receipt */
.mail-view {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-surface);
}

.mail-meta {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.mail-meta h2 {
  margin-bottom: 4px;
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.mail-meta dl {
  display: grid;
  gap: 4px;
  margin: 0;
}

.mail-meta dl div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.mail-meta dt {
  min-width: 48px;
  color: var(--text-secondary);
}

.mail-meta dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mail-canvas {
  padding: 32px 16px;
  background: var(--bg-app);
  color: var(--text);
}

.mail-card {
  display: grid;
  max-width: var(--mail-w);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  overflow: hidden;
}

.mail-hero {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 32px 24px;
  text-align: center;
}

.mail-hero .brand-mark {
  width: 48px;
  height: 48px;
}

.mail-feedback {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.mail-total {
  font-size: var(--fs-d1);
  line-height: var(--lh-d1);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.mail-sec {
  display: grid;
  gap: 8px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.mail-sec h3 {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mail-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.mail-line > :last-child {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.mail-line small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.mail-line.grand {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 700;
}

.mail-rate {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mail-rate :is(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--border-control);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.mail-rate :is(a, button):hover {
  background: var(--bg-subtle);
}

.mail-foot {
  display: grid;
  gap: 4px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.mail-foot a {
  color: inherit;
}

/* Email preview */
.email-stage {
  display: grid;
  justify-items: center;
  padding: 24px 16px;
  background: var(--bg-muted);
  border-radius: 0 0 var(--r-card) var(--r-card);
  overflow-x: auto;
}

.email-frame {
  width: 100%;
  max-width: var(--email-w);
  transition: max-width var(--dur-base) var(--ease);
}

.email-frame.wd-phone {
  max-width: var(--phone-w);
}

.row > * > .card.h-auto {
  height: auto;
  align-self: start;
}

.email-frame iframe {
  display: block;
  width: 100%;
  height: var(--email-h);
  border: 0;
  border-radius: var(--r-control);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.list-link[aria-current="page"] {
  background: var(--accent-subtle);
}

.list-link[aria-current="page"] .grow b {
  color: var(--accent-text);
}

/* SMS receipt */
.phone-frame {
  width: min(100%, var(--phone-w));
  margin: 0 auto;
  border: 12px solid var(--gray-900);
  border-radius: var(--phone-r);
  background: var(--bg-app);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.sms-head {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  text-align: center;
}

.sms-head small {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.sms-thread {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: var(--sms-min);
  padding: 16px;
}

.sms-time {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.sms-bubble {
  justify-self: start;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 16px;
  border-end-start-radius: 4px;
  background: var(--bg-muted);
  color: var(--text);
  overflow-wrap: anywhere;
}

.sms-bubble a {
  color: var(--accent-text);
}

.sms-bubble.me {
  justify-self: end;
  border-radius: 16px;
  border-end-end-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
}

/* ==========================================================================
   11. Apps
   ========================================================================== */

/* Calendar */
.cal-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 1200px) {
  .cal-app {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

.cal-side {
  display: grid;
  gap: 16px;
}

.cal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cal-head h2 {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
  margin-inline-end: auto;
}

@media (max-width: 599px) {
  .cal-head .segmented {
    order: 1;
    flex: 1 0 100%;
    display: flex;
  }

  .cal-head .segmented button {
    flex: 1;
    justify-content: center;
  }

  .cal-head h2 {
    font-size: var(--fs-lg);
    line-height: var(--lh-lg);
  }
}

@media (max-width: 359px) {
  .cal-head h2 {
    order: -1;
    flex: 1 0 100%;
  }
}

.cal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}

.cal-month {
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  overflow: hidden;
}

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.cal-dow span {
  padding: 8px 4px;
  text-align: center;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 32px repeat(3, 24px) 24px;
  row-gap: 2px;
  padding-bottom: 4px;
}

.cal-row + .cal-row {
  border-top: 1px solid var(--border);
}

.cal-cell {
  grid-row: 1 / -1;
  min-width: 0;
  padding: 4px;
  border-top: 1px solid transparent;
  border-inline-start: 1px solid var(--border);
  margin-bottom: -4px;
}

.cal-cell:first-child {
  border-inline-start-color: transparent;
}

.cal-cell.today {
  background: var(--accent-subtle);
}

.cal-day {
  all: unset;
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.cal-day:hover {
  background: var(--bg-muted);
}

.cal-day:focus-visible,
.cal-ev:focus-visible,
.cal-more:focus-visible,
.cal-day-link:focus-visible,
.cal-mini-day:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.cal-ev:focus-visible {
  outline-offset: -2px;
}

.cal-cell.out .cal-day {
  color: var(--text-secondary);
  font-weight: 400;
}

.cal-cell.today .cal-day {
  background: var(--accent);
  color: var(--on-accent);
}

.cal-ev {
  all: unset;
  box-sizing: border-box;
  display: block;
  position: relative;
  min-width: 0;
  height: 24px;
  margin-inline: 4px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  border-inline-start: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--bg-surface));
  color: var(--text);
  font-size: var(--fs-xs);
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-ev b {
  font-weight: 600;
}

.cal-ev:hover {
  background: color-mix(in srgb, var(--c) 26%, var(--bg-surface));
}

.cal-ev.multi {
  background: color-mix(in srgb, var(--c) 24%, var(--bg-surface));
  font-weight: 500;
}

.cal-ev.cont {
  margin-inline-start: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  border-inline-start-width: 0;
}

.cal-ev.on {
  margin-inline-end: 0;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.cal-more {
  all: unset;
  box-sizing: border-box;
  position: relative;
  margin-inline: 4px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  line-height: 24px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cal-more:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.cal-evs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-evs .cal-ev {
  margin: 0;
  height: auto;
  min-height: 24px;
  line-height: var(--lh-xs);
  padding-block: 2px;
  white-space: normal;
}

.cal-dots {
  display: none;
}

.cal-day-link {
  all: unset;
  cursor: pointer;
}

.cal-day-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cal-agenda {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-mini-title {
  margin-bottom: 8px;
  font-weight: 600;
}

.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}

.cal-mini-grid > span {
  display: contents;
}

.cal-mini-grid i {
  font-style: normal;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  padding-bottom: 4px;
}

.cal-mini-day {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.cal-mini-day:hover {
  background: var(--bg-muted);
}

.cal-mini-day.out {
  color: var(--text-secondary);
}

.cal-mini-day.has::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  translate: -50% 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-mini-day.today {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.cal-mini-day.today::after {
  background: var(--on-accent);
}

@media (max-width: 767px) {
  .cal-row {
    grid-template-rows: 32px 1fr;
    min-height: 64px;
  }

  .cal-ev,
  .cal-more {
    display: none;
  }

  .cal-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 4px;
  }

  .cal-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c);
  }
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.cal-week > section {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.cal-week h3 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.cal-week h3.today {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

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

.agenda-ev {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--r-control);
  border-inline-start: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--bg-surface));
}

.agenda-ev small {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.cal-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-list > li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
}

.cal-list .date {
  font-weight: 600;
}

.cal-list .date small {
  display: block;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: var(--fs-sm);
}

.cal-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 575px) {
  .cal-list > li {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

.cal-key {
  display: grid;
  gap: 4px;
}

.cal-key .choice {
  gap: 8px;
}

.cal-key .swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}

/* Mail and chat layout */
.md-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  overflow: hidden;
}

@media (min-width: 992px) {
  .md-app {
    grid-template-columns: 240px minmax(0, 1fr);
    height: calc(100dvh - var(--topbar-h) - 220px);
    min-height: var(--md-min);
  }

  .md-app.two {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

.md-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 992px) {
  .md-col {
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
  }

  .md-col:last-child {
    border-inline-end: 0;
  }
}

.md-app > [role="tabpanel"] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}

.md-app > [role="tabpanel"][hidden] {
  display: none;
}

[data-md]:not(.is-reading) > .md-detail,
[data-md].is-reading > .md-list {
  display: none;
}

.md-detail {
  grid-template-rows: minmax(0, 1fr);
}

@media (min-width: 992px) {
  .md-app[data-md="split"] > :is(.md-list, .md-detail) {
    display: grid;
  }

  .md-app[data-md="split"] [data-md-back] {
    display: none;
  }
}

.mail-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.mail-bar .input {
  flex: 1;
}

.mail-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
}

.mail-tools > .choice {
  margin-inline-end: 8px;
}

@media (max-width: 359px) {
  .mail-tools {
    flex-wrap: nowrap;
  }

  .mail-tools > .ms-auto {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.mail-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline-start: 16px;
  border-bottom: 1px solid var(--border);
}

.mail-row:hover {
  background: var(--bg-subtle);
}

.mail-row.unread {
  background: var(--bg-surface);
}

.mail-row.unread :is(.who, .subj) {
  font-weight: 700;
}

.star-btn {
  all: unset;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  cursor: pointer;
  flex: none;
}

.star-btn:hover {
  background: var(--bg-muted);
}

.star-btn[aria-pressed="true"] {
  color: var(--amber-500);
}

.star-btn[aria-pressed="true"] .ti {
  fill: currentColor;
}

.star-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.mail-open {
  all: unset;
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 160px) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding-block: 8px;
  padding-inline: 4px 16px;
  cursor: pointer;
}

.mail-open:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.mail-open[aria-current="true"] {
  background: var(--accent-subtle);
}

.mail-open .who {
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-open .line {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.mail-open .subj {
  color: var(--text);
  font-weight: 500;
}

.mail-open .when {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mail-open .badge-count {
  grid-column: 5;
}

.chat-rows .mail-row {
  padding-inline-start: 0;
}

.chat-rows .mail-open {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 0;
  padding-inline-start: 16px;
}

.chat-rows .mail-open .avatar {
  grid-row: 1;
}

.chat-rows .mail-open .line {
  grid-column: 2;
  grid-row: 2;
}

.chat-rows .mail-open .when {
  grid-column: 3;
  grid-row: 1;
}

.chat-rows .mail-open .badge-count {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
}

.md-pane-head .avatar {
  flex: none;
}

.md-pane-head .grow {
  flex: 1;
  min-width: 0;
}

.md-pane-head .grow h2 {
  margin: 0;
}

.md-menu {
  display: none;
}

@media (max-width: 991px) {
  .md-menu {
    display: inline-grid;
  }

  .md-app.mail .md-folders {
    display: none;
  }

  .md-app.mail:has([data-menu-toggle][aria-expanded="true"]) .md-folders {
    display: grid;
  }

  .md-app.mail:has([data-menu-toggle][aria-expanded="true"]) > [role="tabpanel"] {
    display: none;
  }
}

@media (max-width: 767px) {
  .mail-open {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    row-gap: 0;
  }

  .mail-open .avatar {
    grid-row: 1;
  }

  .mail-open .line {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .mail-row {
    align-items: flex-start;
  }

  .mail-row > .star-btn {
    margin-top: 8px;
  }

  .mail-row > .choice {
    margin-top: 12px;
  }
}

.md-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  min-width: 0;
}

.md-col:has(> .md-pane) {
  align-content: stretch;
}

.md-pane[hidden] {
  display: none;
}

.md-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.md-pane-head h2 {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
  margin-inline-end: auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.md-pane-body {
  padding: 20px;
  overflow: auto;
  min-height: 0;
}

.md-pane-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.folder-nav {
  display: grid;
  gap: 2px;
  padding: 12px;
}

.folder-nav [role="tab"] {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  cursor: pointer;
  color: var(--text);
}

.folder-nav [role="tab"]:hover {
  background: var(--bg-muted);
}

.folder-nav [role="tab"][aria-selected="true"] {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 600;
}

.folder-nav [role="tab"] .n {
  margin-inline-start: auto;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.folder-nav [role="tab"][aria-selected="true"] .n {
  color: var(--accent-text);
}

.folder-nav [role="tab"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.mail-attach {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
}

.mail-attach small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.msg-body {
  display: grid;
  gap: 12px;
  max-width: 72ch;
}

.msg-from {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.msg-from > div {
  min-width: 0;
}

.msg-from small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  overflow-wrap: anywhere;
}

/* Chat */
.chat-thread {
  display: grid;
  gap: 12px;
  align-content: start;
}

.chat-msg {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  max-width: 80%;
}

.chat-msg .bubble {
  padding: 8px 12px;
  border-radius: 16px;
  border-start-start-radius: 4px;
  background: var(--bg-muted);
  overflow-wrap: anywhere;
}

.chat-msg .meta {
  grid-column: 2;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
}

.chat-msg.me {
  justify-self: end;
  grid-template-columns: minmax(0, 1fr);
}

.chat-msg.me .bubble {
  border-radius: 16px;
  border-start-end-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
}

.chat-msg.me .meta {
  grid-column: 1;
  text-align: end;
}

.chat-day {
  justify-self: center;
  padding: 2px 12px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

.composer {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer .input {
  flex: 1;
}

/* To-do */
.todo-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px var(--card-pad);
  border-bottom: 1px solid var(--border);
}

.todo-item:last-child {
  border-bottom: 0;
}

.todo-item .t {
  min-width: 0;
  overflow-wrap: anywhere;
}

.todo-item .meta {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.todo-item.done .t {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.todo-item > .choice {
  grid-area: 1 / 1;
}

.todo-item > .t {
  grid-area: 1 / 2;
}

.todo-item > .btn {
  grid-area: 1 / 3;
}

/* Contacts */
.contact-lines {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.contact-lines a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  max-width: 100%;
  color: var(--text-secondary);
  text-decoration: none;
}

.contact-lines a > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.contact-lines a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-lines .ti {
  flex: none;
  font-size: calc(var(--icon) - 2px);
}

/* Notes */
.note-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: var(--note-min);
  padding: 16px;
  border-radius: var(--r-card);
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--border));
  background: color-mix(in srgb, var(--c) 10%, var(--bg-surface));
}

.note-card h2 {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.note-card p {
  color: var(--text);
  white-space: pre-line;
}

.note-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
}

/* Files */
.folder-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  padding: 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  text-decoration: none;
}

.folder-card:hover {
  background: var(--bg-subtle);
}

.folder-card {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px;
}

.folder-card > .btn {
  align-self: center;
}

.folder-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  border-radius: var(--r-control);
  color: inherit;
  text-decoration: none;
}

.folder-link .list-ico {
  flex: none;
}

.folder-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.folder-link:hover b {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.folder-card small {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.storage-bar {
  display: flex;
  height: 12px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--bg-muted);
}

.storage-bar span {
  background: var(--c);
}

.storage-bar span + span {
  box-shadow: inset 2px 0 0 var(--bg-surface);
}

[dir="rtl"] .storage-bar span + span {
  box-shadow: inset -2px 0 0 var(--bg-surface);
}

.legend-list.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* Projects */
.project-card {
  display: grid;
  gap: 12px;
  padding: var(--card-pad);
}

.project-card h2 {
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
  font-weight: 600;
}

.project-card h2 a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: inherit;
  text-decoration: none;
}

.project-card h2 a:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.project-card .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.milestones {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.milestones li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.milestones .ti {
  color: var(--text-secondary);
}

.milestones .done .ti {
  color: var(--success-icon);
}

.milestones .done span:not(.num) {
  color: var(--text-secondary);
}

/* Kanban */
.kanban {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(var(--kb-col-w), 1fr);
  gap: 16px;
  width: calc(100% + 8px);
  min-width: 0;
  overflow-x: auto;
  padding: 4px 4px 8px;
  margin: -4px;
  scroll-padding-inline: 8px;
  align-items: start;
}

.kb-col {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: var(--kb-col-min);
  padding: 12px;
  border-radius: var(--r-card);
  background: var(--bg-muted);
}

.kb-col.drop {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.kb-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
}

.kb-col-head h2 {
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  font-weight: 600;
}

.kb-col-head .count {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-surface);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kb-list {
  display: grid;
  gap: 8px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kb-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-control);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: grab;
}

.kb-card.dragging {
  opacity: .5;
}

.kb-card .top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-card > .badge {
  justify-self: start;
}

.kb-card .top b {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.kb-card .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
}

.kb-card .foot > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kb-empty {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-control);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.kb-col-head .count + .sr-only + .btn {
  margin-inline-start: auto;
}

.kb-add-btn {
  justify-self: start;
}

.kb-add {
  padding: 8px;
  border-radius: var(--r-control);
  background: var(--bg-surface);
}

.kb-col-new {
  min-height: 0;
  align-self: start;
  background: none;
  border: 1px dashed var(--border-strong);
}

/* Calls */
.call-stage {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-card);
  background: var(--gray-900);
}

.call-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.call-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-control);
  background: var(--gray-800);
  color: var(--gray-50);
}

.call-tile.speaking {
  box-shadow: 0 0 0 3px var(--green-500);
}

.call-tile .name {
  position: absolute;
  inset-inline-start: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: rgb(0 0 0 / .55);
  color: #fff;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.call-tile .avatar {
  width: 72px;
  height: 72px;
  font-size: var(--fs-2xl);
}

.call-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 8px;
}

.call-btn {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gray-700);
  color: #fff;
  cursor: pointer;
}

.call-btn:hover {
  background: var(--gray-600);
}

.call-btn[aria-pressed="true"] {
  background: #fff;
  color: var(--gray-900);
}

.call-btn.end {
  width: 72px;
  border-radius: var(--r-full);
  background: var(--red-600);
}

.call-btn.end:hover {
  background: var(--red-700);
}

:is(.call-stage, .call-card) .call-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.call-btn .ti {
  font-size: 24px;
}

@media (max-width: 599px) {
  .call-bar {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .call-bar .call-btn {
    width: 48px;
    height: 48px;
  }

  .call-bar .call-btn.end {
    width: 56px;
  }
}

@media (max-width: 359px) {
  .call-bar {
    gap: 4px;
  }

  .call-bar .call-btn {
    width: 44px;
    height: 44px;
  }

  .call-bar .call-btn.end {
    width: 48px;
  }
}

.call-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 40px 24px;
  border-radius: var(--r-sheet);
  background: var(--gray-900);
  color: var(--gray-50);
  text-align: center;
}

.call-card .avatar {
  width: 96px;
  height: 96px;
  font-size: var(--fs-3xl);
}

.call-card .sub {
  color: var(--gray-300);
}

.call-card .timer {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dial {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
}

.dial .call-btn {
  width: 72px;
  height: 56px;
  border-radius: var(--r-card);
  font-size: var(--fs-xl);
}

/* Feed */
.post {
  display: grid;
  gap: 12px;
  padding: var(--card-pad);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-head > div {
  flex: 1;
  min-width: 0;
}

.post-head small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.post-img {
  width: 100%;
  max-width: var(--photo-sharp);
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.post-actions .btn[aria-pressed="true"] {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.comments {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comments li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.comments .bubble {
  padding: 8px 12px;
  border-radius: var(--r-card);
  background: var(--bg-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.comments .bubble b {
  display: block;
}

.comment-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-box .input {
  flex: 1;
}

/* Blog */
.post-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.post-cover {
  display: block;
  width: calc(100% - 32px);
  height: auto;
  margin: 16px 16px 0;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

.empty-cover {
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.empty-cover .ti {
  font-size: 36px;
}

.post-card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.post-card .badge {
  flex: 0 1 auto;
  min-width: 0;
  height: auto;
  min-height: var(--badge-h);
  white-space: normal;
}

.accordion.flush {
  border: 0;
  border-radius: 0;
}

.card > .accordion.flush:last-child {
  border-end-start-radius: calc(var(--r-card) - 1px);
  border-end-end-radius: calc(var(--r-card) - 1px);
  overflow: hidden;
}

/* Search results */
.result-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-list > li > a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--card-pad);
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.result-list > li > a:hover {
  background: var(--bg-subtle);
}

.result-list > li > a:focus-visible {
  outline-offset: -2px;
}

.result-list .grow {
  flex: 1;
  min-width: 0;
}

.result-list .grow b {
  display: block;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.result-list .grow small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.result-list > li:last-child > a {
  border-bottom: 0;
}

/* ==========================================================================
   12. Account pages
   ========================================================================== */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg-app);
  color: var(--text);
}

.auth-card.wide {
  width: min(100%, var(--wizard-w));
}

.btn-link {
  all: unset;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration-thickness: 2px;
}

.btn-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.auth-card {
  display: grid;
  gap: 24px;
  width: min(100%, var(--auth-w));
  padding: 32px;
  border-radius: var(--r-sheet);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.auth-card > .auth-brand {
  justify-self: center;
}

.auth-social {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 575px) {
  .auth-card {
    padding: 24px 20px;
  }
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

.auth-head {
  display: grid;
  gap: 4px;
}

.auth-head p {
  color: var(--text-secondary);
}

.auth-foot {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.auth-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.auth-or {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.auth-or::before,
.auth-or::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.auth-split {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg-surface);
  color: var(--text);
}

@media (min-width: 992px) {
  .auth-split {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.auth-side {
  display: none;
  position: relative;
  overflow: hidden;
}

@media (min-width: 992px) {
  .auth-side {
    display: grid;
  }
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

.auth-main .auth-card {
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* Cover frame */
.auth-cover {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  margin: 20px;
  margin-inline-end: 0;
  padding: 48px;
  border-radius: var(--r-sheet);
  background: var(--gray-900);
  color: #fff;
  text-align: center;
}

.auth-cover .auth-photo {
  display: block;
  width: 100%;
  max-width: var(--photo-sharp);
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
}

.auth-cover b {
  font-size: var(--fs-3xl);
  line-height: var(--lh-3xl);
}

.auth-cover span {
  color: rgb(255 255 255 / .86);
  max-width: 44ch;
}

/* Illustration frame */
.auth-art {
  place-items: center;
  padding: 48px;
  background: var(--accent-subtle);
}

.auth-art svg {
  width: min(100%, var(--art-w));
  height: auto;
}

.art .bg {
  fill: color-mix(in srgb, var(--accent) 12%, var(--bg-surface));
}

.art .card {
  fill: var(--bg-surface);
  stroke: var(--border);
  stroke-width: 2;
}

.art .acc {
  fill: var(--accent);
}

.art .acc-soft {
  fill: color-mix(in srgb, var(--accent) 30%, var(--bg-surface));
}

.art .ink {
  fill: var(--text);
}

.art .mute {
  fill: var(--border-strong);
}

.art .art-paper {
  fill: #fff;
  stroke: var(--border-strong);
  stroke-width: 2;
}

.art .line {
  stroke: var(--border-strong);
  stroke-width: 4;
  stroke-linecap: round;
}

.art .green {
  fill: var(--green-500);
}

.art .amber {
  fill: var(--amber-400);
}

.art .steam {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 4;
  stroke-linecap: round;
}

/* One-time code */
.otp {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.otp input {
  width: 100%;
  min-width: 0;
  height: var(--control-h-xl);
  padding: 0;
  border: 1px solid var(--border-control);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  color: var(--text);
  text-align: center;
  font: 600 var(--fs-2xl)/1 var(--font-mono);
}

.otp input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Error pages */
.status-page {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(100%, var(--status-w));
  text-align: center;
}

.status-page .dl {
  justify-self: stretch;
  text-align: start;
}

.status-page .input input {
  text-align: start;
}

.status-art {
  width: min(100%, var(--status-art-w));
  height: auto;
}

.status-code {
  font-size: var(--fs-d2);
  line-height: var(--lh-d2);
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

.status-page .lead {
  color: var(--text-secondary);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

.status-ico {
  width: 80px;
  height: 80px;
  border-radius: var(--r-sheet);
  display: grid;
  place-items: center;
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.status-ico .ti {
  font-size: 36px;
}

/* Profile header */
.profile-head {
  display: grid;
  gap: 16px;
  padding: 0 var(--card-pad) var(--card-pad);
}

.profile-cover {
  height: 120px;
  margin: 0 calc(var(--card-pad) * -1);
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--violet-500)));
}

.profile-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: -24px;
}

.profile-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.profile-id .avatar {
  width: 96px;
  height: 96px;
  font-size: var(--fs-3xl);
  box-shadow: 0 0 0 4px var(--bg-surface);
}

.profile-id .who {
  display: grid;
  gap: 2px;
  margin-inline-end: auto;
}

.profile-id h1 {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--text-secondary);
}

.profile-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-meta .ti {
  font-size: calc(var(--icon) - 2px);
}

.profile-card .profile-tabs {
  padding-inline: var(--card-pad);
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.profile-card .profile-tabs {
  overflow: auto hidden;
  scrollbar-width: none;
}

.profile-card .profile-tabs .tab {
  flex: none;
  margin-block-end: 0;
}

.profile-card .profile-tabs .tab:focus-visible {
  outline-offset: -2px;
}

@media (max-width: 575px) {
  .profile-id {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-row {
    flex-direction: column;
  }

  .profile-id .who {
    margin-inline-end: 0;
  }

  .profile-meta {
    justify-content: center;
  }
}

/* Notifications */
.note-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-list > li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 8px;
  gap: 4px 12px;
  align-items: center;
  padding: 12px var(--card-pad);
  border-bottom: 1px solid var(--border);
}

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

.note-list > li.unread {
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-surface));
}

.note-list > li.unread::after {
  content: "";
  grid-column: 4;
  grid-row: 1;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.note-list .grow b {
  display: block;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.note-list .unread .grow b {
  font-weight: 700;
}

.note-list .grow small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.note-list .grow a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: inherit;
  text-decoration: none;
}

.note-list .grow a:hover b {
  color: var(--accent-text);
  text-decoration: underline;
}

.note-day {
  padding: 8px var(--card-pad);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Pricing */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  align-items: stretch;
}

.price-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  padding: 24px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text);
}

.plan-price b {
  font-size: var(--fs-4xl);
  line-height: var(--lh-4xl);
  font-weight: 700;
  letter-spacing: -.02em;
}

.plan-price .per {
  color: var(--text-secondary);
}

.price-card .check-list {
  align-content: start;
}

/* ==========================================================================
   13. UI kit
   ========================================================================== */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.demo-show {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.demo-show.col {
  flex-direction: column;
  align-items: stretch;
}

.demo-show > * {
  min-width: 0;
  max-width: 100%;
}

.demo-code {
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
}

.demo-code > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.demo-code > summary::-webkit-details-marker {
  display: none;
}

.demo-code[open] > summary {
  border-bottom: 1px solid var(--border);
}

.demo-code > summary:focus-visible {
  outline-offset: -2px;
}

.demo-code .copy-row {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 0;
}

pre.code {
  margin: 0;
  padding: 12px 16px 16px;
  overflow: auto;
  font: 400 var(--fs-sm)/var(--lh-sm) var(--font-mono);
  color: var(--text);
  white-space: pre;
  tab-size: 2;
}

/* Button group */
.btn-group {
  display: inline-flex;
}

.btn-group > .btn {
  border-radius: 0;
}

.btn-group > .btn:first-child {
  border-start-start-radius: var(--r-control);
  border-end-start-radius: var(--r-control);
}

.btn-group > .btn:last-child {
  border-start-end-radius: var(--r-control);
  border-end-end-radius: var(--r-control);
}

.btn-group > .btn + .btn {
  margin-inline-start: -1px;
}

.btn-group > .btn:focus-visible {
  position: relative;
  z-index: 1;
}

.btn-group > .btn[aria-pressed="true"] {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border-color: var(--accent);
  position: relative;
  z-index: 1;
}

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

/* Carousel */
.carousel {
  position: relative;
  width: 100%;
  max-width: var(--photo-sharp);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-muted);
}

.carousel-slides figure {
  position: relative;
  margin: 0;
}

.carousel-slides img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.carousel-slides figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 48px 64px;
  text-align: center;
  color: #fff;
  background: linear-gradient(to bottom, transparent, rgb(0 0 0 / .7) 40%);
}

.carousel-slides figcaption .muted {
  color: rgb(255 255 255 / .85);
}

.carousel-controls {
  display: contents;
}

.carousel :is([data-carousel-prev], [data-carousel-next]) {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.carousel [data-carousel-prev] {
  inset-inline-start: 12px;
}

.carousel [data-carousel-next] {
  inset-inline-end: 12px;
}

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  gap: 0;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: rgb(0 0 0 / .4);
}

.carousel-dots button {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
}

.carousel-dots button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(255 255 255 / .6);
}

.carousel-dots button[aria-current="true"]::before {
  width: 12px;
  height: 12px;
  background: #fff;
}

.carousel-dots button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* Lightbox */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: 8px;
}

.thumb-grid button {
  all: unset;
  box-sizing: border-box;
  display: block;
  border-radius: var(--r-control);
  overflow: hidden;
  cursor: zoom-in;
}

.thumb-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease);
}

.thumb-grid button:hover img {
  transform: scale(1.03);
}

.thumb-grid button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.modal.lightbox {
  padding: 0;
  background: rgb(0 0 0 / .9);
}

.lb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 64px 80px;
}

.lb-figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.lb-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(var(--lb-max), 100vw - var(--lb-gap));
  max-height: calc(100dvh - var(--lb-gap));
  border-radius: var(--r-sm);
}

.lb-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  color: #fff;
}

.lb-figure figcaption .num {
  color: rgb(255 255 255 / .75);
}

.lb-btn {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: rgb(0 0 0 / .5);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .25);
  cursor: pointer;
}

.lb-btn:hover {
  background: rgb(255 255 255 / .15);
}

.lb-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lb-btn .ti {
  font-size: 24px;
}

.lb-prev,
.lb-next {
  top: 50%;
  translate: 0 -50%;
}

.lb-prev {
  inset-inline-start: 16px;
}

.lb-next {
  inset-inline-end: 16px;
}

.lb-close {
  top: 16px;
  inset-inline-end: 16px;
}

@media (max-width: 767px) {
  .lb {
    padding: 64px 0;
  }

  .lb-figure img {
    max-width: 100vw;
    border-radius: 0;
  }
}

.lb-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

/* Sortable list */
.sort-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sort-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: grab;
}

.sort-list li.dragging {
  opacity: .5;
}

.sort-list .grip {
  color: var(--text-secondary);
}

.sort-list .grow {
  flex: 1;
  min-width: 0;
}

/* Rating */
.rate {
  position: relative;
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  border: 0;
  margin: 0;
  padding: 0;
}

.rate input {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.rate label {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-control);
  cursor: pointer;
  color: var(--border-strong);
}

.rate label .ti {
  font-size: 24px;
  fill: currentColor;
}

.rate input:checked ~ label,
.rate label:hover,
.rate label:hover ~ label {
  color: var(--amber-500);
}

.rate input:focus-visible + label {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

/* Progress ring */

/* Typography and colours */
.type-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.type-row:last-child {
  border-bottom: 0;
}

.type-row > small {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}

@media (max-width: 575px) {
  .type-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

blockquote.quote {
  margin: 0;
  padding-block: 8px;
  padding-inline: 16px 0;
  border-inline-start: 4px solid var(--accent);
  color: var(--text);
  font-size: var(--fs-lg);
  line-height: var(--lh-lg);
}

blockquote.quote footer {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.scroll-demo {
  max-height: var(--scroll-demo-h);
  overflow: auto;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.scroll-demo.x {
  max-height: none;
  white-space: nowrap;
}

.grid-box {
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-size: var(--fs-sm);
  text-align: center;
  font-family: var(--font-mono);
}

/* ==========================================================================
   14. UI kit: forms
   ========================================================================== */

/* Floating labels */
.field.float {
  position: relative;
  gap: 0;
}

.field.float .input {
  height: calc(var(--control-h) + 16px);
  align-items: flex-end;
  padding-bottom: 8px;
}

.field.float .label {
  position: absolute;
  inset-inline-start: calc(var(--control-px) + 1px);
  top: 50%;
  transform: translateY(-50%);
  transform-origin: left top;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: var(--fs-md);
  transition: top var(--dur-base) var(--ease), font-size var(--dur-base) var(--ease);
  z-index: 1;
}

.field.float:focus-within .label,
.field.float .input:has(input:not(:placeholder-shown)) + .label,
.field.float:has(input:not(:placeholder-shown)) .label {
  top: 16px;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Horizontal form */
.form-h {
  display: grid;
  gap: 16px;
}

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

@media (min-width: 768px) {
  .form-h .field {
    grid-template-columns: var(--form-h-label) minmax(0, 1fr);
    align-items: center;
    column-gap: 24px;
  }

  .form-h .field > .hint,
  .form-h .field > .error-msg {
    grid-column: 2;
  }

  .form-h .field > .label {
    align-self: center;
  }

  .form-h .actions {
    padding-inline-start: calc(var(--form-h-label) + 24px);
  }
}

/* Sizes */
.input.sm {
  height: var(--control-h-sm);
}

.input.lg {
  height: var(--control-h-lg);
  font-size: var(--fs-lg);
}

/* Validation */
.input.is-valid {
  border-color: var(--success);
}

.ok-msg {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--success-text);
  font-weight: 500;
}

/* Searchable select */
.combo {
  position: relative;
}

.combo-field {
  padding: 0;
}

.combo-trigger {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  padding: 0 12px;
  cursor: pointer;
}

.combo-trigger .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-trigger .placeholder {
  color: var(--text-secondary);
}

.combo-trigger .chev {
  flex: none;
  transition: rotate var(--dur-fast) var(--ease);
}

.combo-trigger[aria-expanded="true"] .chev {
  rotate: 180deg;
}

.combo.multi .combo-field {
  flex-wrap: wrap;
  gap: 4px;
  height: auto;
  min-height: var(--control-h);
  padding-block: 2px;
  padding-inline-start: 4px;
}

.combo.multi .combo-trigger {
  min-height: 28px;
  min-width: 96px;
}

.combo-pop {
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% + 4px);
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  box-shadow: var(--shadow-md);
}

.combo [role="listbox"] {
  max-height: calc(var(--float-max-h) / 2);
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Date picker */
.dp-input {
  cursor: pointer;
}

.datepicker {
  position: fixed;
  z-index: 60;
  display: flex;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
}

.dp-main {
  padding: 12px;
}

.dp-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.dp-title {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.dp-month,
.dp-year {
  height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font: 600 var(--fs-md)/var(--lh-md) var(--font-sans);
  cursor: pointer;
}

.dp-month:hover,
.dp-year:hover {
  background: var(--bg-subtle);
}

.dp-year {
  width: 64px;
}

.dp-grid {
  border-collapse: collapse;
}

.dp-grid th {
  width: 40px;
  height: 32px;
  padding: 0;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: center;
}

.dp-grid td {
  width: 40px;
  height: 40px;
  padding: 0;
  text-align: center;
  cursor: pointer;
}

.dp-grid td span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: auto;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}

.dp-grid td:hover span {
  background: var(--bg-subtle);
}

.dp-grid td.out span {
  color: var(--text-secondary);
}

.dp-grid td.today span {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.dp-grid td.mid {
  background: var(--accent-subtle);
}

.dp-grid td.start {
  background: linear-gradient(to right, transparent 50%, var(--accent-subtle) 50%);
}

.dp-grid td.end {
  background: linear-gradient(to left, transparent 50%, var(--accent-subtle) 50%);
}

[dir="rtl"] .dp-grid td.start {
  background: linear-gradient(to left, transparent 50%, var(--accent-subtle) 50%);
}

[dir="rtl"] .dp-grid td.end {
  background: linear-gradient(to right, transparent 50%, var(--accent-subtle) 50%);
}

.dp-grid td.sel span,
.dp-grid td.sel:hover span {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.dp-grid td[aria-disabled="true"] {
  cursor: not-allowed;
}

.dp-grid td[aria-disabled="true"] span {
  color: var(--text-disabled);
  background: none;
}

.dp-grid td:focus-visible {
  outline: none;
}

.dp-grid td:focus-visible span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.dp-presets {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px;
  border-inline-end: 1px solid var(--border);
}

.dp-preset {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-control);
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
}

.dp-preset:hover {
  background: var(--bg-subtle);
}

.dp-preset.on {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 600;
}

.dp-preset:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.dp-hint {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  text-align: center;
}

@media (max-width: 599px) {
  .datepicker.dp-range {
    flex-direction: column;
  }

  .datepicker .dp-presets {
    display: flex;
    flex-wrap: wrap;
    border-inline-end: 0;
    border-bottom: 1px solid var(--border);
  }
}

.combo [role="option"] {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-control);
  cursor: pointer;
}

.combo [role="option"] small {
  margin-inline-start: auto;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.combo [role="option"].active {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.combo [role="option"][aria-selected="true"] {
  font-weight: 600;
}

.combo [role="option"][aria-selected="true"]::after {
  content: "✓";
  margin-inline-start: 8px;
  color: var(--accent-text);
}

.combo .combo-empty {
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* Pickers */
.input input[type="color"] {
  flex: none;
  width: 40px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.range-row output {
  min-width: 56px;
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ==========================================================================
   15. Chart libraries
   ========================================================================== */

.lib-chart {
  position: relative;
  height: var(--chart-h);
}

.c3 text,
.c3-legend-item text {
  fill: var(--text-secondary);
  font-family: var(--font-sans);
}

.c3 path.domain,
.c3 .tick line,
.c3-grid line {
  stroke: var(--border);
}

.c3-tooltip {
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
  border-radius: var(--r-control);
}

.c3-tooltip th {
  background: var(--bg-muted);
  color: var(--text);
}

.c3-tooltip td {
  background: var(--bg-raised);
  border-color: var(--border);
}

.c3-chart-arc text {
  fill: var(--on-accent);
}

.c3-chart-arcs-title {
  fill: var(--text-secondary);
}

.morris-hover.morris-default-style {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
}

.morris-hover.morris-default-style .morris-hover-row-label {
  color: var(--text);
}

.lib-chart .legend table {
  color: var(--text);
}

.lib-chart .legend > div {
  background: none !important;
}

.lib-chart .flot-overlay,
.lib-chart .flot-text > div {
  pointer-events: none;
}

.lib-chart .flot-text > div > div {
  pointer-events: auto;
}

/* ==========================================================================
   16. Icon sets
   ========================================================================== */

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.icon-tile {
  all: unset;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--icon-tile-h);
  padding: 12px 8px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}

.icon-tile:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.icon-tile:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.icon-tile .glyph {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 24px;
  line-height: 1;
  color: var(--text);
}

.icon-tile .glyph svg {
  width: 24px;
  height: 24px;
}

.icon-tile .glyph .fi {
  width: 32px;
  height: 24px;
  line-height: 24px;
  border-radius: var(--r-xs);
  box-shadow: 0 0 0 1px var(--border);
}

.icon-tile .name {
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.icon-tile ion-icon {
  font-size: 24px;
}

/* ==========================================================================
   17. Layouts
   ========================================================================== */

.hnav,
.twocol {
  display: none;
}

/* Horizontal */
@media (min-width: 1280px) {
  .app[data-layout="horizontal"] {
    grid-template-columns: minmax(0, 1fr);
    --page-max: calc(var(--boxed-w) + 2 * var(--page-pad));
  }

  .app[data-layout="horizontal"] :is(.topbar, .hnav, .page-foot) {
    padding-inline: max(var(--page-pad), (100% - var(--boxed-w)) / 2);
  }

  .app[data-layout="horizontal"] .topbar-brand {
    display: flex;
  }

  .app[data-layout="horizontal"] > .sidebar,
  .app[data-layout="horizontal"] [data-rail-toggle] {
    display: none;
  }

  .hnav {
    display: block;
    position: sticky;
    top: var(--topbar-h);
    z-index: 19;
    padding: 4px var(--page-pad);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
  }

  .hnav ul {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .hnav-btn {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 8px;
    border-radius: var(--r-control);
    cursor: pointer;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
  }

  .hnav-btn .ti {
    font-size: var(--icon-nav);
    color: var(--text-secondary);
  }

  .hnav-btn .chev {
    font-size: 16px;
  }

  .hnav-btn:hover,
  .hnav-btn[aria-expanded="true"] {
    background: var(--bg-muted);
  }

  .hnav-btn.on {
    color: var(--accent-text);
  }

  .hnav-btn.on .ti {
    color: var(--accent-text);
  }

  .hnav-btn:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }
}

@media (min-width: 992px) {
  .app[data-layout="detached"] .topbar-brand {
    display: flex;
  }

  /* Two columns */
  .app[data-layout="two-column"] {
    grid-template-columns: var(--rail-w) var(--subnav-w) minmax(0, 1fr);
  }

  .app[data-layout="two-column"] > .sidebar,
  .app[data-layout="two-column"] [data-rail-toggle] {
    display: none;
  }

  .twocol {
    display: contents;
  }

  .tc-rail {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 4px;
    padding: calc((var(--topbar-h) - 36px) / 2) 0;
    background: var(--bg-surface);
    border-inline-end: 1px solid var(--border);
    overflow: auto;
  }

  .tc-brand {
    margin-bottom: 12px;
  }

  .tc-sec {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-control);
    color: var(--text-secondary);
  }

  .tc-sec:hover {
    background: var(--bg-muted);
    color: var(--text);
  }

  .tc-sec.on {
    background: var(--accent-subtle);
    color: var(--accent-text);
  }

  .tc-sec .ti {
    font-size: var(--icon-nav);
  }

  .tc-sub {
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: auto;
    padding: 16px 12px;
    background: var(--bg-surface);
    border-inline-end: 1px solid var(--border);
  }

  .tc-title {
    padding: 4px 12px 8px;
    font-size: var(--fs-lg);
    line-height: var(--lh-lg);
    font-weight: 600;
  }

  .tc-sub .nav-item {
    min-height: 36px;
    font-weight: 400;
    color: var(--text-secondary);
  }

  .tc-sub .nav-sec {
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  .tc-sub .nav-item[aria-current="page"] {
    color: var(--accent-text);
    font-weight: 500;
  }

  /* Detached */
  .app[data-layout="detached"] {
    grid-template-columns: calc(var(--sidebar-w) + 24px) minmax(0, 1fr);
    padding-top: var(--topbar-h);
  }

  .app[data-layout="detached"] .topbar {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 31;
  }

  .app[data-layout="detached"] > .sidebar {
    top: calc(var(--topbar-h) + 12px);
    height: calc(100dvh - var(--topbar-h) - 24px);
    grid-template-rows: minmax(0, 1fr);
    margin-block: 12px;
    margin-inline: 24px 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sheet);
  }

  .app[data-layout="detached"] > .sidebar .sidebar-head {
    display: none;
  }

  .app[data-layout="detached"] > .sidebar .sidebar-nav {
    border-end-start-radius: var(--r-sheet);
    border-end-end-radius: var(--r-sheet);
  }

  /* Boxed */
  .app[data-layout="boxed"] {
    max-width: var(--boxed-w);
    margin-inline: auto;
    box-shadow: var(--shadow-lg);
  }

  body:has(.app[data-layout="boxed"]) {
    background: var(--bg-muted);
  }
}

.mega {
  --popover-w: 920px;
}

.mega-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 16px 24px;
  padding: 16px;
}

.mega-col {
  display: grid;
  align-content: start;
  gap: 2px;
}

.mega-col h3 {
  padding: 0 8px 4px;
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  font-weight: 600;
  color: var(--text);
}

.mega-link {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border-radius: var(--r-control);
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-md);
}

.mega-link:hover {
  background: var(--bg-muted);
  color: var(--accent-text);
}

.mega-link[aria-current="page"] {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 500;
}

.mega-link:focus-visible {
  outline-offset: -2px;
}

/* ==========================================================================
   18. Right to left
   ========================================================================== */

[dir="rtl"] :is(
  .ti-chevron-right,
  .ti-chevron-left,
  .ti-arrow-left,
  .ti-arrow-right,
  .ti-arrow-back-up,
  .ti-arrow-forward-up,
  .ti-chevrons-left,
  .ti-chevrons-right,
  .ti-logout,
  .ti-login,
  .ti-send,
  .ti-external-link,
  .ti-arrow-narrow-left,
  .ti-arrow-narrow-right,
  .ti-layout-sidebar-left-collapse,
  .ti-layout-sidebar-left-expand)
 {
  transform: scaleX(-1);
}

[dir="rtl"] .nav-group[open] > summary .chev {
  transform: rotate(90deg);
}

:where([dir="rtl"]) :where(:not(svg, svg *)) {
  unicode-bidi: plaintext;
}

:where([dir="rtl"]) :where(:not(svg, svg *, button)) {
  text-align: -webkit-match-parent;
  text-align: match-parent;
}

:where([dir="rtl"]) :where(code, kbd, samp, pre) {
  direction: ltr;
  unicode-bidi: isolate;
}

[dir="rtl"] :is(ul, ol):is(:not([class]), .ps-4, .doc-list, .doc-steps) {
  list-style: none;
  position: relative;
}

[dir="rtl"] ul:is(:not([class]), .ps-4, .doc-list) > li::before {
  content: "\2022";
  position: absolute;
  inset-inline-start: 0;
}

[dir="rtl"] ol:is(:not([class]), .ps-4, .doc-steps) > li::before {
  content: counter(list-item) ".";
  position: absolute;
  inset-inline-start: 0;
}

[dir="rtl"] pre {
  text-align: left;
}

[dir="rtl"] .otp {
  direction: ltr;
}

[dir="rtl"] :is(.table th, .text-start, .tile, .cashier) {
  text-align: right;
}

[dir="rtl"] :is(
  .table .r,
  .table .actions,
  .text-end,
  .list .end,
  .legend-list b,
  .legend-list .muted,
  .line .amt,
  .line .was,
  .amount .val,
  .denom .input input,
  .denom [data-denom-total],
  .paper .pl > :not(:first-child),
  .chat-msg.me .meta,
  .range-row output)
 {
  text-align: left;
}

[dir="rtl"] .doc-title {
  text-align: left;
}

[dir="rtl"] .dl dd,
[dir="rtl"] .dg-time,
[dir="rtl"] .table.statement tfoot td.r {
  text-align: left;
}

[dir="rtl"] .table .group-row :is(td, th),
[dir="rtl"] .table.statement tfoot th,
[dir="rtl"] .dl-stacked dd,
[dir="rtl"] .kc-line,
[dir="rtl"] .kiosk-review,
[dir="rtl"] .status-page .dl,
[dir="rtl"] .status-page .input input {
  text-align: right;
}

@container (min-width: 520px) {
  [dir="rtl"] .dl:not(.dl-stacked) dd {
    text-align: right;
  }
}

@media (max-width: 575px) {
  [dir="rtl"] .doc-title {
    text-align: right;
  }
}

/* ==========================================================================
   19. Print
   ========================================================================== */

@media print {
  body:has(.print-area) .app * {
    visibility: hidden;
  }

  body:has(.print-area) .print-area,
  body:has(.print-area) .print-area * {
    visibility: visible;
  }

  body:has(.print-area) .print-area {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
  }
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

mark {
  padding: 0 2px;
  border-radius: var(--r-xs);
  background: var(--warning-subtle);
  color: var(--text);
}

.cluster > a.link,
.spread > a.link,
:where(p, div) > a.link:only-child {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

label.btn:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ==========================================================================
   20. Focus
   ========================================================================== */

:where(button, a, [tabindex], select, textarea, summary, input[type="range"], input[type="file"]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chip button:focus-visible,
.pager :is(a, button):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.input input:focus-visible {
  outline: none;
}

.line-head:focus-visible {
  outline-offset: -2px;
}

:is(.lines, .scroll, .payment, .cart.panel, .drawer-body, .count-body):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.accordion > details > summary:focus-visible {
  outline-offset: -2px;
}

/* ==========================================================================
   21. Documentation
   ========================================================================== */

.doc-text {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.doc-text > :is(p, ul, ol, h3) {
  max-width: 72ch;
}

.doc-text h3 {
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  font-weight: 600;
  margin-top: 4px;
}

.doc-text :not(pre) > code {
  padding: 1px 4px;
  border-radius: var(--r-xs);
  background: var(--bg-muted);
  font-size: .9em;
  overflow-wrap: anywhere;
}

.doc-steps,
.doc-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-inline-start: 20px;
}

.doc-steps {
  list-style: decimal;
}

.doc-list {
  list-style: disc;
}

.doc-code {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
}

.doc-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding-block: 4px;
  padding-inline: 12px 4px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-secondary);
}

.doc-text .table td {
  padding-block: 8px;
}

.doc-text td a {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
}

/* ==========================================================================
   22. High contrast
   ========================================================================== */

@media (forced-colors: active) {
  :is(
    .nav-item.on,
    .nav-item[aria-current="page"],
    .mega-link[aria-current="page"],
    .segmented button.on,
    .pager [aria-current="page"],
    .shop-nav a[aria-current="page"],
    .list-link[aria-current="page"],
    .mail-open[aria-current="true"],
    .folder-nav [role="tab"][aria-selected="true"],
    .call-btn[aria-pressed="true"],
    .combo [role="option"].active,
    .tc-sec.on,
    .cat.on,
    .tender.on,
    .hnav-btn.on,
    .seg-row .btn[aria-checked="true"],
    .settings-group a:is([aria-current="page"], [aria-current="location"]),
    .table tbody tr[aria-selected="true"] td)
   {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  :is(
    .nav-item.on,
    .nav-item[aria-current="page"],
    .mega-link[aria-current="page"],
    .segmented button.on,
    .pager [aria-current="page"],
    .shop-nav a[aria-current="page"],
    .list-link[aria-current="page"],
    .mail-open[aria-current="true"],
    .folder-nav [role="tab"][aria-selected="true"],
    .call-btn[aria-pressed="true"],
    .combo [role="option"].active,
    .tc-sec.on,
    .cat.on,
    .tender.on,
    .hnav-btn.on,
    .table tbody tr[aria-selected="true"] td) *
   {
    color: inherit;
  }

  .pay {
    border: 1px solid;
  }

  .tile.added {
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }

  .switch {
    forced-color-adjust: none;
    background: Canvas;
    border-color: CanvasText;
  }

  .switch::after {
    background: CanvasText;
  }

  .choice.on .switch,
  .choice > input:checked + .switch {
    background: Highlight;
    border-color: Highlight;
  }

  .choice.on .switch::after,
  .choice > input:checked + .switch::after {
    background: HighlightText;
  }

  .progress {
    forced-color-adjust: none;
    background: Canvas;
    outline: 1px solid CanvasText;
  }

  :is(
    .progress > span,
    .storage-bar span,
    .steps > li.done::before,
    .steps > li[aria-current="step"]::before,
    .carousel-dots button[aria-current="true"]::before,
    .nav-sub .nav-item.on::before)
   {
    forced-color-adjust: none;
    background: Highlight;
  }

  .rate label,
  .stars .ti {
    forced-color-adjust: none;
    color: CanvasText;
  }

  .rate input:checked ~ label,
  .rate label:hover,
  .rate label:hover ~ label,
  .stars .ti.on {
    color: Highlight;
  }

  .badge {
    border: 1px solid;
  }

  :is(.chart, .lib-chart, .storage-bar, .ring) {
    forced-color-adjust: none;
  }
}

[data-module-off] {
  display: none !important;
}
