:root {
  color-scheme: dark;
  --bg: #0f1114;
  --surface: #181c22;
  --border: #2a3139;
  --text: #e8eaed;
  --muted: #8b949e;
  --accent: #3d9cfd;
  --accent-dim: rgba(61, 156, 253, 0.15);
  --done: #3fb950;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* subtle grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  margin-bottom: 2rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.setups-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.setups-bar .filter-select {
  flex: 1;
  min-width: 12rem;
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.setup-name-wrap {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.setup-name {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  width: 100%;
  max-width: 100%;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s;
}

.setup-name:hover,
.setup-name:focus {
  outline: none;
  border-bottom-color: var(--border);
}

.setup-name:focus {
  border-bottom-color: var(--accent);
}

.rename-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 1rem 0 0.5rem;
}

.filter-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.filter-select {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  min-width: 10rem;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--accent);
  outline: none;
}

.filter-hint {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0.25rem 0 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
  max-width: 36ch;
}

.progress-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.progress-label strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6eb8ff);
  border-radius: 999px;
  transition: width 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill {
    transition: none;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #222830;
  border-color: #3d4654;
}

.btn-danger {
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.35);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.08);
}

.category {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.category-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

/* Hide the native disclosure triangle (we draw our own chevron). */
.category-head::-webkit-details-marker {
  display: none;
}

.category-head:hover {
  background: rgba(255, 255, 255, 0.03);
}

.category-head:focus-visible {
  outline: 2px solid var(--accent, #4493f8);
  outline-offset: -2px;
}

.category-chevron {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.category[open] > .category-head .category-chevron {
  transform: rotate(45deg);
}

.category-headings {
  flex: 1 1 auto;
  min-width: 0;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.category-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.category-meta {
  flex: none;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.item:last-child {
  border-bottom: none;
}

.item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.item.done .item-name {
  color: var(--muted);
  text-decoration: line-through;
}

.item input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  accent-color: var(--done);
  cursor: pointer;
  flex-shrink: 0;
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.item-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.item-actions {
  flex-shrink: 0;
}

.item-actions a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.item-actions a:hover {
  text-decoration: underline;
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  .item {
    flex-wrap: wrap;
  }
  .item-actions {
    width: 100%;
    padding-left: 1.85rem;
  }
}
