:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c1c1c;
  background: #f5f5f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

button, textarea { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 40px auto;
}

.page-header { margin-bottom: 18px; }
.page-header h1 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 650; }


.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  background: #fff;
  border: 1px solid #dedede;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.section-head h2 { margin: 0; font-size: 1rem; }
.muted { color: #6a6a6a; }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 210px;
  padding: 12px;
  border: 1px solid #cfcfcf;
  border-radius: 7px;
  background: #fff;
  color: inherit;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

textarea:focus, button:focus-visible, .table-wrap:focus-visible {
  outline: 2px solid #2869c7;
  outline-offset: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-actions { justify-content: flex-end; margin-top: 12px; }

button {
  border: 1px solid #c9c9c9;
  border-radius: 7px;
  padding: 7px 11px;
  background: #fff;
  color: #222;
  cursor: pointer;
}

button:hover { background: #f1f1f1; }
button.primary { border-color: #225fae; background: #225fae; color: #fff; }
button.primary:hover { background: #174f98; }
button:disabled { opacity: .55; cursor: default; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #e8e8e8;
  text-align: left;
  vertical-align: middle;
}

th { font-size: .86rem; color: #555; background: #fafafa; }

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.copy-button {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: currentColor;
}

.copy-button:hover { background: rgba(127, 127, 127, .12); }

.copy-icon {
  position: absolute;
  inset: 0;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.copy-icon::before { left: 6px; top: 5px; opacity: .7; }
.copy-icon::after { left: 9px; top: 8px; background: inherit; }

.copy-button.copied .copy-icon::before {
  content: "✓";
  left: 4px;
  top: 0;
  width: 16px;
  height: 24px;
  border: 0;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  opacity: 1;
}

.copy-button.copied .copy-icon::after { display: none; }

tbody tr:last-child td { border-bottom: 0; }
th:nth-child(1), td:nth-child(1) { width: 58px; text-align: right; }
th:nth-child(2), td:nth-child(2) { width: 220px; }
th:nth-child(3), td:nth-child(3) { width: 220px; }
th:nth-child(4), td:nth-child(4) { width: 100px; }
th:nth-child(5), td:nth-child(5) { width: 110px; }
th:nth-child(6), td:nth-child(6) { width: 100px; }
th:nth-child(7), td:nth-child(7) { width: 80px; }

.pan {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.issuer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  margin-left: 7px;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: .72rem;
  line-height: 1.4;
  color: #5c5c5c;
  vertical-align: 1px;
}

.luhn-pass { color: #147a35; }
.luhn-fail, .format-error { color: #b32828; }

.message { min-height: 1.3em; margin: 10px 0 0; font-size: .9rem; }
.notes { color: #666; font-size: .86rem; line-height: 1.55; }
.notes p { margin: 4px 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-color-scheme: dark) {
  :root { color: #e7e7e7; background: #151515; }
  .panel, textarea, button { background: #1e1e1e; color: #e7e7e7; border-color: #3c3c3c; }
  th { color: #c9c9c9; background: #252525; }
  th, td { border-bottom-color: #353535; }
  .table-wrap { border-color: #3a3a3a; }
  button:hover { background: #292929; }
  button.primary { background: #3978cb; border-color: #3978cb; color: #fff; }
  button.primary:hover { background: #4a86d5; }
  .muted, .notes { color: #aaa; }
  .badge { color: #bbb; border-color: #555; }
  .luhn-pass { color: #6fd38b; }
  .luhn-fail, .format-error { color: #ff8686; }
}
