:root {
  color-scheme: dark;
  --bg: #1c1c1c;
  --surface: #222;
  --fg: #ededed;
  --muted: #aaa;
  --border: #363636;
  --action: #ededed;
  --action-fg: #171717;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--fg);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #f1f1f1;
  --fg: #202020;
  --muted: #606060;
  --border: #d4d4d4;
  --action: #202020;
  --action-fg: #fff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
.cloud-sign-in {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin: 16px 0;
}
.cloud-sign-in .secondary {
  margin: 0;
}
main {
  padding: 20px;
  min-height: 100vh;
  max-width: 1100px;
  margin: auto;
}
button,
input,
textarea,
select,
a {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button,
.primary {
  min-height: 36px;
  cursor: pointer;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover,
a:hover {
  background: var(--surface);
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
.primary {
  background: var(--action);
  color: var(--action-fg);
  border-color: var(--action);
}
.primary:hover {
  opacity: 0.88;
  background: var(--action);
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
input,
textarea,
select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  caret-color: var(--fg);
}
input,
textarea {
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 88px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
::selection {
  background: var(--fg);
  color: var(--bg);
}
[hidden] {
  display: none !important;
}
h1 {
  font-size: 19px;
  line-height: 1.3;
  margin: 0 0 8px;
  font-weight: 600;
}
h2 {
  font-size: 15px;
  margin: 0 0 10px;
  font-weight: 600;
}
p {
  margin: 7px 0;
  max-width: 72ch;
}
label {
  display: block;
  margin: 0 0 8px;
}
.secondary {
  color: var(--muted);
  font-size: 12px;
}
.connection {
  min-height: 27px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.connection a {
  white-space: nowrap;
}
#error {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  margin: 0 0 16px;
  color: var(--fg);
}
#signed-out,
#connected,
#invitation {
  padding: 44px 0;
  max-width: 580px;
}
#signed-out .primary,
#connected .primary {
  margin: 20px 0 12px;
}
header {
  margin-bottom: 20px;
}
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.chat-header h1 {
  font-size: 17px;
}
.actions,
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline input {
  flex: 1;
  min-width: 0;
}
.inline button {
  white-space: nowrap;
}
#create-room {
  margin: 22px 0;
}
.room-list {
  border-top: 1px solid var(--border);
}
.room-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 15px 4px;
  background: transparent;
}
.room-row span:last-child {
  color: var(--muted);
  font-size: 12px;
}
.participants {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  flex-wrap: wrap;
}
.members {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.member {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}
.member small {
  color: var(--muted);
}
.member button {
  border: 0;
  padding: 0 4px;
  min-height: 24px;
  font-size: 12px;
  color: var(--muted);
}
.inline-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}
.agent-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.agent-option span {
  display: flex;
  flex-direction: column;
}
.agent-option small {
  font-size: 12px;
  color: var(--muted);
}
.messages {
  min-height: 200px;
  max-height: calc(100vh - 355px);
  overflow: auto;
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.message {
  padding: 0 0 23px;
  max-width: 74ch;
}
.message-header {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
}
.message-header time,
.message-header small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}
.message-body pre {
  font-family: ui-monospace, SFMono-Regular, monospace;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  white-space: pre-wrap;
}
.empty-chat {
  padding: 30px 0;
  color: var(--muted);
}
#compose {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.compose-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 10px;
}
.compact-label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
select {
  padding: 5px 8px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
legend {
  font-size: 12px;
  color: var(--muted);
  float: left;
  margin-right: 8px;
  padding: 6px 0;
}
fieldset label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  margin: 0;
  font-size: 12px;
}
fieldset input {
  width: auto;
  accent-color: var(--fg);
}
.review pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  max-height: 240px;
  overflow: auto;
  margin: 15px 0;
}
.review .actions {
  justify-content: flex-end;
}
#agent-consent {
  font-size: 12px;
  color: var(--muted);
  margin: 15px 0;
}
#pending {
  margin: 5px 0 12px;
}
@media (max-width: 600px) {
  main {
    padding: 14px;
  }
  .chat-header {
    flex-direction: column;
    gap: 8px;
  }
  .actions {
    flex-wrap: wrap;
  }
  button,
  .primary {
    min-height: 44px;
  }
  .inline {
    flex-direction: column;
    align-items: stretch;
  }
  .messages {
    max-height: 360px;
    min-height: 180px;
  }
  .compose-controls {
    align-items: stretch;
  }
  .compose-controls > .primary {
    width: 100%;
  }
  fieldset {
    width: 100%;
    gap: 12px;
  }
  fieldset label {
    min-height: 40px;
  }
  .participants {
    gap: 8px;
  }
  #signed-out,
  #connected,
  #invitation {
    padding: 24px 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  a,
  input,
  textarea {
    transition:
      background-color 120ms ease-out,
      border-color 120ms ease-out;
  }
}
:root[data-navigation="true"] {
  --bg: #1c1c1c;
  font-size: 12px;
}
html[data-navigation="true"] main {
  padding: 4px;
  min-height: 0;
}
html[data-navigation="true"] .connection {
  font-size: 12px;
  margin-bottom: 8px;
  min-height: 20px;
  gap: 4px;
}
html[data-navigation="true"] h1 {
  display: none;
}
html[data-navigation="true"] #signed-out {
  padding: 12px 0;
}
html[data-navigation="true"] #signed-out > p {
  font-size: 12px;
}
html[data-navigation="true"] #signed-out .secondary {
  display: none;
}
html[data-navigation="true"] #signed-out .primary {
  font-size: 12px;
  padding: 6px 8px;
  width: 100%;
  margin: 10px 0;
  min-height: 38px;
}
html[data-navigation="true"] .new-conversation {
  width: 100%;
  margin: 0 0 10px;
  font-size: 12px;
  min-height: 36px;
}
html[data-navigation="true"] #home > header {
  display: none;
}
html[data-navigation="true"] .room-row {
  padding: 12px 4px;
  align-items: flex-start;
  gap: 4px;
  min-height: 42px;
}
html[data-navigation="true"] .room-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-navigation="true"] .room-row > span:last-child {
  font-size: 12px;
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#conversation-filter {
  margin: 4px 0 12px;
  font-size: 12px;
  min-height: 36px;
}
.connection #sign-out {
  font-size: 12px;
  min-height: 28px;
  padding: 3px 7px;
  flex-shrink: 0;
}
.stats-list {
  margin: 28px 0;
  max-width: 580px;
  font-variant-numeric: tabular-nums;
}
.stats-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}
.stats-list dt {
  color: var(--muted);
}
.stats-list dd {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}
html[data-navigation="true"] .connection {
  flex-wrap: wrap;
}
main {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.connection,
.chat-header,
.participants,
#compose {
  flex-shrink: 0;
}
#conversation {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.messages {
  flex: 1;
  min-height: 110px;
  max-height: none;
}
#home {
  overflow: auto;
  min-height: 0;
}
html[data-navigation="true"] main {
  height: auto;
  display: block;
}
