:root {
  --bg: #f5f5f7;
  --panel: #fff;
  --line: #e5e5ea;
  --ink: #1d1d1f;
  --muted: #86868b;
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
h1, h2, h3, p { margin: 0; }
svg { width: 14px; height: 14px; fill: currentColor; flex: none; }

.bar {
  height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 24px;
  background: rgba(255, 255, 255, .8); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; width: 248px; }
.brand img { height: 18px; }
.brand span { padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.tools { display: flex; gap: 8px; flex: 1; }
.tools button, .dialog-actions button, .ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 500;
}
.tools .primary, .dialog-actions .primary { background: #000; border-color: #000; color: #fff; }
.right { display: flex; align-items: center; gap: 8px; }
.icon { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; display: grid; place-items: center; color: var(--muted); }
.icon:hover { background: var(--line); }
.icon svg { width: 20px; height: 20px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-weight: 500;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .2); }
.dot.warn { background: var(--orange); }

.layout { flex: 1; display: flex; min-height: 0; }
.side { width: 320px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.picker { display: flex; gap: 4px; align-items: center; }
.picker select {
  flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); font: inherit; font-weight: 600;
}
#search { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--bg); font: inherit; outline: none; }
#search:focus { box-shadow: 0 0 0 3px rgba(0, 122, 255, .25); }
#tree { flex: 1; overflow: auto; padding: 4px 8px 12px; min-height: 0; }
.group > button {
  width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left;
  padding: 10px 8px 6px; color: var(--muted);
}
.group > button svg { transition: transform .2s; }
.group.closed > button svg { transform: rotate(-90deg); }
.group.closed .tests { display: none; }
.gname { display: flex; flex-direction: column; min-width: 0; }
.gname b { color: var(--ink); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gname small { font-size: 11px; }
.chip { flex: none; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; color: #fff; background: var(--muted); letter-spacing: .02em; }
.chip.visa { background: #1a1f71; }
.chip.mastercard { background: #eb001b; }
.chip.amex { background: #2e77bc; }
.chip.discover { background: #ff6000; }
.chip.jcb { background: #0b8a3e; }
.chip.unionpay { background: #d10429; }
.hint { color: var(--muted); font-size: 12px; padding: 6px 10px 10px 30px; }
.test {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left;
  padding: 7px 10px 7px 30px; border-radius: 8px;
}
.test:hover { background: var(--bg); }
.test.on { background: #000; color: #fff; }
.test.on .tid { color: rgba(255, 255, 255, .75); }
.tid { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.test .name { display: flex; flex-direction: column; min-width: 0; }
.test .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.auth { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--grouped, #f2f2f7); padding: 24px; }
.auth[hidden] { display: none; } /* a class rule beats the [hidden] default, so hide it back explicitly */
.auth-card { width: 340px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.08); }
.auth-logo { height: 22px; align-self: flex-start; }
.auth-card h1 { font-size: 22px; margin: 4px 0 0; }
.auth-card .muted { color: var(--muted); margin: 0 0 4px; font-size: 14px; }
.auth-card input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.auth-card input:focus { outline: none; border-color: #000; }
.btn { padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; font-size: 15px; }
.btn.primary { background: #000; border-color: #000; color: #fff; }
.auth-card .link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.auth-card .ok { color: var(--green); font-size: 13px; }
.auth-card .error { color: var(--red); font-size: 13px; }
.acct-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.req { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line2, #f0f0f2); }
.req span:first-child { display: flex; flex-direction: column; }
.req small { color: var(--muted); }
.req-act { display: flex; gap: 6px; }
button.small { padding: 5px 12px; border-radius: 8px; border: 1px solid #000; background: #000; color: #fff; font-weight: 500; cursor: pointer; font-size: 13px; }
button.small.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
#account.pill { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 0; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.card-tile { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.card-tile.on { border-color: #000; box-shadow: 0 0 0 1px #000; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-top .loaded { font-size: 11px; font-weight: 600; color: var(--green); }
.card-label { font-weight: 600; font-size: 15px; }
.card-pan { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--ink); }
.card-meta { font-size: 11px; color: var(--muted); }
.card-actions { margin-top: 8px; }
.card-actions button { width: 100%; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 500; cursor: pointer; }
.card-actions button.primary { background: #000; border-color: #000; color: #fff; }
.card-actions button:disabled { opacity: .4; cursor: default; }
.mark-result { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--line); }
.mark-result.pass { background: var(--green); }
.mark-result.fail { background: var(--red); }
.mark-result.inconclusive { background: var(--orange); }
.mark-result.fime { background: none; border: 1.5px solid; }
.mark-result.fime.pass { color: var(--green); }
.mark-result.fime.fail { color: var(--red); }
.mark-result.fime.inconclusive { color: var(--orange); }
.test.on .mark-result.fime { color: #fff; }
.views { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.views button { border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.views button.on { background: var(--bg); }

#main { flex: 1; display: flex; min-width: 0; overflow: hidden; }
.detail { flex: 1; overflow: auto; padding: 32px 40px; min-width: 0; }
.detail .head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.detail h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; flex: 1; font-family: var(--mono); overflow-wrap: anywhere; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.detail .title { font-size: 16px; max-width: 760px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.tags span { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.sec { margin-top: 18px; }
.sec > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary svg { transition: transform .2s; transform: rotate(-90deg); }
.sec[open] > summary svg { transform: none; }
.sec-body { padding-top: 6px; }
.text { white-space: pre-line; max-width: 760px; }
.muted { color: var(--muted); margin-top: 10px; }
.counts { margin-left: auto; display: flex; gap: 6px; text-transform: none; letter-spacing: 0; }
.counts i { font-style: normal; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line); }
.counts .pass { background: rgba(52, 199, 89, .15); color: #248a3d; }
.counts .fail { background: rgba(255, 59, 48, .12); color: #d70015; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card-image { display: grid; grid-template-columns: repeat(4, 1fr); }
.card-image div { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.card-image div:nth-child(4n) { border-right: 0; }
.card-image div:nth-last-child(-n+4) { border-bottom: 0; }
.card-image dt { font-size: 11px; color: var(--muted); }
.card-image dd { margin: 2px 0 0; font-weight: 500; }
.steps { margin: 0; padding: 12px 16px 12px 36px; }
.steps li { padding: 4px 0; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .row { display: flex; align-items: flex-start; gap: 10px; }
.checks .no { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 1px; min-width: 26px; }
.checks .text { flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.meta i { font-style: normal; font-size: 11px; color: var(--muted); padding: 1px 7px; border-radius: 9px; background: var(--bg); }
.meta .fime.pass { color: #248a3d; }
.meta .fime.fail { color: #d70015; }
.meta .why { background: rgba(255, 149, 0, .12); color: #c93400; }
.steps-detail { margin: 4px 0 0 66px; }
.steps-detail summary { font-size: 12px; color: var(--blue); cursor: pointer; width: max-content; }
.rule { margin-top: 6px; padding: 8px 12px; border-radius: 8px; background: var(--bg); font-size: 12px; border-left: 3px solid var(--line); }
.rule > div { display: flex; gap: 10px; padding: 2px 0; }
.rule span { flex: none; width: 44px; color: var(--muted); }
.rule code { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.rule.yes { border-left-color: var(--green); }
.rule.no { border-left-color: var(--red); }
.rule.skip { opacity: .45; }
.state { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; background: var(--line); flex: none; }
.state.pass { background: var(--green); }
.state.fail { background: var(--red); }
.state.pending { background: none; border: 2px solid var(--line); }
.state.na { background: var(--orange); }
.choice { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.choice button { border: 0; background: var(--panel); padding: 4px 12px; font-weight: 600; color: var(--muted); }
.choice button + button { border-left: 1px solid var(--line); }
.choice button.pass.on { background: var(--green); color: #fff; }
.choice button.fail.on { background: var(--red); color: #fff; }
.choice button.skip.on { background: var(--muted); color: #fff; }

.verdict { padding: 6px 14px; border-radius: 16px; font-weight: 700; font-size: 13px; letter-spacing: .03em; background: var(--line); color: var(--muted); }
.verdict.pass { background: rgba(52, 199, 89, .15); color: #248a3d; }
.verdict.fail { background: rgba(255, 59, 48, .12); color: #d70015; }
.verdict.inconclusive { background: rgba(255, 149, 0, .15); color: #c93400; }
.verdict.ghosted { background: none; border: 1px solid currentColor; font-weight: 600; font-size: 12px; padding: 4px 10px; }

.exec { width: 440px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.banner { padding: 24px; border-bottom: 1px solid var(--line); }
.banner .title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.banner .sub { color: var(--muted); margin-top: 4px; }
.banner.running .title { color: var(--blue); }
.banner.pass .title { color: #248a3d; }
.banner.fail .title { color: #d70015; }
.leds { display: flex; gap: 20px; margin-top: 18px; }
.led { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.led i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.led i.green { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 199, 89, .2); }
.led i.blue { background: var(--blue); box-shadow: 0 0 0 4px rgba(0, 122, 255, .2); }
.led i.red { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 59, 48, .2); }
.led i.blink { animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .35; } }
.logbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.logbar span { display: flex; gap: 4px; flex: none; }
.logbar button { border: 0; background: none; color: var(--blue); font-weight: 500; text-transform: none; letter-spacing: 0; }
.log { flex: 1; overflow: auto; padding: 0 12px 24px; }
.entry { padding: 9px 12px; border-radius: 8px; }
.entry:hover, .entry[open] { background: var(--bg); }
.entry .step { font-weight: 500; display: flex; justify-content: space-between; gap: 12px; }
summary.step { list-style: none; cursor: pointer; }
summary.step::-webkit-details-marker { display: none; }
summary.step > span:first-child { display: flex; align-items: center; gap: 6px; }
summary.step svg { width: 12px; height: 12px; color: var(--muted); transform: rotate(-90deg); transition: transform .2s; }
.entry[open] summary.step svg { transform: none; }
.entry .hex span { display: inline-block; width: 52px; font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 600; }
.tlv { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); font-size: 11px; }
.tlv li { padding: 2px 0; }
.tlv .tag { font-family: var(--mono); font-weight: 600; margin-right: 6px; }
.tlv .tname { color: var(--muted); margin-right: 6px; }
.tlv .tval { font-family: var(--mono); word-break: break-all; }
.tlv em { color: var(--muted); }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; white-space: pre-line; transition: .25s;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .2); max-width: 560px;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #d70015; }
.entry .time { color: var(--muted); font-size: 11px; font-family: var(--mono); font-weight: 400; }
.entry .hex { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 3px; }
.entry .hex b { color: var(--ink); font-weight: 500; }
.entry.tap .step { color: var(--blue); }
.entry.bad .step { color: var(--red); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

.reports { flex: 1; overflow: auto; padding: 32px 40px; }
.reports h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td button { border: 0; background: none; color: var(--blue); font-weight: 500; }

@media (max-width: 1280px) {
  .side { width: 280px; }
  .brand { width: 248px; }
  .exec { width: 340px; }
  .detail h1 { font-size: 22px; }
  .detail { padding: 24px 28px; }
  .card-image { grid-template-columns: repeat(2, 1fr); }
  .card-image div:nth-child(4n) { border-right: 1px solid var(--line); }
  .card-image div:nth-child(2n) { border-right: 0; }
  .card-image div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .card-image div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 1080px) {
  .side { width: 250px; }
  .brand { width: auto; }
  .exec { width: 290px; }
  .detail { padding: 20px; }
  .tools button { padding: 0 10px; }
}

dialog { border: 0; border-radius: 14px; padding: 0; width: 520px; box-shadow: 0 24px 80px rgba(0, 0, 0, .25); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .25); backdrop-filter: blur(4px); }
.dialog-body { padding: 28px; }
.dialog-body h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.dialog-body > p { color: var(--muted); margin-bottom: 20px; }
.qr { display: block; width: 180px; height: 180px; margin: 12px auto; border-radius: 12px; background: #fff; padding: 8px; }
.code { font: 600 40px/1 var(--mono); letter-spacing: .2em; text-align: center; padding: 20px; background: var(--bg); border-radius: 12px; margin-bottom: 20px; }
.rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; }
.rows > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows span { color: var(--muted); }
.rows b { font-family: var(--mono); font-weight: 500; }
.rows input[type=text], .rows input[type=number] { width: 140px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; text-align: right; }
.rows label { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 9px; margin-bottom: 20px; }
.tabs button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 7px; font-weight: 500; }
.tabs button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.note { color: var(--muted); font-size: 12px; margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--bg); }
