:root {
  color-scheme: light;
  --bg: #d7d9de;
  --bg-muted: #ececec;
  --panel: #f5f5f5;
  --panel-strong: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.13);
  --text: #191919;
  --text-muted: #808080;
  --accent: #07c160;
  --accent-strong: #06ad56;
  --accent-soft: rgba(7, 193, 96, 0.08);
  --warning: #d68b1f;
  --danger: #d93025;
  --archive-bg: #eee1e1;
  --archive-shell: #f7ebeb;
  --archive-panel: #f3dddd;
  --archive-panel-soft: #f8eeee;
  --archive-line: #e5c6c6;
  --mobile-header-bg: #e3e7ed;
  --mobile-header-border: #cfd6df;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --sidebar-width: 336px;
  --device-width: 272px;
  --desktop-scale-font: 14px;
  --mobile-scale-font: 15px;
  --composer-mobile-offset: 110px;
  --mobile-nav-offset: 56px;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--desktop-scale-font);
}

body {
  min-height: 100vh;
}

body.archive-view {
  background: var(--archive-bg);
}

body.ui-mode-lite [data-full-only="true"] {
  display: none !important;
}

body.ui-mode-lite .app-shell {
  grid-template-columns: minmax(290px, var(--sidebar-width)) minmax(0, 1fr) minmax(260px, var(--device-width));
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

.system-banner {
  display: flex;
  justify-content: center;
  padding: 10px 14px 0;
}

.system-banner-inner {
  width: min(100%, 1460px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(217, 48, 37, 0.08);
  border: 1px solid rgba(217, 48, 37, 0.16);
  color: #8f1f18;
}

.system-banner strong {
  font-size: 13px;
  white-space: nowrap;
}

.system-banner span {
  font-size: 13px;
  line-height: 1.45;
}

.screen-login {
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-shell {
  width: min(100%, 1100px);
}

.login-card {
  width: min(100%, 420px);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 28px 26px;
}

.brand-badge,
.thread-avatar {
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #22c26f, #07c160);
}

.brand-badge {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-heading {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.login-copy {
  margin: 10px 0 22px;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  color: var(--text-muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f7;
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(7, 193, 96, 0.42);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
  background: #fff;
}

textarea {
  resize: none;
  min-height: 44px;
  max-height: 220px;
}

button.primary,
button.ghost,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 500;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, opacity 120ms ease, border-color 120ms ease;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary.danger {
  background: var(--danger);
}

button.ghost,
.tab-button {
  background: #ededed;
  color: var(--text);
}

button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.login-error {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.mobile-topbar {
  display: none;
}

.tab-button {
  position: relative;
}

.tab-button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-button-badge {
  position: absolute;
  top: 9px;
  right: calc(50% - 38px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(250, 81, 81, 0.28);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(290px, var(--sidebar-width)) minmax(0, 1fr) minmax(260px, var(--device-width));
  gap: 0;
  width: min(100%, 1460px);
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--panel);
}

.app-view {
  display: flex;
  min-width: 0;
  min-height: calc(100vh - 28px);
}

.app-view > .panel {
  flex: 1 1 auto;
  min-width: 0;
}

.panel {
  min-height: calc(100vh - 28px);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.panel-threads,
.panel-devices {
  display: flex;
  flex-direction: column;
}

.panel-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #f5f5f5;
}

.panel-conversation > * {
  min-width: 0;
}

.conversation-header,
.conversation-runtime-strip,
.thread-profile-panel,
.runtime-card,
.composer {
  flex: 0 0 auto;
}

.panel-threads {
  background: #e9e9e9;
  border-right: 1px solid #d8d8d8;
}

body.desktop-threads-collapsed .app-shell {
  grid-template-columns: 56px minmax(0, 1fr) minmax(260px, var(--device-width));
}

body.ui-mode-lite.desktop-threads-collapsed .app-shell {
  grid-template-columns: 56px minmax(0, 1fr) minmax(260px, var(--device-width));
}

body.desktop-devices-collapsed .app-shell {
  grid-template-columns: minmax(290px, var(--sidebar-width)) minmax(0, 1fr) 56px;
}

body.ui-mode-lite.desktop-devices-collapsed .app-shell {
  grid-template-columns: minmax(290px, var(--sidebar-width)) minmax(0, 1fr) 56px;
}

body.desktop-threads-collapsed.desktop-devices-collapsed .app-shell {
  grid-template-columns: 56px minmax(0, 1fr) 56px;
}

body.desktop-threads-collapsed .panel-threads {
  overflow: hidden;
}

body.desktop-threads-collapsed .panel-threads .thread-panel-topline > :first-child,
body.desktop-threads-collapsed .panel-threads .thread-search-toggle,
body.desktop-threads-collapsed .panel-threads .thread-tools-toggle,
body.desktop-threads-collapsed .panel-threads .thread-panel-toolbar,
body.desktop-threads-collapsed .panel-threads #thread-list,
body.desktop-threads-collapsed .panel-threads #thread-list-empty,
body.desktop-threads-collapsed .panel-threads #threads-unread-summary {
  display: none !important;
}

body.desktop-threads-collapsed .panel-threads .thread-panel-header {
  padding-left: 8px;
  padding-right: 8px;
  align-items: center;
}

body.desktop-threads-collapsed .panel-threads .thread-panel-topline {
  justify-content: center;
}

body.desktop-threads-collapsed .panel-threads .thread-panel-controls {
  width: 100%;
  margin-left: 0;
  justify-content: center;
}

.panel-devices {
  background: #f7f7f7;
  border-left: 1px solid #e2e2e2;
}

body.archive-view .app-shell {
  background: var(--archive-shell);
  border-color: rgba(154, 68, 68, 0.12);
}

body.archive-view .panel-threads {
  background: var(--archive-panel);
  border-right-color: var(--archive-line);
}

body.archive-view .panel-conversation,
body.archive-view .panel-devices {
  background: var(--archive-panel-soft);
}

body.archive-view .panel-devices {
  border-left-color: rgba(154, 68, 68, 0.12);
}

body.archive-view .thread-panel-header,
body.archive-view .thread-panel-toolbar,
body.archive-view .thread-selection-bar {
  background: rgba(255, 255, 255, 0.22);
}

body.desktop-devices-collapsed .panel-devices {
  overflow: hidden;
}

body.desktop-devices-collapsed .panel-devices .panel-header > :first-child,
body.desktop-devices-collapsed .panel-devices #refresh-devices-button,
body.desktop-devices-collapsed .panel-devices .device-copy,
body.desktop-devices-collapsed .panel-devices #device-list,
body.desktop-devices-collapsed .panel-devices #device-list-empty,
body.desktop-devices-collapsed .panel-devices #devices-unread-summary {
  display: none !important;
}

body.desktop-devices-collapsed .panel-devices .panel-header {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

body.desktop-devices-collapsed .panel-devices .devices-panel-controls {
  width: 100%;
  justify-content: center;
}

.panel-header,
.conversation-header,
.runtime-card,
.composer {
  padding: 14px 18px;
}

.panel-header,
.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header-stack h2,
.conversation-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.thread-panel-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.thread-panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.thread-panel-topline > :first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.thread-panel-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
}

.thread-panel-collapse-button {
  display: inline-flex;
}

.thread-panel-collapse-button svg {
  width: 16px;
  height: 16px;
  transition: transform 120ms ease;
}

.thread-panel-collapse-button.is-collapsed svg {
  transform: rotate(180deg);
}

.panel-summary-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(250, 81, 81, 0.1);
  color: #d93025;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.panel-threads .eyebrow,
.panel-devices .eyebrow {
  display: none;
}

.toolbar {
  display: grid;
  gap: 10px;
  padding: 0 16px 10px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thread-panel-toolbar {
  display: grid;
  gap: 10px;
  position: relative;
  min-height: 0;
}

.thread-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 243, 228, 0.9);
  border-bottom: 1px solid rgba(231, 149, 66, 0.18);
}

.thread-selection-summary {
  color: #7a4f1a;
  font-size: 12px;
  font-weight: 600;
}

.thread-selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-selection-actions .ghost {
  padding: 6px 10px;
  font-size: 12px;
}

.workspace-picker-modal,
.agent-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(14, 19, 27, 0.46);
}

.workspace-picker-card,
.agent-picker-card {
  width: min(100%, 460px);
  max-height: min(82vh, 720px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 28px 54px rgba(0, 0, 0, 0.22);
}

.workspace-picker-head,
.agent-picker-head {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.workspace-picker-head h3,
.agent-picker-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.workspace-picker-subtitle,
.agent-picker-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.workspace-picker-body,
.agent-picker-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}

.workspace-picker-list,
.agent-picker-list {
  display: grid;
  gap: 10px;
}

.workspace-picker-option,
.agent-picker-option {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #f7f8fa;
  color: var(--text);
  text-align: left;
}

.workspace-picker-option:hover,
.agent-picker-option:hover {
  transform: none;
  background: #f0f4f1;
}

.workspace-picker-option.is-selected,
.agent-picker-option.is-selected {
  border-color: rgba(7, 193, 96, 0.42);
  background: rgba(7, 193, 96, 0.08);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.08);
}

.workspace-picker-option-label,
.agent-picker-option-label {
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.agent-picker-option-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-picker-option-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.agent-picker-option-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.agent-picker-option-badge-current {
  background: rgba(24, 144, 255, 0.12);
  color: #1268b3;
}

.agent-picker-option-badge-selected {
  background: rgba(7, 193, 96, 0.12);
  color: #12804a;
}

.workspace-picker-option-meta,
.agent-picker-option-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.workspace-picker-empty,
.workspace-picker-selection,
.agent-picker-empty,
.agent-picker-selection {
  margin: 0;
  line-height: 1.5;
}

.workspace-picker-empty,
.agent-picker-empty {
  color: var(--text-muted);
}

.workspace-picker-selection,
.agent-picker-selection {
  color: var(--text);
  font-size: 13px;
}

.workspace-picker-help,
.agent-picker-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.workspace-picker-field {
  margin-top: 4px;
}

.workspace-picker-actions,
.agent-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--line);
}

.workspace-picker-actions .ghost,
.workspace-picker-actions .primary,
.agent-picker-actions .ghost,
.agent-picker-actions .primary {
  min-width: 88px;
}

.thread-search-shell {
  display: none;
}

.thread-search-shell.is-open {
  display: block;
}

.thread-tools-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 28;
  display: none;
  min-width: 188px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
}

.thread-tools-popover.is-open {
  display: grid;
  gap: 8px;
}

.thread-tools-popover > .ghost {
  width: 100%;
  justify-content: flex-start;
  padding: 8px 10px;
  font-size: 13px;
}

.thread-filter-select {
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  font-size: 12px;
}

.conversation-actions-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conversation-actions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: none;
  min-width: 164px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
}

.conversation-actions.is-open {
  display: flex;
}

.conversation-actions .ghost {
  width: 100%;
  justify-content: flex-start;
  padding: 8px 10px;
  font-size: 13px;
}

.devices-panel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.device-panel-collapse-button {
  display: inline-flex;
}

.device-panel-collapse-button svg {
  width: 16px;
  height: 16px;
  transition: transform 120ms ease;
}

.device-panel-collapse-button.is-collapsed svg {
  transform: rotate(180deg);
}

.thread-profile-panel {
  padding: 0 18px 14px;
  background: #f5f5f5;
  border-bottom: 1px solid #ebebeb;
}

.thread-profile-card {
  display: grid;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.thread-profile-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.thread-profile-panel-heading {
  min-width: 0;
}

.thread-profile-panel-heading .eyebrow {
  margin-bottom: 6px;
}

.thread-profile-panel-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.thread-profile-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.thread-profile-close-button {
  flex-shrink: 0;
  padding: 7px 10px;
  font-size: 12px;
}

.thread-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.thread-profile-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(245, 247, 250, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.thread-profile-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.thread-profile-label {
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thread-profile-field .ghost {
  padding: 6px 10px;
  font-size: 12px;
}

.thread-profile-value {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.thread-resources-panel {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.thread-resources-header h4 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.thread-resources-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.thread-resource-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(245, 247, 250, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.thread-resource-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.thread-resource-detail-chip,
.thread-resource-detail-empty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.35;
}

.thread-resource-detail-chip {
  background: rgba(70, 132, 255, 0.08);
  border: 1px solid rgba(70, 132, 255, 0.14);
  color: #39527b;
}

.thread-resource-detail-empty {
  background: rgba(0, 0, 0, 0.035);
  border: 1px dashed rgba(0, 0, 0, 0.08);
  color: #6d7480;
}

.thread-resource-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.thread-resource-card-meta {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: #66707d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.thread-resource-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.thread-resource-open-button {
  min-width: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
}

.thread-resource-open-button.is-active {
  background: rgba(70, 132, 255, 0.12);
  color: #3656b8;
}

.thread-resource-detail-view {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(245, 247, 250, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.thread-resource-detail-header {
  display: grid;
  gap: 4px;
}

.thread-resource-detail-header h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.thread-resource-detail-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.thread-resource-detail-list {
  display: grid;
  gap: 8px;
}

.thread-resource-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-resource-detail-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.04);
  line-height: 1.5;
}

.thread-resource-detail-item-label {
  color: #6a7381;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.thread-resource-detail-item-value {
  min-width: 0;
  color: #314055;
  font-size: 12px;
  text-align: right;
  word-break: break-word;
}

.thread-resource-detail-action {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
}

.thread-actions-toggle,
.thread-tools-toggle,
.thread-search-toggle {
  display: none;
  min-width: 40px;
  padding: 8px 11px;
  font-size: 18px;
  line-height: 1;
}

.thread-search-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-shell {
  position: relative;
}

.search-shell::before {
  content: "搜索";
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

#thread-search {
  padding-left: 52px;
}

.thread-list,
.device-list,
.message-list {
  min-height: 0;
  overflow: auto;
}

.message-list-shell {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: auto;
  overflow: hidden;
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.thread-list,
.device-list {
  display: grid;
  gap: 0;
  padding: 0;
}

.device-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 10px;
}

.device-section-heading-copy {
  display: grid;
  gap: 2px;
}

.device-section-heading h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #202124;
}

.device-section-heading-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.device-inline-empty {
  padding: 0 16px 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.thread-item,
.device-item {
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.execution-device-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "main"
    "actions";
  align-items: stretch;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.execution-device-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.execution-device-endpoint,
.execution-device-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
}

.execution-device-endpoint {
  background: rgba(0, 0, 0, 0.06);
  color: #5b5f6a;
}

.execution-device-current {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.device-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.execution-device-item .device-actions {
  grid-area: actions;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.execution-device-item .device-main {
  grid-area: main;
}

.execution-device-item .device-meta {
  word-break: break-word;
}

.thread-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: transparent;
}

.thread-item.is-selection-mode {
  grid-template-columns: 20px 44px minmax(0, 1fr);
}

.thread-item.is-selected {
  background: rgba(255, 140, 66, 0.12);
}

.thread-item.is-active {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 3px 0 0 #d26f18;
}

.thread-item.is-unread {
  background: rgba(255, 255, 255, 0.22);
}

.thread-item.is-starred {
  background: linear-gradient(90deg, rgba(244, 209, 114, 0.16), rgba(255, 255, 255, 0.08));
}

.thread-item.is-starred .thread-star {
  background: rgba(244, 209, 114, 0.2);
  color: #9b6b00;
}

.thread-item.is-unread .thread-name {
  font-weight: 600;
}

.thread-item.is-unread .thread-preview,
.thread-item.is-unread .thread-time {
  color: #4b4b4b;
}

.thread-item.is-unread .thread-preview {
  font-weight: 500;
}

.thread-item.is-active .thread-name {
  font-weight: 600;
}

.thread-item.is-active .thread-location-chip-device {
  background: rgba(210, 111, 24, 0.16);
  color: #8d5513;
}

.thread-time {
  flex-shrink: 0;
  max-width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.thread-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.thread-avatar-stack {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-width: 44px;
}

.thread-selection-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-height: 44px;
}

.thread-selection-marker::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(210, 111, 24, 0.45);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.thread-item.is-selected .thread-selection-marker::before {
  background: #f28b3c;
  border-color: #f28b3c;
}

.thread-heartbeat {
  width: 100%;
  padding: 2px 4px;
  border-radius: 999px;
  color: #56606f;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.06);
}

.thread-heartbeat[data-state="fresh"] {
  background: rgba(47, 143, 88, 0.14);
  color: #1f7a46;
}

.thread-heartbeat[data-state="warm"] {
  background: rgba(214, 144, 22, 0.14);
  color: #946200;
}

.thread-heartbeat[data-state="stale"] {
  background: #d93025;
  color: #ffffff;
}

.thread-heartbeat[data-state="unknown"] {
  background: #d93025;
  color: #ffffff;
}

.thread-avatar-large {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 13px;
}

.thread-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.thread-titleline {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-topline,
.thread-bottomline,
.device-topline {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.thread-bottomline {
  min-width: 0;
}

.thread-status-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-status-badge.status-running {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.thread-status-badge.status-queued {
  background: rgba(200, 111, 29, 0.12);
  color: var(--warning);
}

.thread-status-badge.status-stalled,
.thread-status-badge.status-failed {
  background: rgba(194, 65, 61, 0.12);
  color: var(--danger);
}

.thread-status-badge.status-completed {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.thread-status-badge.status-idle {
  background: rgba(96, 106, 124, 0.12);
  color: #5f6877;
}

.thread-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.thread-profile {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.thread-location {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  color: #7f7f7f;
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
}

.thread-location-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-location-chip-device {
  background: rgba(0, 0, 0, 0.1);
  color: #555c67;
}

.thread-location-chip-workspace {
  background: rgba(0, 0, 0, 0.05);
  color: #69717c;
}

.thread-tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(74, 122, 255, 0.12);
  color: #3656b8;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-profile-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 84, 178, 0.08);
  color: #4a5874;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-name,
.device-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.thread-preview {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.thread-preview-id {
  flex: 0 0 auto;
  color: #4f5d70;
  font-size: inherit;
  line-height: inherit;
}

.thread-preview-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: inherit;
}

.thread-time,
.device-meta,
.message-time,
.message-role,
.thread-location,
#active-thread-meta,
.session-status,
.runtime-card p,
.empty-state p,
.device-copy p {
  color: var(--text-muted);
  font-size: 13px;
}

.thread-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.thread-flag,
.device-badge,
.runtime-badge,
.thread-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
}

.thread-flag,
.device-badge {
  padding: 2px 8px;
  background: #ededed;
  color: var(--text-muted);
  font-size: 11px;
}

.thread-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #fa5151;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.conversation-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.conversation-back-button {
  display: none;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 24px;
  line-height: 1;
}

@media (min-width: 901px) {
  .conversation-back-button {
    display: none !important;
  }
}

.conversation-title-copy {
  min-width: 0;
}

.active-thread-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conversation-title-copy h2 {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conversation-meta-toggle {
  min-width: 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  flex-shrink: 0;
}

.conversation-meta-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 120ms ease;
}

.conversation-meta-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.active-thread-statusline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  min-width: 0;
}

.active-thread-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: #a5adb8;
}

.active-thread-status-dot.status-running,
.active-thread-status-dot.status-completed {
  background: var(--accent-strong);
}

.active-thread-status-dot.status-queued {
  background: var(--warning);
}

.active-thread-status-dot.status-stalled,
.active-thread-status-dot.status-failed {
  background: var(--danger);
}

.active-thread-status-text {
  min-width: 0;
  color: #5e6878;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.active-thread-feedback {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 640px);
  margin: 6px 0 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(70, 132, 255, 0.08);
  border: 1px solid rgba(70, 132, 255, 0.14);
  color: #36527e;
  font-size: 12px;
  line-height: 1.45;
}

.active-thread-location {
  margin: 3px 0 0;
  color: #677489;
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conversation-runtime-strip {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 18px;
  border-bottom: 1px solid #ebebeb;
  background: #f7f7f7;
}

.conversation-runtime-text {
  min-width: 0;
  color: #6c7787;
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.runtime-card {
  display: grid;
  gap: 8px;
  border-top: 1px solid #ebebeb;
  border-bottom: 1px solid #ebebeb;
  background: #fafafa;
}

.runtime-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.runtime-primary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.runtime-label {
  color: var(--text-muted);
  font-size: 13px;
}

.runtime-summary-text {
  min-width: 0;
  color: #6c7787;
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.runtime-badge {
  padding: 4px 10px;
  background: #ededed;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.runtime-toggle {
  min-width: 36px;
  padding: 7px 9px;
}

.runtime-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 120ms ease;
}

.runtime-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.runtime-detail-panel {
  display: none;
  gap: 6px;
}

.runtime-detail-panel.is-open {
  display: grid;
}

.thread-control-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(245, 247, 250, 0.92);
}

.thread-control-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.thread-control-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.thread-control-heading .eyebrow {
  margin-bottom: 0;
}

.thread-control-summary {
  margin: 0;
  color: #445064;
  font-size: 12px;
  line-height: 1.5;
}

.thread-control-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.thread-control-actions .ghost,
.thread-control-task-action {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.thread-control-feedback,
.thread-control-meta {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.thread-control-feedback {
  color: #2f4f96;
}

.thread-control-meta {
  color: #687385;
}

.thread-control-task-list {
  display: grid;
  gap: 8px;
}

.thread-control-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

.thread-control-task-body {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.thread-control-task-title {
  color: #243042;
  font-size: 12px;
  font-weight: 600;
}

.thread-control-task-meta {
  color: #667286;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-word;
}

.thread-control-empty {
  padding: 8px 2px;
  color: #6b7584;
  font-size: 11px;
  line-height: 1.45;
}

.runtime-send-bundles {
  display: grid;
  gap: 8px;
}

.runtime-send-bundle-overview {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(70, 132, 255, 0.08);
  color: #39527b;
  font-size: 11px;
  line-height: 1.45;
  border: 1px solid rgba(70, 132, 255, 0.12);
}

.runtime-send-bundle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(246, 248, 252, 0.92);
}

.runtime-send-bundle-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.runtime-send-bundle-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.runtime-send-bundle-title {
  font-size: 12px;
  font-weight: 600;
  color: #243042;
}

.runtime-send-bundle-summary {
  font-size: 11px;
  color: #5e6878;
  line-height: 1.45;
}

.runtime-send-bundle-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.runtime-send-bundle-status.status-pending {
  background: rgba(200, 111, 29, 0.12);
  color: #916124;
}

.runtime-send-bundle-status.status-completed {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.runtime-send-bundle-status.status-failed {
  background: rgba(194, 65, 61, 0.12);
  color: var(--danger);
}

.runtime-send-bundle-status.restore-restored {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.runtime-send-bundle-status.restore-partial {
  background: rgba(200, 111, 29, 0.12);
  color: #916124;
}

.runtime-send-bundle-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.runtime-send-bundle-actions .ghost {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
}

.runtime-send-bundle-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: #6c7480;
  font-size: 10px;
  line-height: 1.35;
}

.runtime-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runtime-actions .ghost {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.runtime-badge.status-running {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.runtime-badge.status-queued {
  background: rgba(200, 111, 29, 0.12);
  color: var(--warning);
}

.runtime-badge.status-stalled,
.runtime-badge.status-failed {
  background: rgba(194, 65, 61, 0.12);
  color: var(--danger);
}

.runtime-badge.status-completed {
  background: rgba(47, 143, 88, 0.14);
  color: var(--accent-strong);
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 24px;
  background: #f5f5f5;
}

.message-list-bottom-button {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 3;
  min-width: 96px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.message-list-bottom-button:hover {
  background: rgba(17, 17, 17, 0.96);
}

.message-item {
  display: grid;
  gap: 4px;
  max-width: min(70%, 760px);
}

.message-separator {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.message-item.role-user {
  align-self: flex-end;
}

.message-item.role-assistant {
  align-self: flex-start;
}

.message-item.role-system {
  align-self: center;
  max-width: min(82%, 760px);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.72;
}

.message-item.role-user .message-meta {
  justify-content: flex-end;
}

.message-item.role-system .message-meta {
  justify-content: center;
  opacity: 0.9;
}

.message-role {
  display: none;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: none;
}

.message-bubble.message-bubble-system {
  background: rgba(190, 24, 93, 0.08);
  border-color: rgba(190, 24, 93, 0.2);
  color: #9d174d;
}

.message-bubble.has-attachment {
  display: grid;
  gap: 8px;
}

.attachment-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.attachment-link {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.attachment-preview {
  display: block;
  max-width: min(240px, 100%);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
}

.attachment-file {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
}

.attachment-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.message-item.role-user .message-bubble {
  background: #f7b267;
  border-color: rgba(0, 0, 0, 0.02);
  color: #111;
}

.message-item.role-user .attachment-file {
  background: rgba(255, 255, 255, 0.68);
}

.composer {
  display: grid;
  gap: 10px;
  border-top: 1px solid #ebebeb;
  background: #f5f5f5;
}

.composer-main-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.composer-side-button {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  color: #5b5b5b;
}

.composer-side-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-input-shell {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: #ffffff;
}

.composer-input-shell #composer-input {
  border: none;
  background: transparent;
  box-shadow: none;
  min-height: 42px;
  max-height: calc(1.45em * 6 + 22px);
  line-height: 1.45;
  overflow-y: hidden;
}

.composer-action-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(12px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.composer-action-spacer {
  min-width: 12px;
}

.composer-send-button {
  min-width: 84px;
}

.composer-save-button {
  min-width: 84px;
}

.composer-saved-toggle-button {
  min-width: 72px;
}

.composer-current-shell,
.composer-pending-shell {
  display: grid;
  gap: 8px;
}

.composer-current-toolbar,
.composer-pending-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.composer-current-summary,
.composer-pending-summary {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.composer-current-list,
.composer-pending-list,
.composer-saved-list {
  display: grid;
  gap: 8px;
}

.composer-saved-shell {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed rgba(0, 0, 0, 0.08);
}

.composer-saved-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-saved-summary {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.composer-pending-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.composer-pending-actions .ghost {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.composer-save-button:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.composer-save-button:not(:disabled):hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.composer-send-button.is-edit-cancel {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.composer-send-button.is-edit-cancel:hover {
  background: #c52a21;
  border-color: #c52a21;
}

.pending-attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.pending-attachment-item.is-selected {
  border-color: rgba(70, 132, 255, 0.32);
  background: rgba(228, 238, 255, 0.9);
}

.pending-attachment-item.kind-text {
  background: rgba(255, 241, 243, 0.92);
  border-color: rgba(224, 104, 132, 0.16);
}

.pending-attachment-item.is-editing {
  border-color: rgba(7, 193, 96, 0.3);
  background: rgba(239, 253, 245, 0.94);
}

.pending-attachment-item.status-uploading {
  border-color: rgba(7, 193, 96, 0.18);
}

.pending-attachment-item.status-failed {
  border-color: rgba(217, 48, 37, 0.18);
  background: rgba(255, 244, 244, 0.95);
}

.pending-attachment-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.pending-attachment-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pending-attachment-summary {
  min-width: 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pending-attachment-status {
  color: var(--text-muted);
  font-size: 12px;
}

.pending-inline-editor {
  width: 100%;
  min-height: 74px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #ffffff;
  font: inherit;
  line-height: 1.45;
}

.pending-attachment-action {
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 999px;
}

.pending-attachment-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.saved-draft-package-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(245, 247, 251, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.saved-draft-package-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.saved-draft-package-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.saved-draft-package-summary {
  min-width: 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-draft-package-status {
  color: var(--text-muted);
  font-size: 12px;
}

.composer-saved-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.saved-draft-package-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.saved-draft-package-action {
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
}

.composer-plus-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  justify-items: stretch;
}

.composer-sheet-button {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.device-copy,
.empty-state {
  padding: 0 20px 16px;
}

.device-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "main"
    "actions";
  gap: 14px;
  padding: 14px 16px;
  align-items: stretch;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.device-item .device-main {
  grid-area: main;
  min-width: 0;
}

.device-item .device-actions {
  grid-area: actions;
  width: 100%;
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.device-item .device-meta {
  word-break: break-word;
}

.device-item .device-topline {
  flex-wrap: wrap;
}

.device-main {
  display: grid;
  gap: 8px;
}

.session-status {
  margin: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 120px;
  gap: 12px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(280px, 312px) minmax(0, 1fr);
  }

  .panel-devices {
    display: none;
  }

  .panel-devices.is-active {
    display: flex;
  }
}

@media (max-width: 900px) {
  html,
  body,
  #app-screen,
  .screen-app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .system-banner {
    padding: 8px 10px 0;
  }

  .system-banner-inner {
    padding: 10px 12px;
    border-radius: 10px;
    gap: 8px;
  }

  .system-banner strong,
  .system-banner span {
    font-size: 12px;
  }

  .mobile-topbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 48;
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    background: rgba(246, 246, 246, 0.98);
    border-top: 1px solid #e5e5e5;
    border-bottom: none;
    box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.06);
  }

  .mobile-topbar.is-hidden {
    display: none;
  }

  .tab-button {
    flex: 1;
    border-radius: 0;
    min-height: 54px;
    padding: 10px 8px 12px;
    font-size: 13px;
    background: transparent;
    color: #7a7a7a;
  }

  .tab-button.active {
    background: transparent;
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .tab-button-badge {
    top: 7px;
    right: calc(50% - 34px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    line-height: 16px;
  }

  .tab-button-conversation {
    display: inline-flex;
  }

  .app-shell {
    display: block;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow-x: hidden;
  }

  .app-view {
    display: none;
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    max-width: 100vw;
  }

  .app-view.is-active {
    display: flex;
  }

  .panel {
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: 100vw;
  }

  .panel:not(.is-active) {
    display: none !important;
  }

  .conversation-header,
  .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: visible;
  }

  .thread-panel-collapse-button {
    display: none !important;
  }

  .thread-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-devices .panel-header {
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
  }

  .panel-devices .panel-header > :first-child {
    min-width: 0;
    flex: 1 1 auto;
  }

  #refresh-devices-button {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: flex-start;
  }

  .device-panel-collapse-button {
    display: none !important;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .conversation-actions {
    position: absolute;
    top: calc(100% - 4px);
    right: 12px;
    z-index: 30;
    display: none;
    min-width: 152px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
  }

  .conversation-actions.is-open {
    display: flex;
  }

  .conversation-actions .ghost {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 10px;
    font-size: 13px;
  }

  .conversation-actions-shell {
    align-self: flex-start;
    margin-left: auto;
    margin-right: 0;
    flex-shrink: 0;
  }

  .thread-profile-panel {
    padding: 0 12px 12px;
  }

  .thread-profile-card {
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .thread-profile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .thread-resources-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .thread-resource-card-actions {
    gap: 6px;
  }

  .thread-resource-open-button {
    padding: 5px 9px;
    font-size: 10px;
  }

  .thread-resource-detail-view {
    gap: 8px;
    padding: 10px;
  }

  .thread-resource-detail-header h5 {
    font-size: 13px;
  }

  .thread-resource-detail-subtitle,
  .thread-resource-detail-item-value,
  .thread-resource-detail-item {
    font-size: 11px;
  }

  .thread-resource-detail-item {
    gap: 10px;
    padding: 8px 10px;
  }

  .thread-resource-detail-item-label {
    font-size: 10px;
  }

  .thread-resource-detail-actions {
    gap: 6px;
  }

  .thread-resource-detail-action {
    padding: 5px 9px;
    font-size: 10px;
  }

  .thread-actions-toggle,
  .thread-tools-toggle,
  .thread-search-toggle {
    display: inline-flex;
    min-width: 38px;
    padding: 8px 10px;
    font-size: 17px;
  }

  .thread-tools-popover {
    position: absolute;
    top: calc(100% - 4px);
    right: 12px;
    z-index: 28;
    display: none;
    min-width: min(176px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
  }

  .thread-tools-popover.is-open {
    display: grid;
  }

  .thread-tools-popover > .ghost {
    width: 100%;
    justify-self: stretch;
    padding: 8px 10px;
    font-size: 13px;
    justify-content: flex-start;
  }

  .thread-panel-toolbar {
    position: relative;
    gap: 8px;
  }

  .thread-panel-controls {
    margin-left: auto;
    margin-right: -8px;
    justify-content: flex-end;
  }

  .thread-search-shell {
    display: none;
  }

  .thread-search-shell.is-open {
    display: block;
  }

  .thread-search-shell::before {
    left: 12px;
    font-size: 11px;
  }

  .thread-search-shell #thread-search {
    padding: 9px 11px 9px 44px;
    font-size: 13px;
  }

  .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-nav-offset, 56px) + env(safe-area-inset-bottom));
    z-index: 36;
    gap: 6px;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid #d9d9d9;
    background: rgba(247, 247, 247, 0.98);
    backdrop-filter: blur(10px);
  }

  .composer-action-row {
    grid-template-columns: repeat(3, minmax(0, auto)) minmax(8px, 1fr) auto;
    gap: 6px;
  }

  .message-list {
    gap: 8px;
    padding: 12px 10px calc(var(--composer-mobile-offset, 110px) + 12px);
    scroll-padding-bottom: calc(var(--composer-mobile-offset, 110px) + 12px);
  }

  .message-list-bottom-button {
    right: 12px;
    bottom: calc(var(--composer-mobile-offset, 110px) + 12px);
  }

  html,
  body {
    font-size: var(--mobile-scale-font);
    background: #ededed;
  }

  .panel-threads,
  .panel-conversation,
  .panel-devices {
    background: #f5f5f5;
    width: 100%;
    max-width: 100vw;
  }

  .conversation-runtime-strip {
    padding: 7px 10px;
    min-height: 32px;
    background: #f3f5f8;
    border-bottom: 1px solid #dfe4ea;
  }

  .conversation-runtime-text {
    font-size: 12px;
  }

  .panel-header,
  .conversation-header {
    position: sticky;
    top: 0;
    z-index: 26;
    background: var(--mobile-header-bg);
    border-bottom: 1px solid var(--mobile-header-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
  }

  .thread-panel-header {
    background: var(--mobile-header-bg);
  }

  .thread-item {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 68px;
    padding: 10px 12px;
  }

  .thread-item.is-selection-mode {
    grid-template-columns: 18px 42px minmax(0, 1fr);
  }

  .thread-avatar {
    width: 42px;
    height: 42px;
    font-size: 13px;
  }

  .thread-avatar-stack {
    min-width: 42px;
    gap: 5px;
  }

  .thread-name {
    font-size: 15px;
  }

  .panel-summary-pill {
    display: inline-flex;
    margin-top: 4px;
    font-size: 10px;
    padding: 2px 7px;
  }

  .thread-preview,
  .thread-time,
  .device-meta,
  .message-time,
  .thread-location,
  .active-thread-location,
  #active-thread-meta,
  .session-status,
  .runtime-card p,
  .empty-state p,
  .device-copy p {
    font-size: 12px;
  }

  .thread-heartbeat {
    font-size: 10px;
  }

  .thread-selection-bar {
    padding: 9px 12px;
  }

  .thread-selection-actions .ghost {
    padding: 5px 9px;
    font-size: 11px;
  }

  .workspace-picker-modal,
  .agent-picker-modal {
    align-items: flex-end;
    padding: 0;
  }

  .workspace-picker-card,
  .agent-picker-card {
    width: 100%;
    max-height: min(84vh, 760px);
    border-radius: 18px 18px 0 0;
  }

  .workspace-picker-head,
  .agent-picker-head {
    padding: 16px 16px 10px;
  }

  .workspace-picker-head h3,
  .agent-picker-head h3 {
    font-size: 18px;
  }

  .workspace-picker-body,
  .agent-picker-body {
    padding: 14px 16px;
    gap: 10px;
  }

  .workspace-picker-option,
  .agent-picker-option {
    padding: 11px 12px;
    border-radius: 10px;
  }

  .agent-picker-option-top {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .workspace-picker-option-meta,
  .workspace-picker-selection,
  .workspace-picker-help,
  .agent-picker-option-meta,
  .agent-picker-selection,
  .agent-picker-help {
    font-size: 12px;
  }

  .workspace-picker-actions,
  .agent-picker-actions {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .message-item {
    max-width: 82%;
  }

  .message-separator {
    font-size: 11px;
  }

  .message-bubble {
    font-size: 14px;
    padding: 10px 12px;
  }

  .attachment-preview {
    max-width: min(210px, 100%);
  }

  .composer-input-shell {
    border-radius: 18px;
    background: #ffffff;
  }

  .composer-input-shell #composer-input {
    min-height: 38px;
    max-height: calc(1.4em * 6 + 18px);
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
  }

  .composer-current-shell,
  .composer-pending-shell {
    gap: 6px;
    padding: 8px 9px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .composer-saved-shell {
    padding-top: 6px;
  }

  .composer-send-button {
    min-width: 72px;
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 999px;
  }

  .composer-save-button,
  .composer-saved-toggle-button,
  .composer-side-button {
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 999px;
  }

  .composer-current-list,
  .composer-pending-list {
    gap: 6px;
  }

  .composer-saved-shell {
    padding: 8px 9px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.66);
  }

  .composer-current-list {
    max-height: min(16vh, 120px);
    overflow-y: auto;
    padding-right: 2px;
  }

  .composer-pending-list,
  .composer-saved-list {
    max-height: min(24vh, 196px);
    overflow-y: auto;
    padding-right: 2px;
  }

  .composer-current-toolbar,
  .composer-pending-toolbar,
  .composer-saved-toolbar {
    gap: 8px;
  }

  .composer-current-summary,
  .composer-pending-summary,
  .composer-saved-summary {
    font-size: 11px;
  }

  .composer-pending-actions {
    gap: 6px;
  }

  .composer-pending-actions .ghost {
    padding: 5px 9px;
    font-size: 11px;
  }

  .pending-attachment-item {
    padding: 8px 10px;
    border-radius: 14px;
  }

  .pending-attachment-name {
    font-size: 12px;
  }

  .pending-inline-editor {
    min-height: 56px;
    max-height: 132px;
    overflow-y: auto;
  }

  .pending-attachment-actions,
  .saved-draft-package-actions {
    gap: 6px;
  }

  .pending-attachment-action,
  .saved-draft-package-action {
    min-width: 0;
    padding: 5px 9px;
    font-size: 11px;
  }

  .pending-attachment-status {
    font-size: 11px;
  }

  .pending-attachment-action {
    min-width: 48px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .pending-attachment-actions {
    gap: 6px;
  }

  .composer-plus-sheet {
    justify-items: stretch;
  }

  .composer-sheet-button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    font-size: 13px;
  }

  .conversation-identity {
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
  }

  .conversation-identity > div:last-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .conversation-title-copy {
    flex: 1 1 auto;
    min-width: 0;
  }

  .conversation-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: -2px;
    color: #4b4b4b;
  }

  .conversation-meta-toggle {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 8px 10px;
  }

  .thread-actions-toggle {
    width: 38px;
    padding-left: 0;
    padding-right: 0;
    flex: 0 0 auto;
  }

  .active-thread-statusline {
    margin-top: 2px;
  }

  .active-thread-status-text {
    font-size: 11px;
  }

  .active-thread-feedback {
    margin-top: 4px;
    padding: 4px 9px;
    font-size: 11px;
  }

  .thread-avatar-large {
    width: 38px;
    height: 38px;
    font-size: 12px;
  }

  .panel-header,
  .conversation-header,
  .runtime-card,
  .composer {
    padding: 12px;
  }

  .panel-threads,
  .panel-devices {
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }

  .thread-profile-panel {
    padding-left: 10px;
    padding-right: 10px;
  }

  .toolbar {
    gap: 8px;
    padding: 0 12px 8px;
  }

  .thread-panel-header {
    position: sticky;
    top: 0;
    z-index: 26;
  }

  .runtime-badge {
    padding: 3px 8px;
    font-size: 11px;
  }

  .runtime-actions .ghost {
    padding: 5px 9px;
    font-size: 11px;
  }

  .thread-control-panel {
    padding: 9px 10px;
    gap: 7px;
    border-radius: 10px;
  }

  .thread-control-head {
    gap: 10px;
  }

  .thread-control-summary,
  .thread-control-task-title {
    font-size: 11px;
  }

  .thread-control-feedback,
  .thread-control-meta,
  .thread-control-task-meta,
  .thread-control-empty {
    font-size: 10px;
  }

  .thread-control-actions .ghost,
  .thread-control-task-action {
    padding: 5px 9px;
    font-size: 11px;
  }

  .thread-control-task-item {
    padding: 7px 9px;
    border-radius: 9px;
  }

  .runtime-send-bundle-item {
    padding: 7px 9px;
    border-radius: 9px;
  }

  .runtime-send-bundle-title {
    font-size: 11px;
  }

  .runtime-send-bundle-summary {
    font-size: 10px;
  }

  .runtime-label {
    display: none;
  }

  .runtime-summary-text {
    flex: 1;
    font-size: 11px;
  }

  .runtime-badge {
    display: none;
  }

  .thread-flag,
  .device-badge {
    padding: 1px 7px;
    font-size: 10px;
  }

  .thread-unread {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }

  .session-status {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 560px) {
  .screen-login {
    padding: 0;
  }

  .login-card {
    width: 100%;
    min-height: 100vh;
    padding: 32px 20px;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  .app-shell,
  .mobile-topbar {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    max-width: 100vw;
  }

  .panel {
    border-radius: 0;
    min-height: calc(100vh - 49px);
    height: calc(100vh - 49px);
    max-width: 100vw;
    overflow: hidden;
  }

  .panel-threads,
  .panel-devices {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .thread-list,
  .device-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .message-list-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .message-list {
    flex: 0 0 auto;
    min-height: auto;
    height: auto;
    overflow: visible;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: auto;
    touch-action: auto;
  }

  .thread-item,
  .device-item {
    border-radius: 0;
  }

  .panel-header,
  .conversation-header,
  .runtime-card {
    padding-left: 10px;
    padding-right: 10px;
  }

  .thread-list,
  .device-list {
    padding-left: 0;
    padding-right: 0;
  }

  .message-list {
    padding-left: 8px;
    padding-right: 8px;
  }

  .composer {
    padding-left: 8px;
    padding-right: 8px;
  }

  .conversation-actions {
    right: 10px;
    min-width: 144px;
  }

  .thread-tools-popover {
    right: 10px;
    min-width: min(168px, calc(100vw - 20px));
  }

  .conversation-actions-shell {
    margin-right: 0;
  }

  .thread-panel-controls {
    margin-right: -10px;
    justify-content: flex-end;
  }

  .thread-item {
    min-height: 82px;
    padding: 9px 10px;
  }

  .thread-item.is-selection-mode {
    grid-template-columns: 18px 42px minmax(0, 1fr);
  }

  .thread-avatar-stack {
    gap: 4px;
  }

  .tab-button {
    min-height: 52px;
    font-size: 12px;
  }

  .tab-button-badge {
    right: calc(50% - 31px);
  }

  .thread-name {
    font-size: 14px;
  }

  .thread-preview {
    font-size: 11px;
  }

  .thread-location {
    font-size: 11px;
  }

  .thread-heartbeat {
    font-size: 9px;
  }

  .active-thread-location {
    font-size: 11px;
  }

  .thread-tag-chip {
    font-size: 10px;
    padding: 2px 7px;
  }

  .thread-profile-chip {
    font-size: 10px;
    padding: 2px 7px;
  }

  .thread-filter-select {
    width: 100%;
    min-width: 0;
    font-size: 12px;
  }

  .composer-side-button {
    min-width: 36px;
    height: 36px;
  }

  .composer-input-shell #composer-input {
    padding-left: 11px;
    padding-right: 11px;
  }
}

@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  #app-screen,
  .screen-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
  }

  .system-banner {
    flex: 0 0 auto;
  }

  .app-shell {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }

  .app-view {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .panel {
    min-height: 0;
    height: 100%;
  }

  .panel-threads,
  .panel-devices,
  .panel-conversation {
    min-height: 0;
    height: 100%;
  }
}
