:root {
  --font-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --type-weight-regular: 400;
  --type-weight-medium: 500;
  --type-weight-semibold: 600;
  --type-weight-bold: 700;
  --type-size-caption: 11px;
  --type-size-meta: 12px;
  --type-size-body: 14px;
  --type-size-message: 15px;
  --type-size-control: 16px;
  --type-size-title: 18px;
  --type-size-display: 21px;
  --type-size-code: 0.92em;
  font-family: var(--font-sans);
  color: #121316;
  background: #e9eaec;
  color-scheme: light dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-regular);
  line-height: 1.4;
}

#root {
  min-width: 0;
  font-family: var(--font-sans);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: inherit;
}

::placeholder {
  font: inherit;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button,
.message-card,
.task-card,
.thread-root,
.thread-task-card,
.reply-list article {
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.boot {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: #777;
}

.boot-panel {
  display: grid;
  gap: 10px;
  max-width: 520px;
  padding: 20px;
  text-align: center;
}

.boot-panel strong {
  color: #23252b;
  font-size: var(--type-size-message);
}

.boot-panel p {
  margin: 0;
  color: #b42318;
  font-size: var(--type-size-body);
  line-height: 1.5;
}

.boot-panel button {
  justify-self: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

:root,
.app {
  --bg-app: #f0f3f7;
  --bg-sidebar: #f3f5f8;
  --bg-panel: #f7f8fa;
  --bg-panel-strong: #fbfcfd;
  --bg-elevated: #f4f6f9;
  --bg-input: #fbfcfd;
  --bg-header: rgba(247, 248, 250, 0.96);
  --bg-composer: #f4f6f9;
  --bg-control: linear-gradient(180deg, #fbfcfd 0%, #edf1f5 100%);
  --bg-control-flat: rgba(240, 243, 247, 0.92);
  --bg-control-hover: color-mix(in srgb, var(--accent) 7%, var(--bg-panel));
  --bg-control-selected: linear-gradient(180deg, #fbfcfd 0%, #edf1f5 100%);
  --bg-hover: color-mix(in srgb, var(--accent) 8%, var(--bg-panel));
  --bg-selected-soft: rgba(10, 132, 255, 0.09);
  --bg-selected-accent:
    linear-gradient(180deg, rgba(10, 132, 255, 0.18), rgba(10, 132, 255, 0.1)),
    var(--bg-control-flat);
  --shadow-selected-accent:
    inset 0 0 0 1px var(--accent),
    0 0 0 3px rgba(10, 132, 255, 0.12);
  --bg-code: #101318;
  --ink-primary: #20242b;
  --ink-secondary: #4f5661;
  --ink-muted: #68717d;
  --ink-control: #20242b;
  --ink-placeholder: rgba(104, 113, 125, 0.72);
  --ink-disabled: rgba(104, 113, 125, 0.42);
  --border-subtle: rgba(32, 36, 44, 0.1);
  --border-strong: rgba(32, 36, 44, 0.16);
  --control-border: rgba(32, 36, 44, 0.14);
  --status-warning: #a25c00;
  --status-warning-soft: rgba(255, 159, 10, 0.1);
  --status-warning-border: rgba(255, 159, 10, 0.24);
  --status-danger: #b42318;
  --status-danger-soft: rgba(255, 69, 58, 0.12);
  --status-danger-border: rgba(185, 28, 28, 0.16);
  --status-success: #167d32;
  --status-success-soft: rgba(52, 199, 89, 0.14);
  --status-success-border: rgba(52, 199, 89, 0.24);
  --surface-app: var(--bg-app);
  --surface-app-gradient:
    radial-gradient(circle at 14% 8%, rgba(255, 255, 255, 0.54), transparent 24%),
    radial-gradient(circle at 86% 18%, rgba(10, 132, 255, 0.045), transparent 28%),
    linear-gradient(135deg, #f0f3f7 0%, #f7f8fa 48%, #eef2f6 100%);
  --surface-sidebar: var(--bg-sidebar);
  --surface-panel: var(--bg-panel);
  --surface-panel-strong: var(--bg-panel-strong);
  --surface-elevated: var(--bg-elevated);
  --surface-floating: var(--bg-panel-strong);
  --surface-sticky: var(--bg-header);
  --surface-input: var(--bg-input);
  --surface-composer: var(--bg-composer);
  --surface-control: var(--bg-control);
  --surface-control-flat: var(--bg-control-flat);
  --surface-control-hover: var(--bg-control-hover);
  --surface-control-selected: var(--bg-control-selected);
  --surface-code: var(--bg-code);
  --surface-tooltip: rgba(29, 28, 29, 0.94);
  --ink-on-surface: var(--ink-primary);
  --ink-on-surface-secondary: var(--ink-secondary);
  --ink-on-surface-muted: var(--ink-muted);
  --ink-on-control: var(--ink-control);
  --ink-on-accent: var(--accent-ink);
  --ink-on-code: #f7f7f8;
  --ink-on-tooltip: #ffffff;
  --border-default: var(--border-subtle);
  --border-emphasis: var(--border-strong);
  --border-control: var(--control-border);
  --state-hover: var(--bg-hover);
  --state-selected: var(--bg-selected-soft);
  --state-active: var(--bg-selected-soft);
  --state-selected-emphasis:
    linear-gradient(180deg, rgba(10, 132, 255, 0.13), rgba(10, 132, 255, 0.07)),
    var(--bg-control-flat);
  --state-selected-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 1px 2px rgba(20, 23, 31, 0.05);
  --state-selected-emphasis-shadow:
    inset 0 0 0 1px rgba(10, 132, 255, 0.24),
    0 1px 2px rgba(20, 23, 31, 0.05);
  --state-focus-ring: rgba(10, 132, 255, 0.16);
  --state-danger: var(--status-danger-soft);
  --state-warning: var(--status-warning-soft);
  --state-success: var(--status-success-soft);
  --accent-soft: rgba(10, 132, 255, 0.1);
  --accent-soft-border: rgba(10, 132, 255, 0.22);
  --accent-soft-ink: #1262b3;
  --accent-soft-hover: rgba(10, 132, 255, 0.15);
  --accent-soft-hover-border: rgba(10, 132, 255, 0.34);
  --accent-soft-hover-ink: #075aa5;
  --badge-bg: var(--badge);
  --badge-ink: var(--accent);
  --sidebar: var(--bg-sidebar);
  --panel: rgba(242, 245, 248, 0.94);
  --panel-strong: var(--bg-panel-strong);
  --ink: var(--ink-primary);
  --muted: var(--ink-muted);
  --line: var(--border-subtle);
  --accent: #0a84ff;
  --accent-ink: #ffffff;
  --badge: #eef6ff;
  --badge-phase-default-bg: rgba(142, 142, 147, 0.12);
  --badge-phase-default-ink: var(--muted);
  --badge-phase-thinking-bg: rgba(90, 200, 250, 0.16);
  --badge-phase-thinking-ink: #0071a8;
  --badge-phase-command-bg: rgba(255, 159, 10, 0.18);
  --badge-phase-command-ink: #9a5a00;
  --badge-phase-file-bg: rgba(191, 90, 242, 0.14);
  --badge-phase-file-ink: #7b2cbf;
  --badge-phase-success-bg: rgba(52, 199, 89, 0.16);
  --badge-phase-success-ink: #167d32;
  --badge-phase-error-bg: rgba(255, 69, 58, 0.15);
  --badge-phase-error-ink: #c91810;
  --unread-bg: transparent;
  --unread-border: transparent;
  --unread-ink: var(--ink-primary);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --surface-border: rgba(32, 36, 44, 0.16);
  --surface-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  --surface-profile-hero-bg:
    radial-gradient(circle at 12% 0%, rgba(10, 132, 255, 0.17), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(52, 199, 89, 0.13), transparent 30%),
    linear-gradient(180deg, rgba(251, 252, 253, 0.96), rgba(244, 246, 249, 0.9));
  --surface-profile-hero-shadow: 0 18px 42px rgba(32, 36, 44, 0.08);
  --surface-profile-tabs-bg: rgba(240, 243, 247, 0.84);
  --surface-profile-tabs-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  --surface-profile-tab-hover: rgba(247, 248, 250, 0.9);
  --surface-profile-tab-active: #fbfcfd;
  --surface-profile-tab-shadow: 0 8px 20px rgba(32, 36, 44, 0.08);
  --surface-sidebar-edge:
    inset -1px 0 0 rgba(255, 255, 255, 0.58),
    1px 0 2px rgba(32, 36, 44, 0.035);
  --surface-panel-edge:
    inset 1px 0 0 rgba(255, 255, 255, 0.5),
    inset -1px 0 0 rgba(255, 255, 255, 0.38);
  --surface-horizontal-edge:
    inset 0 -1px 0 rgba(255, 255, 255, 0.5),
    0 1px 2px rgba(32, 36, 44, 0.035);
  --surface-composer-edge:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 -1px 2px rgba(32, 36, 44, 0.035);
  --surface-menu-overlay: var(--panel);
  --modal-mobile-backdrop-bg: rgba(17, 24, 39, 0.55);
  --modal-mobile-card-border: rgba(15, 23, 42, 0.18);
  --activity-feed-panel-bg: rgba(247, 248, 250, 0.98);
  --activity-feed-panel-border: rgba(20, 23, 31, 0.14);
  --activity-feed-panel-shadow: 0 32px 86px rgba(15, 23, 42, 0.24);
  --activity-feed-control-bg: var(--bg-control);
  --activity-feed-control-hover-bg: var(--bg-control-hover);
  --activity-feed-control-border: rgba(20, 23, 31, 0.1);
  --activity-feed-control-ink: #656c78;
  --activity-feed-control-hover-ink: #20242b;
  --activity-feed-control-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(20, 23, 31, 0.04);
  --activity-feed-filters-bg: rgba(240, 243, 247, 0.86);
  --activity-feed-filter-bg: #fbfcfd;
  --activity-feed-filter-border: rgba(142, 142, 147, 0.16);
  --activity-feed-filter-active-bg: #edf1f5;
  --activity-feed-filter-active-border: rgba(20, 23, 31, 0.16);
  --activity-feed-filter-active-ink: #20242b;
  --activity-feed-row-border: rgba(20, 23, 31, 0.06);
  --activity-feed-row-hover-bg: var(--bg-hover);
  --activity-feed-row-title-ink: #1d1c1d;
  --activity-feed-row-body-ink: #1d1c1d;
  --activity-feed-meta-chip-bg: #eef0f4;
  --activity-feed-meta-chip-ink: var(--ink-secondary);
  --activity-feed-status-bg: #f0f9f3;
  --activity-feed-status-ink: #167a36;
  --activity-feed-unread-bg: #ff3b30;
  --activity-feed-unread-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
  --thread-new-border: rgba(52, 199, 89, 0.82);
  --thread-new-bg: rgba(52, 199, 89, 0.06);
  --thread-new-ink: #1f7a4d;
  --thread-new-shadow: 0 0 0 3px rgba(52, 199, 89, 0.12);
  --thread-new-pulse-shadow: 0 0 0 6px rgba(52, 199, 89, 0.04);
  --activity-feed-action-bg: var(--bg-panel-strong);
  --activity-feed-action-shadow: inset 0 0 0 1px rgba(20, 23, 31, 0.16);
  --activity-feed-action-success-bg: rgba(52, 199, 89, 0.12);
  --activity-feed-action-success-ink: #168a36;
  --activity-feed-action-danger-bg: rgba(255, 59, 48, 0.1);
  --activity-feed-action-danger-ink: #c4231d;
  --activity-feed-action-danger-border: rgba(196, 35, 29, 0.24);
  --activity-feed-mobile-bg: var(--bg-panel);
  --activity-feed-swipe-bg: #ff3b30;
  --activity-feed-swipe-ink: #fff;
  --task-board-bg: var(--bg-app);
  --task-card-bg: var(--bg-panel-strong);
  --task-input-bg: var(--bg-input);
  --task-count-bg: rgba(20, 23, 31, 0.07);
  --task-unassigned-bg: rgba(255, 250, 242, 0.78);
  --task-unassigned-border: rgba(255, 149, 0, 0.3);
  --task-unassigned-strong-bg: rgba(255, 149, 0, 0.14);
  --task-unassigned-strong-ink: #a35b00;
  --task-label-bg: rgba(10, 132, 255, 0.09);
  --task-control-hover-border: rgba(20, 23, 31, 0.1);
  --task-empty-avatar-bg:
    linear-gradient(135deg, rgba(20, 23, 31, 0.07), rgba(20, 23, 31, 0.02));
  --task-empty-avatar-border: rgba(20, 23, 31, 0.2);
  --task-floating-bg: var(--surface-menu-overlay);
  --task-muted-separator: rgba(20, 23, 31, 0.28);
  --task-thread-bg: rgba(228, 241, 255, 0.62);
  --task-thread-border: rgba(10, 132, 255, 0.2);
  --task-review-success-ink: #167a36;
  --task-execution-border: rgba(10, 132, 255, 0.12);
  --task-execution-ink: #172033;
  --task-execution-muted: #7b7b81;
  --task-execution-time: #8e8e93;
  --task-toggle-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 1px 2px rgba(20, 23, 31, 0.04);
  --task-toggle-active-bg: #d6f3e0;
  --task-toggle-active-border: rgba(21, 128, 61, 0.55);
  --task-toggle-active-ink: #0f5f2c;
  --task-toggle-active-shadow:
    inset 0 0 0 1px rgba(21, 128, 61, 0.22),
    0 1px 2px rgba(21, 128, 61, 0.14);
  --task-toggle-active-hover-bg: #c6ecd3;
  --task-toggle-active-hover-border: rgba(21, 128, 61, 0.7);
  --task-toggle-active-hover-ink: #0c5026;
  --sidebar-width: 292px;
  --thread-width: 560px;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, 1fr) minmax(0, var(--thread-width));
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  background: var(--surface-app-gradient);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-regular);
  letter-spacing: 0;
  line-height: 1.4;
}

.app,
.app *,
.app *::before,
.app *::after {
  letter-spacing: 0 !important;
}

.app,
.app button,
.app input,
.app textarea,
.app select {
  font-family: var(--font-sans);
}

:root[data-theme="dark"],
:root[data-theme="dark"] .app {
  --bg-app: #242b35;
  --bg-sidebar: rgba(43, 51, 63, 0.96);
  --bg-panel: #303844;
  --bg-panel-strong: #374151;
  --bg-elevated: #3d4858;
  --bg-input: #2a3340;
  --bg-header: rgba(53, 62, 75, 0.94);
  --bg-composer: rgba(48, 56, 68, 0.98);
  --bg-control: linear-gradient(180deg, #404b5c 0%, #343e4d 100%);
  --bg-control-flat: rgba(226, 232, 240, 0.12);
  --bg-control-hover: #465366;
  --bg-control-selected: linear-gradient(180deg, #485568 0%, #3a4657 100%);
  --bg-hover: rgba(105, 170, 252, 0.14);
  --bg-selected-soft: rgba(105, 170, 252, 0.18);
  --bg-selected-accent:
    linear-gradient(180deg, rgba(105, 170, 252, 0.24), rgba(105, 170, 252, 0.14)),
    var(--bg-control-flat);
  --shadow-selected-accent:
    inset 0 0 0 1px rgba(105, 170, 252, 0.72),
    0 0 0 3px rgba(105, 170, 252, 0.16);
  --bg-code: #1b222d;
  --ink-primary: #f4f6fa;
  --ink-secondary: #dde3ec;
  --ink-muted: #b3bdcc;
  --ink-control: #f4f6fa;
  --ink-placeholder: rgba(143, 152, 168, 0.72);
  --ink-disabled: rgba(143, 152, 168, 0.42);
  --border-subtle: rgba(226, 232, 240, 0.18);
  --border-strong: rgba(226, 232, 240, 0.3);
  --control-border: rgba(226, 232, 240, 0.24);
  --status-warning: #ffc166;
  --status-warning-soft: rgba(255, 177, 66, 0.16);
  --status-warning-border: rgba(255, 177, 66, 0.28);
  --status-danger: #ffb4ab;
  --status-danger-soft: rgba(255, 69, 58, 0.16);
  --status-danger-border: rgba(255, 69, 58, 0.24);
  --status-success: #67d084;
  --status-success-soft: rgba(52, 199, 89, 0.14);
  --status-success-border: rgba(52, 199, 89, 0.28);
  --surface-app: var(--bg-app);
  --surface-app-gradient:
    linear-gradient(135deg, #222a35 0%, #2a3340 52%, #25313f 100%);
  --surface-sidebar: var(--bg-sidebar);
  --surface-panel: var(--bg-panel);
  --surface-panel-strong: var(--bg-panel-strong);
  --surface-elevated: var(--bg-elevated);
  --surface-floating: var(--bg-panel-strong);
  --surface-sticky: var(--bg-header);
  --surface-input: var(--bg-input);
  --surface-composer: var(--bg-composer);
  --surface-control: var(--bg-control);
  --surface-control-flat: var(--bg-control-flat);
  --surface-control-hover: var(--bg-control-hover);
  --surface-control-selected: var(--bg-control-selected);
  --surface-code: var(--bg-code);
  --ink-on-surface: var(--ink-primary);
  --ink-on-surface-secondary: var(--ink-secondary);
  --ink-on-surface-muted: var(--ink-muted);
  --ink-on-control: var(--ink-control);
  --ink-on-accent: var(--accent-ink);
  --ink-on-code: #eef2f7;
  --border-default: var(--border-subtle);
  --border-emphasis: var(--border-strong);
  --border-control: var(--control-border);
  --state-hover: var(--bg-hover);
  --state-selected: var(--bg-selected-soft);
  --state-active: var(--bg-selected-soft);
  --state-selected-emphasis: var(--bg-selected-accent);
  --state-selected-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.18);
  --state-selected-emphasis-shadow: var(--shadow-selected-accent);
  --state-focus-ring: rgba(105, 170, 252, 0.2);
  --state-danger: var(--status-danger-soft);
  --state-warning: var(--status-warning-soft);
  --state-success: var(--status-success-soft);
  --accent-soft: rgba(105, 170, 252, 0.14);
  --accent-soft-border: rgba(105, 170, 252, 0.28);
  --accent-soft-ink: var(--accent);
  --accent-soft-hover: rgba(105, 170, 252, 0.22);
  --accent-soft-hover-border: rgba(105, 170, 252, 0.4);
  --accent-soft-hover-ink: var(--accent);
  --sidebar: var(--bg-sidebar);
  --panel: rgba(48, 56, 68, 0.96);
  --panel-strong: var(--bg-panel-strong);
  --ink: var(--ink-primary);
  --muted: var(--ink-muted);
  --line: var(--border-subtle);
  --accent: #69aafc;
  --accent-ink: #07111f;
  --badge: rgba(105, 170, 252, 0.16);
  --badge-bg: var(--badge);
  --badge-ink: var(--accent);
  --badge-phase-default-bg: rgba(226, 232, 240, 0.1);
  --badge-phase-default-ink: var(--ink-muted);
  --badge-phase-thinking-bg: rgba(90, 200, 250, 0.16);
  --badge-phase-thinking-ink: #7dd3fc;
  --badge-phase-command-bg: rgba(255, 177, 66, 0.16);
  --badge-phase-command-ink: #ffc166;
  --badge-phase-file-bg: rgba(216, 180, 254, 0.16);
  --badge-phase-file-ink: #d8b4fe;
  --badge-phase-success-bg: rgba(52, 199, 89, 0.14);
  --badge-phase-success-ink: #67d084;
  --badge-phase-error-bg: rgba(255, 69, 58, 0.12);
  --badge-phase-error-ink: #ffb4ab;
  --unread-bg: transparent;
  --unread-border: transparent;
  --unread-ink: var(--ink-primary);
  --surface-border: var(--border-strong);
  --surface-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  --surface-profile-hero-bg:
    radial-gradient(circle at 12% 0%, rgba(105, 170, 252, 0.18), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(52, 199, 89, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg-panel-strong), var(--bg-panel));
  --surface-profile-hero-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --surface-profile-tabs-bg: var(--bg-control-flat);
  --surface-profile-tabs-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --surface-profile-tab-hover: var(--bg-control-hover);
  --surface-profile-tab-active: var(--bg-control-selected);
  --surface-profile-tab-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  --surface-sidebar-edge:
    inset -1px 0 0 rgba(255, 255, 255, 0.06),
    1px 0 2px rgba(0, 0, 0, 0.16);
  --surface-panel-edge:
    inset 1px 0 0 rgba(255, 255, 255, 0.05),
    inset -1px 0 0 rgba(255, 255, 255, 0.04);
  --surface-horizontal-edge:
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.16);
  --surface-composer-edge:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 -1px 2px rgba(0, 0, 0, 0.14);
  --surface-menu-overlay: rgba(55, 65, 81, 0.94);
  --activity-feed-panel-bg: var(--bg-panel);
  --activity-feed-panel-border: var(--border-strong);
  --activity-feed-panel-shadow: var(--surface-shadow);
  --activity-feed-control-bg: var(--bg-panel-strong);
  --activity-feed-control-hover-bg: var(--bg-control-hover);
  --activity-feed-control-border: var(--border-subtle);
  --activity-feed-control-ink: var(--ink-primary);
  --activity-feed-control-hover-ink: var(--ink-primary);
  --activity-feed-control-shadow: none;
  --activity-feed-filters-bg: var(--bg-elevated);
  --activity-feed-filter-bg: var(--bg-panel-strong);
  --activity-feed-filter-border: var(--border-subtle);
  --activity-feed-filter-active-bg: rgba(105, 170, 252, 0.16);
  --activity-feed-filter-active-border: rgba(105, 170, 252, 0.32);
  --activity-feed-filter-active-ink: var(--accent);
  --activity-feed-row-border: var(--border-subtle);
  --activity-feed-row-hover-bg: var(--bg-hover);
  --activity-feed-row-title-ink: var(--ink-primary);
  --activity-feed-row-body-ink: var(--ink-secondary);
  --activity-feed-meta-chip-bg: rgba(226, 232, 240, 0.1);
  --activity-feed-meta-chip-ink: var(--ink-secondary);
  --activity-feed-status-bg: rgba(52, 199, 89, 0.14);
  --activity-feed-status-ink: #67d084;
  --activity-feed-unread-bg: #ff3b30;
  --activity-feed-unread-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
  --thread-new-border: rgba(103, 208, 132, 0.78);
  --thread-new-bg: rgba(52, 199, 89, 0.12);
  --thread-new-ink: #67d084;
  --thread-new-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
  --thread-new-pulse-shadow: 0 0 0 6px rgba(52, 199, 89, 0.06);
  --activity-feed-action-bg: var(--bg-panel-strong);
  --activity-feed-action-shadow: inset 0 0 0 1px var(--border-subtle);
  --activity-feed-action-success-bg: rgba(52, 199, 89, 0.14);
  --activity-feed-action-success-ink: #67d084;
  --activity-feed-action-danger-bg: rgba(255, 69, 58, 0.12);
  --activity-feed-action-danger-ink: var(--status-danger);
  --activity-feed-action-danger-border: var(--status-danger-border);
  --activity-feed-mobile-bg: var(--bg-panel);
  --activity-feed-swipe-bg: #ff3b30;
  --activity-feed-swipe-ink: #fff;
  --task-board-bg: var(--bg-app);
  --task-card-bg: var(--bg-panel);
  --task-input-bg: var(--bg-input);
  --task-count-bg: var(--bg-control-flat);
  --task-unassigned-bg: var(--status-warning-soft);
  --task-unassigned-border: var(--status-warning-border);
  --task-unassigned-strong-bg: var(--status-warning-soft);
  --task-unassigned-strong-ink: var(--status-warning);
  --task-label-bg: var(--badge-bg);
  --task-control-hover-border: var(--border-strong);
  --task-empty-avatar-bg: var(--bg-control-flat);
  --task-empty-avatar-border: var(--border-strong);
  --task-floating-bg: var(--surface-menu-overlay);
  --task-muted-separator: var(--ink-disabled);
  --task-thread-bg: var(--bg-panel);
  --task-thread-border: var(--border-subtle);
  --task-review-success-ink: var(--status-success);
  --task-execution-border: var(--border-subtle);
  --task-execution-ink: var(--ink-primary);
  --task-execution-muted: var(--ink-muted);
  --task-execution-time: var(--ink-muted);
  --task-toggle-shadow: none;
  --task-toggle-active-bg: var(--status-success-soft);
  --task-toggle-active-border: var(--status-success-border);
  --task-toggle-active-ink: var(--status-success);
  --task-toggle-active-shadow: none;
  --task-toggle-active-hover-bg: var(--status-success-soft);
  --task-toggle-active-hover-border: var(--status-success-border);
  --task-toggle-active-hover-ink: var(--status-success);
}

:root[data-theme="dark"] .app {
  background: var(--surface-app-gradient);
  color: var(--ink-primary);
}

.sidebar,
.conversation,
.thread {
  min-width: 0;
  min-height: 0;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  box-shadow: var(--surface-sidebar-edge);
  backdrop-filter: blur(28px) saturate(1.2);
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 8px;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
}

.sidebar-resize-handle::after {
  position: absolute;
  top: 50%;
  right: 3px;
  width: 2px;
  height: 48px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0);
  content: "";
  transform: translateY(-50%);
  transition: background-color 140ms ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:focus-visible::after {
  background: rgba(10, 132, 255, 0.48);
}

.mobile-nav-button,
.mobile-bottom-nav,
.thread-mobile-back,
.agent-mobile-back {
  display: none;
}

.mobile-sidebar-close,
.mobile-sidebar-backdrop {
  display: none !important;
}

.workspace,
.quick-actions,
.profile {
  flex: 0 0 auto;
}

.sidebar-sections {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.workspace {
  padding: 20px 18px 14px;
}

.workspace-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 15px 10px 10px;
  border-radius: var(--radius-lg);
  background: var(--bg-control-flat);
  color: var(--ink-primary);
  border: 1px solid var(--control-border);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.workspace-switch-logo {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.workspace-switch strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
  letter-spacing: 0;
}

.quick-actions {
  display: grid;
  gap: 8px;
  padding: 22px 18px 14px;
}

.search-trigger {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--control-border);
  border-radius: 15px;
  background: var(--bg-control-flat);
  color: var(--muted);
  text-align: left;
}

.search-trigger span {
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-semibold);
}

.search-trigger kbd {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.quick-actions button,
.channel,
.dm,
.section-title button {
  color: inherit;
  background: transparent;
}

.quick-actions button {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  font-size: var(--type-size-message);
  text-align: left;
}

.search-trigger,
.sidebar-nav-trigger {
  border: 1px solid var(--control-border);
  background: var(--bg-control-flat);
  color: var(--muted);
}

.search-trigger-label,
.sidebar-nav-trigger-label {
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-semibold);
  opacity: 1;
}

.sidebar-nav-trigger.active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-nav-trigger.active .sidebar-nav-trigger-label {
  color: var(--accent);
}

.quick-actions button:hover,
.channel:hover {
  background: var(--bg-hover);
}

.quick-actions span {
  opacity: 0.5;
  font-size: var(--type-size-body);
}

.unread-badge {
  display: inline-flex;
  box-sizing: border-box;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 30px;
  min-width: 30px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  font-size: var(--type-size-caption);
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: var(--type-weight-semibold);
  line-height: 1;
  text-align: center;
}

.channel-block,
.dm-list {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 0 18px;
}

.channel-block {
  flex: 0 0 clamp(104px, var(--sidebar-channels-height, 260px), calc(100% - 118px));
}

.dm-list {
  flex: 1 1 auto;
}

.sidebar-sections.channels-collapsed .dm-list:not(.collapsed),
.sidebar-sections.dms-collapsed .channel-block:not(.collapsed) {
  flex: 1 1 auto;
}

.sidebar-section-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0 8px;
}

.channel-block.collapsed,
.dm-list.collapsed {
  flex: 0 0 auto;
  overflow: hidden;
}

.channel-block.collapsed .sidebar-section-scroll,
.dm-list.collapsed .sidebar-section-scroll {
  display: none;
}

.sidebar-section-resize-handle {
  position: relative;
  flex: 0 0 14px;
  margin: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: row-resize;
}

.sidebar-section-resize-handle::before,
.sidebar-section-resize-handle::after {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  border-radius: 999px;
  content: "";
  transform: translateY(-50%);
  transition:
    background-color 140ms ease,
    height 140ms ease;
}

.sidebar-section-resize-handle::before {
  background: rgba(20, 23, 31, 0.08);
}

.sidebar-section-resize-handle::after {
  background: rgba(10, 132, 255, 0);
}

.sidebar-section-resize-handle:hover::after,
.sidebar-section-resize-handle:focus-visible::after {
  height: 2px;
  background: rgba(10, 132, 255, 0.5);
}

.section-title {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-label span {
  display: inline-flex;
  align-items: center;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.channel-section-actions {
  flex: 0 0 auto;
}

.channel-sort-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 26px);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--bg-control-flat);
}

.section-title .channel-sort-control button {
  width: 26px;
  height: 26px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.section-title .channel-sort-control button:hover,
.section-title .channel-sort-control button:focus-visible {
  background: var(--bg-hover);
  color: var(--ink);
  outline: none;
}

.section-title .channel-sort-control button.active {
  background: var(--state-selected-emphasis);
  color: var(--ink-control);
}

.section-title button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: var(--bg-control-flat);
}

.section-title .section-collapse {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.section-title .section-collapse:hover {
  background: var(--bg-control-flat);
  color: var(--ink);
}

.section-title .section-collapse.collapsed {
  transform: rotate(-90deg);
}

.empty-mini {
  padding: 12px;
  color: currentColor;
  font-size: var(--type-size-body);
  line-height: 1.35;
  opacity: 0.58;
}

.sidebar-empty-cta {
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
}

.sidebar-empty-cta p {
  margin: 0;
  padding: 0 12px;
  color: currentColor;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.58;
}

.sidebar-empty-cta button {
  display: inline-flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--accent-soft-border);
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 13px;
  font-weight: 760;
}

.sidebar-empty-cta button:hover,
.sidebar-empty-cta button:focus-visible {
  border-color: var(--accent-soft-hover-border);
  background: var(--accent-soft-hover);
  color: var(--accent-soft-hover-ink);
}

.channel {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  text-align: left;
}

.channel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel:focus-visible {
  border-color: var(--control-border);
  background: var(--bg-hover);
  outline: none;
}

.channel.selected {
  border-color: transparent;
  background: var(--state-selected-emphasis);
  color: var(--ink-control);
  box-shadow: var(--state-selected-emphasis-shadow);
}

.channel.selected .unread-badge {
  background: var(--bg-control-flat);
  color: var(--ink-muted);
}

.channel.has-unread:not(.selected) {
  border-color: var(--unread-border);
  background: var(--unread-bg);
  color: var(--unread-ink);
}

.sidebar-nav-trigger.has-unread .unread-badge,
.channel.has-unread .unread-badge,
.dm-row.has-unread .unread-badge,
.mobile-bottom-nav button.has-unread .unread-badge {
  background: var(--accent);
  color: var(--accent-ink);
}

.channel.selected.has-unread .unread-badge,
.dm-row.selected.has-unread .unread-badge {
  background: var(--accent);
  color: var(--accent-ink);
}

.dm-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding-right: 6px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.dm-row:hover {
  background: var(--bg-hover);
}

.dm-row.has-unread:not(.selected) {
  background: var(--unread-bg);
}

.dm-row.selected {
  border-color: transparent;
  background: var(--state-selected-emphasis);
  color: var(--ink-control);
  box-shadow: var(--state-selected-emphasis-shadow);
}

.dm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 9px 4px 9px 0;
  text-align: left;
}

.dm.selected,
.dm-row.selected .dm {
  background: transparent;
  color: inherit;
}

.dm > div strong,
.dm > div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm div strong {
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.dm div span {
  color: currentColor;
  font-size: var(--type-size-meta);
  opacity: 0.62;
}

.dm .unread-badge {
  max-width: 34px;
}

.dm.selected .unread-badge,
.dm-row.selected:not(.has-unread) .dm .unread-badge {
  background: var(--badge-bg);
  color: var(--badge-ink);
}

.dm-avatar-shell {
  display: grid;
  width: 34px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.dm-row:hover .dm-avatar-shell,
.dm-avatar-shell:hover,
.dm-avatar-shell:focus-visible {
  background: transparent;
  box-shadow: none;
  outline: none;
}

.dm-avatar-shell .agent-avatar::after {
  display: none;
}

.dm-row-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 9px;
  min-width: 49px;
}

.dm-row-actions .dot {
  flex: 0 0 auto;
}

.dm-detail-trigger {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--bg-control-flat);
  color: var(--muted);
  opacity: 0.64;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

.dm-row:hover .dm-detail-trigger,
.dm-row:focus-within .dm-detail-trigger,
.dm-detail-trigger:hover,
.dm-detail-trigger:focus-visible {
  border-color: transparent;
  background: var(--bg-control-selected);
  color: var(--accent);
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: none;
}

.member-editor {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.3);
}

.member-editor strong {
  font-size: var(--type-size-meta);
}

.member-editor span {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.member-editor label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-secondary);
  font-size: var(--type-size-meta);
}

.member-editor input {
  width: auto;
  accent-color: var(--accent);
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  background: var(--bg-control-flat);
  color: var(--ink-primary);
  font-weight: var(--type-weight-bold);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.avatar.human {
  background: var(--badge-phase-file-bg);
}

.avatar.tiny {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  font-size: var(--type-size-body);
}

.avatar.small {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  font-size: var(--type-size-body);
}

.message-agent-avatar-trigger {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  align-self: start;
  padding: 0;
  border-radius: 15px;
  background: transparent;
  color: inherit;
}

.message-agent-avatar-trigger.tiny {
  width: 34px;
  height: 34px;
  border-radius: 13px;
}

.message-agent-avatar-trigger:hover {
  background: var(--bg-selected-soft);
}

.message-agent-avatar-trigger:hover .agent-avatar {
  transform: translateY(-1px) scale(1.03);
}

.agent-avatar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--avatar-bg);
  color: transparent;
  --avatar-cell-gap: 2px;
  --avatar-cell-radius: 2px;
  --avatar-pixel-inset: 7px;
  box-shadow:
    inset 0 0 0 1px var(--border-subtle),
    inset 0 0 0 2px var(--bg-hover),
    var(--state-selected-shadow);
}

.agent-avatar::after {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ink-muted);
  box-shadow:
    0 0 0 2px var(--avatar-bg),
    var(--state-selected-shadow);
  content: "";
}

.agent-avatar[data-show-status="false"]::after {
  display: none;
}

.agent-avatar.status-idle::after {
  background: var(--status-success);
}

.agent-avatar.status-starting::after,
.agent-avatar.status-queued::after,
.agent-avatar.status-running::after,
.agent-avatar.status-stopping::after {
  background: var(--status-warning);
}

.agent-avatar.status-error::after {
  background: var(--status-danger);
}

.agent-avatar.status-deleted {
  filter: grayscale(0.9);
  opacity: 0.72;
  box-shadow:
    inset 0 0 0 1px var(--border-subtle),
    inset 0 0 0 2px var(--bg-hover),
    var(--state-selected-shadow);
}

.agent-avatar[data-agent-deleted="true"]::before {
  position: absolute;
  inset: 6px;
  z-index: 3;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    transparent calc(50% - 1px),
    var(--ink-muted) calc(50% - 1px),
    var(--ink-muted) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  content: "";
  pointer-events: none;
}

.agent-avatar-sm[data-agent-deleted="true"]::before {
  inset: 5px;
}

.agent-avatar-lg[data-agent-deleted="true"]::before {
  inset: 9px;
}

.agent-avatar.status-deleted::after {
  background: var(--ink-muted);
}

.agent-avatar-pixels {
  position: absolute;
  inset: var(--avatar-pixel-inset);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: var(--avatar-cell-gap);
}

.agent-avatar-pixels span {
  border-radius: var(--avatar-cell-radius);
}

.agent-avatar-pixels span.filled {
  background: var(--avatar-color);
}

.agent-avatar-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--avatar-color);
  font-size: var(--type-size-code);
  font-weight: var(--type-weight-bold);
  letter-spacing: 0;
}

.agent-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-avatar-lg {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  font-size: var(--type-size-title);
  --avatar-cell-gap: 3px;
  --avatar-cell-radius: 3px;
  --avatar-pixel-inset: 10px;
}

.agent-avatar-lg::after {
  right: 4px;
  bottom: 4px;
  width: 13px;
  height: 13px;
  box-shadow:
    0 0 0 3px var(--avatar-bg),
    var(--state-selected-shadow);
}

.agent-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  font-size: var(--type-size-body);
  --avatar-cell-gap: 1px;
  --avatar-cell-radius: 1px;
  --avatar-pixel-inset: 6px;
}

.agent-avatar-sm::after {
  right: 1px;
  bottom: 1px;
  width: 8px;
  height: 8px;
}

.agent-avatar-profile-anchor {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.agent-avatar-profile-card {
  --agent-avatar-profile-bg: var(--bg-panel);
  --agent-avatar-profile-border: var(--border-strong);
  --agent-avatar-profile-shadow: var(--surface-shadow);
  --agent-avatar-profile-ink-primary: var(--ink-primary);
  --agent-avatar-profile-ink-secondary: var(--ink-secondary);
  --agent-avatar-profile-ink-muted: var(--ink-muted);
  position: fixed;
  z-index: 1400;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  width: min(252px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--agent-avatar-profile-border);
  border-radius: 12px;
  background: var(--agent-avatar-profile-bg);
  box-shadow: var(--agent-avatar-profile-shadow);
  color: var(--agent-avatar-profile-ink-primary);
  font-size: var(--type-size-meta);
  line-height: 1.35;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  text-align: left;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  visibility: hidden;
}

:root[data-theme="dark"] .agent-avatar-profile-card {
  --agent-avatar-profile-bg: var(--bg-panel-strong);
}

.agent-avatar-profile-image {
  margin-top: 1px;
}

.agent-avatar-profile-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.agent-avatar-profile-card::after {
  position: absolute;
  left: var(--agent-avatar-profile-arrow-left, 50%);
  width: 10px;
  height: 10px;
  background: var(--agent-avatar-profile-bg);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.agent-avatar-profile-card-above::after {
  bottom: -5px;
  border-right: 1px solid var(--agent-avatar-profile-border);
  border-bottom: 1px solid var(--agent-avatar-profile-border);
}

.agent-avatar-profile-card-below {
  transform: translateY(-4px);
}

.agent-avatar-profile-card-below::after {
  top: -5px;
  border-top: 1px solid var(--agent-avatar-profile-border);
  border-left: 1px solid var(--agent-avatar-profile-border);
}

.agent-avatar-profile-card-visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.agent-avatar-profile-name,
.agent-avatar-profile-handle,
.agent-avatar-profile-role,
.agent-avatar-profile-description {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-avatar-profile-name {
  color: var(--agent-avatar-profile-ink-primary);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.agent-avatar-profile-handle,
.agent-avatar-profile-role {
  color: var(--agent-avatar-profile-ink-muted);
  white-space: nowrap;
}

.agent-avatar-profile-role {
  margin-top: 1px;
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.agent-avatar-profile-description {
  display: -webkit-box;
  color: var(--agent-avatar-profile-ink-secondary);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.profile strong {
  display: block;
  font-size: var(--type-size-message);
}

.profile span {
  display: block;
  color: currentColor;
  font-size: var(--type-size-meta);
  opacity: 0.56;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  color: var(--ink-muted);
  fill: currentColor;
}

.dot.idle {
  color: var(--status-success);
}

.dot.starting,
.dot.queued,
.dot.running {
  color: var(--status-warning);
}

.dot.stopping {
  color: var(--status-warning);
}

.dot.error {
  color: var(--status-danger);
}

.profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px 20px;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.profile-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.profile-main:hover,
.profile-main:focus-visible,
.profile-settings:hover,
.profile-settings:focus-visible {
  background: var(--bg-selected-soft);
  outline: none;
}

.profile-settings {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--bg-control-flat);
  color: var(--muted);
}

.profile-settings:hover,
.profile-settings:focus-visible {
  color: var(--accent);
}

.conversation {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: var(--surface-panel-edge);
  backdrop-filter: none;
  container: conversation / inline-size;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-width: 0;
  overflow: visible;
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
  box-shadow: var(--surface-horizontal-edge);
}

.topbar,
.thread header,
.agent-drawer-head {
  min-height: 72px;
  padding: 14px 18px;
}

.channel-title,
.thread-title,
.agent-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.channel-title {
  flex: 1 1 auto;
}

.channel-title > div,
.thread-title h2,
.agent-title > div {
  min-width: 0;
}

.desktop-history-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.desktop-history-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.desktop-history-button:hover:not(:disabled),
.desktop-history-button:focus-visible:not(:disabled) {
  border-color: rgba(10, 132, 255, 0.24);
  background: rgba(10, 132, 255, 0.09);
  color: var(--ink);
  outline: none;
}

.desktop-history-button:disabled {
  color: var(--ink-disabled);
  cursor: default;
}

.hash-card {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  background: var(--bg-control);
  color: var(--muted);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 1px 2px rgba(20, 23, 31, 0.04);
}

.hash-card svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.15;
}

.hash-card.dm-card {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: var(--type-weight-bold);
  box-shadow: none;
}

.hash-card.dm-card > span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.hash-card.dm-card .agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.dm-agent-detail-trigger:hover .agent-avatar {
  transform: translateY(-1px) scale(1.04);
}

.channel-header-actions {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.channel-agent-count-trigger,
.channel-action-trigger {
  display: inline-flex;
  flex: 0 0 auto;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-control);
  color: var(--ink-control);
}

.channel-action-trigger {
  width: 38px;
}

.channel-agent-count-trigger {
  gap: 7px;
  min-width: 58px;
  padding: 0 10px;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.channel-agent-count-trigger.empty {
  gap: 7px;
  min-width: 92px;
  padding: 0 10px;
}

.channel-agent-count-trigger span {
  white-space: nowrap;
}

.channel-agent-preview {
  display: inline-flex;
  align-items: center;
  padding-left: 2px;
}

.channel-agent-preview > span {
  display: inline-flex;
  margin-left: -7px;
}

.channel-agent-preview > span:first-child {
  margin-left: 0;
}

.channel-agent-preview .agent-avatar {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-header);
  box-shadow: 0 0 0 1px rgba(20, 23, 31, 0.08);
}

.channel-agent-count-trigger:hover,
.channel-action-trigger:hover,
.channel-action-trigger.active {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

.channel-actions-menu {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 6;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
  box-shadow: 0 18px 42px rgba(20, 22, 28, 0.18);
}

.channel-actions-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  text-align: left;
}

.channel-actions-menu button:hover {
  background: var(--bg-selected-soft);
}

.channel-actions-menu button.danger {
  color: #d92d20;
}

.channel-actions-menu button.danger:hover {
  background: rgba(217, 45, 32, 0.09);
}

.channel-title h1 {
  margin: 0;
  overflow: hidden;
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-title p,
.thread header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 16px;
}

.thread header button {
  display: inline-flex;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-control);
  color: var(--ink-control);
}

.thread-header-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.thread-header-actions button[data-tooltip] {
  position: relative;
}

.thread-header-actions button[data-tooltip]:not(:disabled)::after {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  max-width: 220px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-tooltip);
  color: var(--ink-on-tooltip);
  content: attr(data-tooltip);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition:
    opacity 60ms ease,
    transform 60ms ease;
  white-space: nowrap;
}

.thread-header-actions button[data-tooltip]:not(:disabled)::before {
  position: absolute;
  top: calc(100% + 3px);
  right: 15px;
  z-index: 8;
  width: 8px;
  height: 8px;
  background: var(--surface-tooltip);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px) rotate(45deg);
  transition:
    opacity 60ms ease,
    transform 60ms ease;
}

.thread-header-actions button[data-tooltip]:not(:disabled):hover::after,
.thread-header-actions button[data-tooltip]:not(:disabled):focus-visible::after,
.thread-header-actions button[data-tooltip]:not(:disabled):hover::before,
.thread-header-actions button[data-tooltip]:not(:disabled):focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.thread-header-actions button[data-tooltip]:not(:disabled):hover::before,
.thread-header-actions button[data-tooltip]:not(:disabled):focus-visible::before {
  transform: translateY(0) rotate(45deg);
}

.thread header .thread-mobile-back {
  display: none;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  background: transparent;
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: 18px;
}

.tabs button.active {
  color: var(--ink);
  background: var(--bg-control-flat);
}

.message-list,
.task-board,
.reply-list {
  min-height: 0;
  overflow: auto;
}

.message-list-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.message-list {
  height: 100%;
  padding: 10px 0 20px;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message-list-content {
  display: flow-root;
  min-height: 100%;
}

.message-list-bottom-anchor {
  height: 1px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 240px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  min-height: 180px;
}

.empty-state h2 {
  margin: 6px 0 0;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  max-width: 320px;
  line-height: 1.45;
}

.empty-state-action {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  padding: 0 13px;
  border: 1px solid rgba(10, 132, 255, 0.22);
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.08);
  color: #1262b3;
  font-size: 13px;
  font-weight: 760;
}

.empty-state-action:hover {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(10, 132, 255, 0.13);
}

.beginning {
  margin: 10px 24px 14px;
  color: #8f8f95;
  font-family: inherit;
  font-size: var(--type-size-meta);
  text-align: center;
}

.message-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 7px 22px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.message-card > .message-body {
  min-width: 0;
}

.message-card.compact,
.reply-list article.compact {
  padding-top: 3px;
  padding-bottom: 3px;
}

.message-compact-time {
  align-self: start;
  justify-self: end;
  margin-top: 2px;
  color: rgba(123, 125, 132, 0.82);
  font-size: var(--type-size-caption);
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  white-space: nowrap;
}

.message-card.compact:hover .message-compact-time,
.message-card.compact.focused .message-compact-time,
.message-card.compact.tap-focused .message-compact-time,
.message-card.compact[data-jump-focused="true"] .message-compact-time,
.reply-list article.compact:hover .message-compact-time,
.reply-list article.compact.tap-focused .message-compact-time,
.reply-list article.compact[data-jump-focused="true"] .message-compact-time {
  opacity: 1;
}

.message-card:hover,
.message-card.focused,
.message-card.tap-focused {
  transform: none;
  border-color: transparent;
  background: var(--bg-hover);
  box-shadow: none;
}

.message-card.focused,
.message-card.tap-focused {
  border-color: rgba(10, 132, 255, 0.28);
  background: var(--bg-selected-soft);
  box-shadow:
    inset 3px 0 var(--accent),
    inset 0 0 0 1px rgba(10, 132, 255, 0.12);
}

.thread-root.tap-focused,
.reply-list article.tap-focused {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(10, 132, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.14);
}

.message-card[data-jump-focused="true"],
.thread-root[data-jump-focused="true"],
.reply-list article[data-jump-focused="true"] {
  background: rgba(255, 204, 0, 0.15);
  box-shadow: inset 3px 0 #ffcc00;
}

.message-date-divider {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 14px 22px 8px;
  color: #8f8f95;
}

.message-date-divider span {
  height: 1px;
  background: var(--line);
}

.message-date-divider time {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control-flat);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 16px;
}

.thread-reply-summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 520px);
  max-width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-body);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 120ms ease;
}

.thread-reply-summary:hover {
  background: var(--bg-control-flat);
  border-color: rgba(30, 111, 201, 0.28);
  box-shadow: 0 2px 8px rgba(20, 23, 31, 0.08);
  color: var(--ink-control);
}

.thread-reply-summary:focus-visible {
  background: var(--bg-control-flat);
  border-color: rgba(30, 111, 201, 0.36);
  box-shadow: 0 0 0 3px rgba(30, 111, 201, 0.12);
  color: var(--ink-control);
  outline: none;
}

.thread-reply-summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  color: var(--accent);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.thread-reply-progress-dots {
  flex: 0 0 auto;
  min-width: 20px;
  color: var(--status-success);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-bold);
  line-height: 1;
  text-align: left;
  white-space: nowrap;
}

.thread-reply-summary-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.thread-reply-summary-action {
  display: inline-grid;
  flex: 1;
  grid-template-areas: "stack";
  min-width: 0;
  overflow: hidden;
}

.thread-reply-summary-action time,
.thread-reply-summary-status,
.thread-reply-summary-open {
  grid-area: stack;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-reply-summary-action time {
  color: #8f8f95;
}

.thread-reply-summary-status {
  color: #4f5560;
  font-weight: var(--type-weight-bold);
}

.thread-reply-summary-open {
  color: #686d76;
  font-weight: var(--type-weight-semibold);
  opacity: 0;
}

.thread-reply-summary:hover .thread-reply-summary-action time,
.thread-reply-summary:hover .thread-reply-summary-status,
.thread-reply-summary:focus-visible .thread-reply-summary-action time {
  opacity: 0;
}

.thread-reply-summary:focus-visible .thread-reply-summary-status {
  opacity: 0;
}

.thread-reply-summary:hover .thread-reply-summary-open,
.thread-reply-summary:focus-visible .thread-reply-summary-open {
  opacity: 1;
}

.thread-reply-summary.active-reply {
  color: #4f5560;
}

.thread-reply-summary.active-reply:hover,
.thread-reply-summary.active-reply:focus-visible {
  z-index: 7;
}

.thread-reply-summary.active-reply .thread-reply-summary-action {
  overflow: visible;
}

.thread-reply-summary.active-reply strong {
  color: var(--thread-new-ink);
}

.thread-reply-summary.active-reply .thread-reply-summary-status {
  color: var(--thread-new-ink);
}

.thread-reply-summary.unread-replies {
  border-color: var(--thread-new-border);
  background: var(--thread-new-bg);
  box-shadow: var(--thread-new-shadow);
  animation: thread-reply-unread-pulse 2.8s ease-in-out infinite;
}

.thread-reply-summary.unread-replies strong,
.thread-reply-summary.unread-replies .thread-reply-summary-open,
.thread-reply-summary.unread-replies .thread-reply-summary-icon {
  color: var(--thread-new-ink);
}

@media (prefers-reduced-motion: reduce) {
  .thread-reply-summary.unread-replies {
    animation: none;
  }
}

.thread-reply-summary.active-reply .thread-reply-summary-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
  color: var(--thread-new-ink);
}

.thread-reply-summary.active-reply:hover .thread-reply-summary-status,
.thread-reply-summary.active-reply:focus-visible .thread-reply-summary-status {
  opacity: 1;
}

.thread-reply-summary.active-reply:hover .thread-reply-summary-open,
.thread-reply-summary.active-reply:focus-visible .thread-reply-summary-open {
  opacity: 0;
}

.thread-reply-status-avatar-stack {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 18px;
}

.thread-reply-status-avatar-stack .agent-avatar {
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px var(--bg-panel);
}

.thread-reply-status-avatar-stack .agent-avatar + .agent-avatar {
  margin-left: -7px;
}

.thread-reply-status-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 24px;
  height: 18px;
  line-height: 1;
  vertical-align: middle;
}

.thread-reply-status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: thread-reply-dot-pulse 1.2s ease-in-out infinite;
  transform: translateZ(0);
  will-change: opacity, transform;
}

.thread-reply-status-dot:nth-child(2) {
  animation-delay: 140ms;
}

.thread-reply-status-dot:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes thread-reply-dot-pulse {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.84);
  }
  45% {
    opacity: 1;
    transform: scale(1);
  }
}

.thread-reply-active-menu {
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: 10px;
  display: none;
  gap: 6px;
  min-width: min(320px, calc(100vw - 40px));
  max-width: min(460px, calc(100vw - 40px));
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: var(--surface-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.thread-reply-summary.active-reply[data-active-menu-placement="below"] .thread-reply-active-menu {
  top: calc(100% + 6px);
  bottom: auto;
  transform: translateY(2px);
}

:root[data-theme="dark"] .thread-reply-active-menu {
  background: var(--bg-panel-strong);
}

.thread-reply-summary.active-reply:hover .thread-reply-active-menu,
.thread-reply-summary.active-reply:focus-visible .thread-reply-active-menu {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

.thread-reply-active-agent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg-control-flat);
  color: var(--ink);
  font-size: var(--type-size-caption);
}

.thread-reply-active-agent-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.thread-reply-active-agent-name {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-reply-active-agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.3;
}

.thread-reply-active-agent-status span,
.thread-reply-active-agent-status em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-reply-active-agent-status span {
  flex: 0 0 auto;
  color: var(--badge-phase-thinking-ink);
  font-weight: var(--type-weight-semibold);
}

.thread-reply-active-agent-status em {
  flex: 1 1 0;
  color: var(--muted);
  font-style: normal;
}

@media (hover: none) {
  .thread-reply-active-menu {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thread-reply-status-text {
    animation: none;
  }
}

.thread-reply-summary-icon {
  display: block;
  flex: 0 0 auto;
  color: #8e939b;
  opacity: 0;
  stroke-width: 2.6;
  transition: color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.thread-reply-summary:hover .thread-reply-summary-icon,
.thread-reply-summary:focus-visible .thread-reply-summary-icon {
  color: var(--accent);
  opacity: 1;
}

.message-hover-actions {
  position: absolute;
  top: -12px;
  right: 18px;
  z-index: 2;
  display: inline-flex;
  gap: 0;
  padding: 2px;
  border: 1px solid rgba(29, 28, 29, 0.13);
  border-radius: 8px;
  background: #fff;
  box-shadow:
    0 1px 1px rgba(29, 28, 29, 0.04),
    0 4px 12px rgba(29, 28, 29, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.message-card:hover .message-hover-actions,
.message-card:focus-within .message-hover-actions,
.thread-root:hover .message-hover-actions,
.thread-root:focus-within .message-hover-actions,
.reply-list article:hover .message-hover-actions,
.reply-list article:focus-within .message-hover-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message-hover-actions button {
  position: relative;
  display: grid;
  width: 30px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  color: #5e5d60;
}

.message-hover-actions button:hover {
  background: rgba(29, 28, 29, 0.06);
  color: #1d1c1d;
}

.message-hover-actions button:first-child:hover {
  color: var(--accent);
}

.message-hover-actions button.saved:last-child {
  background: #fff;
  color: #8a5b00;
}

.message-hover-actions button.saved:last-child:hover {
  background: rgba(29, 28, 29, 0.06);
}

.message-hover-actions button.saved svg {
  fill: currentColor;
}

.message-hover-actions button[data-tooltip]::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 3;
  max-width: 140px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(29, 28, 29, 0.94);
  color: #fff;
  content: attr(data-tooltip);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 2px);
  transition:
    opacity 90ms ease,
    transform 90ms ease;
  white-space: nowrap;
}

.message-hover-actions button[data-tooltip]::before {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  z-index: 3;
  width: 8px;
  height: 8px;
  background: rgba(29, 28, 29, 0.94);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 2px) rotate(45deg);
  transition:
    opacity 90ms ease,
    transform 90ms ease;
}

.message-hover-actions button[data-tooltip]:hover::after,
.message-hover-actions button[data-tooltip]:focus-visible::after,
.message-hover-actions button[data-tooltip]:hover::before,
.message-hover-actions button[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0) rotate(45deg);
}

.message-hover-actions button[data-tooltip]:hover::after,
.message-hover-actions button[data-tooltip]:focus-visible::after {
  transform: translate(-50%, 0);
}

.thread-reply-avatars {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-left: 2px;
}

.thread-reply-avatars > span {
  display: inline-flex;
  margin-left: -4px;
}

.thread-reply-avatars > span:first-child {
  margin-left: 0;
}

.thread-reply-avatars .agent-avatar,
.thread-reply-fallback-avatar {
  width: 22px;
  height: 22px;
  border: 2px solid #fbfbfc;
  box-shadow: 0 0 0 1px rgba(20, 23, 31, 0.08);
}

.thread-reply-summary .thread-reply-avatars {
  flex: 0 0 auto;
  padding-left: 0;
}

.thread-reply-summary .thread-reply-avatars > span {
  margin-left: -7px;
}

.thread-reply-summary .thread-reply-avatars > span:first-child {
  margin-left: 0;
}

.thread-reply-summary .thread-reply-avatars .agent-avatar,
.thread-reply-summary .thread-reply-fallback-avatar {
  width: 28px;
  height: 28px;
  border-color: #ffffff;
}

.thread-reply-fallback-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef0f4;
  color: #555a66;
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
}

.message-action-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  min-width: 238px;
  overflow: hidden;
  border: 1px solid rgba(20, 23, 31, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(18px) saturate(1.1);
}

.message-action-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(142, 142, 147, 0.16);
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-bold);
  text-align: left;
}

.message-action-menu button:last-child {
  border-bottom: 0;
}

.message-action-menu button:hover {
  background: rgba(10, 132, 255, 0.08);
  color: var(--accent);
}

.system-message {
  margin: 2px 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.system-message-line {
  display: inline-flex;
  max-width: min(760px, 100%);
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(142, 142, 147, 0.12);
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.08);
  color: #6b7280;
  font-size: var(--type-size-meta);
}

.system-message-line p {
  margin: 0;
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-message-line time {
  flex: 0 0 auto;
  color: #9ca3af;
  font-size: var(--type-size-caption);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 16px;
}

.meta strong {
  color: var(--ink-primary);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: 18px;
}

.meta span,
.meta time {
  color: var(--muted);
}

.meta .edited-indicator {
  font-size: var(--type-size-caption);
  font-style: italic;
}

.message-save-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.1);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.message-save-button svg {
  fill: transparent;
}

.message-save-button:hover,
.message-save-button.saved {
  background: rgba(255, 204, 0, 0.16);
  color: #8a5b00;
}

.message-save-button.saved svg {
  fill: currentColor;
}

.mobile-message-save-tag {
  display: none;
}

mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #dfff9a;
  color: #2e5200;
  font-weight: var(--type-weight-bold);
}

.message-body,
.thread-message-content,
.reply-body {
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: var(--type-size-message);
  line-height: 1.48;
}

.message-body p,
.thread-message-content p,
.reply-body p {
  margin: 8px 0 0;
  line-height: 1.48;
  white-space: pre-wrap;
}

.message-body p {
  margin-top: 3px;
}

.message-card.compact .message-body p,
.reply-list article.compact .reply-body p {
  margin-top: 0;
}

.message-long-preview {
  min-width: 0;
}

.message-long-preview.collapsed {
  position: relative;
  max-height: 360px;
  overflow: hidden;
}

.message-long-preview.collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 56px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96));
}

.message-card:hover .message-long-preview.collapsed::after,
.message-card.focused .message-long-preview.collapsed::after,
.message-card.tap-focused .message-long-preview.collapsed::after,
.message-card[data-jump-focused="true"] .message-long-preview.collapsed::after {
  background: linear-gradient(to bottom, rgba(248, 248, 248, 0), rgba(248, 248, 248, 0.98));
}

.message-expand-button {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  cursor: pointer;
}

.message-expand-button:hover {
  text-decoration: underline;
}

.message-expand-button:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.3);
  outline-offset: 2px;
}

.local-entity-link {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--accent);
  font-weight: var(--type-weight-semibold);
  text-decoration: none;
}

.local-entity-link:hover {
  background: rgba(10, 132, 255, 0.14);
}

.message-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 260px));
  gap: 8px;
  margin-top: 8px;
}

.message-attachment {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
}

.message-attachment:hover {
  border-color: rgba(10, 132, 255, 0.24);
  background: rgba(255, 255, 255, 0.92);
}

.message-attachment.image {
  display: block;
  grid-template-columns: none;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: #eef0f4;
  cursor: zoom-in;
}

.message-attachment.image img {
  display: block;
  width: 100%;
  height: 132px;
  border-radius: 0;
  object-fit: cover;
  background: #eef0f4;
}

.message-attachment.image:hover img {
  filter: saturate(1.04) contrast(1.02);
}

.message-attachment.pending {
  opacity: 0.78;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(10, 132, 255, 0.1);
  color: var(--accent);
}

.message-artifacts {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.message-artifact {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.message-artifact summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.message-artifact summary::-webkit-details-marker {
  display: none;
}

.message-artifact summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-artifact summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.artifact-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.message-artifact p {
  margin: 0;
  padding: 0 12px 10px 56px;
  color: var(--muted);
}

.artifact-markdown-content {
  padding: 0 12px 12px 56px;
}

.artifact-markdown-content .markdown-body {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--ink);
}

.artifact-render-error {
  margin: 0 12px 12px 56px;
  padding: 10px 12px;
  border: 1px solid rgba(185, 28, 28, 0.16);
  border-radius: 12px;
  background: rgba(254, 242, 242, 0.82);
  color: #991b1b;
  font-size: var(--type-size-body);
}

.artifact-actions {
  padding: 0 12px 10px 56px;
}

.artifact-actions button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.message-artifact pre {
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-code, #10141d);
  color: var(--ink-on-code, #eef3ff);
  font-size: var(--type-size-meta);
  line-height: 1.5;
  white-space: pre-wrap;
}

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

.attachment-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: calc(60px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.attachment-lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: rgba(12, 16, 24, 0.76);
}

.attachment-lightbox-content {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: min(92vw, 1120px);
  max-height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  place-items: center;
}

.attachment-lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  object-fit: contain;
}

.attachment-lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.message-stream-state {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  color: #5f6b7a;
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.message-stream-state::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 999px;
  background: #2f80ed;
  box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12);
}

.message-stream-state.error {
  color: #a34828;
}

.message-stream-state.error::before {
  background: #e1583f;
  box-shadow: 0 0 0 4px rgba(225, 88, 63, 0.12);
}

.message-stream-state.sending {
  color: #6a5a20;
}

.message-stream-state.sending::before {
  background: #d99a17;
  box-shadow: 0 0 0 4px rgba(217, 154, 23, 0.14);
}

.activity-progress-dock {
  --activity-progress-bg: var(--bg-panel);
  --activity-progress-border: var(--border-strong);
  --activity-progress-shadow: var(--surface-shadow);
  --activity-progress-ink: var(--ink-secondary);
  --activity-progress-title-ink: var(--ink-primary);
  --activity-progress-muted-ink: var(--ink-muted);
  --activity-progress-avatar-ring: var(--bg-panel);
  position: sticky;
  top: 10px;
  z-index: 5;
  width: min(520px, calc(100% - 32px));
  margin: 8px auto;
  color: var(--activity-progress-ink);
  font-size: var(--type-size-meta);
  container-type: inline-size;
  container-name: activity-progress-dock;
}

:root[data-theme="dark"] .activity-progress-dock {
  --activity-progress-bg: var(--bg-panel-strong);
  --activity-progress-avatar-ring: var(--bg-panel-strong);
}

.activity-progress-dock summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 9px 7px 7px;
  border: 1px solid var(--activity-progress-border);
  border-radius: var(--radius-md);
  background: var(--activity-progress-bg);
  box-shadow: var(--activity-progress-shadow);
  cursor: pointer;
  list-style: none;
}

.activity-progress-dock summary[data-state="provider-retrying"] {
  border-color: var(--status-warning-border);
  background: var(--activity-progress-bg);
  box-shadow: var(--activity-progress-shadow);
}

.activity-progress-dock summary[data-state="queued"] {
  border-style: dashed;
}

.activity-progress-dock summary::-webkit-details-marker {
  display: none;
}

.activity-progress-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--activity-progress-border);
  border-radius: var(--radius-md);
  background: var(--activity-progress-bg);
  box-shadow: var(--activity-progress-shadow);
}

.activity-progress-summary[data-state="provider-retrying"] {
  border-color: var(--status-warning-border);
}

.activity-progress-summary[data-state="queued"] {
  border-style: dashed;
}

.activity-progress-summary-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 7px 7px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.activity-progress-summary-main:disabled {
  cursor: default;
}

.activity-progress-summary-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.activity-progress-jump-arrow {
  font-size: 14px;
  font-weight: var(--type-weight-semibold);
  color: var(--source-kind-strong, var(--accent));
}

.activity-progress-kind-icon {
  color: var(--source-kind-strong, var(--accent));
}

.activity-progress-kind-label {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--source-kind-soft, var(--badge-phase-default-bg));
  color: var(--source-kind-strong, var(--ink-secondary));
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.activity-progress-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 5px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--activity-progress-muted-ink);
  cursor: pointer;
}

.activity-progress-toggle:hover,
.activity-progress-toggle:focus-visible {
  background: var(--surface-control-hover);
  color: var(--activity-progress-title-ink);
}

.activity-progress-chevron[data-open="true"] {
  transform: rotate(180deg);
}

.message-progress-layer,
.thread-progress-layer {
  position: relative;
  z-index: 8;
  display: flex;
  justify-content: center;
  min-height: 0;
  padding: 8px 0 0;
  pointer-events: none;
}

.message-progress-layer .activity-progress-dock,
.thread-progress-layer .activity-progress-dock {
  position: relative;
  top: auto;
  margin: 0 auto;
  pointer-events: auto;
}

.activity-progress-avatar-stack {
  display: flex;
  align-items: center;
  min-width: 30px;
}

.activity-progress-avatar-stack .agent-avatar {
  flex: 0 0 auto;
  box-shadow:
    0 0 0 2px var(--activity-progress-avatar-ring),
    0 8px 18px rgba(20, 22, 28, 0.16);
}

.activity-progress-avatar-stack .agent-avatar + .agent-avatar {
  margin-left: -8px;
}

.activity-progress-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.activity-progress-copy strong {
  overflow: hidden;
  color: var(--activity-progress-title-ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-progress-copy small {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 18px;
  color: var(--activity-progress-muted-ink);
  font-size: var(--type-size-caption);
  font-style: normal;
  line-height: 18px;
}

.activity-progress-copy small svg {
  flex: 0 0 auto;
  color: var(--accent);
  animation: progress-spin 1.2s linear infinite;
}

.activity-progress-copy small span,
.activity-progress-copy small em {
  overflow: hidden;
  min-width: 0;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-progress-copy small span {
  flex: 0 1 auto;
  max-width: 24ch;
  color: var(--activity-progress-title-ink);
  font-style: normal;
  font-weight: var(--type-weight-semibold);
}

.activity-progress-copy small em {
  flex: 1 1 0;
  min-width: 0;
  color: var(--activity-progress-muted-ink);
  font-style: normal;
}

@container activity-progress-dock (max-width: 360px) {
  .activity-progress-copy small em {
    display: none;
  }
  .activity-progress-copy small span {
    max-width: none;
    flex: 1 1 0;
  }
}

.activity-progress-chevron {
  color: var(--activity-progress-muted-ink);
  transition: transform 120ms ease;
}

.activity-progress-dock[open] .activity-progress-chevron {
  transform: rotate(180deg);
}

.activity-progress-history {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  align-content: start;
  gap: 0;
  max-height: min(360px, calc(100vh - 160px));
  margin: 0;
  padding: 8px;
  border: 1px solid var(--activity-progress-border);
  border-radius: var(--radius-md);
  background: var(--activity-progress-bg);
  box-shadow: var(--activity-progress-shadow);
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-snap-type: y proximity;
  scroll-padding-top: 8px;
}

.activity-progress-history .activity-run-step {
  grid-template-columns: clamp(50px, 14%, 66px) 12px minmax(0, 1fr);
  gap: 6px;
  padding: 4px 0;
  scroll-snap-align: start;
}

.activity-progress-history .activity-run-step time {
  padding-top: 2px;
  font-size: var(--type-size-caption);
  line-height: 15px;
}

.activity-progress-history .activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
}

.activity-progress-history .activity-dot::after {
  top: 8px;
  height: calc(100% + 46px);
}

.activity-progress-history .activity-run-step:last-child .activity-dot::after {
  display: none;
}

.activity-progress-history .activity-timeline-body {
  gap: 2px;
}

.activity-progress-history .activity-timeline-title {
  gap: 5px;
}

.activity-progress-history .activity-timeline-title strong {
  font-size: var(--type-size-meta);
  line-height: 16px;
}

.activity-progress-history .activity-status {
  padding: 1px 6px;
  font-size: var(--type-size-caption);
  line-height: 14px;
}

.activity-progress-history .activity-structure-line {
  gap: 4px;
  line-height: 16px;
}

.activity-progress-history .activity-structure-line span {
  max-width: 110px;
  padding: 1px 6px;
  line-height: 14px;
}

.activity-progress-history .activity-timeline-body p {
  line-height: 1.25;
}

@keyframes progress-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes thread-reply-unread-pulse {
  0%,
  100% {
    box-shadow: var(--thread-new-shadow);
  }

  50% {
    box-shadow: var(--thread-new-pulse-shadow);
  }
}

.markdown-body {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  font-size: inherit;
  line-height: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-body > * {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.markdown-body img,
.markdown-body video,
.markdown-body svg {
  max-width: 100%;
  height: auto;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body a {
  color: var(--accent);
  font-weight: var(--type-weight-semibold);
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(20, 23, 31, 0.08);
  font-family: var(--font-mono);
  font-size: var(--type-size-code);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.code-block-shell {
  position: relative;
  min-width: 0;
}

.code-block-shell button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #f7f7f8;
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.code-block-shell:hover button,
.code-block-shell button:focus-visible {
  opacity: 1;
}

.code-block-shell button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.markdown-body pre {
  overflow: auto;
  margin: 4px 0;
  padding: 10px 56px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101318;
  color: #f7f7f8;
  min-width: 0;
  max-width: 100%;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  overflow-wrap: normal;
  word-break: normal;
}

.markdown-body blockquote {
  padding-left: 10px;
  border-left: 3px solid rgba(10, 132, 255, 0.28);
  color: var(--muted);
}

.markdown-body table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 6px 8px;
  border: 1px solid var(--line);
}

:root[data-theme="dark"] .workspace-switch,
:root[data-theme="dark"] .search-trigger,
:root[data-theme="dark"] .sidebar-nav-trigger,
:root[data-theme="dark"] .section-title button,
:root[data-theme="dark"] .profile-settings,
:root[data-theme="dark"] .conversation,
:root[data-theme="dark"] .thread,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .modal-head,
:root[data-theme="dark"] .detail-grid > div,
:root[data-theme="dark"] .workspace-section,
:root[data-theme="dark"] .workspace-path-card,
:root[data-theme="dark"] .workspace-memory-card,
:root[data-theme="dark"] .workspace-tree,
:root[data-theme="dark"] .workspace-preview,
:root[data-theme="dark"] .performance-card,
:root[data-theme="dark"] .agent-reminders-section,
:root[data-theme="dark"] .agent-reminder-row,
:root[data-theme="dark"] .activity-run-card,
:root[data-theme="dark"] .task-board-summary > div,
:root[data-theme="dark"] .theme-choice-grid button,
:root[data-theme="dark"] .chat-text-size-grid button {
  border-color: var(--border-subtle);
  background: var(--bg-panel);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .theme-choice-grid button.selected {
  border-color: var(--accent);
  background: var(--bg-selected-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}

:root[data-theme="dark"] .theme-choice-grid button.selected strong,
:root[data-theme="dark"] .theme-choice-grid button.selected small {
  color: var(--accent);
}

:root[data-theme="dark"] .sidebar {
  background: var(--bg-sidebar);
}

:root[data-theme="dark"] .message-card:hover,
:root[data-theme="dark"] .message-card.focused,
:root[data-theme="dark"] .message-card.tap-focused,
:root[data-theme="dark"] .reply-list article:hover,
:root[data-theme="dark"] .reply-list article.tap-focused,
:root[data-theme="dark"] .activity-run-step:hover,
:root[data-theme="dark"] .activity-run-step.expanded,
:root[data-theme="dark"] .activity-timeline-row:hover,
:root[data-theme="dark"] .activity-timeline-row.expanded {
  background: var(--bg-hover);
}

:root[data-theme="dark"] .message-long-preview.collapsed::after {
  background: linear-gradient(to bottom, rgba(23, 27, 34, 0), var(--bg-panel));
}

:root[data-theme="dark"] .message-card:hover .message-long-preview.collapsed::after,
:root[data-theme="dark"] .message-card.focused .message-long-preview.collapsed::after,
:root[data-theme="dark"] .message-card.tap-focused .message-long-preview.collapsed::after,
:root[data-theme="dark"] .message-card[data-jump-focused="true"] .message-long-preview.collapsed::after {
  background: linear-gradient(to bottom, rgba(30, 36, 46, 0), #1f2631);
}

:root[data-theme="dark"] .message-body,
:root[data-theme="dark"] .thread-message-content,
:root[data-theme="dark"] .reply-body,
:root[data-theme="dark"] .activity-timeline-title strong,
:root[data-theme="dark"] .activity-run-head h5,
:root[data-theme="dark"] .settings-section-head h4,
:root[data-theme="dark"] .theme-choice-grid strong,
:root[data-theme="dark"] .chat-text-size-grid strong {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .markdown-body code {
  background: rgba(226, 232, 240, 0.12);
}

:root[data-theme="dark"] .markdown-body pre,
:root[data-theme="dark"] .workspace-preview-raw {
  border-color: var(--border-subtle);
  background: var(--bg-code);
  color: #eef2f7;
}

:root[data-theme="dark"] .message-artifact {
  border-color: var(--border-strong);
  background: var(--bg-panel-strong);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .message-artifact summary strong {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .message-artifact summary small,
:root[data-theme="dark"] .message-artifact p {
  color: var(--ink-muted);
}

:root[data-theme="dark"] .artifact-icon {
  background: rgba(52, 199, 89, 0.14);
  color: #67d084;
}

:root[data-theme="dark"] .artifact-markdown-content .markdown-body {
  border-color: var(--border-subtle);
  background: var(--bg-panel);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .artifact-actions button {
  border-color: var(--border-subtle);
  background: var(--bg-control-flat);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .artifact-actions button:hover {
  background: var(--bg-control-hover);
}

:root[data-theme="dark"] .artifact-render-error {
  border-color: rgba(255, 69, 58, 0.22);
  background: rgba(255, 69, 58, 0.12);
  color: #ffb4ab;
}

:root[data-theme="dark"] .message-artifact pre {
  border-color: var(--border-subtle);
  background: var(--bg-code);
  color: #eef2f7;
}

:root[data-theme="dark"] .message-hover-actions,
:root[data-theme="dark"] .message-hover-actions button,
:root[data-theme="dark"] .message-hover-actions button.saved:last-child,
:root[data-theme="dark"] .message-action-menu,
:root[data-theme="dark"] .message-action-menu button,
:root[data-theme="dark"] .channel-actions-menu,
:root[data-theme="dark"] .channel-actions-menu button,
:root[data-theme="dark"] .search-panel,
:root[data-theme="dark"] .search-input-icon,
:root[data-theme="dark"] .search-clear,
:root[data-theme="dark"] .search-filter-group button,
:root[data-theme="dark"] .search-time-filter,
:root[data-theme="dark"] .search-backdrop {
  background: var(--surface-menu-overlay);
}

:root[data-theme="dark"] .search-filters {
  border-color: var(--border-subtle);
  background: var(--bg-panel);
}

:root[data-theme="dark"] .search-panel-head input {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .search-filter-group button.active {
  border-color: rgba(105, 170, 252, 0.28);
  background: rgba(105, 170, 252, 0.14);
  color: var(--accent);
}

:root[data-theme="dark"] .message-hover-actions button:hover,
:root[data-theme="dark"] .message-hover-actions button.saved:last-child:hover,
:root[data-theme="dark"] .search-clear:hover {
  background: var(--bg-control-hover);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .task-execution-head strong,
:root[data-theme="dark"] .task-execution-row strong,
:root[data-theme="dark"] .search-result-title,
:root[data-theme="dark"] .search-result-body {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .channel.has-unread,
:root[data-theme="dark"] .dm.has-unread,
:root[data-theme="dark"] .dm-row.has-unread .dm {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .task-board {
  background: var(--bg-app);
}

:root[data-theme="dark"] .task-card,
:root[data-theme="dark"] .thread-task-card,
:root[data-theme="dark"] .thread-browser-panel,
:root[data-theme="dark"] .thread-browser-row,
:root[data-theme="dark"] .reminder-create,
:root[data-theme="dark"] .reminder-summary div,
:root[data-theme="dark"] .reminder-row {
  border-color: var(--border-subtle);
  background: var(--bg-panel);
  color: var(--ink-primary);
  box-shadow: none;
}

:root[data-theme="dark"] .task-card input,
:root[data-theme="dark"] .thread-task-card input,
:root[data-theme="dark"] .thread-task-card select,
:root[data-theme="dark"] .reminder-create input,
:root[data-theme="dark"] .reminder-create textarea,
:root[data-theme="dark"] .reminder-create select {
  border-color: var(--border-subtle);
  background: var(--bg-input);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .task-queue-section.unassigned,
:root[data-theme="dark"] .task-card.unassigned {
  border-color: var(--task-unassigned-border);
  background: var(--status-warning-soft);
}

:root[data-theme="dark"] .reminder-row.fired {
  border-color: var(--status-warning-border);
  background: var(--status-warning-soft);
}

:root[data-theme="dark"] .task-assignee-trigger:hover,
:root[data-theme="dark"] .task-assignee-trigger[aria-expanded="true"],
:root[data-theme="dark"] .task-assignee-option:hover,
:root[data-theme="dark"] .task-assignee-option[aria-selected="true"],
:root[data-theme="dark"] .thread-browser-row:hover,
:root[data-theme="dark"] .thread-browser-row.selected,
:root[data-theme="dark"] .channel-agent-picker .channel-agent-option.selected {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  color: var(--ink-primary);
  box-shadow: none;
}

:root[data-theme="dark"] .task-assignee-option[aria-selected="true"] {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .task-unassigned-avatar {
  border-color: var(--border-strong);
  background: var(--task-empty-avatar-bg);
}

:root[data-theme="dark"] .thread-browser-content p,
:root[data-theme="dark"] .search-result-list strong,
:root[data-theme="dark"] .search-result-list p {
  color: var(--ink-primary);
}

:root[data-theme="dark"] .search-result-fallback-avatar,
:root[data-theme="dark"] .reminder-row-icon {
  background: var(--badge-phase-default-bg);
  color: var(--ink-secondary);
}

:root[data-theme="dark"] .thread-browser-follow {
  background: var(--status-success-soft);
  color: var(--status-success);
}

:root[data-theme="dark"] .thread-browser-follow:hover {
  background: var(--status-danger-soft);
  color: var(--status-danger);
}

:root[data-theme="dark"] .search-result-list button:hover {
  background: var(--bg-hover);
}

:root[data-theme="dark"] .search-time-chevron {
  color: var(--ink-muted);
}

:root[data-theme="dark"] .reminder-quick-grid button,
:root[data-theme="dark"] .reminder-thread-toggle {
  border-color: var(--border-subtle);
  background: var(--bg-panel-strong);
  color: var(--ink-primary);
}

:root[data-theme="dark"] .mention-picker,
:root[data-theme="dark"] .thread-back-to-bottom,
:root[data-theme="dark"] .agent-form-preview,
:root[data-theme="dark"] .owner-profile-preview {
  border-color: var(--border-subtle);
  background: var(--bg-panel-strong);
  color: var(--ink-primary);
  box-shadow: none;
}

:root[data-theme="dark"] .modal-form .agent-select-control select {
  border-color: var(--border-subtle);
  background: var(--bg-control);
  color: var(--ink-primary);
  box-shadow: none;
}

:root[data-theme="dark"] .modal-form .agent-select-control select:hover,
:root[data-theme="dark"] .modal-form .agent-select-control select:focus,
:root[data-theme="dark"] .mention-picker button.active,
:root[data-theme="dark"] .mention-picker button:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  color: var(--ink-primary);
  box-shadow: none;
}

:root[data-theme="dark"] .agent-select-control svg,
:root[data-theme="dark"] .mention-picker-copy em {
  color: var(--ink-muted);
}

.thread-reply-count {
  display: flex;
  width: fit-content;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.task-board {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  background: var(--task-board-bg);
}

.task-board-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-board-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--task-card-bg);
}

.task-board-summary strong {
  color: var(--ink);
  font-size: var(--type-size-display);
  line-height: 1;
}

.task-board-summary span {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-sections {
  display: grid;
  gap: 12px;
}

.task-queue-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.task-queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 4px 2px;
}

.task-queue-heading > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.task-queue-heading span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.task-queue-heading strong {
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-bold);
}

.task-queue-heading mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--task-count-bg);
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.task-queue-section.unassigned {
  padding: 12px;
  border: 1px solid var(--task-unassigned-border);
  border-radius: var(--radius-md);
  background: var(--task-unassigned-bg);
}

.task-queue-section.unassigned .task-queue-heading mark {
  background: var(--task-unassigned-strong-bg);
  color: var(--task-unassigned-strong-ink);
}

.task-card input,
.thread-task-card input,
.thread-task-card select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--task-input-bg);
  color: var(--ink);
  outline: none;
}

.task-card input {
  padding: 2px 0;
  border-color: transparent;
  background: transparent;
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-bold);
  line-height: 22px;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--task-card-bg);
}

.task-card.unassigned {
  border-color: var(--task-unassigned-border);
}

.task-card-main {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  min-width: 0;
  touch-action: manipulation;
}

.task-card-head > span {
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
  cursor: pointer;
}

.task-card-head strong {
  display: inline-flex;
  max-width: 150px;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--task-label-bg);
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  line-height: 1.1;
  text-transform: uppercase;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.task-controls {
  display: grid;
  gap: 8px;
  width: min(332px, 34vw);
  margin: 0;
}

.task-assignee-picker {
  position: relative;
  justify-self: start;
  width: 100%;
  min-width: 0;
}

.task-assignee-trigger {
  display: grid;
  grid-template-columns: 28px minmax(0, auto) 14px;
  align-items: center;
  gap: 8px;
  min-width: 152px;
  max-width: min(236px, 100%);
  min-height: 38px;
  padding: 4px 9px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  color: inherit;
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.task-assignee-trigger:hover,
.task-assignee-trigger[aria-expanded="true"] {
  border-color: var(--control-border);
  background: var(--bg-control-selected);
  box-shadow: var(--state-selected-shadow);
}

.task-assignee-trigger:focus-visible {
  border-color: var(--accent-soft-hover-border);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.task-assignee-trigger:disabled {
  cursor: default;
  opacity: 0.74;
}

.task-assignee-trigger .agent-avatar,
.task-assignee-trigger .task-unassigned-avatar {
  width: 28px;
  height: 28px;
}

.task-assignee-chevron {
  color: var(--muted);
}

.task-assignee-copy {
  display: grid;
  min-width: 0;
  gap: 0;
}

.task-assignee-copy strong,
.task-assignee-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-assignee-copy strong {
  color: var(--ink);
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  line-height: 1.15;
}

.task-assignee-copy span {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-medium);
  line-height: 1.2;
}

.task-unassigned-avatar {
  width: 32px;
  height: 32px;
  border: 1px dashed var(--task-empty-avatar-border);
  border-radius: 50%;
  background: var(--task-empty-avatar-bg);
}

.task-assignee-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 4px;
  width: min(288px, 74vw);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--task-floating-bg);
  box-shadow: var(--surface-shadow);
}

.task-assignee-option {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  text-align: left;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.task-assignee-option:hover,
.task-assignee-option[aria-selected="true"] {
  border-color: var(--control-border);
  background: var(--bg-control-selected);
  box-shadow: var(--state-selected-shadow);
}

.task-assignee-option[aria-selected="true"] {
  color: var(--ink-control);
}

.task-assignee-check {
  display: grid;
  width: 18px;
  place-items: center;
  color: var(--accent);
}

.task-assignee-option-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

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

.task-assignee-option-copy strong {
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  line-height: 1.18;
}

.task-assignee-option-copy span {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-medium);
  line-height: 1.22;
}

.task-assignee-option-copy span b {
  padding: 0 6px;
  color: var(--task-muted-separator);
  font-weight: var(--type-weight-bold);
}

.task-open-thread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-selected-soft);
  color: var(--accent);
}

.status-row {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  justify-content: space-between;
  gap: 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(20, 23, 31, 0.04);
}

.status-row button {
  min-width: max-content;
  padding: 7px 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-row button.active {
  background: var(--accent);
  box-shadow: 0 5px 12px rgba(10, 132, 255, 0.22);
  color: #fff;
}

.composer {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--bg-composer);
  box-shadow: var(--surface-composer-edge);
}

.composer,
.reply-composer {
  padding: 12px 16px 14px;
}

.composer.drag-over,
.reply-composer.drag-over {
  background: rgba(10, 132, 255, 0.08);
  box-shadow: inset 0 0 0 2px rgba(10, 132, 255, 0.22);
}

.composer textarea,
.reply-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 74px;
  overflow-y: hidden;
  overflow-wrap: anywhere;
  resize: none;
  padding: 14px 15px;
  border: 1px solid var(--control-border);
  border-radius: 18px;
  background: var(--bg-input);
  color: var(--ink-primary);
  caret-color: var(--accent);
  outline: none;
}

.composer textarea::placeholder,
.reply-composer textarea::placeholder {
  color: var(--ink-placeholder);
  opacity: 1;
}

.composer textarea {
  max-height: min(40vh, 360px);
}

.reply-composer textarea {
  max-height: min(35vh, 280px);
}

.composer.drag-over textarea,
.reply-composer.drag-over textarea {
  border-color: rgba(10, 132, 255, 0.5);
  background: var(--bg-input);
}

.composer textarea:focus,
.reply-composer textarea:focus {
  border-color: rgba(10, 132, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.08);
}

.composer textarea:disabled,
.composer button:disabled,
.reply-composer textarea:disabled,
.reply-composer .attach-button:disabled,
.reply-composer .reply-send:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.composer-actions,
.reply-composer-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.composer-actions label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.file-input-hidden {
  display: none;
}

.draft-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
}

.draft-attachment {
  position: relative;
  flex: 0 0 auto;
}

.draft-attachment.image {
  width: 148px;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border: 1px solid rgba(20, 23, 31, 0.12);
  border-radius: 10px;
  background: var(--bg-control-flat);
}

.draft-attachment-trigger {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.draft-attachment.image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draft-attachment.file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 5px 7px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control-flat);
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.draft-attachment.file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-attachment-remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.16);
  color: var(--muted);
  line-height: 0;
}

.draft-attachment-remove svg {
  display: block;
}

.draft-attachment.image .draft-attachment-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(17, 24, 39, 0.86);
  color: #fff;
}

.attach-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--control-border);
  border-radius: 13px;
  background: var(--bg-control);
  color: var(--muted);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(20, 23, 31, 0.04);
}

.attach-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-control-hover);
  color: var(--ink-control);
  transform: translateY(-1px);
}

.task-toggle {
  display: inline-flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--bg-control);
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  box-shadow: var(--task-toggle-shadow);
}

.task-toggle:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-control-hover);
  color: var(--ink-control);
  transform: translateY(-1px);
}

.task-toggle.active {
  border-color: var(--task-toggle-active-border);
  background: var(--task-toggle-active-bg);
  color: var(--task-toggle-active-ink);
  box-shadow: var(--task-toggle-active-shadow);
}

.task-toggle.active:hover:not(:disabled) {
  border-color: var(--task-toggle-active-hover-border);
  background: var(--task-toggle-active-hover-bg);
  color: var(--task-toggle-active-hover-ink);
}

.send {
  display: inline-flex;
  align-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgba(20, 23, 31, 0.2);
  border-radius: 13px;
  background: #20242b;
  color: #fff;
  font-weight: var(--type-weight-bold);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 14px rgba(20, 23, 31, 0.16);
}

.send:hover:not(:disabled),
.reply-composer .reply-send:hover:not(:disabled) {
  background: #111318;
  transform: translateY(-1px);
}

@container conversation (max-width: 360px) {
  .topbar {
    gap: 8px;
    min-height: 64px;
    padding: 11px 10px;
  }

  .desktop-history-controls {
    gap: 2px;
  }

  .desktop-history-button {
    width: 28px;
    height: 32px;
    border-radius: 9px;
  }

  .channel-title {
    gap: 8px;
  }

  .channel-title .hash-card {
    display: none;
  }

  .channel-title h1 {
    font-size: var(--type-size-title);
    line-height: 21px;
  }

  .channel-title p {
    display: none;
  }

  .channel-header-actions {
    gap: 4px;
  }

  .channel-agent-preview {
    display: none;
  }

  .channel-agent-count-trigger,
  .channel-action-trigger {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 11px;
  }

  .channel-agent-count-trigger {
    gap: 0;
    font-size: var(--type-size-meta);
  }

  .channel-agent-count-trigger.empty {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .channel-agent-count-trigger.empty > span {
    display: none;
  }

  .tabs button {
    justify-content: center;
    min-width: 0;
    padding: 11px 10px;
    font-size: var(--type-size-caption);
  }

  .message-list {
    padding-top: 6px;
  }

  .message-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .message-card .message-agent-avatar-trigger {
    width: 34px;
  }

  .activity-progress-dock {
    width: calc(100% - 16px);
  }

  .composer {
    padding: 10px;
  }

  .composer-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .send {
    margin-left: 0;
  }
}

@container conversation (max-width: 420px) {
  .message-card .message-hover-actions {
    position: static;
    width: max-content;
    margin: 6px 0 2px;
    border-color: rgba(20, 23, 31, 0.1);
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .message-hover-actions button[data-tooltip]::before,
  .message-hover-actions button[data-tooltip]::after {
    display: none;
  }
}

.thread {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background: var(--bg-panel);
  backdrop-filter: none;
  container: thread / inline-size;
}

.thread-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  width: 8px;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
}

.thread-resize-handle::after {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 2px;
  height: 48px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0);
  content: "";
  transform: translateY(-50%);
  transition: background-color 140ms ease;
}

.thread-resize-handle:hover::after,
.thread-resize-handle:focus-visible::after {
  background: rgba(10, 132, 255, 0.48);
}

body.resizing-column,
body.resizing-column * {
  cursor: col-resize !important;
  user-select: none;
}

body.resizing-row,
body.resizing-row * {
  cursor: row-resize !important;
  user-select: none;
}

.thread header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  overflow: visible;
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
}

.thread h2 {
  margin: 0;
  overflow: hidden;
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread h2 span {
  color: var(--muted);
  font-weight: var(--type-weight-medium);
}

.thread-root {
  grid-row: 1;
  position: relative;
  margin: 0;
  padding: 7px 22px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
}

.thread-root:hover {
  transform: none;
  border-color: transparent;
  background: var(--bg-hover);
}

.thread-root.system-message {
  margin: 0;
  padding: 4px 16px;
  border: 0;
  background: transparent;
}

.thread-root.system-message:hover {
  background: transparent;
}

.thread-message-with-avatar {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
}

.thread-message-content {
  min-width: 0;
}

.thread-task-card {
  grid-row: 2;
  display: grid;
  gap: 10px;
  margin: 0 22px 8px;
  padding: 14px;
  border: 1px solid var(--task-thread-border);
  border-radius: 19px;
  background: var(--task-thread-bg);
}

.thread-task-card .task-card-head strong {
  color: var(--accent);
  font-size: var(--type-size-meta);
  text-transform: uppercase;
}

.task-review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-review-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--task-thread-border);
  border-radius: 8px;
  background: var(--bg-control-flat);
  color: var(--ink-control);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.task-review-actions button:first-child {
  border-color: var(--status-success-border);
  color: var(--task-review-success-ink);
}

.task-review-actions button:hover {
  background: var(--bg-control-hover);
  transform: translateY(-1px);
}

.task-execution-panel {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding-top: 4px;
  border-top: 1px solid var(--task-execution-border);
}

.task-execution-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.task-execution-head strong {
  color: var(--task-execution-ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.task-execution-head span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.task-execution-timeline {
  display: grid;
  gap: 0;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.task-execution-row {
  display: grid;
  grid-template-columns: 54px 14px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 6px 0;
}

.task-execution-row time {
  padding-top: 2px;
  color: var(--task-execution-time);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  text-align: right;
  white-space: nowrap;
}

.task-execution-row .activity-dot {
  margin-top: 4px;
}

.task-execution-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-execution-row strong,
.task-execution-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-execution-row strong {
  color: var(--task-execution-ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.task-execution-row small {
  color: var(--task-execution-muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.task-execution-row p,
.task-execution-empty {
  margin: 0;
  color: var(--task-execution-muted);
  font-size: var(--type-size-caption);
  line-height: 1.35;
}

.task-execution-row p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thread-replies-divider {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 8px 22px 2px;
  color: var(--muted);
}

.thread-replies-divider > span {
  height: 1px;
  background: rgba(20, 23, 31, 0.1);
}

.thread-replies-divider div {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.thread-replies-divider strong {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.thread-replies-divider small {
  color: rgba(102, 112, 133, 0.82);
  font-size: var(--type-size-caption);
}

.reply-list {
  grid-row: 3;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 6px 0 12px;
}

.reply-list article {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 22px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
}

.reply-list article > .reply-body {
  min-width: 0;
}

.reply-list article:hover {
  transform: none;
  border-color: transparent;
  background: var(--bg-hover);
}

.reply-list article.system-message {
  display: block;
  padding: 4px 16px;
}

.reply-list article.system-message:hover {
  background: transparent;
}

.reply-composer {
  z-index: 1;
  grid-row: 2;
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--bg-composer);
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.035);
}

.composer .draft-attachments,
.reply-composer .draft-attachments {
  margin-top: 0;
}

.reply-composer .reply-send {
  display: inline-flex;
  align-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgba(20, 23, 31, 0.2);
  border-radius: 13px;
  background: #20242b;
  color: #fff;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 14px rgba(20, 23, 31, 0.16);
}

.mention-picker {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(10, 132, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.mention-picker button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.mention-picker button.active,
.mention-picker button:hover {
  background: rgba(10, 132, 255, 0.1);
}

.mention-picker .agent-avatar {
  align-self: start;
  margin-top: 1px;
}

.mention-picker-channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(10, 132, 255, 0.1);
  color: #0a84ff;
}

.mention-picker-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.mention-picker-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-picker-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-picker-copy em {
  display: block;
  overflow: hidden;
  color: #667085;
  font-size: var(--type-size-caption);
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer textarea,
.reply-composer textarea {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.agent-drawer {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: var(--surface-panel-edge);
  backdrop-filter: none;
}

.agent-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
  box-shadow: var(--surface-horizontal-edge);
}

.agent-title-card {
  overflow: hidden;
}

.agent-title-card .agent-avatar {
  width: 28px;
  height: 28px;
}

.agent-drawer-head h2 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.agent-drawer-head button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  color: var(--ink);
}

.agent-drawer-head button:hover {
  border-color: rgba(10, 132, 255, 0.28);
  background: rgba(10, 132, 255, 0.1);
}

.agent-drawer-head button.danger:hover {
  border-color: rgba(255, 59, 48, 0.2);
  background: rgba(255, 59, 48, 0.1);
  color: #d70015;
}

.agent-drawer-head button:disabled,
.agent-head-action:disabled {
  cursor: not-allowed;
  color: var(--ink-on-surface-muted);
}

.agent-drawer-head .agent-head-action[data-tooltip] {
  position: relative;
}

.agent-drawer-head button:disabled:hover,
.agent-drawer-head button.danger:disabled:hover {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--ink-on-surface-muted);
}

.agent-drawer-head button:disabled svg {
  opacity: 0.45;
}

.agent-drawer-head .agent-head-action[data-tooltip]::after {
  position: absolute;
  top: calc(100% + 8px);
  right: 50%;
  z-index: 4;
  max-width: 140px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-tooltip);
  color: var(--ink-on-tooltip);
  content: attr(data-tooltip);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, -2px);
  transition:
    opacity 90ms ease,
    transform 90ms ease;
  white-space: nowrap;
}

.agent-drawer-head .agent-head-action[data-tooltip]::before {
  position: absolute;
  top: calc(100% + 3px);
  right: 50%;
  z-index: 4;
  width: 8px;
  height: 8px;
  background: var(--surface-tooltip);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, -2px) rotate(45deg);
  transition:
    opacity 90ms ease,
    transform 90ms ease;
}

.agent-drawer-head .agent-head-action[data-tooltip]:hover::after,
.agent-drawer-head .agent-head-action[data-tooltip]:focus-visible::after,
.agent-drawer-head .agent-head-action[data-tooltip]:hover::before,
.agent-drawer-head .agent-head-action[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translate(50%, 0) rotate(45deg);
}

.agent-drawer-head .agent-head-action[data-tooltip]:hover::after,
.agent-drawer-head .agent-head-action[data-tooltip]:focus-visible::after {
  transform: translate(50%, 0);
}

.agent-drawer-head .agent-mobile-back {
  display: none;
}

.agent-drawer-body {
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 14px;
}

.thread-focus {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.thread-scroll-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.thread-progress-layer {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
}

.thread-scroll {
  grid-area: 1 / 1;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.thread-scroll .reply-list {
  overflow: visible;
}

.thread-bottom-anchor {
  height: 1px;
}

.thread-back-to-bottom {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.thread-back-to-bottom:hover {
  background: #fff;
  transform: translateX(-50%) translateY(-1px);
}

@container thread (max-width: 420px) {
  .thread header {
    gap: 8px;
    min-height: 64px;
    padding: 11px 10px;
  }

  .thread header button {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .thread-title {
    gap: 8px;
  }

  .thread-title-card {
    display: none;
  }

  .thread h2 {
    font-size: 17px;
    line-height: 21px;
  }

  .thread h2 span {
    display: none;
  }

  .thread-root,
  .reply-list article {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .thread-message-with-avatar {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .thread-task-card {
    margin-right: 10px;
    margin-left: 10px;
    padding: 10px;
  }

  .thread .message-hover-actions {
    position: static;
    width: max-content;
    margin: 6px 0 2px;
    border-color: rgba(20, 23, 31, 0.1);
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .thread .message-hover-actions button[data-tooltip]::before,
  .thread .message-hover-actions button[data-tooltip]::after {
    display: none;
  }

  .thread .status-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
  }

  .thread .status-row button {
    min-width: 0;
    padding-inline: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .thread .task-review-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .reply-composer {
    padding: 10px;
  }

  .reply-composer-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .reply-composer .reply-send {
    margin-left: auto;
  }
}

.app.thread-hidden {
  grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, 1fr);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(17, 24, 39, 0.22);
  backdrop-filter: blur(18px) saturate(1.15);
}

.modal-card {
  max-width: calc(100vw - 64px);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: rgba(250, 251, 253, 0.98);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.modal-head h3 {
  margin: 0;
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
}

.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.12);
  color: var(--muted);
}

.modal-body {
  max-height: calc(100vh - 142px);
  overflow: auto;
  padding: 18px;
}

.settings-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.settings-section-head {
  display: grid;
  gap: 4px;
}

.settings-section-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-bold);
}

.settings-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 1.4;
}

.settings-fieldset {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-fieldset legend {
  padding: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
}

.theme-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chat-text-size-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.theme-choice-grid button {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  color: var(--muted);
  text-align: left;
}

.chat-text-size-grid button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  gap: 4px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  color: var(--muted);
  text-align: center;
}

.theme-choice-grid button.selected {
  border-color: var(--accent);
  background: var(--bg-selected-accent);
  box-shadow: var(--shadow-selected-accent);
  color: var(--accent);
}

.chat-text-size-grid button.selected {
  border-color: var(--accent);
  background: var(--bg-selected-accent);
  box-shadow: var(--shadow-selected-accent);
  color: var(--accent);
}

:root[data-theme="dark"] .theme-choice-grid button.selected {
  border-color: rgba(105, 170, 252, 0.72);
  color: var(--accent);
}

.theme-choice-grid button.selected::after {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  content: "✓";
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-bold);
  line-height: 1;
}

.theme-choice-grid button.selected strong,
.theme-choice-grid button.selected small,
.chat-text-size-grid button.selected strong,
.chat-text-size-grid button.selected small {
  color: var(--accent);
}

.theme-choice-grid span,
.chat-text-size-grid span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.theme-choice-grid strong,
.chat-text-size-grid strong {
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.theme-choice-grid small,
.chat-text-size-grid small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.4;
}

.modal-form {
  display: grid;
  gap: 14px;
}

.modal-form label,
.modal-field {
  display: grid;
  gap: 7px;
}

.modal-form label > span,
.modal-field-label {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0;
}

.modal-form input,
.modal-form textarea,
.modal-form select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-input);
  color: var(--ink-primary);
  caret-color: var(--accent);
  outline: none;
}

.modal-form input::placeholder,
.modal-form textarea::placeholder {
  color: var(--ink-placeholder);
  opacity: 1;
}

.modal-form input[aria-invalid="true"],
.modal-form textarea[aria-invalid="true"] {
  border-color: rgba(255, 59, 48, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.modal-field-error {
  margin: -2px 0 0;
  color: #c91810;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.modal-form textarea {
  min-height: 88px;
  resize: vertical;
}

.agent-select-field {
  min-width: 0;
}

.agent-select-control {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 0;
}

.modal-form .agent-select-control select {
  height: 44px;
  padding: 0 40px 0 13px;
  border-color: rgba(20, 23, 31, 0.1);
  border-radius: 14px;
  appearance: none;
  background:
    linear-gradient(180deg, #fff 0%, #f6f7f9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 1px 2px rgba(20, 23, 31, 0.05);
  color: #20242b;
  font-size: var(--type-size-control);
  font-weight: var(--type-weight-medium);
  line-height: 44px;
  cursor: pointer;
}

.modal-form .agent-select-control select:hover {
  border-color: rgba(20, 23, 31, 0.14);
  background:
    linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);
}

.modal-form .agent-select-control select:focus {
  border-color: rgba(20, 23, 31, 0.16);
  box-shadow:
    0 0 0 3px rgba(20, 23, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.agent-select-control svg {
  position: absolute;
  right: 13px;
  color: rgba(20, 23, 31, 0.48);
  pointer-events: none;
}

.owner-profile-form {
  gap: 16px;
}

.agent-form-preview,
.owner-profile-preview {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(142, 142, 147, 0.14);
  border-radius: 16px;
  background: #fff;
}

.agent-form-preview {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.owner-profile-preview {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.agent-form-preview-avatar-action {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(10, 132, 255, 0.16);
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--accent);
}

.agent-form-preview-avatar-action:hover,
.agent-form-preview-avatar-action:focus-visible {
  background: rgba(10, 132, 255, 0.13);
  outline: none;
}

.agent-form-preview strong,
.agent-form-preview span,
.owner-profile-preview strong,
.owner-profile-preview span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-form-preview strong,
.owner-profile-preview strong {
  color: var(--ink);
  font-size: var(--type-size-title);
  font-weight: var(--type-weight-bold);
  white-space: nowrap;
}

.agent-form-preview span,
.owner-profile-preview span {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 1.35;
  white-space: nowrap;
}

.runtime-preflight {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(142, 142, 147, 0.16);
  border-radius: 13px;
  background: rgba(142, 142, 147, 0.08);
}

.runtime-preflight strong {
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.runtime-preflight span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-meta);
  line-height: 1.4;
}

.runtime-preflight.ok {
  border-color: rgba(52, 199, 89, 0.24);
  background: rgba(52, 199, 89, 0.09);
}

.runtime-preflight.missing {
  border-color: rgba(255, 149, 0, 0.28);
  background: rgba(255, 149, 0, 0.09);
}

.runtime-preflight.missing strong {
  color: #9a5a00;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.agent-advanced-settings {
  display: grid;
  gap: 12px;
}

.agent-advanced-settings summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  list-style: none;
  text-transform: uppercase;
  letter-spacing: 0;
}

.agent-advanced-settings summary::-webkit-details-marker {
  display: none;
}

.agent-advanced-settings summary:hover,
.agent-advanced-settings summary:focus-visible {
  background: rgba(20, 23, 31, 0.06);
  color: #4f5560;
  outline: none;
}

.agent-advanced-settings summary svg {
  color: rgba(20, 23, 31, 0.46);
  transition: transform 0.16s ease;
}

.agent-advanced-settings[open] summary svg {
  transform: rotate(180deg);
}

.agent-advanced-settings[open] summary {
  margin-bottom: 12px;
}

.agent-advanced-settings[open] {
  padding-top: 2px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.modal-actions.split {
  justify-content: space-between;
}

.modal-actions.split > div {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  padding: 10px 14px;
  border-radius: 13px;
  background: rgba(142, 142, 147, 0.12);
  color: var(--ink);
  font-weight: var(--type-weight-semibold);
}

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

.modal-actions button.danger {
  background: rgba(255, 59, 48, 0.12);
  color: #d70015;
}

.modal-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.confirm-modal {
  display: grid;
  gap: 18px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 1.55;
}

.modal-member-editor {
  background: #fff;
}

.modal-form .modal-member-editor label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.modal-form .modal-member-editor label:hover {
  background: rgba(10, 132, 255, 0.07);
}

.modal-form .modal-member-editor input[type="checkbox"] {
  width: 17px;
  min-width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 5px;
  accent-color: var(--accent);
}

.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: flex;
  align-items: center;
  max-width: min(520px, calc(100vw - 48px));
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 23, 31, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.14);
  color: #2c3038;
  backdrop-filter: blur(16px);
}

.app-toast span {
  overflow-wrap: anywhere;
  font-size: var(--type-size-body);
  line-height: 1.45;
}

.app-toast button {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(20, 23, 31, 0.08);
  color: #4f5560;
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.agent-detail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.agent-detail-hero {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  background: var(--surface-profile-hero-bg);
  box-shadow: var(--surface-profile-hero-shadow);
  color: var(--ink-primary);
}

.avatar.large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: var(--type-size-title);
}

.agent-detail-hero h3 {
  overflow: hidden;
  margin: 0;
  font-size: var(--type-size-display);
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-detail-hero p {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-detail-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-rows: 50px;
  align-self: start;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--surface-profile-tabs-bg);
  box-shadow: var(--surface-profile-tabs-shadow);
}

.agent-detail-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 2px;
  height: 50px;
  padding: 8px 6px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.agent-detail-tab:hover {
  background: var(--surface-profile-tab-hover);
}

.agent-detail-tab.active {
  background: var(--surface-profile-tab-active);
  color: var(--ink-primary);
  box-shadow: var(--surface-profile-tab-shadow);
}

.agent-detail-tab span {
  overflow: hidden;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-detail-tab small {
  overflow: hidden;
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.agent-detail-panel {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.agent-detail-panel.panel-activity {
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.agent-phase-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.agent-phase-line small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--badge-phase-default-bg);
  color: var(--badge-phase-default-ink);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.phase-badge.phase-thinking {
  background: var(--badge-phase-thinking-bg);
  color: var(--badge-phase-thinking-ink);
}

.phase-badge.phase-command {
  background: var(--badge-phase-command-bg);
  color: var(--badge-phase-command-ink);
}

.phase-badge.phase-file_edit {
  background: var(--badge-phase-file-bg);
  color: var(--badge-phase-file-ink);
}

.phase-badge.phase-acting,
.phase-badge.phase-event,
.phase-badge.phase-message,
.phase-badge.phase-task {
  background: var(--badge-phase-success-bg);
  color: var(--badge-phase-success-ink);
}

.phase-badge.phase-tools {
  background: var(--badge-phase-command-bg);
  color: var(--badge-phase-command-ink);
}

.phase-badge.phase-error,
.phase-badge.phase-event_error,
.phase-badge.phase-run_error {
  background: var(--badge-phase-error-bg);
  color: var(--badge-phase-error-ink);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-grid > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(118, 118, 128, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(32, 36, 44, 0.04);
}

.detail-grid span,
.detail-section h4 {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-grid code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--type-size-meta);
}

.detail-section {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-head > span {
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.workspace-section {
  padding: 14px;
  border: 1px solid rgba(118, 118, 128, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 251, 0.76)),
    rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 22px rgba(32, 36, 44, 0.04);
}

.workspace-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 8px;
  min-width: 0;
}

.workspace-path-card,
.workspace-memory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-panel);
}

.workspace-path-card > div,
.workspace-memory-card > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.workspace-path-card span,
.workspace-memory-card span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-path-card code,
.workspace-memory-card code {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--type-size-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.workspace-tree-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: min(360px, 46vh);
  max-height: min(620px, 62vh);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-panel);
}

.workspace-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.workspace-pane-head h5 {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.workspace-pane-head span {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tree {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  grid-auto-rows: max-content;
  min-height: 0;
  max-height: min(520px, 56vh);
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.workspace-tree-node {
  display: grid;
  min-width: 0;
}

.workspace-tree-row {
  display: grid;
  grid-template-columns: 18px 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.workspace-disclosure {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.workspace-tree-row.is-dir:hover .workspace-disclosure {
  background: var(--accent-soft);
  color: var(--accent);
}

.workspace-tree-row:hover,
.workspace-tree-row.selected {
  background: var(--bg-selected-soft);
}

.workspace-tree-node:last-child > .workspace-tree-row {
  border-bottom: 0;
}

.workspace-tree-children {
  display: grid;
  border-bottom: 1px solid var(--border-subtle);
}

.workspace-entry-kind {
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(142, 142, 147, 0.12);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-align: center;
}

.workspace-entry-kind.kind-dir {
  background: var(--accent-soft);
  color: var(--accent);
}

.workspace-tree-row.is-file .workspace-entry-kind {
  background: rgba(52, 199, 89, 0.12);
  color: #167d32;
}

.workspace-entry-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.workspace-entry-main strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-entry-main small {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-row-action {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.1);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-tree-row.is-dir .workspace-row-action {
  background: rgba(10, 132, 255, 0.1);
  color: var(--accent);
}

.workspace-tree-row.is-file:hover .workspace-row-action,
.workspace-tree-row.selected .workspace-row-action {
  background: rgba(52, 199, 89, 0.13);
  color: #167d32;
}

.workspace-empty-folder {
  margin: 0;
  padding: 7px 10px 7px 92px;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.workspace-error {
  margin: 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.1);
  color: #c91810;
  font-size: var(--type-size-meta);
  line-height: 1.4;
}

.workspace-preview {
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

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

.workspace-preview-head > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.workspace-preview-head strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-preview-head span {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-preview .markdown-body {
  min-width: 0;
  font-size: var(--type-size-body);
}

.workspace-preview-raw {
  max-height: none;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  font-size: var(--type-size-meta);
  line-height: 1.5;
  white-space: pre-wrap;
}

.live-activity-section {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.performance-section {
  padding: 0;
}

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

.performance-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.performance-card span {
  color: var(--ink-muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.performance-card strong {
  color: var(--ink-primary);
  font-size: var(--type-size-display);
  font-weight: var(--type-weight-bold);
  letter-spacing: 0;
}

.performance-card small {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-autonomy-card {
  padding: 14px;
  border: 1px solid var(--accent-soft-border);
  border-radius: 18px;
  background: var(--accent-soft);
}

.agent-autonomy-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 1.5;
}

.agent-reminders-section {
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--bg-elevated);
  box-shadow: var(--state-selected-shadow);
}

.agent-reminder-list {
  display: grid;
  gap: 8px;
}

.agent-reminder-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-control-flat);
}

.agent-reminder-row.status-fired {
  border-color: var(--status-danger-border);
  background: var(--status-danger-soft);
}

.agent-reminder-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.agent-reminder-row.status-fired .agent-reminder-icon {
  background: var(--status-danger-soft);
  color: var(--status-danger);
}

.agent-reminder-body {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.agent-reminder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-reminder-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-reminder-title span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--badge-phase-default-bg);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.agent-reminder-row.status-fired .agent-reminder-title span {
  background: var(--status-danger-soft);
  color: var(--status-danger);
}

.agent-reminder-body p,
.agent-reminder-overflow {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.4;
}

.agent-reminder-body small {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-timeline {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 6px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.activity-run-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 6px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.activity-run-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-control-flat);
  border-left: 3px solid var(--source-kind-strong, var(--border-subtle));
}

.activity-run-card[data-provider-retrying="true"] {
  border-color: var(--status-warning-border);
  background: var(--status-warning-soft);
}

[data-source-kind="mention"] {
  --source-kind-strong: #1d6bff;
  --source-kind-soft: rgba(29, 107, 255, 0.12);
}

[data-source-kind="dm"] {
  --source-kind-strong: #5a3fdb;
  --source-kind-soft: rgba(90, 63, 219, 0.14);
}

[data-source-kind="thread_followup"] {
  --source-kind-strong: #1aa3a3;
  --source-kind-soft: rgba(26, 163, 163, 0.14);
}

[data-source-kind="channel_message"] {
  --source-kind-strong: #1a9b6e;
  --source-kind-soft: rgba(26, 155, 110, 0.14);
}

[data-source-kind="task"] {
  --source-kind-strong: #7b2cbf;
  --source-kind-soft: rgba(123, 44, 191, 0.14);
}

[data-source-kind="reminder"] {
  --source-kind-strong: #c97b14;
  --source-kind-soft: rgba(201, 123, 20, 0.16);
}

[data-source-kind="schedule"] {
  --source-kind-strong: #cf5c1e;
  --source-kind-soft: rgba(207, 92, 30, 0.16);
}

[data-source-kind="handoff"] {
  --source-kind-strong: #c52b88;
  --source-kind-soft: rgba(197, 43, 136, 0.14);
}

[data-source-kind="self_wake"],
[data-source-kind="system"] {
  --source-kind-strong: #6a7484;
  --source-kind-soft: rgba(106, 116, 132, 0.16);
}

[data-source-kind="manual"] {
  --source-kind-strong: #2f9e44;
  --source-kind-soft: rgba(47, 158, 68, 0.14);
}

[data-source-kind="default"] {
  --source-kind-strong: var(--accent);
  --source-kind-soft: var(--badge-phase-default-bg);
}

.activity-run-card[data-jumpable="false"] {
  opacity: 0.92;
}

.activity-run-head-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.activity-run-trigger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 1.3;
}

.activity-run-kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--source-kind-soft, var(--badge-phase-default-bg));
  color: var(--source-kind-strong, var(--ink-secondary));
}

.activity-run-trigger-label {
  color: var(--ink-secondary);
  font-weight: var(--type-weight-semibold);
}

.activity-run-trigger-label b {
  color: var(--source-kind-strong, var(--ink-primary));
}

.activity-run-trigger time {
  color: var(--muted);
  font-weight: var(--type-weight-regular);
  font-variant-numeric: tabular-nums;
}

.activity-run-trigger small {
  color: var(--muted);
  font-weight: var(--type-weight-regular);
}

.activity-run-retrying {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--status-warning-soft);
  color: var(--status-warning);
  font-weight: var(--type-weight-semibold);
}

.activity-run-arrow {
  color: var(--source-kind-strong, var(--accent));
  margin-left: auto;
}

.activity-run-context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.4;
  min-width: 0;
}

.activity-run-path {
  flex: 0 1 auto;
  color: var(--ink-secondary);
  font-weight: var(--type-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.activity-run-context-divider {
  color: var(--muted);
}

.activity-run-preview {
  flex: 1 1 14ch;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-run-open {
  padding: 5px 9px;
  border: 1px solid var(--source-kind-strong, var(--border-control));
  border-radius: 8px;
  background: var(--source-kind-soft, var(--surface-control));
  color: var(--source-kind-strong, var(--ink-on-control));
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.activity-run-open:hover,
.activity-run-open:focus-visible {
  background: var(--source-kind-soft, var(--surface-control-hover));
  filter: brightness(0.98);
}

.activity-progress-dock .activity-run-step[data-source-kind] .activity-dot,
.activity-run-step[data-source-kind] .activity-dot {
  background: var(--source-kind-strong, var(--border-strong));
}

.activity-run-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.activity-run-head h5,
.activity-run-head p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-run-head h5 {
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: 1.35;
}

.activity-run-head p {
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.4;
}

.activity-run-head button {
  padding: 5px 9px;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--surface-control);
  color: var(--ink-on-control);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.activity-run-head button:hover,
.activity-run-head button:focus-visible {
  background: var(--surface-control-hover);
}

.activity-run-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  line-height: 1.3;
}

.activity-run-kicker span,
.activity-run-kicker b {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--badge-phase-default-bg);
  color: var(--muted);
  font-weight: var(--type-weight-semibold);
}

.activity-run-kicker b {
  background: var(--status-warning-soft);
  color: var(--status-warning);
}

.activity-provider-note,
.activity-queued-note,
.activity-queued-summary {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: var(--type-size-meta);
  line-height: 1.35;
}

.activity-provider-note {
  border: 1px solid var(--status-warning-border);
  background: var(--status-warning-soft);
  color: var(--status-warning);
}

.activity-provider-note strong,
.activity-queued-summary strong {
  color: var(--ink);
  font-weight: var(--type-weight-bold);
}

.activity-queued-note,
.activity-queued-summary {
  border: 1px dashed var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--muted);
}

.activity-run-steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-run-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.activity-run-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  cursor: pointer;
}

.activity-run-toggle:hover,
.activity-run-toggle:focus-visible {
  color: var(--ink-primary);
  text-decoration: underline;
}

.activity-run-truncation-note {
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.35;
}

.activity-run-step {
  display: grid;
  grid-template-columns: clamp(60px, 18%, 82px) 14px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 8px 8px 0;
  border-radius: 10px;
  cursor: pointer;
}

.activity-run-step:hover,
.activity-run-step.expanded {
  background: var(--bg-hover);
}

.activity-run-step time {
  padding-top: 3px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  text-align: right;
  white-space: nowrap;
}

.live-activity-section {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.activity-timeline-row {
  display: grid;
  grid-template-columns: clamp(60px, 18%, 82px) 14px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 8px 8px 0;
  border-radius: 10px;
  cursor: pointer;
}

.activity-timeline-row:hover,
.activity-timeline-row.expanded {
  background: var(--bg-hover);
}

.activity-timeline-row time {
  padding-top: 3px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  letter-spacing: 0;
  text-align: right;
  white-space: nowrap;
}

.activity-dot {
  position: relative;
  display: inline-grid;
  align-self: start;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  justify-self: center;
  border: 2px solid var(--bg-code);
  border-radius: 999px;
  background: var(--badge-phase-command-ink);
  box-shadow: 0 0 0 2px var(--status-warning-soft);
}

.activity-dot::after {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 1px;
  height: calc(100% + 30px);
  background: var(--border-strong);
  content: "";
  transform: translateX(-50%);
}

.activity-timeline-row:last-child .activity-dot::after {
  display: none;
}

.activity-dot[data-kind="thinking"] {
  background: var(--badge-phase-thinking-ink);
  box-shadow: 0 0 0 3px var(--badge-phase-thinking-bg);
}

.activity-dot[data-kind="command"] {
  background: var(--status-warning);
  box-shadow: 0 0 0 3px var(--status-warning-soft);
}

.activity-dot[data-kind="file_edit"] {
  background: var(--badge-phase-file-ink);
  box-shadow: 0 0 0 3px var(--badge-phase-file-bg);
}

.activity-dot[data-kind="acting"],
.activity-dot[data-kind="event"],
.activity-dot[data-kind="message"],
.activity-dot[data-kind="task"] {
  background: var(--status-success);
  box-shadow: 0 0 0 3px var(--status-success-soft);
}

.activity-dot[data-kind="tools"] {
  background: var(--badge-phase-command-ink);
  box-shadow: 0 0 0 3px var(--status-warning-soft);
}

.activity-dot[data-kind="run_retry"] {
  background: var(--status-warning);
  box-shadow: 0 0 0 3px var(--status-warning-soft);
}

.activity-dot[data-kind="error"],
.activity-dot[data-kind="event_error"],
.activity-dot[data-kind="run_error"] {
  background: var(--status-danger);
  box-shadow: 0 0 0 3px var(--status-danger-soft);
}

.activity-dot[data-status="success"] {
  background: var(--status-success);
  box-shadow: 0 0 0 3px var(--status-success-soft);
}

.activity-dot[data-status="warning"] {
  background: var(--status-warning);
  box-shadow: 0 0 0 3px var(--status-warning-soft);
}

.activity-dot[data-status="error"] {
  background: var(--status-danger);
  box-shadow: 0 0 0 3px var(--status-danger-soft);
}

.activity-timeline-body {
  display: grid;
  min-width: 0;
  gap: 4px;
  overflow: hidden;
}

.activity-timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.activity-timeline-title strong {
  min-width: 0;
  color: var(--ink-primary);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-timeline-title span {
  color: var(--ink-muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  line-height: 1.4;
}

.activity-status {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--badge-phase-default-bg);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.activity-status.status-active {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.activity-status.status-success {
  border-color: var(--status-success-border);
  background: var(--status-success-soft);
  color: var(--status-success);
}

.activity-status.status-warning {
  border-color: var(--status-warning-border);
  background: var(--status-warning-soft);
  color: var(--status-warning);
}

.activity-status.status-error {
  border-color: var(--status-danger-border);
  background: var(--status-danger-soft);
  color: var(--status-danger);
}

.activity-structure-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  color: var(--ink-muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  overflow: hidden;
  line-height: 20px;
}

.activity-structure-line span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 130px;
  overflow: hidden;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--badge-phase-default-bg);
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-metadata {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  line-height: 22px;
}

.activity-metadata span {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 180px);
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-control-flat);
  color: var(--ink-secondary);
  font-size: var(--type-size-caption);
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-metadata b {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-weight: var(--type-weight-bold);
}

.activity-timeline-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--type-size-caption);
  line-height: 1.45;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.activity-timeline-row.expanded .activity-timeline-body p {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.activity-timeline-row.expanded .activity-metadata,
.activity-timeline-row.expanded .activity-structure-line {
  flex-wrap: wrap;
  overflow: visible;
}

.activity-raw {
  max-height: 180px;
  overflow: auto;
  margin: 2px 0 0;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-code);
  color: var(--ink-on-code);
  font-family: var(--font-mono);
  font-size: var(--type-size-caption);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.activity-timeline-row[data-kind="error"] .activity-timeline-body p,
.activity-timeline-row[data-kind="event_error"] .activity-timeline-body p,
.activity-timeline-row[data-kind="run_error"] .activity-timeline-body p {
  color: var(--status-danger);
}

.channel.has-unread,
.dm.has-unread,
.dm-row.has-unread .dm {
  font-weight: var(--type-weight-bold);
}

.channel.has-unread {
  color: var(--unread-ink);
}

.modal-form .channel-agent-picker .channel-agent-option {
  grid-template-columns: minmax(0, 1fr) 76px;
  align-items: center;
  gap: 12px;
}

.channel-agent-modal-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-control-selected);
}

.channel-agent-modal-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--state-focus-ring);
  border-radius: 12px;
  background: var(--bg-selected-soft);
  color: var(--accent-soft-ink);
}

.channel-agent-modal-intro strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
}

.channel-agent-modal-intro p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.channel-agent-empty-cta {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-panel-strong);
}

.channel-agent-empty-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.channel-agent-empty-cta button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--accent-soft-border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 13px;
  font-weight: 760;
}

.channel-agent-empty-cta button:hover,
.channel-agent-empty-cta button:focus-visible {
  border-color: var(--accent-soft-hover-border);
  background: var(--accent-soft-hover);
  color: var(--accent-soft-hover-ink);
}

.channel-agent-picker .channel-agent-option {
  position: relative;
  min-height: 56px;
  border: 1px solid transparent;
  touch-action: manipulation;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.channel-agent-picker .channel-agent-option.selected {
  background: var(--bg-selected-soft);
  border-color: var(--state-focus-ring);
  box-shadow: inset 3px 0 0 var(--accent);
}

.modal-form .modal-member-editor input.channel-agent-checkbox[type="checkbox"] {
  position: absolute;
  width: 1px;
  min-width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.channel-agent-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.channel-agent-profile .agent-avatar {
  color: transparent;
  font-size: var(--type-size-body);
}

.channel-agent-profile .agent-avatar-glyph {
  color: var(--avatar-color);
}

.channel-agent-option-state {
  display: inline-flex;
  width: 76px;
  height: 30px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  justify-self: end;
  padding: 0 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-panel-strong);
  color: #535967;
  font-size: 12px;
  font-weight: 760;
}

.channel-agent-option-state.selected {
  border-color: var(--accent-soft-border);
  background: var(--bg-selected-soft);
  color: var(--accent-soft-ink);
}

.agent-pick-row {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-pick-row strong {
  color: var(--ink);
  font-size: var(--type-size-body);
}

.agent-pick-row strong,
.agent-pick-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-pick-row small {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: 28px;
  background: rgba(246, 247, 249, 0.7);
  backdrop-filter: blur(20px) saturate(1.12);
}

.search-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--surface-shadow);
}

.search-panel-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.search-input-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);
  color: #5f6672;
  box-shadow:
    inset 0 0 0 1px rgba(20, 23, 31, 0.1),
    0 1px 2px rgba(20, 23, 31, 0.04);
}

.search-mobile-back,
.search-mobile-top-back {
  display: none;
}

.search-panel-head input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-display);
  font-weight: var(--type-weight-semibold);
  outline: none;
}

.search-clear {
  display: grid;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(20, 23, 31, 0.1);
  background: linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);
  color: #656c78;
}

.search-clear {
  width: 36px;
}

.search-clear:hover {
  background: #fff;
  color: #20242b;
}

.search-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 251, 0.86);
}

.search-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-filter-group button,
.search-time-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(142, 142, 147, 0.16);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.search-filter-group button.active {
  border-color: rgba(20, 23, 31, 0.16);
  background: #eef0f4;
  color: #20242b;
}

.search-time-filter {
  position: relative;
  margin-left: auto;
  padding-right: 10px;
}

.search-time-filter select {
  max-width: 132px;
  padding-right: 18px;
  border: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  outline: none;
  cursor: pointer;
}

.search-time-chevron {
  flex: 0 0 auto;
  color: rgba(20, 23, 31, 0.48);
  pointer-events: none;
}

.search-panel-body {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.search-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
}

.search-empty h3 {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-size-title);
}

.search-empty p {
  max-width: 460px;
  margin: 0;
  font-size: var(--type-size-body);
}

.search-result-group {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.search-result-group h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-result-list {
  display: grid;
  gap: 10px;
}

.search-result-list button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 22px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.search-result-list button:hover {
  border-color: transparent;
  background: rgba(248, 248, 248, 0.72);
  box-shadow: none;
}

.search-result-avatar,
.activity-feed-row-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  align-self: start;
}

.search-result-fallback-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: #eef0f4;
  color: #555a66;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 16px;
}

.search-result-list strong,
.search-result-list small,
.search-result-list p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-list strong {
  color: #1d1c1d;
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.search-result-list small {
  color: var(--muted);
  font-size: var(--type-size-meta);
  white-space: nowrap;
}

.search-result-list p {
  display: -webkit-box;
  margin: 3px 0 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #1d1c1d;
  font-size: var(--type-size-message);
  line-height: 1.48;
}

.search-result-list mark {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 214, 10, 0.45);
  color: inherit;
}

.thread-browser-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--surface-shadow);
}

.thread-browser-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.thread-browser-head h2 {
  margin: 0;
  font-size: var(--type-size-display);
}

.thread-browser-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.thread-browser-body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.thread-browser-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(142, 142, 147, 0.18);
  border-radius: 16px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}

.thread-browser-row:hover,
.thread-browser-row.selected {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.thread-browser-row.has-unread {
  border-color: rgba(20, 23, 31, 0.2);
}

.thread-browser-content {
  min-width: 0;
}

.thread-browser-content p {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-semibold);
  line-height: 1.45;
}

.thread-browser-content small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.thread-browser-follow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.12);
  color: #168a36;
}

.thread-browser-follow:hover {
  background: rgba(255, 59, 48, 0.12);
  color: #d70015;
}

.reminder-modal {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.25fr);
  gap: 16px;
}

.reminder-create,
.reminder-list {
  display: grid;
  align-content: start;
  gap: 12px;
}

.reminder-create {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--bg-elevated);
  box-shadow: var(--state-selected-shadow);
}

.reminder-hero {
  display: flex;
  gap: 12px;
  align-items: center;
}

.reminder-icon,
.reminder-row-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.reminder-row-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--badge-phase-default-bg);
  color: var(--muted);
}

.reminder-hero strong,
.reminder-row strong {
  display: block;
  color: var(--ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.reminder-hero span,
.reminder-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.reminder-create input,
.reminder-create textarea,
.reminder-create select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--bg-input);
  color: var(--ink);
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.reminder-create input:focus,
.reminder-create textarea:focus,
.reminder-create select:focus {
  border-color: var(--accent-soft-hover-border);
  box-shadow: 0 0 0 3px var(--state-focus-ring);
  outline: none;
}

.reminder-create input,
.reminder-create select {
  height: 38px;
  padding: 0 11px;
}

.reminder-create textarea {
  min-height: 74px;
  padding: 10px 11px;
  resize: vertical;
}

.reminder-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.reminder-quick-grid button {
  height: 34px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-control-flat);
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.reminder-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
}

.reminder-create-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-transform: uppercase;
}

.reminder-thread-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-control-flat);
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.reminder-thread-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.reminder-thread-toggle.disabled {
  opacity: 0.5;
}

.reminder-list {
  max-height: min(560px, calc(100vh - 230px));
  overflow: auto;
  padding-right: 4px;
}

.reminder-summary {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
  gap: 8px;
}

.reminder-summary div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-control-flat);
}

.reminder-summary span {
  display: block;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.reminder-summary strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminder-group {
  display: grid;
  gap: 10px;
}

.reminder-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reminder-group h4,
.reminder-group-head span {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.reminder-group-head span {
  letter-spacing: 0;
}

.reminder-row {
  display: flex;
  gap: 11px;
  align-items: start;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-panel);
  box-shadow: var(--state-selected-shadow);
}

.reminder-row.fired {
  border-color: var(--status-warning-border);
  background: var(--status-warning-soft);
}

.reminder-row-body {
  min-width: 0;
  flex: 1;
}

.reminder-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reminder-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
  text-transform: capitalize;
}

.reminder-status.due {
  background: var(--status-warning-soft);
  color: var(--status-warning);
}

.reminder-row p {
  margin: 7px 0 0;
  color: var(--ink-secondary);
  font-size: var(--type-size-body);
  line-height: 1.42;
}

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

.reminder-row-actions button {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
}

.reminder-row-actions button.icon {
  display: grid;
  width: 30px;
  padding: 0;
  place-items: center;
}

@media (max-width: 760px) {
  .reminder-modal {
    grid-template-columns: 1fr;
  }

  .reminder-summary {
    grid-template-columns: 1fr;
  }

  .reminder-row {
    flex-wrap: wrap;
  }

  .reminder-row-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.activity-feed-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--activity-feed-panel-border);
  border-radius: 22px;
  background: var(--activity-feed-panel-bg);
  box-shadow: var(--activity-feed-panel-shadow);
}

.activity-panel {
  height: min(820px, calc(100vh - 56px));
}

.activity-feed-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.activity-feed-head h2 {
  margin: 0;
  font-size: var(--type-size-display);
}

.activity-feed-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
}

.activity-feed-back,
.activity-feed-mark-all,
.activity-feed-dismiss-all {
  border: 1px solid var(--activity-feed-control-border);
  border-radius: 12px;
  background: var(--activity-feed-control-bg);
  color: var(--activity-feed-control-ink);
  font-weight: var(--type-weight-bold);
  box-shadow: var(--activity-feed-control-shadow);
}

.activity-feed-back:hover,
.activity-feed-mark-all:hover:not(:disabled),
.activity-feed-dismiss-all:hover:not(:disabled) {
  background: var(--activity-feed-control-hover-bg);
  color: var(--activity-feed-control-hover-ink);
}

.activity-feed-back {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  font-size: var(--type-size-display);
}

.activity-feed-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-feed-mark-all,
.activity-feed-dismiss-all {
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.activity-feed-dismiss-all:hover:not(:disabled) {
  border-color: var(--activity-feed-action-danger-border);
  color: var(--activity-feed-action-danger-ink);
}

.activity-feed-mark-all:disabled,
.activity-feed-dismiss-all:disabled {
  opacity: 0.46;
}

.activity-feed-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--activity-feed-filters-bg);
}

.activity-feed-filters button {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--activity-feed-filter-border);
  border-radius: 999px;
  background: var(--activity-feed-filter-bg);
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  white-space: nowrap;
}

.activity-feed-filters button.active {
  border-color: var(--activity-feed-filter-active-border);
  background: var(--activity-feed-filter-active-bg);
  color: var(--activity-feed-filter-active-ink);
}

.activity-feed-body {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 20px;
  scrollbar-gutter: stable;
}

.activity-feed-new-activity {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  padding: 10px 22px 8px;
  pointer-events: none;
}

.activity-feed-new-activity button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--activity-feed-filter-active-border);
  border-radius: 999px;
  background: var(--activity-feed-control-bg);
  color: var(--activity-feed-filter-active-ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-bold);
  box-shadow: var(--activity-feed-control-shadow);
  pointer-events: auto;
}

.activity-feed-new-activity button:hover {
  background: var(--activity-feed-control-hover-bg);
  color: var(--activity-feed-control-hover-ink);
}

.activity-feed-row-shell {
  position: relative;
  min-height: max-content;
  overflow: hidden;
  padding: 10px 28px 12px;
  border-radius: 16px;
  --activity-feed-swipe-x: 0px;
}

.activity-feed-row-shell + .activity-feed-row-shell {
  border-top: 0;
}

.activity-feed-swipe-action {
  display: none;
}

.activity-feed-row {
  /*
   * Activity rows are content-driven. The body scrolls; individual messages
   * should not shrink to fit the visible viewport.
   */
  --activity-feed-meta-line-height: 18px;
  --activity-feed-title-line-height: 23px;
  --activity-feed-excerpt-line-height: 22px;
  --activity-feed-excerpt-max-height: 66px;
  --activity-feed-footer-line-height: 18px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px 22px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--activity-feed-control-bg);
  color: inherit;
  box-shadow: inset 0 0 0 1px var(--activity-feed-row-border);
  cursor: pointer;
}

.activity-feed-row:hover {
  background: var(--activity-feed-row-hover-bg);
  box-shadow: inset 0 0 0 1px var(--activity-feed-row-border);
}

.activity-feed-row.new-thread {
  background: var(--thread-new-bg);
  box-shadow:
    inset 0 0 0 1px var(--thread-new-border),
    var(--thread-new-shadow);
}

.activity-feed-row.new-thread:hover {
  background: var(--thread-new-bg);
  box-shadow:
    inset 0 0 0 1px var(--thread-new-border),
    var(--thread-new-shadow);
}

.activity-feed-row.unread .activity-feed-row-meta strong,
.activity-feed-row.unread h3 {
  font-weight: var(--type-weight-bold);
}

.activity-feed-row-main {
  min-width: 0;
}

.activity-feed-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-medium);
  line-height: var(--activity-feed-meta-line-height);
}

.activity-feed-row-meta strong {
  display: inline;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--activity-feed-row-title-ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  line-height: var(--activity-feed-meta-line-height);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-feed-row-meta span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--activity-feed-meta-line-height);
  white-space: nowrap;
}

.activity-feed-row-meta em {
  display: inline-flex;
  align-items: center;
  min-height: var(--activity-feed-meta-line-height);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--activity-feed-meta-chip-bg);
  color: var(--activity-feed-meta-chip-ink);
  font-style: normal;
  text-transform: capitalize;
}

.activity-feed-row h3 {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 3px 0 0;
  min-width: 0;
  color: var(--activity-feed-row-title-ink);
  font-size: var(--type-size-message);
  font-weight: var(--type-weight-semibold);
  line-height: var(--activity-feed-title-line-height);
}

.activity-feed-row h3 svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

.activity-feed-row h3 span {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: var(--activity-feed-title-line-height);
}

.activity-feed-row p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--activity-feed-row-body-ink);
  font-size: var(--type-size-body);
  line-height: var(--activity-feed-excerpt-line-height);
  max-height: var(--activity-feed-excerpt-max-height);
}

.activity-feed-row small {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: var(--type-weight-semibold);
  line-height: var(--activity-feed-footer-line-height);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-feed-row small b {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--activity-feed-status-bg);
  color: var(--activity-feed-status-ink);
  font-size: var(--type-size-caption);
}

.activity-feed-row-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.activity-feed-unread-dot {
  display: none;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--activity-feed-unread-bg);
  box-shadow: var(--activity-feed-unread-shadow);
}

.activity-feed-check,
.activity-feed-dismiss {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--activity-feed-action-bg);
  color: var(--ink);
  box-shadow: var(--activity-feed-action-shadow);
}

.activity-feed-check:hover {
  background: var(--activity-feed-action-success-bg);
  color: var(--activity-feed-action-success-ink);
}

.activity-feed-dismiss:hover {
  background: var(--activity-feed-action-danger-bg);
  color: var(--activity-feed-action-danger-ink);
}

.activity-feed-load-more {
  display: grid;
  place-items: center;
  padding: 14px 22px 6px;
}

.activity-feed-load-more button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 18px;
  border: 1px solid var(--activity-feed-control-border);
  border-radius: 999px;
  background: var(--activity-feed-control-bg);
  color: var(--activity-feed-control-hover-ink);
  font-size: var(--type-size-body);
  font-weight: var(--type-weight-semibold);
  box-shadow: var(--activity-feed-control-shadow);
}

.activity-feed-load-more button:hover {
  background: var(--activity-feed-control-hover-bg);
}

.activity-feed-load-more button span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: var(--type-weight-semibold);
}

.fatal-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 111, 174, 0.16), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(10, 132, 255, 0.16), transparent 34%),
    #eef1f5;
  color: #16181d;
}

.fatal-card {
  width: min(760px, calc(100vw - 48px));
  padding: 28px;
  border: 1px solid rgba(20, 23, 31, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(20, 23, 31, 0.16);
}

.fatal-card h1 {
  margin: 8px 0 10px;
  font-size: var(--type-size-display);
  letter-spacing: 0;
}

.fatal-card p {
  max-width: 620px;
  margin: 0;
  color: #4d515b;
  line-height: 1.55;
}

.fatal-actions {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.fatal-actions button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: var(--type-weight-bold);
}

.fatal-card pre {
  max-height: 260px;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #101216;
  color: #f6f8ff;
  font-size: var(--type-size-meta);
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (min-width: 761px) and (max-width: 1100px) {
  .app,
  .app.thread-hidden {
    grid-template-columns: minmax(220px, min(var(--sidebar-width), 34vw)) minmax(0, 1fr);
  }

  .conversation {
    grid-column: 2;
    grid-row: 1;
    border-right: 0;
  }

  .app.right-panel-active:not(.thread-hidden) .conversation {
    display: none;
  }

  .app:not(.right-panel-active) .thread {
    display: none;
  }

  .thread,
  .agent-drawer {
    position: relative;
    inset: auto;
    z-index: 0;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 100%;
    border-left: 1px solid rgba(20, 23, 31, 0.12);
    box-shadow: none;
  }

  .thread-resize-handle {
    display: none;
  }
}

@media (max-height: 560px) {
  .topbar,
  .thread header,
  .agent-drawer-head {
    min-height: 54px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .tabs button {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .workspace {
    padding-top: 12px;
    padding-bottom: 8px;
  }

  .quick-actions {
    gap: 6px;
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .quick-actions button {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .composer,
  .reply-composer {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .composer textarea,
  .reply-composer textarea {
    min-height: 40px;
    max-height: min(28vh, 96px);
  }
}

@media (max-width: 760px) {
  html,
  body,
  #root {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior-x: none;
  }

  body {
    min-width: 0;
    min-height: 100dvh;
  }

  .app input:not([type="checkbox"]):not([type="radio"]),
  .app textarea,
  .app select {
    font-size: 16px;
  }

  .app,
  .app.thread-hidden {
    grid-template-columns: 100vw 100vw;
    grid-template-rows: minmax(0, 1fr);
    width: 100vw;
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
  }

  .sidebar {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: none;
    transform: translateX(-100vw);
    transition: transform 180ms ease;
  }

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

  .app.mobile-sidebar-dragging .sidebar {
    transform: translateX(calc(-100vw + var(--mobile-sidebar-drag, 0px)));
    transition: none;
  }

  .sidebar-resize-handle,
  .thread-resize-handle {
    display: none;
  }

  .two-col,
  .three-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  }

  .workspace-switch {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    gap: 9px;
  }

  .workspace-switch-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .workspace-switch strong {
    font-size: var(--type-size-title);
  }

  .quick-actions {
    display: none;
  }

  .profile {
    display: none;
  }

  .channel-block,
  .dm-list {
    max-height: none;
    padding: 0 14px;
  }

  .dm-list {
    scroll-margin-top: calc(14px + env(safe-area-inset-top));
  }

  .dm-list .sidebar-section-scroll {
    padding-bottom: 118px;
  }

  .channel,
  .dm {
    min-height: 42px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: var(--type-size-body);
  }

  .conversation {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    width: 100vw;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100dvh;
    min-height: 0;
    border-right: 0;
    overscroll-behavior-x: none;
    transform: translateX(-100vw);
    transition: transform 180ms ease;
  }

  .app.mobile-sidebar-open .conversation {
    transform: translateX(0);
  }

  .app.mobile-sidebar-dragging .conversation {
    transform: translateX(calc(-100vw + var(--mobile-sidebar-drag, 0px)));
    transition: none;
  }

  .topbar {
    overflow: visible;
    min-height: 48px;
    justify-content: flex-start;
    gap: 8px;
    padding: calc(5px + env(safe-area-inset-top)) 10px 5px;
  }

  .mobile-nav-button {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: var(--panel-strong);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .mobile-nav-button svg {
    width: 16px;
    height: 16px;
  }

  .desktop-history-controls {
    display: none;
  }

  .hash-card {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .hash-card.dm-card {
    width: 30px;
    height: 30px;
  }

  .hash-card.dm-card .agent-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .channel-title {
    flex: 1 1 0;
    max-width: calc(100vw - 118px);
    min-width: 0;
    overflow: hidden;
    gap: 10px;
  }

  .channel-title > div {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .channel-title h1 {
    max-width: 100%;
    overflow: hidden;
    font-size: var(--type-size-title);
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .channel-title p {
    display: none;
  }

  .channel-title .hash-card {
    flex: 0 0 auto;
  }

  .channel-header-actions {
    flex: 0 0 auto;
    max-width: 66px;
    min-width: 0;
    gap: 4px;
  }

  .channel-agent-count-trigger {
    min-width: 30px;
    height: 30px;
    padding: 0 5px;
  }

  .channel-agent-count-trigger.empty {
    width: 30px;
    min-width: 30px;
    padding: 0;
  }

  .channel-agent-count-trigger.empty > span {
    display: none;
  }

  .channel-action-trigger {
    width: 30px;
    height: 30px;
  }

  .channel-agent-preview {
    display: none;
  }

  .tabs button {
    flex: 1 1 0;
    justify-content: center;
    padding: 11px 10px;
    font-size: var(--type-size-meta);
  }

  .message-list {
    padding: 6px 0 10px;
  }

  .message-card,
  .reply-list article {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 12px;
  }

  .message-card.focused,
  .message-card.tap-focused {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .message-hover-actions {
    display: none;
  }

  .mobile-message-save-tag {
    display: inline-grid;
    flex: 0 0 auto;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    margin: -4px 0 -4px auto;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(138, 91, 0, 0.12);
    border-radius: 999px;
  }

  .message-body,
  .thread-message-content,
  .reply-body {
    font-size: var(--type-size-control);
    line-height: 1.5;
    -webkit-user-select: text;
    user-select: text;
  }

  .message-card,
  .thread-root,
  .reply-list article {
    -webkit-touch-callout: default;
  }

  .message-body p,
  .thread-message-content p,
  .reply-body p {
    line-height: 1.5;
  }

  .message-card.compact,
  .reply-list article.compact {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .message-agent-avatar-trigger {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .avatar,
  .agent-avatar {
    flex: 0 0 auto;
  }

  .system-message {
    margin: 2px 12px;
  }

  .system-message-line {
    max-width: 100%;
    border-radius: 14px;
  }

  .message-attachments {
    grid-template-columns: minmax(0, min(58vw, 220px));
    justify-content: start;
  }

  .message-attachment.image img {
    height: 124px;
  }

  .task-board {
    padding: 12px;
  }

  .task-board-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card {
    grid-template-columns: 1fr;
  }

  .task-controls {
    width: 100%;
  }

  .task-assignee-picker {
    justify-self: stretch;
  }

  .task-assignee-trigger {
    width: 100%;
    max-width: none;
    grid-template-columns: 28px minmax(0, 1fr) 14px;
  }

  .task-assignee-menu {
    right: auto;
    left: 0;
    width: min(100%, calc(100vw - 24px));
  }

  .status-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
  }

  .status-row button {
    min-width: 0;
    padding-inline: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .composer,
  .reply-composer {
    align-items: end;
    gap: 6px 8px;
    margin-bottom: calc(68px + env(safe-area-inset-bottom));
    padding: 4px 12px;
  }

  .composer {
    grid-template-columns: 34px 34px minmax(0, 1fr) 34px;
    grid-template-areas:
      "picker picker picker picker"
      "attachments attachments attachments attachments"
      "attach task input send";
  }

  .composer:not(:has(.task-toggle)),
  .reply-composer {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    grid-template-areas:
      "picker picker picker"
      "attachments attachments attachments"
      "attach input send";
  }

  .composer .mention-picker,
  .reply-composer .mention-picker {
    grid-area: picker;
    margin-bottom: 0;
  }

  .composer .draft-attachments,
  .reply-composer .draft-attachments {
    grid-area: attachments;
  }

  .composer:focus-within,
  .reply-composer:focus-within,
  .app.mobile-composer-focused .composer,
  .app.mobile-composer-focused .reply-composer {
    margin-bottom: 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .composer textarea,
  .reply-composer textarea {
    grid-area: input;
    min-height: 38px;
    max-height: 112px;
    padding: 7px 13px;
    border-radius: 14px;
    font-size: var(--type-size-control);
    line-height: 20px;
    overflow-y: auto;
  }

  .composer-actions,
  .reply-composer-actions {
    display: contents;
  }

  .composer .attach-button,
  .reply-composer .attach-button {
    grid-area: attach;
  }

  .composer .task-toggle {
    grid-area: task;
  }

  .send,
  .reply-composer .reply-send {
    grid-area: send;
    margin-left: 0;
  }

  .send,
  .reply-composer .reply-send,
  .attach-button,
  .task-toggle {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    box-shadow: none;
  }

  .task-toggle {
    margin-left: 0;
  }

  .task-toggle span,
  .send span {
    display: none;
  }

  .thread,
  .agent-drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: auto;
    max-width: 100vw;
    min-width: 0;
    height: 100dvh;
    border-left: 0;
    box-shadow: none;
    transform: translateX(0);
    transition: transform 180ms ease;
  }

  .thread {
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .app.mobile-panel-dragging.right-panel-active .thread,
  .app.mobile-panel-dragging.right-panel-active .agent-drawer {
    transform: translateX(var(--mobile-sidebar-drag, 0px));
    transition: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 4px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: 21px;
    background: var(--bg-panel-strong);
    box-shadow:
      0 16px 40px rgba(20, 23, 31, 0.18),
      0 2px 8px rgba(20, 23, 31, 0.08);
    backdrop-filter: blur(24px) saturate(1.16);
  }

  .app.mobile-composer-focused .mobile-bottom-nav {
    display: none;
  }

  .mobile-bottom-nav button {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 42px;
    place-items: center;
    align-content: center;
    gap: 2px;
    border-radius: 16px;
    background: transparent;
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: var(--type-weight-semibold);
    line-height: 1;
  }

  .mobile-bottom-nav button.active {
    background: var(--bg-selected-soft);
    color: var(--accent);
  }

  .mobile-bottom-nav-icon {
    position: relative;
    display: grid;
    place-items: center;
  }

  .mobile-bottom-nav svg {
    width: 17px;
    height: 17px;
  }

  .mobile-bottom-nav .unread-badge {
    position: absolute;
    top: -6px;
    right: -11px;
  }

  .thread header,
  .agent-drawer-head {
    justify-content: flex-start;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    gap: 6px;
    padding: calc(4px + env(safe-area-inset-top)) 10px 4px;
  }

  .thread header > div,
  .agent-title {
    flex: 1 1 0;
    max-width: 100%;
    min-width: 0;
  }

  .thread-title {
    max-width: calc(100vw - 88px);
    overflow: hidden;
  }

  .thread-title-card {
    display: none;
  }

  .thread header .thread-mobile-back,
  .agent-drawer-head .agent-mobile-back {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--panel-strong);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .thread header .thread-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0;
    place-items: center;
    border-radius: 10px;
    background: var(--panel-strong);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .agent-close {
    display: none;
  }

  .agent-drawer-head-actions {
    flex: 0 0 auto;
    gap: 6px;
    margin-left: auto;
  }

  .agent-drawer-head .agent-head-action {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
  }

  .thread h2,
  .agent-drawer-head h2 {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    font-size: var(--type-size-title);
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .thread header p {
    display: none;
  }

  .thread-focus,
  .thread-scroll,
  .thread-scroll .reply-list,
  .thread-root,
  .thread-message-with-avatar,
  .thread-message-content,
  .reply-list article,
  .reply-body,
  .reply-composer {
    max-width: 100%;
    min-width: 0;
  }

  .thread-root {
    margin: 0;
    padding: 8px 12px;
  }

  .thread-message-with-avatar {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .thread-task-card {
    margin: 0 12px 8px;
    padding: 12px;
  }

  .reply-list {
    padding-bottom: 8px;
  }

  .agent-drawer-body {
    --mobile-bottom-clearance: calc(92px + env(safe-area-inset-bottom));
    padding: 12px 12px calc(var(--mobile-bottom-clearance) + 16px);
  }

  .agent-detail-hero {
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: start;
    padding: 14px;
    border-radius: 18px;
  }

  .agent-detail-tabs {
    grid-auto-columns: minmax(112px, 34vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 4px;
    scroll-padding-inline: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .agent-detail-tabs::-webkit-scrollbar {
    display: none;
  }

  .agent-detail-tab {
    min-height: 52px;
    scroll-snap-align: start;
  }

  .agent-detail-panel.panel-activity {
    overflow: hidden;
  }

  .agent-drawer .live-activity-section {
    min-height: 0;
  }

  .agent-drawer .activity-run-list {
    gap: 12px;
    padding: 2px 0 10px;
  }

  .agent-drawer .activity-run-card {
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .agent-drawer .activity-run-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .agent-drawer .activity-run-head h5,
  .agent-drawer .activity-run-head p {
    white-space: normal;
  }

  .agent-drawer .activity-run-head button {
    justify-self: end;
  }

  .agent-drawer .activity-run-step {
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 4px 10px;
    padding: 10px 0;
  }

  .agent-drawer .activity-run-step time {
    grid-column: 2;
    grid-row: 1;
    padding-top: 0;
    text-align: left;
  }

  .agent-drawer .activity-run-step .activity-dot {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-top: 4px;
  }

  .agent-drawer .activity-run-step .activity-dot::after {
    height: calc(100% + 60px);
  }

  .agent-drawer .activity-run-step:last-child .activity-dot::after {
    display: none;
  }

  .agent-drawer .activity-run-step .activity-timeline-body {
    grid-column: 2;
    grid-row: 2;
    overflow: visible;
  }

  .agent-drawer .activity-timeline-title {
    flex-wrap: wrap;
    gap: 5px 7px;
  }

  .agent-drawer .activity-timeline-title strong {
    flex: 1 1 100%;
    white-space: normal;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .agent-drawer .activity-structure-line,
  .agent-drawer .activity-metadata {
    flex-wrap: wrap;
    overflow: visible;
  }

  .agent-drawer .activity-structure-line span,
  .agent-drawer .activity-metadata span {
    max-width: min(100%, 180px);
  }

  .agent-drawer .activity-timeline-body p {
    -webkit-line-clamp: 2;
  }

  .detail-grid,
  .performance-grid {
    grid-template-columns: 1fr;
  }

  .search-panel,
  .activity-feed-panel,
  .reminder-panel,
  .thread-browser-panel {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .search-backdrop {
    padding: 0;
    place-items: stretch;
    background: #fff;
    backdrop-filter: none;
  }

  .search-panel {
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #fff;
  }

  .search-mobile-top-back {
    display: grid;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 13px;
    background: var(--panel-strong);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .search-panel-head {
    order: 4;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 64px;
    padding: 10px 12px calc(92px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
  }

  .search-mobile-back {
    display: none;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 13px;
    background: var(--panel-strong);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .search-input-icon {
    display: none;
  }

  .search-panel-head input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f6f7f9;
    font-size: var(--type-size-control);
  }

  .search-clear {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .search-filters {
    order: 1;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    background: #fff;
  }

  .search-filter-group {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .search-filter-group button,
  .search-time-filter {
    min-height: 36px;
    padding: 8px 11px;
    white-space: nowrap;
  }

  .search-time-filter {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .search-panel-body {
    order: 2;
    padding: 12px;
    background: #fff;
  }

  .search-empty {
    min-height: 56dvh;
    padding: 24px 14px;
  }

  .search-result-group {
    margin-bottom: 18px;
  }

  .search-result-list button {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 14px;
    border-radius: 16px;
  }

  .search-kind {
    justify-self: start;
  }

  .activity-feed-head {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }

  .activity-feed-head h2 {
    font-size: var(--type-size-display);
  }

  .activity-feed-head p {
    font-size: var(--type-size-meta);
  }

  .activity-feed-head-actions {
    gap: 6px;
  }

  .activity-feed-mark-all,
  .activity-feed-dismiss-all {
    grid-column: auto;
    width: auto;
    height: 40px;
    padding: 0 10px;
    white-space: nowrap;
    font-size: var(--type-size-meta);
  }

  .activity-feed-filters {
    gap: 8px;
    padding: 10px 12px;
  }

  .activity-feed-filters button {
    height: 36px;
    padding: 0 12px;
  }

  .activity-feed-body {
    gap: 10px;
    padding: 12px 12px 118px;
    background: var(--activity-feed-mobile-bg);
  }

  .activity-feed-new-activity {
    padding: 0 0 2px;
  }

  .activity-feed-new-activity button {
    min-height: 36px;
    padding: 8px 14px;
  }

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

  .activity-feed-row-shell {
    padding: 0;
    border-radius: 16px;
    background: var(--activity-feed-mobile-bg);
    touch-action: pan-y;
  }

  .activity-feed-row-shell.swiping {
    background: var(--activity-feed-mobile-bg);
  }

  .activity-feed-swipe-action {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: grid;
    width: calc(-1 * var(--activity-feed-swipe-x));
    min-width: 0;
    max-width: 104px;
    overflow: hidden;
    place-items: center;
    align-content: center;
    gap: 4px;
    border-radius: 0 16px 16px 0;
    background: var(--activity-feed-swipe-bg);
    color: var(--activity-feed-swipe-ink);
    font-size: var(--type-size-caption);
    font-weight: var(--type-weight-semibold);
    opacity: clamp(0, calc(-1 * var(--activity-feed-swipe-x) / 72), 1);
    pointer-events: none;
  }

  .activity-feed-swipe-action svg,
  .activity-feed-swipe-action span {
    opacity: clamp(0, calc((-1 * var(--activity-feed-swipe-x) - 32) / 48), 1);
    transform: translateX(calc(max(0px, 52px + var(--activity-feed-swipe-x)) / 2));
  }

  .activity-feed-row {
    grid-template-areas:
      "avatar main action";
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: var(--activity-feed-mobile-bg);
    box-shadow: none;
    transform: translateX(var(--activity-feed-swipe-x));
    transition: transform 160ms ease;
  }

  .activity-feed-row-shell.swiping .activity-feed-row {
    transition: none;
  }

  .activity-feed-row-avatar {
    grid-area: avatar;
    min-width: 0;
  }

  .activity-feed-row-main {
    grid-area: main;
  }

  .activity-feed-row-meta {
    flex-wrap: wrap;
    overflow: hidden;
    gap: 5px 8px;
  }

  .activity-feed-row-meta em,
  .activity-feed-row-meta time {
    flex: 0 0 auto;
  }

  .activity-feed-row h3 {
    margin-top: 5px;
  }

  .activity-feed-row p {
    margin-top: 5px;
  }

  .activity-feed-row-actions {
    grid-area: action;
    align-self: start;
  }

  .activity-feed-unread-dot {
    display: block;
  }

  .activity-feed-check {
    display: none;
  }

  .activity-feed-dismiss {
    display: none;
  }

  .activity-feed-check,
  .activity-feed-dismiss {
    width: 40px;
    height: 40px;
  }

  :root[data-theme="dark"] .search-backdrop,
  :root[data-theme="dark"] .search-panel,
  :root[data-theme="dark"] .search-panel-head,
  :root[data-theme="dark"] .search-filters,
  :root[data-theme="dark"] .search-panel-body {
    background: var(--bg-panel);
  }

  :root[data-theme="dark"] .search-panel-head input {
    border-color: var(--border-subtle);
    background: var(--bg-input);
  }

  .message-action-menu {
    right: 12px;
    left: 12px !important;
    width: auto;
    min-width: 0;
  }

  /* Mobile: drop modal backdrop blur — full-viewport backdrop-filter forces
     a fresh composite every commit, which makes state flips inside the modal
     (e.g. ChannelAgentsModal Add → Added chip) feel ~1.5s slow on iOS/Android
     WKWebView even though React state updates instantly. Desktop keeps the
     frosted look. */
  .modal-backdrop {
    background: var(--modal-mobile-backdrop-bg);
    backdrop-filter: none;
  }

  .modal-card {
    border-color: var(--modal-mobile-card-border);
  }
}
