:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #dde4ee;
  --line-strong: #cbd5e1;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #c2410c;
  --danger-bg: #fff1eb;
  --warning: #b45309;
  --warning-bg: #fff7ed;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.1), rgba(244, 246, 248, 0) 300px),
    var(--bg);
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px 44px;
}

.state-panel {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 34px;
  margin-top: 80px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.state-panel-error {
  align-items: flex-start;
  justify-content: flex-start;
  min-height: auto;
  margin-top: 42px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d6e2e0;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--danger);
  font-weight: 800;
  flex: 0 0 auto;
}

.state-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.state-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.event-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(22, 78, 99, 0.92)),
    #0f766e;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.event-hero-main {
  min-width: 0;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
}

.event-hero h1 {
  margin: 8px 0 16px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  background: #eef2f7;
  border: 1px solid rgba(15, 23, 42, 0.08);
  white-space: nowrap;
}

.event-hero .badge {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
}

.badge-p1 {
  color: #ffffff !important;
  background: #dc2626 !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
}

.badge-p2 {
  color: #ffffff !important;
  background: #ea580c !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
}

.badge-p3 {
  color: #ffffff !important;
  background: #2563eb !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
}

.badge-success {
  color: var(--success);
  background: var(--success-bg);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.badge-neutral {
  color: var(--muted);
  background: #f1f5f9;
}

.icon-button,
.plain-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.28);
}

.icon-copy,
.icon-refresh {
  width: 18px;
  height: 18px;
  display: inline-block;
  position: relative;
}

.icon-copy::before,
.icon-copy::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-copy::before {
  width: 10px;
  height: 12px;
  left: 5px;
  top: 3px;
}

.icon-copy::after {
  width: 10px;
  height: 12px;
  left: 1px;
  top: 0;
  opacity: 0.72;
}

.icon-refresh::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.icon-refresh::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 2px;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.plain-button {
  margin-top: 16px;
  padding: 9px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--brand);
  font-weight: 800;
}

.plain-button:hover {
  background: var(--brand-dark);
}

.text-button {
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

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

.summary-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.summary-value {
  min-height: 24px;
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.content-main,
.content-side {
  display: grid;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.field-list {
  display: grid;
}

.field-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  padding: 15px 16px;
  border-top: 1px solid #edf2f7;
}

.field-row:first-child {
  border-top: 0;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.field-value {
  min-width: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.field-value pre {
  max-width: 100%;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.field-empty {
  color: #94a3b8;
}

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

.chip {
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.hint-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.hint-item {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  line-height: 1.7;
  border: 1px solid #e2e8f0;
}

.json-view {
  max-height: 480px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #dbeafe;
  background: #0f172a;
  font-size: 12px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.92);
  font-size: 14px;
  z-index: 20;
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .page-shell {
    padding: 14px 12px 28px;
  }

  .event-hero {
    padding: 20px;
    flex-direction: column;
  }

  .event-hero h1 {
    font-size: 24px;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px;
  }

  .panel-header {
    padding: 13px 14px;
  }

  .state-panel {
    margin-top: 32px;
    padding: 24px 18px;
    align-items: flex-start;
  }
}
