:root {
  --bg: #f4f0e8;
  --paper: #fffaf0;
  --ink: #1a1a1a;
  --muted: #5b5b5b;
  --accent: #0f8a5f;
  --warn: #c4542f;
  --edge: #d8d0c0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 0% 0%, #fbe39a, transparent 30%),
    radial-gradient(circle at 100% 100%, #9fd7c0, transparent 35%),
    var(--bg);
}

.bg-orb {
  position: fixed;
  width: 45vw;
  height: 45vw;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.25;
  pointer-events: none;
}

.orb-a {
  background: #f0a500;
  top: -15vw;
  left: -15vw;
}

.orb-b {
  background: #00a896;
  right: -20vw;
  bottom: -20vw;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #00000012;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 20px #0000000d;
  animation: rise 0.45s ease;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi {
  background: #ffffff;
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px;
}

.kpi.kpi-wide {
  grid-column: span 2;
}

.kpi .label {
  color: var(--muted);
  font-size: 0.85rem;
}

.kpi .value {
  font-size: 1.9rem;
  font-weight: 700;
}

.kpi .value.small {
  font-size: 1rem;
  line-height: 1.3;
}

.top-list {
  margin: 0 0 20px;
  padding-left: 20px;
}

.top-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--edge);
}

.top-list .name {
  font-weight: 500;
}

.top-list .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.crash-signature-columns {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.crash-signature-columns h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.crash-signature-columns .top-list {
  margin-bottom: 0;
}

button {
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 12px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

input[type="text"] {
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  min-width: 220px;
}

textarea {
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  width: 100%;
  resize: vertical;
}

button.ghost {
  background: #ffffffb8;
  color: var(--ink);
  border: 1px solid var(--edge);
}

button#navAlerts {
  position: relative;
}

button#navAlerts.has-alert::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d90429;
  box-shadow: 0 0 0 2px #fff;
}

button.ghost.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.warn {
  background: var(--warn);
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--edge);
  padding: 10px 8px;
  font-size: 0.95rem;
}

a {
  color: #005f73;
}

.section-title {
  margin: 0 0 10px;
}

.section-subtitle {
  margin: 18px 0 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.grid-images img {
  width: auto;
  max-width: 40%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--edge);
}

pre.json {
  margin: 0;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
}

td code {
  font-size: 0.85rem;
}

.audio-link-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-link-group audio {
  max-width: 320px;
}

.page-list {
  display: grid;
  gap: 12px;
}

.page-card {
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #ffffff;
}

.page-card h4 {
  margin: 0 0 8px;
}

.page-card p {
  margin: 0;
  white-space: pre-wrap;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.window-filters {
  margin-bottom: 10px;
}

.dashboard-search-row,
.users-toolbar {
  margin-bottom: 10px;
}

.users-pagination {
  margin-top: 10px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.message-editor {
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
}

.message-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.message-editor-header h3 {
  margin: 0;
}

.message-editor-grid {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.message-editor-grid label {
  display: grid;
  gap: 6px;
}

.dlq-editor {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  padding: 12px;
}

.trace-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--edge);
  background: #f5f5f5;
}

.trace-status-success {
  background: #e6f6ef;
  color: #0b6b49;
  border-color: #9bd5bc;
}

.trace-status-failed {
  background: #fcebe7;
  color: #9f2f1e;
  border-color: #e9b2a8;
}

.trace-status-retry {
  background: #fff6df;
  color: #7a5a0a;
  border-color: #ead08e;
}

.trace-status-started {
  background: #e8f1ff;
  color: #24539f;
  border-color: #b7c9eb;
}

.trace-status-warning {
  background: #fff6df;
  color: #7a5a0a;
  border-color: #ead08e;
}

.flow-card {
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
}

.flow-card h3,
.flow-card h4 {
  margin: 0 0 8px;
}

.flow-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.flow-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trace-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fafafa;
  font-size: 0.82rem;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.queue-card {
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.queue-card h3 {
  margin: 0 0 8px;
}

.queue-message {
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fcfcfc;
}

.queue-message:last-child {
  margin-bottom: 0;
}

.crash-stack {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: #00000070;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 80vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  margin-top: 10px;
}

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

.hidden {
  display: none;
}

.timestamp-area {
  width: min(460px, 100%);
  min-height: 82px;
  resize: vertical;
  font-family: monospace;
  font-size: 0.8rem;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi.kpi-wide {
    grid-column: span 2;
  }

  .crash-signature-columns {
    grid-template-columns: 1fr;
  }

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

  .grid-images {
    display: block;
  }

  .grid-images img {
    max-width: 40%;
    margin-bottom: 10px;
  }
}
