:root {
  color-scheme: light;
  --ink: #1c2421;
  --muted: #62706a;
  --line: #d9ded8;
  --paper: #f8f7f2;
  --panel: #ffffff;
  --accent: #276749;
  --accent-strong: #174531;
  --warn: #a83b32;
  --gold: #b78b2b;
  --blue: #315f8f;
  --shadow: 0 18px 45px rgba(22, 31, 27, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.icon-button,
.small-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
}

button:hover,
.icon-button:hover,
.small-button:hover {
  border-color: #aeb8b1;
}

.primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.danger {
  color: var(--warn);
  border-color: #e2b7b2;
}

.subtle {
  background: transparent;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
  text-decoration: none;
  font-size: 1.2rem;
  line-height: 1;
}

.small-button {
  display: inline-grid;
  place-items: center;
  min-width: 76px;
  text-decoration: none;
}

.icon-button input,
.small-button input {
  display: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #eef2ec;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 0;
  font-size: 2rem;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: 1.05rem;
}

.header-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

main {
  padding: 22px clamp(18px, 4vw, 48px) 40px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--panel);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(39, 103, 73, 0.18);
  border-color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

.stats span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stats p {
  margin: 8px 0 0;
  color: var(--muted);
}

.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.artist-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(22, 31, 27, 0.04);
  cursor: pointer;
}

.artist-card:hover {
  border-color: #aeb8b1;
}

.artist-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.artist-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.25;
}

.artist-card p {
  margin: 0;
  color: var(--muted);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 32px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #e2ece5;
  font-weight: 800;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ec;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.artist-detail {
  display: grid;
  gap: 14px;
}

.detail-header {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.detail-header h2,
.detail-header p {
  margin: 0;
}

.detail-header p {
  color: var(--muted);
}

.album-list {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong,
td span {
  display: block;
}

td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.owned-cell {
  width: 72px;
}

.owned-cell input {
  width: 22px;
  min-height: 22px;
}

.search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.search-result h3,
.search-result p {
  margin: 0;
}

.search-result p,
.status {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  color: #33413c;
  background: #edf1ec;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.blue {
  color: #183c60;
  background: #e4eef7;
}

.path {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.card-actions {
  align-self: end;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.empty-state {
  display: none;
  border: 1px dashed #bbc5bd;
  border-radius: 8px;
  padding: 36px;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.empty-state.visible {
  display: block;
}

dialog {
  width: min(820px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(28, 36, 33, 0.38);
}

form {
  padding: 18px;
}

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

.dialog-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.check span {
  margin: 0;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  margin-top: 18px;
}

@media (max-width: 860px) {
  .app-header {
    align-items: start;
    flex-direction: column;
  }

  .toolbar,
  .detail-header {
    grid-template-columns: 1fr;
  }

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

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .header-actions .primary {
    grid-column: 1 / -1;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .empty-state {
    padding: 24px 16px;
  }
}
