:root {
  color: #e5eef7;
  background: #07111d;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 20rem;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 2%, #123955 0, transparent 36%),
    linear-gradient(145deg, #07111d, #0b1726 60%, #111d2c);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 2px solid #69d5ff;
  outline-offset: 3px;
}

code,
pre,
input {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.app-shell {
  width: min(88rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.app-header h1,
.card h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.app-header h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.card h2 {
  font-size: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: #69d5ff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.lede,
.muted,
.scope-note {
  color: #9fb2c5;
}

.lede {
  max-width: 48rem;
  margin: 0.75rem 0 0;
  line-height: 1.6;
}

.session-panel {
  display: flex;
  flex: 0 1 21rem;
  align-items: flex-end;
  flex-direction: column;
  gap: 0.65rem;
}

.session-notice {
  margin: 0;
  color: #9fb2c5;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: right;
}

.session-notice.good {
  color: #88e4b4;
}

.session-notice.warning {
  color: #ffd58a;
}

.card {
  margin-top: 1rem;
  padding: 1.35rem;
  border: 1px solid #294156;
  border-radius: 1rem;
  background: rgb(9 22 36 / 90%);
  box-shadow: 0 1.2rem 3rem rgb(0 0 0 / 18%);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.scope-note,
.muted {
  font-size: 0.84rem;
}

.scope-note {
  padding: 0.3rem 0.55rem;
  border: 1px solid #294156;
  border-radius: 999px;
  white-space: nowrap;
}

.inline-form,
.button-row,
.two-fields {
  display: flex;
  gap: 0.75rem;
}

.inline-form {
  align-items: flex-end;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.two-fields > .field {
  min-width: 0;
  flex: 1;
}

.field {
  display: grid;
  gap: 0.4rem;
  color: #cbd9e5;
  font-size: 0.82rem;
  font-weight: 650;
}

.field.grow {
  flex: 1;
}

.field input,
.field select {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #38536a;
  border-radius: 0.55rem;
  color: #edf7ff;
  background: #0b1b2b;
}

.field input::placeholder {
  color: #61778b;
}

.field input:focus,
.field select:focus {
  border-color: #69d5ff;
}

.field-error {
  min-height: 1.2rem;
  margin: 0.6rem 0 0;
  color: #ff9e9e;
  font-size: 0.84rem;
}

.button {
  min-height: 2.65rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid #38536a;
  border-radius: 0.55rem;
  color: #eaf7ff;
  font-weight: 700;
  white-space: nowrap;
}

.button.primary {
  border-color: #43a6cc;
  background: #126182;
}

.button.primary:hover:not(:disabled) {
  background: #197ca2;
}

.button.secondary {
  background: #122638;
}

.button.secondary:hover:not(:disabled) {
  background: #1b354b;
}

.recording-list,
.stream-list {
  display: grid;
  gap: 0.55rem;
}

.recording-row,
.stream-row {
  display: grid;
  align-items: center;
  gap: 0.2rem 0.75rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid #294156;
  border-radius: 0.65rem;
  color: #e5eef7;
  background: #0b1b2b;
  text-align: left;
}

.recording-row:hover,
.recording-row.selected,
.stream-row:hover {
  border-color: #4f89a6;
  background: #102a3d;
}

.recording-row strong,
.stream-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-row span,
.stream-row span {
  overflow: hidden;
  color: #8fa7b9;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-row {
  grid-template-columns: auto minmax(8rem, 0.7fr) minmax(10rem, 1fr);
}

.stream-row input {
  accent-color: #55c9ee;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.empty-state {
  margin: 0.3rem 0;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.workflow-grid > .card {
  min-width: 0;
}

.workflow-grid .card > .muted {
  margin: 0 0 1.1rem;
  line-height: 1.55;
}

.mode-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.2rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-fieldset legend {
  width: 100%;
  margin-bottom: 0.25rem;
  color: #cbd9e5;
  font-size: 0.82rem;
  font-weight: 650;
}

.choice {
  color: #cbd9e5;
  font-size: 0.86rem;
}

.choice input {
  accent-color: #55c9ee;
}

.workflow-status {
  min-height: 1.35rem;
  margin: 1rem 0 0.5rem;
  color: #a8c0d2;
  font-size: 0.84rem;
  line-height: 1.5;
}

.media-preview {
  min-height: 3.4rem;
  max-height: 8rem;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  border: 1px solid #21384a;
  border-radius: 0.55rem;
  color: #8fdcf4;
  background: #071521;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.query-results {
  display: grid;
  gap: 0.4rem;
  max-height: 16rem;
  margin: 0;
  padding: 0 0 0 1.5rem;
  overflow: auto;
  color: #c8d9e6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
}

.loading-card {
  width: min(38rem, 100%);
  margin: 20vh auto 0;
  padding: 2.5rem;
  border: 1px solid #294156;
  border-radius: 1rem;
  background: rgb(9 22 36 / 90%);
}

.loading-card h1 {
  margin: 0;
}

.loading-card p:last-child {
  margin-bottom: 0;
  color: #9fb2c5;
  line-height: 1.6;
}

@media (max-width: 54rem) {
  .app-header {
    flex-direction: column;
  }

  .session-panel {
    align-items: flex-start;
  }

  .session-notice {
    text-align: left;
  }

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

@media (max-width: 38rem) {
  .app-shell {
    width: min(100% - 1rem, 88rem);
    padding-top: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .inline-form,
  .two-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form .button {
    width: 100%;
  }

  .stream-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .stream-row span {
    grid-column: 2;
  }

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