:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-soft: #ecfdf5;
  --accent-line: #99f6e4;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px 72px; }

/* ---------- header ---------- */
header.top { padding: 34px 0 22px; }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(140deg, var(--accent) 0%, #115e59 100%);
  display: grid; place-items: center; flex: 0 0 auto;
}
.brand-mark svg { width: 21px; height: 21px; }
h1 { font-size: 22px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; font-weight: 650; }
.sub { color: var(--muted); font-size: 13px; margin: 3px 0 0; }

.lang-switch {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; gap: 2px; flex: 0 0 auto;
}
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 4px 11px; border-radius: 999px; cursor: pointer; font-weight: 500;
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- tabs ---------- */
nav.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 22px; overflow-x: auto; scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 14px;
  color: var(--muted); padding: 11px 15px 12px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
nav.tabs button:hover { color: var(--ink-2); }
nav.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- cards ---------- */
.panel[hidden] { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px;
}
.card + .card { margin-top: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
h2 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -0.005em; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.card-head .hint { margin: 0; }

/* ---------- form ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.full { grid-column: 1 / -1; }

label.f { display: block; }
label.f > span.lbl {
  display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; margin-bottom: 6px;
}
label.f > span.lbl small { color: var(--muted); font-weight: 400; }

input[type="text"], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 11px; min-height: 38px; transition: border-color .12s, box-shadow .12s;
}
input[type="text"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(13,148,136,.13);
}
input.mono, textarea.mono { font-family: var(--mono); font-size: 13.5px; letter-spacing: .04em; }
textarea { resize: vertical; line-height: 1.7; }
select { cursor: pointer; }
input::placeholder, textarea::placeholder { color: #98a2b3; }

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

button.btn {
  appearance: none; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
  border-radius: 8px; padding: 9px 18px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); transition: background .12s, border-color .12s, transform .04s;
}
button.btn:hover { background: var(--surface-2); }
button.btn:active { transform: translateY(1px); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.primary:hover { background: #0b5f59; border-color: #0b5f59; }
button.btn.ghost { border-color: transparent; color: var(--muted); padding: 9px 12px; }
button.btn.ghost:hover { background: var(--surface-2); color: var(--ink-2); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- mrz output ---------- */
.mrz-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 14px; overflow-x: auto;
}
.mrz-line {
  font-family: var(--mono); font-size: 15px; letter-spacing: .12em; white-space: pre;
  color: var(--ink); line-height: 2.1;
}
.mrz-line + .mrz-line { border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 2px; }
.mrz-line .cd {
  background: var(--accent-soft); color: var(--accent); border-radius: 3px;
  box-shadow: inset 0 -2px 0 var(--accent-line); font-weight: 600;
}
.legend {
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 12px;
}
.legend .swatch {
  display: inline-block; width: 16px; height: 13px; border-radius: 3px;
  background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent-line);
}
.meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 10px; font-family: var(--mono); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--mono); letter-spacing: .06em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { min-width: 520px; }

.steps-table td { padding: 5px 9px; font-family: var(--mono); font-size: 13px; }
.steps-table th { padding: 6px 9px; }
.steps-table td.ch { font-weight: 600; }
.sum-line {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 14px; padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px;
}
.sum-line .k { color: var(--muted); font-size: 12.5px; }
.sum-line .v { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: .06em; }
.sum-line .v.accent { color: var(--accent); }

/* ---------- badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: #f2f4f7; color: var(--ink-2); }

.status-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent;
}
.status-bar.ok { background: var(--ok-soft); border-color: #abefc6; color: var(--ok); }
.status-bar.bad { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
.status-bar.warn { background: var(--warn-soft); border-color: #fedf89; color: var(--warn); }
.status-bar.neutral { background: #f2f4f7; border-color: var(--line); color: var(--ink-2); }
.status-bar strong { font-weight: 650; }

.issues { margin: 14px 0 0; padding: 0; list-style: none; }
.issues li {
  font-size: 13px; color: var(--danger); padding: 7px 12px; background: var(--danger-soft);
  border: 1px solid #fecdca; border-radius: 8px; margin-bottom: 6px;
}
.issues li.warn { color: var(--warn); background: var(--warn-soft); border-color: #fedf89; }

footer.foot {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
footer.foot .note { max-width: 620px; }

.empty { color: var(--muted); font-size: 13px; padding: 22px 0; text-align: center; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); }

@media (max-width: 720px) {
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .wrap { padding: 0 14px 56px; }
  header.top { padding: 22px 0 16px; }
  h1 { font-size: 19px; }
  .card { padding: 16px; }
  .mrz-line { font-size: 11.5px; letter-spacing: .02em; }
  .top-row { flex-direction: column; gap: 12px; }
}

.status-bar .fmt {
  font-family: var(--mono); font-size: 12px; padding-left: 10px; margin-left: 2px;
  border-left: 1px solid currentColor; opacity: .75;
}
