:root {
  background: #edf1f5;
  color: #151922;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  background: #111827;
  border: 1px solid #111827;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 13px;
}

button.secondary {
  background: #fff;
  border-color: #c9d1dc;
  color: #18202c;
}

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

a {
  color: #0b66c3;
  font-weight: 750;
}

.shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto 14px;
  max-width: 1380px;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}

p {
  color: #5d6878;
  margin: 7px 0 0;
}

.tabs {
  background: #dfe5ee;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
}

.tab {
  background: transparent;
  border: 0;
  color: #283242;
}

.tab.is-active {
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 12%);
}

.view {
  display: grid;
  gap: 14px;
  grid-template-columns: 370px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1380px;
}

.is-hidden {
  display: none;
}

.panel {
  background: #fff;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  padding: 14px;
}

.controls {
  align-self: start;
  display: grid;
  gap: 12px;
}

.file-picker input {
  display: none;
}

.file-picker span {
  align-items: center;
  background: #111827;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-weight: 750;
  height: 42px;
  justify-content: center;
}

.grid {
  display: grid;
  gap: 10px;
}

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

.grid label {
  color: #3b4655;
  display: grid;
  gap: 5px;
  font-size: 13px;
}

.grid input,
.grid select,
textarea {
  border: 1px solid #c9d1dc;
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 82px;
  resize: vertical;
  width: 100%;
}

.stats {
  background: #f6f8fb;
  border: 1px solid #e1e6ee;
  border-radius: 7px;
  color: #293341;
  font-size: 14px;
  line-height: 1.45;
  min-height: 76px;
  padding: 11px;
  word-break: break-word;
}

.audio-diag-log {
  min-height: 132px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre;
  overflow: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage,
.receiver {
  align-items: center;
  background: #070a10;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 130px);
  overflow: hidden;
  position: relative;
}

#tx-canvas,
#return-canvas,
#cf-tx-canvas {
  aspect-ratio: 1;
  background: #fff;
  height: 74vmin;
  max-height: 980px;
  max-width: 980px;
  width: 74vmin;
}

.overlay {
  background: rgb(255 255 255 / 90%);
  border-radius: 7px;
  bottom: 14px;
  color: #111827;
  font-size: 13px;
  font-weight: 750;
  left: 50%;
  padding: 8px 11px;
  position: absolute;
  transform: translateX(-50%);
}

#rx-video,
#pc-rx-video,
#cf-rx-video {
  height: 100%;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

#rx-canvas,
#pc-rx-canvas,
#cf-rx-canvas {
  display: none;
}

.compact-note {
  font-size: 12px;
  margin-top: 6px;
  min-height: 0;
  opacity: 0.72;
}

.cf-missing-control {
  color: #3b4655;
  display: grid;
  font-size: 13px;
  gap: 5px;
}

.cf-missing-control input {
  border: 1px solid #c9d1dc;
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.input-hint {
  color: #687385;
  font-size: 12px;
  line-height: 1.45;
}

.scan-guide {
  aspect-ratio: 1;
  border: 3px solid #00d4ff;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 25%), inset 0 0 0 1px rgb(255 255 255 / 80%);
  position: absolute;
  width: 90%;
}

.records {
  max-width: 1380px;
}

.settings-view {
  display: grid;
  gap: 12px;
}

.stacked {
  color: #3b4655;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

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

th,
td {
  border-bottom: 1px solid #e1e6ee;
  font-size: 13px;
  padding: 9px;
  text-align: left;
}

@media (max-width: 920px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .view {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stage,
  .receiver {
    min-height: 58vh;
  }

  #tx-canvas,
  #return-canvas,
  #cf-tx-canvas {
    height: 92vw;
    width: 92vw;
  }
}
