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

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --border: #262626;
  --text: #e5e5e5;
  --text-muted: #737373;
  --blue: #3b82f6;
  --blue-dim: #1e3a5f;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  flex-shrink: 0;
}

.logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 32px;
  padding: 0 8px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card-hover);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
  background: var(--blue-dim);
}

.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 960px;
}

/* Page */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.back-link {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: inline-block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-card-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: transparent;
}

.btn-danger {
  color: var(--red);
  border-color: var(--red);
  background: transparent;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.status-pending { background: rgba(115, 115, 115, 0.2); color: var(--text-muted); }
.status-running { background: rgba(59, 130, 246, 0.2); color: var(--blue); }
.status-completed { background: rgba(34, 197, 94, 0.2); color: var(--green); }
.status-partial { background: rgba(234, 179, 8, 0.2); color: var(--yellow); }
.status-failed { background: rgba(239, 68, 68, 0.2); color: var(--red); }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* Latest run */
.latest-run {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.run-header h2 {
  font-size: 18px;
  font-weight: 500;
}

/* Progress bar */
.progress-bar-container {
  background: var(--border);
  border-radius: 4px;
  height: 24px;
  position: relative;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar {
  background: var(--blue);
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

/* Overall score */
.overall-score {
  text-align: center;
  margin-bottom: 24px;
}

.overall-score .score-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--blue);
}

.overall-score.large .score-value {
  font-size: 64px;
}

.score-label {
  font-size: 14px;
  color: var(--text-muted);
}

/* Dimension scores */
.dimension-scores {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.dimension-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dimension-name {
  width: 180px;
  font-size: 14px;
  flex-shrink: 0;
}

.dimension-bar-container {
  flex: 1;
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.dimension-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.dimension-bar.pending {
  background: var(--text-muted);
  opacity: 0.3;
}

.dimension-score {
  width: 40px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
}

.friction-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.2);
  color: var(--orange);
  white-space: nowrap;
}

.view-details-btn {
  margin-top: 16px;
}

/* Score pill */
.score-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--blue);
  font-weight: 600;
  font-size: 13px;
}

/* Table */
.table-container {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover td {
  background: var(--bg-card);
}

/* Trend line */
.trend-line {
  opacity: 0.8;
}

/* Run detail */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.result-header:hover {
  background: var(--bg-card-hover);
}

.result-title {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expand-icon {
  font-size: 10px;
  color: var(--text-muted);
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.duration {
  font-size: 12px;
  color: var(--text-muted);
}

.result-score-bar {
  width: 120px;
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.result-score {
  font-size: 14px;
  font-weight: 600;
  width: 50px;
  text-align: right;
}

.result-detail {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.detail-section {
  margin-top: 20px;
}

.detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-section p {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.strengths-list li {
  color: var(--green);
  font-size: 14px;
  margin-left: 20px;
  margin-bottom: 4px;
}

.weaknesses-list li {
  color: var(--orange);
  font-size: 14px;
  margin-left: 20px;
  margin-bottom: 4px;
}

/* Friction points */
.friction-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.friction-item {
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 3px solid;
}

.friction-item.severity-low {
  border-color: var(--yellow);
  background: rgba(234, 179, 8, 0.05);
}

.friction-item.severity-medium {
  border-color: var(--orange);
  background: rgba(249, 115, 22, 0.05);
}

.friction-item.severity-high {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.05);
}

.friction-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.severity-badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.severity-low { background: rgba(234, 179, 8, 0.2); color: var(--yellow); }
.severity-medium { background: rgba(249, 115, 22, 0.2); color: var(--orange); }
.severity-high { background: rgba(239, 68, 68, 0.2); color: var(--red); }

.friction-url {
  font-size: 12px;
  color: var(--text-muted);
}

.friction-desc {
  font-size: 14px;
}

.friction-suggestion {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.pages-list {
  list-style: none;
}

.pages-list li {
  font-size: 13px;
  margin-bottom: 4px;
}

/* Config page */
.dimensions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dimension-card {
  transition: opacity 0.2s;
}

.dimension-card.disabled {
  opacity: 0.5;
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.dimension-header h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.dim-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dim-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.dimension-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-btn {
  padding: 4px 12px;
  border-radius: 12px;
  border: none;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.toggle-btn.on {
  background: rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.toggle-btn.off {
  background: rgba(115, 115, 115, 0.2);
  color: var(--text-muted);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.add-form {
  margin-bottom: 24px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--text-muted);
}
