body.logs-page {
  margin: 0;
  min-height: 100dvh;
}

.logs-page .page-shell {
  display: none;
}

.logs-shell {
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: none;
  min-height: 100dvh;
  width: 100%;
}

.logs-topbar {
  align-items: flex-start;
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.logs-topbar-start {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.logs-topbar h1 {
  font-size: clamp(18px, 2.4vw, 24px);
  margin: 0;
}

.logs-topbar .muted {
  font-size: 13px;
  margin-top: 4px;
}

.logs-brand {
  flex: 0 0 auto;
  text-decoration: none;
}

.logs-topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.logs-link-btn {
  align-items: center;
  display: inline-flex;
  min-height: 40px;
  padding: 9px 14px;
  text-decoration: none;
}

.logs-status {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
}

.logs-status.is-live {
  background: var(--success-soft);
  border-color: #a7f3d0;
  color: var(--success);
}

.logs-empty {
  align-items: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: auto;
  max-width: 420px;
  padding: 48px 20px;
  text-align: center;
}

.logs-grid {
  display: grid;
  flex: 1;
  gap: 14px;
  grid-template-columns: 1fr;
  padding: 16px 18px 24px;
  width: 100%;
}

.log-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: none;
  padding: 14px;
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
  width: 100%;
}

.log-tile:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 18%);
}

.log-tile:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.log-tile.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 12%);
}

.log-tile.is-error {
  border-color: #fca5a5;
}

.log-tile-head {
  align-items: flex-start;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: space-between;
  width: 100%;
}

.log-tile-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.log-tile-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.log-tile-preview {
  background: #0f172a;
  border-radius: 10px;
  box-sizing: border-box;
  color: #e2e8f0;
  display: block;
  flex: 1 1 auto;
  font: 11px/1.45 ui-monospace, Consolas, monospace;
  height: clamp(200px, 32vh, 280px);
  margin: 0;
  max-height: clamp(200px, 32vh, 280px);
  min-height: 200px;
  overflow: hidden;
  padding: 10px 12px;
  white-space: pre-wrap;
  width: 100%;
  word-break: break-word;
}

.log-tile-foot {
  color: var(--muted);
  display: flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  justify-content: space-between;
  width: 100%;
}

.log-modal-root {
  align-items: stretch;
  display: grid;
  inset: 0;
  padding: 0;
  position: fixed;
  z-index: 200;
}

.log-modal-root:not([hidden]) {
  display: grid;
}

.log-modal-backdrop {
  animation: dialog-fade-in 180ms ease;
  background: rgb(15 23 42 / 55%);
  inset: 0;
  position: absolute;
}

.log-modal-card {
  animation: dialog-slide-in 220ms ease;
  background: var(--surface);
  border-radius: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  margin: 0;
  max-height: none;
  position: relative;
  width: 100%;
  z-index: 1;
}

.log-modal-header {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.log-modal-head {
  min-width: 0;
}

.log-modal-header h2 {
  font-size: clamp(17px, 2.5vw, 22px);
  margin: 0;
  word-break: break-word;
}

.log-modal-actions {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  justify-content: flex-start;
  padding: 10px;
  width: 100%;
}

.log-modal-actions button {
  flex: 1 1 auto;
  min-width: 72px;
}

.log-modal-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.log-autoscroll {
  align-items: center;
  color: var(--text-secondary);
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
}

.log-autoscroll input {
  accent-color: var(--primary);
  height: 16px;
  width: 16px;
}

.log-modal-output {
  background: #0f172a;
  border-radius: 0;
  color: #e2e8f0;
  font: 12px/1.55 ui-monospace, Consolas, monospace;
  margin: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (min-width: 768px) {
  .logs-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }

  .log-tile-preview {
    height: 260px;
    max-height: 260px;
    min-height: 260px;
  }
}

@media (min-width: 900px) {
  .log-modal-root {
    padding: 20px;
  }

  .log-modal-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    height: min(92vh, 900px);
    margin: auto;
    max-width: 1200px;
    width: 100%;
  }

  .log-modal-output {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
}

@media (max-width: 640px) {
  .log-modal-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .log-modal-actions button {
    min-width: 0;
    width: 100%;
  }

  .log-modal-tools {
    justify-content: stretch;
  }

  .log-modal-tools button {
    flex: 1;
  }

  .logs-topbar {
    padding: 12px 14px;
  }

  .logs-topbar-start {
    align-items: flex-start;
  }

  .logs-topbar-actions {
    width: 100%;
  }

  .logs-topbar-actions > * {
    flex: 1 1 auto;
  }

  .logs-grid {
    gap: 12px;
    padding: 12px;
  }

  .log-tile {
    padding: 12px;
  }

  .log-tile-preview {
    font-size: 10px;
    height: 200px;
    max-height: 200px;
    min-height: 200px;
  }

  .log-modal-header-actions {
    width: 100%;
  }

  .log-modal-header-actions button {
    flex: 1;
  }
}
