/*
 * 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 minmax(0, 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;
  min-width: 0;
}

.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: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

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

.seen-time__relative {
  font-size: 0.9em;
  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;
}

.suspect-summary {
  margin-bottom: 1.5rem;
}

.suspect-summary__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.suspect-summary__title {
  margin: 0;
  font-size: 1.6rem;
  font-family: var(--mono);
  flex: 1;
  min-width: 0;
}

.suspect-summary__chip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.suspect-summary__chip:hover {
  border-color: var(--text-muted);
  background: var(--bg);
}

.suspect-summary__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

.suspect-summary__sep {
  margin: 0;
}

.decode-accordion {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.decode-accordion > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.decode-accordion__body {
  margin-top: 1rem;
}

.upload-details {
  margin-top: 1rem;
}

.repro-command {
  margin-top: 1.25rem;
}

.repro-command__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.repro-command__header h4 {
  margin: 0;
  flex: 1;
}

.repro-command__feedback {
  color: var(--green);
  font-size: 0.85rem;
}

.repro-command__command {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.decode-attempt-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.related-issues ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.issue-triage {
  margin-bottom: 1.5rem;
}

.issue-triage__form p {
  margin: 0 0 0.75rem;
}

.issue-triage__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.symbol-coverage__hint {
  margin-top: 1rem;
}

.symbol-coverage__hint code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.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;
}

.occurrence-graph {
  margin-bottom: 1.5rem;
}

.occurrence-graph__summary {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.occurrence-graph__summary strong {
  color: var(--purple-deep);
  font-size: 1.05rem;
}

.timeline-chart--suspect {
  grid-template-columns: repeat(var(--timeline-cols, 7), minmax(0, 1fr));
  gap: 0.25rem;
  min-height: 120px;
  align-items: end;
}

.timeline-chart--suspect .timeline-bar-wrap {
  width: 100%;
  max-width: none;
  height: 88px;
  min-height: 88px;
}

.timeline-chart--suspect .timeline-count {
  min-height: 1.1rem;
  font-size: 0.65rem;
  line-height: 1;
}

.timeline-chart--suspect .timeline-label {
  font-size: 0.65rem;
  min-height: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.timeline-chart--suspect .timeline-bar {
  min-height: 0;
  border-radius: 4px 4px 2px 2px;
}

.timeline-bar--peak {
  box-shadow: 0 0 0 1px rgba(124, 92, 191, 0.35);
}

.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);
  min-width: 0;
  max-width: 100%;
}

.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);
}

th.sortable {
  padding: 0;
}

th.sortable .sortable-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

th.sortable .sortable-link:hover {
  color: var(--purple-deep);
  background: rgba(124, 92, 191, 0.08);
}

th.sortable.is-sorted .sortable-link {
  color: var(--purple-deep);
}

th.sortable .sort-indicator {
  font-size: 0.75rem;
  opacity: 0.35;
  text-transform: none;
  letter-spacing: 0;
}

th.sortable.is-sorted .sort-indicator {
  opacity: 1;
}

.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;
}

.build-label__version {
  font-weight: 600;
  margin-right: 0.25rem;
}

.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;
  align-items: center;
}

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

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.pagination__summary,
.pagination__page {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.pagination__links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.pagination__link.is-disabled {
  color: var(--text-muted);
  font-weight: 500;
  cursor: default;
}

.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: 2.5rem;
}

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

.stack-trace {
  background: #1f1633;
  color: #f3eefb;
  padding: 1rem;
  border-radius: 8px;
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-family: var(--mono);
  font-size: 0.85rem;
}

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

.flash-alert {
  background: #fee2e2;
  color: var(--red);
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(124, 92, 191, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(59, 36, 102, 0.18), transparent 50%),
    var(--bg-page);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 18px 40px rgba(31, 22, 51, 0.08);
}

.login-brand {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--purple-deep);
  background: var(--purple-light);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

.login-lede {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-field {
  display: grid;
  gap: 0.4rem;
}

.login-field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
}

.login-field input:focus {
  outline: 2px solid rgba(124, 92, 191, 0.35);
  border-color: var(--purple-accent);
}

.login-submit {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.9rem;
  border: none;
  cursor: pointer;
  font: inherit;
}

.sidebar-sign-out {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.sidebar-sign-out:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.crash-map-card {
  overflow: hidden;
}

.crash-map {
  position: relative;
}

.crash-map__canvas {
  width: 100%;
  height: 420px;
  border-radius: 8px;
  z-index: 0;
}

.crash-map .leaflet-container {
  background: var(--purple-deep);
  font-family: inherit;
}

.crash-map .leaflet-popup-content-wrapper {
  background: rgba(31, 22, 51, 0.95);
  color: #f3eefb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(59, 36, 102, 0.35);
}

.crash-map .leaflet-popup-tip {
  background: rgba(31, 22, 51, 0.95);
}

.crash-map .leaflet-popup-content {
  margin: 0.65rem 0.75rem;
  line-height: 1.45;
}

.crash-map .leaflet-popup-content a {
  color: #c4b5fd;
}

.crash-map .leaflet-popup-content strong {
  color: white;
}

.crash-map__summary {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ip-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
  align-items: stretch;
}

.ip-overview .crash-map-card,
.ip-overview .card {
  margin: 0;
}

.ip-overview .crash-map__canvas {
  height: 340px;
}

.ip-overview .fact-list > div {
  grid-template-columns: 10.5rem 1fr;
}

.ip-map-placeholder {
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.ip-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

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