/* IxA Onboarding Console. Dark first; [data-theme="light"] on <html> switches.
   Spacing is one 4px scale (--s1..--s8); type is one scale (--t-xs..--t-xl). */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;
  --t-xs: 11px; --t-sm: 12px; --t-md: 13px; --t-base: 14px; --t-lg: 16px; --t-xl: 24px;
  --radius: 10px; --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0c0e12; --surface: #14171d; --surface-2: #1b1f27; --line: #2a303b; --line-soft: #1f242d;
  --fg: #e8eaed; --fg-2: #c6cbd3; --muted: #9aa1ad;
  --accent: #7aa2ff; --accent-ink: #0b1020; --accent-soft: rgba(122, 162, 255, .14);
  --ok: #4cc98d; --ok-soft: rgba(76, 201, 141, .14);
  --warn: #e9b44c; --warn-soft: rgba(233, 180, 76, .14);
  --bad: #f2786e; --bad-soft: rgba(242, 120, 110, .14);
  --danger-bg: #c93d33; --danger-ink: #ffffff;
  --scrim: rgba(4, 6, 10, .62);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --focus: #9dbbff;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f0f2f5; --line: #dde1e7; --line-soft: #eaedf1;
  --fg: #14171c; --fg-2: #2e3440; --muted: #555c6b;
  --accent: #2f5bea; --accent-ink: #ffffff; --accent-soft: rgba(47, 91, 234, .10);
  --ok: #187a4a; --ok-soft: rgba(24, 122, 74, .10);
  --warn: #8a5a00; --warn-soft: rgba(154, 98, 0, .12);
  --bad: #b8322a; --bad-soft: rgba(184, 50, 42, .10);
  --danger-bg: #b8322a; --danger-ink: #ffffff;
  --scrim: rgba(20, 23, 28, .38);
  --shadow: 0 12px 32px rgba(20, 23, 28, .16);
  --focus: #2f5bea;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font); font-size: var(--t-base);
  line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
[tabindex="-1"]:focus { outline: none; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: var(--t-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px;
  padding: 0 var(--s4); border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 500; font-size: var(--t-md); white-space: nowrap; text-decoration: none; color: var(--fg);
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--danger-ink); font-weight: 600; }
.btn-danger:hover { background: var(--danger-bg); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn-sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); color: var(--fg); }
svg { flex: none; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); max-width: 1440px; margin: 0 auto; min-height: 56px; }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.app-name { font-weight: 650; font-size: var(--t-base); letter-spacing: -.01em; white-space: nowrap; min-width: 0; }
.user { margin-left: auto; display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.user-email { color: var(--fg-2); font-size: var(--t-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.chip { font-size: var(--t-xs); font-weight: 600; padding: 2px var(--s2); border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--s6); max-width: 1440px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); }
.rail { position: sticky; top: 80px; align-self: start; min-width: 0; display: flex; flex-direction: column; max-height: calc(100vh - 80px - var(--s4)); }
.content { min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.search { position: relative; display: block; margin-bottom: var(--s2); }
.search input { width: 100%; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); padding: 0 var(--s3) 0 34px; font-size: var(--t-md); }
.search input::placeholder { color: var(--muted); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.rail-label { font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: var(--s2) var(--s3) var(--s1); }
.brands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.brand-btn { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; min-height: 36px; }
.brand-btn:hover { background: var(--surface-2); }
.brand-btn[aria-current="true"] { background: var(--accent-soft); }
.brand-btn[aria-current="true"] .b-name { color: var(--fg); font-weight: 600; }
.b-name { color: var(--fg-2); font-size: var(--t-md); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Every brand lists its currencies on a line of their own under the name, so the list reads the same for one currency or five. */
.b-tags { display: flex; flex-wrap: wrap; gap: 3px; order: 1; flex-basis: 100%; }
.tag { font-size: 10px; font-weight: 600; letter-spacing: .03em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft); }
.tag-fiat { background: transparent; color: var(--fg-2); border: 1px solid var(--line); }
/* Each payment kind is a line: its tag, then the currencies it runs in. */
.b-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; flex-basis: 100%; }
/* The payment kind is a fixed-width label, not a tag, so the currencies after it line up and read as its list. */
.b-pay-label { width: 52px; flex: none; font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.b-pay-fiat { color: var(--fg-2); }
.b-pay-crypto { color: var(--accent); }
.tag-crypto { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.group-h .tag, .seg .tag, .type-opt .tag { margin-left: var(--s2); vertical-align: middle; }
.b-count { font-size: var(--t-sm); color: var(--muted); min-width: 20px; text-align: right; }
.rail-empty { color: var(--muted); font-size: var(--t-md); padding: var(--s2) var(--s3); }

/* brand header */
.bh { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); }
.bh > div:first-child { flex: 1 1 auto; min-width: 0; }
.bh > .btn { margin-top: var(--s1); }
.bh h1 { margin: 0; font-size: var(--t-xl); font-weight: 700; letter-spacing: -.02em; }
.bh h1 .title-id { margin-left: var(--s2); vertical-align: middle; font-weight: 400; letter-spacing: 0; }
.bh-sub { margin: var(--s1) 0 0; color: var(--fg-2); font-size: var(--t-md); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: var(--s4) 0 0; padding: 0; }
.fact { background: var(--surface); padding: var(--s3) var(--s4); min-width: 0; }
.fact dt { margin: 0 0 var(--s1); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); min-width: 0; }
.fact-v { color: var(--fg); font-weight: 600; font-size: var(--t-md); overflow-wrap: anywhere; }
.fact-id { color: var(--muted); font-size: var(--t-xs); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 6px; }
.fact-muted { color: var(--muted); font-style: italic; font-size: var(--t-md); }
.fact-warn { color: var(--warn); display: inline-flex; align-items: center; gap: 4px; font-weight: 500; font-size: var(--t-md); }
.fact-warn svg { align-self: center; }

/* tabs */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: transparent; padding: var(--s3) var(--s3); margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; cursor: pointer; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tab:hover { color: var(--fg-2); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab .n { font-size: var(--t-xs); padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* summary strip */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0; }
.sum { background: var(--surface); padding: var(--s3) var(--s4); }
.sum dt { font-size: var(--t-sm); color: var(--muted); }
.sum dd { margin: 2px 0 0; font-size: 20px; font-weight: 650; }
.sum dd small { font-size: var(--t-sm); color: var(--muted); font-weight: 500; margin-left: var(--s1); }
.sum dd.attn { color: var(--warn); }

/* alerts */
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.alert p { margin: 0; flex: 1 1 240px; font-size: var(--t-md); }
.alert b { display: block; font-size: var(--t-base); margin-bottom: 2px; }
.alert.warn { background: var(--warn-soft); border-color: transparent; }
.alert.bad { background: var(--bad-soft); border-color: transparent; }
.alert.ok { background: var(--ok-soft); border-color: transparent; }
.alert .ic { flex: none; align-self: flex-start; margin-top: 2px; }
.alert.warn .ic { color: var(--warn); } .alert.bad .ic { color: var(--bad); } .alert.ok .ic { color: var(--ok); }

/* project groups */
.market { display: flex; flex-direction: column; gap: var(--s3); }
.market-h { display: flex; align-items: center; gap: var(--s3); margin: 0; font-size: var(--t-sm); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sum-pay { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 400; color: var(--fg-2); margin-top: 2px; }
.market-h .b-pay-label { width: auto; font-size: var(--t-sm); }
.market-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.group-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft); }
.group-h h3 { margin: 0; font-size: var(--t-base); font-weight: 600; }
.group-h .meta { color: var(--muted); font-size: var(--t-sm); flex: 1 1 200px; min-width: 0; }
.group-note { margin: 0; padding: var(--s3) var(--s4); color: var(--muted); font-size: var(--t-sm); border-bottom: 1px solid var(--line-soft); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name state menu" "extra extra extra"; align-items: center; column-gap: var(--s3); padding: var(--s2) var(--s2) var(--s2) var(--s4); border-top: 1px solid var(--line-soft); position: relative; min-height: 56px; }
.rows .row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.p-main { grid-area: name; min-width: 0; }
.p-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-name.unknown { color: var(--muted); font-style: italic; font-weight: 400; }
.p-id { color: var(--muted); margin-top: 1px; }
.p-state { grid-area: state; }
.p-menu { grid-area: menu; position: relative; }
.p-extra { grid-area: extra; }
.p-extra:not(:empty) { padding: var(--s2) var(--s2) var(--s1) 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: var(--t-sm); font-weight: 500; white-space: nowrap; }
.pill svg { width: 12px; height: 12px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.info { background: var(--accent-soft); color: var(--accent); }

.menu { position: absolute; right: 0; top: 38px; z-index: 6; min-width: 232px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s1); }
.menu [role="menuitem"] { width: 100%; text-align: left; border: 0; background: transparent; padding: var(--s2) var(--s3); border-radius: 7px; cursor: pointer; display: flex; gap: var(--s2); align-items: center; color: var(--fg); text-decoration: none; font-size: var(--t-md); }
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible { background: var(--surface-2); }
.menu [role="menuitem"][aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.menu .danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s1) 0; }
.menu small { display: block; color: var(--muted); font-size: var(--t-xs); }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3); border-radius: 8px; background: var(--bad-soft); }
.confirm p { margin: 0; flex: 1 1 260px; font-size: var(--t-md); }
.inline-msg { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--t-md); padding: var(--s2) var(--s3); border-radius: 8px; }
.inline-msg.bad { background: var(--bad-soft); }
.inline-msg.ok { background: var(--ok-soft); }

/* status mapping */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 6px var(--s3); border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: var(--t-md); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 520px; }
caption { text-align: left; padding: var(--s3) var(--s4); font-size: var(--t-md); color: var(--muted); border-bottom: 1px solid var(--line); }
th { text-align: left; font-size: var(--t-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
td { padding: var(--s2) var(--s4); border-top: 1px solid var(--line-soft); font-size: var(--t-md); }
tbody tr:first-child td { border-top: 0; }
td.yes-no { color: var(--muted); }
.note { color: var(--muted); font-size: var(--t-sm); margin: 0; }

/* the status mapping editor */
.map-select { height: 34px; max-width: 100%; min-width: 220px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); padding: 0 var(--s2); font: inherit; font-size: var(--t-md); }
.switch { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); }
.content > .actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); justify-content: flex-end; }

/* empty and loading */
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: var(--s7) var(--s6); color: var(--muted); text-align: center; }
.empty b { color: var(--fg); display: block; font-size: var(--t-lg); margin-bottom: var(--s1); }
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line-soft) 50%, var(--surface-2) 100%); background-size: 200% 100%; border-radius: 6px; animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-line { height: 12px; margin: var(--s2) 0; }
.skel-brand { height: 32px; margin-bottom: 4px; }
.skel-title { height: 28px; width: 220px; }
.skel-card { height: 180px; border-radius: var(--radius); }

/* full-page states: sign in, no access, set-up problems */
.center { min-height: calc(100vh - 57px); display: grid; place-items: center; padding: var(--s6) var(--s4); }
.card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: var(--s7) var(--s6); display: flex; flex-direction: column; gap: var(--s4); }
.card h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--fg-2); }
.card .actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.card .big-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.card .big-ic.bad { background: var(--bad-soft); color: var(--bad); }
.card .big-ic.warn { background: var(--warn-soft); color: var(--warn); }
#clerk-sign-in:empty { display: none; }

/* side sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(480px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.sheet-h h2 { margin: 0; font-size: var(--t-lg); font-weight: 600; }
.sheet-b { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); overflow: auto; flex: 1; }
.sheet-f { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .field-label { font-size: var(--t-md); font-weight: 600; color: var(--fg-2); padding: 0; margin-bottom: var(--s2); }
.field { display: flex; flex-direction: column; }
.field input[type="url"] { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); padding: 0 var(--s3); width: 100%; font-size: var(--t-md); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.hint { color: var(--muted); font-size: var(--t-sm); margin-top: 6px; }
.hint.bad { color: var(--bad); }
.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.type-opt { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: 9px; border: 1px solid var(--line); cursor: pointer; background: var(--bg); }
.type-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.type-opt:has(input:disabled) { cursor: not-allowed; opacity: .6; }
.type-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.type-opt input { margin: 2px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.type-opt b { display: block; font-weight: 600; font-size: var(--t-md); }
.type-opt small { color: var(--muted); font-size: var(--t-sm); }
.sheet-result { display: flex; flex-direction: column; gap: var(--s3); }
.sheet-result:empty { display: none; }
.checks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.checks li { display: flex; gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--line-soft); font-size: var(--t-md); }
.checks li:first-child { border-top: 0; }
.mark-ic { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: -1px; }
.mark-ic svg { width: 12px; height: 12px; }
.mark-ic.y { background: var(--ok-soft); color: var(--ok); }
.mark-ic.n { background: var(--bad-soft); color: var(--bad); }
.mark-ic.w { background: var(--warn-soft); color: var(--warn); }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--s6); z-index: 50; display: flex; flex-direction: column; gap: var(--s2); width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--fg); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--radius); font-weight: 500; font-size: var(--t-md); box-shadow: var(--shadow); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding-top: var(--s4); }
  .rail { position: static; max-height: none; }
  .brands { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: var(--s1); padding-bottom: var(--s1); -webkit-overflow-scrolling: touch; }
  .brands li { flex: none; }
  .brand-btn { width: auto; white-space: nowrap; overflow: visible; border: 1px solid var(--line); background: var(--surface); }
  .brand-btn[aria-current="true"] { border-color: var(--accent); }
  .brand-btn { flex-wrap: nowrap; }
  /* A phone chip has room for the payment kinds only; the currencies are on the brand page. */
  .b-tags .tag { display: none; }
  .b-pay-label { width: auto; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
  .b-pay-crypto { background: var(--accent-soft); border-color: transparent; }
  .b-tags { order: 0; flex-basis: auto; }
  .b-pay { flex-basis: auto; }
  .rail-label { display: none; }
}
@media (max-width: 560px) {
  .user-email { display: none; }
  .app-name { white-space: normal; line-height: 1.25; }
  .summary, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .types { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name menu" "state state" "extra extra"; row-gap: var(--s1); padding-left: var(--s3); }
  .p-state { padding-bottom: var(--s1); }
  .group-h, .group-note { padding-left: var(--s3); padding-right: var(--s3); }
  .group-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title add" "meta meta"; row-gap: 2px; }
  .group-h h3 { grid-area: title; }
  .group-h .meta { grid-area: meta; }
  .group-h .btn { grid-area: add; }
  .bh { flex-wrap: wrap; }
  .bh .btn-primary { width: 100%; }
  .sheet-b { padding: var(--s4); }
  .sheet-h, .sheet-f { padding-left: var(--s4); padding-right: var(--s4); }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
}
@media (prefers-reduced-motion: reduce) {
  .skel, .spinner { animation: none; }
}

/* the status mapping tab: the sync overview (kept in one block, apart from the rest, so a rebase moves it whole) */
.map-counts { margin: var(--s3) 0 var(--s2); color: var(--fg-2); font-size: var(--t-base); }
.map-counts b { color: var(--fg); }
.map-warn { margin-bottom: var(--s2); }
.map-sync { min-width: 860px; }
.map-sync td { vertical-align: top; padding-top: var(--s3); padding-bottom: var(--s3); }
.map-sync .th-note { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.map-sync td .note { margin-top: var(--s1); }
.map-sync s { color: var(--muted); }
.map-pair { display: flex; align-items: center; gap: var(--s2); }
.map-pair .map-select { min-width: 0; flex: 1 1 180px; }
.map-pending td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.map-pending { background: var(--accent-soft); }
.map-link { white-space: nowrap; min-height: 34px; padding: 0 var(--s3); border: 1px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-size: var(--t-md); cursor: pointer; }
.map-link[aria-expanded="true"] { background: var(--accent-soft); }
.map-link:disabled { opacity: .5; cursor: not-allowed; }
.map-pick { list-style: none; margin: var(--s2) 0 0; padding: var(--s2); display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.map-pick li .btn { width: 100%; justify-content: flex-start; }
.map-pick-h { padding: var(--s1) var(--s2); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.map-bar { position: sticky; bottom: 0; z-index: 15; margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.map-bar-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.map-bar-top b { margin-right: auto; }
.map-bar-toggle { display: none; }
.map-bar-actions { display: flex; gap: var(--s2); }
.map-bar-list { list-style: none; margin: var(--s2) 0 0; padding: 0; max-height: 180px; overflow-y: auto; }
.map-bar-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s1) 0; border-top: 1px solid var(--line-soft); font-size: var(--t-md); }
@media (max-width: 560px) {
  .map-sync { min-width: 0; }
  .map-sync thead { display: none; }
  .map-sync, .map-sync tbody, .map-sync tr, .map-sync td, .map-sync caption { display: block; width: 100%; box-sizing: border-box; }
  .map-sync caption.sr-only { width: 1px; }
  .map-sync tr { padding: var(--s3) var(--s4); border-top: 1px solid var(--line-soft); }
  .map-sync tbody tr:first-child { border-top: 0; }
  .map-sync td { padding: 0; border: 0; }
  .map-sync td + td { margin-top: var(--s2); }
  .map-sync td:first-child { font-weight: 600; font-size: var(--t-base); }
  .map-sync td:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: var(--s1); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .map-sync td:last-child::before { content: none; }
  .map-pair { flex-direction: column; align-items: stretch; }
  .map-pair .map-select { flex: 0 0 auto; }
  .map-pair .map-select, .map-link { width: 100%; min-width: 0; }
  .map-pair .btn { width: 100%; border-color: var(--line); }
  .map-pending td:first-child { box-shadow: none; }
  .map-pending { box-shadow: inset 3px 0 0 var(--accent); }
  .map-bar { padding: var(--s3); }
  .map-bar-toggle { display: inline-flex; }
  .map-bar:not(.open) .map-bar-list { display: none; }
  .map-bar-top b { flex: 1 1 0; }
  .map-bar-actions { flex: 1 1 100%; }
  .map-bar-actions .btn { flex: 1 1 0; }
}

/* Add Ticket Type: the six-step sheet (one block, apart from the rest, so a rebase moves it whole) */
.bh-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-start; }
.sheet.wiz { width: min(760px, 100%); }
.wiz-step { margin: 2px 0 0; color: var(--muted); font-size: var(--t-md); }
.types.one { grid-template-columns: minmax(0, 1fr); }
.text-in, .map-select { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); padding: 0 var(--s3); width: 100%; font-size: var(--t-md); }
.text-in.short { max-width: 240px; }
.key-line { display: flex; gap: var(--s3); align-items: baseline; flex-wrap: wrap; }
.key-line .field-label { margin: 0; }
.tick { display: inline-flex; gap: var(--s2); align-items: center; white-space: nowrap; font-size: var(--t-md); }
.tick input { width: 16px; height: 16px; accent-color: var(--accent); }
.map-fields { width: 100%; min-width: 0; border-collapse: collapse; }
.map-fields th { text-align: left; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: var(--s2); border-bottom: 1px solid var(--line); }
.map-fields td { padding: var(--s2); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.map-fields .th-note { display: block; font-size: var(--t-xs); color: var(--muted); }
.review { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.review .rv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--line-soft); }
.review .rv:first-child { border-top: 0; }
.review dt { color: var(--muted); font-size: var(--t-md); }
.review dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .bh-actions { width: 100%; }
  .bh-actions .btn { flex: 1 1 100%; }
  .map-fields thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .map-fields, .map-fields tbody, .map-fields tr, .map-fields td { display: block; width: 100%; min-width: 0; }
  .map-fields tr { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); margin-bottom: var(--s2); }
  .map-fields td { border: 0; padding: var(--s1) var(--s2); }
  .map-fields td::before { content: attr(data-label); display: block; font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .review .rv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
