:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --line: #dce3ea;
  --line-soft: #eef2f6;
  --text: #071326;
  --muted: #5f6b7a;
  --muted-light: #8792a2;
  --green: #15a665;
  --green-dark: #087548;
  --green-soft: #e5f8ef;
  --blue: #2563eb;
  --blue-soft: #edf4ff;
  --purple: #7c3aed;
  --purple-soft: #f2ecff;
  --orange: #f97316;
  --orange-soft: #fff2e8;
  --red: #dc2626;
  --red-soft: #fff0f0;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Noto Sans SC", "PingFang SC", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
  gap: 28px;
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  padding: 26px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 34px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 28px;
  font-weight: 850;
}

.brand-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

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

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px 0 24px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.nav-item::before {
  position: absolute;
  left: 0;
  width: 4px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  content: "";
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.nav-item.is-active::before {
  background: var(--green);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

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

.runtime-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfcfd;
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted-light);
  flex: none;
}

.dot-ok {
  background: var(--green);
}

.dot-warn {
  background: var(--orange);
}

.dot-danger {
  background: var(--red);
}

.dot-muted {
  background: var(--muted-light);
}

.main {
  min-width: 0;
  padding: 6px 10px 56px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 850;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.shop-select-wrap {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shop-select-wrap select {
  min-width: 260px;
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  width: 100%;
  min-height: 128px;
  padding: 12px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 166, 101, 0.14);
}

.primary-button,
.outline-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.outline-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.outline-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.ghost-button {
  height: 34px;
  padding: 0 12px;
  background: #f6f8fb;
  color: var(--muted);
}

.ghost-button:hover {
  color: var(--green-dark);
}

.notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #f7c87e;
  background: #fff8e8;
  color: #8a4b0b;
}

.auth-required-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid #bfe8d4;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #edf9f3 100%);
}

.auth-required-copy {
  min-width: 0;
}

.auth-required-copy h2 {
  margin: 14px 0 8px;
  font-size: 26px;
  line-height: 1.22;
}

.auth-required-copy p {
  max-width: 850px;
  margin: 0;
  color: var(--muted);
}

.auth-required-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-warning {
  margin-top: 12px;
  color: #9a4b00;
  font-weight: 700;
}

.auth-url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.auth-url-box code {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f7faf9;
  color: var(--green-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  word-break: break-all;
}

.inline-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

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

.inline-muted {
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-tile {
  position: relative;
  min-height: 72px;
  padding: 14px 44px 12px 20px;
  border-radius: 8px;
  overflow: hidden;
}

.status-tile .status-dot {
  position: absolute;
  right: 20px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.tone-green {
  background: var(--green-soft);
}

.tone-green .status-dot {
  background: var(--green);
}

.tone-blue {
  background: var(--blue-soft);
}

.tone-blue .status-dot {
  background: var(--blue);
}

.tone-purple {
  background: var(--purple-soft);
}

.tone-purple .status-dot {
  background: var(--purple);
}

.tone-orange {
  background: var(--orange-soft);
}

.tone-orange .status-dot {
  background: var(--orange);
}

.status-label {
  color: #465465;
  font-size: 14px;
}

.status-value {
  margin-top: 3px;
  font-size: 23px;
  font-weight: 850;
}

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

.metric-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  min-height: 132px;
  gap: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
}

.metric-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.metric-icon.green {
  color: var(--green-dark);
  background: var(--green-soft);
}

.metric-icon.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.metric-icon.red {
  color: var(--red);
  background: var(--red-soft);
}

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

.metric-value {
  margin-top: 6px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 850;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-grid,
.page-grid,
.tool-grid {
  display: grid;
  gap: 24px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.85fr);
  margin-top: 28px;
}

.page-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.58fr);
}

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

.panel,
.tool-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel,
.tool-panel,
.result-panel {
  min-width: 0;
  padding: 24px;
}

.panel-wide {
  min-height: 330px;
}

.panel-header,
.tool-header,
.section-title,
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel-header h2,
.section-title h2,
.tool-header h2,
.tool-header h3,
.result-header h2,
.result-header h3 {
  margin: 0;
  font-weight: 850;
}

.panel-header h2,
.section-title h2,
.tool-header h2,
.result-header h2 {
  font-size: 24px;
}

.tool-header h3,
.result-header h3 {
  font-size: 20px;
}

.panel-header p,
.section-title p,
.tool-header p,
.result-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.soft-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 14px;
  border-radius: 8px;
  background: #f5f7fa;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

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

.form-grid .span-2 {
  grid-column: 1 / -1;
}

label.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.operation-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.operation-tab {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 750;
}

.operation-tab.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.coverage-chart {
  display: grid;
  gap: 18px;
  padding: 10px 0 2px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 16px;
}

.bar-label {
  color: var(--text);
  font-weight: 750;
}

.bar-track {
  height: 16px;
  border-radius: 8px;
  background: var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--green);
  width: 0;
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.orange {
  background: var(--orange);
}

.bar-fill.purple {
  background: var(--purple);
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.flow-steps,
.event-list,
.authorizer-list,
.quick-list,
.module-list {
  display: grid;
  gap: 12px;
}

.flow-step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.flow-index {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--muted-light);
  color: #fff;
  font-weight: 850;
}

.flow-index.ok {
  background: var(--green);
}

.flow-index.warning {
  background: var(--orange);
}

.flow-title {
  font-weight: 850;
}

.flow-desc {
  color: var(--muted);
  font-size: 14px;
}

.event-item,
.authorizer-item,
.module-item,
.credential-row,
.quick-item {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfd;
}

.event-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
}

.event-title {
  font-weight: 750;
}

.event-detail {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.status-chip {
  display: inline-flex;
  justify-content: center;
  min-width: 54px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.status-chip.success {
  color: var(--green-dark);
  background: var(--green-soft);
}

.status-chip.warning {
  color: #9a4b00;
  background: var(--orange-soft);
}

.status-chip.danger {
  color: var(--red);
  background: var(--red-soft);
}

.status-chip.muted {
  color: var(--muted);
  background: #eef1f5;
}

.authorizer-empty {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.plus-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 23px;
  font-weight: 850;
}

.authorizer-item {
  padding: 14px 16px;
}

.authorizer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.authorizer-appid {
  font-weight: 850;
  word-break: break-all;
}

.authorizer-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.result-panel {
  align-self: start;
}

.result-output {
  min-height: 360px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.json-view,
.log-view {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: #d7e3f4;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.json-view {
  max-height: 560px;
}

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

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

.data-table th {
  color: var(--muted);
  background: #f7f9fb;
  font-weight: 800;
}

.data-table td {
  word-break: break-all;
}

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

.module-item {
  min-height: 96px;
  padding: 16px;
}

.module-name {
  color: var(--text);
  font-weight: 850;
  word-break: break-all;
}

.module-count,
.module-file {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.credential-table {
  display: grid;
  gap: 12px;
}

.credential-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.2fr) 100px 120px;
  gap: 16px;
  align-items: center;
  min-height: 64px;
  padding: 14px 16px;
}

.credential-name {
  font-weight: 850;
}

.credential-key {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.quick-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  text-decoration: none;
}

.quick-item:hover {
  border-color: var(--green);
}

.quick-title {
  font-weight: 800;
}

.quick-desc {
  color: var(--muted);
  font-size: 13px;
}

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

.danger-text {
  color: var(--red);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-footer {
    margin-top: 24px;
  }

  .status-grid,
  .metric-grid,
  .dashboard-grid,
  .page-grid,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-required-panel {
    grid-template-columns: 1fr;
  }

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

  .panel-wide {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  .topbar,
  .panel-header,
  .tool-header,
  .section-title,
  .result-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .topbar-actions,
  .button-row,
  .form-actions {
    width: 100%;
  }

  .topbar-actions button,
  .button-row button,
  .form-actions button,
  .auth-required-actions .primary-button,
  .auth-required-actions .outline-button,
  .shop-select-wrap select {
    width: 100%;
  }

  .nav-list,
  .status-grid,
  .metric-grid,
  .dashboard-grid,
  .page-grid,
  .tool-grid,
  .form-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .status-grid,
  .panel,
  .tool-panel,
  .result-panel,
  .auth-required-panel {
    padding: 18px;
  }

  .auth-url-box {
    align-items: stretch;
    flex-direction: column;
  }

  .credential-row,
  .event-item,
  .authorizer-empty {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .bar-value {
    text-align: left;
  }
}
