:root {
  --bg: #f5f6f8;
  --text: #111111;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card: #ffffff;
  --pass: #1b8f5a;
  --fail: #e5484d;
  --skip: #f2b705;
  --block: #f59e0b;
  --high: #d93f3f;
  --med: #f08c2e;
  --low: #2f7ed8;
  --c1: #2f7ed8;
  --c2: #28a66a;
  --c3: #f59e0b;
  --p1: #b3c6e6;
  --p2: #b7e4c7;
  --p3: #f7d8a0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

h1, h2, h3 {
  margin: 0 0 8px 0;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
  text-align: right;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-value {
  font-size: 13px;
  font-weight: 600;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
}

.toolbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.toolbar-item:hover .toolbar-text {
  color: var(--text);
}

.toolbar-text {
  display: none;
}

.card {
  background: var(--card);
  border: 1px solid #ededed;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 6px 16px rgba(17, 17, 17, 0.08);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}

.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.card-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.card-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.item-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-sub {
  font-size: 11px;
  color: var(--muted);
}

.stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ai-summary {
  margin: 0;
  line-height: 1.4;
}

.card-header {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mini-table {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  align-items: center;
}

.row.head {
  font-weight: 600;
}

.row-label {
  color: var(--muted);
}

.row-sub {
  font-size: 11px;
  color: var(--muted);
}

.big {
  font-size: 18px;
  font-weight: 600;
}

.twosectiontypedchart {
  display: flex;
  height: 8px;
  background: #f3f4f6;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  position: relative;
  cursor: help;
}

.twosectiontypedchart:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.twosectiontypedchart .seg {
  height: 100%;
  background: #ddd;
}

.twosectiontypedchart .c1 { background: var(--c1); }
.twosectiontypedchart .c2 { background: var(--c2); }
.twosectiontypedchart .c3 { background: var(--c3); }
.twosectiontypedchart .p1 { background: var(--p1); }
.twosectiontypedchart .p2 { background: var(--p2); }
.twosectiontypedchart .p3 { background: var(--p3); }

.line-bar {
  display: flex;
  height: 10px;
  background: #f3f4f6;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #ececec;
  position: relative;
  cursor: help;
}

.line-bar:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.line-bar .seg { height: 100%; }
.line-bar .pass { background: var(--pass); }
.line-bar .fail { background: var(--fail); }
.line-bar .skip { background: var(--skip); }
.line-bar .block { background: var(--block); }
.line-bar .high { background: var(--high); }
.line-bar .med { background: var(--med); }
.line-bar .low { background: var(--low); }

.legend {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.legend.compact { margin-top: 4px; }

.chip {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 6px;
}

.chip.pass { color: var(--pass); border-color: #d2f3e2; }
.chip.fail { color: var(--fail); border-color: #f6d1d2; }
.chip.block { color: #b45309; border-color: #f7e6c2; }
.chip.skip { color: #a16207; border-color: #f7e6c2; }

.toolbar {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.id-link {
  color: #7c3aed;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.id-link:hover {
  text-decoration: underline;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--border);
  color: var(--text);
}

.tag-icon {
  margin-right: 4px;
}

.tag-type {
  background: #dbeafe;
  color: #1e40af;
}

.tag-status {
  background: #f0fdf4;
  color: #166534;
}

.tag-priority {
  background: #fef3c7;
  color: #92400e;
}

.tag-status-passed {
  background: #dcfce7;
  color: #166534;
}

.tag-status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.tag-status-blocked {
  background: #fef08a;
  color: #854d0e;
}

.tag-status-progress {
  background: #dbeafe;
  color: #1e40af;
}

.tag-status-open {
  background: #fce7f3;
  color: #831843;
}

.tag-status-merged {
  background: #f3e8ff;
  color: #6b21a8;
}

.tag-status-review {
  background: #f3e8ff;
  color: #6b21a8;
}

.tag-changed {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

.tag-unchanged {
  background: #f3f4f6;
  color: #6b7280;
}

.ghost {
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.feature-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.feature-card .feature-title {
  grid-column: 1 / -1;
  font-weight: 600;
  font-size: 13px;
}

.feature-card .block {
  display: grid;
  gap: 4px;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.breakdown-category {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.category-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-label {
  font-size: 12px;
  color: var(--text);
}

.gap-list {
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.gap-item {
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: var(--card);
}

.comparison-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comparison-bar-group {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  align-items: center;
}

.comparison-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.comparison-list {
  display: grid;
  gap: 8px;
}

.comparison-item {
  display: grid;
  gap: 4px;
}

.wave {
  width: 100%;
  height: 140px;
}

.wave-line {
  fill: none;
  stroke: #111111;
  stroke-width: 2;
}

.wave-line.alt {
  stroke: #9aa0a6;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
}

.jira-chart {
  display: grid;
  gap: 8px;
}

.jira-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.priority-bar {
  display: flex;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.priority-bar .p1 { background: #d93f3f; }
.priority-bar .p2 { background: #f08c2e; }
.priority-bar .p3 { background: #f2b705; }
.priority-bar .p4 { background: #2f7ed8; }

@media (max-width: 1000px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .breakdown-grid {
    grid-template-columns: 1fr;
  }
  .feature-card {
    grid-template-columns: 1fr;
  }
  .meta {
    grid-template-columns: 1fr;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats {
    grid-template-columns: 1fr;
  }
}
