/* Self-hosted (SIL OFL) - no third-party font requests. Same faces as Warp It. */
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url(/fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(/fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-display: swap; src: url(/fonts/instrument-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap; src: url(/fonts/fraunces-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 700; font-display: swap; src: url(/fonts/fraunces-latin-700-normal.woff2) format("woff2"); }

/* Palette follows Warp It (navy + orange) so the two read as sister products.
   Orange is a fill, never text on white: white-on-orange fails contrast, so buttons are navy text on orange. */
:root {
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --brand: #0f172a;
  --brand-dark: #1e293b;
  --brand-tint: #fef6ec;
  --orange: #F7941D;
  --orange-dark: #E07D0A;
  --link: #9a4a00;
  --accent: #F7941D;
  --warn-bg: #fff4e0;
  --warn: #8a4b00;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --good: #1d6b2f;
  --good-bg: #e5f4e8;
  --radius: 12px;
  --focus: #F7941D;
  --font-body: "Instrument Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: var(--font-body);
  color: var(--ink); background: var(--bg); line-height: 1.55;
}
a { color: var(--link); text-underline-offset: 2px; }
/* Focus: navy ring on light backgrounds, orange ring on navy ones. Orange on white is only 2.3:1,
   too faint to find where you are (WCAG 1.4.11 / 2.4.7). */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(247, 148, 29, .55); border-radius: 4px; }
.top :focus-visible, .mk-footer :focus-visible, .navy :focus-visible, .mk-result :focus-visible, .nav :focus-visible, .mk-cta :focus-visible {
  outline-color: var(--orange); box-shadow: none;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--orange); color: var(--ink); padding: 10px 14px; z-index: 50; font-weight: 700; }
.skip:focus { left: 8px; }

/* Tap targets: at least 44px tall for anything you press (WCAG 2.5.5). */
.btn, .pill-nav a, .app-menu, .seg span, details > summary { min-height: 44px; }
.btn, .pill-nav a { display: inline-flex; align-items: center; justify-content: center; }
.btn.small { min-height: 36px; }
details > summary { display: flex; align-items: center; gap: 6px; }
.pill-nav a { padding: 6px 14px; }
.seg span { display: inline-flex; align-items: center; }
.demo-bar a { display: inline-block; padding: 12px 0; }
.top .logo { display: inline-flex; align-items: center; min-height: 44px; }
footer a { display: inline-block; padding: 12px 0; }
h1, h2, .stat .n { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; margin: 0 0 .75rem; line-height: 1.2; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .8rem; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { background: var(--brand); color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.logo { color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--orange); }
.trustname { font-size: .9rem; color: #cbd5e1; }
.trustname .tag { background: var(--orange); color: var(--ink); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; font-weight: 600; border-bottom: 2px solid transparent; }
.nav a:hover { background: var(--brand-dark); }
.nav a.on { border-bottom-color: var(--orange); border-radius: 6px 6px 0 0; }
.nav-home { display: none; }
.app-menu { display: none; background: none; color: #fff; border: 1.5px solid #fff; border-radius: 8px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.app-menu[aria-expanded="true"] { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.demo-bar { background: var(--warn-bg); color: var(--warn); font-size: .9rem; padding: 6px 0; border-bottom: 1px solid #f0d9b0; }
.demo-bar a { margin-left: .75em; white-space: nowrap; }

main { padding: 20px 0 48px; }
footer { color: var(--muted); font-size: .85rem; padding: 24px 0; border-top: 1px solid var(--line); }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .9rem; }
.stat.hero { border-left: 5px solid var(--orange); }
a.stat { color: var(--ink); text-decoration: none; }
a.stat:hover { border-color: var(--orange); }
a.stat .l { text-decoration: underline; text-underline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.spread .row > *, .row > .btn, .row > div > .btn { flex: 0 0 auto; }
.spread .row { flex-wrap: nowrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Forms */
label { display: block; font-weight: 600; margin: 0 0 4px; font-size: .95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=file], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #9fb0b4; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; background: var(--orange); color: var(--ink); border: 0; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--orange-dark); }
.btn.big { padding: 14px 22px; font-size: 1.1rem; width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); font-weight: 600; }
.btn.ghost:hover { background: var(--brand-tint); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.inline { display: inline; }

/* Quick pick buttons for issue logging */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.picks label { margin: 0; }
.picks input { position: absolute; opacity: 0; }
.picks span {
  display: block; border: 2px solid var(--line); border-radius: 8px; padding: 12px 10px; background: #fff; cursor: pointer;
  font-weight: 600; min-height: 64px;
}
.picks span small { display: block; font-weight: 400; }
.picks input:checked + span { border-color: var(--orange); background: var(--brand-tint); }
.picks input:focus + span { outline: 3px solid var(--focus); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-block; padding: 8px 14px; border: 2px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer; font-weight: 600; }
.seg input:checked + span { border-color: var(--orange); background: var(--brand-tint); }
.seg input:focus + span { outline: 3px solid var(--focus); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #fafcfb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* Messages and tags */
.flash { background: var(--good-bg); color: var(--good); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 10px; background: #e2e8f0; color: var(--ink); font-weight: 600; font-family: var(--font-body); letter-spacing: 0; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.grey { background: #eceff0; color: var(--muted); }

/* Bars (SVG) */
.bar-bg { fill: #e8eeee; }
.bar-fg { fill: var(--orange); }
.bar-bm { stroke: var(--accent); stroke-width: 3; }

/* Public pages */
.public main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.drop { border-left: 4px solid var(--orange); }

/* Sign-in page: intro + demo choice */
.intro { max-width: 760px; margin: 8px 0 24px; }
.intro h1 { font-size: 2.2rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.demo-card { border-top: 5px solid var(--orange); }
.demo-choice { display: grid; gap: 12px; }
.tier {
  display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer;
}
.tier:hover { border-color: var(--orange); background: var(--brand-tint); }
.tier-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.tier-desc { display: block; color: var(--muted); margin: 4px 0 8px; }
.tier-go { display: block; font-weight: 700; color: var(--link); }
.drop h3 { margin-top: 0; }
.choice { display: grid; gap: 10px; }
.qr { width: 180px; height: 180px; image-rendering: pixelated; border: 1px solid var(--line); background: #fff; }

details summary { cursor: pointer; font-weight: 600; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-nav a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; background: #fff; font-size: .9rem; }
.pill-nav a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Returns: tap counters */
.ret-details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.ret-details summary { font-weight: 600; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.ret-details summary::-webkit-details-marker { display: none; }
.ret-change { margin-left: auto; color: var(--link); text-decoration: underline; font-weight: 600; }
.ret-details[open] .ret-change { display: none; }
.ret-details .row { margin-top: 12px; }
.ret-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 12px; }
.ret-card { margin: 0; padding: 14px 16px; }
.ret-card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.ret-card select { margin-bottom: 10px; }
.ret-card > .btn { width: 100%; margin-top: 6px; }
.ret-card.has-count { border-color: var(--orange); box-shadow: 0 0 0 2px var(--brand-tint); }
.stepper { display: grid; grid-template-columns: 1fr 48px 64px 48px; gap: 6px; align-items: center; margin-bottom: 8px; }
.stepper-label { font-weight: 600; }
.good-label::before { content: "\2713  "; color: var(--good); }
.bad-label::before { content: "\2715  "; color: var(--bad); }
.step { height: 48px; border-radius: 10px; border: 1.5px solid var(--ink); background: #fff; font-size: 1.5rem; font-weight: 700; color: var(--ink); cursor: pointer; line-height: 1; }
.step[data-step="1"] { background: var(--orange); border-color: var(--orange); }
.step:active { transform: scale(.94); }
.stepper input { height: 48px; text-align: center; font-size: 1.25rem; font-weight: 700; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-solo { grid-template-columns: 56px 80px 56px; max-width: 220px; margin: 0; }
.picks-more > summary { font-weight: 700; color: var(--link); padding: 4px 0 12px; cursor: pointer; }
.picks span { min-height: 0; }
.ret-parts summary { font-size: .9rem; color: var(--link); font-weight: 600; margin: 2px 0 6px; }
.ret-more { margin: 4px 0 12px; }
.ret-more > summary { font-weight: 700; padding: 10px 0; }
.ret-bar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 14px; z-index: 3; }
.ret-bar .btn[disabled] { background: #e2e8f0; color: var(--muted); cursor: default; }
.ret-recent { list-style: none; padding: 0; margin: 0; }
.ret-recent li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .top .wrap { min-height: 56px; gap: 8px 12px; flex-wrap: nowrap; position: relative; }
  .trustname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .app-menu { display: inline-block; margin-left: auto; flex: none; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
         background: var(--ink); padding: 6px 16px 14px; box-shadow: 0 16px 30px rgba(15, 23, 42, .35); z-index: 20; }
  .nav.open { display: flex; }
  .nav a { padding: 13px 4px; border-radius: 0; border-bottom: 1px solid #1e293b; font-size: 1.05rem; }
  .nav a.on { border-bottom-color: #1e293b; box-shadow: inset 4px 0 0 var(--orange); padding-left: 14px; border-radius: 0; }
  .nav a:last-child { border-bottom: 0; }
  .nav .nav-home { display: block; }
  .demo-bar { font-size: .8rem; }
  main { padding-top: 14px; }
  .stat .n { font-size: 1.5rem; }
}

@media print {
  .top, .nav, footer, .no-print, .demo-bar { display: none !important; }
  body { background: #fff; }
  .card, .stat { border-color: #bbb; break-inside: avoid; }
}

/* Warp It pointer (dashboard, stock, returns) */
.tip { margin-top: 28px; border-left: 4px solid var(--orange, #F7941D); background: #fef6ec; }
.tip h2 { font-size: 1.1rem; margin: 0 0 6px; }
.tip p { margin: 0 0 10px; }
.tip-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 4px 0 0 !important; }

/* Logo image (Aid Back mark B) */
.logo img { display: block; height: 32px; width: auto; }

/* filter pills: at least 44px wide for taps */
.pill-nav a { min-width: 44px; }

/* simple lists in admin cards */
ul.plain { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }

/* Two-step setup: phone link, QR for computers, key to copy */
.mfa-ways { display: grid; gap: 14px; margin: 14px 0 18px; }
.mfa-way { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.mfa-way h2 { font-size: 1rem; margin: 0 0 6px; font-family: var(--font-body); }
.mfa-way p { margin: 0 0 8px; }
.mfa-key { display: block; font-size: 1.05rem; letter-spacing: .04em; word-break: break-all; user-select: all; padding: 8px 10px; background: var(--brand-tint, #fef6ec); border-radius: 8px; }
@media (min-width: 760px) { .mfa-ways { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 759px) { .mfa-qr { order: 3; } }

/* ---- Phones ---- */
@media (max-width: 640px) {
  /* number tiles two to a row instead of one */
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 1.45rem; }
  /* list tables become one labelled card per row (labels copied from the header by site.js) */
  table.stack:has(thead) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack:has(thead), table.stack:has(thead) tbody, table.stack:has(thead) tr, table.stack:has(thead) td { display: block; width: 100%; }
  table.stack:has(thead) tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--card); }
  table.stack:has(thead) td { border: 0; padding: 5px 0; text-align: left; display: grid; grid-template-columns: minmax(84px, 34%) 1fr; gap: 10px; align-items: baseline; }
  table.stack:has(thead) td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; font-weight: 600; }
  table.stack:has(thead) td[data-label=""] { grid-template-columns: 1fr; }
  table.stack:has(thead) td[data-label=""]::before { display: none; }
  table.stack:has(thead) td:empty { display: none; }
  table.stack:has(thead) small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  table.stack:has(thead) td input:not([type=checkbox]), table.stack:has(thead) td select { width: 100%; }
  .table-wrap:has(table.stack) { overflow: visible; }
}
/* full-size tap targets on touch screens */
@media (pointer: coarse) {
  .btn.small, .pill-nav a { min-height: 44px; }
  .tip-actions a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 640px) { .hide-phone { display: none !important; } }
@media (max-width: 640px) {
  table.stack:has(thead) td > a:first-child { display: flex; align-items: center; min-height: 44px; }
}
select, input[type=time], input[type=date], input[type=number], input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=search] { min-height: 44px; }
input[type=number] { min-width: 56px; }
@media (max-width: 640px) {
  /* label on the left, everything in the cell (links, second lines, buttons) on the right */
  table.stack:has(thead) td { display: block; position: relative; padding: 6px 0 6px max(96px, 34%); min-height: 32px; }
  table.stack:has(thead) td::before { position: absolute; left: 0; top: 8px; width: calc(max(96px, 34%) - 10px); }
  table.stack:has(thead) td[data-label=""] { padding-left: 0; }
  table.stack:has(thead) td > a:first-child { min-height: 44px; display: inline-flex; align-items: center; margin-top: -8px; }
}
