:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-2: #e9eef7;
  --surface: rgba(255, 255, 255, .9);
  --surface-strong: #ffffff;
  --surface-soft: rgba(15, 23, 42, .045);
  --line: rgba(15, 23, 42, .12);
  --line-strong: rgba(124, 58, 237, .26);
  --text: #101827;
  --muted: #526071;
  --subtle: #707b8c;
  --accent: #d97706;
  --accent-2: #7c3aed;
  --accent-3: #0f766e;
  --danger: #be123c;
  --success: #047857;
  --warn: #b45309;
  --ink: #111827;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(15, 23, 42, .12);
  --focus: 0 0 0 3px rgba(217, 119, 6, .22);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(217, 119, 6, .14) 0 12%, transparent 12% 100%),
    linear-gradient(155deg, rgba(124, 58, 237, .12) 0 34%, transparent 34% 100%),
    linear-gradient(160deg, #f9fbff, var(--bg) 46%, #eef4f6);
  color: var(--text);
  font-family: "IBM Plex Sans", Inter, "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(15, 23, 42, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent 78%);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
  flex: 0 0 auto;
}

.app-shell,
.admin-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.app-shell {
  padding: 22px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  margin-bottom: 30px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 16px 46px rgba(15, 23, 42, .1);
  backdrop-filter: blur(18px);
}

.brand,
.admin-link,
.secondary,
.link-btn {
  text-decoration: none;
}

.brand,
.admin-link,
.secondary,
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 12px 30px rgba(124, 58, 237, .22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.15;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  align-items: end;
  gap: 30px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(34px, 6vw, 72px);
  line-height: .96;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.admin-page h1 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.04;
}

.lead {
  max-width: 640px;
  margin: 18px 0 0;
  color: #334155;
  font-size: 17px;
  line-height: 1.75;
}

.signal-strip {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
}

.signal-strip span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: rgba(248, 250, 252, .92);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.signal-strip svg {
  color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr);
  gap: 18px;
  align-items: start;
}

.panel,
.login-panel,
.band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel,
.login-panel,
.band {
  padding: 24px;
}

.panel-head,
.mast,
.admin-head,
.table-head,
.head-actions,
.quota-row,
.result-row {
  display: flex;
  align-items: center;
}

.panel-head,
.mast,
.admin-head,
.table-head {
  justify-content: space-between;
  gap: 16px;
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, .24);
  border-radius: 999px;
  background: rgba(240, 253, 250, .9);
  color: #115e59;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.muted-badge {
  border-color: rgba(124, 58, 237, .24);
  background: rgba(245, 243, 255, .9);
  color: #5b21b6;
}

.field-grid {
  display: grid;
  gap: 18px;
  margin: 24px 0 0;
}

.field {
  display: grid;
  gap: 9px;
}

.field-label,
.field > span {
  color: #1f2937;
  font-size: 14px;
  font-weight: 800;
}

.field-label small {
  margin-left: 7px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.help,
.muted,
.row small {
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, .14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  color: var(--text);
  outline: none;
  padding: 13px 14px;
  transition: border-color .18s ease-out, box-shadow .18s ease-out, background .18s ease-out;
}

textarea {
  min-height: 226px;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #253244;
}

.compact-textarea {
  min-height: 96px;
}

input::placeholder,
textarea::placeholder {
  color: #8792a2;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.quota-row {
  gap: 10px;
}

.quota-row input {
  min-width: 0;
}

.quota {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 48px;
  border: 1px solid rgba(217, 119, 6, .34);
  border-radius: var(--radius);
  background: rgba(254, 243, 199, .72);
  color: #92400e;
  padding: 0 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quota.err,
.form-error,
.row-error {
  color: var(--danger);
}

.primary,
.secondary,
.admin-link {
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  min-height: 46px;
  gap: 9px;
  padding: 0 16px;
  transition: border-color .18s ease-out, background .18s ease-out, color .18s ease-out, box-shadow .18s ease-out;
}

.primary {
  width: 100%;
  margin-top: 20px;
  border: 1px solid rgba(124, 58, 237, .16);
  background: linear-gradient(135deg, var(--accent), #fcd34d 52%, var(--accent-2));
  color: #151009;
  box-shadow: 0 18px 34px rgba(217, 119, 6, .18);
}

.primary:hover:not(:disabled) {
  box-shadow: 0 20px 42px rgba(124, 58, 237, .18);
}

.secondary,
.admin-link {
  border: 1px solid rgba(15, 23, 42, .12);
  background: rgba(255, 255, 255, .7);
  color: var(--text);
}

.secondary:hover:not(:disabled),
.admin-link:hover {
  border-color: rgba(217, 119, 6, .38);
  background: rgba(254, 243, 199, .55);
}

button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.spin {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(17, 24, 39, .28);
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.primary.loading {
  gap: 10px;
}

.primary.loading .spin {
  display: inline-block;
}

.primary.loading .button-icon {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.steps {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.steps:empty::before {
  display: grid;
  place-items: center;
  min-height: 138px;
  border: 1px dashed rgba(15, 23, 42, .2);
  border-radius: var(--radius);
  background: rgba(248, 250, 252, .72);
  color: var(--muted);
  content: "等待提交后显示处理进度";
  text-align: center;
}

.step {
  display: grid;
  grid-template-columns: minmax(148px, auto) 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .76);
  color: #334155;
  padding: 11px 12px;
}

.time,
.elapsed,
.countdown,
.qrno {
  font-variant-numeric: tabular-nums;
}

.time {
  color: #92400e;
}

.elapsed {
  color: var(--muted);
}

.result {
  display: none;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.result.show {
  display: grid;
  gap: 16px;
}

.result-row {
  gap: 10px;
}

.result-row input {
  flex: 1;
  min-width: 0;
}

.qr-stage {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(124, 58, 237, .08), rgba(15, 118, 110, .06)),
    rgba(248, 250, 252, .9);
}

.countdown,
.qrno,
.qr {
  text-align: center;
}

.countdown {
  min-height: 28px;
  color: #334155;
  font-weight: 800;
}

.countdown .cd-time {
  color: #92400e;
  font-size: 24px;
  font-weight: 900;
  margin-left: 8px;
}

.countdown.expired {
  color: var(--danger);
}

.qrno {
  color: #5b21b6;
  font-size: 15px;
  font-weight: 900;
}

.qr {
  width: 100%;
}

.qr img {
  width: min(300px, 100%);
  border: 12px solid white;
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 20px 44px rgba(0, 0, 0, .28);
}

.admin-shell {
  padding: 32px 0;
}

.login-panel {
  width: min(430px, 100%);
  margin: 8vh auto 0;
}

.login-panel .field {
  margin-top: 18px;
}

.dashboard {
  display: grid;
  gap: 16px;
}

.hide {
  display: none !important;
}

.admin-head {
  padding: 6px 0 12px;
}

.head-actions {
  gap: 10px;
}

.admin-form {
  display: grid;
  grid-template-columns: .7fr .7fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.source-form {
  grid-template-columns: 1fr auto;
}

.admin-form .primary {
  margin-top: 0;
  width: auto;
  white-space: nowrap;
}

.grow {
  min-width: 0;
}

.created-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.created-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.created-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(248, 250, 252, .84);
  padding: 10px;
}

.created-item code {
  color: #92400e;
  overflow-wrap: anywhere;
}

.table {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr .8fr .8fr .9fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(248, 250, 252, .84);
  padding: 12px;
}

.site-row {
  grid-template-columns: minmax(220px, 1.6fr) .5fr .5fr auto auto auto;
}

.source-summary {
  margin-top: 14px;
}

.quota-card {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 12px;
}

.quota-card > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(248, 250, 252, .84);
  padding: 16px;
}

.quota-card span,
.quota-card strong {
  display: block;
}

.quota-card strong {
  margin-top: 8px;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.row-label {
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.table-header {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-height: 0;
  padding-block: 6px;
}

.cdk-code {
  display: block;
  min-width: 0;
  color: #713f12;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  border-color: rgba(4, 120, 87, .22);
  background: rgba(209, 250, 229, .76);
  color: #047857;
}

.pill.off {
  border-color: rgba(190, 18, 60, .2);
  background: rgba(255, 228, 230, .82);
  color: var(--danger);
}

.danger-btn {
  color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 980px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .signal-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signal-strip span {
    align-items: flex-start;
    min-height: 70px;
    padding-block: 12px;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .admin-shell {
    width: min(100% - 24px, 1120px);
    padding: 14px 0 24px;
  }

  .topbar,
  .panel,
  .login-panel,
  .band {
    padding: 18px;
  }

  .topbar,
  .hero {
    margin-bottom: 18px;
  }

  .topbar,
  .panel-head,
  .mast,
  .admin-head,
  .table-head {
    align-items: flex-start;
  }

  .topbar,
  .panel-head,
  .admin-head,
  .table-head,
  .quota-row,
  .result-row,
  .head-actions {
    flex-direction: column;
  }

  .admin-link,
  .secondary,
  .primary,
  .quota-row,
  .result-row,
  .head-actions {
    width: 100%;
  }

  .brand {
    justify-content: flex-start;
    width: auto;
  }

  .hero {
    gap: 18px;
  }

  h1 {
    font-size: clamp(36px, 14vw, 52px);
  }

  .lead {
    font-size: 15px;
  }

  .signal-strip {
    grid-template-columns: 1fr;
  }

  .signal-strip span {
    min-height: 44px;
  }

  .quota {
    min-width: 0;
    width: 100%;
  }

  .step,
  .row,
  .admin-form,
  .source-form,
  .created-toolbar,
  .created-item,
  .quota-card {
    grid-template-columns: 1fr;
  }

  .created-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .elapsed {
    justify-self: start;
  }
}
