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

body {
  margin: 0;
  min-height: 100vh;
  background: #111827;
  color: #e5e7eb;
}

.app-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1, h2, h3 {
  margin: 0;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: #9ca3af;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1rem;
  padding: 1rem;
}

.layout.phase-a {
  grid-template-columns: 340px 1fr;
}

.panel {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

.wizard-shell {
  padding: 1rem;
}

.wizard-card {
  max-width: 620px;
  margin: 0 auto;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wizard-progress {
  margin: 0;
  color: #9ca3af;
  font-size: 0.9rem;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

input,
select,
textarea,
button {
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #f9fafb;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

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

button {
  width: fit-content;
  cursor: pointer;
}

button.danger {
  border-color: #ef4444;
}

.note {
  margin: 0;
  color: #9ca3af;
  font-size: 0.85rem;
}

.badge {
  width: fit-content;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #6b7280;
  font-size: 0.8rem;
}

.badge.ok { border-color: #10b981; color: #86efac; }
.badge.warn { border-color: #f59e0b; color: #fcd34d; }

.heatmap-own {
  border-left: 3px solid #10b981;
  padding-left: 0.4rem;
}

.heatmap-source {
  border-left: 3px solid #f59e0b;
  padding-left: 0.4rem;
}

.matrix-low {
  border-left: 3px solid #ef4444;
  padding-left: 0.4rem;
}

.matrix-mid {
  border-left: 3px solid #f59e0b;
  padding-left: 0.4rem;
}

.matrix-good {
  border-left: 3px solid #10b981;
  padding-left: 0.4rem;
}

.profile-card {
  border: 1px solid #4b5563;
  border-radius: 10px;
  padding: 0.6rem;
  background: #111827;
}

.guided-flow {
  border: 1px solid #4b5563;
  border-radius: 10px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guided-flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guided-stepper {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.guided-step-button {
  width: 100%;
  text-align: left;
}

.guided-step-button.active {
  border-color: #60a5fa;
}

.guided-step-meta {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.step-help {
  border-top: 1px dashed #4b5563;
  padding-top: 0.4rem;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.help-icon {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border-color: #6b7280;
}

.field-help-popover {
  position: fixed;
  z-index: 40;
  width: min(360px, 90vw);
  background: #111827;
  border: 1px solid #6b7280;
  border-radius: 10px;
  padding: 0.65rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.chapter-list,
.source-list,
.lektor-results,
.toc-suggestions,
.ready-check-results {
  margin: 0;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow: auto;
}

.chapter-list li,
.source-list li {
  cursor: pointer;
}

.chapter-list li.active,
.source-list li.active {
  color: #93c5fd;
  font-weight: 600;
}

.toc-suggestions li {
  border: 1px dashed #4b5563;
  border-radius: 8px;
  padding: 0.35rem;
}

.toc-suggestions .button-row {
  margin-top: 0.3rem;
}

#export-report,
#export-report-pdf {
  border-color: #60a5fa;
}

#verify-audit-lock {
  border-color: #fbbf24;
}

#vault-save,
#vault-restore {
  border-color: #34d399;
}

.save-status {
  padding: 0.45rem 0.7rem;
  border: 1px solid #4b5563;
  border-radius: 999px;
  font-size: 0.9rem;
  background: #111827;
}

.app-dialog {
  border: 1px solid #4b5563;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  width: min(520px, 92vw);
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
}

.dialog-actions {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.hidden {
  display: none;
}

.review-drawer {
  position: fixed;
  top: 70px;
  right: 12px;
  width: min(420px, 92vw);
  max-height: calc(100vh - 90px);
  overflow: auto;
  background: #111827;
  border: 1px solid #4b5563;
  border-radius: 12px;
  padding: 0.8rem;
  z-index: 20;
}

.review-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
