:root {
  --bg: #f4f4f4;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --line: #e3e3e3;
  --line-strong: #d5d5d5;
  --text: #222222;
  --muted: #777777;
  --accent: #ef8a00;
  --accent-strong: #d97400;
  --accent-soft: #fff1db;
  --ok: #1f9d59;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #fbfbfb 0%, #f0f0f0 100%);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.desktop-shell {
  width: min(1880px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px 0 20px;
}

.app-header {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 540px;
  align-items: stretch;
  gap: 18px;
  padding: 8px 12px 0;
}

.brand-block,
.hero-banner,
.top-tabs,
.summary-card,
.view-panel,
.module-sidebar,
.module-stage,
.settings-card,
.modal-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffba42 0%, #ef8a00 100%);
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy strong {
  font-size: 28px;
  line-height: 1;
}

.brand-copy span {
  margin-top: 8px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.top-tabs {
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 4px;
}

.top-tab {
  min-width: 120px;
  padding: 16px 10px 14px;
  background: transparent;
  border-bottom: 3px solid transparent;
  color: #3b3b3b;
  font-size: 18px;
  cursor: pointer;
}

.top-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.hero-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  background:
    linear-gradient(120deg, #f09c18 0%, #ffbf4a 24%, #f48f13 52%, #e47700 100%);
  color: #fff8ee;
  font-size: clamp(24px, 2vw, 50px);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 12px 0;
}

.summary-card {
  padding: 16px 18px;
}

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

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.summary-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  padding: 10px 12px 0;
}

.view-panel {
  display: none;
  padding: 14px;
}

.view-panel.is-active {
  display: block;
}

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

.panel-head h1,
.section-title h2,
.sidebar-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.panel-head p,
.section-title p,
.sidebar-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.toolbar-btn,
.soft-btn,
.action-btn,
.icon-btn,
.primary-btn {
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.toolbar-btn,
.soft-btn,
.action-btn {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: #fff8ef;
  color: #6e4a11;
}

.toolbar-btn:hover,
.soft-btn:hover,
.action-btn:hover,
.primary-btn:hover,
.icon-btn:hover,
.module-item:hover,
.top-tab:hover {
  transform: translateY(-1px);
}

.toolbar-btn.is-primary,
.primary-btn {
  border: 1px solid var(--accent-strong);
  background: linear-gradient(180deg, #ff9f18 0%, #ef8a00 100%);
  color: #ffffff;
}

.action-btn.is-danger {
  color: #8a1d1d;
  background: #fff4f4;
  border-color: #f0c8c8;
}

.action-btn.is-running {
  color: #8a4b09;
  background: #fff4df;
}

.icon-btn {
  width: 36px;
  height: 36px;
  background: #fff5e4;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 22px;
  line-height: 1;
}

.search-row {
  margin: 14px 0 12px;
  display: flex;
  justify-content: flex-end;
}

.search-input,
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.search-input {
  width: min(360px, 100%);
}

.search-input:focus,
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 138, 0, 0.12);
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.grid-table th,
.grid-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.grid-table th:last-child,
.grid-table td:last-child {
  border-right: 0;
}

.grid-table thead th {
  background: #fafafa;
  color: #555555;
  font-weight: 600;
}

.grid-table tbody tr:hover {
  background: #fffaf1;
}

.check-col {
  width: 42px;
  text-align: center !important;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f4f4f4;
  color: #555555;
}

.status-inline.is-ok {
  background: #ebfff4;
  color: var(--ok);
}

.status-inline.is-warn {
  background: #fff6e3;
  color: var(--warn);
}

.status-inline.is-danger {
  background: #fff1f1;
  color: var(--danger);
}

.status-inline.is-neutral {
  background: #f3f4f6;
  color: #475569;
}

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

.product-layout {
  display: grid;
  grid-template-columns: 166px minmax(0, 1fr);
  gap: 14px;
}

.module-sidebar {
  padding: 12px 0;
  overflow: hidden;
}

.sidebar-head {
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--line);
}

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

.module-list {
  padding: 8px 0 0;
}

.module-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  color: #333333;
  text-align: left;
  cursor: pointer;
}

.module-item.is-active {
  background: #fff7eb;
  color: var(--accent-strong);
  border-left-color: var(--accent);
}

.module-item span {
  font-size: 12px;
  color: var(--muted);
}

.module-stage {
  padding: 14px;
}

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

.module-header h2 {
  margin: 0;
  font-size: 26px;
}

.module-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.module-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cloud-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(560px, 1.4fr);
  gap: 14px;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

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

.subpanel-head h3 {
  margin: 0;
  font-size: 17px;
}

.subpanel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.table-shell.compact .grid-table {
  min-width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
}

.badge.badge-desktop {
  background: #eef6ff;
  color: #2458a6;
}

.desktop-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.desktop-inline-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.module-empty {
  padding: 28px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--muted);
  line-height: 1.7;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-card {
  padding: 16px;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 12px;
  margin-top: 14px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-form label span {
  font-size: 13px;
  color: #555555;
}

.settings-form .wide {
  grid-column: span 2;
}

.settings-submit {
  display: flex;
  align-items: end;
}

.primary-btn {
  padding: 11px 18px;
}

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

.desktop-db-card {
  grid-column: 1 / -1;
}

.delivery-card {
  grid-column: 1 / -1;
}

.kv-list {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px 14px;
}

.kv-list dt {
  color: var(--muted);
}

.kv-list dd {
  margin: 0;
  word-break: break-all;
}

.endpoint-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.mini-stat strong,
.mini-stat span {
  display: block;
}

.mini-stat strong {
  font-size: 20px;
}

.mini-stat span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.endpoint-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.endpoint-card strong,
.endpoint-card code {
  display: block;
}

.endpoint-card strong {
  margin-bottom: 6px;
}

.endpoint-card code {
  color: #7c4d09;
  font-size: 12px;
  line-height: 1.6;
}

.desktop-db-list {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.desktop-db-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.desktop-db-item h3,
.desktop-db-item p {
  margin: 0;
}

.desktop-db-item h3 {
  font-size: 14px;
}

.desktop-db-item p {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}

.desktop-db-item code {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #7c4d09;
  word-break: break-all;
}

.desktop-db-error {
  margin-top: 14px;
  font-size: 12px;
  color: #8a4b0f;
  line-height: 1.6;
}

.desktop-module-panel {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.desktop-module-preview {
  margin-bottom: 14px;
}

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

.module-link-pills {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-link-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

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

.module-link-item {
  background: #fff;
}

.store-login-panel {
  background: #fffdf8;
}

.store-login-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.store-login-checklist {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.store-check-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.store-login-notes {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.store-login-notes .endpoint-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  z-index: 20;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-shell {
  width: min(760px, calc(100vw - 32px));
  padding: 16px;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 24px;
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

.modal-form .wide {
  grid-column: span 2;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-form label span {
  color: #555555;
  font-size: 13px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 220px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.modal-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(34, 34, 34, 0.92);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1360px) {
  .app-header {
    grid-template-columns: 220px 1fr;
  }

  .hero-banner {
    grid-column: 1 / -1;
    min-height: 86px;
  }

  .summary-row,
  .insight-grid,
  .settings-form,
  .settings-grid,
  .cloud-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .desktop-shell {
    width: min(100vw - 16px, 980px);
  }

  .app-header,
  .summary-row,
  .insight-grid,
  .product-layout,
  .settings-grid,
  .cloud-grid,
  .settings-form,
  .modal-form,
  .check-grid,
  .desktop-db-list,
  .store-login-checklist,
  .store-login-notes {
    grid-template-columns: 1fr;
  }

  .top-tabs {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .settings-form .wide,
  .modal-form .wide,
  .modal-actions {
    grid-column: span 1;
  }

  .product-layout {
    gap: 10px;
  }

  .module-sidebar {
    padding-bottom: 8px;
  }
}
