/*
 * Boom⁴ design system
 */

:root {
  --purple-deep: #3b2466;
  --purple-accent: #7c5cbf;
  --purple-light: #f3eefb;
  --bg-page: #f8f5fc;
  --card-bg: #ffffff;
  --border: #e4ddf0;
  --text: #1f1633;
  --text-muted: #6b5f80;
  --green: #1f7a4d;
  --amber: #b45309;
  --red: #b42318;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

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

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--purple-deep);
  color: white;
  padding: 1.5rem 1rem;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 2rem;
}

.sidebar nav a {
  display: block;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  color: white;
}

.main {
  padding: 2rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
}

.fact-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.fact-list > div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.fact-list dt {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.fact-list dd {
  margin: 0;
}

.fact-list--inline {
  margin-top: 1rem;
}

.fact-list--compact > div {
  grid-template-columns: 7rem 1fr;
}

.issue-stats {
  margin-top: 0.75rem;
}

.issue-hero {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

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

.issue-hero__stats {
  display: flex;
  gap: 0.75rem;
}

.hero-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--purple-light);
  border: 1px solid var(--border);
}

.hero-stat__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple-deep);
  line-height: 1;
}

.hero-stat__label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.issue-hero__title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--text);
}

.issue-hero__panic {
  margin: 0.65rem 0 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.issue-hero__timeline {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.issue-hero__fingerprint {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.issue-hero__fingerprint .seen-label {
  display: block;
  margin-bottom: 0.35rem;
}

.issue-hero__fingerprint .mono {
  display: block;
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-all;
  color: var(--text-muted);
}

.issue-seen-range {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--purple-light);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.seen-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.seen-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.seen-stat time {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.seen-time {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.seen-time__absolute {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.seen-time__relative {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.seen-arrow {
  color: var(--purple-accent);
  font-size: 1.1rem;
  line-height: 1;
}

.task-tags-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.task-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-family: var(--mono);
  color: var(--text-muted);
}

.task-tag--crashed {
  background: var(--purple-light);
  border-color: var(--purple-accent);
  color: var(--purple-deep);
  font-weight: 600;
}

.fact-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.section-heading {
  margin: 2rem 0 0.75rem;
  font-size: 1.1rem;
}

.board-list {
  margin: 0;
  padding-left: 1.1rem;
}

.decode-details {
  margin-bottom: 1.5rem;
}

.decode-raw-output {
  margin-top: 1rem;
}

.decode-raw-output summary {
  cursor: pointer;
  color: var(--purple-accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.crash-timeline {
  margin-bottom: 1.5rem;
}

.crash-timeline-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.crash-timeline-header h3 {
  margin-bottom: 0;
}

.crash-timeline-header .subtitle {
  margin: 0;
}

.crash-timeline-empty {
  margin: 0;
}

.timeline-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
  min-height: 140px;
}

.timeline-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.timeline-count {
  min-height: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--purple-deep);
}

.timeline-bar-wrap {
  width: 100%;
  max-width: 3rem;
  height: 96px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.timeline-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, var(--purple-accent) 0%, var(--purple-deep) 100%);
  transition: height 0.2s ease;
}

.timeline-bar--today {
  box-shadow: 0 0 0 2px rgba(124, 92, 191, 0.25);
}

.timeline-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(59, 36, 102, 0.06);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.card-link:hover {
  border-color: var(--purple-accent);
  box-shadow: 0 6px 16px rgba(59, 36, 102, 0.12);
  transform: translateY(-2px);
  background: var(--purple-light);
}

.card-link:hover .stat {
  color: var(--purple-accent);
}

.card-link-hint {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--purple-accent);
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.15s ease;
}

.card-link:hover .card-link-hint {
  color: var(--purple-deep);
}

.card-link-list {
  margin: 0;
  padding-left: 1.1rem;
}

.card h2, .card h3 {
  margin-top: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat {
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple-deep);
}

.card a {
  color: var(--purple-accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.card a:hover {
  color: var(--purple-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.main a:not(.btn):not(.card-link):hover {
  color: var(--purple-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar nav a {
  transition: background-color 0.15s ease, color 0.15s ease;
}

table a {
  transition: color 0.15s ease;
}

table a:hover {
  color: var(--purple-deep);
}

.btn {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  box-shadow: 0 2px 8px rgba(124, 92, 191, 0.35);
}

.btn-secondary:hover {
  background: var(--purple-light);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--purple-light);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.mono {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-decoded { background: #dcfce7; color: var(--green); }
.badge-waiting { background: #fef3c7; color: var(--amber); }
.badge-failed { background: #fee2e2; color: var(--red); }
.badge-loop { background: #fce7f3; color: #be185d; }

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filters input, .filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.btn {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--purple-accent);
  background: var(--purple-accent);
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.btn-secondary {
  background: white;
  color: var(--purple-accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-grid--single {
  grid-template-columns: 1fr;
}

.stack-trace {
  background: #1f1633;
  color: #f3eefb;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #dcfce7;
  color: var(--green);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 0.5rem; }
  .detail-grid { grid-template-columns: 1fr; }
}
