* {
  box-sizing: border-box;
}
html,
body,
#app {
  height: 100%;
  margin: 0;
}
body {
  font:
    15px/1.65 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #20393b;
  background: #fafaf7;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #d7ded7;
  border-radius: 9px;
  background: #fff;
  padding: 8px 14px;
  color: inherit;
}
button:hover {
  background: #edf3ee;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.primary {
  background: #195d62;
  border-color: #195d62;
  color: #fff;
  font-weight: 600;
}
.quiet {
  background: transparent;
  border-color: transparent;
  padding: 4px 8px;
}
.subtle,
small {
  color: #7a8880;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 650;
  color: inherit;
  text-decoration: none;
}
.brand .subtle {
  font-weight: 400;
  font-size: 14px;
}
.mark {
  display: grid;
  place-items: center;
  background: #195d62;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 20px;
}
header {
  height: 72px;
  padding: 0 30px;
  border-bottom: 1px solid #e1e6df;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.layout {
  height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: 260px 1fr;
}
aside {
  overflow: auto;
  border-right: 1px solid #e1e6df;
  padding: 24px 14px;
  background: #f1f4f1;
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #7c887e;
  letter-spacing: 1px;
  margin: 12px 10px;
}
.device-group {
  position: relative;
}
.device {
  width: 100%;
  display: flex;
  text-align: left;
  gap: 12px;
  border: 0;
  background: transparent;
  margin: 5px 0;
  padding: 13px 10px;
}
.device small {
  display: block;
  font-size: 11px;
}
.device strong {
  font-size: 14px;
}
.computer {
  font-size: 25px;
  color: #66766b;
}
.selected {
  background: #fff;
  box-shadow: 0 1px 6px #2337290c;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a6ada8;
  margin-right: 5px;
}
.dot.online {
  background: #238363;
}
.revoke {
  position: absolute;
  right: 3px;
  top: 8px;
  font-size: 10px;
  opacity: 0;
}
.device-group:hover .revoke,
.revoke:focus {
  opacity: 1;
}
.session {
  display: flex;
  width: 100%;
  text-align: left;
  flex-direction: column;
  border: 0;
  background: transparent;
  margin: 3px 0;
  padding: 10px;
}
.session span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session small {
  font-size: 11px;
}
.session.selected {
  background: #dceced;
}
main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  padding: 0 42px;
}
#target {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #e1e6df;
}
#target:empty {
  display: none;
}
#target h2 {
  font-size: 18px;
  margin: 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #7f9484;
}
.welcome {
  max-width: 640px;
  margin: 10vh auto;
}
.welcome h1 {
  font-size: 42px;
  line-height: 1.35;
  letter-spacing: -1.6px;
  font-weight: 550;
}
.welcome p {
  color: #738278;
}
.hint {
  margin-top: 48px;
  font-size: 13px;
  color: #819080;
  border-left: 2px solid #a6bda8;
  padding-left: 15px;
}
.compact {
  margin: 6vh auto;
}
.compact h1 {
  font-size: 30px;
}
#history {
  flex: 1;
  overflow: auto;
  padding: 24px 0;
  min-height: 0;
  scroll-behavior: smooth;
}
.turn {
  max-width: 840px;
  margin: 0 auto 28px;
  padding: 0 4px;
}
.turn.user {
  background: #edf2e9;
  padding: 17px 20px;
  border-radius: 14px;
}
.turn-label {
  font-size: 12px;
  font-weight: 600;
  color: #576d5c;
  margin-bottom: 9px;
}
.turn-label time {
  font-size: 10px;
  margin-left: 10px;
  color: #93a092;
}
.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tool {
  border-left: 2px solid #a1b49d;
  padding: 10px 16px;
  margin: 15px 0;
  background: #f1f4ef;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
}
.tool pre,
details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.permission {
  margin-top: 14px;
  padding: 14px;
  background: #fff5de;
  border: 1px solid #ead9a3;
  border-radius: 8px;
}
.permission button {
  margin: 3px;
}
.working {
  font-size: 12px;
  color: #438567;
}
details {
  margin: 10px 0;
  color: #617062;
}
summary {
  cursor: pointer;
}
.added {
  background: #e5f3e6;
}
.removed {
  background: #f8e7e4;
}
#composer {
  background: #fff;
  border: 1px solid #d9e2d4;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 5px 20px #293d2405;
  margin: 8px auto 24px;
  width: 100%;
  max-width: 900px;
}
#composer[hidden] {
  display: none;
}
textarea {
  resize: vertical;
  border: 0;
  background: transparent;
  width: 100%;
  outline: none;
  color: inherit;
  min-height: 65px;
}
#new-options {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}
#new-options label {
  font-size: 12px;
  color: #71816e;
}
select {
  border: 1px solid #dce3d8;
  border-radius: 6px;
  margin-left: 10px;
  padding: 4px;
  max-width: 240px;
  background: #fff;
}
.compose-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.compose-footer span {
  font-size: 11px;
  color: #98a08e;
}
.compose-footer button {
  white-space: nowrap;
}
.empty {
  padding: 12px;
  color: #94a08f;
  font-size: 13px;
}
#notice {
  display: none;
  background: #fff1d8;
  padding: 10px 15px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 13px;
}
#notice.visible {
  display: block;
}
.auth {
  max-width: 440px;
  margin: 10vh auto;
  padding: 24px;
}
.auth h1 {
  font-size: 30px;
  margin-top: 48px;
}
.auth p {
  color: #819080;
}
.auth label {
  display: block;
  font-size: 13px;
  margin: 20px 0;
}
.auth input {
  width: 100%;
  margin-top: 7px;
  padding: 11px;
  border: 1px solid #d7e0d4;
  border-radius: 8px;
  background: #fff;
}
.auth .primary {
  width: 100%;
  margin-top: 15px;
}
dialog {
  border: 1px solid #d3ddcf;
  border-radius: 16px;
  max-width: min(580px, 90vw);
  padding: 28px;
}
dialog::backdrop {
  background: #11281b66;
}
dialog code {
  font-size: 24px;
  color: #195d62;
}
dialog pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #edf2e9;
  padding: 12px;
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}
@media (max-width: 700px) {
  header {
    height: 60px;
    padding: 0 16px;
  }
  .brand .subtle,
  #connection {
    display: none;
  }
  .header-actions {
    gap: 2px;
  }
  .layout {
    height: calc(100dvh - 60px);
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid #e1e6df;
    padding: 8px 12px;
    max-height: 180px;
  }
  .section-label {
    margin: 3px;
    font-size: 10px;
  }
  #devices,
  #sessions {
    display: flex;
    overflow-x: auto;
    gap: 6px;
  }
  .device-group {
    flex-shrink: 0;
  }
  .device {
    margin: 0;
    padding: 5px 9px;
    gap: 8px;
  }
  .device strong {
    font-size: 12px;
  }
  .computer {
    font-size: 19px;
  }
  .revoke {
    display: none;
  }
  .session {
    width: auto;
    min-width: 110px;
    max-width: 180px;
    flex-shrink: 0;
    padding: 5px 9px;
  }
  .session small {
    display: none;
  }
  main {
    padding: 0 16px;
  }
  #target {
    padding: 10px 0;
  }
  #history {
    padding: 16px 0;
  }
  .welcome {
    margin: 5vh auto;
  }
  .welcome h1 {
    font-size: 30px;
  }
  .hint {
    margin-top: 24px;
  }
  #composer {
    margin-bottom: max(12px, env(safe-area-inset-bottom));
    padding: 10px;
  }
  #new-options {
    gap: 6px;
    flex-wrap: wrap;
  }
  select {
    max-width: 160px;
  }
  textarea {
    font-size: 16px;
  }
  .compose-footer span {
    max-width: 180px;
  }
  .auth {
    margin: 5vh auto;
  }
}

/* Moor navigation and readable agent output. */
[hidden] {
  display: none !important;
}
.mark {
  object-fit: cover;
  background: #133f43;
}
.layout {
  grid-template-columns: 290px minmax(0, 1fr);
}
#navigation-controls {
  display: grid;
  gap: 9px;
  margin: 10px 4px;
}
#navigation-controls label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #657978;
}
#navigation-controls select {
  min-width: 0;
  width: 190px;
  margin: 0;
}
#session-search {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #d7e0dc;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font-size: 14px;
}
#session-count {
  font-size: 11px;
  padding: 0 10px 6px;
}
#nav-toggle,
#nav-shade {
  display: none;
}
.markdown {
  overflow-wrap: anywhere;
}
.markdown p {
  margin: 0 0 12px;
}
.markdown h2,
.markdown h3,
.markdown h4 {
  margin: 20px 0 10px;
  line-height: 1.4;
}
.markdown h2 {
  font-size: 23px;
}
.markdown h3 {
  font-size: 19px;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
}
.markdown a {
  color: #195d62;
  text-underline-offset: 3px;
}
.markdown blockquote {
  margin: 10px 0;
  border-left: 3px solid #b1c9c4;
  padding: 8px 14px;
  color: #657978;
}
.markdown :not(pre) > code {
  background: #e9eeea;
  color: #1d565c;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
.code-block {
  border: 1px solid #d5dfda;
  border-radius: 9px;
  background: #fcfdfb;
  overflow: hidden;
  margin: 10px 0;
  min-width: 0;
  color: #243c3d;
}
.code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #edf2ef;
  border-bottom: 1px solid #dce5df;
  padding: 5px 10px;
  font-size: 11px;
}
.code-toolbar span {
  overflow-wrap: anywhere;
}
.code-toolbar button {
  padding: 3px 8px;
  font-size: 11px;
  flex-shrink: 0;
}
.code-block pre,
.tool .code-block pre,
details .code-block pre {
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  max-height: 450px;
  padding: 12px;
  margin: 0;
  font:
    12px/1.7 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  tab-size: 2;
}
.code-block > small {
  display: block;
  padding: 8px 12px;
}
.diff-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.diff-pair > :first-child .code-toolbar {
  background: #faece9;
}
.diff-pair > :last-child .code-toolbar {
  background: #e5f0e7;
}
.file-changes {
  padding: 0;
  font-size: 12px;
  list-style: none;
}
.file-changes li {
  display: flex;
  gap: 9px;
  padding: 6px 0;
}
.file-changes li > :first-child {
  flex: 1;
  overflow-wrap: anywhere;
}
.added-count {
  color: #268052;
}
.removed-count {
  color: #bc5346;
}
.tool-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.tool-status {
  font-size: 11px;
  white-space: nowrap;
  color: #557c68;
}
.tool-status.failed {
  color: #bb5148;
}
:focus-visible {
  outline: 2px solid #39858b;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  header {
    gap: 6px;
  }
  .brand {
    font-size: 17px;
    gap: 7px;
  }
  .mark {
    width: 28px;
    height: 28px;
  }
  .header-actions {
    margin-left: auto;
  }
  #connection {
    display: block;
    font-size: 10px;
    max-width: 60px;
    line-height: 1.3;
  }
  #pair,
  #logout {
    padding: 5px;
    font-size: 11px;
  }
  #nav-toggle {
    display: block;
    font-size: 20px;
    padding: 4px 6px;
  }
  .layout {
    display: flex;
    height: calc(100dvh - 60px);
  }
  main {
    flex: 1;
  }
  aside {
    display: none;
    position: fixed;
    z-index: 20;
    top: 60px;
    bottom: 0;
    left: 0;
    width: min(320px, 88vw);
    max-height: none;
    padding: 14px;
    box-shadow: 10px 0 40px #16382d20;
  }
  #app[data-nav-open] aside {
    display: block;
  }
  #app[data-nav-open] #nav-shade {
    display: block;
    position: fixed;
    inset: 60px 0 0;
    z-index: 19;
    background: #173c3e55;
    border: 0;
    border-radius: 0;
  }
  #devices,
  #sessions {
    display: block;
    overflow: visible;
  }
  .device,
  .session {
    width: 100%;
    max-width: none;
    margin: 5px 0;
    padding: 10px;
  }
  .session small {
    display: block;
  }
  .device strong {
    font-size: 14px;
  }
  .section-label {
    margin: 12px 8px;
    font-size: 12px;
  }
  .revoke {
    display: block;
    opacity: 1;
  }
  #session-search,
  #navigation-controls select {
    font-size: 16px;
  }
  .diff-pair {
    grid-template-columns: minmax(0, 1fr);
  }
  #target {
    font-size: 12px;
    gap: 10px;
  }
  #target h2 {
    font-size: 16px;
  }
  .turn.user {
    padding: 12px 14px;
  }
  .tool {
    padding: 10px;
  }
  .compose-footer span {
    max-width: 170px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #history {
    scroll-behavior: auto;
  }
}
