:root {
  --bg: #f7f5ff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-muted: #efeafb;
  --text: #231f3c;
  --text-soft: #6d678c;
  --line: rgba(119, 97, 184, 0.16);
  --primary: #6c2cff;
  --primary-strong: #5118cf;
  --primary-soft: rgba(108, 44, 255, 0.12);
  --teal: #18c6b0;
  --amber: #f2bf41;
  --danger: #dc4f65;
  --success: #1aa86d;
  --shadow-xl: 0 30px 80px rgba(100, 74, 179, 0.18);
  --shadow-lg: 0 18px 42px rgba(93, 67, 166, 0.14);
  --shadow-sm: 0 12px 24px rgba(76, 54, 143, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 290px;
  --font-stack: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(121, 77, 255, 0.22), transparent 32%),
    radial-gradient(circle at bottom right, rgba(166, 138, 255, 0.18), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-stack);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(108, 44, 255, 0.14);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus {
  border-color: rgba(108, 44, 255, 0.42);
  box-shadow: 0 0 0 5px rgba(108, 44, 255, 0.1);
}

textarea {
  resize: vertical;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 26px 22px;
  background:
    linear-gradient(180deg, rgba(119, 54, 255, 0.97), rgba(100, 40, 236, 0.92) 120px, rgba(243, 239, 255, 0.96) 120px),
    #f5f1ff;
  border-right: 1px solid rgba(108, 44, 255, 0.08);
  z-index: 10;
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 24px 20px;
  border-radius: 26px;
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02)),
    linear-gradient(135deg, #7b39ff, #4d18da);
  box-shadow: var(--shadow-lg);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 5px;
}

.brand-mark span {
  display: block;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
}

.brand-mark span:nth-child(1) {
  grid-column: 1 / span 2;
  width: 54px;
}

.brand-mark span:nth-child(2) {
  width: 24px;
}

.brand-mark span:nth-child(3) {
  width: 24px;
}

.brand-name {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 14px;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-label {
  color: rgba(60, 43, 111, 0.62);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #342d55;
  background: transparent;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.nav-item:hover {
  transform: translateX(4px);
  background: rgba(108, 44, 255, 0.08);
}

.nav-item.active {
  background: rgba(117, 61, 255, 0.12);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(108, 44, 255, 0.08);
}

.nav-icon {
  width: 22px;
  height: 22px;
  color: currentColor;
}

.sidebar-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-soft);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(26, 168, 109, 0.1);
}

.status-dot-offline {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(220, 79, 101, 0.1);
}

.status-dot-planned {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(242, 191, 65, 0.12);
}

.main {
  padding: 30px 34px 42px;
}

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

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow,
.section-kicker,
.hero-kicker {
  color: rgba(84, 65, 146, 0.72);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title,
.hero-title,
.section-heading h3,
.modal-head h3 {
  margin: 6px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.section-heading h3,
.modal-head h3 {
  font-size: 28px;
}

.topbar-actions,
.inline-actions,
.hero-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-button,
.soft-button,
.ghost-button {
  border-radius: 16px;
  padding: 12px 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #7d39ff, #5b1be3);
  box-shadow: 0 14px 32px rgba(96, 55, 222, 0.28);
}

.soft-button {
  color: var(--primary-strong);
  background: rgba(117, 61, 255, 0.12);
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(108, 44, 255, 0.12);
}

.primary-button:hover,
.soft-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(108, 44, 255, 0.12);
}

.icon-button::before,
.icon-button::after,
.icon-button span {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-button::before {
  top: 15px;
}

.icon-button::after {
  top: 27px;
}

.icon-button[data-close]::before {
  top: 21px;
  transform: rotate(45deg);
}

.icon-button[data-close]::after {
  top: 21px;
  transform: rotate(-45deg);
}

.mobile-only {
  display: none;
}

.view {
  display: none;
  animation: fadeIn 0.28s ease;
}

.view-active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.hero-card,
.runtime-card,
.filter-card,
.model-card,
.service-card,
.table-card,
.notice-card,
.modal-card {
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-sm);
}

.hero-card,
.runtime-card,
.filter-card,
.table-card,
.notice-card,
.service-card {
  padding: 26px;
}

.hero-copy,
.field-hint,
.notice-card p,
.muted-copy,
.service-copy {
  color: var(--text-soft);
  line-height: 1.7;
}

code {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(108, 44, 255, 0.1);
  color: var(--primary-strong);
}

.hero-chip {
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(117, 61, 255, 0.1);
  color: var(--primary-strong);
}

.hero-chip.muted {
  background: rgba(32, 22, 75, 0.05);
  color: var(--text-soft);
}

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

.compact-stats {
  margin: 20px 0;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 237, 255, 0.9));
  border: 1px solid rgba(108, 44, 255, 0.08);
}

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

.stat-value {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 700;
}

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

.runtime-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(108, 44, 255, 0.08);
}

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

.runtime-title {
  font-weight: 700;
}

.runtime-detail {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading.compact {
  align-items: center;
}

.section-meta {
  color: var(--text-soft);
}

.market-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 22px;
  margin-top: 24px;
}

.filter-rail {
  position: sticky;
  top: 24px;
  align-self: start;
}

.search-box {
  position: relative;
  display: block;
  margin-top: 18px;
}

.search-box input {
  padding-left: 48px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(69, 51, 123, 0.55);
  border-radius: 50%;
  transform: translateY(-50%);
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: rgba(69, 51, 123, 0.55);
  transform: rotate(40deg);
}

.filter-group {
  margin-top: 22px;
}

.filter-title {
  margin-bottom: 10px;
  font-weight: 700;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip,
.tag-pill,
.status-pill,
.field-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(108, 44, 255, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-soft);
}

.filter-chip.active {
  background: rgba(117, 61, 255, 0.12);
  border-color: rgba(108, 44, 255, 0.28);
  color: var(--primary-strong);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.model-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.model-card::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(117, 61, 255, 0.12), transparent 70%);
}

.model-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.model-family {
  color: var(--text-soft);
  font-size: 14px;
}

.model-name {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.model-vendor {
  margin-top: 6px;
  color: var(--text-soft);
}

.status-pill.online {
  color: var(--success);
  background: rgba(26, 168, 109, 0.1);
  border-color: rgba(26, 168, 109, 0.16);
}

.status-pill.planned {
  color: #a16b0e;
  background: rgba(242, 191, 65, 0.16);
  border-color: rgba(242, 191, 65, 0.2);
}

.status-pill.offline {
  color: var(--danger);
  background: rgba(220, 79, 101, 0.1);
  border-color: rgba(220, 79, 101, 0.18);
}

.model-summary {
  margin: 16px 0 18px;
  color: var(--text-soft);
  line-height: 1.72;
}

.pill-row,
.fields-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-pill strong {
  color: var(--primary-strong);
}

.highlights {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.highlight-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-soft);
}

.highlight-row::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7d39ff, #32d6ca);
}

.service-shell {
  display: grid;
  gap: 22px;
}

.service-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.service-kicker {
  margin-bottom: 8px;
}

.service-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
}

.endpoint-box {
  padding: 18px;
  border-radius: 18px;
  background: rgba(117, 61, 255, 0.08);
}

.endpoint-route {
  margin-top: 10px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 15px;
}

.code-block {
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-radius: 18px;
  background: #171326;
  color: #efe8ff;
  font-family: "Cascadia Code", "Consolas", monospace;
  line-height: 1.7;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.notice-title {
  font-size: 18px;
  font-weight: 700;
}

.notice-card p + p {
  margin-top: 10px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

th,
td {
  padding: 18px 22px;
  text-align: left;
  border-bottom: 1px solid rgba(108, 44, 255, 0.08);
}

thead th {
  color: var(--text-soft);
  background: rgba(251, 249, 255, 0.96);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-key {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 14px;
}

.table-meta {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

.table-link {
  padding: 0;
  background: transparent;
  color: var(--primary-strong);
}

.table-link.danger {
  color: var(--danger);
}

.empty-state {
  display: none;
  padding: 44px 26px;
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.field {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.field span {
  font-weight: 700;
}

.modal {
  width: min(540px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.modal[open],
.modal.modal-fallback-open {
  position: fixed;
  inset: 0;
  margin: auto;
  max-height: calc(100vh - 24px);
}

.modal::backdrop {
  background: rgba(17, 11, 45, 0.46);
  backdrop-filter: blur(8px);
}

.modal-card {
  padding: 26px;
}

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

.secret-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #171326;
  color: #fff;
  font-family: "Cascadia Code", "Consolas", monospace;
  word-break: break-all;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 13px 18px;
  border-radius: 16px;
  background: rgba(27, 20, 53, 0.92);
  color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

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

.mobile-backdrop {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .hero-grid,
  .service-grid,
  .market-layout {
    grid-template-columns: 1fr;
  }

  .filter-rail {
    position: static;
  }

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

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-110%);
    transition: transform 0.24s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(12, 8, 28, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
    z-index: 8;
  }

  .mobile-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-only {
    display: inline-flex;
  }

  .main {
    padding: 22px 18px 38px;
  }

  .topbar,
  .section-heading,
  .service-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .inline-actions,
  .hero-actions,
  .modal-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .card-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .runtime-card,
  .filter-card,
  .service-card,
  .table-card,
  .notice-card,
  .modal-card {
    padding: 20px;
    border-radius: 22px;
  }
}
