:root {
  color-scheme: light;
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-primary-border: #bfdbfe;
  --color-action: #315fba;
  --color-action-hover: #294f9f;
  --color-success: #16a34a;
  --color-success-soft: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-warning: #f59e0b;
  --color-warning-soft: #fffbeb;
  --color-warning-border: #fde68a;
  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;
  --color-danger-border: #fecaca;
  --color-text-main: #0f172a;
  --color-text-body: #334155;
  --color-text-muted: #64748b;
  --color-text-disabled: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --bg: var(--color-bg);
  --card: var(--color-surface);
  --text: var(--color-text-main);
  --muted: var(--color-text-muted);
  --border: var(--color-border);
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-hover);
  --danger: var(--color-danger);
  --success: var(--color-success);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-strong: 0 18px 48px rgba(15, 23, 42, 0.08);
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --line-height-xs: 18px;
  --line-height-sm: 20px;
  --line-height-base: 22px;
  --line-height-md: 24px;
  --line-height-lg: 26px;
  --line-height-xl: 28px;
  --line-height-2xl: 32px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-regular);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  color: var(--color-text-main);
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.03em;
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 6px;
  color: var(--color-text-main);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 6px;
  color: var(--color-text-main);
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  font-weight: var(--font-weight-semibold);
}

.card p {
  color: var(--muted);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  width: min(1280px, calc(100% - 32px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), #60a5fa);
  transition: width 0.25s ease;
}

.content-stack {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.wizard-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  height: var(--wizard-shell-height, auto);
}

.wizard-panel {
  min-height: 0;
  height: var(--wizard-panel-height, auto);
  overflow: auto;
}

.wizard-panel[hidden] {
  display: none;
}

.wizard-nav {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.wizard-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
}

.wizard-nav-center {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.wizard-nav-center strong {
  color: var(--color-text-main);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.wizard-nav-center small {
  display: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.notice-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid #bae6fd;
  border-radius: 20px;
  background: #f0f9ff;
  box-shadow: var(--shadow);
}

.notice-panel[hidden] {
  display: none;
}

.notice-panel.warn {
  border-color: var(--color-warning-border);
  background: var(--color-warning-soft);
}

.notice-panel.ok {
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.notice-panel h2 {
  margin-bottom: 6px;
}

.notice-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--color-action);
  color: #ffffff;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}

.notice-link:hover {
  background: var(--color-action-hover);
}

.compact-link {
  margin-top: 8px;
}

.notice-panel details {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding-top: 10px;
}

.notice-panel summary {
  cursor: pointer;
  color: var(--primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
}

.notice-panel pre {
  min-height: 120px;
  max-height: 260px;
  margin: 12px 0 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
}

.progress-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
  align-self: start;
  min-height: calc(100vh - 40px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.progress-panel h2 {
  margin-bottom: 0;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.sidebar-overview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--color-primary-border);
  border-radius: 16px;
  background: var(--color-primary-soft);
}

.sidebar-overview > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-overview strong {
  color: var(--color-text-main);
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.04em;
}

.sidebar-overview small {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.progress-summary {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.progress-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  margin: 0 -8px;
  padding: 10px 8px 18px;
  border-radius: 14px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.progress-item[data-wizard-target] {
  cursor: pointer;
}

.progress-item[data-wizard-target]:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

.progress-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 29px;
  bottom: -2px;
  width: 2px;
  background: #d8e0ef;
}

.progress-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 3px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
}

.progress-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.step-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.progress-item small {
  color: var(--muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.progress-item.done .progress-dot {
  border-color: var(--success);
  background: var(--success);
}

.progress-item.done {
  color: var(--color-success);
}

.progress-item.active .progress-dot {
  border-color: var(--primary);
  background: #dbeafe;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.progress-item.active {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

.progress-item.current-panel {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  background: var(--color-primary-soft);
}

.progress-item.warn .progress-dot {
  border-color: var(--color-warning);
  background: var(--color-warning);
}

.progress-item.warn {
  background: var(--color-warning-soft);
}

.progress-item.done:not(:last-child)::after {
  background: rgba(22, 163, 74, 0.4);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.muted {
  background: #fbfcff;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.todo-list {
  display: grid;
  gap: 10px;
}

.todo-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--color-surface);
}

.todo-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.wizard-panel h2 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
}

.wizard-panel h3 {
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

.wizard-panel p,
.wizard-panel small,
.wizard-panel li {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.todo-title p {
  margin-bottom: 0;
}

.todo-dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border-radius: 999px;
  border: 3px solid #cbd5e1;
  background: #ffffff;
}

.todo-dot.pending {
  border-color: var(--color-border-strong);
}

.todo-dot.done {
  border-color: var(--success);
  background: var(--success);
}

.todo-dot.warn {
  border-color: var(--color-warning);
  background: var(--color-warning);
}

.todo-dot.active {
  border-color: var(--primary);
  background: #dbeafe;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.todo-actions {
  justify-content: flex-start;
}

.wechat-actions {
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.wechat-actions .field-help {
  flex: 1 1 260px;
}

.wizard-panel[data-wizard-panel="0"]:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.wizard-panel[data-wizard-panel="0"] .card-header {
  margin-bottom: 12px;
}

.cli-guide-card {
  margin-bottom: 10px;
  border-color: var(--color-primary-border);
  background: linear-gradient(180deg, #ffffff 0%, var(--color-primary-soft) 100%);
}

.cli-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cli-guide-option {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.cli-guide-option strong {
  color: var(--color-text-main);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.cli-guide-option p {
  margin-bottom: 0;
}

.command-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-muted);
}

.command-box code {
  overflow: hidden;
  color: var(--color-text-main);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-box-scroll code {
  overflow-x: auto;
  text-overflow: clip;
}

.copy-btn {
  min-width: 58px;
  padding: 7px 10px;
}

.setup-action-grid {
  display: grid;
  grid-template-rows: minmax(96px, 0.55fr) minmax(220px, 1.45fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.setup-action-card {
  align-content: space-between;
  min-height: 0;
  padding: 18px;
}

.setup-action-card-wide {
  gap: 14px;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.benefit-grid li {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-muted);
  color: var(--color-text-body);
  font-weight: var(--font-weight-medium);
}

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

.automation-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
}

.automation-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.automation-step small {
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.automation-step.active {
  border-color: var(--color-primary-border);
  background: var(--color-primary-soft);
}

.automation-step.done {
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.automation-step.warn {
  border-color: var(--color-warning-border);
  background: var(--color-warning-soft);
}

.agent-config-card {
  margin-top: 12px;
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.agent-config-box {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--color-success-border);
  border-radius: 14px;
  background: #ffffff;
}

.agent-config-box pre {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text-main);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.skill-template-section {
  display: grid;
  gap: 16px;
}

.skill-template-group {
  display: grid;
  gap: 10px;
}

.skill-template-heading {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--color-primary-border);
  border-radius: 14px;
  background: var(--color-primary-soft);
}

.skill-template-heading strong {
  color: var(--color-text-main);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

.skill-template-heading p {
  margin-bottom: 0;
}

.skill-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skill-card {
  align-content: space-between;
  min-height: 148px;
}

.skill-card p {
  margin-bottom: 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 8px 13px;
  border-radius: 10px;
  background: var(--color-action);
  color: #ffffff;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: background 0.15s ease;
}

.button-link:hover {
  background: var(--color-action-hover);
}

.skill-download-link {
  justify-self: flex-start;
}

.auto-panel {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--color-primary-border);
  border-radius: 12px;
  background: var(--color-primary-soft);
}

.auto-panel p {
  margin-bottom: 0;
}

.wizard-panel[data-wizard-panel="0"] .auto-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.wizard-panel[data-wizard-panel="0"] .auto-panel p {
  flex: 1 1 220px;
}

#deviceCodeStatus {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
  overflow-wrap: anywhere;
}

#workspaceLinkStatus {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

.permission-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-surface-muted);
}

.permission-panel summary {
  cursor: pointer;
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
}

.permission-panel ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.permission-panel:not([open]) ul {
  display: none;
}

.permission-panel li {
  margin: 2px 0;
}

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

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

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

label {
  display: grid;
  gap: 8px;
  color: var(--color-text-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-semibold);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-regular);
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 8px 13px;
  background: var(--color-action);
  color: #ffffff;
  font: inherit;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

button:hover {
  background: var(--color-action-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

button.secondary {
  border: 1px solid var(--color-border-strong);
  background: #ffffff;
  color: var(--color-text-body);
}

button.secondary:hover {
  background: var(--color-surface-muted);
}

button.danger {
  border: 1px solid var(--color-danger-border);
  background: var(--color-danger-soft);
  color: var(--danger);
}

button.copied {
  background: var(--success);
  color: #ffffff;
}

pre {
  overflow: auto;
  padding: 20px 22px;
  background: #0f172a;
  color: #dbeafe;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  white-space: pre-wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  white-space: nowrap;
}

.status-badge.active {
  background: #dbeafe;
  color: var(--color-primary-hover);
}

.status-badge.done {
  background: #dcfce7;
  color: #166534;
}

.status-badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.pending {
  background: #f1f5f9;
  color: #475569;
}

.step-badge {
  flex: 0 0 auto;
}

.field-help {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-sm);
}

@media (max-width: 760px) {
  .card-header {
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .progress-panel {
    position: static;
    min-height: auto;
  }

  .wizard-shell {
    height: auto;
  }

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

  .wizard-nav {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .wizard-arrow {
    width: 38px;
    height: 38px;
  }

  .two,
  .three {
    grid-template-columns: 1fr;
  }

  .cli-guide-grid,
  .skill-template-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }

  .step-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
