:root {
  --bg: #0c1417;
  --panel: rgba(11, 24, 28, 0.78);
  --panel-strong: rgba(15, 31, 36, 0.92);
  --line: rgba(176, 226, 209, 0.14);
  --text: #eff6f2;
  --muted: #a4beb4;
  --accent: #7ae1b1;
  --accent-strong: #d5ff8c;
  --danger: #ff8d7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(108, 225, 176, 0.16), transparent 32%),
    radial-gradient(circle at 85% 10%, rgba(214, 255, 140, 0.14), transparent 24%),
    linear-gradient(160deg, #071014 0%, #0d1619 45%, #111a1f 100%);
}

.orb {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.25;
  pointer-events: none;
}

.orb-left {
  top: -8rem;
  left: -6rem;
  background: #69d9b0;
}

.orb-right {
  top: 12rem;
  right: -8rem;
  background: #e7ff8f;
}

.shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  padding: 2.5rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-size: 0.75rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lede {
  max-width: 44rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel,
.card,
.summary-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel,
.card {
  border-radius: var(--radius);
}

.panel {
  padding: 1.5rem;
}

.navidrome-health {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(122, 225, 177, 0.12);
  border: 1px solid rgba(122, 225, 177, 0.2);
  color: var(--text);
}

.navidrome-health[data-available="false"] {
  background: rgba(255, 141, 122, 0.1);
  border-color: rgba(255, 141, 122, 0.2);
}

.analyze-form {
  display: grid;
  gap: 1.25rem;
}

.setup-card,
.advanced-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 1.25rem;
}

.setup-header {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.setup-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

button.source-chip {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 600;
}

button.source-chip[data-active="true"] {
  background: rgba(122, 225, 177, 0.18);
  border-color: rgba(122, 225, 177, 0.3);
  color: var(--text);
}

.source-panes {
  margin-top: 1rem;
}

.source-pane {
  display: block;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.checkbox-field {
  align-content: start;
}

.checkbox-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
  margin-top: 0.2rem;
}

.sync-toggle,
.dry-run-row {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.field span {
  font-size: 0.92rem;
  color: var(--accent-strong);
}

.field small,
.notes {
  color: var(--muted);
}

input,
select,
button {
  border: 0;
  border-radius: 16px;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.95rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

input::file-selector-button {
  margin-right: 0.85rem;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 10px;
  background: rgba(122, 225, 177, 0.18);
  color: var(--text);
}

code {
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: rgba(122, 225, 177, 0.12);
  color: var(--accent-strong);
}

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

.status-wrap {
  display: grid;
  gap: 0.2rem;
}

button {
  padding: 0.95rem 1.35rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #081012;
  font-weight: 700;
  cursor: pointer;
}

button.secondary-button {
  background: rgba(122, 225, 177, 0.12);
  border: 1px solid rgba(122, 225, 177, 0.24);
  color: var(--text);
}

button.secondary-button.danger-button {
  background: rgba(255, 141, 122, 0.12);
  border-color: rgba(255, 141, 122, 0.22);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status {
  margin: 0;
  color: var(--muted);
}

.status[data-error="true"] {
  color: var(--danger);
}

.status-meta {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.advanced-card summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 600;
}

.advanced-grid {
  margin-top: 1rem;
}

.section-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.section-help {
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 44rem;
}

.review-cell {
  display: grid;
  gap: 0.65rem;
}

.review-note {
  color: var(--muted);
  line-height: 1.45;
}

.review-actions,
.alternate-actions,
.history-actions,
.manual-fix-controls,
.fix-candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.review-actions button,
.alternate-actions button,
.history-actions button {
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  font-size: 0.92rem;
}

.alternate-actions {
  align-items: center;
}

.alternate-label {
  color: var(--accent-strong);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.alternate-button {
  background: rgba(255, 255, 255, 0.04);
}

.manual-fix-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.manual-fix-field {
  display: grid;
  gap: 0.55rem;
}

.manual-fix-controls {
  align-items: center;
}

.manual-fix-input {
  min-width: 16rem;
  flex: 1 1 16rem;
}

.fix-candidate-list {
  flex-direction: column;
}

.fix-candidate-button {
  display: grid;
  gap: 0.25rem;
  justify-items: start;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
}

.fix-candidate-button span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.history-actions {
  margin-top: 0.9rem;
}

.history-actions button {
  width: 100%;
}

@media (max-width: 760px) {
  .section-head {
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.run-summary {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(122, 225, 177, 0.08);
  border: 1px solid rgba(122, 225, 177, 0.16);
  color: var(--text);
  line-height: 1.6;
}

.results {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.hidden {
  display: none;
}

.results-header,
.split {
  display: grid;
  gap: 1rem;
}

.results-header {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.report-links {
  display: flex;
  gap: 0.75rem;
}

.report-links a {
  color: var(--accent-strong);
  text-decoration: none;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.summary-card {
  padding: 1rem;
  border-radius: 20px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.summary-card strong {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.4rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.history-card {
  padding: 1rem;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.history-time,
.history-stats,
.history-delta,
.empty-state {
  margin: 0;
}

.history-time {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-card h3 {
  margin-top: 0.55rem;
  font-size: 1.35rem;
}

.history-stats {
  margin-top: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.history-delta {
  margin-top: 0.75rem;
  color: var(--accent-strong);
  line-height: 1.5;
}

.history-sync {
  margin: 0.75rem 0 0;
  color: var(--accent-strong);
  line-height: 1.5;
}

.empty-state {
  color: var(--muted);
}

.split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  padding: 1.25rem;
}

.collapsible-card {
  padding: 0;
  overflow: hidden;
}

.collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  list-style: none;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.35rem;
  font-weight: 600;
}

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

.collapsible-summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.15rem;
  line-height: 1;
}

.collapsible-card[open] > .collapsible-summary::after {
  content: "-";
}

.collapsible-body {
  padding: 0 1.25rem 1.25rem;
}

.sync-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.pill-list {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pill {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(122, 225, 177, 0.14);
  color: var(--text);
}

.notes {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
  margin-top: 0.85rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 0.8rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th {
  color: var(--accent-strong);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

details summary {
  cursor: pointer;
}

@media (max-width: 960px) {
  .field-grid,
  .compact-grid,
  .summary-cards,
  .history-grid,
  .split,
  .results-header {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 1rem, 1180px);
    padding-top: 1.25rem;
  }

  .hero,
  .panel,
  .card {
    padding: 1rem;
  }

  .collapsible-card {
    padding: 0;
  }

  .collapsible-summary {
    padding: 1rem;
  }

  .collapsible-body {
    padding: 0 1rem 1rem;
  }
}
