:root {
  color-scheme: light dark;
  --background: #f3f4f7;
  --card: #ffffff;
  --text: #151922;
  --muted: #555d6b;
  --border: #dcdfe5;
  --badge: #eef0f4;
  --input: #ffffff;
  --input-border: #868d9a;
  --accent: #2f5fd0;
  --accent-hover: #2850b4;
  --on-accent: #ffffff;
  --error: #a3221b;
  --error-background: #fdf0ef;
  --error-border: #efc2be;
  --received: #17703f;
  --received-background: #e5f4ea;
  --refused: #9a4a00;
  --refused-background: #fbefe3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 12px 32px rgba(16, 24, 40, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0e1014;
    --card: #171a20;
    --text: #e9ebef;
    --muted: #a6adba;
    --border: #2a2f39;
    --badge: #22262e;
    --input: #0f1216;
    --input-border: #6b7383;
    --accent: #8bb0ff;
    --accent-hover: #a8c4ff;
    --on-accent: #0b1530;
    --error: #ffb4ab;
    --error-background: #3a1714;
    --error-border: #6b2a24;
    --received: #7ad6a0;
    --received-background: #15301f;
    --refused: #ffc58a;
    --refused-background: #36240f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 40px 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

main {
  width: 100%;
  max-width: 27rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 24px;
}

.brand svg {
  width: 30px;
  height: 30px;
}

.brand .mark {
  fill: var(--accent);
}

.brand .orbit {
  fill: none;
  stroke: var(--on-accent);
}

.brand .moon {
  fill: var(--on-accent);
}

.wordmark {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--badge);
}

.badge svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.for {
  margin: 6px 0 0;
  color: var(--muted);
}

.why {
  margin: 16px 0 0;
}

#error {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--error-border);
  border-radius: 10px;
  font-weight: 500;
  color: var(--error);
  background: var(--error-background);
}

form {
  margin: 24px 0 0;
}

.field + .field {
  margin-top: 18px;
}

label {
  display: block;
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

input {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--input);
}

input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 28px 0 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

button.secondary {
  margin-top: 12px;
  color: var(--text);
  background: var(--badge);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--border);
}

#switch-account {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

button.link {
  display: inline;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: 500;
  color: var(--accent);
  background: none;
  text-decoration: underline;
}

button.link:hover {
  background: none;
}

a {
  color: var(--accent);
}

.note {
  margin: 24px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.status {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 0 18px;
  border-radius: 50%;
}

.status svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status.received {
  color: var(--received);
  background: var(--received-background);
}

.status.refused {
  color: var(--refused);
  background: var(--refused-background);
}

#notice {
  margin: 10px 0 0;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
}

.simulated {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--refused);
  background: var(--refused-background);
}

h2 {
  margin: 24px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.grants {
  margin: 8px 0 0;
  padding-left: 20px;
}

.grants li + li {
  margin-top: 6px;
}

.grants ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

/* The signed-in customer's pages (wide_document): wide on a desktop, stacked on a phone. */

body.wide {
  justify-content: flex-start;
  padding: 32px 24px 48px;
}

body.wide main {
  max-width: 68rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0 0 24px;
}

.top .brand {
  margin: 0;
}

.top nav {
  display: flex;
  gap: 4px;
}

.top nav a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.top nav a:hover {
  color: var(--text);
  background: var(--badge);
}

.top nav a[aria-current="page"] {
  font-weight: 600;
  color: var(--text);
  background: var(--badge);
}

body.wide .card {
  padding: 32px 36px;
}

.figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 0;
}

.figures div {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.figures dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.figures dd {
  margin: 0;
}

.figures .amount {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.figures .detail {
  font-size: 13px;
  color: var(--muted);
}

.table {
  margin: 10px 0 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td[data-label="Date"],
td[data-label="Connected"],
td[data-label="Last used"] {
  white-space: nowrap;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.muted,
tr.voided td {
  color: var(--muted);
}

tr.voided strong {
  text-decoration: line-through;
}

td.action {
  text-align: right;
}

td.action form {
  margin: 0;
}

td.action button,
body.wide #sign-out button {
  display: inline-block;
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 6px 16px;
  font-size: 15px;
}

body.wide #sign-out {
  margin: 28px 0 0;
}

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

@media (max-width: 760px) {
  body.wide {
    padding: 24px 14px;
  }

  body.wide .card {
    padding: 24px 20px;
  }

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

  .table {
    overflow: visible;
  }

  .table table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table tr {
    margin: 0 0 10px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  .table td::before {
    content: attr(data-label);
    flex: none;
    font-weight: 600;
    text-align: left;
    color: var(--muted);
  }

  .table td.action {
    justify-content: flex-end;
  }

  .table td.action::before {
    content: none;
  }
}

@media (max-width: 480px) {
  body {
    justify-content: flex-start;
    padding: 24px 14px;
  }

  .brand {
    margin-bottom: 20px;
  }

  .card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  h1 {
    font-size: 22px;
  }
}

button.stop {
  color: #ffffff;
  background: #b42318;
}

button.stop:hover {
  background: #912018;
}

.watch-screen {
  display: block;
  width: 100%;
  max-height: 80vh;
  aspect-ratio: 16 / 10;
  margin: 16px 0 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #000000;
  object-fit: contain;
}

.activity {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.activity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.activity-channel {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.activity-channel.assistant {
  color: #204691;
  background: #e8efff;
}

.activity-channel.internal {
  color: #6b3c00;
  background: #fff0d6;
}

#activity-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.activity-entry {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
}

.activity-entry.assistant {
  border-left-color: #4976d1;
}

.activity-entry.internal {
  border-left-color: #c47a16;
}

.activity-entry-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-entry-heading strong {
  flex: 1;
  font-size: 14px;
}

.activity-entry-heading time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.activity-entry dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0 0;
}

.activity-entry dl div {
  display: flex;
  gap: 5px;
  font-size: 13px;
}

.activity-entry dt {
  font-weight: 600;
  color: var(--muted);
}

.activity-entry dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.activity-channel.job {
  color: #215c2e;
  background: #e2f5e6;
}

.activity-entry.job {
  border-left-color: #3c9a52;
}

.activity-screenshots {
  margin: 8px 0 0;
  font-size: 13px;
}

.activity-entry details {
  margin-top: 8px;
  font-size: 13px;
}

.activity-entry summary {
  cursor: pointer;
  color: var(--muted);
}

.activity-entry pre {
  margin: 6px 0 0;
  padding: 10px;
  max-height: 480px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  .activity-channel.assistant {
    color: #b9ceff;
    background: #1c315b;
  }

  .activity-channel.internal {
    color: #ffd699;
    background: #4a3010;
  }

  .activity-channel.job {
    color: #b5ecc1;
    background: #173d20;
  }
}

@media (max-width: 480px) {
  .activity-entry-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .activity-entry-heading strong {
    flex-basis: 100%;
    order: 3;
  }
}
