/* Robô CODEX v7: project-first layout with the conversation as the work surface. */
:root {
  color-scheme: dark;
  --app-viewport-height: 100vh;
  --app-viewport-top: 0px;
  --bg: #0d1310;
  --sidebar: #111a15;
  --panel: #121b16;
  --panel-raised: #18231c;
  --composer-bg: #151f18;
  --line: #26342a;
  --line-strong: #34483a;
  --ink: #ecf4ed;
  --mute: #98aa9d;
  --accent: #64dec9;
  --accent-strong: #36bba7;
  --blue: #48b9ad;
  --danger: #f08e98;
  --shadow: 0 18px 50px #0005;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f4;
  --sidebar: #edf2ee;
  --panel: #f7faf7;
  --panel-raised: #e9f0eb;
  --composer-bg: #fff;
  --line: #d6e0d8;
  --line-strong: #c1d0c4;
  --ink: #18231c;
  --mute: #627469;
  --accent: #167f70;
  --accent-strong: #176f63;
  --blue: #218a7d;
  --danger: #b83f4a;
  --shadow: 0 18px 50px #233a2918;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

body,
button,
input,
textarea,
select {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button {
  border-radius: 10px;
  background: var(--accent-strong);
  color: #f5fffb;
  font-weight: 650;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

button:hover:not(:disabled) {
  filter: none;
  background: #278f80;
}

:root[data-theme="light"] button:hover:not(:disabled) {
  background: #146c60;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
textarea,
select {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  width: 100%;
  height: var(--app-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  transition: grid-template-columns .2s ease;
}

.shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  position: relative;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 264px;
  max-height: none;
  height: var(--app-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  padding: 19px 12px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  transition: transform .2s ease;
}

.sidebar .logo {
  flex: 0 0 auto;
  gap: 10px;
  padding: 0 7px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: .35px;
}

.sidebar-close {
  display: none;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mute);
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3ebda9, #346c66);
  box-shadow: none;
  font-size: 20px;
}

.logo strong {
  color: var(--accent);
}

.logo small {
  margin-top: 2px;
  color: var(--mute);
  font-size: 10px;
}

.sidebar-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  flex: 0 0 auto;
}

.sidebar-toolbar .sidebar-add {
  min-width: 0;
  margin: 0;
  padding: 9px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-raised);
  color: var(--ink);
  font-size: 11px;
}

.sidebar-toolbar .sidebar-add:first-child {
  border-color: transparent;
  background: var(--accent-strong);
  color: #f7fffb;
}

.sidebar-toolbar .sidebar-add span {
  margin-left: 3px;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.project-section {
  flex: 1.1 1 45%;
}

.conversations-section {
  flex: 1 1 40%;
  padding-top: 3px;
  border-top: 1px solid var(--line);
}

.sidetitle {
  padding: 0 9px;
  color: var(--mute);
  font-size: 10px;
  letter-spacing: 1.2px;
}

.search-label {
  padding: 0 9px;
  color: var(--mute);
  font-size: 10px;
}

.side-search {
  width: 100%;
  min-height: 35px;
  padding: 8px 10px;
  border-color: transparent;
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel-raised) 83%, transparent);
  font-size: 12px;
}

.sidebar nav,
.sidebar #projectList,
.sidebar #conversationList {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 3px;
  min-height: 30px;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.project {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 8px 9px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
}

.project:hover {
  background: var(--panel-raised);
}

.project.active {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-raised));
}

.project-emoji {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 14px;
}

.project-txt {
  min-width: 0;
}

.project-txt b {
  display: block;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.project-txt small {
  color: var(--mute);
  font-size: 9px;
}

.project-group-title {
  padding: 8px 9px 3px;
  color: var(--mute);
  font-size: 9px;
  letter-spacing: 1px;
}

.conversation-item,
.conversation-row,
.conversation-button {
  max-width: 100%;
  border-radius: 8px;
}

.sidebar-footer {
  flex: 0 0 auto;
  min-height: 40px;
  margin: 0;
  padding: 9px 5px 3px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 10px;
}

.sidebar-footer .iconbutton {
  color: var(--mute);
}

.main {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--app-viewport-height, 100dvh);
  max-height: none;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--bg);
}

.topbar {
  z-index: 30;
  display: flex;
  flex: 0 0 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, var(--sidebar));
}

.topbar-project {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--mute);
  font-size: 17px;
}

.mobile-menu:hover {
  background: var(--panel-raised);
  color: var(--ink);
}

.project-heading {
  min-width: 0;
}

.project-heading .eyebrow {
  margin: 0 0 1px;
  color: var(--mute);
  font-size: 9px;
  letter-spacing: 1.1px;
}

.topbar h1 {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 690;
  letter-spacing: -.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .detail {
  max-width: min(54vw, 620px);
  margin-top: 1px;
  overflow: hidden;
  color: var(--mute);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.executor-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 230px;
  margin-left: 8px;
  padding: 6px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--mute);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.executor-status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #c6a65e;
  content: "";
}

.executor-status.connected::before,
.executor-status.ok::before,
.executor-status.online::before {
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
}

.executor-status.error::before,
.executor-status.offline::before {
  background: var(--danger);
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.quiet,
.iconbutton {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--mute);
  font-weight: 560;
}

.quiet:hover:not(:disabled),
.iconbutton:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--panel-raised);
  color: var(--ink);
}

.notification-wrap,
.workspace-actions {
  position: relative;
}

.notification-bell,
.file-toggle,
.workspace-actions > summary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  font-size: 11px;
}

.notification-bell {
  width: 38px;
  padding: 0;
  font-size: 16px;
}

.notification-count {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
}

.workspace-actions > summary {
  width: 38px;
  list-style: none;
  cursor: pointer;
  font-size: 16px;
  letter-spacing: 2px;
}

.workspace-actions > summary::-webkit-details-marker,
.overview-drawer > summary::-webkit-details-marker {
  display: none;
}

.workspace-actions-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(310px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--sidebar);
  box-shadow: var(--shadow);
}

.workspace-actions-panel > button {
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 11px;
}

.workspace-actions-panel > button:hover:not(:disabled) {
  background: var(--panel-raised);
}

.overview-drawer {
  margin-top: 3px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.overview-drawer > summary {
  padding: 8px 10px;
  color: var(--mute);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.overview-drawer[open] > summary {
  color: var(--accent);
}

.overview-drawer .metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0 8px;
}

.overview-drawer .metric {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.overview-drawer .metric label {
  color: var(--mute);
  font-size: 8px;
}

.overview-drawer .metric > div {
  margin: 3px 0 0;
  font-size: 16px;
}

.overview-drawer .metric small {
  font-size: 9px;
}

.sync-overview {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sync-overview .sync-header strong,
.sync-overview .sync-header span,
.sync-overview .sync-header p {
  display: block;
  margin: 2px 0;
  font-size: 10px;
}

.sync-overview #syncFootnote {
  display: block;
  margin-top: 6px;
  color: var(--mute);
  font-size: 9px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  gap: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.workspace:not(.activity-hidden) {
  grid-template-columns: minmax(0, 1fr) 354px;
}

.workspace.activity-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.pane {
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.conversation .pane-head {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 10px max(24px, calc((100% - 900px) / 2));
  border: 0;
  background: transparent;
}

.conversation .pane-head h2 {
  color: var(--mute);
  font-size: 11px;
  font-weight: 600;
}

.conversation .pane-head small {
  display: none;
}

.conversation-project {
  border-color: var(--line);
  background: var(--panel);
  color: var(--mute);
  font-size: 9px;
}

.conversation-body {
  width: min(100%, 960px);
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  padding: 12px clamp(22px, 5vw, 58px) 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.welcome {
  max-width: 460px;
  margin: clamp(70px, 16vh, 170px) auto 50px;
  text-align: center;
}

.welcome-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 17px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  color: var(--accent);
  font-size: 25px;
}

.welcome h3 {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 22px;
  letter-spacing: -.45px;
}

.welcome p {
  color: var(--mute);
  font-size: 13px;
  line-height: 1.7;
}

.message {
  max-width: 800px;
  margin: 0 0 20px;
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.72;
}

.message.owner {
  width: fit-content;
  max-width: min(88%, 700px);
  margin: 8px 0 20px auto;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 5px 16px;
  background: var(--panel-raised);
}

.message strong {
  color: var(--accent);
  font-size: 10px;
}

.message pre,
.filecontent {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a100c;
  color: #d9e9de;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
}

:root[data-theme="light"] .message pre,
:root[data-theme="light"] .filecontent {
  background: #18231c;
  color: #e6f1e9;
}

.composer {
  position: relative;
  z-index: 10;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: min(900px, calc(100% - 42px));
  margin: 0 auto max(17px, env(safe-area-inset-bottom));
  padding: 10px 12px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: var(--composer-bg);
  box-shadow: 0 12px 34px #0002;
}

.prompt-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.composer textarea {
  width: 100%;
  min-height: 92px;
  max-height: min(30vh, 300px);
  padding: 10px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}

.composer textarea:focus-visible {
  outline: 0;
}

.composer textarea::placeholder {
  color: var(--mute);
  opacity: .8;
}

.model-settings {
  order: 2;
  flex: 0 0 auto;
  margin: 4px 0 0;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.model-settings > summary {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--mute);
  cursor: pointer;
  font-size: 10px;
  list-style: none;
}

.model-settings > summary::-webkit-details-marker {
  display: none;
}

.model-settings[open] > summary,
.model-settings > summary:hover {
  border-color: var(--line);
  background: var(--panel-raised);
  color: var(--ink);
}

.model-settings > summary small {
  color: var(--accent);
  font-size: 10px;
}

.model-settings > label {
  display: block;
  margin: 10px 0 4px;
  color: var(--mute);
  font-size: 10px;
}

.model-settings[open] {
  max-height: min(42vh, 470px);
  overflow: auto;
}

.model-row,
.paid-model-heading,
.paid-model-filter,
.target-row {
  gap: 7px;
}

.model-row input,
.model-settings select,
.model-settings input {
  min-height: 34px;
  font-size: 11px;
}

.model-row button,
.paid-model-heading button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
}

.ai-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.ai-levels button {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--mute);
  font-size: 10px;
}

.ai-levels button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
}

.composer-bottom {
  order: 3;
  min-height: 38px;
  margin-top: 4px;
}

.composer-bottom span {
  overflow: hidden;
  color: var(--mute);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-bottom button[type="submit"] {
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 11px;
}

.attachment-row {
  order: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 0 5px;
}

.attachment-row small {
  color: var(--mute);
  font-size: 9px;
}

.attachment-row button {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--mute);
  font-size: 10px;
}

.attachment-list {
  order: 1;
}

.activity {
  display: flex;
  width: 354px;
  min-width: 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--sidebar);
}

.workspace.activity-hidden .activity {
  display: none !important;
}

.activity .pane-head {
  min-height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.activity .pane-head h2 {
  font-size: 12px;
}

.activity .pane-head small {
  font-size: 10px;
}

.activity-head-actions {
  display: flex;
  gap: 5px;
}

.activity-head-actions button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 9px;
}

.tabs {
  flex: 0 0 auto;
  gap: 2px;
  overflow-x: auto;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--mute);
  font-size: 10px;
  white-space: nowrap;
}

.tab.active {
  background: var(--panel-raised);
  color: var(--accent);
}

.activity-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 11px;
}

.activity-footer {
  flex: 0 0 auto;
  padding: 9px;
  border-top: 1px solid var(--line);
}

.activity-footer button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
}

.task-item,
.event-item,
.approval {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.file-item {
  border-radius: 8px;
  color: var(--ink);
}

.file-item:hover {
  background: var(--panel-raised);
}

.notification-panel {
  top: calc(100% + 9px);
  right: -4px;
  z-index: 100;
  max-height: min(80vh, 680px);
  border-color: var(--line-strong);
  border-radius: 13px;
  background: var(--sidebar);
  box-shadow: var(--shadow);
}

.notification-panel .notification-heading {
  border-color: var(--line);
}

.sidebar-backdrop,
.activity-backdrop {
  display: none;
}

.workspace-actions details,
.workspace-actions button {
  font-family: inherit;
}

@media (max-width: 1000px) {
  .shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .sidebar {
    width: 236px;
  }

  .workspace:not(.activity-hidden) {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .activity {
    width: 320px;
  }
}

@media (max-width: 900px) {
  .shell,
  .shell.sidebar-collapsed {
    display: block;
    position: fixed;
    top: var(--app-viewport-top, 0px);
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--app-viewport-height, 100dvh);
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: var(--app-viewport-top, 0px) auto auto 0;
    z-index: 82;
    width: min(86vw, 340px);
    height: var(--app-viewport-height, 100dvh);
    max-height: none;
    transform: translateX(-105%);
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
  }

  .sidebar .logo {
    align-items: center;
  }

  .sidebar-close {
    display: inline-grid;
    place-items: center;
  }

  .shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: var(--app-viewport-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    height: var(--app-viewport-height, 100dvh);
    z-index: 78;
    display: none;
    border-radius: 0;
    background: #050a0799;
  }

  .shell.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main {
    width: 100%;
  }

  .topbar {
    flex-basis: calc(60px + env(safe-area-inset-top));
    min-height: calc(60px + env(safe-area-inset-top));
    gap: 6px;
    padding: max(7px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-left)) 7px max(9px, env(safe-area-inset-right));
  }

  .topbar-project {
    gap: 5px;
    min-width: 0;
  }

  .mobile-menu {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    flex-basis: 40px;
    font-size: 15px;
  }

  .project-heading .eyebrow,
  .topbar .detail,
  .executor-status {
    display: none;
  }

  .topbar h1 {
    max-width: 43vw;
    font-size: 14px;
  }

  .top-actions {
    gap: 4px;
  }

  .notification-bell,
  .file-toggle,
  .workspace-actions > summary {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    font-size: 14px;
  }

  .file-toggle span {
    display: none;
  }

  #toggleActivity {
    overflow: hidden;
    font-size: 0;
  }

  #toggleActivity::before {
    content: "▤";
    font-size: 17px;
  }

  .workspace {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0 max(6px, env(safe-area-inset-left)) max(5px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
    overflow: hidden;
  }

  .workspace:not(.activity-hidden),
  .workspace.activity-hidden {
    display: flex;
  }

  .conversation {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
  }

  .conversation .pane-head {
    min-height: 30px;
    padding: 6px 10px 3px;
  }

  .conversation .pane-head h2,
  .conversation-project {
    display: none;
  }

  .conversation-body {
    height: auto;
    min-height: 0;
    padding: 8px 10px 15px;
  }

  .welcome {
    margin: clamp(44px, 11vh, 100px) auto 30px;
  }

  .welcome h3 {
    font-size: 19px;
  }

  .welcome p {
    font-size: 12px;
  }

  .message {
    padding: 9px 2px;
    font-size: 13px;
  }

  .message.owner {
    max-width: 92%;
    padding: 10px 12px;
  }

  .composer {
    width: calc(100% - 8px);
    margin: 0 auto 8px;
    padding: 7px 8px 5px;
    border-radius: 14px;
  }

  .composer textarea {
    min-height: 64px;
    max-height: min(20vh, 130px);
    padding: 7px 5px;
    font-size: 13px;
  }

  .attachment-row {
    gap: 4px;
    padding: 0 3px;
  }

  .attachment-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .attachment-row button {
    min-height: 27px;
    padding: 4px 6px;
    font-size: 9px;
    white-space: nowrap;
  }

  .composer-bottom {
    min-height: 33px;
  }

  .composer-bottom span {
    max-width: 48vw;
    font-size: 9px;
  }

  .composer-bottom button[type="submit"] {
    min-height: 31px;
    padding: 6px 11px;
  }

  .activity {
    position: fixed;
    top: calc(var(--app-viewport-top, 0px) + max(66px, calc(env(safe-area-inset-top) + 58px)));
    right: max(7px, env(safe-area-inset-right));
    left: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    z-index: 72;
    display: flex;
    width: min(92vw, 390px);
    height: auto;
    max-height: none;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--sidebar);
    box-shadow: var(--shadow);
  }

  .workspace.activity-hidden .activity {
    display: none !important;
  }

  .activity-backdrop {
    position: fixed;
    top: var(--app-viewport-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    height: var(--app-viewport-height, 100dvh);
    z-index: 68;
    display: none;
    border-radius: 0;
    background: #050a0799;
  }

  .workspace:not(.activity-hidden) .activity-backdrop {
    display: block;
  }

  .notification-panel {
    position: fixed;
    top: calc(var(--app-viewport-top, 0px) + max(65px, calc(env(safe-area-inset-top) + 56px)));
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    max-height: calc(var(--app-viewport-height, 100dvh) - 78px);
  }

  .workspace-actions-panel {
    position: fixed;
    top: calc(var(--app-viewport-top, 0px) + max(65px, calc(env(safe-area-inset-top) + 56px)));
    right: max(8px, env(safe-area-inset-right));
    width: min(320px, calc(100vw - 16px));
    max-height: calc(var(--app-viewport-height, 100dvh) - 78px);
  }
}

@media (max-width: 390px) {
  .topbar h1 {
    max-width: 38vw;
  }

  .sidebar-toolbar .sidebar-add {
    font-size: 10px;
  }

  .attachment-row small {
    max-width: 78px;
  }

  .topbar h1 {
    max-width: 35vw;
  }

  .topbar {
    gap: 4px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .topbar {
    flex-basis: calc(50px + env(safe-area-inset-top));
    min-height: calc(50px + env(safe-area-inset-top));
    padding-bottom: 4px;
  }

  .conversation .pane-head {
    display: none;
  }

  .conversation-body {
    padding-top: 5px;
    padding-bottom: 8px;
  }

  .composer {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .composer textarea {
    min-height: 48px;
    max-height: min(16vh, 92px);
  }

  .activity {
    top: calc(var(--app-viewport-top, 0px) + max(54px, calc(env(safe-area-inset-top) + 48px)));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.task-progress-empty {
  margin-top: 11px;
  padding: 9px 11px;
  border-left: 2px solid var(--accent);
  background: var(--panel-raised);
  color: var(--mute);
  font-size: 12px;
}

.task-progress-feed {
  margin: 12px 0 8px;
  padding: 11px 12px 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-raised);
}

.task-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.task-progress-heading strong {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .02em;
}

.task-progress-heading small,
.task-progress-older {
  color: var(--mute);
  font-size: 10px;
}

.task-progress-list {
  position: relative;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0 0 0 13px;
  list-style: none;
}

.task-progress-list::before {
  position: absolute;
  top: 7px;
  bottom: 8px;
  left: 3px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.task-progress-step {
  position: relative;
  min-width: 0;
  padding: 0 0 2px 8px;
}

.task-progress-step::before {
  position: absolute;
  top: 5px;
  left: -13px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent-strong);
  border-radius: 50%;
  background: var(--panel);
  content: "";
}

.task-progress-step.complete::before { background: var(--accent-strong); }
.task-progress-step.problem::before { border-color: var(--danger); background: var(--danger); }

.task-progress-detail {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.task-progress-kind {
  color: var(--mute);
  font-size: 10px;
  font-weight: 700;
}

.task-progress-text {
  min-width: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.task-progress-time {
  color: var(--mute);
  font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .task-progress-feed { padding: 9px 9px 6px; }
  .task-progress-detail { grid-template-columns: 1fr auto; gap: 1px 6px; }
  .task-progress-kind { grid-column: 1 / -1; }
  .task-progress-text { font-size: 11px; }
}
