:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1f2937;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

header h1 {
  margin-bottom: 0.25rem;
}

.panel {
  background: white;
  border-radius: 16px;
  padding: 1rem;
  margin-top: 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title-row h2,
.panel-header h2 {
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  border: 1px solid #d0d7e2;
  background: white;
  color: #111827;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.primary {
  background: #111827;
  color: white;
}

.button.secondary {
  background: #eef2ff;
}

.button.danger {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.file-button {
  display: inline-flex;
  align-items: center;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.8rem 0.5rem;
  vertical-align: top;
}

input[type="text"], textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.6rem;
  font: inherit;
  box-sizing: border-box;
}

input.field-invalid,
textarea.field-invalid {
  border-color: #fca5a5;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.18);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.message {
  margin-top: 0.75rem;
  min-height: 1.25rem;
  color: #1d4ed8;
}

.hint {
  color: #6b7280;
  margin: 0.5rem 0 0;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.help-popover {
  position: relative;
}

.help-popover summary {
  list-style: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  background: #ffffff;
}

.help-popover summary::-webkit-details-marker {
  display: none;
}

.help-card {
  position: absolute;
  top: 2rem;
  left: 0;
  width: 340px;
  max-width: min(90vw, 340px);
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 0.9rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  z-index: 20;
}

.help-card code,
.help-card pre {
  display: block;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.65rem;
  overflow-x: auto;
}

.collapsible-panel summary {
  list-style: none;
  cursor: pointer;
}

.collapsible-panel summary::-webkit-details-marker {
  display: none;
}

.collapsible-content {
  padding-top: 0.4rem;
}

.guidance-block {
  margin-top: 1rem;
}

.guidance-actions {
  margin-top: 0.75rem;
}

.generate-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-start;
}

.generate-button {
  font-size: 1.05rem;
  padding: 0.9rem 1.35rem;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.14);
}

.export-actions {
  margin-top: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  background: #e5e7eb;
}

.status-auto { background: #dcfce7; color: #166534; }
.status-review { background: #fef3c7; color: #92400e; }
.status-skipped { background: #e5e7eb; color: #374151; }
.status-error { background: #fee2e2; color: #991b1b; }

.draft-placeholder {
  color: #94a3b8;
}

@media (max-width: 820px) {
  .container {
    padding-inline: 0.75rem;
  }

  .help-card {
    left: auto;
    right: 0;
  }
}

.sources-list {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.sources-list a {
  font-size: 0.85rem;
}
