:root {
  --accent: #c00;
  --accent-soft: #ffe5e5;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e4e6ea;
  --text: #1a1c22;
  --text-muted: #666c78;
  --pass: #1a8a4a;
  --pass-bg: #e6f6ec;
  --fail: #c00;
  --fail-bg: #ffe9e9;
  --na: #8a8f98;
  --na-bg: #eceef1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.06), 0 6px 20px rgba(20, 20, 30, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button { font-family: inherit; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 12px; color: var(--text-muted); }

.project-select {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  max-width: 160px;
  flex-shrink: 0;
  cursor: pointer;
}
.project-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.project-select option:disabled { color: var(--text-muted); }

.topbar-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-numbers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  flex-shrink: 0;
  min-width: 70px;
}
#progress-count { font-weight: 700; font-size: 14px; }
.progress-label { font-size: 11px; color: var(--text-muted); }

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff8a5c);
  transition: width 0.25s ease;
}

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--border); }

/* Layout */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.tester-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.tester-card label {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}
.tester-card input, .tester-card select {
  font: inherit;
  font-weight: 400;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.tester-card input { cursor: text; }
.tester-card input:focus, .tester-card select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.section-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-item .nav-badge {
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-item.active .nav-badge { color: var(--accent); }
.nav-item.done .nav-dot { background: var(--pass); }
.nav-dot {
  width: 7px; height: 7px; border-radius: 99px; background: var(--border); flex-shrink: 0;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.ghost-btn:hover { background: var(--surface-2); }
.ghost-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ghost-btn.danger { color: var(--fail); }
.ghost-btn.danger:hover { background: var(--fail-bg); }
.ghost-btn.result-highlight {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(204, 0, 0, 0.35);
}
.ghost-btn.result-highlight:hover { filter: brightness(1.08); }

.hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 2px;
}

/* Content */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.content.checklist-locked {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.required-mark { color: var(--fail); font-weight: 700; }

.tester-info-notice {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 84px;
}

.section-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.section-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
}
.section-header .blurb {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.section-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  white-space: nowrap;
}
.admin-delete-section-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fail);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.admin-delete-section-btn:hover { background: var(--fail-bg); border-color: var(--fail); }

.items { display: flex; flex-direction: column; }

.item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.item:last-child { border-bottom: none; }
.item.admin-editable { background: var(--surface-2); }
.item.dragging { opacity: 0.4; }
.item.drag-over-top { box-shadow: inset 0 2px 0 var(--accent); }
.item.drag-over-bottom { box-shadow: inset 0 -2px 0 var(--accent); }

.drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
  padding-top: 2px;
}
.drag-handle:active { cursor: grabbing; }

.admin-item-actions { display: flex; gap: 6px; margin-top: 4px; }
.admin-edit-btn, .admin-delete-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.admin-edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-delete-btn:hover { border-color: var(--fail); color: var(--fail); background: var(--fail-bg); }

.admin-edit-input {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 44px;
}

.admin-add-item {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  align-items: center;
}
.admin-add-input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--text);
}
.admin-add-btn {
  flex-shrink: 0;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.admin-add-btn:hover { background: var(--accent); color: #fff; }

.admin-add-section {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.admin-add-section-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.admin-add-section input {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.admin-add-section input#admin-new-section-title { font-size: 14px; font-weight: 600; }
.admin-add-section input#admin-new-section-blurb { font-size: 12.5px; font-weight: 400; }
.admin-add-section-btn {
  flex-shrink: 0;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 7px;
  cursor: pointer;
}
.admin-add-section-btn:hover { filter: brightness(1.08); }

.item-body { flex: 1; min-width: 0; }
.item-text {
  font-size: 13.5px;
  line-height: 1.45;
}
.item-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 99px;
}
.tag.critical { background: var(--accent-soft); color: var(--accent); }
.tag.platform { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.tag-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.tag-toggle:hover { border-color: var(--accent); color: var(--accent); }
.tag-toggle.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

.item-note-static {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  padding: 6px 9px;
  border-radius: 4px;
}

.status-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.status-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.status-btn:hover { filter: brightness(0.97); }

.status-btn[data-status="pass"].active { background: var(--pass-bg); color: var(--pass); border-color: var(--pass); }
.status-btn[data-status="fail"].active { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }
.status-btn[data-status="na"].active { background: var(--na-bg); color: var(--na); border-color: var(--na); }

.note-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.note-toggle.has-note { color: var(--accent); border-color: var(--accent); }

.item-full { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.item-note-input {
  display: none;
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
  min-height: 40px;
}
.item-note-input.open { display: block; }

.item-attachments {
  display: none;
  flex-direction: column;
  gap: 8px;
}
.item-attachments.open { display: flex; }

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
}
.attachment-chip a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.attachment-size { color: var(--text-muted); flex-shrink: 0; }
.attachment-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  padding: 0 2px;
}
.attachment-remove:hover { color: var(--fail); }
.attachment-uploading { color: var(--text-muted); font-style: italic; }

.attach-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.attach-btn:hover { background: var(--border); }
.attach-hint { font-size: 11px; color: var(--text-muted); }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
}

/* Responsive */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .sidebar {
    position: static;
    max-height: none;
  }
  .brand-text span { display: none; }
  .project-select { max-width: 110px; font-size: 11.5px; padding: 5px 6px; }
  .item { flex-wrap: wrap; }
}
