/* The app, /app: plain on purpose. A bar, the nav on the left, the page on the right. */

:root {
  color-scheme: light dark;
  font-family: system-ui, sans-serif;
  font-size: 15px;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid GrayText;
}

.top .brand {
  font-weight: bold;
}

.spacer {
  flex: 1;
}

.small {
  font-size: 0.85rem;
  opacity: 0.8;
}

.error {
  color: #b3261e;
  padding: 0 0.75rem;
}

.notice {
  padding: 1rem 0.75rem;
}

#layout {
  flex: 1;
  min-height: 0;
  display: flex;
}

#nav {
  width: 16rem;
  flex-shrink: 0;
  overflow: auto;
  padding: 0.75rem;
  border-right: 1px solid GrayText;
}

#nav .group {
  margin-bottom: 0.75rem;
}

#nav .station-link {
  font-weight: bold;
}

#nav ul {
  margin: 0.25rem 0 0;
  padding-left: 1rem;
  list-style: none;
}

#nav [aria-current='page'] {
  background: Highlight;
  color: HighlightText;
}

#main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

#main h1 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
}

#main h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

.state[data-state='running'] {
  color: #2e7d32;
}

.state[data-state='failed'] {
  color: #b3261e;
}

.state[data-state='stopped'] {
  opacity: 0.7;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

button.danger {
  color: #b3261e;
}

button.link {
  border: none;
  background: none;
  padding: 0;
  color: LinkText;
  text-decoration: underline;
  cursor: pointer;
  margin-right: 0.75rem;
}

.tabset {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 24rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid GrayText;
}

.tab {
  border: 1px solid GrayText;
  border-bottom: none;
  background: Canvas;
  color: CanvasText;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.tab[aria-selected='true'] {
  background: CanvasText;
  color: Canvas;
}

.sub-tabs .tab {
  font-size: 0.85rem;
}

.panels,
.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel {
  padding-top: 0.5rem;
}

iframe.view {
  flex: 1;
  width: 100%;
  min-height: 30rem;
  border: 1px solid GrayText;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
}

.messages li {
  border: 1px solid GrayText;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
}

.messages li.mine {
  margin-left: 3rem;
}

.messages li.theirs {
  margin-right: 3rem;
}

.messages .text {
  white-space: pre-wrap;
  margin: 0.25rem 0;
}

.compose textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
}

.compose .row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.console-bar {
  padding: 0.25rem 0;
}

.terminal {
  flex: 1;
  min-height: 24rem;
  background: #1e1e1e;
}

form.spawn {
  display: grid;
  gap: 0.5rem;
  max-width: 32rem;
}

form.spawn label {
  display: grid;
  gap: 0.15rem;
}

table {
  border-collapse: collapse;
}

th,
td {
  border: 1px solid GrayText;
  padding: 0.25rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

td pre {
  margin: 0;
  white-space: pre-wrap;
}

.meta-agent {
  min-height: 28rem;
  display: flex;
  flex-direction: column;
}

[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  .error,
  .state[data-state='failed'],
  button.danger {
    color: #f2b8b5;
  }

  .state[data-state='running'] {
    color: #7fd99a;
  }
}

@media (max-width: 640px) {
  #layout {
    flex-direction: column;
  }

  #nav {
    width: auto;
    max-height: 30vh;
    border-right: none;
    border-bottom: 1px solid GrayText;
  }
}
