:root {
  --te-border: rgba(43, 76, 139, 0.14);
  --te-border-strong: rgba(43, 76, 139, 0.32);
  --te-bg: #ffffff;
  --te-muted: #5b648f;
  --te-primary: #5168ff;
  --te-secondary: #3bc1fe;
  --te-chip-bg: rgba(81, 104, 255, 0.1);
  --te-chip-border: rgba(81, 104, 255, 0.35);
  --te-shadow: 0 22px 45px rgba(18, 34, 72, 0.08);
  --te-ok: #16a34a;
  --te-error: #ef4444;
}

.te-root {
  width: 100%;
}

.te-card {
  background: linear-gradient(145deg, rgba(81, 104, 255, 0.03), rgba(59, 193, 254, 0.02)), var(--te-bg);
  border: 1px solid var(--te-border);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--te-shadow);
}

.te-root--viewer .te-card {
  padding: 1.25rem;
}

.te-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.te-title {
  margin: 0;
  font-size: 1.25rem;
}

.te-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.te-description {
  color: var(--te-muted);
  font-size: 0.9rem;
}

.te-button {
  border-radius: 999px;
  border: 1px solid var(--te-border);
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.02);
  color: #1d2c6b;
  cursor: pointer;
}

.te-button--ghost {
  background: transparent;
  color: var(--te-muted);
}

.te-button--secondary {
  background: rgba(81, 104, 255, 0.12);
  color: #1d2c6b;
  border-color: var(--te-border-strong);
  box-shadow: none;
}

.te-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
}

.te-pane {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.te-editor {
  border-radius: 16px;
  border: 1px solid var(--te-border);
  padding: 0.15rem;
  background: rgba(15, 22, 38, 0.02);
  position: relative;
}

.te-editor .ace_editor {
  width: 100%;
  min-height: 340px;
  border-radius: 14px;
  font-family: var(--rm-code-font, "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
  font-size: 0.88rem;
}

.te-editor--input .ace_editor {
  background: rgba(15, 22, 38, 0.08);
}

.te-editor--input.read-only .ace_editor {
  background: rgba(15, 22, 38, 0.04);
}

.te-editor--preview .ace_editor {
  min-height: 260px;
  background: #fff;
  border: 1px solid rgba(15, 22, 38, 0.05);
}

.te-editor--hint::after {
  content: attr(data-hover-tip);
  position: absolute;
  top: -0.8rem;
  right: 0;
  transform: translateY(-100%);
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  max-width: 320px;
  pointer-events: none;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
}

.te-editor--hint:not([data-hover-tip])::after {
  content: "";
  display: none;
}

.te-section-label {
  font-weight: 600;
  color: #1d2c6b;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.te-status {
  font-weight: 600;
  color: var(--te-muted);
}

.te-status--ok {
  color: var(--te-ok);
}

.te-status--error {
  color: var(--te-error);
}

.te-issues-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.te-issue {
  border: 1px solid var(--te-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: #fff;
}

.te-issue-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--te-muted);
}

.te-issue-badge--error {
  color: var(--te-error);
}

.te-issue-message {
  font-size: 0.9rem;
}

.te-issue-path {
  font-size: 0.78rem;
  color: var(--te-muted);
}

.te-reference-panel {
  border: 1px solid var(--te-border);
  border-radius: 16px;
  padding: 0.9rem;
  background: rgba(15, 22, 38, 0.02);
  position: relative;
}

.te-reference-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.65rem;
}

.te-subtitle {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.te-hint {
  font-size: 0.75rem;
  color: var(--te-muted);
}

.te-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}

.te-chip {
  border-radius: 999px;
  border: 1px solid var(--te-chip-border);
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  background: var(--te-chip-bg);
  color: #1d2c6b;
  cursor: help;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.te-chip--active {
  border-color: var(--te-primary);
  background: rgba(81, 104, 255, 0.2);
  color: #101828;
}

.te-tabs-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.te-tabs {
  border: 1px solid var(--te-border);
  border-radius: 16px;
  background: rgba(15, 22, 38, 0.02);
  padding: 0.2rem;
}

.te-tabs .tab {
  border: none;
  box-shadow: none;
}

.te-tab {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--te-muted);
  border-radius: 12px;
  margin: 0.15rem;
  padding: 0.65rem 0.95rem;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.te-tab--selected {
  color: #101828;
  background: rgba(81, 104, 255, 0.12);
}

.te-tab-panel {
  padding: 0.35rem 0.35rem 0.6rem;
  border-top: 1px solid rgba(15, 22, 38, 0.08);
  margin-top: 0.2rem;
}

.te-array-panel {
  border: 1px dashed var(--te-border);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  min-height: 80px;
  background: rgba(249, 250, 251, 0.9);
}

.te-array-empty {
  color: var(--te-muted);
  font-size: 0.85rem;
}

.te-array-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.te-array-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--te-border);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  background: #fff;
}

.te-array-path {
  font-weight: 600;
  color: #101828;
}

.te-array-length {
  font-size: 0.75rem;
  color: var(--te-muted);
}
