:root {
  color: #14343c;
  background: #e7f4f6;
  font-family: "Segoe UI", system-ui, sans-serif;
  --brand: #0f7f96;
  --line: #d7e7ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

[hidden] {
  display: none !important;
}

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: #0f6f86;
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.balance {
  background: #e3f4f7;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  text-decoration: none;
}

.who {
  color: #4d6670;
  font-size: 14px;
}

.link-button {
  background: none;
  border: 0;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.signed-out .layout {
  justify-content: center;
}

.side {
  flex: 0 0 200px;
}

.side-title {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b8790;
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.side nav a {
  color: #14343c;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
}

.side nav a:hover {
  background: #d6edf1;
}

.side nav a.active {
  background: var(--brand);
  color: white;
}

main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.signed-out main {
  align-items: center;
}

.card {
  width: 100%;
  background: white;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(20, 70, 80, 0.07);
  overflow-x: auto;
}

.card.narrow {
  max-width: 440px;
}

h1 {
  margin: 0 0 12px;
  font-size: 26px;
}

h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

.eyebrow {
  margin: 0;
  color: #0f6f86;
  font-weight: 700;
}

.muted {
  color: #4d6670;
  line-height: 1.5;
}

.small {
  font-size: 13px;
}

.error,
.notice {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
}

.error {
  color: #9f1239;
  background: #fff1f2;
}

.notice {
  color: #065f46;
  background: #ecfdf5;
}

main > .error,
main > .notice {
  width: 100%;
}

.button {
  display: inline-block;
  background: var(--brand);
  color: white;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  cursor: pointer;
}

.button.secondary {
  background: #e3f4f7;
  color: var(--brand);
}

.button.danger {
  background: #be123c;
}

.button.small {
  padding: 6px 12px;
  font-size: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 460px;
}

.stack .button {
  align-self: flex-start;
  margin-top: 6px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.row.tight {
  margin: 6px 0 0;
}

.row.wrap {
  flex-wrap: wrap;
}

.stack .stack {
  max-width: none;
}

label {
  font-weight: 600;
  font-size: 14px;
}

input,
select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #c8dde1;
  border-radius: 10px;
  background: #f6fbfc;
  min-width: 0;
}

.row input {
  flex: 1;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font: inherit;
  font-size: 13px;
  border: 1px solid #c8dde1;
  background: white;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

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

th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid #edf4f5;
  vertical-align: top;
}

th {
  color: #4d6670;
  font-weight: 600;
}

td.clip {
  max-width: 280px;
  overflow-wrap: anywhere;
}

.plus {
  color: #047857;
}

.minus {
  color: #be123c;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  background: #eef3f4;
  color: #4d6670;
  white-space: nowrap;
}

.pill.paid,
.pill.credited,
.pill.assigned {
  background: #dcfce7;
  color: #166534;
}

.pill.pending {
  background: #fef9c3;
  color: #854d0e;
}

.pill.unmatched {
  background: #ffe4e6;
  color: #9f1239;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0 0 16px;
}

.facts dt {
  color: #4d6670;
}

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

.code {
  font-size: 20px;
  letter-spacing: 0.05em;
}

.deposit-grid {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 16px 0;
}

.qr {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats div.warn {
  border-color: #fda4af;
  background: #fff1f2;
}

.stats span {
  color: #4d6670;
  font-size: 13px;
}

.stats strong {
  font-size: 22px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tabs a {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef6f7;
  color: #14343c;
}

.tabs a.active {
  background: var(--brand);
  color: white;
}

.head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.head-row h1 {
  margin: 0;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.slot-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.slot-card:hover {
  border-color: var(--brand);
}

.slot-card.expired {
  opacity: 0.6;
}

.slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slot-id {
  color: #4d6670;
  font-size: 13px;
}

.slot-name {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.pill.running {
  background: #dcfce7;
  color: #166534;
}

.pill.paused {
  background: #e0f2fe;
  color: #075985;
}

.pill.expired,
.pill.net_error,
.pill.dead {
  background: #ffe4e6;
  color: #9f1239;
}

.pill.alive {
  background: #dcfce7;
  color: #166534;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}

.danger-text {
  color: #be123c;
  margin-top: 12px;
}

input.tiny {
  width: 70px;
}

code {
  background: #eef6f7;
  border-radius: 6px;
  padding: 2px 6px;
  overflow-wrap: anywhere;
}

.card form.stack + form {
  margin-top: 18px;
}

.worker-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.worker-box p {
  margin: 0;
  flex: 1 1 240px;
}

.play {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.phone {
  width: min(100%, calc(var(--screen-w) * 1.5 + 36px));
  min-width: 260px;
  background: #1d2a30;
  border-radius: 28px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  user-select: none;
  -webkit-user-select: none;
}

.screen {
  position: relative;
  background: black;
  border-radius: 8px;
  overflow: hidden;
}

.screen canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  touch-action: none;
  cursor: pointer;
}

.screen-note {
  position: absolute;
  inset: auto 10px 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 30, 36, 0.85);
  color: white;
  font-size: 14px;
  text-align: center;
}

.keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.keys button {
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  padding: 10px 0;
  border: 0;
  border-radius: 12px;
  background: #33464e;
  color: white;
  cursor: pointer;
  touch-action: none;
}

.keys button.small-label {
  font-size: 13px;
  background: #26363d;
}

.keys button.soft {
  font-size: 13px;
  background: #26363d;
  border-top: 3px solid #5fb4c4;
}

.keys button.fire {
  background: var(--brand);
}

.keys button.down {
  background: #5fb4c4;
  color: #10262c;
}

.watch-only .keys button {
  opacity: 0.45;
  cursor: not-allowed;
}

.play-side {
  flex: 1 1 260px;
  max-width: 420px;
}

.play-side h2 {
  margin-top: 18px;
}

@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    padding: 16px;
  }

  .side {
    flex: none;
  }

  .side nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .who {
    display: none;
  }
}
