:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dde3;
  --text: #1b2430;
  --muted: #5a6675;
  --accent: #0b6a84;
  --accent-bg: #e3f1f5;
  --ok: #1a7f4b;
  --ok-bg: #e0f3e8;
  --warn: #8a5a00;
  --warn-bg: #fbefd2;
  --bad: #b3261e;
  --bad-bg: #fbe3e0;
  --idle-bg: #e9ecf0;
  --s-p50: #0b6a84;
  --s-p95: #7a3fc0;
  --s-p99: #b4510a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --panel: #1a212a;
    --line: #2b3541;
    --text: #e6ebf1;
    --muted: #9aa7b6;
    --accent: #6cc4dc;
    --accent-bg: #1c3640;
    --ok: #6fd39b;
    --ok-bg: #173826;
    --warn: #f0c36a;
    --warn-bg: #3b2f12;
    --bad: #ff8f86;
    --bad-bg: #432020;
    --idle-bg: #262e38;
    --s-p50: #6cc4dc;
    --s-p95: #c8a6ff;
    --s-p99: #ffb070;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    sans-serif;
}
a {
  color: var(--accent);
}
.shell {
  display: grid;
  grid-template-columns: 14rem 1fr;
  min-height: 100vh;
}
.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0.75rem;
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0 0.5rem;
}
.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rail li a {
  border-radius: 0.5rem;
  color: var(--text);
  display: block;
  padding: 0.5rem;
  text-decoration: none;
}
.rail li a[aria-current='page'] {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.me {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: auto;
  overflow-wrap: anywhere;
  padding: 0 0.5rem;
}
main {
  min-width: 0;
  padding: 1.5rem 1.25rem;
}
main h1 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}
.empty,
.notice {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  color: var(--muted);
  padding: 1.5rem;
}
.notice {
  margin: 1.25rem;
}
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 0.75rem;
  padding: 1rem;
}
.card.ok {
  border-left-color: var(--ok);
}
.card.warn {
  border-left-color: var(--warn);
}
.card.bad {
  border-left-color: var(--bad);
}
.card header {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}
.card h2 {
  font-size: 1.125rem;
  margin: 0;
  overflow-wrap: anywhere;
}
.card h3 {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  margin: 1rem 0 0.25rem;
  text-transform: uppercase;
}
.reason {
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}
.pill {
  background: var(--idle-bg);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.125rem 0.625rem;
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.count.over {
  color: var(--bad);
  font-weight: 600;
}
.squares {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 0.375rem;
}
.sq {
  background: var(--idle-bg);
  border-radius: 2px;
  height: 10px;
  width: 10px;
}
.sq.used {
  background: var(--accent);
}
.sq.used.over {
  background: var(--bad);
}
.accounts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.account {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.125rem 0;
}
.who {
  overflow-wrap: anywhere;
}
.facts {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  gap: 0.25rem 1rem;
  margin: 1rem 0 0;
  padding-top: 0.5rem;
}
.facts div {
  display: flex;
  gap: 0.375rem;
}
.facts dt::after {
  content: ':';
}
.facts dd {
  color: var(--text);
  margin: 0;
}
@media (max-width: 700px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem 16px;
  }
  .me {
    margin-top: 0;
    width: 100%;
  }
  main {
    padding: 1rem 16px;
  }
}
.controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.field {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 0.8125rem;
  gap: 0.25rem;
}
.field.check {
  align-items: center;
  flex-direction: row;
  gap: 0.5rem;
  padding-bottom: 0.375rem;
}
.field select,
.field input[type='search'] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  font: inherit;
  max-width: 100%;
  padding: 0.375rem 0.5rem;
}
.sessions-page .count {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}
.group {
  margin-bottom: 1.5rem;
}
.group h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  overflow-wrap: anywhere;
}
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  max-width: 100%;
  overflow-x: auto;
}
.sessions-table {
  border-collapse: collapse;
  width: 100%;
}
.sessions-table th,
.sessions-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.sessions-table th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sessions-table tr:last-child td {
  border-bottom: 0;
}
.sessions-table tr[aria-selected='true'] {
  background: var(--accent-bg);
}
.sessions-table td:nth-child(2),
.sessions-table td:nth-child(5) {
  white-space: nowrap;
}
button.title {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-align: left;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.chip {
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  display: inline-flex;
  font-size: 0.75rem;
  overflow: hidden;
}
.chip .app {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
  padding: 0.0625rem 0.375rem;
}
.chip .kv {
  padding: 0.0625rem 0.375rem;
}
.drawer {
  background: var(--panel);
  border-left: 1px solid var(--line);
  bottom: 0;
  box-shadow: -8px 0 24px rgb(0 0 0 / 0.15);
  overflow-y: auto;
  padding: 1rem;
  position: fixed;
  right: 0;
  top: 0;
  width: min(28rem, 100%);
  z-index: 10;
}
.drawer[hidden] {
  display: none;
}
.drawer header {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}
.drawer h2 {
  font-size: 1.125rem;
  margin: 0;
  overflow-wrap: anywhere;
}
.drawer h3 {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  margin: 1rem 0 0.25rem;
  text-transform: uppercase;
}
.detail div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 8rem 1fr;
  padding: 0.25rem 0;
}
.detail dt {
  color: var(--muted);
  font-size: 0.8125rem;
}
.detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.meta {
  color: var(--muted);
  margin: 0 0 1rem;
}
.app {
  color: var(--text);
  font-weight: 600;
}
.live {
  color: var(--ok);
}
.live.paused {
  color: var(--warn);
}
.filters {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.filters label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 0.8125rem;
  gap: 0.25rem;
}
.filters select,
.filters input,
.filters button,
.older {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  font: inherit;
  padding: 0.375rem 0.625rem;
}
.filters button,
.older {
  cursor: pointer;
}
.older {
  display: block;
  margin: 1rem 0 0;
}
.older[hidden] {
  display: none;
}
.events {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.event {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--line);
  display: grid;
  gap: 0.25rem 0.75rem;
  grid-template-columns: 11rem 11rem 1fr;
  padding: 0.5rem 0.75rem;
}
.event:last-child {
  border-bottom: 0;
}
.event.ok {
  border-left-color: var(--ok);
}
.event.warn {
  border-left-color: var(--warn);
}
.event.bad {
  border-left-color: var(--bad);
}
.event.fresh {
  animation: fresh 2s ease-out;
}
@keyframes fresh {
  from {
    background: var(--accent-bg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .event.fresh {
    animation: none;
  }
}
.event .pill {
  justify-self: start;
}
.event .when {
  color: var(--muted);
  font-size: 0.8125rem;
}
.event .where,
.event .detail {
  overflow-wrap: anywhere;
}
.event .detail {
  color: var(--muted);
  grid-column: 1 / -1;
}
.event .detail:empty {
  display: none;
}
@media (max-width: 700px) {
  .event {
    grid-template-columns: 1fr;
  }
}

.speed .measure {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1rem;
}
.speed .measure h2 {
  font-size: 1.125rem;
  margin: 0 0 0.5rem;
}
.speed .tiles {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin: 1rem 0;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
}
.tile .label {
  color: var(--muted);
  font-size: 0.8125rem;
}
.tile strong {
  font-size: 1.5rem;
}
.tile .pill {
  align-self: flex-start;
}
.chart-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.5rem;
}
.chart {
  display: block;
  height: auto;
  width: 100%;
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .tick {
  fill: var(--muted);
  font-size: 11px;
}
.chart .target {
  stroke: var(--bad);
  stroke-dasharray: 6 4;
  stroke-width: 1.5;
}
.chart .series {
  stroke-width: 2;
}
.chart .series.p50,
.legend .key.p50 {
  --c: var(--s-p50);
}
.chart .series.p95,
.legend .key.p95 {
  --c: var(--s-p95);
}
.chart .series.p99,
.legend .key.p99 {
  --c: var(--s-p99);
}
.chart .series {
  stroke: var(--c);
}
.chart .series.p95 {
  stroke-dasharray: 8 3;
}
.chart .series.p99 {
  stroke-dasharray: 2 3;
}
.chart .dot {
  fill: var(--c);
}
.chart .dot.p50 {
  --c: var(--s-p50);
}
.chart .dot.p95 {
  --c: var(--s-p95);
}
.chart .dot.p99 {
  --c: var(--s-p99);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0;
}
.legend[hidden] {
  display: none;
}
.legend .key::before {
  background: var(--c, var(--bad));
  content: '';
  display: inline-block;
  height: 0.25rem;
  margin-right: 0.4rem;
  vertical-align: middle;
  width: 1.25rem;
}
.numbers {
  margin: 0.5rem 0;
  overflow-x: auto;
}
.numbers[hidden] {
  display: none;
}
.numbers table {
  border-collapse: collapse;
  min-width: 100%;
}
.numbers th,
.numbers td {
  border-bottom: 1px solid var(--line);
  padding: 0.25rem 0.5rem;
  text-align: right;
  white-space: nowrap;
}
.numbers th:first-child,
.numbers td:first-child {
  text-align: left;
}
.artifacts,
.versions,
.threads {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.artifact,
.version,
.thread {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
}
.artifact:last-child,
.version:last-child,
.thread:last-child {
  border-bottom: 0;
}
.artifact {
  grid-template-columns: 1fr 1fr auto;
}
.version {
  grid-template-columns: 7rem auto 1fr auto;
}
.artifact .name {
  font-weight: 600;
}
.artifact .where,
.artifact .when,
.version .when,
.version .detail,
.comment .when,
.comment .version-tag {
  color: var(--muted);
  font-size: 0.8125rem;
}
.artifact .detail,
.version .file,
.version .detail,
.comment .text {
  overflow-wrap: anywhere;
}
.artifact .detail {
  grid-column: 1 / 3;
}
.artifact .open,
.resolve {
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  justify-self: start;
  padding: 0.25rem 0.75rem;
}
.artifact-detail {
  margin-top: 1.5rem;
}
.artifact-detail h2,
.artifact-detail h3 {
  margin: 0 0 0.5rem;
}
.thread {
  grid-template-columns: 1fr;
}
.thread.resolved {
  opacity: 0.8;
}
.comment {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
.comment .text {
  flex-basis: 100%;
  margin: 0;
  white-space: pre-wrap;
}
.comment.reply {
  border-left: 3px solid var(--line);
  padding-left: 0.75rem;
}
.thread .state,
.resolve {
  justify-self: start;
}
.thread .note {
  color: var(--bad);
}
@media (max-width: 700px) {
  .artifact,
  .version {
    grid-template-columns: 1fr;
  }
  .artifact .detail {
    grid-column: auto;
  }
}

/* The Stop control in the drawer. */
.stop {
  margin: 1rem 0 0;
}
.stop p {
  margin: 0 0 0.5rem;
}
.stop .notice {
  margin: 0;
  padding: 0.75rem 1rem;
}
.stop button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  margin-right: 0.5rem;
  padding: 0.375rem 0.875rem;
}
.stop button.danger {
  border-color: var(--bad, #c0392b);
  color: var(--bad, #c0392b);
}
.stop button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* The message box in the drawer. */
.message {
  margin: 1rem 0 0;
}
.message .hint {
  color: var(--muted, inherit);
  margin: 0 0 0.5rem;
}
.message textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-sizing: border-box;
  color: var(--text);
  display: block;
  font: inherit;
  margin: 0 0 0.5rem;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  resize: vertical;
  width: 100%;
}
.message .notice {
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
}
.message button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 0.375rem 0.875rem;
}
.message button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* "Sign Claude in again" on a host environment: the button, then the panel with the steps, the link and the code box. */
.signin {
  flex-basis: 100%;
  margin: 0.25rem 0 0.5rem;
}
.signin p {
  margin: 0 0 0.5rem;
}
.signin .hint {
  color: var(--muted);
  font-size: 0.875rem;
}
.signin .notice {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
}
.signin button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  margin: 0 0.5rem 0.25rem 0;
  padding: 0.375rem 0.875rem;
}
.signin button.danger {
  border-color: var(--bad);
  color: var(--bad);
}
.signin button:disabled {
  cursor: default;
  opacity: 0.6;
}
.steps {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}
.steps li {
  color: var(--muted);
  padding: 0.125rem 0 0.125rem 1.5rem;
  position: relative;
}
.steps li::before {
  content: '○';
  left: 0;
  position: absolute;
}
.steps li.done {
  color: var(--ok);
}
.steps li.done::before {
  content: '✓';
}
.steps li.now {
  color: var(--text);
  font-weight: 600;
}
.steps li.now::before {
  content: '●';
  color: var(--accent);
}
.signin-link {
  display: inline-block;
  margin: 0 0 0.5rem;
}
.signin .code label {
  display: block;
  font-size: 0.875rem;
  margin: 0 0 0.25rem;
}
.signin .code input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  display: block;
  font: inherit;
  margin: 0 0 0.5rem;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  width: 100%;
}
.signin .clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
