:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #f7faf7;
  --ink: #1d2525;
  --muted: #687272;
  --line: #d8ded8;
  --accent: #0d7c66;
  --blue: #2e5fa8;
  --gold: #b67c25;
  --red: #b8473b;
  --shadow: 0 18px 60px rgba(25, 37, 37, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    linear-gradient(135deg, rgba(13, 124, 102, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(46, 95, 168, 0.08), transparent 24%),
    var(--bg);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(264px, 316px) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(16px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand,
.composer-actions,
.section-title,
.chat-header,
.target-row,
.room-heading,
.device-top,
.resume-pill {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: #182423;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px;
  box-shadow: var(--shadow);
}

.brand-mark span {
  border-radius: 3px;
  background: var(--accent);
}

.brand-mark span:nth-child(2) {
  background: var(--gold);
}

.brand-mark span:nth-child(3) {
  background: var(--blue);
}

.brand h1,
.brand p,
.chat-header h2,
.chat-header p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  line-height: 1.1;
}

.brand p,
.eyebrow,
.room-subtitle,
.sync-status {
  color: var(--muted);
  font-size: 12px;
}

.target-row {
  gap: 8px;
  flex-wrap: wrap;
}

.icon-text,
.secondary,
.primary,
.target-button {
  min-height: 36px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-text,
.secondary,
.target-button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-text:hover,
.secondary:hover,
.target-button:hover {
  border-color: #a8b4ad;
}

.primary {
  background: var(--accent);
  color: white;
  min-width: 120px;
}

.primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.device-list,
.rooms-panel,
.thread-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.rooms-panel {
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  flex: 1 1 auto;
}

.device-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 10px 30px 30px;
  align-items: center;
  gap: 8px;
}

.device-avatar-stack {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.device-copy {
  min-width: 0;
  flex: 1;
}

.device-name {
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta span,
.device-meta small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta small {
  color: #7d6a42;
  font-size: 10px;
  line-height: 1.3;
}

.work-label {
  max-width: 42px;
  min-height: 13px;
  border-radius: 999px;
  padding: 1px 4px;
  color: var(--muted);
  background: #edf2ef;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-label.live {
  color: #6f4b12;
  background: #fff0d2;
  animation: liveBlink 1.05s ease-in-out infinite;
}

.mini-avatar,
.target-avatar {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.mention-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  font-weight: 800;
}

.remote-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
}

.remote-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(104, 114, 114, 0.12);
}

.status-dot.ok {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 124, 102, 0.14);
}

.status-dot.fail {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(184, 71, 59, 0.14);
}

.status-dot.run {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(182, 124, 37, 0.14);
  animation: liveDot 1.05s ease-in-out infinite;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: #edf2ef;
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill.local {
  color: var(--blue);
}

.pill.ok {
  color: var(--accent);
}

.pill.fail {
  color: var(--red);
}

.pill.run {
  color: var(--gold);
}

.activity-pill {
  gap: 5px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-avatar {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  flex: 0 0 auto;
}

.section-title {
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.new-thread-button {
  min-height: 32px;
  padding: 0 9px;
}

.sync-status {
  min-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

.thread-button {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 8px;
}

.thread-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e7f4ef;
}

.thread-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
}

.thread-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.thread-text strong,
.thread-text em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-text strong {
  font-size: 13px;
  font-style: normal;
}

.thread-text em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.thread-button small {
  color: var(--muted);
}

.chat {
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 22px;
  gap: 14px;
}

.chat-header {
  min-width: 0;
  justify-content: space-between;
  gap: 20px;
}

.mobile-back {
  display: none;
}

.room-heading {
  min-width: 0;
  flex: 1 1 auto;
  gap: 12px;
}

.room-heading > div {
  min-width: 0;
}

.room-avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(25, 37, 37, 0.16);
}

.chat-header h2 {
  min-width: 0;
  font-size: 22px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.room-subtitle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.target-button {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.resume-pill {
  gap: 8px;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 12px;
  background: #edf2ef;
  border: 1px solid var(--line);
  color: var(--muted);
}

.conversation {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(255, 253, 248, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state {
  margin: auto;
  max-width: 560px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.activity-panel {
  align-self: stretch;
  display: grid;
  gap: 7px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 250, 247, 0.92);
  padding: 10px;
}

.activity-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.activity-row.live {
  grid-template-columns: 24px minmax(0, 1fr);
  color: var(--ink);
}

.activity-row strong,
.activity-row span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.activity-row strong {
  color: var(--ink);
  font-size: 12px;
}

.activity-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@keyframes liveBlink {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

@keyframes liveDot {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.58;
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  max-width: min(900px, 92%);
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(25, 37, 37, 0.12);
}

.bubble {
  min-width: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(25, 37, 37, 0.06);
}

.message.user .bubble {
  color: white;
  background: #1e4e44;
  border-color: #1e4e44;
}

.tone-this-mac .bubble {
  border-color: rgba(13, 124, 102, 0.35);
  background: #effaf5;
}

.tone-macbook-pro .bubble {
  border-color: rgba(46, 95, 168, 0.32);
  background: #f0f5ff;
}

.tone-pc .bubble {
  border-color: rgba(182, 124, 37, 0.32);
  background: #fff7ea;
}

.tone-all .bubble,
.tone-fleet .bubble {
  border-color: rgba(29, 37, 37, 0.18);
  background: #f7faf7;
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.message.user .message-meta {
  color: rgba(255, 255, 255, 0.74);
}

.bubble pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.bubble .stderr {
  color: var(--red);
}

.composer {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}

.composer-input {
  position: relative;
  min-width: 0;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 104px;
  max-height: 280px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.55;
}

.mention-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: min(360px, 100%);
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(25, 37, 37, 0.18);
  padding: 6px;
}

.mention-option {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.mention-option:hover,
.mention-option[aria-selected="true"] {
  background: #edf2ef;
}

.mention-option span,
.mention-option strong,
.mention-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option span {
  display: grid;
  gap: 2px;
}

.mention-option strong {
  font-size: 13px;
}

.mention-option small {
  color: var(--muted);
  font-size: 11px;
}

textarea::placeholder {
  color: #8a9494;
}

.composer-actions {
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    box-sizing: border-box;
    height: 100dvh;
    border: 0;
    overflow: hidden;
  }

  .rooms-panel {
    flex: 1 1 auto;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .rooms-panel .thread-list {
    display: grid;
    max-height: none;
  }

  .new-thread-button {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 0;
  }

  .new-thread-button svg {
    width: 18px;
    height: 18px;
  }

  .device-list,
  .brand p,
  .status-strip,
  .room-subtitle,
  .eyebrow {
    display: none;
  }

  .chat {
    display: none;
    box-sizing: border-box;
    height: 100dvh;
    min-height: 0;
    padding: 14px;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  body.mobile-chat .sidebar {
    display: none;
  }

  body.mobile-chat .chat {
    display: grid;
  }

  .chat-header {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .mobile-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
  }

  .room-avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .chat-header h2 {
    max-width: 100%;
    font-size: 17px;
    -webkit-line-clamp: 1;
  }

  .conversation {
    min-height: 0;
  }

  #clearChat {
    display: none;
  }

  .composer-actions {
    flex-direction: row;
  }

  .primary {
    width: 100%;
  }
}

/* Final flat chat surface: no framing around the conversation. */
.chat { background: transparent !important; }
.chat-header { border: 0 !important; background: transparent !important; box-shadow: none !important; }
.conversation { max-width: 1180px !important; width: calc(100% - 48px) !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; padding: 26px 0 20px !important; }
.composer { position: relative !important; right: auto !important; bottom: auto !important; left: auto !important; width: min(1180px, calc(100% - 48px)) !important; min-height: 138px !important; margin: 0 auto 20px !important; padding: 14px 16px 10px !important; border: 1px solid #e5e5e5 !important; border-radius: 14px !important; background: #1b1b1b !important; box-shadow: 0 10px 28px rgba(0,0,0,.22) !important; }
.composer:focus-within { border-color: #fff !important; box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 10px 28px rgba(0,0,0,.22) !important; }
.composer-input { min-height: 82px !important; }
.composer textarea { min-height: 80px !important; font-size: 15px !important; }
.composer-actions { min-height: 34px !important; border-top: 1px solid #626262 !important; }
.device-glyph, .mini-avatar, .thread-avatar, .target-avatar, .message-avatar, .pill-avatar, .room-avatar { aspect-ratio: 1; overflow: hidden; border-radius: 50% !important; background: transparent !important; box-shadow: none !important; }

/* Stable three-zone chat layout: header, scrollable transcript, composer. */
.chat { display: grid !important; height: 100dvh !important; grid-template-rows: 58px minmax(0, 1fr) auto !important; gap: 0 !important; padding: 0 !important; }
.target-row { display: none !important; }
.chat-header { grid-row: 1 !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 28px !important; border-bottom: 1px solid #555 !important; }
.conversation { grid-row: 2 !important; width: min(1180px, calc(100% - 48px)) !important; max-width: none !important; height: 100% !important; margin: 0 auto !important; padding: 24px 0 !important; overflow-y: auto !important; }
.composer { grid-row: 3 !important; position: static !important; width: min(1180px, calc(100% - 48px)) !important; min-height: 130px !important; margin: 0 auto 20px !important; padding: 14px 16px 10px !important; border: 1px solid #f1f1f1 !important; border-radius: 14px !important; background: #1b1b1b !important; box-shadow: none !important; }
.composer:focus-within { border-color: #fff !important; box-shadow: 0 0 0 1px rgba(255,255,255,.28) !important; }
.composer-input, .composer textarea { min-height: 76px !important; }
.composer-actions { min-height: 34px !important; border-top: 1px solid #686868 !important; }
@media (max-width: 900px) { .chat { grid-template-rows: 54px minmax(0,1fr) auto !important; } .chat-header { padding: 0 16px !important; } .conversation { width: calc(100% - 32px) !important; padding: 16px 0 !important; } .composer { width: calc(100% - 32px) !important; min-height: 118px !important; margin-bottom: 12px !important; } .composer-input, .composer textarea { min-height: 64px !important; } }
@media (max-width: 900px) { .conversation { width: calc(100% - 32px) !important; padding-top: 18px !important; } .composer { width: calc(100% - 32px) !important; min-height: 124px !important; margin: 0 auto 12px !important; } .composer-input, .composer textarea { min-height: 68px !important; } }

/* Codex workspace layout: a quiet navigation rail and one focused conversation. */
:root { --bg: #171717; --panel: #212121; --panel-hover: #2a2a2a; --line: #303030; --text: #ececec; --muted: #a1a1a1; }
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100dvh; background: var(--bg); }
.sidebar { width: auto; padding: 10px 8px; gap: 0; border-right: 1px solid #2b2b2b; background: #171717; }
.brand { height: 42px; padding: 0 8px; margin-bottom: 8px; align-items: center; }
.brand-mark, .room-avatar { display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: transparent; box-shadow: none; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; font-size: 16px; }
.brand-mark span { display: block; background: none; width: auto; height: auto; transform: none; }
.brand h1 { color: #f5f5f5; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.brand p, .device-card .work-label, .status-dot, .device-card .icon-text, .status-strip, .target-row, .eyebrow { display: none; }
.device-list { gap: 1px; padding: 0 2px 12px; border-bottom: 1px solid #2b2b2b; }
.device-card { display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; min-height: 44px; padding: 6px 7px; gap: 9px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; }
.device-card:hover { background: var(--panel-hover); border: 0; transform: none; }
.device-avatar-stack { display: contents; }
.device-copy { min-width: 0; }
.device-name { overflow: hidden; color: #ddd; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.device-meta { display: none; }
.device-glyph, .mini-avatar, .thread-avatar, .target-avatar, .message-avatar, .pill-avatar { display: grid; place-items: center; flex: 0 0 auto; aspect-ratio: 1; border: 1px solid #4a4a4a; border-radius: 50%; background: transparent; color: #d7d7d7; font-size: 11px; font-weight: 700; letter-spacing: -.02em; line-height: 1; box-shadow: none; }
.device-glyph[data-device="this-mac"], .mini-avatar[data-device="this-mac"], .thread-avatar[data-device="this-mac"], .message-avatar[data-device="this-mac"] { color: #76c9a6; }
.device-glyph[data-device="macbook-pro"], .mini-avatar[data-device="macbook-pro"], .thread-avatar[data-device="macbook-pro"], .message-avatar[data-device="macbook-pro"] { color: #91aaf4; }
.device-glyph[data-device="pc"], .mini-avatar[data-device="pc"], .thread-avatar[data-device="pc"], .message-avatar[data-device="pc"] { color: #e3b86f; }
.mini-avatar { width: 30px; height: 30px; }
.rooms-panel { min-height: 0; margin: 13px 0 0; }
.section-title { height: 34px; padding: 0 7px; color: #9b9b9b; font-size: 12px; font-weight: 500; text-transform: none; }
.new-thread-button { width: 28px; min-width: 28px; height: 28px; padding: 0; justify-content: center; overflow: hidden; color: transparent; border: 0; border-radius: 6px; background: transparent; }
.new-thread-button:hover { background: var(--panel-hover); }
.new-thread-button svg { width: 16px; height: 16px; stroke: #cacaca; }
.thread-list { gap: 1px; overflow: auto; }
.thread-button { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; min-height: 52px; padding: 7px 8px; gap: 9px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; text-align: left; }
.thread-button:hover { background: var(--panel-hover); transform: none; }
.thread-button[aria-pressed="true"] { background: #2a2a2a; border: 0; box-shadow: none; }
.thread-avatar { width: 30px; height: 30px; }
.thread-text { min-width: 0; gap: 2px; }
.thread-text strong { overflow: hidden; color: #dedede; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.thread-text em { overflow: hidden; color: #898989; font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.thread-button small { color: #777; font-size: 10px; }
.sync-status { display: none; }
.chat { min-width: 0; padding: 0; background: transparent; }
.chat-header { display: flex; align-items: center; min-height: 54px; padding: 0 24px; border-bottom: 1px solid #303030; background: transparent; }
.room-heading { gap: 8px; }
.room-avatar { width: 30px; height: 30px; border: 1px solid #4a4a4a; border-radius: 50%; background: transparent; font-size: 14px; }
.chat-header h2 { color: #e9e9e9; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.room-subtitle { display: none; }
.conversation { width: min(100%, 850px); margin: 0 auto; padding: 34px 28px 124px; background: transparent; scrollbar-color: #4a4a4a transparent; }
.message { display: flex; align-items: flex-start; width: 100%; max-width: none; margin: 0 0 28px; gap: 12px; }
.message.user { display: flex; align-self: auto; margin-left: 0; }
.message.user .message-avatar { order: 0; }
.message.user .bubble { order: 0; }
.message-avatar { width: 30px; height: 30px; margin-top: 0; font-size: 11px; box-shadow: inset 0 1px rgba(255,255,255,.08), 0 1px 3px rgba(0,0,0,.28); }
.bubble, .message.user .bubble, .tone-this-mac .bubble, .tone-macbook-pro .bubble, .tone-pc .bubble, .tone-all .bubble, .tone-fleet .bubble { width: min(100% - 36px, 760px); padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #e8e8e8; }
.message-meta, .message.user .message-meta { margin: 0 0 5px; color: #a0a0a0; font-size: 11px; font-weight: 500; }
.bubble pre { margin: 0; color: #e8e8e8; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 1.65; white-space: pre-wrap; }
.bubble .stderr { color: #ff9c9c; }
.empty-state { margin-top: 80px; padding: 0; border: 0; background: transparent; color: #999; text-align: center; }
.composer { position: fixed; right: max(28px, calc((100vw - 850px) / 2)); bottom: 20px; left: max(288px, calc((100vw - 850px) / 2)); z-index: 3; display: grid; gap: 0; padding: 10px 0 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.composer:focus-within { border-color: transparent; }
.composer-input { min-height: 58px; }
.composer textarea { min-height: 56px; padding: 4px 2px; border: 0; background: transparent; color: #f2f2f2; font-family: inherit; font-size: 14px; line-height: 1.5; resize: none; }
.composer textarea::placeholder { color: #979797; }
.composer-actions { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 0; }
.secondary { position: absolute; bottom: 8px; left: 8px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #999; font-size: 11px; }
.secondary:hover { background: #383838; color: #eee; }
.primary { display: grid; place-items: center; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 1px solid #464646; border-radius: 50%; background: transparent; color: #e6e6e6; font-size: 0; }
.primary:hover { border-color: #777; background: #2f2f2f; color: #fff; transform: none; }
.primary svg { width: 14px; height: 14px; }
.mention-menu { bottom: calc(100% + 8px); border: 1px solid #444; border-radius: 9px; background: #292929; box-shadow: 0 14px 32px rgba(0,0,0,.45); }
.mention-option { color: #e8e8e8; }
.mention-option:hover, .mention-option[aria-selected="true"] { background: #383838; }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; min-height: 100dvh; padding: 10px 8px; background: #171717; }
  .chat { min-height: 100dvh; background: transparent; }
  .chat-header { min-height: 52px; padding: 0 16px; }
  .mobile-back { margin-right: 8px; border: 0; background: transparent; color: #d7d7d7; }
  .conversation { padding: 24px 16px 116px; }
  .message { margin-bottom: 24px; gap: 10px; }
  .bubble pre { font-size: 14px; line-height: 1.62; }
  .composer { right: 16px; bottom: 8px; left: 16px; padding: 8px 0 6px; border-radius: 0; }
}

@media (max-width: 520px) {
  .sidebar,
  .chat {
    padding: 10px;
  }

  .target-button {
    flex: 1 1 calc(50% - 8px);
  }

  .message {
    max-width: 100%;
  }
}

/* Codex Fleet — focused dark workspace */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-2: #202020;
  --ink: #f2f2f2;
  --muted: #9b9b9b;
  --line: #2d2d2d;
  --accent: #f2f2f2;
  --blue: #8ab4ff;
  --gold: #f3c969;
  --red: #ff8a8a;
  --shadow: none;
  --radius: 10px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { background: var(--bg); }

.app-shell { grid-template-columns: 292px minmax(0, 1fr); }

.sidebar {
  background: #121212;
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  gap: 18px;
}

.brand { padding: 2px 6px; gap: 9px; }
.brand-mark {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  background: #efefef;
  color: #111;
  border-radius: 7px;
  font-size: 15px;
  box-shadow: none;
}
.brand-mark span { background: none; border-radius: 0; }
.brand h1 { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand p { margin-top: 2px; font-size: 11px; color: #737373; }

.device-list { gap: 3px; }
.device-card {
  grid-template-columns: 28px minmax(0, 1fr) 8px 28px 28px;
  gap: 7px;
  min-height: 48px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}
.device-card:hover { background: #1c1c1c; border-color: #292929; }
.mini-avatar { width: 26px; height: 26px; border-radius: 7px; opacity: .86; }
.work-label { display: none; }
.device-name { font-size: 12px; font-weight: 560; color: #e8e8e8; }
.device-meta { margin-top: 2px; font-size: 11px; color: #7f7f7f; }
.status-dot { width: 6px; height: 6px; box-shadow: none; }
.status-dot.ok { background: #56b870; }
.status-dot.fail { background: #717171; }
.status-dot.run { background: #eab65e; }

.icon-text, .secondary, .target-button {
  border-color: #353535;
  background: #202020;
  color: #dedede;
}
.icon-text:hover, .secondary:hover, .target-button:hover { background: #2a2a2a; border-color: #444; }
.icon-text { min-height: 30px; padding: 0 8px; border-radius: 7px; }
.device-card .icon-text { background: transparent; border-color: transparent; color: #858585; min-height: 28px; padding: 0; }
.device-card .icon-text:hover { background: #292929; color: #eee; }
.primary { background: #f4f4f4; color: #111; min-width: 92px; border-radius: 8px; font-weight: 650; }
.primary:hover { background: #fff; }

.rooms-panel { gap: 8px; }
.section-title { padding: 0 6px; color: #dcdcdc; font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.new-thread-button { margin-left: auto; font-size: 11px; }
.sync-status { padding: 0 6px; color: #6f6f6f; font-size: 10px; }
.thread-list { gap: 2px; }
.thread-button {
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 50px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d8d8d8;
}
.thread-button:hover { background: #1d1d1d; }
.thread-button[aria-pressed="true"] { background: #282828; border-color: #343434; }
.thread-avatar { width: 26px; height: 26px; border-radius: 7px; }
.thread-text strong { font-size: 12px; font-weight: 560; }
.thread-text em, .thread-button small { color: #777; font-size: 10px; }

.chat { height: 100dvh; padding: 22px clamp(18px, 4vw, 56px); gap: 16px; background: #0d0d0d; }
.chat-header { max-width: 920px; width: 100%; margin: 0 auto; gap: 12px; }
.room-heading { gap: 10px; }
.room-avatar { width: 38px; height: 38px; border-radius: 9px; box-shadow: none; }
.eyebrow { color: #777; font-size: 11px; letter-spacing: .02em; }
.chat-header h2 { font-size: 18px; font-weight: 620; letter-spacing: -.02em; }
.room-subtitle { color: #777; font-size: 11px; }
.status-strip { gap: 5px; }
.pill { min-height: 23px; padding: 0 8px; border: 1px solid #303030; background: #191919; color: #909090; font-size: 10px; box-shadow: none; }
.pill.ok { color: #9ad7a6; border-color: #274530; background: #132017; }
.pill.fail { color: #9b9b9b; }
.pill.run { color: #f0c879; border-color: #4c3c1d; background: #211b10; }

.target-row, .conversation, .composer { max-width: 920px; width: 100%; margin: 0 auto; }
.target-row { padding-bottom: 2px; }
.target-button { min-height: 32px; padding: 0 9px; font-size: 11px; border-radius: 7px; }
.target-avatar { width: 18px; height: 18px; border-radius: 5px; }
.resume-pill { min-height: 32px; border: 1px solid #343434; border-radius: 7px; background: #191919; color: #aaa; font-size: 11px; padding: 0 9px; }

.conversation { padding: 4px 0 14px; scrollbar-color: #383838 transparent; }
.message { max-width: min(780px, 92%); margin: 0 0 16px; gap: 9px; }
.message-avatar { width: 26px; height: 26px; border-radius: 7px; }
.bubble { border: 0; border-radius: 0 10px 10px 10px; background: transparent; padding: 2px 0; box-shadow: none; }
.message.user { margin-left: auto; }
.message.user .message-avatar { order: 2; }
.message.user .bubble { border-radius: 10px 0 10px 10px; background: #262626; padding: 10px 12px; }
.message-meta, .message.user .message-meta { margin-bottom: 5px; color: #777; font-size: 10px; }
.bubble pre { color: #e9e9e9; font: 400 13px/1.65 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: pre-wrap; }
.bubble .stderr { color: #ffabab; }
.empty-state { border: 1px dashed #333; border-radius: 10px; background: #131313; color: #898989; }

.composer { padding: 10px; border: 1px solid #333; border-radius: 12px; background: #181818; box-shadow: 0 12px 42px rgba(0,0,0,.28); }
.composer:focus-within { border-color: #555; }
.composer-input { border: 0; background: transparent; }
.composer textarea { min-height: 76px; color: #f1f1f1; font-size: 13px; line-height: 1.5; }
.composer textarea::placeholder { color: #707070; }
.composer-actions { padding-top: 8px; border-top: 1px solid #2b2b2b; }
.secondary { min-height: 32px; padding: 0 10px; border-radius: 7px; font-size: 11px; }
.mention-menu { border-color: #3b3b3b; background: #1e1e1e; box-shadow: 0 12px 30px rgba(0,0,0,.42); }
.mention-option { color: #ddd; }
.mention-option:hover, .mention-option[aria-selected="true"] { background: #2a2a2a; }

@media (max-width: 900px) {
  .sidebar { background: #0d0d0d; padding: 16px 12px; }
  .brand { padding: 4px; }
  .rooms-panel { margin-top: 10px; }
  .thread-button { min-height: 58px; padding: 9px; }
  .chat { padding: 12px; background: #0d0d0d; }
  .chat-header { padding-bottom: 4px; }
  .mobile-back { border-color: #353535; background: #202020; color: #e2e2e2; }
  .room-avatar { width: 32px; height: 32px; }
  .chat-header h2 { font-size: 15px; }
  .target-row { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .target-button { flex: 0 0 auto; }
  .message { max-width: 96%; margin-bottom: 13px; }
  .bubble pre { font-size: 13px; line-height: 1.58; }
  .composer { padding: 8px; border-radius: 11px; }
  .composer textarea { min-height: 52px; }
}

/* Stable three-zone chat layout: header, scrollable transcript, composer. */
.chat { display: grid !important; height: 100dvh !important; grid-template-rows: 58px minmax(0, 1fr) auto !important; gap: 0 !important; padding: 0 !important; background: transparent !important; }
.target-row { display: none !important; }
.chat-header { grid-row: 1 !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 28px !important; border: 0 !important; border-bottom: 1px solid #555 !important; background: transparent !important; box-shadow: none !important; }
.conversation { grid-row: 2 !important; width: min(1180px, calc(100% - 48px)) !important; max-width: none !important; height: 100% !important; margin: 0 auto !important; padding: 24px 0 !important; overflow-y: auto !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
.composer { grid-row: 3 !important; position: static !important; width: min(1180px, calc(100% - 48px)) !important; min-height: 130px !important; margin: 0 auto 20px !important; padding: 14px 16px 10px !important; border: 1px solid #f1f1f1 !important; border-radius: 14px !important; background: #1b1b1b !important; box-shadow: none !important; }
.composer:focus-within { border-color: #fff !important; box-shadow: 0 0 0 1px rgba(255,255,255,.28) !important; }
.composer-input, .composer textarea { min-height: 76px !important; }
.composer-actions { min-height: 34px !important; border-top: 1px solid #686868 !important; }
.device-glyph, .mini-avatar, .thread-avatar, .target-avatar, .message-avatar, .pill-avatar, .room-avatar { aspect-ratio: 1; overflow: hidden; border-radius: 50% !important; background: transparent !important; box-shadow: none !important; }
@media (max-width: 900px) { .chat { grid-template-rows: 54px minmax(0,1fr) auto !important; } .chat-header { padding: 0 16px !important; } .conversation { width: calc(100% - 32px) !important; padding: 16px 0 !important; } .composer { width: calc(100% - 32px) !important; min-height: 118px !important; margin-bottom: 12px !important; } .composer-input, .composer textarea { min-height: 64px !important; } }
