:root {
  --bg: #edf1f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #172033;
  --muted: #687385;
  --line: #dce3ed;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #12805c;
  --success-bg: #e8f7ef;
  --danger: #c93131;
  --danger-bg: #fff0f0;
  --warning: #a46000;
  --warning-bg: #fff7df;
  --shadow: 0 22px 70px rgba(28, 43, 70, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 14% 12%, rgba(37, 99, 235, 0.12), transparent 26rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 50%, #f4f6fb 100%);
  color: var(--text);
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.site-body {
  min-height: 100vh;
}

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

.submit-shell,
.login-shell {
  min-height: calc(100vh - 54px);
  display: flex;
  align-items: center;
  padding: 40px 0 24px;
}

.submit-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 28px;
  align-items: stretch;
}

.intro-panel,
.workspace-card,
.login-card,
.panel,
.gen-box,
.stat-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 227, 237, 0.92);
  box-shadow: var(--shadow);
}

.intro-panel {
  min-height: 540px;
  min-width: 0;
  border-radius: 8px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.intro-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -100px auto;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  transform: rotate(18deg);
}

.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.brand-line.compact {
  font-size: 15px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.intro-panel h1,
.login-card h1 {
  margin: 24px 0 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.intro-panel p,
.login-card p,
.section-head p,
.panel-head p {
  margin: 0;
  color: var(--muted);
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.trust-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #40506a;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 650;
}

.workspace-card {
  border-radius: 8px;
  padding: 24px;
  min-width: 0;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
}

.step {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-soft);
  color: var(--muted);
}

.step span {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e5ebf5;
  color: #4a5568;
  font-size: 12px;
  font-weight: 800;
}

.step strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.step.active,
.step.done {
  border-color: rgba(37, 99, 235, 0.35);
  background: #edf4ff;
  color: var(--primary-dark);
}

.step.active span,
.step.done span {
  background: var(--primary);
  color: #fff;
}

.flow-panel {
  min-height: 390px;
}

.section-head {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px !important;
  color: var(--primary-dark) !important;
  font-size: 12px;
  font-weight: 800;
}

.section-head h2,
.panel-head h2,
.done-panel h2 {
  margin: 0 0 7px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
}

.field > span {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
  margin: -4px 0 17px;
  color: #40506a;
  font-size: 13px;
}

.consent-line input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

textarea {
  resize: vertical;
  min-height: 156px;
}

input:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.75);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #243044;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.16s, background 0.16s, border-color 0.16s, color 0.16s;
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.btn.ghost {
  background: var(--surface-soft);
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.action-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.msg {
  min-height: 22px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 14px;
}

.msg.error {
  color: var(--danger);
}

.msg.success {
  color: var(--success);
}

.upload-box {
  min-height: 142px;
  border: 1px dashed #b9c5d6;
  border-radius: 8px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 22px;
  text-align: center;
  color: #40506a;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.upload-box input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-box.dragging {
  border-color: var(--primary);
  background: #eef5ff;
}

.upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e5edff;
  color: var(--primary);
  font-size: 25px;
  line-height: 1;
  font-weight: 500;
}

.file-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
}

.file-preview strong,
.file-preview small {
  display: block;
  word-break: break-word;
}

.file-preview small {
  color: var(--muted);
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.done-panel {
  text-align: center;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
}

.done-panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.success-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success-bg);
  color: var(--success);
  font-size: 40px;
  font-weight: 900;
}

.success-ring.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.success-ring.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-box {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px 14px;
  text-align: left;
}

.status-box strong,
.status-box span {
  display: block;
}

.status-box strong {
  margin-bottom: 3px;
  color: #334155;
}

.status-box span {
  color: var(--muted);
  word-break: break-word;
}

.status-box.success {
  border-color: rgba(18, 128, 92, 0.24);
  background: var(--success-bg);
}

.status-box.error {
  border-color: rgba(201, 49, 49, 0.26);
  background: var(--danger-bg);
}

.status-box.pending {
  border-color: rgba(164, 96, 0, 0.25);
  background: var(--warning-bg);
}

.page-foot {
  min-height: 54px;
  display: grid;
  place-items: center;
}

.page-foot a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.page-foot a:hover {
  color: var(--primary);
}

.submit-body {
  background:
    linear-gradient(120deg, rgba(14, 165, 233, 0.12), transparent 30%),
    linear-gradient(150deg, #f6f8fb 0%, #eef4f8 45%, #f9fafb 100%);
}

.client-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #42526a;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.admin-link:hover {
  border-color: #c8d4e3;
  background: #fff;
}

.client-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 24px;
  align-items: center;
  padding: 22px 0 38px;
}

.client-overview {
  min-width: 0;
  padding: 12px 4px;
}

.client-kicker {
  width: fit-content;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-dark);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 850;
}

.client-overview h1 {
  margin: 20px 0 14px;
  color: #111827;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
}

.client-overview p {
  max-width: 560px;
  margin: 0;
  color: #5f6d7e;
  font-size: 16px;
}

.flow-summary {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.flow-summary div {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 420px);
  border: 1px solid rgba(220, 227, 237, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 13px;
}

.flow-summary span {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e7f0ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
}

.flow-summary strong {
  color: #243044;
}

.client-console {
  min-width: 0;
}

.client-card {
  border: 1px solid rgba(210, 220, 232, 0.95);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 64px rgba(31, 41, 55, 0.14);
}

.client-steps {
  margin-bottom: 24px;
}

.client-card .flow-panel {
  min-height: 420px;
}

.client-card .section-head h2 {
  font-size: 28px;
}

.client-card textarea {
  min-height: 220px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.session-tools {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: -8px 0 16px;
}

.login-shell {
  justify-content: center;
}

.login-card {
  width: min(460px, 100%);
  border-radius: 8px;
  padding: 32px;
}

.login-card h1 {
  font-size: 34px;
}

.login-card p {
  margin-bottom: 24px;
}

.admin-app {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions,
.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  border-radius: 8px;
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 28px;
  line-height: 1;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 5px;
  margin-bottom: 16px;
}

.tab {
  min-width: 104px;
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 750;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.panel {
  border-radius: 8px;
  padding: 18px;
  overflow: hidden;
}

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

.panel-head h2 {
  font-size: 22px;
}

.search-box {
  width: min(320px, 100%);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  color: var(--muted);
}

.search-box input {
  min-height: 38px;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.search-box input:focus {
  box-shadow: none;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

tbody tr:hover {
  background: #fbfdff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

code {
  display: inline-block;
  border: 1px solid #d9e2ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e3a8a;
  padding: 3px 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.cell-text {
  max-width: 340px;
  max-height: 128px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell-note {
  max-width: 220px;
  margin-top: 6px;
  word-break: break-word;
}

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

.file-link {
  color: var(--primary-dark);
  font-weight: 750;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success);
}

.badge.off {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.used {
  background: var(--warning-bg);
  color: var(--warning);
}

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

.customer-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.customer-status .btn {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}

.row-actions .btn {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}

.empty-row {
  height: 150px;
  text-align: center;
  color: var(--muted);
}

.gen-box {
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: none;
}

.gen-row {
  display: grid;
  grid-template-columns: 130px 150px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.compact-field,
.note-field {
  margin-bottom: 0;
}

.gen-result {
  margin-top: 14px;
}

.gen-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.gen-result textarea {
  min-height: 128px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid #c6d4ea;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  padding: 12px 14px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .client-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .client-overview {
    padding-top: 8px;
  }

  .client-overview h1 {
    font-size: 42px;
  }

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

  .flow-summary div {
    width: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .submit-shell {
    align-items: flex-start;
  }

  .submit-layout {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    min-height: auto;
    padding: 30px;
  }

  .intro-panel h1 {
    font-size: 38px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head,
  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-actions,
  .top-actions {
    width: 100%;
  }

  .panel-actions .btn,
  .top-actions .btn,
  .search-box {
    flex: 1 1 160px;
  }

  .gen-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gen-row .note-field,
  .gen-row .btn.primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .client-topbar {
    min-height: 60px;
  }

  .client-shell {
    min-height: calc(100vh - 60px);
    padding: 8px 0 22px;
    gap: 16px;
  }

  .client-overview h1 {
    font-size: 34px;
  }

  .client-overview p {
    font-size: 14px;
  }

  .flow-summary {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .flow-summary div {
    flex-direction: row;
    align-items: center;
  }

  .client-card .flow-panel {
    min-height: auto;
  }

  .client-card .section-head h2 {
    font-size: 23px;
  }

  .client-card textarea {
    min-height: 180px;
  }

  .session-tools {
    justify-content: stretch;
  }

  .session-tools .btn {
    flex: 1;
  }

  .shell,
  .admin-app {
    width: min(100% - 24px, 1240px);
  }

  .submit-shell,
  .login-shell {
    min-height: calc(100vh - 46px);
    padding: 18px 0 12px;
  }

  .intro-panel,
  .workspace-card,
  .login-card,
  .panel {
    padding: 18px;
  }

  .intro-panel h1 {
    font-size: 32px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .flow-panel {
    min-height: auto;
  }

  .section-head h2,
  .panel-head h2 {
    font-size: 20px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .gen-row {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .tab {
    min-width: 0;
  }

  .panel-actions {
    flex-direction: column;
  }

  .panel-actions .btn,
  .search-box {
    width: 100%;
    flex: auto;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .btn {
    white-space: normal;
  }

  table {
    min-width: 1080px;
  }
}
