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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.55;
}

.error-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: #dc2626;
  font-family: monospace;
  font-size: 0.95rem;
  padding: 2rem;
  text-align: center;
}

.signin-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.signin-card {
  background: white;
  border-radius: 12px;
  padding: 2.5rem 2.25rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.signin-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.signin-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.signin-button {
  display: inline-block;
  background: #0f172a;
  color: white;
  text-decoration: none;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s;
}

.signin-button:hover {
  background: #1e293b;
}

.signin-hint {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 1.25rem;
}

.loading {
  text-align: center;
  padding: 4rem;
  color: #64748b;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.controls {
  display: flex;
  gap: 0.75rem;
}

.controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
  color: #334155;
  cursor: pointer;
}

.section {
  margin-bottom: 2.75rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #e2e8f0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  border-left: 4px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.kpi-done { border-left-color: #16a34a; }
.kpi-progress { border-left-color: #4f46e5; }
.kpi-todo { border-left-color: #94a3b8; }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.chart-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 1rem;
}

.chart-card canvas {
  max-height: 220px;
}

.chart-legend {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #64748b;
}

.chart-legend strong {
  color: #f59e0b;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.team-member {
  background: white;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.member-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.member-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
}

.member-stats {
  font-size: 0.875rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.divider {
  margin: 0 0.35rem;
}

.member-stories {
  list-style: none;
}

.member-story-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.member-story-item + .member-story-item {
  border-top: 1px solid #f8fafc;
}

.story-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-done { background: #16a34a; }
.dot-in_progress { background: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.dot-todo { background: #94a3b8; }
.dot-draft { background: #cbd5e1; }

.story-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  cursor: pointer;
}

.story-title-text {
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 0 1 auto;
}

.external-icon {
  font-size: 0.78em;
  color: #cbd5e1;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}

a.story-title:hover .external-icon,
a.epic-title:hover .external-icon {
  color: #3b82f6;
  transform: translate(1px, -1px);
}

.member-story-item.is-in-progress .story-title-text {
  color: #0f172a;
  font-weight: 600;
}

.member-story-item.is-done .story-title-text {
  color: #94a3b8;
}

.story-badges {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.badge {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.badge-adhoc {
  background: #fef3c7;
  color: #854d0e;
}

.badge-discovery {
  background: #f3e8ff;
  color: #6b21a8;
}

.badge-priority-p0 {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-priority-p1 {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.story-points {
  font-size: 0.8rem;
  color: #94a3b8;
  flex-shrink: 0;
  min-width: 3.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.story-status-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
  flex-shrink: 0;
  min-width: 5rem;
  text-align: right;
}

.member-story-item.is-in-progress .story-status-label {
  color: #4f46e5;
  font-weight: 600;
}

.epic-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.epic-card {
  background: white;
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.epic-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.epic-title {
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.epic-meta {
  font-size: 0.8rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #15803d);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.epic-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-top: 0.4rem;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  color: #94a3b8;
  font-size: 0.875rem;
  padding: 1rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.refresh-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: white;
  font-size: 0.8rem;
  color: #475569;
  cursor: pointer;
}

.refresh-btn:hover {
  background: #f1f5f9;
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    width: 100%;
  }

  .controls select {
    flex: 1;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .member-story-item {
    flex-wrap: wrap;
  }

  .story-status-label {
    min-width: auto;
  }
}
