* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070d18;
  color: #e8eefc;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 20px;
  background: #0d1628;
  border-bottom: 1px solid #22304d;
}

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

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar-content {
  margin-top: 12px;
}

.topbar.collapsed .topbar-content {
  display: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.controls label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #a8b6d8;
  min-width: 190px;
}

.controls input,
.controls select {
  margin-top: 4px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #2b3e64;
  background: #0f1a31;
  color: #eff4ff;
}

button {
  border: 1px solid #2f4e8d;
  background: #15326e;
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover {
  background: #1d428f;
}

.status {
  margin-top: 8px;
  font-size: 12px;
  color: #8aa8e8;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(860px, 1.8fr);
  align-items: start;
  gap: 12px;
  padding: 12px;
}

.stack-card {
  margin-bottom: 12px;
  border: 1px solid #21314f;
  border-radius: 10px;
  background: #0b1324;
  overflow: hidden;
}

.stack-card-skeleton {
  border-color: #1a2a46;
}

.stack-header {
  padding: 10px 14px;
  background: #101c33;
  border-bottom: 1px solid #22324f;
  font-weight: 700;
  font-size: 14px;
}

.lambda-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #1a2740;
  cursor: pointer;
}

.lambda-row:last-child {
  border-bottom: none;
}

.lambda-row:hover {
  background: #121e36;
}

.lambda-row-skeleton {
  cursor: default;
}

.lambda-row-skeleton:hover {
  background: transparent;
}

.uptime-badge {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 7px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  min-width: 68px;
}

.uptime-ok {
  background: #00b067;
  color: #02200e;
}

.uptime-warn {
  background: #f3a21a;
  color: #231300;
}

.uptime-critical {
  background: #b74646;
  color: #ffeaea;
}

.lambda-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.lambda-sep {
  color: #6f87b7;
  font-size: 12px;
}

.lambda-name {
  font-size: 13px;
  font-weight: 600;
  color: #f4f7ff;
  flex-shrink: 0;
}

.lambda-error-summary {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lambda-error-count {
  font-size: 12px;
  color: #a9bbe0;
  flex-shrink: 0;
  white-space: nowrap;
  text-align: right;
}

.bars {
  display: flex;
  gap: 2px;
  min-height: 16px;
  flex: 1 1 auto;
  min-width: 0;
}

.lambda-line2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar {
  flex: 1 1 0;
  min-width: 1px;
  height: 16px;
  border-radius: 2px;
}

.bar-ok {
  background: #2bc77d;
}

.bar-error {
  background: #f3a21a;
}

.bar-error-critical {
  background: #b74646;
}

.skeleton-block {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, #152746 25%, #223a63 37%, #152746 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-header {
  width: 220px;
  height: 14px;
}

.skeleton-badge {
  width: 68px;
  height: 18px;
  border-radius: 999px;
  flex-shrink: 0;
}

.skeleton-name {
  width: 140px;
  height: 14px;
  flex-shrink: 0;
}

.skeleton-error-count {
  width: 48px;
  height: 12px;
  flex-shrink: 0;
}

.skeleton-error-summary {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bar-skeleton {
  background: #223a63;
  animation: skeleton-pulse 1.1s ease-in-out infinite alternate;
}

.detail-panel {
  border: 1px solid #243458;
  border-radius: 10px;
  background: #0b1324;
  position: sticky;
  top: var(--painel-detail-top, 120px);
  max-height: calc(100vh - var(--painel-detail-top, 120px) - 12px);
  overflow: auto;
  padding: 12px;
  min-width: 760px;
}

.hidden {
  display: none;
}

.detail-sticky {
  position: sticky;
  top: -12px;
  z-index: 4;
  background: #0b1324;
  margin: -12px -12px 8px -12px;
  padding: 12px 12px 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #1a2740;
}

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

.detail-heading {
  min-width: 0;
}

.detail-heading h2 {
  margin: 0;
}

.detail-log-group {
  margin-top: 4px;
  font-size: 12px;
  color: #9eb2d9;
  word-break: break-all;
}

.detail-controls {
  margin-bottom: 0;
}

.detail-controls input {
  display: block;
  width: 100%;
  border: 1px solid #2b3e64;
  background: #111b32;
  color: #eff4ff;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
}

.recent-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-pagination {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.event-card {
  border: 1px solid #27406e;
  background: #0f1a31;
  border-radius: 10px;
  padding: 10px;
}

.event-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.event-card-time {
  font-size: 12px;
  color: #9eb2d9;
}

.event-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.event-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.event-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #30528f;
  border-radius: 8px;
  background: #13284b;
  color: #dbe8ff;
}

.event-copy-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.event-copy-btn:hover {
  background: #1b3a69;
}

.event-copy-btn:disabled {
  cursor: default;
  opacity: 0.9;
}

.event-copy-btn.copied {
  border-color: #2f935f;
  background: #1d5a3d;
  color: #e4fff0;
}

.event-copy-btn.copy-failed {
  border-color: #b74646;
  background: #6f2f2f;
  color: #ffeaea;
}

.event-card-count {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  background: #243c66;
  color: #dbe8ff;
}

.event-card-status {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

.status-ok {
  background: #2f935f;
  color: #e4fff0;
}

.status-4xx {
  background: #b98523;
  color: #2b1800;
}

.status-5xx {
  background: #b74646;
  color: #ffeaea;
}

.status-unknown {
  background: #4d638f;
  color: #ecf2ff;
}

.event-meta {
  font-size: 11px;
  color: #94a8d0;
  margin-bottom: 8px;
}

.event-meta strong {
  color: #d6e3ff;
}

.event-message {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0c1528;
  border: 1px solid #24395e;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.empty-state {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f1a31;
  border: 1px dashed #375282;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  color: #a9bbe0;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

@keyframes skeleton-pulse {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    top: auto;
    max-height: none;
    height: auto;
    min-width: 0;
  }
}
