* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e1a;
  --surface: #141829;
  --surface-hover: #1c2137;
  --border: #2a2f45;
  --text: #e0e4f0;
  --text-dim: #8890a8;
  --cyan: #00e5ff;
  --gold: #ffd700;
  --green: #00e676;
  --red: #ff4757;
  --orange: #ff9100;
  --purple: #b388ff;
  --pink: #ff6090;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Header ---- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.97); }
.btn-cyan { background: var(--cyan); color: var(--bg); }
.btn-gold { background: var(--gold); color: var(--bg); }
.btn-green { background: var(--green); color: var(--bg); }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Top bar (mini leaderboard + stats) ---- */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}
.top-bar::-webkit-scrollbar { height: 0; }

.top-bar-leaders {
  display: flex;
  gap: 16px;
  align-items: center;
}
.top-bar-leader {
  display: flex;
  align-items: center;
  gap: 4px;
}
.top-bar-leader .medal { font-size: 14px; }
.top-bar-leader .name { font-weight: 600; font-size: 12px; }
.top-bar-leader .score { color: var(--gold); font-weight: 700; font-size: 12px; }

.top-bar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}
.top-bar-stats {
  display: flex;
  gap: 16px;
  color: var(--text-dim);
  font-size: 12px;
  margin-left: auto;
}
.top-bar-stats .highlight { color: var(--green); font-weight: 600; }
.top-bar-stats .warn { color: var(--orange); font-weight: 600; }

/* ---- Main content (two-column) ---- */
.main-content {
  display: flex;
  height: calc(100vh - 82px);
  overflow: hidden;
}

/* ---- Left sidebar ---- */
.test-sidebar {
  width: 420px;
  min-width: 320px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.sidebar-filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--surface);
}

.filter-btn {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.filter-btn.active {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
  font-weight: 600;
}
.filter-divider {
  width: 1px;
  background: var(--border);
  margin: 0 2px;
  align-self: stretch;
}

.sidebar-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.sidebar-search input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.sidebar-search input:focus {
  outline: none;
  border-color: var(--cyan);
}

.test-list {
  flex: 1;
  overflow-y: auto;
}

/* ---- Suite groups ---- */
.suite-group {
  border-bottom: 1px solid var(--border);
}

.suite-header {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: background 0.15s;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 3;
}
.suite-header:hover { background: var(--surface-hover); }

/* Parent suite = bold, slightly larger */
.suite-header.parent-suite {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cyan);
  border-left: 3px solid var(--cyan);
}

/* Child suite = indented, subtler */
.child-suite-group {
  border-bottom: none;
}
.suite-header.child-suite {
  padding-left: 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 229, 255, 0.03);
  position: sticky;
  top: 39px;
  z-index: 2;
  border-left: 3px solid transparent;
}
.suite-header.child-suite:hover {
  background: var(--surface-hover);
}

.suite-header .arrow {
  font-size: 9px;
  transition: transform 0.2s;
  color: var(--text-dim);
  width: 14px;
  text-align: center;
}
.suite-header .arrow.collapsed { transform: rotate(-90deg); }

.suite-header .suite-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suite-header .count {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 11px;
  flex-shrink: 0;
}

/* ---- Test list items ---- */
.test-list-item {
  padding: 7px 14px 7px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}

/* Child suite tests get extra indent */
.child-test-item {
  padding-left: 36px;
}
.test-list-item:hover { background: var(--surface-hover); }
.test-list-item.selected {
  background: rgba(0, 229, 255, 0.08);
  border-left-color: var(--cyan);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.available { border: 2px solid var(--cyan); background: transparent; }
.status-dot.reserved { background: var(--orange); }
.status-dot.in_progress { background: var(--purple); }
.status-dot.submitted { background: var(--pink); }
.status-dot.completed { background: var(--green); }
.status-dot.irrelevant { background: var(--text-dim); width: 8px; height: 2px; border-radius: 1px; }

.platform-mini {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.platform-mini.ios { background: #1a3a5c; color: #4fc3f7; }
.platform-mini.android { background: #1a3c1a; color: #81c784; }

.test-list-item .case-id {
  color: var(--text-dim);
  font-size: 11px;
  min-width: 52px;
  flex-shrink: 0;
  font-weight: 600;
}

.test-list-item .test-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.test-list-item .pts {
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.test-list-item .assignee-mini {
  font-size: 12px;
  flex-shrink: 0;
}

/* ---- Right detail panel ---- */
.detail-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.detail-content {
  padding: 24px 28px;
  max-width: 920px;
}

/* Detail header */
.detail-header { margin-bottom: 20px; }

.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  flex: 1;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-links {
  display: flex;
  gap: 14px;
  font-size: 13px;
  flex-wrap: wrap;
}
.detail-links a {
  color: var(--cyan);
  text-decoration: none;
}
.detail-links a:hover { text-decoration: underline; }

/* Tags */
.tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.tag-ios { background: #1a3a5c; color: #4fc3f7; }
.tag-android { background: #1a3c1a; color: #81c784; }

.points-badge {
  font-weight: 800;
  font-size: 15px;
  color: var(--gold);
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-available { background: rgba(0, 229, 255, 0.15); color: var(--cyan); }
.status-reserved { background: rgba(255, 145, 0, 0.15); color: var(--orange); }
.status-in_progress { background: rgba(179, 136, 255, 0.15); color: var(--purple); }
.status-submitted { background: rgba(255, 96, 144, 0.15); color: var(--pink); }
.status-completed { background: rgba(0, 230, 118, 0.15); color: var(--green); }
.status-irrelevant { background: rgba(136, 144, 168, 0.15); color: var(--text-dim); }

/* ---- Detail sections ---- */
.detail-section {
  margin-bottom: 24px;
}
.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.detail-section-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-section-empty {
  color: var(--text-dim);
  font-style: italic;
  font-size: 13px;
}

/* ---- Steps ---- */
.step-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.step-item:last-child { border-bottom: none; }

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-content {
  flex: 1;
  min-width: 0;
}
.step-action {
  font-size: 14px;
  line-height: 1.6;
}
.step-data {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(179, 136, 255, 0.08);
  border-left: 3px solid var(--purple);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
.step-data strong { color: var(--purple); }

.step-expected {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(0, 230, 118, 0.06);
  border-left: 3px solid var(--green);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.step-expected strong {
  color: var(--green);
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.sub-steps {
  margin-top: 10px;
  margin-left: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

/* ---- QA Review in detail ---- */
.qa-info {
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ---- Dashboard panels (default view) ---- */
.dashboard-view {
  padding: 24px 28px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.panel-header {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-body {
  padding: 10px 14px;
  max-height: 350px;
  overflow-y: auto;
}

/* ---- Leaderboard ---- */
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.lb-rank.gold { background: var(--gold); color: var(--bg); }
.lb-rank.silver { background: #c0c0c0; color: var(--bg); }
.lb-rank.bronze { background: #cd7f32; color: #fff; }
.lb-rank.default { background: var(--border); color: var(--text-dim); }
.lb-name { font-weight: 600; font-size: 14px; }
.lb-score { font-weight: 800; font-size: 16px; color: var(--gold); }
.lb-details { font-size: 11px; color: var(--text-dim); }
.lb-quality-positive { color: var(--green); }
.lb-quality-negative { color: var(--red); }

/* ---- Activity Feed ---- */
.activity-item {
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-time {
  font-size: 11px;
  color: var(--border);
  margin-left: 4px;
}

/* ---- Pending Issues ---- */
.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.pending-item:last-child { border-bottom: none; }
.pending-info { flex: 1; font-size: 13px; }
.pending-critical { color: var(--red); font-weight: 600; }
.pending-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- Quality Log ---- */
.quality-item {
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.quality-item:last-child { border-bottom: none; }
.quality-points { font-weight: 700; font-size: 13px; min-width: 38px; }
.quality-positive { color: var(--green); }
.quality-negative { color: var(--red); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: 18px; color: var(--cyan); }
.modal label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.modal input, .modal select, .modal textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.modal textarea { min-height: 60px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Registration ---- */
.registration {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 20px;
}
.registration h1 { font-size: 32px; color: var(--cyan); }
.registration-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.registration-form label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.registration-form input, .registration-form select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 15px;
}
.emoji-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-pick {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.emoji-pick:hover { border-color: var(--border); }
.emoji-pick.selected { border-color: var(--cyan); background: rgba(0, 229, 255, 0.1); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  z-index: 200;
  animation: slideIn 0.3s ease;
}
.toast-error { border-color: var(--red); }
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .main-content { flex-direction: column; height: auto; }
  .test-sidebar { width: 100%; min-width: 0; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  .detail-panel { min-height: 50vh; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
