:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fbf7e9 0%, #fdf7fb 100%);
  color: #1f2533;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

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

.topbar h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.topbar p {
  margin: 0;
  color: #667085;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page[data-view="history"] .view-builder {
  display: none;
}

.page[data-view="builder"] .view-history {
  display: none;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.card-header h2 {
  margin: 0 0 6px;
}

.card-header p {
  margin: 0;
  color: #667085;
}

.badge {
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
}

.panel {
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: #f9fafb;
}

.panel h3 {
  margin: 0 0 6px;
}

.panel p {
  margin: 0 0 12px;
  color: #667085;
}

.hint {
  font-size: 14px;
  color: #475569;
  margin-top: 8px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e4e7ec;
  background: white;
}

.option input {
  margin-top: 4px;
}

.option small {
  color: #667085;
  display: block;
  margin-top: 4px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
}

select,
input,
textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d0d7e2;
  font-size: 14px;
  font-family: inherit;
  background: white;
}

textarea {
  width: 100%;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
}

button.primary {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  color: white;
}

button.ghost {
  background: white;
  border: 1px solid #e4e7ec;
  color: #111827;
}

.status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
}

.status.info {
  background: #eff6ff;
  color: #1e40af;
}

.status.success {
  background: #ecfdf3;
  color: #047857;
}

.status.error {
  background: #fef2f2;
  color: #b91c1c;
}

.details ul {
  padding-left: 18px;
  margin: 12px 0 0;
}

.hidden {
  display: none;
}

.details a {
  color: #2563eb;
  text-decoration: none;
}

.preview-frame {
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #f5f5f5;
  padding: 12px;
  height: 560px;
}

.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  border-radius: 10px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.library-card {
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  padding: 16px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-card h4 {
  margin: 0;
}

.library-card p {
  margin: 0;
  color: #667085;
  font-size: 14px;
}

.library-card button {
  width: 100%;
  background: white;
  border: 1px solid #e4e7ec;
  color: #111827;
}
