/* RezyPOS Cloud back office. Phone first: the base rules are the phone layout, wider layouts only add media queries. */

:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #fff;
  --surface-muted: #f5f5f5;
  --text: #0a0a0a;
  --text-muted: #636363;
  --border: #e5e5e5;
  --input-border: #8a8a8a;
  --accent: #3248FF;
  --accent-button: #3248FF;
  --accent-button-hover: #2538d4;
  --accent-soft: #e8ebff;
  --on-accent: #fff;
  --focus: #3248FF;
  --ok: #0a7a37;
  --ok-soft: #e3f4ea;
  --warn: #9a3b06;
  --warn-soft: #fdf0dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --danger-button: #b42318;
  --neutral: #525252;
  --neutral-soft: #ebebeb;
  --series: #3248FF;
  --series-prior: #8a8f98;
  --grid: #e5e5e5;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --icon-moon: inline-block;
  --icon-sun: none;

  --xs: 4px;
  --sm: 8px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --xxl: 48px;
  --xxxl: 64px;
  --target: 44px;
  --bar-height: 56px;
  --sidebar-width: 240px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0f0f0f;
    --surface: #1b1b1b;
    --surface-muted: #292929;
    --text: #fafafa;
    --text-muted: #aeaeae;
    --border: rgb(255 255 255 / 0.12);
    --input-border: #8a8a8a;
    --accent: #7c86ff;
    --accent-button: #4f5dff;
    --accent-button-hover: #3d4cf0;
    --accent-soft: #181f2e;
    --on-accent: #fff;
    --focus: #8a94ff;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --warn: #fbbf24;
    --warn-soft: #33260a;
    --danger: #ff6467;
    --danger-soft: #3a1517;
    --danger-button: #d92d20;
    --neutral: #c4c4c4;
    --neutral-soft: #2e2e2e;
    --series: #7c86ff;
    --series-prior: #6e6e78;
    --grid: rgb(255 255 255 / 0.12);
    --shadow: none;
    --icon-moon: none;
    --icon-sun: inline-block;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #1b1b1b;
  --surface-muted: #292929;
  --text: #fafafa;
  --text-muted: #aeaeae;
  --border: rgb(255 255 255 / 0.12);
  --input-border: #8a8a8a;
  --accent: #7c86ff;
  --accent-button: #4f5dff;
  --accent-button-hover: #3d4cf0;
  --accent-soft: #181f2e;
  --on-accent: #fff;
  --focus: #8a94ff;
  --ok: #4ade80;
  --ok-soft: #12301f;
  --warn: #fbbf24;
  --warn-soft: #33260a;
  --danger: #ff6467;
  --danger-soft: #3a1517;
  --danger-button: #d92d20;
  --neutral: #c4c4c4;
  --neutral-soft: #2e2e2e;
  --series: #7c86ff;
  --series-prior: #6e6e78;
  --grid: rgb(255 255 255 / 0.12);
  --shadow: none;
  --icon-moon: none;
  --icon-sun: inline-block;
}

/* Base */

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong,
b,
th,
summary,
legend {
  font-weight: 600;
}

h1,
h2 {
  margin: 0 0 var(--sm);
  font-size: 1.25rem;
  line-height: 1.2;
}

h3,
h4,
h5,
h6 {
  margin: 0 0 var(--sm);
  font-size: 1rem;
  line-height: 1.5;
}

p {
  margin: 0 0 var(--md);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

img,
svg {
  max-width: 100%;
}

bdi {
  overflow-wrap: anywhere;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.display {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}

h1.display {
  margin-bottom: var(--sm);
}

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

.caption,
.label {
  font-size: 0.875rem;
  line-height: 1.4;
}

.caption {
  color: var(--text-muted);
  font-weight: 400;
}

.label {
  font-weight: 600;
}

.tabular,
td,
th,
.stat-value {
  font-variant-numeric: tabular-nums;
}

.ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}

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

.skip-link {
  position: absolute;
  inset-block-start: var(--sm);
  inset-inline-start: var(--sm);
  z-index: 100;
  padding: var(--sm) var(--md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

.icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.icon-sm {
  width: var(--md);
  height: var(--md);
}

.icon-lg {
  width: var(--xxl);
  height: var(--xxl);
}

/* Forms and buttons */

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: var(--md);
}

.field > label,
.field > legend,
.field > .hint,
.field > .error {
  grid-column: 1 / -1;
}

.field > label {
  margin-bottom: var(--sm);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.field > button {
  margin-inline-start: var(--sm);
}

.hint,
.error {
  margin: var(--sm) 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

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

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

input,
select,
textarea {
  width: 100%;
  min-height: var(--target);
  padding: 0 var(--md);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 150ms;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

input[type="checkbox"],
input[type="radio"] {
  width: var(--lg);
  min-height: 0;
  height: var(--lg);
  padding: 0;
  accent-color: var(--accent-button);
}

.check {
  display: flex;
  align-items: center;
  gap: var(--sm);
  min-height: var(--target);
  margin-bottom: var(--md);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sm);
  min-height: var(--target);
  padding: 0 var(--md);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 150ms,
    border-color 150ms,
    color 150ms;
}

button.primary,
.button.primary {
  border-color: transparent;
  background: var(--accent-button);
  color: var(--on-accent);
}

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

button.secondary,
.button.secondary {
  background: var(--surface);
  border-color: var(--input-border);
  color: var(--text);
}

button.destructive,
.button.destructive {
  border-color: transparent;
  background: var(--danger-button);
  color: #fff;
}

button:disabled,
button[aria-disabled="true"],
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

form .primary {
  width: 100%;
}

/* Banners */

.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sm);
  margin: 0 0 var(--md);
  padding: var(--sm) var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--neutral-soft);
  color: var(--text);
}

.banner > .icon {
  margin-block-start: var(--xs);
  color: var(--neutral);
}

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

.banner.warn > .icon {
  color: var(--warn);
}

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

.banner.danger > .icon {
  color: var(--danger);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .banner.info a {
    color: var(--focus);
  }
}

:root[data-theme="dark"] .banner.info a {
  color: var(--focus);
}

/* Sign-in and notice pages */

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.auth-header {
  margin: var(--xl) 0 var(--md);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 0 var(--md) var(--xl);
}

.auth-card .primary {
  width: 100%;
}

.logo {
  display: block;
  border-radius: var(--radius-md);
}

@media (min-width: 600px) {
  .auth-card {
    padding-inline: 0;
  }
}

/* App shell: app bar, navigation and page frame */

.app-bar {
  position: sticky;
  inset-block-start: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sm);
  height: var(--bar-height);
  padding-inline: var(--md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sm);
  min-height: var(--target);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--sm);
  min-width: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target);
  min-height: var(--target);
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.icon-button:hover {
  background: var(--surface-muted);
}

.theme-icon-moon {
  display: var(--icon-moon);
}

.theme-icon-sun {
  display: var(--icon-sun);
}

.account-menu > summary {
  display: flex;
  align-items: center;
  gap: var(--sm);
  min-width: var(--target);
  min-height: var(--target);
  padding: 0 var(--sm);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu > summary:hover {
  background: var(--surface-muted);
}

.account-name {
  display: none;
  max-width: 200px;
  font-weight: 600;
}

.account-panel {
  position: absolute;
  inset-block-start: calc(100% + var(--xs));
  inset-inline-end: var(--sm);
  z-index: 30;
  width: min(280px, calc(100vw - var(--md)));
  padding: var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.16);
}

.account-panel p {
  margin: 0 0 var(--sm);
  overflow-wrap: anywhere;
}

.account-panel form {
  margin: 0;
}

.menu-logout button {
  width: 100%;
  justify-content: flex-start;
}

.menu-link {
  display: flex;
  align-items: center;
  min-height: var(--target);
}

.main-nav {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 20;
  height: calc(var(--xxxl) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.main-nav ul {
  display: flex;
  height: var(--xxxl);
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav li {
  flex: 1;
  min-width: 0;
}

.main-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--xs);
  height: 100%;
  min-height: var(--target);
  padding-inline: var(--xs);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: inset 0 3px 0 transparent;
  transition:
    background-color 150ms,
    color 150ms;
}

.main-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 3px 0 var(--accent);
}

.nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav > .nav-back {
  display: none;
}

.nav-logout {
  display: none;
  margin: 0;
}

body.app main {
  padding: var(--md) var(--md) calc(var(--xxxl) + var(--md) + env(safe-area-inset-bottom));
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--xs);
  min-height: var(--target);
  margin-bottom: var(--xs);
  overflow-wrap: anywhere;
}

.page-head {
  margin-bottom: var(--md);
}

.page-head p {
  margin-bottom: 0;
}

.logo {
  flex: none;
}

/* Cards, figures, pills */

.card {
  margin-bottom: var(--md);
  padding: var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

a.card {
  display: block;
  min-height: 72px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms;
}

a.card:hover {
  border-color: var(--input-border);
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--md);
  margin-bottom: var(--sm);
}

.card-title-row h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--xs);
  min-width: 0;
}

.stat-label,
.stat-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stat-hero .stat-value {
  font-size: 1.75rem;
}

dl.figures {
  margin: 0;
}

dl.figures > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--xs) var(--md);
  min-height: var(--target);
  border-bottom: 1px solid var(--border);
}

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

dl.figures.stacked {
  display: block;
}

dl.figures.stacked > div {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

dl.figures.stacked > div:last-child {
  border-bottom: 0;
}

dl.figures dt {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

dl.figures dd {
  min-width: 0;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--xs);
  padding: var(--xs) var(--sm);
  border: 1px solid currentColor;
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

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

.pill.neutral {
  background: var(--neutral-soft);
  color: var(--neutral);
}

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

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

td .pill {
  white-space: normal;
}

.stores-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--md);
}

.stores-grid .card {
  margin-bottom: 0;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sm);
  min-width: 0;
}

.card-row > :first-child {
  min-width: 0;
}

.admin-store .card-row {
  flex-wrap: wrap;
}

.admin-store .card-row > .pill {
  white-space: normal;
}

/* Dashboard: sections keep the phone order; from 1024px two columns */

.dash {
  display: flex;
  flex-direction: column;
}

.dash > div {
  display: contents;
}

.dash-1 { order: 1; }
.dash-2 { order: 2; }
.dash-3 { order: 3; }
.dash-4 { order: 4; }
.dash-5 { order: 5; }
.dash-6 { order: 6; }
.dash-7 { order: 7; }

.status-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: var(--sm);
}

.card-title-row a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.rank-list,
.share-list {
  margin: 0 0 var(--md);
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: var(--sm);
  min-height: var(--target);
  border-bottom: 1px solid var(--border);
}

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

.rank {
  flex: none;
  min-width: var(--lg);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-list .ellipsis {
  flex: 1 1 auto;
  min-width: 0;
}

.rank-amount {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.share-list li {
  padding: var(--sm) 0;
}

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

.recent-list li {
  display: flex;
  flex-direction: column;
  gap: var(--xs);
  padding: var(--sm) 0;
  border-bottom: 1px solid var(--border);
}

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

.recent-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--xs) var(--sm);
  min-width: 0;
}

.recent-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.recent-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.recent-total {
  margin-inline-start: auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Navigation strips: period chips and report tabs */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  margin: 0 0 var(--md);
  padding: 0;
  list-style: none;
}

.chips a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 var(--md);
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition:
    background-color 150ms,
    border-color 150ms;
}

.chips a[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tabs {
  display: flex;
  margin: 0 0 var(--md);
  padding: 0 var(--lg) 0 0;
  overflow-x: auto;
  list-style: none;
  border-bottom: 1px solid var(--border);
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--md);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--lg)), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - var(--lg)), transparent);
}

.tabs a {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 var(--md);
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  scroll-snap-align: start;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* Tables: stacked labelled blocks on a phone, a real table from 600px */

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

table,
tbody,
tfoot,
tr,
th,
td {
  display: block;
}

thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

tr {
  padding: var(--sm) 0;
  border-bottom: 1px solid var(--border);
}

th,
td {
  min-width: 0;
  padding: var(--xs) 0;
  text-align: start;
  overflow-wrap: anywhere;
}

td[data-label] {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md);
  row-gap: var(--xs);
  justify-content: space-between;
  text-align: end;
}

td[data-label]::before {
  content: attr(data-label);
  flex: none;
  max-width: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: start;
}

tfoot tr {
  font-weight: 600;
}

#right-now td.num[data-label] {
  flex-wrap: wrap;
  row-gap: var(--xs);
}

#right-now .count-unknown {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: flex-end;
  min-width: min-content;
  text-align: end;
}

#right-now .count-unknown > span:first-child {
  overflow-wrap: normal;
}

#right-now .count-unknown > span + span {
  overflow-wrap: anywhere;
}

table caption {
  text-align: start;
}

/* Disclosure, empty state, copy field */

details.disclosure > summary,
.account-menu > summary {
  cursor: pointer;
}

details.disclosure > summary {
  display: flex;
  align-items: center;
  gap: var(--sm);
  min-height: var(--target);
  list-style: none;
}

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

details.disclosure > summary .icon {
  transition: transform 150ms;
}

details.disclosure[open] > summary .icon {
  transform: rotate(90deg);
}

.disclosure-panel {
  padding: var(--sm) 0 var(--md);
}

.disclosure-panel strong {
  overflow-wrap: anywhere;
}

.steps {
  margin: 0 0 var(--md);
  padding-inline-start: var(--lg);
}

.steps > li {
  margin-bottom: var(--sm);
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sm) var(--md);
  margin: 0 0 var(--md);
  padding: 0;
  list-style: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sm);
  padding: var(--xxl) var(--md);
  text-align: center;
}

.empty-state .icon {
  width: var(--xxl);
  height: var(--xxl);
  color: var(--text-muted);
}

.empty-state h2,
.empty-state p {
  max-width: 40ch;
  margin: 0;
}

.copy-field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  margin-bottom: var(--md);
}

.copy-field input,
.copy-field textarea {
  flex: 1 1 200px;
  font-family: var(--mono);
  user-select: all;
  -webkit-user-select: all;
}

#support-code {
  font-weight: 600;
}

/* Charts: inline SVG styled by these classes, so a theme change needs no re-render */

.chart {
  display: block;
  width: 100%;
  height: 200px;
}

.chart-bar {
  fill: var(--series);
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-prior {
  fill: none;
  stroke: var(--series-prior);
  stroke-width: 2px;
  stroke-dasharray: 8 4;
}

.chart-grid {
  stroke: var(--grid);
  stroke-width: 1px;
}

.chart-axis {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
}

.chart-axis-minor {
  display: none;
}

.chart-readout {
  min-height: var(--lg);
  margin: var(--sm) 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md);
  margin: 0 0 var(--sm);
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--xs);
}

.share {
  display: block;
  width: 100%;
  height: var(--sm);
}

.share-track {
  fill: var(--surface-muted);
}

.share-fill {
  fill: var(--series);
}

/* Tablet */

@media (min-width: 600px) {
  body.app main {
    padding-inline: var(--lg);
  }

  .account-name {
    display: block;
  }

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

  .chart {
    height: 240px;
  }

  .chart-axis-minor {
    display: initial;
  }

  table {
    display: table;
  }

  thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  tbody {
    display: table-row-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    display: table-row;
    padding: 0;
    border-bottom: 0;
  }

  th,
  td {
    display: table-cell;
    padding: var(--sm) var(--md);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }

  td[data-label] {
    display: table-cell;
    text-align: start;
  }

  td[data-label]::before {
    content: none;
  }

  thead th {
    background: var(--surface-muted);
    font-size: 0.875rem;
    line-height: 1.4;
  }

  th.num,
  td.num {
    text-align: end;
  }

  td .pill {
    white-space: nowrap;
  }

  #store-check th.num {
    overflow-wrap: normal;
  }

  #store-check td.num {
    overflow-wrap: normal;
    white-space: nowrap;
  }

  dl.figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--md);
  }

  dl.figures > div {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    border-bottom: 0;
  }

  .field > input,
  .field > select,
  .field > textarea {
    max-width: 480px;
  }

  form .primary {
    width: auto;
  }

  .auth-card form .primary {
    width: 100%;
  }
}

/* Desktop: the app bar becomes the head of a 240px sidebar */

@media (min-width: 1024px) {
  .app-bar {
    position: fixed;
    inset-block-start: 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    border-inline-end: 1px solid var(--border);
  }

  .account-name {
    display: none;
  }

  .account-panel {
    inset-inline: var(--sm);
    width: auto;
  }

  .main-nav {
    display: flex;
    flex-direction: column;
    inset-block: var(--bar-height) 0;
    inset-inline: 0 auto;
    width: var(--sidebar-width);
    height: auto;
    padding: var(--md) var(--sm);
    overflow-y: auto;
    border-top: 0;
    border-inline-end: 1px solid var(--border);
  }

  .main-nav ul {
    flex-direction: column;
    gap: var(--xs);
    height: auto;
  }

  .main-nav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sm);
    min-height: var(--target);
    padding-inline: var(--md);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: inset 3px 0 0 transparent;
  }

  .main-nav a[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .nav-logout {
    display: block;
    margin-top: auto;
    padding-top: var(--md);
  }

  .nav-logout button {
    width: 100%;
    justify-content: flex-start;
    padding-inline: var(--md);
  }

  .main-nav > .nav-back {
    display: flex;
    flex: none;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--xs);
    height: auto;
    min-height: var(--target);
    margin-bottom: var(--sm);
    padding-inline: var(--md);
    color: var(--accent);
  }

  body.app main {
    margin-inline-start: var(--sidebar-width);
    padding: var(--xxl) var(--xl) var(--xxl);
  }

  body.app main > * {
    max-width: 1120px;
    margin-inline: auto;
  }

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

  .dash {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--xl);
    align-items: start;
  }

  .dash > div {
    display: block;
  }

  .dash table th,
  .dash table td {
    padding-inline: var(--sm);
    overflow-wrap: break-word;
  }
}

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

@media (forced-colors: active) {
  :focus-visible {
    outline-color: Highlight;
  }

  button,
  .button,
  input,
  select,
  textarea {
    border-color: ButtonText;
  }

  button.primary,
  .button.primary,
  button.destructive,
  .button.destructive {
    border-color: ButtonText;
  }

  .banner {
    border-color: CanvasText;
  }

  .pill,
  .chips a {
    border-color: CanvasText;
  }

  .plain-text {
    border-color: CanvasText;
  }

  .main-nav a[aria-current="page"],
  .tabs a[aria-current="page"],
  .chips a[aria-current="true"] {
    text-decoration: underline;
  }

  .chart-bar,
  .share-fill {
    fill: Highlight;
  }

  .chart-prior,
  .chart-grid {
    stroke: GrayText;
  }

  .chart-axis {
    fill: CanvasText;
  }
}

/* Reports: the period line, the items pager and indented method rows */

.period-line {
  margin: 0 0 var(--xs);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  margin: var(--md) 0;
}

th.indent {
  padding-inline-start: var(--lg);
  font-weight: 400;
}

.field + .field {
  margin-top: var(--sm);
}

/* Orders: the list rows, the search form and the order header */

.order-list {
  display: grid;
  gap: var(--sm);
  margin: 0 0 var(--md);
  padding: 0;
  list-style: none;
}

.order-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--xs);
  min-height: 72px;
  padding: var(--sm) var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms;
}

.order-row:hover {
  border-color: var(--input-border);
}

.order-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sm);
  min-width: 0;
}

.order-number {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.order-total {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.order-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sm);
  margin: 0 0 var(--md);
}

.status-line {
  margin: var(--xs) 0;
}

.search-form .field {
  margin-bottom: 0;
}

/* Reports: the toolbar, the combined views and their by-store tables */

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  gap: var(--sm);
  margin: var(--md) 0;
}

.toolbar .button {
  min-height: var(--target);
}

.toolbar > form {
  display: contents;
}

.toolbar > form > button {
  grid-column: 1 / -1;
}

.banner + .toolbar {
  grid-template-columns: 1fr;
}

.group-section {
  margin-bottom: var(--xl);
}

.group-section > h2 {
  margin-bottom: var(--xs);
  padding-bottom: var(--sm);
  border-bottom: 1px solid var(--border);
}

.group-count {
  margin: 0 0 var(--md);
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.tap-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

@media (min-width: 600px) {
  .nowrap {
    white-space: nowrap;
  }
}

.code-input {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (display-mode: standalone) {
  .install-hint {
    display: none;
  }
}

@media (display-mode: standalone) and (hover: none) {
  [data-no-standalone] {
    display: none;
  }
}

.by-store a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  overflow-wrap: anywhere;
}

tbody.store-group th[scope="rowgroup"] {
  padding-top: var(--md);
  font-weight: 600;
  text-align: start;
}

/* Text typed on a till: shown whole, wrapped, never as markup */

.plain-text {
  margin: 0 0 var(--md);
  padding: var(--sm) var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.plain-text.scroll-box {
  max-height: 30rem;
  overflow: auto;
}

.field > textarea {
  min-height: 6rem;
  padding-block: var(--sm);
  resize: vertical;
}

tbody.store-group th[scope="rowgroup"] .currency-code {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

tr.reconcile th {
  color: var(--text-muted);
  font-weight: 400;
}

tr.reconcile td {
  color: var(--text);
}

.stat-hero.compact .stat-value {
  font-size: 1.25rem;
}

a.all-stores-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
}

@media (min-width: 600px) {
  .toolbar {
    display: flex;
    flex-wrap: wrap;
  }

  tbody.store-group th[scope="rowgroup"] {
    padding-top: var(--sm);
    background: var(--surface-muted);
  }
}

/* The Deletion requests tables keep the stacked blocks until there is room for five columns with whole times */

@media (min-width: 600px) and (max-width: 1279px) {
  .by-store.deletions table,
  .by-store.deletions tbody,
  .by-store.deletions tr,
  .by-store.deletions th,
  .by-store.deletions td {
    display: block;
  }

  .by-store.deletions thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .by-store.deletions tr {
    padding: var(--sm) 0;
    border-bottom: 1px solid var(--border);
  }

  .by-store.deletions th,
  .by-store.deletions td {
    padding: var(--xs) 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .by-store.deletions td[data-label] {
    display: flex;
    flex-wrap: wrap;
    gap: var(--md);
    row-gap: var(--xs);
    justify-content: space-between;
    text-align: end;
  }

  .by-store.deletions td[data-label]::before {
    content: attr(data-label);
    flex: none;
    max-width: 100%;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: start;
  }
}

@media (min-width: 1280px) {
  .by-store.deletions th[scope="row"],
  .by-store.deletions td[data-label="Owner"] {
    max-inline-size: 20rem;
  }

  .by-store.deletions td:not([data-label="Owner"]) {
    overflow-wrap: normal;
  }
}

/* Print sheet: the light palette is forced on screen for the print view and on paper for every page */

body.print main {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--md);
}

.print-controls {
  display: grid;
  gap: var(--sm);
  margin: 0 0 var(--md);
}

.print-controls p {
  margin: 0;
}

.print-sheet {
  padding: var(--md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
}

.print-header {
  display: flex;
  align-items: center;
  gap: var(--sm);
}

.print-brand {
  margin: 0;
  color: var(--text-muted);
}

.print-meta {
  margin: 0 0 var(--md);
  padding-bottom: var(--md);
  border-bottom: 1px solid var(--text);
}

.print-meta > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--xs) var(--sm);
}

.print-meta dt {
  color: var(--text-muted);
  font-weight: 600;
}

.print-meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.print-warning {
  margin: 0 0 var(--sm);
  font-weight: 600;
}

@media (min-width: 600px) {
  .print-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .print-controls p {
    flex-basis: 100%;
  }

  .print-sheet {
    padding: var(--lg);
  }
}

html.print-doc,
html.print-doc[data-theme] {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #fff;
  --surface-muted: #f5f5f5;
  --text: #0a0a0a;
  --text-muted: #636363;
  --border: #e5e5e5;
  --input-border: #8a8a8a;
  --accent: #3248FF;
  --accent-button: #3248FF;
  --accent-button-hover: #2538d4;
  --accent-soft: #e8ebff;
  --on-accent: #fff;
  --focus: #3248FF;
  --ok: #0a7a37;
  --ok-soft: #e3f4ea;
  --warn: #9a3b06;
  --warn-soft: #fdf0dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --danger-button: #b42318;
  --neutral: #525252;
  --neutral-soft: #ebebeb;
  --series: #3248FF;
  --series-prior: #8a8f98;
  --grid: #e5e5e5;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --icon-moon: inline-block;
  --icon-sun: none;
}

html.print-doc .print-sheet h1 {
  font-size: 18pt;
  line-height: 1.2;
}

html.print-doc .print-sheet h2 {
  font-size: 14pt;
  line-height: 1.2;
}

html.print-doc .print-sheet {
  font-size: 11pt;
  line-height: 1.4;
}

html.print-doc .print-sheet .print-brand,
html.print-doc .print-sheet .print-meta,
html.print-doc .print-sheet caption,
html.print-doc .print-sheet .caption {
  font-size: 9pt;
  line-height: 1.4;
}

@page {
  margin: 12mm;
}

@media print {
  :root,
  :root:where(:not([data-theme="light"])),
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #f5f5f5;
    --surface: #fff;
    --surface-muted: #f5f5f5;
    --text: #0a0a0a;
    --text-muted: #636363;
    --border: #e5e5e5;
    --input-border: #8a8a8a;
    --accent: #3248FF;
    --accent-button: #3248FF;
    --accent-button-hover: #2538d4;
    --accent-soft: #e8ebff;
    --on-accent: #fff;
    --focus: #3248FF;
    --ok: #0a7a37;
    --ok-soft: #e3f4ea;
    --warn: #9a3b06;
    --warn-soft: #fdf0dc;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --danger-button: #b42318;
    --neutral: #525252;
    --neutral-soft: #ebebeb;
    --series: #3248FF;
    --series-prior: #8a8f98;
    --grid: #e5e5e5;
    --shadow: none;
  }

  html,
  body {
    background: #fff;
    color: #0a0a0a;
  }

  body {
    font-size: 11pt;
    line-height: 1.4;
    orphans: 3;
    widows: 3;
  }

  h1 {
    font-size: 18pt;
    line-height: 1.2;
  }

  h2 {
    font-size: 14pt;
    line-height: 1.2;
  }

  h3 {
    font-size: 11pt;
  }

  .caption,
  .print-brand,
  .print-meta,
  caption {
    font-size: 9pt;
  }

  .app-bar,
  .main-nav,
  .skip-link,
  .back-link,
  .nav-back,
  .no-print,
  .offline-banner,
  .icon-button,
  .account-menu,
  .tabs,
  .chips,
  .pager,
  .toolbar,
  .print-controls,
  form,
  details > summary,
  svg,
  .chart-readout {
    display: none !important;
  }

  body.app main,
  body.print main {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  body.app main > * {
    max-width: none;
  }

  .print-sheet,
  .card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

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

  table {
    display: table;
    width: 100%;
  }

  thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  tbody {
    display: table-row-group;
  }

  tfoot {
    display: table-row-group;
  }

  tr {
    display: table-row;
    padding: 0;
    border-bottom: 0;
    break-inside: avoid;
  }

  th,
  td,
  td[data-label] {
    display: table-cell;
    padding: 4pt 6pt;
    border-bottom: 1px solid #8a8a8a;
    vertical-align: top;
    text-align: start;
  }

  td[data-label]::before {
    content: none;
  }

  thead th {
    border-bottom: 1px solid #0a0a0a;
    background: transparent;
    font-size: 9pt;
    font-weight: 600;
  }

  th.num,
  td.num {
    text-align: end;
  }

  h2,
  h3,
  caption {
    break-after: avoid;
  }

  .print-header,
  .figures {
    break-inside: avoid;
  }
}
