:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1d2939;
  background: #f5f6f8;
  font-synthesis: none;
  --blue: #215edb;
  --muted: #697586;
  --line: #e4e8ee;
  --green: #1c7552;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
main {
  max-width: 1120px;
  margin: auto;
  padding: 26px 32px 20px;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  transition: background-color 0.15s;
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #98baff;
  outline-offset: 4px;
}
input:focus-visible {
  outline: 3px solid #d0e0ff;
  border-color: var(--blue);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  color: var(--blue);
  font-size: 27px;
  font-weight: 760;
  letter-spacing: -1.2px;
  text-decoration: none;
}
.brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  border-left: 1px solid #d7dde5;
  padding-left: 15px;
  margin-left: 15px;
}
.service-state {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.service-state::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca6b4;
}
.service-state.ready::before {
  background: #27966b;
}
.service-state.offline::before {
  background: #b64e43;
}
.intro {
  padding: 42px 0 27px;
}
.eyebrow,
.step-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: #7c8898;
}
.eyebrow {
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(29px, 4vw, 43px);
  letter-spacing: -1.7px;
  line-height: 1.12;
  font-weight: 650;
  margin: 0 0 13px;
}
h1 span {
  color: var(--blue);
}
.intro > p:last-child {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
h2 {
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.6px;
  font-weight: 640;
  margin: 12px 0;
}
h3 {
  font-size: 17px;
  margin: 14px 0;
  letter-spacing: -0.2px;
}
p {
  line-height: 1.65;
}
.muted {
  font-size: 13px;
  color: var(--muted);
}
.hint {
  font-size: 11px;
  color: #7a8696;
  line-height: 1.65;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}
.work-panel,
.card-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}
.operation-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  gap: 14px;
}
.mode {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  padding: 19px 8px 16px;
  font-weight: 600;
}
.mode:hover {
  color: #283b55;
  background: #f9fafc;
}
.mode.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.operation-view {
  padding: 29px 28px 26px;
  min-height: 352px;
}
.operation-view > .muted {
  margin: 0 0 21px;
}
.primary,
.secondary,
.danger-outline {
  padding: 12px 17px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  min-height: 42px;
}
.primary {
  background: var(--blue);
  color: white;
}
.primary:hover {
  background: #164bb7;
}
.secondary {
  background: #f5f8fc;
  color: #354861;
  border-color: #dde4ee;
}
.secondary:hover {
  background: #eaf0f9;
}
.danger-outline {
  background: white;
  color: #a13b39;
  border-color: #e6bfbc;
}
.danger-outline:hover {
  background: #fff5f4;
}
.primary.danger {
  background: #ae4440;
}
.primary.danger:hover {
  background: #963630;
}
.text-button {
  background: none;
  border: 0;
  color: var(--blue);
  padding: 10px 3px;
  font-size: 12px;
  font-weight: 600;
}
.text-button:hover {
  text-decoration: underline;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
label {
  font-size: 12px;
  font-weight: 600;
  color: #455369;
  display: grid;
  gap: 9px;
}
input {
  width: 100%;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid #dbe1e9;
  border-radius: 7px;
  color: #243248;
  background: #fff;
  font-size: 12px;
}
input:disabled {
  background: #f5f6f8;
  color: var(--muted);
}
.presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.chip {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  padding: 6px 8px;
  color: #677487;
  font-size: 10px;
}
.chip:hover,
.chip.selected {
  background: #edf3ff;
  color: var(--blue);
  border-color: #b4c9f4;
}
.operation-view .hint {
  margin: 15px 0 20px;
}
.callout {
  border-left: 2px solid #b4c9f4;
  padding: 5px 0 5px 15px;
  font-size: 13px;
  color: #4e6078;
  margin: 26px 0;
}
.review-panel {
  border-top: 1px solid #dae5f6;
  background: #f6f9ff;
  padding: 22px 28px 25px;
}
.review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.review-panel h3 {
  margin: 14px 0;
}
.review-values,
.card-info {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 12px;
  font-size: 12px;
  margin: 18px 0;
}
dt {
  color: #7b8797;
}
dd {
  margin: 0;
  color: #344257;
  overflow-wrap: anywhere;
}
.review-values dd {
  font-weight: 550;
}
.review-actions {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-top: 17px;
}
.inline-error {
  color: #973d35;
  background: #fff5f2;
  border-top: 1px solid #f1d7ce;
  font-size: 12px;
  padding: 17px 28px;
  line-height: 1.6;
}
.card-panel {
  padding: 24px;
}
.card-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.small-badge {
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 5px;
  background: #f1f3f6;
  color: #697586;
}
.small-badge.valid {
  background: #edf7f0;
  color: var(--green);
}
.small-badge.expired {
  background: #fff2e8;
  color: #9a5720;
}
.physical-card {
  position: relative;
  aspect-ratio: 1.72;
  max-width: 310px;
  background: #204991;
  border-radius: 11px;
  margin: 23px auto 25px;
  color: white;
  padding: 18px 21px;
  overflow: hidden;
}
.physical-card::after {
  position: absolute;
  content: '';
  width: 200px;
  height: 200px;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  right: -80px;
  top: -105px;
}
.physical-brand {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.8px;
  color: #e8f0ff;
}
.physical-card svg {
  position: absolute;
  right: 22px;
  top: 24px;
  color: #a5c1ef;
}
.physical-card > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: absolute;
  bottom: 20px;
  left: 21px;
}
.physical-card small {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #b4c9ea;
}
.physical-card strong {
  font-size: 37px;
  font-weight: 500;
  letter-spacing: -1px;
}
.card-panel h2 {
  font-size: 20px;
  margin-bottom: 8px;
}
.card-panel .muted {
  font-size: 12px;
  margin-top: 0;
}
.card-info {
  grid-template-columns: 86px minmax(0, 1fr);
  padding-top: 17px;
  border-top: 1px solid var(--line);
  gap: 13px;
}
.proof {
  font-size: 11px;
  line-height: 1.6;
  color: var(--green);
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.proof::before {
  content: '✓';
  font-weight: 700;
}
.card-buttons {
  display: grid;
  gap: 3px;
  margin-top: 20px;
}
.card-buttons .text-button {
  text-align: left;
}
.result-message {
  border-top: 1px solid #dbeadd;
  margin: 16px 0 0;
  padding: 14px 0 0;
  font-size: 12px;
  color: var(--green);
  line-height: 1.65;
}
.banner {
  font-size: 12px;
  padding: 13px 17px;
  border-radius: 8px;
  margin-bottom: 18px;
  line-height: 1.6;
}
.banner.error {
  color: #973d35;
  background: #fff0ea;
  border: 1px solid #efd7cd;
}
.banner.busy {
  background: #e9f1ff;
  color: #2d568d;
  border: 1px solid #d4e2fb;
}
.utility-section {
  border-bottom: 1px solid #dfe4ec;
  margin-top: 17px;
  padding: 0 3px;
}
.utility-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.utility-section summary::before {
  content: '+';
  color: #7f8fa5;
  font-size: 17px;
  font-weight: 400;
}
.utility-section[open] summary::before {
  content: '−';
}
.utility-section summary > span:first-child {
  margin-right: auto;
}
.utility-summary {
  color: #8190a3;
  font-size: 11px;
  font-weight: 400;
  text-align: right;
}
.setup-content {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 35px;
  padding: 0 0 25px;
}
.setup-content h3 {
  font-size: 15px;
}
.setup-content .card-info {
  border: 0;
  padding-top: 0;
}
.setup-content form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.setup-content label {
  flex: 1;
  min-width: 180px;
}
.setup-content .secondary {
  height: 39px;
  min-height: 39px;
  font-size: 11px;
}
.setup-content .muted {
  font-size: 12px;
}
.activity-actions {
  display: flex;
  gap: 15px;
}
#log {
  font:
    11px/1.8 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 230px;
  overflow: auto;
  color: #63748b;
  padding: 6px 0 16px;
}
.activity-actions .text-button {
  font-size: 11px;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 7px;
  font-size: 10px;
  color: #8b96a6;
}
@media (max-width: 820px) {
  main {
    padding: 22px 22px 16px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .card-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 26px;
  }
  .card-panel-heading,
  .card-panel .physical-card {
    grid-column: 1;
    grid-row: auto;
  }
  .card-panel-heading {
    grid-row: 1;
  }
  .card-panel .physical-card {
    grid-row: 2 / span 4;
    width: 100%;
    margin: 20px 0;
  }
  .card-panel h2 {
    grid-column: 2;
    grid-row: 1;
  }
  .card-panel #card-caption {
    grid-column: 2;
    grid-row: 2;
  }
  .card-panel #card-info,
  .card-panel #card-proof,
  .card-panel .card-buttons,
  .card-panel #write-result {
    grid-column: 2;
  }
  .intro {
    padding-top: 33px;
  }
  .operation-view {
    min-height: 0;
  }
  .setup-content {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  footer {
    flex-wrap: wrap;
  }
}
@media (max-width: 520px) {
  main {
    padding: 20px 15px;
  }
  .brand span {
    font-size: 11px;
    margin-left: 9px;
    padding-left: 9px;
  }
  .service-state {
    font-size: 10px;
    max-width: 130px;
  }
  .intro {
    padding: 29px 0 23px;
  }
  h1 {
    font-size: 31px;
  }
  .intro > p:last-child {
    font-size: 12px;
  }
  .operation-nav {
    padding: 0 13px;
    gap: 9px;
  }
  .mode {
    font-size: 11px;
    padding-left: 5px;
    padding-right: 5px;
  }
  .operation-view,
  .review-panel {
    padding: 24px 21px;
  }
  .date-grid {
    grid-template-columns: 1fr;
  }
  .card-panel {
    display: block;
    padding: 22px;
  }
  .card-panel .physical-card {
    max-width: 270px;
    margin: 20px auto;
  }
  .utility-summary {
    max-width: 180px;
  }
  .review-values {
    grid-template-columns: 85px minmax(0, 1fr);
  }
  .review-top {
    flex-wrap: wrap;
  }
  footer {
    font-size: 9px;
  }
  .chip {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}
.transport-switch {
  margin: 16px 0 0;
  text-align: right;
  font-size: 11px;
}
.transport-switch a {
  color: #617796;
  text-decoration: none;
}
.transport-switch a:hover {
  text-decoration: underline;
}
.browser-connection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border: 1px solid #d8e4f6;
  background: #eef4ff;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
.browser-connection strong {
  font-size: 13px;
  color: #355788;
}
.browser-connection .hint {
  margin: 7px 0 0;
  max-width: 570px;
}
.browser-connect-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 820px) {
  .browser-connection {
    align-items: flex-start;
    flex-direction: column;
  }
  .browser-connect-actions {
    flex-wrap: wrap;
  }
}
