/* 魔神智能开放平台 — 品牌主题（荧光绿） */
:root {
  --bg-dark: #f5f5f5;
  --bg-card: #ffffff;
  --bg-elevated: #fafafa;
  --border: #ebebeb;
  --text: #1a1a1a;
  --text-muted: #262626;
  --text-subtle: #737373;
  --primary: #a7e826;
  --primary-dark: #1a1a1a;
  --accent: #40f8c1;
  --gradient: linear-gradient(105.95deg, #a7e826 26.24%, #40f8c1 98.2%);
  --btn-dark: #0d0d0d;
  --btn-dark-hover: #262626;
  --btn-dark-text: #f2f2f2;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 18px;
  --radius-sm: 8px;
  --radius-pill: 100px;
  --shadow: 0 4px 24px rgba(13, 13, 13, 0.06);
  --font: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Alimama ShuHeiTi", "PingFang SC", -apple-system,
    BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  --brand-tint: rgba(167, 232, 38, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--btn-dark);
  color: var(--btn-dark-text);
  border-radius: var(--radius-pill);
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--btn-dark-hover);
  filter: none;
  transform: translateY(-1px);
}

.btn-brand {
  background: var(--gradient);
  color: var(--text);
  border-radius: var(--radius-pill);
  box-shadow: none;
}

.btn-brand:hover:not(:disabled) {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-dark);
  color: var(--primary-dark);
  border-radius: var(--radius-pill);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(13, 13, 13, 0.04);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-input {
  flex: 1;
}

.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-default {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table th,
table.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

table.data-table tr:hover td {
  background: rgba(15, 23, 42, 0.02);
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal-lg {
  max-width: 640px;
}

.modal-header {
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-size: 18px;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-sm .modal-body p {
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.4);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}

.toast-info {
  border-color: rgba(167, 232, 38, 0.45);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Console layout */
.console-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-link {
  text-decoration: none;
  color: inherit;
}

.sidebar-brand-link:hover {
  color: inherit;
  background: var(--bg-elevated);
}

.brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo-nav {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-logo-sidebar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-logo-auth {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin: 0 auto 16px;
}

.brand-icon {
  /* 保留兼容，Logo 已改用 .brand-logo */
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-item.active {
  background: var(--brand-tint);
  color: var(--primary-dark);
  font-weight: 500;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 12px;
}

.main-content {
  flex: 1;
  overflow: auto;
  background: var(--bg-dark);
}

.page-header {
  padding: 24px 32px 0;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-display);
}

.page-body {
  padding: 24px 32px 32px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.select-input {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

/* Module cards (console hub) */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow);
}

.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(167, 232, 38, 0.15);
}

.module-card-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--text);
}

.module-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.module-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Doc viewer */
.doc-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  min-height: 500px;
}

.doc-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.doc-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.doc-list {
  list-style: none;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.doc-list-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background 0.15s;
}

.doc-list-item:hover,
.doc-list-item.active {
  background: var(--brand-tint);
}

.doc-list-item .doc-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.doc-content-panel h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.doc-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.doc-body {
  font-size: 15px;
  line-height: 1.8;
  color: #475569;
}

.doc-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}

.doc-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
}

.doc-body h1,
.doc-body h2,
.doc-body h3 {
  margin: 24px 0 12px;
  color: var(--text);
}

.doc-body p {
  margin-bottom: 12px;
}

.doc-body ul,
.doc-body ol {
  margin: 12px 0 12px 24px;
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.doc-body th,
.doc-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.doc-body th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}

.doc-body tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

/* Stats summary */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Step indicator */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  padding-bottom: 8px;
}

.step::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}

.step.active::after,
.step.done::after {
  background: var(--primary);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-bottom: 8px;
}

.step.active .step-num {
  border-color: var(--primary);
  background: var(--brand-tint);
  color: var(--primary-dark);
}

.step.done .step-num {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.step-label {
  font-size: 13px;
  color: var(--text-muted);
}

.step.active .step-label {
  color: var(--text);
}

/* Credential reveal */
.credential-box {
  background: var(--bg-elevated);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
  word-break: break-all;
  font-family: "SF Mono", monospace;
  font-size: 13px;
}

@media (max-width: 768px) {
  .console-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .nav-item {
    flex-shrink: 0;
  }

  .sidebar-user {
    display: none;
  }

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

  .page-body {
    padding: 16px;
  }
}
