* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  background: #e2e8f0;
}

.te-app {
  display: flex;
  height: 100vh;
}

.te-sidebar {
  width: 360px;
  min-width: 320px;
  background: #fff;
  border-right: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.te-sidebar__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.te-sidebar__header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.te-sidebar__meta {
  margin: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #64748b;
}

.te-sidebar__meta span {
  background: #f1f5f9;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.te-empty-state,
.te-edit-form {
  padding: 1.25rem;
}

.te-empty-state p {
  margin: 0 0 0.75rem;
  line-height: 1.5;
  color: #475569;
}

.te-hint {
  font-size: 0.85rem;
  color: #64748b;
}

.te-field-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.te-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
}

.te-badge--static {
  background: #d1fae5;
  color: #047857;
}

.te-badge--muted {
  background: #f1f5f9;
  color: #64748b;
}

.te-field-label {
  margin: 0 0 0.25rem;
  font-weight: 600;
  word-break: break-word;
}

.te-field-section {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: #64748b;
}

#te-value-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

#te-value-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  resize: vertical;
  min-height: 120px;
}

.te-image-preview {
  margin-top: 0.75rem;
  padding: 0.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  text-align: center;
}

.te-image-preview img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.te-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.te-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  cursor: pointer;
}

.te-btn--primary {
  background: #2563eb;
  color: #fff;
}

.te-btn--primary:hover {
  background: #1d4ed8;
}

.te-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.te-btn--ghost {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}

.te-btn--ghost:hover {
  background: #f8fafc;
}

.te-status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.te-status--ok {
  color: #047857;
}

.te-status--error {
  color: #b91c1c;
}

.te-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.te-preview-warning {
  padding: 0.5rem 1rem;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.85rem;
  border-bottom: 1px solid #fde68a;
}

#te-preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
