:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #101010;
  --panel-raised: #141414;
  --line: #292929;
  --line-soft: #202020;
  --text: #f4f4f5;
  --muted: #9b9b9f;
  --red: #ff3434;
  --red-muted: rgba(255, 52, 52, 0.12);
  --green: #43c68b;
  --amber: #e5ae48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Helvetica Neue", sans-serif;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.brand {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.brand span {
  color: var(--red);
}

.eyebrow {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
}

.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.signin-panel {
  width: min(100%, 420px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.signin-panel h1 {
  margin: 28px 0 26px;
  font-size: 1.55rem;
  font-weight: 600;
}

label {
  display: block;
  margin: 17px 0 8px;
  color: #c7c7ca;
  font-size: 0.84rem;
  font-weight: 500;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #0b0b0b;
  color: var(--text);
  font: inherit;
}

input:focus {
  border-color: #555;
}

button {
  height: 44px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary {
  width: 100%;
  margin-top: 22px;
  background: var(--red);
}

.secondary {
  border-color: var(--line);
  background: transparent;
}

.text-action {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
}

.form-error,
.load-error {
  min-height: 18px;
  margin: 14px 0 0;
  color: #ff7777;
  font-size: 0.83rem;
}

.console {
  width: min(1380px, calc(100% - 56px));
  margin: 0 auto;
  padding-bottom: 42px;
}

.console-header {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.operator {
  margin: 0 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.icon-action {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: var(--line);
  background: transparent;
}

.icon-action svg,
.search-field svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-bar {
  padding: 40px 0 24px;
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.status-bar h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
}

.updated {
  color: var(--muted);
  font-size: 0.83rem;
}

.status-bar .load-error {
  margin-left: auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics article {
  height: 108px;
  padding: 22px 25px;
  border-right: 1px solid var(--line);
}

.metrics article:last-child {
  border-right: 0;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.metrics strong {
  display: block;
  margin-top: 12px;
  font-size: 1.75rem;
  font-weight: 600;
}

.data-section {
  margin-top: 36px;
}

.section-heading {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
}

.section-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.search-field {
  position: relative;
  width: 270px;
  margin: 0;
  color: var(--muted);
}

.search-field svg {
  position: absolute;
  top: 13px;
  left: 13px;
}

.search-field input {
  padding-left: 40px;
}

.event-lookup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-lookup .search-field {
  width: 350px;
}

.investigation-error {
  min-height: 0;
  margin: 0 0 12px;
}

.investigation-error:empty {
  display: none;
}

.investigation-empty {
  min-height: 74px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.88rem;
}

.investigation {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.investigation-title {
  min-height: 78px;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.investigation-title h3 {
  margin: 0 0 7px;
  font-size: 1.08rem;
  font-weight: 600;
}

.investigation-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.investigation-facts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.investigation-facts div {
  min-height: 76px;
  padding: 16px 18px;
  border-right: 1px solid var(--line-soft);
}

.investigation-facts div:last-child {
  border-right: 0;
}

.investigation-facts span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.73rem;
}

.investigation-facts strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.investigation-columns {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
}

.investigation-columns section {
  min-height: 196px;
  padding: 21px 22px;
  border-right: 1px solid var(--line-soft);
}

.investigation-columns section:last-child {
  border-right: 0;
}

.investigation-columns h4 {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  margin: 0 0 14px;
  padding-left: 17px;
  font-size: 0.83rem;
}

.timeline li:not(.muted-value)::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.timeline span,
.timeline time {
  display: block;
}

.timeline time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.details-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(82px, auto) 1fr;
  gap: 13px 12px;
  font-size: 0.82rem;
}

.details-list dt {
  color: var(--muted);
}

.details-list dd {
  margin: 0;
  color: #e1e1e4;
  overflow-wrap: anywhere;
}

.muted-value {
  color: var(--muted);
  font-size: 0.83rem;
}

.external-link {
  color: #f0f0f2;
  text-decoration-color: #5d5d62;
  text-underline-offset: 3px;
}

.external-link:hover {
  color: var(--red);
}

.billing-error {
  margin: 18px 0 0;
  color: #ff7979;
  font-size: 0.78rem;
  line-height: 1.45;
}

.investigation-logs {
  padding: 21px 22px 23px;
  border-top: 1px solid var(--line);
}

.logs-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.logs-heading h4 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.logs-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

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

.logs-error {
  min-height: 0;
}

.logs-error:empty {
  display: none;
}

.logs-preview {
  max-height: 310px;
  margin: 19px 0 0;
  padding: 16px 17px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #090909;
  color: #c9c9cd;
  font: 0.75rem/1.58 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.events-table th:last-child,
.events-table td:last-child {
  width: 96px;
}

th {
  height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

td {
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  color: #e1e1e4;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty td {
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1b1b1b;
  color: #d7d7da;
  font-size: 0.78rem;
}

.pill.live,
.pill.active,
.pill.trialing {
  background: rgba(67, 198, 139, 0.12);
  color: var(--green);
}

.pill.past_due {
  background: rgba(229, 174, 72, 0.12);
  color: var(--amber);
}

.pill.canceled,
.pill.none {
  background: var(--red-muted);
  color: #ff7979;
}

.row-action {
  height: 34px;
  padding: 0 13px;
  border-color: var(--line);
  background: transparent;
  color: #d7d7da;
  font-size: 0.78rem;
}

.row-action:hover {
  border-color: #444;
  color: var(--text);
}

@media (max-width: 840px) {
  .console {
    width: calc(100% - 30px);
  }

  .console-header {
    height: auto;
    padding: 18px 0;
  }

  .operator {
    display: none;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics article:nth-child(2) {
    border-right: 0;
  }

  .metrics article:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
  }

  .search-field {
    width: 100%;
  }

  .event-lookup {
    width: 100%;
  }

  .event-lookup .search-field {
    width: auto;
    flex: 1;
  }

  .investigation-title {
    gap: 16px;
  }

  .investigation-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .investigation-facts div:nth-child(2n) {
    border-right: 0;
  }

  .investigation-facts div:nth-child(-n+4) {
    border-bottom: 1px solid var(--line-soft);
  }

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

  .investigation-columns section {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .investigation-columns section:last-child {
    border-bottom: 0;
  }

  .logs-heading {
    flex-direction: column;
  }

  .logs-actions {
    width: 100%;
  }

  .logs-actions button {
    flex: 1;
  }

  .table-shell {
    overflow-x: auto;
  }

  table {
    min-width: 720px;
  }
}
