:root {
  /* Match storetempo.com / App Master Mobile */
  --header-bg: #003366;
  --bg: #f4f6f9;
  --ink: #1c2434;
  --muted: #5a6478;
  --accent: #c8102e;
  --accent-dark: #a50d26;
  --navy: #003366;
  --navy-dark: #00264d;
  --card: #ffffff;
  --line: rgba(28, 36, 52, 0.12);
  --err: #c8102e;
  --warn: #9a5b00;
  --ok: #16a34a;
  --grocery: #16a34a;
  --peach: #ff8a65;
  --sun: #f9a825;
  --sky: #4a90c8;
  --font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 51, 102, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 45% at 8% -8%, rgba(0, 51, 102, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(200, 16, 46, 0.07) 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
}
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  pointer-events: auto;
  position: fixed;
  left: 0.75rem;
  top: 0;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  z-index: 100;
  padding: 0.5rem 0.85rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 6px 6px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.wrap { max-width: 64rem; margin: 0 auto; padding: 1rem 1.25rem; }
.top {
  background: var(--header-bg);
  border-bottom: 3px solid var(--accent);
  color: #fff;
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand {
  font-family: var(--display);
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
}
.brand:hover { opacity: 0.95; color: #fff; }
.main-nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: center; }
.main-nav a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}
.main-nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.nav-badge {
  display: inline-block;
  min-width: 1.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  margin-left: 0.15rem;
}
.store-bar {
  border-bottom: 1px solid var(--line);
  background: #e8eef5;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.store-select { margin: 0; }
.store-select select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-width: 14rem;
}
.muted { color: var(--muted); font-size: 0.9rem; }
h1 {
  margin: 0.35rem 0 0.5rem;
  letter-spacing: -0.03em;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--navy);
}
h2 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.15rem;
  font-family: var(--display);
  color: var(--navy);
}
.lead { color: var(--muted); margin-top: 0; font-size: 1.05rem; }

.dash-hero { margin: 1rem 0 0.25rem; }
.dash-kicker {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.dash-stats .stat { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.dash-stats .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-warn strong { color: var(--accent); }

.dash-grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
}
.dash-tile {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 51, 102, 0.04);
  animation: dash-in 0.45s ease both;
  animation-delay: var(--dash-delay, 0s);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.dash-tile:hover,
.dash-tile:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(200, 16, 46, 0.35);
  outline: none;
}
.dash-art {
  display: block;
  line-height: 0;
  background: #e8eef5;
}
.dash-art img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}
.dash-tile:hover .dash-art img { transform: scale(1.04); }
.dash-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem 1rem;
}
.dash-copy strong {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.dash-copy span { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.tone-mint .dash-art { background: #e8f5ee; }
.tone-sky .dash-art { background: #e8eef5; }
.tone-peach .dash-art { background: #fde8eb; }
.tone-teal .dash-art { background: #e8f7f4; }
.tone-sun .dash-art { background: #fff8e6; }
.tone-rose .dash-art { background: #fde8eb; }
.tone-fog .dash-art { background: #eef2f7; }

@keyframes dash-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dash-tile { animation: none; }
  .dash-tile:hover, .dash-tile:focus-visible { transform: none; }
  .dash-tile:hover .dash-art img { transform: none; }
}

.cards { list-style: none; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.cards li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cards a { color: var(--accent); text-decoration: none; }
.cards span { color: var(--muted); font-size: 0.9rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.25rem; font-weight: 600; }
.stat strong { font-family: var(--display); font-size: 1.2rem; color: var(--navy); }.stock-summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 1rem 0 1.25rem;
  max-width: 32rem;
}
.stock-onhand { margin: 0; }
.stock-qty { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stock-actions { margin: 0.5rem 0 0; font-size: 0.95rem; }
.stock-actions a { color: var(--accent); }
.form { display: grid; gap: 0.85rem; max-width: 22rem; margin-top: 1rem; }
.form-wide { max-width: 28rem; }
.form label { display: grid; gap: 0.35rem; font-size: 0.95rem; }
.form input, .form select, .form textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.checkbox { display: flex !important; align-items: center; gap: 0.5rem; }
button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-dark); }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.form .check { display: flex !important; flex-direction: row; align-items: center; gap: 0.5rem; }
.form-wide { max-width: 32rem; }
.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.error { color: var(--err); }
.warn { color: var(--warn); font-weight: 600; }
.hint { margin-top: 0.75rem; color: var(--muted); font-size: 0.9rem; }
.flash { padding: 0.65rem 0.85rem; border-radius: 6px; margin: 0.75rem 0; }
.flash-success { background: #e8f5e9; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fde8eb; color: var(--err); border: 1px solid #f5c2c7; }
.launch-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  max-width: 36rem;
  box-shadow: var(--shadow);
}
.launch-panel-danger {
  border-color: #e6c48a;
  background: #fff6e8;
}
.launch-panel-live {
  border-color: #bbf7d0;
  background: #e8f5e9;
}
.alert-banner {
  background: #fff6e8;
  border-bottom: 1px solid #e6c48a;
  padding: 0.65rem 1.25rem;
}
.alert-banner ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.alert-banner li { margin: 0.2rem 0; font-size: 0.92rem; }
.alert-banner .sev { text-transform: uppercase; font-weight: 700; font-size: 0.75rem; margin-right: 0.35rem; }
.alert-banner .sev-critical .sev { color: var(--err); }
.alert-banner .sev-warning .sev { color: var(--warn); }
.alert-banner .src { color: var(--muted); font-size: 0.8rem; margin-right: 0.35rem; }
footer { margin-top: 3rem; padding-bottom: 2rem; }
code { font-size: 0.85em; }
/* Wide tables: keep both scrollbars in the viewport (H bar must not sit under 400+ rows). */
.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 42rem);
  overflow-x: scroll;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #7a8c84 #e8eee9;
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
/* Optional top horizontal scrollbar (synced via table-hscroll.js). */
.table-hscroll {
  margin: 1rem 0;
}
.table-hscroll .table-hscroll-bar {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
  height: 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #e8eee9;
  scrollbar-width: thin;
  scrollbar-color: #7a8c84 #e8eee9;
}
.table-hscroll .table-hscroll-bar::-webkit-scrollbar {
  height: 14px;
}
.table-hscroll .table-hscroll-bar::-webkit-scrollbar-track {
  background: #e8eee9;
}
.table-hscroll .table-hscroll-bar::-webkit-scrollbar-thumb {
  background: #7a8c84;
  border-radius: 7px;
  border: 3px solid #e8eee9;
}
.table-hscroll .table-hscroll-spacer {
  height: 1px;
  pointer-events: none;
}
.table-hscroll .table-scroll {
  margin: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.table-scroll::-webkit-scrollbar {
  height: 14px;
  width: 14px;
}
.table-scroll::-webkit-scrollbar-track {
  background: #e8eee9;
  border-radius: 0 0 7px 7px;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: #7a8c84;
  border-radius: 7px;
  border: 3px solid #e8eee9;
}
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #5c6b64;
}
.table-scroll .data {
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  width: max-content;
  max-width: none;
}
.table-scroll .data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--line);
}
.table-scroll .data th:first-child,
.table-scroll .data td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: 1px 0 0 var(--line);
}
.table-scroll .data thead th:first-child {
  z-index: 3;
  background: #eef3ef;
}
.table-scroll .data tbody tr:nth-child(even) td:first-child {
  background: #fafcfb;
}
main.wrap:has(.table-scroll) {
  max-width: min(100%, 96rem);
}
.data {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.data-wide { min-width: 78rem; width: max-content; }
.data th, .data td { padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.92rem; white-space: nowrap; }
.data th { background: #eef3ef; font-weight: 600; }
.data th a.th-sort {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}
.data th a.th-sort:hover { color: var(--accent); text-decoration: underline; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:nth-child(even) { background: #fafcfb; }
.data .actions { white-space: nowrap; }
.data .actions form.inline { display: inline; margin-left: 0.5rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin: 1rem 0; max-width: 100%; }
.search-form { display: flex; gap: 0.5rem; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; max-width: 100%; }
.search-form input {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.panel-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.panel h2 {
  margin-top: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.panel .form,
.panel .inv-form {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.panel .form label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.panel .form input,
.panel .form select,
.panel .form textarea,
.panel .product-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.panel .product-select {
  font-size: 0.78rem;
  line-height: 1.25;
  padding: 0.45rem 0.5rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.panel .product-select option {
  font-size: 0.78rem;
}
.panel .hint,
.panel .onhand-line {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Product image thumbs (StoreTempo image_url) */
.product-thumb-cell {
  width: 3rem;
  text-align: center;
  vertical-align: middle;
}
.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #e8ecf1;
  display: inline-block;
  vertical-align: middle;
}
.product-thumb-lg {
  width: 120px;
  height: 120px;
}
.product-image-preview {
  margin: 0.35rem 0 0.75rem;
}

/* Till — large targets, two columns when there is room */
main.wrap:has(.pos) {
  max-width: min(100%, 96rem);
}
.pos-head { margin-bottom: 0.75rem; }
.pos-kicker {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.pos-market fieldset,
.pos-auth fieldset,
.pos-correct-form fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.pos-market legend,
.pos-auth legend { font-weight: 700; color: var(--navy); }
.pos-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.9fr);
  align-items: start;
}
@media (max-width: 52rem) {
  .pos-grid { grid-template-columns: 1fr; }
}
.pos-search {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.pos-scan span,
.pos-add label span,
.pos-auth label span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.pos-scan input,
.pos-add input,
.pos-auth input,
.pos-complete input[type="checkbox"] {
  min-height: 2.75rem;
}
.pos-scan input,
.pos-add input,
.pos-auth input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 1.05rem;
}
.pos-cats,
.pos-qty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.pos-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.pos-chip.is-on,
.pos-chip:has(input:checked) {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.pos-packages {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.pos-pkg {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.75rem;
}
.pos-pkg-meta { display: grid; gap: 0.15rem; }
.pos-pkg-meta span { color: var(--muted); font-size: 0.9rem; }
.pos-add {
  display: grid;
  grid-template-columns: 5.5rem 6.5rem 1fr;
  gap: 0.5rem;
  align-items: end;
}
.pos-add .pos-qty { grid-column: 1 / -1; }
.pos-add-btn,
.pos-pay,
.pos-search button {
  min-height: 2.75rem;
  font-weight: 700;
}
.pos-ticket {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 0.75rem;
}
.pos-lines {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.65rem;
}
.pos-lines li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}
.pos-lines span { display: block; color: var(--muted); font-size: 0.9rem; }
.pos-totals {
  margin: 0.75rem 0;
  display: grid;
  gap: 0.35rem;
}
.pos-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}
.pos-totals dt { margin: 0; color: var(--muted); }
.pos-totals dd { margin: 0; font-weight: 700; }
.pos-limit { font-weight: 600; }
.pos-verify {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}
.pos-complete { margin-top: 0.75rem; }
.pos-pay { width: 100%; font-size: 1.1rem; }
.pos-links { margin-top: 1.25rem; }
.pos-receipt { max-width: 36rem; }
@media (prefers-reduced-motion: reduce) {
  .pos-ticket { position: static; }
}

main.wrap:has(.mk) { max-width: 42rem; }
.mk-hero { margin: 1.25rem 0 2rem; }
.mk-hero h1 { margin-bottom: 0.75rem; }
.mk-cta { font-weight: 700; min-height: 2.75rem; }
.mk-section { margin: 2rem 0; }
.mk-section h2 { margin-top: 0; }
.mk-points { padding-left: 1.15rem; margin: 0.75rem 0 0; }
.mk-points li { margin: 0.75rem 0; line-height: 1.45; }
.mk-foot { margin: 2.5rem 0 1rem; }
