:root,
[data-theme="dark"] {
  --gateway-surface: #0c090a;
  --gateway-surface-raised: #110c0e;
  --gateway-surface-hover: #151013;
  --gateway-surface-code: #171115;
  --gateway-surface-inset: #070506;
  --gateway-border: #2c2025;
  --gateway-border-subtle: #1d1518;
  --gateway-code-color: #aaa3a6;
  --gateway-detail-color: #b8b1b4;
  --pico-background-color: #000;
  --pico-card-background-color: var(--gateway-surface);
  --pico-card-sectioning-background-color: var(--gateway-surface-raised);
  --pico-color: #ededed;
  --pico-muted-color: #91898d;
  --pico-muted-border-color: var(--gateway-border);
  --pico-primary: #f06f91;
  --pico-primary-background: #c74f70;
  --pico-primary-border: #c74f70;
  --pico-primary-hover: #ff8aa7;
  --pico-primary-hover-background: #d95d7d;
  --pico-primary-hover-border: #d95d7d;
  --pico-primary-focus: rgb(240 111 145 / 24%);
  --pico-primary-inverse: #fff;
  /* Form fields sit on our dark surface (no Pico blue-grey fill) and focus in our pink. */
  --pico-form-element-background-color: var(--gateway-surface-code);
  --pico-form-element-selected-background-color: var(--gateway-surface-hover);
  --pico-form-element-border-color: var(--gateway-border);
  --pico-form-element-active-background-color: var(--gateway-surface-code);
  --pico-form-element-active-border-color: var(--pico-primary);
  --pico-form-element-focus-color: var(--pico-primary-focus);
  --pico-ins-color: #79c995;
  --pico-del-color: #e17777;
  --gateway-warning: #d9a441;
  --pico-border-radius: 0.5rem;
  color-scheme: dark;
}

body {
  background: var(--pico-background-color);
  min-width: 320px;
}

main.container {
  max-width: 1320px;
  padding-bottom: 4rem;
  padding-inline: 1.25rem;
  padding-top: 0;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--pico-muted-border-color);
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  /* Pin the bar height so it never reflows as the range switcher hydrates. */
  min-height: 3.9rem;
  padding: 0.9rem 0;
}

.wordmark {
  align-items: center;
  color: var(--pico-color);
  display: inline-flex;
  font-size: 1.08rem;
  font-weight: 700;
  gap: 0.45rem;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.wordmark-mark {
  background: var(--pico-primary);
  border-radius: 50%;
  box-shadow: 0 0 0.45rem rgb(240 111 145 / 28%);
  display: block;
  height: 0.45rem;
  position: relative;
  transform: translateY(1.5px);
  width: 0.45rem;
}

.wordmark-mark::before,
.wordmark-mark::after {
  animation: wordmark-pulse 1.55s cubic-bezier(0.2, 0.65, 0.35, 1) infinite;
  border: 1px solid var(--pico-primary);
  border-radius: inherit;
  content: "";
  inset: -0.14rem;
  opacity: 0;
  position: absolute;
}

.wordmark-mark::after {
  animation-delay: 0.45s;
}

/* Non-live instance (GATEBOT_LIVE unset — local, mirror, CI): same dot, same pulse, just recoloured
   grey — obvious at a glance that gatebot sends from here reach only the superuser. */
.wordmark-mark.is-idle {
  background: var(--pico-muted-color);
  box-shadow: 0 0 0.45rem color-mix(in srgb, var(--pico-muted-color) 28%, transparent);
}

.wordmark-mark.is-idle::before,
.wordmark-mark.is-idle::after {
  border-color: var(--pico-muted-color);
}

.range-switcher {
  align-items: center;
  display: flex;
  gap: 0.3rem;
  margin: 0;
}

.range-switcher a {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.4rem;
  color: var(--pico-muted-color);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0.55rem 0;
  text-align: center;
  text-decoration: none;
  transition:
    border-color 120ms ease,
    color 120ms ease,
    background-color 120ms ease;
  width: 3.1rem;
}

.range-switcher a:hover {
  background: rgb(240 111 145 / 6%);
  border-color: var(--pico-primary);
  color: var(--pico-primary-hover);
}

.range-switcher a[aria-current="page"] {
  background: var(--pico-primary-background);
  border-color: var(--pico-primary-border);
  color: var(--pico-primary-inverse);
}

.range-switcher a[aria-current="page"]:hover {
  background: var(--pico-primary-hover-background);
  border-color: var(--pico-primary-hover-border);
  color: var(--pico-primary-inverse);
}

@keyframes wordmark-pulse {
  0% {
    opacity: 0;
    transform: scale(0.65);
  }

  12% {
    opacity: 0.65;
  }

  72%,
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.dashboard-section {
  margin-bottom: 2.2rem;
}

.section-title,
.events-panel > header h2 {
  font-size: 1.45rem;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
}

.section-heading {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-heading .section-title {
  margin: 0;
}

.section-heading small {
  color: var(--pico-muted-color);
  font-size: 0.72rem;
}

.metric-grid {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.6rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.metric-card,
.project-card,
.events-panel,
.system-message {
  box-shadow: none;
}

.metric-card {
  background: var(--pico-card-background-color);
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--pico-muted-border-color);
  margin: 0;
  min-width: 0;
  padding: 0.9rem;
}

.metric-card:last-child {
  border-right: 0;
}

.metric-card > header {
  background: transparent;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  padding: 0;
}

.metric-meta {
  align-items: baseline;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  margin-top: 0.3rem;
  min-width: 0;
}

.metric-card h3 {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  color: var(--pico-primary);
  margin: 0;
}

.metric-peak {
  color: var(--pico-muted-color);
  flex: 0 0 auto;
  font-size: 0.68rem;
}

.metric-detail {
  color: var(--pico-muted-color);
  font-size: 0.68rem;
}

.metric-peak strong {
  font-weight: 600;
}

.chart-frame {
  margin-top: 0.85rem;
}

.chart-canvas {
  height: 4.2rem;
  margin-inline: -0.25rem;
  position: relative;
  width: calc(100% + 0.5rem);
}

.chart {
  display: block;
  height: 100%;
  overflow: visible;
  width: 100%;
}

.chart-grid line {
  stroke: var(--pico-muted-border-color);
  stroke-dasharray: 2 10;
  stroke-opacity: 0.42;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-grid .chart-baseline {
  stroke-dasharray: none;
  stroke-opacity: 0.8;
}

.chart-line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  vector-effect: non-scaling-stroke;
}

.chart-point {
  background: var(--pico-card-background-color);
  border: 2px solid currentColor;
  border-radius: 50%;
  height: 0.42rem;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 0.42rem;
}

.chart-gradient-primary,
.chart-series-primary {
  color: var(--pico-primary);
}

.chart-gradient-success,
.chart-series-success {
  color: var(--pico-ins-color);
}

.chart-gradient-error,
.chart-series-error {
  color: var(--pico-del-color);
}

.chart-gradient-muted,
.chart-series-muted {
  color: var(--pico-muted-color);
}

.chart-axis {
  color: var(--pico-muted-color);
  display: flex;
  font-size: 0.64rem;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.chart-empty,
.empty-state {
  color: var(--pico-muted-color);
}

/* `.events-panel` has no padding of its own — the empty-state text sits flush against its edges
   without this: centered and given breathing room so it reads as a deliberate state, not a cut-off table. */
.events-panel > .empty-state {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0;
  min-height: 5rem;
  padding: 1.4rem;
  text-align: center;
}

.project-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card {
  border: 1px solid var(--pico-muted-border-color);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0.9rem;
}

.project-card > header {
  align-items: baseline;
  background: transparent;
  border-bottom: 1px solid var(--pico-muted-border-color);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: -0.9rem -0.9rem 0.35rem;
  padding: 0.75rem 0.9rem;
}

.project-identity {
  align-items: baseline;
  display: flex;
  gap: 0.3rem;
  min-width: 0;
}

.project-card > header a {
  color: var(--pico-color);
  font-weight: 650;
  text-decoration: none;
}

.project-card > header a:hover {
  color: var(--pico-primary-hover);
}

.project-identity small {
  color: var(--pico-muted-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-stats {
  display: flex;
  font-size: 0.72rem;
  gap: 0.35rem;
  justify-self: end;
  margin: 0;
  white-space: nowrap;
}

.project-stats span:first-child {
  color: var(--pico-primary);
}

.project-stats span:last-child {
  color: var(--pico-muted-color);
}

.project-card .chart-canvas {
  height: 5.8rem;
  margin-inline: -0.5rem;
  width: calc(100% + 1rem);
}

.project-card .chart-frame {
  margin-top: 1rem;
}

.project-card > footer {
  align-items: center;
  background: transparent;
  border-top: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
  display: flex;
  font-size: 0.72rem;
  gap: 0.5rem;
  justify-content: space-between;
  margin: 0.5rem -0.9rem -0.9rem;
  padding: 0.65rem 0.9rem;
}

/* Ping button in a project card's footer — a table-style chip (no border), at the footer's own text
   size but with line-height 1 so it fits inside the "last request" line and never grows the footer.
   Hover and the post-click pulse both live in box-shadow only (inset ring + outer glow), so the chip
   never changes its footprint. */
.project-ping {
  background: var(--gateway-surface-code);
  border: 0;
  border-radius: 0.3rem;
  box-shadow: inset 0 0 0 1px transparent;
  color: var(--pico-muted-color);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 0.72rem;
  line-height: 1;
  margin: 0;
  padding: 0.16rem 0.5rem;
  transition:
    color 120ms ease,
    box-shadow 200ms ease;
}

.project-ping:hover,
.project-ping:focus-visible {
  box-shadow: inset 0 0 0 1px var(--pico-primary);
  color: var(--pico-primary);
}

/* Click landed — a brief pink glow, no colour or label change. */
.project-ping.is-pinged {
  box-shadow:
    inset 0 0 0 1px var(--pico-primary),
    0 0 7px 1px color-mix(in srgb, var(--pico-primary) 45%, transparent);
  color: var(--pico-primary);
}

.events-panel {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.events-scroll {
  overflow-x: auto;
}

.events-list {
  min-width: 900px;
}

.event-row {
  align-items: center;
  display: grid;
  font-size: 0.76rem;
  gap: 0.75rem;
  grid-template-columns: minmax(195px, 1.25fr) 0.55fr minmax(210px, 1.55fr) 0.65fr 0.48fr 0.52fr 3rem;
  padding: 0.62rem 0.85rem;
}

.event-head {
  border-bottom: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-head > :last-child {
  text-align: center;
}

.event-group,
.event-item {
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin: 0;
}

.events-list > :last-child {
  border-bottom: 0;
}

.event-group summary {
  color: var(--pico-color);
  cursor: pointer;
  list-style: none;
  transition: background-color 120ms ease;
}

.event-group summary::-webkit-details-marker {
  display: none;
}

.event-group summary::after {
  display: none;
}

.event-group summary:hover {
  background: var(--gateway-surface-hover);
}

.event-item:hover {
  background: var(--gateway-surface-hover);
}

.event-time-cell {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  min-width: 0;
  white-space: nowrap;
}

.event-chevron {
  border-bottom: 1.5px solid var(--pico-muted-color);
  border-right: 1.5px solid var(--pico-muted-color);
  flex: 0 0 auto;
  height: 0.38rem;
  transform: rotate(-45deg);
  transition: transform 120ms ease;
  width: 0.38rem;
}

.event-group[open] .event-chevron {
  transform: rotate(45deg);
}

.event-group[open] > summary {
  margin-bottom: 0;
}

.event-row code,
.event-detail-row code {
  background: var(--gateway-surface-code);
  border-radius: 0.3rem;
  color: var(--gateway-code-color);
  font-size: 0.73rem;
  padding: 0.2rem 0.35rem;
  width: max-content;
}

.event-row .event-project {
  color: var(--event-project-color);
}

.event-operation {
  align-items: center;
  display: flex;
  white-space: nowrap;
}

.event-operation > code:first-child {
  color: var(--pico-primary);
}

.cache-badge {
  color: var(--pico-muted-color);
  cursor: help;
  margin-inline-start: 0.35rem;
}

.event-row .event-status-success {
  color: var(--pico-ins-color);
}

.event-row .event-status-denied,
.event-row .event-status-error {
  color: var(--pico-del-color);
}

.event-error {
  align-items: center;
  display: flex;
  justify-content: center;
  min-width: 0;
  position: relative;
}

.event-error:hover,
.event-error:focus,
.event-error:focus-visible {
  z-index: 20;
}

.event-error.is-empty {
  color: var(--pico-muted-color);
}

.event-error:not(.is-empty) {
  cursor: help;
}

.event-error-mark {
  border-radius: 50%;
  flex: 0 0 auto;
  height: 0.5rem;
  width: 0.5rem;
}

.event-error.is-note .event-error-mark {
  background: var(--pico-muted-color);
}

.event-error.is-denied .event-error-mark {
  background: var(--gateway-warning);
}

.event-error.is-error .event-error-mark {
  background: var(--pico-del-color);
}

/* A gatebot tip carries parsed chips (outcome / @handle / project), not plain text — its dot goes
   pink to match on the success rows, like it did before, rather than the neutral grey `note` dot. */
.event-error.is-gatebot .event-error-mark {
  background: var(--pico-primary);
}

/* Chip row inside a gatebot Detail tip: a lower-case outcome, a pink subject, its project in the
   project's own colour. */
.event-detail {
  align-items: center;
  display: inline-flex;
  gap: 0.3rem;
}

.event-detail-arrow {
  color: var(--pico-muted-color);
  font-size: 0.65rem;
}

.event-detail-reason {
  color: var(--pico-muted-color);
}

/* Preview dot on a successful delivery row — pink like the rest of the gatebot chrome, clearly not
   an alert. The tip holds the message body, so it wraps and is given room, unlike the one-line error tip. */
.event-error.is-preview .event-error-mark {
  background: color-mix(in srgb, var(--pico-primary) 55%, transparent);
}

/* The delivery preview tip holds a sentence, not a one-line code. `width: max-content` keeps an
   abspos box (no left, no explicit width) from collapsing to one character per line; `max-width`
   then wraps long text inside a bound so it never runs past the panel edge (it opens leftward from
   the last column). Compound selector so it outweighs the base tip's `white-space: nowrap`. */
.event-error-tip.is-preview-tip {
  border-color: color-mix(in srgb, var(--pico-primary) 45%, var(--pico-muted-color));
  max-width: 20rem;
  overflow-wrap: break-word;
  text-align: left;
  white-space: normal;
  width: max-content;
}

/* The preview line is gatebot content — pink like the handle chips and the row's dot, not plain white. */
.event-preview-text {
  color: var(--pico-primary);
  line-height: 1.4;
}

.event-preview-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.event-preview-btn {
  background: var(--gateway-surface-code);
  border-radius: 0.25rem;
  color: var(--pico-muted-color);
  font-size: 0.64rem;
  padding: 0.05rem 0.35rem;
}

.event-error-tip {
  background: var(--gateway-surface-hover);
  border: 1px solid var(--pico-muted-color);
  border-radius: 0.35rem;
  box-shadow: 0 0.5rem 1.25rem rgb(0 0 0 / 55%);
  color: var(--pico-color);
  font-size: 0.7rem;
  opacity: 0;
  padding: 0.3rem 0.5rem;
  pointer-events: none;
  position: absolute;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%) translateX(0.15rem);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  white-space: nowrap;
  z-index: 20;
}

.event-error:hover .event-error-tip,
.event-error:focus .event-error-tip,
.event-error:focus-visible .event-error-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.event-details {
  background: var(--gateway-surface-inset);
  border-top: 1px solid var(--pico-muted-border-color);
  padding: 0;
}

.event-detail-row {
  border-bottom: 1px solid var(--gateway-border-subtle);
  color: var(--gateway-detail-color);
  font-size: 0.76rem;
}

.event-detail-row:last-child {
  border-bottom: 0;
}

.events-loader {
  border-top: 1px solid var(--pico-muted-border-color);
  margin: 0;
  padding: 0.8rem;
  text-align: center;
}

.system-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100svh;
  padding-block: 2rem;
}

.access-wordmark {
  color: var(--pico-primary);
  cursor: default;
  font-size: 1.65rem;
  gap: 0.6rem;
  margin: 0;
  transform: translateY(-2vh);
}

.access-wordmark .wordmark-mark {
  height: 0.6rem;
  width: 0.6rem;
}

.system-message {
  color: var(--pico-muted-color);
  max-width: 36rem;
}

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

  .metric-card:nth-child(2) {
    border-right: 0;
  }

  .metric-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--pico-muted-border-color);
  }
}

@media (max-width: 700px) {
  main.container {
    padding-inline: 0.8rem;
  }

  .topbar {
    margin-bottom: 2rem;
  }

  .range-switcher a {
    padding-inline: 0;
  }

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

  .events-scroll {
    overflow: visible;
  }

  .events-list {
    min-width: 0;
  }

  .event-head {
    display: none;
  }

  .event-row {
    gap: 0.55rem 0.8rem;
    grid-template-areas:
      "time project"
      "operation status"
      "duration count"
      "message message";
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.75rem 0.85rem;
  }

  .event-time-cell {
    grid-area: time;
  }

  .event-row .event-project {
    grid-area: project;
    text-align: right;
  }

  .event-operation {
    grid-area: operation;
  }

  .event-status {
    grid-area: status;
    justify-self: end;
  }

  .event-duration {
    grid-area: duration;
  }

  .event-count {
    grid-area: count;
    justify-self: end;
  }

  .event-error {
    gap: 0.5rem;
    grid-area: message;
    justify-content: flex-start;
  }

  .event-error.is-empty {
    display: none;
  }

  .event-error-tip {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--pico-muted-color);
    opacity: 1;
    padding: 0;
    pointer-events: auto;
    position: static;
    transform: none;
    white-space: normal;
  }
}

@media (max-width: 400px) {
  .metric-card {
    padding: 0.75rem;
  }

  .metric-card h3 {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark-mark::before,
  .wordmark-mark::after {
    animation: none;
  }

  .range-switcher a,
  .event-group summary,
  .topbar-link,
  .gatebot-card {
    transition: none;
  }
}

/* gatebot */

/* Colored status chips need .event-row specificity to beat the base `.event-row code` grey. */
.event-row .event-status-pending {
  color: var(--gateway-warning);
}

.event-row .event-status-muted {
  color: var(--pico-muted-color);
}

.topbar-left {
  align-items: center;
  display: flex;
  gap: 0.9rem;
}

.topbar-link {
  color: var(--pico-muted-color);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: color 200ms ease;
}

/* Pico re-scopes --pico-color to primary on <a>, so an explicit value is needed for plain white. */
.topbar-link:hover,
.topbar-link:focus-visible {
  color: #ededed;
  text-decoration: none;
}

.gatebot-card {
  border-color: color-mix(in srgb, var(--pico-primary) 55%, var(--pico-muted-border-color));
  position: relative;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.gatebot-card:hover {
  border-color: var(--pico-primary);
  box-shadow: 0 0 1.5rem rgb(240 111 145 / 22%);
}

/* Hypothesis: tint the "last delivery" line pink to echo the card's outline. Revert if it reads as too loud. */
.gatebot-card > footer {
  color: color-mix(in srgb, var(--pico-primary) 100%, var(--pico-muted-color));
}

/* Title links to the bot; sits above the card-wide link so it stays independently clickable. */
.gatebot-card-name {
  position: relative;
  z-index: 2;
}

.gatebot-card-link {
  inset: 0;
  position: absolute;
  z-index: 1;
}

.sr-only {
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.gatebot-notice {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.4rem;
  font-size: 0.8rem;
  margin-bottom: 1.6rem;
  padding: 0.55rem 0.8rem;
}

.gatebot-notice-ok {
  border-color: color-mix(in srgb, var(--pico-ins-color) 45%, var(--pico-muted-border-color));
  color: var(--pico-ins-color);
}

.gatebot-notice-warn {
  border-color: color-mix(in srgb, var(--gateway-warning) 45%, var(--pico-muted-border-color));
  color: var(--gateway-warning);
}

.gatebot-note {
  color: var(--pico-muted-color);
  font-size: 0.82rem;
  margin: 0;
}

.gatebot-op {
  background: var(--gateway-surface-code);
  border-radius: 0.25rem;
  color: var(--pico-primary);
  font-size: 0.9em;
  padding: 0.05rem 0.32rem;
}

/* Non-interactive count beside the Members heading: a table-style chip sized to match the button next to it. */
.gatebot-count {
  align-items: center;
  background: var(--gateway-surface-code);
  border: 1px solid transparent;
  border-radius: 0.3rem;
  color: var(--gateway-code-color);
  display: inline-flex;
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0.42rem 0.6rem;
}

/* Telegram on/off beside the Delivery log heading — same compact tag as table status cells
   (`.event-status`), not `.gatebot-count`'s pill shape: next to the "Send test" button, a
   bordered pill of matching size read as a second button instead of a status readout. */
/* Padding + a transparent border matching `.gatebot-btn`'s box model exactly, so the two sit at the
   same height in the row — a background-only tag with `.gatebot-btn`'s smaller padding read visibly
   shorter next to it. */
.gatebot-status {
  align-items: center;
  background: var(--gateway-surface-code);
  border: 1px solid transparent;
  border-radius: 0.3rem;
  display: inline-flex;
  font-size: 0.73rem;
  line-height: 1;
  padding: 0.42rem 0.6rem;
  width: max-content;
}

.gatebot-status-on {
  color: var(--pico-ins-color);
}

.gatebot-status-muted {
  color: var(--gateway-warning);
}

/* Members heading: count pill + "Create invitation" trigger, kept together on the right. */
.gatebot-heading-actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

/* Shared chip for gatebot table cells — same silhouette as `.event-row code`. */
.gatebot-tag {
  background: var(--gateway-surface-code);
  border-radius: 0.3rem;
  color: var(--gateway-code-color);
  font-size: 0.73rem;
  padding: 0.2rem 0.35rem;
  white-space: nowrap;
  width: max-content;
}

/* Needs .event-row to outrank the base `.event-row code` (0,1,1) that would otherwise grey it out. */
.event-row .gatebot-tag-pink {
  color: var(--pico-primary);
}

.gatebot-dash {
  color: var(--pico-muted-color);
  font-size: 0.73rem;
}

/* Kind stays off pink: notify is real outbound traffic (amber), debug is a throwaway test (grey). */
.gatebot-log .gatebot-kind-notify {
  color: var(--gateway-warning);
}

.gatebot-log .gatebot-kind-debug {
  color: var(--pico-muted-color);
}

/* Full "date, time" like the main request log — plain text, not a chip, so it is never clipped. */
.gatebot-log .gatebot-when {
  color: var(--pico-muted-color);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gatebot-id-cell {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  min-width: 0;
}

.gatebot-id-cell > :first-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gatebot-id-cell code {
  flex: 0 0 auto;
}

/* Tables reuse .events-panel / .events-list / .event-row / .event-head / .event-item from the request log. */
.events-list.gatebot-members {
  min-width: 640px;
}

.events-list.gatebot-log {
  min-width: 760px;
}

/* Every track is fixed or minmax(0, …) — including a fixed Actions column — so columns never shift row to row. */
.gatebot-members .event-row {
  grid-template-columns:
    minmax(0, 2fr) minmax(0, 1fr) minmax(0, 0.8fr)
    minmax(0, 0.7fr) minmax(0, 0.9fr) 4.5rem;
}

.gatebot-log .event-row {
  align-items: center;
  grid-template-columns:
    minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 0.7fr) minmax(0, 0.7fr)
    minmax(0, 0.45fr) 9.5rem 2.5rem;
}

.gatebot-members .event-row > .gatebot-tag,
.gatebot-members .event-row > .event-status,
.gatebot-members .event-row > .event-project,
.gatebot-log .event-row > .gatebot-tag,
.gatebot-log .event-row > .event-status,
.gatebot-log .event-row > .event-project {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The /gatebot "Projects" section reuses .project-grid / .project-card from the main dashboard as-is. */

.gatebot-row-actions {
  align-items: center;
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* Compact icon button for row actions (add / copy / remove / restore / dismiss). Pink, brighter on hover. */
.gatebot-icon {
  align-items: center;
  background: var(--gateway-surface-code);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.4rem;
  color: var(--pico-primary);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 1.7rem;
  justify-content: center;
  margin: 0;
  padding: 0;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
  width: 1.7rem;
}

.gatebot-icon::before {
  content: attr(data-glyph);
  font-size: 0.8rem;
  line-height: 1;
}

.gatebot-icon:hover,
.gatebot-icon:focus-visible {
  background: rgb(240 111 145 / 8%);
  border-color: var(--pico-primary);
  color: var(--pico-primary-hover);
}

/* Permanent delete — irreversible, so it turns red on hover to read differently from the pink actions. */
.gatebot-icon-danger:hover,
.gatebot-icon-danger:focus-visible {
  background: color-mix(in srgb, var(--pico-del-color) 12%, transparent);
  border-color: var(--pico-del-color);
  color: var(--pico-del-color);
}

/* After a copy: just swap the glyph and lift to the lighter pink — no colour flash. */
.gatebot-icon.is-copied {
  border-color: var(--pico-primary);
  color: var(--pico-primary-hover);
}

.gatebot-icon.is-copied::before {
  content: "✓";
}

.gatebot-btn {
  background: transparent;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.4rem;
  color: var(--pico-muted-color);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  margin: 0;
  padding: 0.42rem 0.7rem;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
  white-space: nowrap;
  width: auto;
}

.gatebot-btn:hover,
.gatebot-btn:focus-visible {
  background: rgb(240 111 145 / 6%);
  border-color: var(--pico-primary);
  color: var(--pico-primary-hover);
}

.gatebot-btn-primary {
  border-color: var(--pico-primary-border);
  color: var(--pico-primary);
}

/* Pico paints the dropdown arrow as a right-anchored background image — leave room so text never sits under it. */
.gatebot-modal-form select {
  padding-right: 1.75rem;
}

/* Create-invitation modal — Pico styles <dialog>; this pulls it into our palette and spacing. */
.gatebot-modal::backdrop {
  background: rgb(0 0 0 / 60%);
}

.gatebot-modal article {
  background: var(--gateway-surface-raised);
  border: 1px solid var(--pico-muted-border-color);
  gap: 0;
  max-width: 26rem;
  width: 100%;
}

.gatebot-modal article > header {
  align-items: center;
  background: transparent;
  border: 0;
  display: flex;
  justify-content: space-between;
  margin: 0 0 1.1rem;
  padding: 0;
}

.gatebot-modal article > header h3 {
  font-size: 1rem;
  margin: 0;
}

.gatebot-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.gatebot-modal-form label {
  color: var(--pico-muted-color);
  display: flex;
  flex-direction: column;
  font-size: 0.76rem;
  gap: 0.35rem;
}

.gatebot-modal-form select,
.gatebot-modal-form input {
  font-size: 0.85rem;
  margin: 0;
}

.gatebot-modal-form footer {
  background: transparent;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin: 0.3rem 0 0;
  padding: 0;
}

@media (max-width: 700px) {
  .events-list.gatebot-members,
  .events-list.gatebot-log {
    min-width: 0;
  }

  .gatebot-members .event-row,
  .gatebot-log .event-row {
    grid-template-columns: 1fr auto;
  }

  .gatebot-members .event-head,
  .gatebot-log .event-head {
    display: none;
  }

  .gatebot-row-actions {
    justify-content: flex-start;
  }
}
