:root {
  --ink: #192327;
  --muted: #657176;
  --line: #dfe5e3;
  --panel: rgba(255, 255, 255, .84);
  --green: #176f59;
  --green-deep: #0f5645;
  --green-pale: #e8f4ef;
  --red: #b44940;
  --amber: #a66a22;
  --shadow: 0 24px 70px rgba(24, 46, 40, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 85% 8%, rgba(217, 237, 225, .9), transparent 31rem),
    linear-gradient(135deg, #f4f1e9 0%, #f8faf7 54%, #eef4f0 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
}

.shell { width: min(1060px, calc(100% - 36px)); margin: 0 auto; padding: 68px 0 38px; }
.shell.with-nav { padding-top: 42px; }
.top-nav { position: sticky; top: 0; z-index: 10; height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(22px, calc((100vw - 1060px) / 2)); border-bottom: 1px solid rgba(216,226,222,.85); background: rgba(248,250,247,.86); backdrop-filter: blur(18px); }
.nav-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 14px; }
.nav-brand span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: white; background: var(--green); font: 700 16px Georgia, serif; }
.nav-links { display: flex; align-items: center; gap: 7px; }
.nav-links > a { padding: 8px 11px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; }
.nav-links > a:hover, .nav-links > a.active { color: var(--green); background: var(--green-pale); }
.nav-user { margin-left: 10px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.nav-links form { margin: 0; }
.nav-logout { border: 0; padding: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.nav-logout:hover { color: var(--red); }
.hero { display: flex; align-items: center; gap: 24px; margin-bottom: 34px; }
.brand-mark { width: 74px; height: 74px; flex: 0 0 74px; display: grid; place-items: center; border-radius: 21px; color: #fff; background: var(--green); box-shadow: 0 14px 30px rgba(23, 111, 89, .24); transform: rotate(-3deg); }
.brand-mark span { font: 700 34px Georgia, serif; transform: rotate(3deg); }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font: 600 clamp(30px, 4.5vw, 46px)/1.12 Georgia, "Songti SC", serif; letter-spacing: -.02em; }
.subtitle { margin: 9px 0 0; color: var(--muted); font-size: 15px; }

.panel { position: relative; padding: 34px; margin-bottom: 24px; border: 1px solid rgba(255,255,255,.95); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.panel-head > div:first-child { display: flex; align-items: center; gap: 13px; }
.panel h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.step { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: var(--green); background: var(--green-pale); font-size: 11px; font-weight: 800; }
.template-link, .download-results { color: var(--green); text-decoration: none; font-size: 13px; font-weight: 700; }
.template-link span { margin-left: 5px; }

.dropzone { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 28px; border: 1.5px dashed #a9bcb5; border-radius: 18px; background: rgba(245, 249, 246, .8); cursor: pointer; transition: .2s ease; text-align: center; }
.dropzone:hover, .dropzone.dragging { border-color: var(--green); background: #eff8f3; transform: translateY(-2px); }
.dropzone.selected { border-style: solid; border-color: #83a89c; background: #eff8f3; }
.upload-icon { width: 47px; height: 47px; display: grid; place-items: center; margin-bottom: 3px; border-radius: 50%; color: var(--green); background: white; box-shadow: 0 8px 20px rgba(21, 79, 63, .10); }
.upload-icon svg { width: 23px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 16px; }
.dropzone > span:last-child { color: var(--muted); font-size: 12px; }

.schema { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 17px 0; }
.schema div { position: relative; padding: 15px 15px 15px 48px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.7); }
.schema span { position: absolute; left: 14px; top: 16px; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; color: var(--green); background: var(--green-pale); font-size: 11px; font-weight: 800; }
.schema strong, .schema small { display: block; }
.schema strong { font-size: 13px; }
.schema small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.alert { margin: 14px 0; padding: 12px 14px; border-radius: 10px; color: #853a34; background: #fbecea; font-size: 13px; }
.primary-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 15px 20px; border: 0; border-radius: 13px; color: white; background: var(--green); cursor: pointer; font-weight: 750; font-size: 14px; box-shadow: 0 12px 24px rgba(23, 111, 89, .18); transition: .2s ease; }
.primary-button:hover:not(:disabled) { background: var(--green-deep); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary-button .arrow { font-size: 18px; }

.status-pill { padding: 8px 12px; border-radius: 20px; color: var(--green); background: var(--green-pale); font-size: 12px; font-weight: 750; }
.status-pill i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; }
.status-pill.running i { animation: pulse 1.2s infinite; }
.status-pill.failed { color: var(--red); background: #fbecea; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }
.progress-wrap { padding: 20px; border-radius: 15px; background: #f2f6f3; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 11px; color: var(--muted); font-size: 12px; }
.progress-copy strong { color: var(--ink); }
.progress-track { height: 8px; overflow: hidden; border-radius: 9px; background: #dce7e2; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #3d9479); transition: width .35s ease; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 28px; }
.metrics div { padding: 17px; border: 1px solid var(--line); border-radius: 14px; }
.metrics span, .metrics strong { display: block; }
.metrics span { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.metrics strong { font-size: 24px; }
.metrics .success strong { color: var(--green); }
.metrics .bound strong, .number-bound { color: var(--amber); }
.metrics .failed strong { color: var(--red); }
.metrics-four { grid-template-columns: repeat(4, 1fr); }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.table-toolbar p { margin: 0; font-size: 13px; font-weight: 750; }
.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 14px; color: var(--muted); background: #f4f7f5; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 13px 14px; border-top: 1px solid var(--line); }
.empty-row td { padding: 34px; color: var(--muted); text-align: center; }
.result-badge { display: inline-block; padding: 5px 8px; border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.result-badge.success { color: var(--green); background: var(--green-pale); }
.result-badge.already_bound { color: var(--amber); background: #fff3df; }
.result-badge.card_not_found, .result-badge.error { color: var(--red); background: #fbecea; }
.result-badge.completed, .result-badge.success { color: var(--green); background: var(--green-pale); }
.result-badge.pending, .result-badge.processing, .result-badge.running { color: #3d6681; background: #eaf2f7; }
.result-badge.failed, .result-badge.interrupted, .result-badge.request_error,
.result-badge.business_error, .result-badge.http_error, .result-badge.invalid_response,
.result-badge.unknown { color: var(--red); background: #fbecea; }
.number-success { color: var(--green); font-weight: 750; }
.number-failed { color: var(--red); font-weight: 750; }
footer { padding: 8px 0 20px; color: #7a8581; font-size: 11px; text-align: center; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; }
.auth-card { width: min(430px, 100%); padding: 38px; border: 1px solid rgba(255,255,255,.95); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-logo { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 15px; color: white; background: var(--green); font: 700 25px Georgia, serif; box-shadow: 0 12px 24px rgba(23,111,89,.2); }
.auth-card h1 { font-size: 32px; }
.auth-subtitle { margin: 10px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-form { display: grid; gap: 15px; }
.auth-form label { color: #44514d; font-size: 12px; font-weight: 750; }
.auth-form input, .auth-form select { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid #ced8d4; border-radius: 10px; outline: 0; color: var(--ink); background: rgba(255,255,255,.86); font: inherit; font-size: 14px; }
.auth-form input:focus, .auth-form select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,111,89,.1); }
.auth-note { margin: 17px 0 0; color: #87918e; font-size: 10px; text-align: center; }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title h1 { font-size: 38px; }
.primary-link { display: inline-block; padding: 11px 15px; border-radius: 10px; color: white; background: var(--green); text-decoration: none; font-size: 12px; font-weight: 750; }
.history-shell .panel { padding: 24px; }
.history-table td:first-child { white-space: nowrap; color: var(--muted); }
.history-table td a { color: var(--ink); font-weight: 700; text-decoration: none; }
.clickable-row { cursor: pointer; transition: background .15s; }
.clickable-row:hover { background: #f5f9f7; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state strong { font-size: 17px; }
.empty-state p { color: var(--muted); font-size: 12px; }
.detail-title { align-items: center; }
.detail-title h1 { margin-top: 10px; font-size: 30px; }
.back-link { color: var(--green); text-decoration: none; font-size: 12px; font-weight: 700; }
.history-metrics { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.users-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 20px; }
.users-grid .panel { margin: 0; }
.users-grid h2 { margin: 0 0 18px; }
.compact-panel { align-self: start; }
.form-note { margin: -7px 0 19px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.success-alert { margin: 14px 0; padding: 12px 14px; border-radius: 10px; color: var(--green-deep); background: var(--green-pale); font-size: 13px; }

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1060px); padding-top: 32px; }
  .hero { align-items: flex-start; }
  .brand-mark { width: 56px; height: 56px; flex-basis: 56px; border-radius: 16px; }
  .brand-mark span { font-size: 26px; }
  .subtitle { font-size: 13px; }
  .panel { padding: 21px; border-radius: 19px; }
  .panel-head { align-items: flex-start; }
  .schema { grid-template-columns: 1fr; }
  .metrics { gap: 7px; }
  .metrics-four, .history-metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div { padding: 12px; }
  .metrics strong { font-size: 20px; }
  .top-nav { padding: 0 12px; }
  .nav-brand { font-size: 0; }
  .nav-links { gap: 1px; }
  .nav-user { display: none; }
  .auth-card { padding: 27px 23px; }
  .page-title { align-items: flex-start; }
  .users-grid { grid-template-columns: 1fr; }
}
